Modifiche al 01/02/97 per Beta4
git-svn-id: svn://10.65.10.50/trunk@4113 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
1ea856efbb
commit
c6e62a9f9e
@ -19,3 +19,5 @@
|
|||||||
#define F_CONTOA 119
|
#define F_CONTOA 119
|
||||||
#define F_SOTTOA 120
|
#define F_SOTTOA 120
|
||||||
#define F_DESCRCONTOA 121
|
#define F_DESCRCONTOA 121
|
||||||
|
#define F_TIPORIGA 122
|
||||||
|
#define F_DESCRRIGA 123
|
||||||
|
@ -159,7 +159,7 @@ END
|
|||||||
STRING F_NCAMPOCAL1 50
|
STRING F_NCAMPOCAL1 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 17 13 ""
|
PROMPT 17 13 ""
|
||||||
USE %FRD
|
USE %FRD KEY 2
|
||||||
INPUT S0 F_NCAMPOCAL1
|
INPUT S0 F_NCAMPOCAL1
|
||||||
DISPLAY "Descrizione@50" S0
|
DISPLAY "Descrizione@50" S0
|
||||||
DISPLAY "Codice " CODTAB
|
DISPLAY "Codice " CODTAB
|
||||||
@ -295,4 +295,27 @@ BEGIN
|
|||||||
ADD RUN CG0 -0
|
ADD RUN CG0 -0
|
||||||
END
|
END
|
||||||
|
|
||||||
|
STRING F_TIPORIGA 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 19 "Tipo riga "
|
||||||
|
FIELD S8
|
||||||
|
FLAGS "U"
|
||||||
|
USE %TRI SELECT S7=="S"
|
||||||
|
INPUT CODTAB F_TIPORIGA
|
||||||
|
DISPLAY "Codice" CODTAB
|
||||||
|
DISPLAY "Descrizione@50" S0
|
||||||
|
OUTPUT F_TIPORIGA CODTAB
|
||||||
|
OUTPUT F_DESCRRIGA S0
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DESCRRIGA 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 17 20 ""
|
||||||
|
USE %TRI KEY 2 SELECT S7=="S"
|
||||||
|
INPUT S0 F_DESCRRIGA
|
||||||
|
COPY DISPLAY F_TIPORIGA
|
||||||
|
COPY OUTPUT F_TIPORIGA
|
||||||
|
END
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
@ -6,3 +6,4 @@
|
|||||||
#define F_DESCAUS 106
|
#define F_DESCAUS 106
|
||||||
#define F_NCOPIE 107
|
#define F_NCOPIE 107
|
||||||
#define F_RIFERIMENTO 108
|
#define F_RIFERIMENTO 108
|
||||||
|
#define F_SPESEAUT 109
|
||||||
|
@ -98,6 +98,11 @@ BEGIN
|
|||||||
CHECKTYPE NORMAL
|
CHECKTYPE NORMAL
|
||||||
END
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_SPESEAUT
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 15 "Addebito automatico spese cliente"
|
||||||
|
FIELD B0
|
||||||
|
END
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
@ -26,6 +26,9 @@
|
|||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __VEINI_H
|
||||||
|
#include "veini.h"
|
||||||
|
#endif
|
||||||
HIDDEN const real CENTO(100.0);
|
HIDDEN const real CENTO(100.0);
|
||||||
|
|
||||||
bool TCond_vendita::set_sconto( const char * exp, bool signal )
|
bool TCond_vendita::set_sconto( const char * exp, bool signal )
|
||||||
@ -319,13 +322,10 @@ void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
|
|||||||
anamag().put("CODART", codriga);
|
anamag().put("CODART", codriga);
|
||||||
if (anamag().read() != NOERR)
|
if (anamag().read() != NOERR)
|
||||||
{
|
{
|
||||||
// if (full_load)
|
|
||||||
// {
|
|
||||||
set_prezzo(ZERO);
|
set_prezzo(ZERO);
|
||||||
set_sconto("");
|
set_sconto("");
|
||||||
set_iva("");
|
set_iva("");
|
||||||
set_provv(ZERO);
|
set_provv(ZERO);
|
||||||
// }
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -353,29 +353,18 @@ void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
|
|||||||
_load_mask = !load_um_only && !load_scagl_only;
|
_load_mask = !load_um_only && !load_scagl_only;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
// if (full_load)
|
|
||||||
set_prezzo(umart().get_real("PREZZO"));
|
set_prezzo(umart().get_real("PREZZO"));
|
||||||
|
|
||||||
|
|
||||||
// if (full_load)
|
|
||||||
// {
|
|
||||||
if (_ivarid)
|
if (_ivarid)
|
||||||
set_iva(anamag().get("CODIVAR"));
|
set_iva(anamag().get("CODIVAR"));
|
||||||
else
|
else
|
||||||
set_iva(anamag().get("CODIVA"));
|
set_iva(anamag().get("CODIVA"));
|
||||||
// }
|
|
||||||
|
|
||||||
const char gestione = config_ditta().get_char( "GESSCORIGA", "ve" );
|
const char gestione = config_ditta().get_char( "GESSCORIGA", "ve" );
|
||||||
const bool sco_scagl = config_ditta().get_bool("GESCOSCA", "ve");
|
const bool sco_scagl = config_ditta().get_bool("GESCOSCA", "ve");
|
||||||
const bool sco_um_gest = config_ditta().get_bool("GESSCORIGAUM", "ve");
|
const bool sco_um_gest = config_ditta().get_bool("GESSCORIGAUM", "ve");
|
||||||
|
|
||||||
// if (!full_load && gestione != 'A' && !sco_scagl)
|
|
||||||
// {
|
|
||||||
// if (gestione == 'L' && found_condv)
|
|
||||||
// set_sconto(_rcondv.get("SCONTO"));
|
|
||||||
//}
|
|
||||||
// else
|
|
||||||
{
|
|
||||||
switch (gestione)
|
switch (gestione)
|
||||||
{
|
{
|
||||||
case 'N':
|
case 'N':
|
||||||
@ -474,7 +463,6 @@ void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
|
|||||||
error_box("Tipo di gestione sconti '%c' non valido!", gestione );
|
error_box("Tipo di gestione sconti '%c' non valido!", gestione );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
if (_riga && _riga->id2pos(FR_PERCPROV) >= 0 && _riga->field(FR_PERCPROV).active())
|
if (_riga && _riga->id2pos(FR_PERCPROV) >= 0 && _riga->field(FR_PERCPROV).active())
|
||||||
{
|
{
|
||||||
@ -492,13 +480,6 @@ void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
|
|||||||
if (tipoprovv <= ' ')
|
if (tipoprovv <= ' ')
|
||||||
tipoprovv = config_ditta().get_char( "AGETIPOPERC", "ve" );
|
tipoprovv = config_ditta().get_char( "AGETIPOPERC", "ve" );
|
||||||
|
|
||||||
// if (!full_load)
|
|
||||||
// {
|
|
||||||
// if (tipoprovv == 'L' && found_condv)
|
|
||||||
// set_provv(_rcondv.get_real("PERCPROVV"));
|
|
||||||
// }
|
|
||||||
// else
|
|
||||||
{
|
|
||||||
switch (tipoprovv)
|
switch (tipoprovv)
|
||||||
{
|
{
|
||||||
case 'A':
|
case 'A':
|
||||||
@ -541,10 +522,80 @@ void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
if (found_condv)
|
||||||
|
update_omaggi(load_scagl_only);
|
||||||
}
|
}
|
||||||
|
|
||||||
TCond_vendita::TCond_vendita(TCliFor * clifo, TConfig * ditta, TMask * testa, TMask * riga,
|
void TCond_vendita::update_omaggi(bool full)
|
||||||
|
{
|
||||||
|
static TString16 tipo_riga("_");
|
||||||
|
TSheet_field & sh = (TSheet_field &) testa().field(F_SHEET);
|
||||||
|
const int current_doc_row = sh.selected() + 1;
|
||||||
|
TDocumento & doc = testa().doc();
|
||||||
|
bool update = FALSE;
|
||||||
|
|
||||||
|
if (doc[current_doc_row].tipo().tipo() == RIGA_OMAGGI)
|
||||||
|
return;
|
||||||
|
|
||||||
|
if (current_doc_row < doc.rows())
|
||||||
|
{
|
||||||
|
TRiga_documento & r = doc[current_doc_row + 1];
|
||||||
|
|
||||||
|
if (r.tipo().tipo() == RIGA_OMAGGI && r.generata())
|
||||||
|
{
|
||||||
|
doc.destroy_row(current_doc_row + 1, TRUE);
|
||||||
|
sh.destroy(current_doc_row, FALSE);
|
||||||
|
update = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
real qta = _riga->get(FR_QTA);
|
||||||
|
|
||||||
|
if (full || qta != ZERO)
|
||||||
|
{
|
||||||
|
const TString80 codart_omaggio(_rcondv.get("CODARTOM"));
|
||||||
|
|
||||||
|
if (tipo_riga[0] == '_')
|
||||||
|
{
|
||||||
|
TConfig cnf(CONFIG_STUDIO, "ve");
|
||||||
|
tipo_riga = cnf.get("TROMAGGI");
|
||||||
|
}
|
||||||
|
|
||||||
|
if (codart_omaggio.not_empty() && tipo_riga.not_empty())
|
||||||
|
{
|
||||||
|
TRiga_documento & r = doc.insert_row(current_doc_row + 1, tipo_riga);
|
||||||
|
r.set_generata();
|
||||||
|
TString16 codmag(_riga->get(FR_CODMAG)); codmag << _riga->get(FR_CODDEP);
|
||||||
|
r.put("CODMAG", codmag);
|
||||||
|
r.put("CODART", codart_omaggio);
|
||||||
|
anamag().setkey(1);
|
||||||
|
anamag().put("CODART", codart_omaggio);
|
||||||
|
if (anamag().read() == NOERR)
|
||||||
|
r.put("DESCR", anamag().get("DESCR"));
|
||||||
|
r.put("UMQTA", _rcondv.get("UMOM"));
|
||||||
|
|
||||||
|
qta /= _rcondv.get_real("QBASE");
|
||||||
|
qta.floor();
|
||||||
|
qta *= _rcondv.get_real("QOM");
|
||||||
|
r.put("QTA", qta);
|
||||||
|
r.put("PREZZO", _rcondv.get("PROMAGGIO"));
|
||||||
|
const TString16 codiva_cli(_clifo->get(LF_CFVEN, "ASSFIS"));
|
||||||
|
if (codiva_cli.not_empty())
|
||||||
|
r.put("CODIVA", codiva_cli);
|
||||||
|
else
|
||||||
|
r.put("CODIVA", _rcondv.get("CODIVA"));
|
||||||
|
r.put("ADDIVA", _rcondv.get("ADDIVA"));
|
||||||
|
sh.insert(current_doc_row, FALSE);
|
||||||
|
r.autoload(sh);
|
||||||
|
sh.check_row(current_doc_row);
|
||||||
|
update = TRUE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (update)
|
||||||
|
sh.force_update();
|
||||||
|
}
|
||||||
|
|
||||||
|
TCond_vendita::TCond_vendita(TCliFor * clifo, TConfig * ditta, TDocumento_mask * testa, TMask * riga,
|
||||||
TLocalisamfile * anamag, TLocalisamfile * umart)
|
TLocalisamfile * anamag, TLocalisamfile * umart)
|
||||||
: _clifo(clifo), _testa(testa), _riga(riga),
|
: _clifo(clifo), _testa(testa), _riga(riga),
|
||||||
_condv( LF_CONDV ), _rcondv( LF_RCONDV ), _sconti( LF_SCONTI ),
|
_condv( LF_CONDV ), _rcondv( LF_RCONDV ), _sconti( LF_SCONTI ),
|
||||||
|
13
ve/sconti.h
13
ve/sconti.h
@ -9,8 +9,8 @@
|
|||||||
#include "tclifor.h"
|
#include "tclifor.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __MASK_H
|
#ifndef __VELIB01_H
|
||||||
#include <mask.h>
|
#include "velib01.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifndef __CONFIG_H
|
#ifndef __CONFIG_H
|
||||||
@ -32,7 +32,7 @@ class TCond_vendita : public TObject
|
|||||||
TLocalisamfile _sconti;
|
TLocalisamfile _sconti;
|
||||||
TLocalisamfile * _umart;
|
TLocalisamfile * _umart;
|
||||||
TConfig * _config_ditta;
|
TConfig * _config_ditta;
|
||||||
TMask * _testa;
|
TDocumento_mask * _testa;
|
||||||
TMask * _riga;
|
TMask * _riga;
|
||||||
bool _load_mask;
|
bool _load_mask;
|
||||||
|
|
||||||
@ -42,9 +42,10 @@ protected:
|
|||||||
void set_prezzo(const real & prezzo,const char * val_rif = "");
|
void set_prezzo(const real & prezzo,const char * val_rif = "");
|
||||||
void set_provv(const real & provv);
|
void set_provv(const real & provv);
|
||||||
void set_iva(const TString & codiva);
|
void set_iva(const TString & codiva);
|
||||||
|
void update_omaggi(bool full);
|
||||||
|
|
||||||
TConfig & config_ditta() const { CHECK(_config_ditta, "Configurazione ditta non inizializzata"); return * _config_ditta; }
|
TConfig & config_ditta() const { CHECK(_config_ditta, "Configurazione ditta non inizializzata"); return * _config_ditta; }
|
||||||
TMask & testa() const { CHECK(_testa, "Maschera testata non inizializzata"); return * _testa; }
|
TDocumento_mask & testa() const { CHECK(_testa, "Maschera testata non inizializzata"); return * _testa; }
|
||||||
TMask & riga() const { CHECK(_testa, "Maschera testata non inizializzata"); return * _riga; }
|
TMask & riga() const { CHECK(_testa, "Maschera testata non inizializzata"); return * _riga; }
|
||||||
TLocalisamfile & anamag() const { CHECK(_anamag, "Anagrafica di magazzino non inizializzata") ; return *_anamag; }
|
TLocalisamfile & anamag() const { CHECK(_anamag, "Anagrafica di magazzino non inizializzata") ; return *_anamag; }
|
||||||
TLocalisamfile & umart() const { CHECK(_umart, "Anagrafica di unita' di misura magazzino non inizializzata") ; return *_umart; }
|
TLocalisamfile & umart() const { CHECK(_umart, "Anagrafica di unita' di misura magazzino non inizializzata") ; return *_umart; }
|
||||||
@ -59,14 +60,14 @@ public:
|
|||||||
const TString & get_iva() const { return _codiva; }
|
const TString & get_iva() const { return _codiva; }
|
||||||
|
|
||||||
void set_config( TConfig * ditta){ _config_ditta = ditta; }
|
void set_config( TConfig * ditta){ _config_ditta = ditta; }
|
||||||
void set_testa( TMask * testa ){ _testa = testa; }
|
void set_testa( TDocumento_mask * testa ){ _testa = testa; }
|
||||||
void set_riga( TMask * riga ){ _riga = riga; }
|
void set_riga( TMask * riga ){ _riga = riga; }
|
||||||
void set_anamag(TLocalisamfile & anamag) { _anamag = &anamag; }
|
void set_anamag(TLocalisamfile & anamag) { _anamag = &anamag; }
|
||||||
void set_umart(TLocalisamfile & umart) { _umart = &umart; }
|
void set_umart(TLocalisamfile & umart) { _umart = &umart; }
|
||||||
void ricerca(bool load_um_only = FALSE, bool load_scagl_only = FALSE);
|
void ricerca(bool load_um_only = FALSE, bool load_scagl_only = FALSE);
|
||||||
bool gestum() const { return _condv.get_bool("GESTUM"); }
|
bool gestum() const { return _condv.get_bool("GESTUM"); }
|
||||||
|
|
||||||
TCond_vendita(TCliFor * clifo = NULL, TConfig * _ditta = NULL, TMask * testa = NULL, TMask * riga = NULL,
|
TCond_vendita(TCliFor * clifo = NULL, TConfig * _ditta = NULL, TDocumento_mask * testa = NULL, TMask * riga = NULL,
|
||||||
TLocalisamfile * anamag = NULL, TLocalisamfile * umart = NULL);
|
TLocalisamfile * anamag = NULL, TLocalisamfile * umart = NULL);
|
||||||
~TCond_vendita() {}
|
~TCond_vendita() {}
|
||||||
};
|
};
|
||||||
|
@ -23,6 +23,14 @@
|
|||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __VEINI_H
|
||||||
|
#include "veini.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __VELIB01_H
|
||||||
|
#include <velib01.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
const TString& TData_picker::get( const TString& table, const TString& codtab, const TString& field )
|
const TString& TData_picker::get( const TString& table, const TString& codtab, const TString& field )
|
||||||
{
|
{
|
||||||
TTable tab(table);
|
TTable tab(table);
|
||||||
@ -182,7 +190,6 @@ void TCliForVendite::update_mask( TMask& m, bool onload )
|
|||||||
stato = get( LF_CLIFO, "STATOCF" );
|
stato = get( LF_CLIFO, "STATOCF" );
|
||||||
m.set( F_STATOCF, stato );
|
m.set( F_STATOCF, stato );
|
||||||
}
|
}
|
||||||
// m.set( F_DESSTATOCF, get( "%STA", stato, "S0" ) );
|
|
||||||
const TString16 newcodval(m.get(F_CODVAL));
|
const TString16 newcodval(m.get(F_CODVAL));
|
||||||
const TString16 newdatacambio(m.get(F_DATACAMBIO1));
|
const TString16 newdatacambio(m.get(F_DATACAMBIO1));
|
||||||
|
|
||||||
@ -227,10 +234,12 @@ void TCliForVendite::update_mask( TMask& m, bool onload )
|
|||||||
m.enable(F_CODCONT1, contr_enabled && gescontr);
|
m.enable(F_CODCONT1, contr_enabled && gescontr);
|
||||||
m.enable(F_CODCONT, contr_enabled && gescontr);
|
m.enable(F_CODCONT, contr_enabled && gescontr);
|
||||||
|
|
||||||
// imposta_dati_comune( m );
|
if (!onload)
|
||||||
|
{
|
||||||
imposta_indirizzo_spedizione( m );
|
imposta_indirizzo_spedizione( m );
|
||||||
imposta_sconto_testa( m );
|
imposta_sconto_testa( m );
|
||||||
// imposta_valuta( m );
|
imposta_spese(m);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCliFor::edita_occasionale( )
|
void TCliFor::edita_occasionale( )
|
||||||
@ -259,26 +268,6 @@ bool TCliFor::occas_code_handler(TMask_field& f, KEY key)
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCliForVendite::imposta_dati_comune( TMask& m )
|
|
||||||
{
|
|
||||||
TLocalisamfile comuni(LF_COMUNI);
|
|
||||||
comuni.setkey( 1 );
|
|
||||||
if( occasionale( ) )
|
|
||||||
{
|
|
||||||
comuni.put( "COM", occas_mask( ).get( O_COMUNE ));
|
|
||||||
comuni.put( "STATO", occas_mask( ).get( O_STATO ) );
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
comuni.put( "COM", get( LF_CLIFO, "COMCF" ));
|
|
||||||
comuni.put( "STATO", get( LF_CLIFO, "STATOCF" ) );
|
|
||||||
}
|
|
||||||
if (comuni.read() != NOERR)
|
|
||||||
comuni.zero();
|
|
||||||
m.set( F_DENCOM, comuni.get( "DENCOM" ) );
|
|
||||||
m.set( F_PROVCOM, comuni.get( "PROVCOM" ) );
|
|
||||||
}
|
|
||||||
|
|
||||||
void TCliForVendite::imposta_indirizzo_spedizione( TMask& m )
|
void TCliForVendite::imposta_indirizzo_spedizione( TMask& m )
|
||||||
{
|
{
|
||||||
TString16 stato;
|
TString16 stato;
|
||||||
@ -360,36 +349,22 @@ void TCliForVendite::imposta_sconto_testa( TMask& m )
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TCliForVendite::imposta_valuta( TMask& m )
|
void TCliForVendite::imposta_spese( TMask& m )
|
||||||
{
|
{
|
||||||
|
TSheet_field & sh = (TSheet_field &) m.field(F_SHEET);
|
||||||
|
TDocumento & doc = app().doc();
|
||||||
|
|
||||||
TConfig & ditta = app().config_ditta();
|
TString16 name("CODSP0");
|
||||||
|
TString_array spese;
|
||||||
|
for (int i = 1; i <= 4; i++)
|
||||||
|
{
|
||||||
|
name.rtrim(1); name << i;
|
||||||
|
const TString16 s(get(LF_CFVEN, name));
|
||||||
|
|
||||||
if( ditta.get_bool( "GESVALAC", "ve" ) )
|
if (s.not_empty())
|
||||||
{
|
spese.add(s);
|
||||||
TTable cambi( "CAM" );
|
|
||||||
cambi.zero( );
|
|
||||||
TString16 val( m.get( F_CODVAL ) );
|
|
||||||
TString16 codtab( ( const char * ) val );
|
|
||||||
codtab << m.get( F_DATADOC );
|
|
||||||
cambi.put( "CODTAB", codtab );
|
|
||||||
const int result = cambi.read( _isgteq );
|
|
||||||
if( result == _iseof )
|
|
||||||
cambi.prev( );
|
|
||||||
codtab = cambi.get( "CODTAB" );
|
|
||||||
if ( codtab.sub( 0, 2 ) == val )
|
|
||||||
{
|
|
||||||
m.set( F_CAMBIO, cambi.get( "R10" ) );
|
|
||||||
m.set( F_DATACAMBIO1, cambi.get( "D0" ) );
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
TTable valuta( "%VAL" );
|
|
||||||
valuta.zero( );
|
|
||||||
valuta.put( "CODTAB", m.get( F_CODVAL ) );
|
|
||||||
if( valuta.read( ) == NOERR )
|
|
||||||
{
|
|
||||||
m.set( F_CAMBIO, valuta.get( "R10" ) );
|
|
||||||
m.set( F_DATACAMBIO, valuta.get( "D0" ) );
|
|
||||||
}
|
}
|
||||||
|
m.autosave(*app().get_relation());
|
||||||
|
doc.update_spese_aut(spese, FALSE, &sh);
|
||||||
|
sh.force_update();
|
||||||
}
|
}
|
||||||
|
@ -55,10 +55,9 @@ class TCliForVendite : public TCliFor
|
|||||||
public:
|
public:
|
||||||
|
|
||||||
void update_mask( TMask& m, bool onload = FALSE );
|
void update_mask( TMask& m, bool onload = FALSE );
|
||||||
void imposta_dati_comune( TMask& m );
|
|
||||||
void imposta_valuta( TMask& m );
|
|
||||||
void imposta_indirizzo_spedizione( TMask& m );
|
void imposta_indirizzo_spedizione( TMask& m );
|
||||||
void imposta_sconto_testa( TMask& m );
|
void imposta_sconto_testa( TMask& m );
|
||||||
|
void imposta_spese( TMask& m );
|
||||||
|
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -52,9 +52,9 @@ void TMotore_application::init_insert_mode( TMask& m )
|
|||||||
|
|
||||||
if (pos >= 0 && m.fld(pos).active())
|
if (pos >= 0 && m.fld(pos).active())
|
||||||
m.fld(pos).set(data_doc);
|
m.fld(pos).set(data_doc);
|
||||||
|
m.disable(DLG_PRINT);
|
||||||
clifo( ).occas_mask( ).reset( );
|
clifo( ).occas_mask( ).reset( );
|
||||||
const int ndefaults = pro( ).get_int( "NDEFAULTS", "DEFAULT" ); // prof
|
const int ndefaults = pro( ).get_int( "NDEFAULTS", "DEFAULT" ); // prof
|
||||||
TMask & emask = edit_mask();
|
|
||||||
|
|
||||||
for( int i = 1; i <= ndefaults; i++ )
|
for( int i = 1; i <= ndefaults; i++ )
|
||||||
{
|
{
|
||||||
@ -63,10 +63,15 @@ void TMotore_application::init_insert_mode( TMask& m )
|
|||||||
TToken_string valore( pro( ).get( chiave, "DEFAULT" ) );
|
TToken_string valore( pro( ).get( chiave, "DEFAULT" ) );
|
||||||
int campo( valore.get_int( 0 ) );
|
int campo( valore.get_int( 0 ) );
|
||||||
TString default_val( valore.get( 1 ) );
|
TString default_val( valore.get( 1 ) );
|
||||||
emask.set( campo, default_val, TRUE );
|
m.set( campo, default_val, TRUE );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TMotore_application::init_modify_mode( TMask& m )
|
||||||
|
{
|
||||||
|
m.enable(DLG_PRINT);
|
||||||
|
}
|
||||||
|
|
||||||
void TMotore_application::update_profile()
|
void TMotore_application::update_profile()
|
||||||
{
|
{
|
||||||
TFilename fn(_doc->tipo().profile_name());
|
TFilename fn(_doc->tipo().profile_name());
|
||||||
@ -133,19 +138,34 @@ bool TMotore_application::ss_handler( TSheet_field& ss, int r, KEY key )
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
if ( key == K_DEL ) // Cancellazione
|
if ( key == K_DEL ) // Cancellazione
|
||||||
|
{
|
||||||
app()._doc->destroy_row(r + 1, TRUE);
|
app()._doc->destroy_row(r + 1, TRUE);
|
||||||
|
if (r < app()._doc->rows())
|
||||||
|
{
|
||||||
|
TRiga_documento & riga = (*(app()._doc))[r + 1];
|
||||||
|
if (riga.tipo().tipo() == RIGA_OMAGGI && riga.generata())
|
||||||
|
{
|
||||||
|
ss.destroy(r + 1);
|
||||||
|
app()._doc->destroy_row(r + 1, TRUE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
else
|
else
|
||||||
if (key == K_INS) // Inserimento
|
if (key == K_INS) // Inserimento
|
||||||
{
|
{
|
||||||
|
if (r < app()._doc->rows())
|
||||||
|
{
|
||||||
|
TRiga_documento & riga = (*(app()._doc))[r + 1];
|
||||||
|
if (riga.tipo().tipo() == RIGA_OMAGGI && riga.generata())
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
TMask & emask = app().edit_mask();
|
TMask & emask = app().edit_mask();
|
||||||
|
|
||||||
app()._doc->insert_row(r + 1, emask.get( F_LBTIPORIGA ));
|
app()._doc->insert_row(r + 1, emask.get( F_LBTIPORIGA ));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (key == K_CTRL + K_INS)
|
if (key == K_CTRL + K_INS)
|
||||||
{
|
{
|
||||||
TRiga_documento & riga = (*(app()._doc))[r + 1];
|
TRiga_documento & riga = (*(app()._doc))[r + 1];
|
||||||
|
|
||||||
TString16 s(app()._clifor->get(LF_CFVEN, "CODMAG"));
|
TString16 s(app()._clifor->get(LF_CFVEN, "CODMAG"));
|
||||||
|
|
||||||
s << app()._clifor->get(LF_CFVEN, "CODDEP");
|
s << app()._clifor->get(LF_CFVEN, "CODDEP");
|
||||||
@ -225,6 +245,28 @@ bool TMotore_application::elabora_handler( TMask_field& f, KEY key )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool TMotore_application::print_handler( TMask_field& f, KEY key )
|
||||||
|
|
||||||
|
{
|
||||||
|
if (key == K_SPACE)
|
||||||
|
{
|
||||||
|
TMask& m = f.mask();
|
||||||
|
|
||||||
|
if (app().save(TRUE)) // Registra il record corrente
|
||||||
|
{
|
||||||
|
TString commandline("ve1 -0 ");
|
||||||
|
|
||||||
|
commandline << m.get( F_CODNUM ) << " " << m.get( F_ANNO ) << " ";
|
||||||
|
commandline << m.get( F_PROVV )<< " " << m.get( F_NDOC );
|
||||||
|
|
||||||
|
TExternal_app interattivo( commandline );
|
||||||
|
|
||||||
|
interattivo.run( );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
bool TMotore_application::occas_handler( TMask_field& f, KEY key )
|
bool TMotore_application::occas_handler( TMask_field& f, KEY key )
|
||||||
@ -407,7 +449,9 @@ TMask* TMotore_application::get_mask( int mode )
|
|||||||
msk1->set_handler( F_CODPAG, condpag_hndl );
|
msk1->set_handler( F_CODPAG, condpag_hndl );
|
||||||
msk1->set_handler( F_DATAINSC, condpag_hndl );
|
msk1->set_handler( F_DATAINSC, condpag_hndl );
|
||||||
msk1->set_handler( F_CODNOTE, note_hndl );
|
msk1->set_handler( F_CODNOTE, note_hndl );
|
||||||
// _msk1->set_handler( 99, elabora_handler );
|
msk1->set_handler( F_DATADOC, data_hndl );
|
||||||
|
msk1->set_handler( 99, elabora_handler );
|
||||||
|
msk1->set_handler( DLG_PRINT, print_handler );
|
||||||
int numhandler = pro( ).get_int( "NHANDLER", "HANDLERS" ); // prof
|
int numhandler = pro( ).get_int( "NHANDLER", "HANDLERS" ); // prof
|
||||||
for ( i = 1; i <= numhandler; i ++ )
|
for ( i = 1; i <= numhandler; i ++ )
|
||||||
{
|
{
|
||||||
@ -509,14 +553,6 @@ void TMotore_application::set_descr( int i, const char * dfi )
|
|||||||
r.add( dfi, 0 );
|
r.add( dfi, 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
void TMotore_application::carica_righe_libere( int from )
|
|
||||||
{
|
|
||||||
if ( from < 0 ) from = ss( ).items( );
|
|
||||||
for ( int i = from; i < 20; i++ )
|
|
||||||
set_descr( i, "" );
|
|
||||||
ss( ).force_update( );
|
|
||||||
}
|
|
||||||
|
|
||||||
const char* TMotore_application::get_next_key( )
|
const char* TMotore_application::get_next_key( )
|
||||||
{
|
{
|
||||||
TToken_string key;
|
TToken_string key;
|
||||||
@ -573,11 +609,13 @@ int TMotore_application::read( TMask& m )
|
|||||||
const int rows = _doc->rows();
|
const int rows = _doc->rows();
|
||||||
for (int i = 1; i <= rows; i++)
|
for (int i = 1; i <= rows; i++)
|
||||||
{
|
{
|
||||||
|
f.insert(-1, FALSE);
|
||||||
TToken_string & r = f.row(i -1);
|
TToken_string & r = f.row(i -1);
|
||||||
TRiga_documento & rec = (*_doc)[i];
|
TRiga_documento & rec = (*_doc)[i];
|
||||||
|
|
||||||
rec.autoload(f);
|
rec.autoload(f);
|
||||||
f.post_insert(i - 1);
|
f.check_row(i - 1);
|
||||||
|
// f.post_insert(i - 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
|
13
ve/ve0100.h
13
ve/ve0100.h
@ -149,6 +149,7 @@ class TMotore_application : public TRelation_application
|
|||||||
virtual bool changing_mask( int mode );
|
virtual bool changing_mask( int mode );
|
||||||
virtual void init_query_mode(TMask& m);
|
virtual void init_query_mode(TMask& m);
|
||||||
virtual void init_insert_mode( TMask& m );
|
virtual void init_insert_mode( TMask& m );
|
||||||
|
virtual void init_modify_mode( TMask& m );
|
||||||
virtual int read( TMask& m );
|
virtual int read( TMask& m );
|
||||||
virtual bool remove( void );
|
virtual bool remove( void );
|
||||||
virtual int write( const TMask& m );
|
virtual int write( const TMask& m );
|
||||||
@ -177,16 +178,9 @@ protected:
|
|||||||
void read_rdoc( TMask& m );
|
void read_rdoc( TMask& m );
|
||||||
void update_profile();
|
void update_profile();
|
||||||
|
|
||||||
|
|
||||||
// formato dipendente dallo sheet ( sono le varie colonne )
|
|
||||||
// void load_riga( TSheet_field& f, int numrig, TRectype& r );
|
|
||||||
|
|
||||||
void save( TRelation* r ) const;
|
|
||||||
void set_descr ( int numrig, const char* descr );
|
void set_descr ( int numrig, const char* descr );
|
||||||
void carica_righe_libere( int from = -1 );
|
|
||||||
|
|
||||||
// Procedure e funzioni per la gestione degli stati
|
// Procedure e funzioni per la gestione degli stati
|
||||||
// void setta_stato_corrente( int nuovostato );
|
|
||||||
const char* nome_sezione( int op );
|
const char* nome_sezione( int op );
|
||||||
int stato_corrente( );
|
int stato_corrente( );
|
||||||
int stato_finale( int operazione );
|
int stato_finale( int operazione );
|
||||||
@ -209,14 +203,11 @@ protected:
|
|||||||
static bool clifo_handler( TMask_field& f, KEY key );
|
static bool clifo_handler( TMask_field& f, KEY key );
|
||||||
static bool occas_handler( TMask_field& f, KEY key );
|
static bool occas_handler( TMask_field& f, KEY key );
|
||||||
static bool elabora_handler( TMask_field& f, KEY key );
|
static bool elabora_handler( TMask_field& f, KEY key );
|
||||||
|
static bool print_handler( TMask_field& f, KEY key );
|
||||||
|
|
||||||
// Configurazione dello sheet dato il profilo
|
// Configurazione dello sheet dato il profilo
|
||||||
void configura_sheet( TSheet_field& sheet, TConfig& config );
|
void configura_sheet( TSheet_field& sheet, TConfig& config );
|
||||||
|
|
||||||
// Funzione per la sostituzione delle variabili nella decodifica
|
|
||||||
// delle espressioni di una riga
|
|
||||||
void carica_variabile( TExpression& e, const char * varname, TRectype r );
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
virtual TRelation* get_relation( ) const { return _rel;}
|
virtual TRelation* get_relation( ) const { return _rel;}
|
||||||
|
@ -184,4 +184,31 @@ END
|
|||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
|
PAGE "Gestione omaggi" 1 1 60 14
|
||||||
|
|
||||||
|
STRING F_TIPORIGAOM 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 2 "Tipo riga per omaggi "
|
||||||
|
FIELD TROMAGGI
|
||||||
|
FLAGS "U"
|
||||||
|
USE %TRI SELECT S7=="O"
|
||||||
|
INPUT CODTAB F_TIPORIGAOM
|
||||||
|
DISPLAY "Codice" CODTAB
|
||||||
|
DISPLAY "Descrizione@50" S0
|
||||||
|
OUTPUT F_TIPORIGAOM CODTAB
|
||||||
|
OUTPUT F_DESCRRIGAOM S0
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING F_DESCRRIGAOM 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 23 3 ""
|
||||||
|
USE %TRI KEY 2 SELECT S7=="O"
|
||||||
|
INPUT S0 F_DESCRRIGAOM
|
||||||
|
COPY DISPLAY F_TIPORIGAOM
|
||||||
|
COPY OUTPUT F_TIPORIGAOM
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
@ -1162,7 +1162,7 @@ void TMask_generator::genera( const TString& profilo )
|
|||||||
_m->control( T_BOTTONE, DLG_PRINT, 1002 );
|
_m->control( T_BOTTONE, DLG_PRINT, 1002 );
|
||||||
_m->begin( );
|
_m->begin( );
|
||||||
_m->prompt( -45, -1 );
|
_m->prompt( -45, -1 );
|
||||||
_m->message( "EXIT,346" );
|
_m->message( "EXIT,20082" );
|
||||||
_m->end( );
|
_m->end( );
|
||||||
|
|
||||||
_m->control( T_BOTTONE, DLG_CANCEL, 1002 );
|
_m->control( T_BOTTONE, DLG_CANCEL, 1002 );
|
||||||
|
@ -941,7 +941,7 @@ public:
|
|||||||
TDocumento_form& form() { return *_form; }
|
TDocumento_form& form() { return *_form; }
|
||||||
void print_documento();
|
void print_documento();
|
||||||
void print_selected();
|
void print_selected();
|
||||||
TStampaDoc_application() {};
|
TStampaDoc_application() : _key(BY_NUM_KEY) {};
|
||||||
virtual ~TStampaDoc_application() {};
|
virtual ~TStampaDoc_application() {};
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -1146,29 +1146,40 @@ bool TStampaDoc_application::create()
|
|||||||
_firmrel->add(LF_UNLOC,"CODDITTA=CODDITTA"); // si posiziona sulla prima unita' locale della ditta
|
_firmrel->add(LF_UNLOC,"CODDITTA=CODDITTA"); // si posiziona sulla prima unita' locale della ditta
|
||||||
_firmrel->add(LF_COMUNI, "COM=STATORES+COMRES", 1, LF_ANAG, 100+LF_COMUNI);
|
_firmrel->add(LF_COMUNI, "COM=STATORES+COMRES", 1, LF_ANAG, 100+LF_COMUNI);
|
||||||
_firmrel->add(LF_COMUNI, "COM=STATORES+COMRF", 1, LF_ANAG, 200+LF_COMUNI);
|
_firmrel->add(LF_COMUNI, "COM=STATORES+COMRF", 1, LF_ANAG, 200+LF_COMUNI);
|
||||||
int argc = TApplication::argc();
|
const int argc = TApplication::argc();
|
||||||
if (argc>2 && (argc == 8 || argc == 9))
|
|
||||||
|
if (argc>2)
|
||||||
{ // lettura dei parametri iniziali dalla linea di comando
|
{ // lettura dei parametri iniziali dalla linea di comando
|
||||||
_codnum= argv(2); // il primo parametro è il codice di numerazione
|
_codnum= argv(2); // il primo parametro è il codice di numerazione
|
||||||
_anno= atoi(argv(3)); // il secondo è l'anno
|
_anno= atoi(argv(3)); // il secondo è l'anno
|
||||||
_provv= argv(4)[0]; // il terzo è il flag di numerazione provvisoria
|
_provv= argv(4)[0]; // il terzo è il flag di numerazione provvisoria
|
||||||
_dalnum= atol(argv(5)); // il quarto è il numero di documento di partenza
|
_dalnum= atol(argv(5)); // il quarto è il numero di documento di partenza
|
||||||
_alnum= atol(argv(6)); // il quinto è il numero di documento di fine
|
_alnum = _dalnum;
|
||||||
_definitiva= (strcmp(argv(7), "D")==0); // il sesto è se la stampa è definitiva (rinumerazione dei documenti)
|
_definitiva = FALSE;
|
||||||
_ncopie = argc == 9 ? atoi(argv(8)) : 1;
|
_ncopie = 1;
|
||||||
_interattivo= FALSE;
|
_interattivo= FALSE;
|
||||||
print_selected();
|
if (argc > 6)
|
||||||
|
{
|
||||||
|
_alnum= atol(argv(6)); // il quinto è il numero di documento di fine
|
||||||
|
if (argc > 7)
|
||||||
|
{
|
||||||
|
_definitiva= (strcmp(argv(7), "D")==0); // il sesto è se la stampa è definitiva (rinumerazione dei documenti)
|
||||||
|
if (argc > 8)
|
||||||
|
_ncopie = atoi(argv(8));
|
||||||
}
|
}
|
||||||
else if (argc == 2)
|
else _interattivo = TRUE;
|
||||||
|
}
|
||||||
|
print_selected();
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
if (argc == 2)
|
||||||
{ // oppure lancio della maschera
|
{ // oppure lancio della maschera
|
||||||
_interattivo= TRUE;
|
_interattivo= TRUE;
|
||||||
dispatch_e_menu(BAR_ITEM(1));
|
dispatch_e_menu(BAR_ITEM(1));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
return error_box(Usage);
|
||||||
error_box(Usage);
|
|
||||||
return FALSE;
|
|
||||||
}
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -273,7 +273,7 @@ bool TRighe_condizioni_vendita::handle_cod(TMask_field &fld, KEY k) {
|
|||||||
|
|
||||||
const bool enable_gift = _gest_so && condv.get_bool("GESTSCO");
|
const bool enable_gift = _gest_so && condv.get_bool("GESTSCO");
|
||||||
_msk->enable(-1,enable_gift); // abilita il gruppo di campi relativi all'omaggio
|
_msk->enable(-1,enable_gift); // abilita il gruppo di campi relativi all'omaggio
|
||||||
_msk->enable(F_R_UMOM, enable_gift && _gest_um); // abilita il campo "unità di misura art. omaggio"
|
_msk->enable(F_R_UMOM, enable_gift); // abilita il campo "unità di misura art. omaggio"
|
||||||
|
|
||||||
const int mode = _msk->mode();
|
const int mode = _msk->mode();
|
||||||
if (mode == MODE_QUERY || mode == MODE_QUERYINS) // Sostituisce il listbox solo in ricerca...
|
if (mode == MODE_QUERY || mode == MODE_QUERYINS) // Sostituisce il listbox solo in ricerca...
|
||||||
|
@ -112,6 +112,8 @@
|
|||||||
#define F_SPBOIMP6 121
|
#define F_SPBOIMP6 121
|
||||||
#define F_SPBOSCA7 122
|
#define F_SPBOSCA7 122
|
||||||
#define F_SPBOIMP7 123
|
#define F_SPBOIMP7 123
|
||||||
|
#define F_TIPORIGAOM 124
|
||||||
|
#define F_DESCRRIGAOM 125
|
||||||
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
275
ve/velib01.cpp
275
ve/velib01.cpp
@ -57,7 +57,7 @@
|
|||||||
TSpesa_prest::TSpesa_prest(const char* codice, char tipo)
|
TSpesa_prest::TSpesa_prest(const char* codice, char tipo)
|
||||||
: TRectype(LF_TAB)
|
: TRectype(LF_TAB)
|
||||||
{
|
{
|
||||||
settab(tipo == 'S' ? "SPP" : "PRS");
|
settab(tipo == RIGA_SPESE ? "SPP" : "PRS");
|
||||||
if (codice && *codice)
|
if (codice && *codice)
|
||||||
read(codice);
|
read(codice);
|
||||||
}
|
}
|
||||||
@ -195,6 +195,39 @@ bool note_hndl( TMask_field& f, KEY key )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handler per il calcolo delle date di pagamento
|
||||||
|
bool data_hndl( TMask_field& field, KEY key )
|
||||||
|
{
|
||||||
|
TDocumento_mask& m = (TDocumento_mask &) field.mask( );
|
||||||
|
if (key == K_ENTER && field.dirty())
|
||||||
|
{
|
||||||
|
TLocalisamfile doc(LF_DOC);
|
||||||
|
const TDate datadoc(m.get(F_DATADOC));
|
||||||
|
|
||||||
|
doc.curr() = m.doc().head();
|
||||||
|
const TString16 codnum(doc.get("CODNUM"));
|
||||||
|
const int anno = doc.get_int("ANNO");
|
||||||
|
const char tipo_num = doc.get_char("PROVV");
|
||||||
|
|
||||||
|
if (doc.read(_isgreat) == NOERR &&
|
||||||
|
codnum == doc.get("CODNUM") &&
|
||||||
|
anno == doc.get_int("ANNO") &&
|
||||||
|
tipo_num == doc.get_char("PROVV") &&
|
||||||
|
datadoc > doc.get_date("DATADOC"))
|
||||||
|
return field.error_box("Data documento superiore alla data del documento successivo");
|
||||||
|
|
||||||
|
doc.curr() = m.doc().head();
|
||||||
|
doc.read();
|
||||||
|
if (doc.prev() == NOERR &&
|
||||||
|
codnum == doc.get("CODNUM") &&
|
||||||
|
anno == doc.get_int("ANNO") &&
|
||||||
|
tipo_num == doc.get_char("PROVV") &&
|
||||||
|
datadoc < doc.get_date("DATADOC"))
|
||||||
|
return field.error_box("Data documento inferiore alla data del documento precedente");
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
// handler delle righe
|
// handler delle righe
|
||||||
|
|
||||||
HIDDEN void row_set_handler( TMask& m, const int field, const int index )
|
HIDDEN void row_set_handler( TMask& m, const int field, const int index )
|
||||||
@ -228,10 +261,10 @@ HIDDEN bool iva_handler( TMask_field& f, KEY key )
|
|||||||
|
|
||||||
HIDDEN bool codart_handler( TMask_field& f, KEY key )
|
HIDDEN bool codart_handler( TMask_field& f, KEY key )
|
||||||
{
|
{
|
||||||
// Se qualcuno cerca di modificare la maschera
|
|
||||||
if ( key == K_TAB && f.focusdirty())
|
|
||||||
{
|
|
||||||
TMask& row_mask = f.mask();
|
TMask& row_mask = f.mask();
|
||||||
|
|
||||||
|
if (key == K_TAB && (f.focusdirty() || row_mask.get(FR_DESCR).empty()))
|
||||||
|
{
|
||||||
TDocumento_mask & mask = (TDocumento_mask &) row_mask.get_sheet()->mask();
|
TDocumento_mask & mask = (TDocumento_mask &) row_mask.get_sheet()->mask();
|
||||||
TCond_vendita & condv = mask.condv();
|
TCond_vendita & condv = mask.condv();
|
||||||
|
|
||||||
@ -389,26 +422,11 @@ HIDDEN bool qta_handler( TMask_field& f, KEY key )
|
|||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
HIDDEN bool sppr_handler( TMask_field& f, KEY key )
|
HIDDEN void sppr_calc(TRectype & rec, const TString & valuta_doc, const real & cambio, real & prezzo)
|
||||||
{
|
{
|
||||||
if (key == K_TAB && f.focusdirty())
|
const TString16 sppr_valuta(rec.get("S4"));
|
||||||
{
|
|
||||||
TMask& row_mask = f.mask( );
|
|
||||||
const int pos = row_mask.id2pos(FR_PREZZO);
|
|
||||||
|
|
||||||
if (pos >= 0)
|
if (sppr_valuta != valuta_doc && cambio != 0.0)
|
||||||
{
|
|
||||||
TMask & mask = row_mask.get_sheet()->mask();
|
|
||||||
TRectype & spprrec = ((TEdit_field &) row_mask.field(FR_CODART)).browse()->cursor()->file().curr();
|
|
||||||
|
|
||||||
if (spprrec.get("CODTAB") == row_mask.get(FR_CODART) && spprrec.get_char("S6") != 'P')
|
|
||||||
{
|
|
||||||
real cambio = mask.get(F_CAMBIO);
|
|
||||||
real prezzo = row_mask.get(FR_PREZZO);
|
|
||||||
const TString16 doc_valuta(mask.get(F_CODVAL));
|
|
||||||
const TString16 sppr_valuta(spprrec.get("S4"));
|
|
||||||
|
|
||||||
if (sppr_valuta != doc_valuta && cambio != 0.0)
|
|
||||||
{
|
{
|
||||||
TTable val("%VAL");
|
TTable val("%VAL");
|
||||||
|
|
||||||
@ -419,12 +437,33 @@ HIDDEN bool sppr_handler( TMask_field& f, KEY key )
|
|||||||
if (sppr_cambio != ZERO)
|
if (sppr_cambio != ZERO)
|
||||||
prezzo *= sppr_cambio;
|
prezzo *= sppr_cambio;
|
||||||
}
|
}
|
||||||
prezzo /= mask.get_real(F_CAMBIO);
|
prezzo /= cambio;
|
||||||
}
|
}
|
||||||
row_mask.set(FR_PREZZO, prezzo);
|
}
|
||||||
const int pos =row_mask.id2pos(FR_CODIVA);
|
|
||||||
|
HIDDEN bool sppr_handler( TMask_field& f, KEY key )
|
||||||
|
{
|
||||||
|
TMask& row_mask = f.mask();
|
||||||
|
|
||||||
|
if (key == K_TAB && (f.focusdirty() || !row_mask.get(FR_DESCR).empty()))
|
||||||
|
{
|
||||||
|
const int pos = row_mask.id2pos(FR_PREZZO);
|
||||||
|
|
||||||
if (pos >= 0)
|
if (pos >= 0)
|
||||||
iva_handler(row_mask.fld(pos), 0);
|
{
|
||||||
|
TMask & mask = row_mask.get_sheet()->mask();
|
||||||
|
TRectype & spprrec = ((TEdit_field &) row_mask.field(FR_CODART)).browse()->cursor()->file().curr();
|
||||||
|
|
||||||
|
if (spprrec.get("CODTAB") == row_mask.get(FR_CODART) && spprrec.get_char("S6") != 'P')
|
||||||
|
{
|
||||||
|
const real cambio = mask.get(F_CAMBIO);
|
||||||
|
real prezzo = row_mask.get(FR_PREZZO);
|
||||||
|
const TString16 doc_valuta(mask.get(F_CODVAL));
|
||||||
|
sppr_calc(spprrec, doc_valuta, cambio, prezzo);
|
||||||
|
row_mask.set(FR_PREZZO, prezzo);
|
||||||
|
const int posiva = row_mask.id2pos(FR_CODIVA);
|
||||||
|
if (posiva >= 0)
|
||||||
|
iva_handler(row_mask.fld(posiva), 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -517,10 +556,13 @@ real iva(real imponibile, const TIVA & iva,int ndec)
|
|||||||
{
|
{
|
||||||
real val = imponibile * iva.aliquota() / 100.0;
|
real val = imponibile * iva.aliquota() / 100.0;
|
||||||
|
|
||||||
if (val <ZERO)
|
if (ndec < 20)
|
||||||
|
{
|
||||||
|
if (val < ZERO)
|
||||||
val.floor(ndec);
|
val.floor(ndec);
|
||||||
else
|
else
|
||||||
val.ceil(ndec);
|
val.ceil(ndec);
|
||||||
|
}
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -902,7 +944,7 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
|
|||||||
real & val = stack.peek_real();
|
real & val = stack.peek_real();
|
||||||
if (_row)
|
if (_row)
|
||||||
{
|
{
|
||||||
if (_row->tipo().tipo() == 'C')
|
if (_row->tipo().tipo() == RIGA_SCONTI)
|
||||||
val = -_row->importo(FALSE, FALSE, ndec);
|
val = -_row->importo(FALSE, FALSE, ndec);
|
||||||
else
|
else
|
||||||
val = _row->importo(FALSE, FALSE, ndec) - _row->importo(TRUE, FALSE, ndec);
|
val = _row->importo(FALSE, FALSE, ndec) - _row->importo(TRUE, FALSE, ndec);
|
||||||
@ -1253,7 +1295,7 @@ TVariable_mask * TTipo_riga_documento::mask()
|
|||||||
_mask->set_handler( FR_QTA, qta_handler );
|
_mask->set_handler( FR_QTA, qta_handler );
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if (tipo_r == 'S' || tipo_r == 'P')
|
if (tipo_r == RIGA_SPESE || tipo_r == RIGA_PRESTAZIONI)
|
||||||
_mask->set_handler( FR_CODART, sppr_handler );
|
_mask->set_handler( FR_CODART, sppr_handler );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1276,7 +1318,7 @@ TAssoc_array TRiga_documento::_spese;
|
|||||||
TAssoc_array TRiga_documento::_ive;
|
TAssoc_array TRiga_documento::_ive;
|
||||||
|
|
||||||
TRiga_documento::TRiga_documento(TDocumento* doc, const char * tipo)
|
TRiga_documento::TRiga_documento(TDocumento* doc, const char * tipo)
|
||||||
: TAuto_variable_rectype(LF_RIGHEDOC), _doc(doc)
|
: TAuto_variable_rectype(LF_RIGHEDOC), _doc(doc), _iva_calc(FALSE)
|
||||||
{
|
{
|
||||||
if (tipo)
|
if (tipo)
|
||||||
set_tipo(tipo);
|
set_tipo(tipo);
|
||||||
@ -1284,7 +1326,7 @@ TRiga_documento::TRiga_documento(TDocumento* doc, const char * tipo)
|
|||||||
|
|
||||||
TRiga_documento::TRiga_documento(const TRiga_documento& rec, TDocumento* doc,
|
TRiga_documento::TRiga_documento(const TRiga_documento& rec, TDocumento* doc,
|
||||||
const char * tipo)
|
const char * tipo)
|
||||||
: TAuto_variable_rectype(rec), _doc(doc)
|
: TAuto_variable_rectype(rec), _doc(doc), _iva_calc(FALSE)
|
||||||
{
|
{
|
||||||
if (tipo)
|
if (tipo)
|
||||||
set_tipo(tipo);
|
set_tipo(tipo);
|
||||||
@ -1320,7 +1362,7 @@ const TSpesa_prest & TRiga_documento::spesa() const
|
|||||||
{
|
{
|
||||||
const char tipor = tipo().tipo();
|
const char tipor = tipo().tipo();
|
||||||
|
|
||||||
CHECK(tipor == 'S' || tipor == 'P', "Tipo riga incompatibile con le spese");
|
CHECK(tipor == RIGA_SPESE || tipor == RIGA_PRESTAZIONI, "Tipo riga incompatibile con le spese");
|
||||||
static long firm = -1;
|
static long firm = -1;
|
||||||
long new_firm = main_app().get_firm();
|
long new_firm = main_app().get_firm();
|
||||||
|
|
||||||
@ -1357,20 +1399,20 @@ bool TRiga_documento::sola_descrizione() const
|
|||||||
{
|
{
|
||||||
char t = tipo().tipo();
|
char t = tipo().tipo();
|
||||||
if (t <= ' ' && get("QTA").empty() && get("PREZZO").empty())
|
if (t <= ' ' && get("QTA").empty() && get("PREZZO").empty())
|
||||||
t = 'D';
|
t = RIGA_DESCRIZIONI;
|
||||||
return t == 'D';
|
return t == RIGA_DESCRIZIONI;
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRiga_documento::forza_sola_descrizione()
|
void TRiga_documento::forza_sola_descrizione()
|
||||||
{
|
{
|
||||||
// In realta' il test serve anche a caricare la lista dei tipi riga!
|
// In realta' il test serve anche a caricare la lista dei tipi riga!
|
||||||
if (!tipo_valido() || tipo().tipo() != 'D')
|
if (!tipo_valido() || tipo().tipo() != RIGA_DESCRIZIONI)
|
||||||
{
|
{
|
||||||
_tipi.restart();
|
_tipi.restart();
|
||||||
for (const TObject* o = _tipi.get(); o; o = _tipi.get())
|
for (const TObject* o = _tipi.get(); o; o = _tipi.get())
|
||||||
{
|
{
|
||||||
const TTipo_riga_documento* trd = (const TTipo_riga_documento*)o;
|
const TTipo_riga_documento* trd = (const TTipo_riga_documento*)o;
|
||||||
if (trd->tipo() == 'D')
|
if (trd->tipo() == RIGA_DESCRIZIONI)
|
||||||
{
|
{
|
||||||
put("TIPORIGA", trd->codice());
|
put("TIPORIGA", trd->codice());
|
||||||
break;
|
break;
|
||||||
@ -1464,7 +1506,7 @@ real TRiga_documento::prezzo(bool scontato, bool lordo, int ndec) const
|
|||||||
return prezzo;
|
return prezzo;
|
||||||
}
|
}
|
||||||
|
|
||||||
real TRiga_documento::importo(bool scontato, bool lordo, int ndec, bool iva_calc) const
|
real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
|
||||||
{
|
{
|
||||||
real importo;
|
real importo;
|
||||||
|
|
||||||
@ -1476,11 +1518,11 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec, bool iva_calc
|
|||||||
|
|
||||||
switch (tipor)
|
switch (tipor)
|
||||||
{
|
{
|
||||||
case 'M':
|
case RIGA_MERCE:
|
||||||
c = _qtaprezzo;
|
c = _qtaprezzo;
|
||||||
break;
|
break;
|
||||||
case 'P':
|
case RIGA_PRESTAZIONI:
|
||||||
case 'S':
|
case RIGA_SPESE:
|
||||||
{
|
{
|
||||||
const TSpesa_prest & s = spesa();
|
const TSpesa_prest & s = spesa();
|
||||||
|
|
||||||
@ -1501,7 +1543,7 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec, bool iva_calc
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case 'C':
|
case RIGA_SCONTI:
|
||||||
cv.set_sconto(get("SCONTO"));
|
cv.set_sconto(get("SCONTO"));
|
||||||
|
|
||||||
if (cv.get_sconto().not_empty())
|
if (cv.get_sconto().not_empty())
|
||||||
@ -1509,8 +1551,8 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec, bool iva_calc
|
|||||||
else
|
else
|
||||||
c = _scontoimp;
|
c = _scontoimp;
|
||||||
break;
|
break;
|
||||||
case 'O':
|
case RIGA_OMAGGI:
|
||||||
if (iva_calc)
|
if (_iva_calc && get_bool("ADDIVA"))
|
||||||
c = _qtaprezzo;
|
c = _qtaprezzo;
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
@ -1540,6 +1582,14 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec, bool iva_calc
|
|||||||
return importo;
|
return importo;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
real TRiga_documento::iva(int ndec) const
|
||||||
|
{
|
||||||
|
((TRiga_documento *) this)->_iva_calc = TRUE;
|
||||||
|
real iva(::iva(imponibile(), iva(), ndec));
|
||||||
|
((TRiga_documento *) this)->_iva_calc = FALSE;
|
||||||
|
return iva;
|
||||||
|
}
|
||||||
|
|
||||||
real TRiga_documento::imponibile() const
|
real TRiga_documento::imponibile() const
|
||||||
{
|
{
|
||||||
const TString16 field(tipo().imponibile());
|
const TString16 field(tipo().imponibile());
|
||||||
@ -1550,14 +1600,14 @@ real TRiga_documento::imponibile() const
|
|||||||
return importo(TRUE, FALSE, doc().in_valuta() ? 3 : 0);
|
return importo(TRUE, FALSE, doc().in_valuta() ? 3 : 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
real TRiga_documento::imposta() const
|
real TRiga_documento::imposta(bool round) const
|
||||||
{
|
{
|
||||||
const TString16 field(tipo().imposta());
|
const TString16 field(tipo().imposta());
|
||||||
|
|
||||||
if (field.not_empty())
|
if (field.not_empty())
|
||||||
return get_real(field);
|
return get_real(field);
|
||||||
else
|
else
|
||||||
return iva(doc().in_valuta() ? 3 : 0);
|
return iva(round ? (doc().in_valuta() ? 3 : 0) : 20);
|
||||||
}
|
}
|
||||||
|
|
||||||
void TRiga_documento::dirty_fields(bool dirty_document)
|
void TRiga_documento::dirty_fields(bool dirty_document)
|
||||||
@ -1576,10 +1626,10 @@ bool TRiga_documento::doc_dependent() const
|
|||||||
{
|
{
|
||||||
const char tipor = tipo().tipo();
|
const char tipor = tipo().tipo();
|
||||||
|
|
||||||
if (tipor == 'S')
|
if (tipor == RIGA_SPESE)
|
||||||
return spesa().tipo() == 'P';
|
return spesa().tipo() == 'P';
|
||||||
else
|
else
|
||||||
if (tipor == 'C')
|
if (tipor == RIGA_SCONTI)
|
||||||
return get("SCONTO").not_empty();
|
return get("SCONTO").not_empty();
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
@ -1677,8 +1727,6 @@ void TRiga_documento::autoload(TSheet_field & f)
|
|||||||
{
|
{
|
||||||
const int num = numero() - 1;
|
const int num = numero() - 1;
|
||||||
|
|
||||||
if (num >= 0 && num < f.items())
|
|
||||||
{
|
|
||||||
TToken_string & row = f.row(num);
|
TToken_string & row = f.row(num);
|
||||||
|
|
||||||
row.add( get( "STATORIGA" ), f.cid2index(FR_STATORIGA ));
|
row.add( get( "STATORIGA" ), f.cid2index(FR_STATORIGA ));
|
||||||
@ -1711,7 +1759,6 @@ void TRiga_documento::autoload(TSheet_field & f)
|
|||||||
row.add( get( "CODIVA" ), f.cid2index(FR_CODIVA ));
|
row.add( get( "CODIVA" ), f.cid2index(FR_CODIVA ));
|
||||||
row.add( get( "ADDIVA" ), f.cid2index(FR_ADDIVA ));
|
row.add( get( "ADDIVA" ), f.cid2index(FR_ADDIVA ));
|
||||||
row.add( get( "ASPBENI" ), f.cid2index(FR_ASPBENI ));
|
row.add( get( "ASPBENI" ), f.cid2index(FR_ASPBENI ));
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
TDocumento_mask::TDocumento_mask(const char* name, TDocumento * doc, int num,
|
TDocumento_mask::TDocumento_mask(const char* name, TDocumento * doc, int num,
|
||||||
@ -1766,7 +1813,7 @@ TAssoc_array TDocumento::_tipi;
|
|||||||
|
|
||||||
TDocumento::TDocumento()
|
TDocumento::TDocumento()
|
||||||
: TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(TRUE),
|
: TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(TRUE),
|
||||||
_condv(NULL), _rel(NULL), _sconto(NULL)
|
_condv(NULL), _rel(NULL), _sconto(NULL), _esenzione(NULL)
|
||||||
{
|
{
|
||||||
set_memo_fld("G1");
|
set_memo_fld("G1");
|
||||||
}
|
}
|
||||||
@ -1774,7 +1821,7 @@ TDocumento::TDocumento()
|
|||||||
TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc,
|
TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc,
|
||||||
TCond_vendita * condv, TRelation * rel)
|
TCond_vendita * condv, TRelation * rel)
|
||||||
: TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(TRUE),
|
: TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(TRUE),
|
||||||
_condv(condv), _rel(rel), _sconto(NULL)
|
_condv(condv), _rel(rel), _sconto(NULL), _esenzione(NULL)
|
||||||
{
|
{
|
||||||
set_memo_fld("G1");
|
set_memo_fld("G1");
|
||||||
if (numdoc <= 0)
|
if (numdoc <= 0)
|
||||||
@ -1790,6 +1837,21 @@ TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc,
|
|||||||
read(provv, anno, codnum, numdoc);
|
read(provv, anno, codnum, numdoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
TDocumento::TDocumento(const TRectype& rec, TCond_vendita * condv, TRelation * rel)
|
||||||
|
: TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(FALSE),
|
||||||
|
_condv(condv), _rel(rel), _sconto(NULL), _esenzione(NULL)
|
||||||
|
{
|
||||||
|
set_memo_fld("G1");
|
||||||
|
read(rec);
|
||||||
|
}
|
||||||
|
|
||||||
|
TDocumento::~TDocumento()
|
||||||
|
|
||||||
|
{
|
||||||
|
if (_sconto != NULL) delete _sconto;
|
||||||
|
if (_esenzione != NULL) delete _esenzione;
|
||||||
|
}
|
||||||
|
|
||||||
// Funzione statica utile a tutti gli utenti di LF_DOC e LF_RIGHEDOC
|
// Funzione statica utile a tutti gli utenti di LF_DOC e LF_RIGHEDOC
|
||||||
void TDocumento::set_key(TRectype& rec, char provv, int anno, const char* codnum, long numdoc)
|
void TDocumento::set_key(TRectype& rec, char provv, int anno, const char* codnum, long numdoc)
|
||||||
{
|
{
|
||||||
@ -1821,14 +1883,6 @@ void TDocumento::copy_data(TRectype& dst, const TRectype& src)
|
|||||||
dst.put("NRIGA", nriga);
|
dst.put("NRIGA", nriga);
|
||||||
}
|
}
|
||||||
|
|
||||||
TDocumento::TDocumento(const TRectype& rec, TCond_vendita * condv, TRelation * rel)
|
|
||||||
: TAuto_variable_rectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA"), _nuovo(FALSE),
|
|
||||||
_condv(condv), _rel(rel), _sconto(NULL)
|
|
||||||
{
|
|
||||||
set_memo_fld("G1");
|
|
||||||
read(rec);
|
|
||||||
}
|
|
||||||
|
|
||||||
TRiga_documento& TDocumento::insert_row(int row, const char *tipo)
|
TRiga_documento& TDocumento::insert_row(int row, const char *tipo)
|
||||||
{
|
{
|
||||||
TRiga_documento * r = new TRiga_documento((const TRiga_documento &) _rows.key(), this); // ok
|
TRiga_documento * r = new TRiga_documento((const TRiga_documento &) _rows.key(), this); // ok
|
||||||
@ -1931,6 +1985,10 @@ void TDocumento::set_riga_sconto()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TDocumento::set_riga_esenzione()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
void TDocumento::dirty_fields()
|
void TDocumento::dirty_fields()
|
||||||
{
|
{
|
||||||
for (TDocumento_variable_field * f = (TDocumento_variable_field *) first_variable_field();
|
for (TDocumento_variable_field * f = (TDocumento_variable_field *) first_variable_field();
|
||||||
@ -2009,13 +2067,22 @@ const bool TDocumento::in_valuta() const
|
|||||||
TRiga_documento & TDocumento::row(int index)
|
TRiga_documento & TDocumento::row(int index)
|
||||||
{
|
{
|
||||||
const int nrows = _rows.rows();
|
const int nrows = _rows.rows();
|
||||||
|
TRiga_documento * r = NULL;
|
||||||
|
|
||||||
if (index <= nrows)
|
if (index <= nrows)
|
||||||
return (TRiga_documento &) _rows.row(index, FALSE);
|
r = &((TRiga_documento &) _rows.row(index, FALSE));
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
CHECKD(index == nrows + 1 &&_sconto != NULL, "Riga documento non esistente ", index);
|
CHECKD((index == nrows + 1 && (_sconto != NULL || _esenzione != NULL)) || (index == nrows + 2 && _sconto != NULL && _esenzione != NULL),
|
||||||
return *_sconto;
|
"Riga documento non esistente ", index);
|
||||||
|
if (index == nrows + 1)
|
||||||
|
{
|
||||||
|
r = _sconto != NULL ? _sconto : _esenzione;
|
||||||
}
|
}
|
||||||
|
if (index == nrows + 2)
|
||||||
|
r = _esenzione;
|
||||||
|
}
|
||||||
|
return *r;
|
||||||
}
|
}
|
||||||
|
|
||||||
long TDocumento::get_next_key(char provv, int anno, const char* codnum) const
|
long TDocumento::get_next_key(char provv, int anno, const char* codnum) const
|
||||||
@ -2242,6 +2309,87 @@ TRectype & TDocumento::operator =(const char * r)
|
|||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old, TSheet_field * sh)
|
||||||
|
|
||||||
|
{
|
||||||
|
const bool interactive = sh != NULL;
|
||||||
|
if (tipo().spese_aut())
|
||||||
|
{
|
||||||
|
const int nrows = _rows.rows();
|
||||||
|
for (int i = nrows; i > 0; i--)
|
||||||
|
{
|
||||||
|
TRiga_documento & r = row(i);
|
||||||
|
|
||||||
|
if (r.tipo().tipo() == RIGA_SPESE && r.generata())
|
||||||
|
{
|
||||||
|
if (preserve_old)
|
||||||
|
return;
|
||||||
|
destroy_row(i, TRUE);
|
||||||
|
if (interactive)
|
||||||
|
sh->destroy(i - 1);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
TString16 cod_iva_cli;
|
||||||
|
const int nspese = spese_aut.items();
|
||||||
|
if (nspese > 0)
|
||||||
|
{
|
||||||
|
TLocalisamfile cfven(LF_CFVEN);
|
||||||
|
cfven.put("TIPOCF", get("TIPOCF"));
|
||||||
|
cfven.put("CODCF", get("CODCF"));
|
||||||
|
if (cfven.read() == NOERR)
|
||||||
|
cod_iva_cli = cfven.get("ASSFIS");
|
||||||
|
for (i = 0; i < nspese; i++)
|
||||||
|
{
|
||||||
|
const TString & s = spese_aut.row(i);
|
||||||
|
|
||||||
|
TSpesa_prest sp(s);
|
||||||
|
TString16 tipo(sp.tipo_riga());
|
||||||
|
TRiga_documento & riga = new_row(tipo);
|
||||||
|
|
||||||
|
riga.put("CODART", s);
|
||||||
|
riga.set_generata();
|
||||||
|
riga.put("DESCR", sp.descrizione());
|
||||||
|
switch (sp.tipo())
|
||||||
|
{
|
||||||
|
case 'Q':
|
||||||
|
{
|
||||||
|
real qta = sp.qta();
|
||||||
|
|
||||||
|
if (qta == ZERO)
|
||||||
|
qta = 1.0;
|
||||||
|
riga.put("QTA", qta);
|
||||||
|
}
|
||||||
|
case 'V':
|
||||||
|
{
|
||||||
|
const real cambio = get_real("CAMBIO");
|
||||||
|
const TString16 valuta = get("CODVAL");
|
||||||
|
real prezzo = sp.prezzo();
|
||||||
|
|
||||||
|
sppr_calc(sp, valuta, cambio, prezzo);
|
||||||
|
riga.put("PREZZO", prezzo);
|
||||||
|
riga.put("UMQTA", sp.um());
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
case 'P':
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
if (cod_iva_cli.empty())
|
||||||
|
riga.put("CODIVA", sp.cod_iva());
|
||||||
|
else
|
||||||
|
riga.put("CODIVA", cod_iva_cli);
|
||||||
|
if (interactive)
|
||||||
|
{
|
||||||
|
const int nrow = sh->insert(-1, FALSE);
|
||||||
|
riga.autoload(*sh);
|
||||||
|
sh->check_row(nrow);
|
||||||
|
// sh->post_insert(nrow);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Lista di documenti
|
// Lista di documenti
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -2728,3 +2876,4 @@ bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& do
|
|||||||
}
|
}
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
33
ve/velib01.h
33
ve/velib01.h
@ -21,6 +21,13 @@
|
|||||||
#include "../cg/pagament.h"
|
#include "../cg/pagament.h"
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define RIGA_MERCE 'M'
|
||||||
|
#define RIGA_SPESE 'S'
|
||||||
|
#define RIGA_PRESTAZIONI 'P'
|
||||||
|
#define RIGA_SCONTI 'C'
|
||||||
|
#define RIGA_OMAGGI 'O'
|
||||||
|
#define RIGA_DESCRIZIONI 'D'
|
||||||
|
|
||||||
class TDocumento;
|
class TDocumento;
|
||||||
class TRiga_documento;
|
class TRiga_documento;
|
||||||
class TCond_vendita;
|
class TCond_vendita;
|
||||||
@ -42,6 +49,7 @@ bool codcli_hndl(TMask_field& field, KEY key);
|
|||||||
bool dummy_hndl(TMask_field& field, KEY key);
|
bool dummy_hndl(TMask_field& field, KEY key);
|
||||||
bool condpag_hndl(TMask_field& field, KEY key);
|
bool condpag_hndl(TMask_field& field, KEY key);
|
||||||
bool note_hndl(TMask_field& field, KEY key);
|
bool note_hndl(TMask_field& field, KEY key);
|
||||||
|
bool data_hndl(TMask_field& field, KEY key);
|
||||||
|
|
||||||
class TDocumento_variable_field : public TVariable_field
|
class TDocumento_variable_field : public TVariable_field
|
||||||
{
|
{
|
||||||
@ -81,7 +89,12 @@ public:
|
|||||||
const TString& codice() const { return get("CODTAB");}
|
const TString& codice() const { return get("CODTAB");}
|
||||||
const TString& descrizione() const { return get("S0"); }
|
const TString& descrizione() const { return get("S0"); }
|
||||||
const TString& field_perc() const { return get("S5"); }
|
const TString& field_perc() const { return get("S5"); }
|
||||||
|
const TString & um() const { return get("S7"); }
|
||||||
|
const TString& cod_iva() const { return get("S3"); }
|
||||||
|
real prezzo() const { return get_real("R0"); }
|
||||||
|
real qta() const { return get_real("R1"); }
|
||||||
char tipo() const { return get_char("S6"); }
|
char tipo() const { return get_char("S6"); }
|
||||||
|
const TString & tipo_riga() const { return get("S8"); }
|
||||||
char genere() const { return get("COD") == "SPP" ? 'S' : 'P'; }
|
char genere() const { return get("COD") == "SPP" ? 'S' : 'P'; }
|
||||||
|
|
||||||
TSpesa_prest(const char* codice = NULL, char tipo = 'S');
|
TSpesa_prest(const char* codice = NULL, char tipo = 'S');
|
||||||
@ -205,6 +218,7 @@ public:
|
|||||||
TFormula_documento * succ_formula(bool restart = FALSE);
|
TFormula_documento * succ_formula(bool restart = FALSE);
|
||||||
|
|
||||||
const int ncopie() const { return get_int("I0"); }
|
const int ncopie() const { return get_int("I0"); }
|
||||||
|
bool spese_aut() const { return get_bool("B0"); }
|
||||||
|
|
||||||
TTipo_documento(const char* tipodoc = NULL);
|
TTipo_documento(const char* tipodoc = NULL);
|
||||||
TTipo_documento(const TRectype& rec);
|
TTipo_documento(const TRectype& rec);
|
||||||
@ -255,6 +269,7 @@ class TRiga_documento : public TAuto_variable_rectype
|
|||||||
static TAssoc_array _tipi;
|
static TAssoc_array _tipi;
|
||||||
static TAssoc_array _spese;
|
static TAssoc_array _spese;
|
||||||
static TAssoc_array _ive;
|
static TAssoc_array _ive;
|
||||||
|
bool _iva_calc;
|
||||||
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
@ -269,6 +284,8 @@ public:
|
|||||||
bool doc_dependent() const;
|
bool doc_dependent() const;
|
||||||
int numero() const { return get_int("NRIGA");}
|
int numero() const { return get_int("NRIGA");}
|
||||||
void set_numero(int numero) { put("NRIGA", numero);}
|
void set_numero(int numero) { put("NRIGA", numero);}
|
||||||
|
bool generata() const { return get_bool("GENERATA");}
|
||||||
|
void set_generata(bool on = TRUE) { put("GENERATA", on);}
|
||||||
// @cmember Assegna il documento corrente
|
// @cmember Assegna il documento corrente
|
||||||
void set_doc(TDocumento * doc) { _doc = doc; }
|
void set_doc(TDocumento * doc) { _doc = doc; }
|
||||||
const TDocumento & doc() const { CHECK(_doc, "Documento nullo"); return *_doc;}
|
const TDocumento & doc() const { CHECK(_doc, "Documento nullo"); return *_doc;}
|
||||||
@ -300,10 +317,10 @@ public:
|
|||||||
void set_fields(TAuto_variable_rectype & rec);
|
void set_fields(TAuto_variable_rectype & rec);
|
||||||
|
|
||||||
real prezzo(bool scontato, bool lordo, int ndec) const ;
|
real prezzo(bool scontato, bool lordo, int ndec) const ;
|
||||||
real importo(bool scontato, bool lordo, int ndec, bool iva_calc = FALSE) const ;
|
real importo(bool scontato, bool lordo, int ndec) const ;
|
||||||
real iva(int ndec) const {return ::iva(imponibile(), iva(), ndec);}
|
real iva(int ndec) const;
|
||||||
real imponibile() const;
|
real imponibile() const;
|
||||||
real imposta() const;
|
real imposta(bool round = TRUE) const;
|
||||||
|
|
||||||
TRiga_documento(TDocumento* doc, const char * tipo = NULL);
|
TRiga_documento(TDocumento* doc, const char * tipo = NULL);
|
||||||
TRiga_documento(const TRiga_documento& rec, TDocumento* doc,
|
TRiga_documento(const TRiga_documento& rec, TDocumento* doc,
|
||||||
@ -322,6 +339,7 @@ class TDocumento : public TAuto_variable_rectype
|
|||||||
TCond_vendita * _condv;
|
TCond_vendita * _condv;
|
||||||
TPagamento _pag;
|
TPagamento _pag;
|
||||||
TRiga_documento * _sconto; // Riga per lo sconto di testata
|
TRiga_documento * _sconto; // Riga per lo sconto di testata
|
||||||
|
TRiga_documento * _esenzione; // Riga per l' esenzione iva
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
TRiga_documento & row(int index);
|
TRiga_documento & row(int index);
|
||||||
@ -329,6 +347,7 @@ protected:
|
|||||||
virtual void put_str(const char* fieldname, const char* val);
|
virtual void put_str(const char* fieldname, const char* val);
|
||||||
long renum(long numdoc = 0);
|
long renum(long numdoc = 0);
|
||||||
void set_riga_sconto();
|
void set_riga_sconto();
|
||||||
|
void set_riga_esenzione();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
void dirty_fields();
|
void dirty_fields();
|
||||||
@ -345,7 +364,7 @@ public:
|
|||||||
virtual void zero(const char * fieldname);
|
virtual void zero(const char * fieldname);
|
||||||
virtual void zero(char c = '\0');
|
virtual void zero(char c = '\0');
|
||||||
|
|
||||||
int rows() const { return _rows.rows() + ((_sconto != NULL) ? 1 : 0); }
|
int rows() const { return _rows.rows() + ((_sconto != NULL) ? 1 : 0) + ((_esenzione != NULL) ? 1 : 0); }
|
||||||
const TRiga_documento& operator[](int index) const { return (const TRiga_documento&)((TDocumento *)this)->row(index); }
|
const TRiga_documento& operator[](int index) const { return (const TRiga_documento&)((TDocumento *)this)->row(index); }
|
||||||
TRiga_documento& operator[](int index) { return (TRiga_documento&)row(index); }
|
TRiga_documento& operator[](int index) { return (TRiga_documento&)row(index); }
|
||||||
|
|
||||||
@ -398,13 +417,15 @@ public:
|
|||||||
|
|
||||||
TPagamento & pagamento();
|
TPagamento & pagamento();
|
||||||
|
|
||||||
|
void update_spese_aut(TString_array & spese, bool preserve_old = FALSE, TSheet_field * sh = NULL);
|
||||||
|
|
||||||
TDocumento ();
|
TDocumento ();
|
||||||
TDocumento(char provv, int anno, const char* codnum, long numdoc,
|
TDocumento(char provv, int anno, const char* codnum, long numdoc,
|
||||||
TCond_vendita * condv = NULL, TRelation * rel = NULL);
|
TCond_vendita * condv = NULL, TRelation * rel = NULL);
|
||||||
TDocumento(const TRectype& doc, TCond_vendita * condv = NULL,
|
TDocumento(const TRectype& doc, TCond_vendita * condv = NULL,
|
||||||
TRelation * rel = NULL);
|
TRelation * rel = NULL);
|
||||||
virtual ~TDocumento() { if (_sconto != NULL) delete _sconto;}
|
virtual ~TDocumento();
|
||||||
};
|
};
|
||||||
|
|
||||||
class TDocumento_mask : public TVariable_mask
|
class TDocumento_mask : public TVariable_mask
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user