Patch level : 4.0 649

Ricompilazione Demo : [ ]
Commento            :

Riportata la versione 3.1 patch 848

(ve mancano i file con nomi doficati


git-svn-id: svn://10.65.10.50/trunk@15004 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
alex 2007-03-07 11:36:57 +00:00
parent cf9f70b8c7
commit dcf8d84484
27 changed files with 1748 additions and 1919 deletions

View File

@ -1,3 +1,3 @@
34 34
0 0
$rdoc|||520|31|Righe documenti di vendita|NDOC*3|| $rdoc|||539|0|Righe documenti di vendita|||

View File

@ -1,5 +1,5 @@
34 34
56 58
CODNUM|1|4|0|Codice Numeriazione CODNUM|1|4|0|Codice Numeriazione
ANNO|2|4|0|Anno ANNO|2|4|0|Anno
PROVV|1|1|0|Tipo numerazione <P>rovvisoria <D>efinitiva PROVV|1|1|0|Tipo numerazione <P>rovvisoria <D>efinitiva
@ -18,6 +18,7 @@ DESCR|1|50|0|Descrizione
DESCLUNGA|8|1|0|Descrizione estesa caricata DESCLUNGA|8|1|0|Descrizione estesa caricata
DESCEST|11|10|0|Descrizione estesa DESCEST|11|10|0|Descrizione estesa
PREZZO|4|18|5|Prezzo o valore PREZZO|4|18|5|Prezzo o valore
PREZZOL|4|18|5|Prezzo o valore per documenti al lordo
UMQTA|1|2|0|Unita di misura UMQTA|1|2|0|Unita di misura
QTA|4|15|5|Quantita' QTA|4|15|5|Quantita'
QTAEVASA|4|13|5|Quantita' evasa QTAEVASA|4|13|5|Quantita' evasa
@ -56,6 +57,7 @@ CODCOSTO|1|20|0|Centro di costo
CODAGG1|1|20|0|Codice aggiuntivo 1 CODAGG1|1|20|0|Codice aggiuntivo 1
CODAGG2|1|20|0|Codice aggiuntivo 2 CODAGG2|1|20|0|Codice aggiuntivo 2
PRIORITY|3|7|0|Priorita' MSP PRIORITY|3|7|0|Priorita' MSP
TIPODET|1|1|0|Tipo detraibilità
7 7
CODNUM+ANNO+PROVV+NDOC+NRIGA| CODNUM+ANNO+PROVV+NDOC+NRIGA|
CODNUM+ANNO+PROVV+CODART+LIVELLO+CODMAG|X CODNUM+ANNO+PROVV+CODART+LIVELLO+CODMAG|X

Binary file not shown.

Before

Width:  |  Height:  |  Size: 103 KiB

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 96 KiB

After

Width:  |  Height:  |  Size: 96 KiB

View File

@ -78,7 +78,7 @@ void TCond_vendita::set_prezzo(const real & prezzo, const char * val_rif)
{ {
_prezzo = normalize_valuta(prezzo, val_rif); _prezzo = normalize_valuta(prezzo, val_rif);
if (_load_mask && _riga && _riga->id2pos(FR_PREZZO) >= 0) // && _riga->field(FR_PREZZO).active()) if (_load_mask && _riga && _riga->id2pos(FR_PREZZO) >= 0)
_riga->set(FR_PREZZO, _prezzo); _riga->set(FR_PREZZO, _prezzo);
} }
@ -370,8 +370,6 @@ void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
set_sconto(""); set_sconto("");
set_iva(""); set_iva("");
set_provv(ZERO); set_provv(ZERO);
if (doc_al_lordo)
riga().set(FR_LORDO, "X");
return; return;
} }
@ -389,11 +387,6 @@ void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
const bool cv_scagl = _condv.get_bool("GESTSCAGL"); const bool cv_scagl = _condv.get_bool("GESTSCAGL");
const bool cv_um = _condv.get_bool("GESTUM"); const bool cv_um = _condv.get_bool("GESTUM");
if (doc_al_lordo)
riga().set(FR_LORDO, "X");
else
riga().reset(FR_LORDO);
real prezzo; real prezzo;
bool prezzo_lordo = false; bool prezzo_lordo = false;
TString16 valuta; TString16 valuta;
@ -406,8 +399,6 @@ void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
prezzo = _rcondv.get_real("PREZZO"); prezzo = _rcondv.get_real("PREZZO");
valuta = _condv.get("CODVAL"); valuta = _condv.get("CODVAL");
prezzo_lordo = _condv.get_bool("IMPLORDI"); prezzo_lordo = _condv.get_bool("IMPLORDI");
_load_mask = !load_um_only && !load_scagl_only;
} }
else else
{ {
@ -614,7 +605,6 @@ void TCond_vendita::update_omaggi(bool full)
TSheet_field & sh = (TSheet_field &) testa().field(F_SHEET); TSheet_field & sh = (TSheet_field &) testa().field(F_SHEET);
int current_doc_row = sh.selected() + 1; int current_doc_row = sh.selected() + 1;
TDocumento & doc = testa().doc(); TDocumento & doc = testa().doc();
bool update = FALSE;
if (doc[current_doc_row].is_omaggio()) if (doc[current_doc_row].is_omaggio())
return; return;
@ -626,9 +616,8 @@ void TCond_vendita::update_omaggi(bool full)
if (r.is_omaggio() && r.is_generata()) if (r.is_omaggio() && r.is_generata())
{ {
sh.update_row(current_doc_row - 1); sh.update_row(current_doc_row - 1);
doc.destroy_row(current_doc_row + 1, TRUE); doc.destroy_row(current_doc_row + 1, true);
sh.destroy(current_doc_row, FALSE); sh.destroy(current_doc_row, true);
update = TRUE;
} }
} }
@ -685,7 +674,7 @@ void TCond_vendita::update_omaggi(bool full)
else else
r.put("CODIVA", _rcondv.get("CODIVA")); r.put("CODIVA", _rcondv.get("CODIVA"));
r.put("ADDIVA", _rcondv.get("ADDIVA")); r.put("ADDIVA", _rcondv.get("ADDIVA"));
sh.insert(current_doc_row, FALSE); sh.insert(current_doc_row, false);
r.autoload(sh); r.autoload(sh);
sh.check_row(current_doc_row); sh.check_row(current_doc_row);
r.autosave(sh); r.autosave(sh);
@ -693,14 +682,13 @@ void TCond_vendita::update_omaggi(bool full)
prezzo = normalize_valuta(prezzo, codval); prezzo = normalize_valuta(prezzo, codval);
r.put("PREZZO", prezzo); r.put("PREZZO", prezzo);
r.autoload(sh); r.autoload(sh);
update = TRUE; if (!testa().is_omaggio_enabled())
// curr_row.autoload(sh);
}
}
if (update)
{ {
sh.disable_row(current_doc_row);
sh.check_row(current_doc_row);
}
sh.force_update(); sh.force_update();
sh.select(creata ? current_doc_row : current_doc_row - 1); }
} }
} }

View File

@ -7,11 +7,13 @@
#include "ve0100.h" #include "ve0100.h"
#include "veini.h" #include "veini.h"
#include "vepriv.h"
#include "veuml.h" #include "veuml.h"
#include "veuml1.h" #include "veuml1.h"
#include "verig.h" #include "verig.h"
#include "sconti.h" #include "sconti.h"
#include "../mg/anamag.h"
#include "../mg/mglib.h" #include "../mg/mglib.h"
bool TMotore_application::save_and_new() const bool TMotore_application::save_and_new() const
@ -147,7 +149,7 @@ void TMotore_application::init_insert_mode( TMask& m )
void TMotore_application::init_modify_mode( TMask& m ) void TMotore_application::init_modify_mode( TMask& m )
{ {
const bool enable_print = _docmsk->doc().tipo().printable(); const bool enable_print = edit_mask().doc().tipo().printable();
enable_menu_item(M_FILE_PRINT, enable_print); enable_menu_item(M_FILE_PRINT, enable_print);
m.enable(DLG_PRINT, enable_print); m.enable(DLG_PRINT, enable_print);
m.enable(DLG_ELABORA); m.enable(DLG_ELABORA);
@ -266,8 +268,8 @@ const char* TMotore_application::get_next_key( )
int TMotore_application::read( TMask& m ) int TMotore_application::read( TMask& m )
{ {
// m.autoload(*_rel);
TRelation_application::read(m); TRelation_application::read(m);
doc() = (TDocumento &)_rel->curr(); doc() = (TDocumento &)_rel->curr();
_codnum = m.get(F_CODNUM); _codnum = m.get(F_CODNUM);
_tipodoc = m.get(F_TIPODOC); _tipodoc = m.get(F_TIPODOC);
@ -434,9 +436,40 @@ void TMotore_application::sheet2ini(TSheet_field &sheet,TConfig& ini)
str.overwrite("\\", p); str.overwrite("\\", p);
str.insert("n", p+1); str.insert("n", p+1);
} }
}
if (campo.field()->name() == RDOC_PREZZO)
{
TCodiceIVA c(sm->get(FR_CODIVA));
TFieldref l;
real prezzo(str);
real prezzol;
l = RDOC_PREZZOL;
if (m.doc().tipo().calcolo_lordo())
{
prezzol = prezzo;
c.scorpora(prezzo);
}
else
prezzol = c.lordo(prezzo);
l.write(ini, defpar, prezzol.string());
str = prezzo.string();
} }
campo.field()->write(ini, defpar, str); campo.field()->write(ini, defpar, str);
} }
const TRiga_documento &rdoc = m.doc()[r];
TFieldref f;
f = RDOC_DACODNUM;
f.write(ini, defpar, rdoc.get(RDOC_DACODNUM));
f = RDOC_DAANNO;
f.write(ini, defpar, rdoc.get(RDOC_DAANNO));
f = RDOC_DAPROVV;
f.write(ini, defpar, rdoc.get(RDOC_DAPROVV));
f = RDOC_DANDOC;
f.write(ini, defpar, rdoc.get(RDOC_DANDOC));
f = RDOC_DAIDRIGA;
f.write(ini, defpar, rdoc.get(RDOC_DAIDRIGA));
} }
} }
for ( ; ; r++) for ( ; ; r++)
@ -472,6 +505,95 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
} }
else else
{ {
TDocumento & d = doc();
d.put(DOC_TIPOCF, msk.get(F_TIPOCF));
d.put(DOC_CODCF, msk.get(F_CODCF));
const TCli_for & c = d.clifor();
const TRectype & ven_rec = c.vendite();
ini.set_paragraph("33");
if (!ini.exist(DOC_CODVAL))
{
const TString16 codval = c.get(CLI_CODVAL); // Attenzione: Non usare TString& qui!
msk.set(F_CODVAL, codval, true);
msk.set(F_CODVAL1, codval, true);
if (codval.blank())
msk.reset(F_CAMBIO);
}
if (!ini.exist(DOC_CODLIN))
msk.set(F_CODLIN, c.get(CLI_CODLIN), true);
if (!ini.exist(DOC_CODPAG))
msk.set(F_CODPAG, c.get(CLI_CODPAG), true);
if (!ini.exist(DOC_CODABIA))
msk.set(F_CODABIA, c.get(CLI_CODABI), true);
if (!ini.exist(DOC_CODCABA))
msk.set(F_CODCABA, c.get(CLI_CODCAB), true);
if (!ini.exist(DOC_IBAN))
{
const TString & iban = c.get(CLI_IBAN);
msk.set(F_IBAN, iban, true);
if (iban.not_empty())
{
msk.set(F_IBAN_STATO, iban.left(2));
msk.set(F_IBAN_CHECK, iban.mid(2,2));
msk.set(F_BBAN , iban.mid(4));
msk.set(F_BBAN_CIN , iban.mid(4,1));
msk.set(F_BBAN_ABI , iban.mid(5,5));
msk.set(F_BBAN_CAB , iban.mid(10,5));
msk.set(F_BBAN_CONTO, iban.mid(15,12));
}
}
// Setta i campi che appartengono al file LF_CFVEN
if (!ini.exist(DOC_CODABIP))
msk.set(F_CODABIP, ven_rec.get(CFV_CODABIPR), true);
if (!ini.exist(DOC_CODCABP))
msk.set(F_CODCABP, ven_rec.get(CFV_CODCABPR), true);
if (!ini.exist(DOC_RAGGR))
msk.set(F_RAGGR, ven_rec.get(CFV_RAGGDOC));
if (!ini.exist(DOC_RAGGREFF))
msk.set(F_RAGGREFF, ven_rec.get(CFV_RAGGEFF));
if (!ini.exist(DOC_CODINDSP))
msk.set(F_CODINDSP, ven_rec.get(CFV_CODINDSP), true);
if (!ini.exist(DOC_CODAG))
msk.set(F_CODAG, ven_rec.get(CFV_CODAG));
if (!ini.exist(DOC_CODSPMEZZO))
msk.set(F_CODSPMEZZO, ven_rec.get(CFV_CODSPMEZZO), true);
if (!ini.exist(DOC_CODPORTO))
msk.set(F_CODPORTO, ven_rec.get(CFV_CODPORTO), true);
if (!ini.exist(DOC_CODNOTESP1))
msk.set(F_CODNOTESP1, ven_rec.get(CFV_CODNOTESP1), true);
if (!ini.exist(DOC_CODNOTESP2))
msk.set(F_CODNOTESP2, ven_rec.get(CFV_CODNOTESP2), true);
if (!ini.exist(DOC_CODNOTE))
msk.set(F_CODNOTE, ven_rec.get(CFV_CODNOTE), true);
if (!ini.exist(DOC_CODVETT1))
msk.set(F_CODVETT1, ven_rec.get(CFV_CODVETT1), true);
if (!ini.exist(DOC_CODVETT2))
msk.set(F_CODVETT2, ven_rec.get(CFV_CODVETT2), true);
if (!ini.exist(DOC_CODVETT3))
msk.set(F_CODVETT3, ven_rec.get(CFV_CODVETT3), true);
if (!ini.exist(DOC_PERCSPINC))
msk.set(F_SPESEINC, ven_rec.get(CFV_PERCSPINC));
if (!ini.exist(DOC_ADDBOLLI))
msk.set(F_ADDBOLLI, ven_rec.get(CFV_ADDBOLLI));
if (!ini.exist(DOC_CATVEN))
msk.set(F_CATVEN, ven_rec.get(CFV_CATVEN), false);
if (!ini.exist(DOC_ZONA))
msk.set(F_CODZON, ven_rec.get(CFV_CODZONA), true);
if (!ini.exist(DOC_CODLIST))
{
const TString16 codlist = ven_rec.get(CFV_CODLIST);
msk.set(F_CODLIST, codlist, true);
msk.set(F_CODLIST1, codlist, true);
}
TSheet_field& f = msk.sfield(F_SHEET); TSheet_field& f = msk.sfield(F_SHEET);
TTipo_riga_documento tr; TTipo_riga_documento tr;
@ -489,7 +611,7 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
} }
// Considera solo i tipi riga validi // Considera solo i tipi riga validi
const TString16 tipo = ini.get(RDOC_TIPORIGA); const TString16 tipo(ini.get(RDOC_TIPORIGA));
if (tr.read(tipo) == NOERR) if (tr.read(tipo) == NOERR)
{ {
// Crea una nuova riga documento // Crea una nuova riga documento
@ -533,6 +655,7 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
if (xvt_str_compare_ignoring_case(key, RDOC_TIPORIGA) != 0) // ... ed il tipo riga if (xvt_str_compare_ignoring_case(key, RDOC_TIPORIGA) != 0) // ... ed il tipo riga
rec.put(key, val); rec.put(key, val);
} }
// solo la insert chiama la post_insert necessaria alla disabilitazione verifichiamo // solo la insert chiama la post_insert necessaria alla disabilitazione verifichiamo
// l'autoload ?? // l'autoload ??
f.insert(-1, FALSE); f.insert(-1, FALSE);
@ -543,7 +666,8 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
if (checked) if (checked)
{ {
const TString& codart = rec.get(RDOC_CODARTMAG); const TString& codart = rec.get(RDOC_CODARTMAG);
if (!codart.blank())
if (codart.full())
{ {
const TRectype& art = cache().get(LF_ANAMAG, codart); const TRectype& art = cache().get(LF_ANAMAG, codart);
if (art.empty()) if (art.empty())
@ -553,7 +677,29 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
} }
} }
} }
else
{
if (!ini.exist(RDOC_DESCR))
{
const TString& codart = rec.get(RDOC_CODARTMAG);
if (codart.full())
{
const TRectype& art = cache().get(LF_ANAMAG, codart);
rec.put(RDOC_DESCR, art.get(ANAMAG_DESCR));
rec.put(RDOC_CODIVA, art.get(ANAMAG_CODIVA));
}
rec.put(RDOC_CHECKED, "X");
}
}
if (!ini.exist(RDOC_CODIVA) && !(rec.is_descrizione() || rec.is_sconto() || rec.is_sconto_perc()))
{
const TString4 codiva = ((TDocumento_mask &) msk).condv().clifo().vendite().get(CFV_ASSFIS);
if (codiva.full())
rec.put(RDOC_CODIVA, codiva);
}
rec.autoload(f); rec.autoload(f);
f.check_row(f.items() - 1, 0x2); f.check_row(f.items() - 1, 0x2);
@ -567,7 +713,7 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
void TMotore_application::print() void TMotore_application::print()
{ {
if (_print_directly || save(TRUE)) // Registra il record corrente if (_print_directly || save(false)) // Registra il record corrente
{ {
TDocumento& doc = (TDocumento&)get_relation()->curr(); TDocumento& doc = (TDocumento&)get_relation()->curr();

View File

@ -37,6 +37,9 @@ class TMotore_application : public TRelation_application
int _link_pos; int _link_pos;
bool _print_directly; bool _print_directly;
protected:
// Ridefinizione dei metodi virtuali // Ridefinizione dei metodi virtuali
virtual bool user_create( ); virtual bool user_create( );
virtual bool user_destroy( ); virtual bool user_destroy( );
@ -50,7 +53,7 @@ class TMotore_application : public TRelation_application
virtual int write( const TMask& m ); virtual int write( const TMask& m );
virtual int rewrite( const TMask& m ); virtual int rewrite( const TMask& m );
virtual void print(); virtual void print();
virtual bool has_filtered_cursor() const { return TRUE; } virtual bool has_filtered_cursor() const { return true; }
virtual bool save_and_new() const; virtual bool save_and_new() const;
// Funzioni da associare ad ogni procedura // Funzioni da associare ad ogni procedura
int user_function( int index ); int user_function( int index );
@ -59,8 +62,6 @@ class TMotore_application : public TRelation_application
virtual const char * extra_modules() const {return "dt";} virtual const char * extra_modules() const {return "dt";}
protected:
virtual void on_firm_change(); virtual void on_firm_change();
// Procedure e funzioni per la gestione degli stati // Procedure e funzioni per la gestione degli stati
@ -78,7 +79,7 @@ public:
// Funzioni di accesso alle variabili private // Funzioni di accesso alle variabili private
TMask & query_mask() { CHECK( _msk, "Maschera di ricerca nulla!" ); return *_msk; } TMask & query_mask() { CHECK( _msk, "Maschera di ricerca nulla!" ); return *_msk; }
TDocumento_mask & edit_mask() { CHECK( _docmsk, "Maschera di edit nulla!" ); return *_docmsk; } virtual TDocumento_mask & edit_mask() const { CHECK( _docmsk, "Maschera di edit nulla!" ); return *_docmsk; }
TRelation & rel() { CHECK( _rel, "Relazione nulla!" ); return *_rel; } TRelation & rel() { CHECK( _rel, "Relazione nulla!" ); return *_rel; }
TSheet_field & sheet() { return edit_mask().sheet(); } TSheet_field & sheet() { return edit_mask().sheet(); }
TConfig & config_ditta() {return *_config_ditta; } TConfig & config_ditta() {return *_config_ditta; }

View File

@ -9,6 +9,7 @@
#include <reprint.h> #include <reprint.h>
#include <statbar.h> #include <statbar.h>
#include <clifo.h>
#include <cfven.h> #include <cfven.h>
#include <comuni.h> #include <comuni.h>
#include <nditte.h> #include <nditte.h>
@ -782,6 +783,7 @@ class TReport_doc_app : public TSkeleton_application
int _anno; int _anno;
TString4 _codnum; TString4 _codnum;
long _ndoc; long _ndoc;
bool _archive;
protected: protected:
void add_data_filter(TString& query, bool from) const; void add_data_filter(TString& query, bool from) const;
@ -792,6 +794,8 @@ protected:
void set_next_pdf(int a, const char* c, long n); void set_next_pdf(int a, const char* c, long n);
virtual bool get_next_pdf(int anno, long ditta, const char* codnum, long numdoc, TFilename& pdf) const; virtual bool get_next_pdf(int anno, long ditta, const char* codnum, long numdoc, TFilename& pdf) const;
virtual bool get_next_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn,
TString& subj, TString& text, TToken_string& attach, bool& ui) const ;
public: public:
virtual bool create(); virtual bool create();
@ -800,20 +804,39 @@ public:
}; };
void TReport_doc_app::set_next_pdf(int a, const char* c, long n) void TReport_doc_app::set_next_pdf(int a, const char* c, long n)
{
_archive = n > 0L;
if (_archive)
{ {
_anno = a; _anno = a;
_codnum = c; _codnum = c;
_ndoc = n; _ndoc = n;
} }
}
bool TReport_doc_app::get_next_pdf(int anno, long ditta, const char* codnum, long ndoc, TFilename& pdf) const bool TReport_doc_app::get_next_pdf(int anno, long ditta, const char* codnum, long ndoc, TFilename& pdf) const
{ {
bool ok = false; bool ok = false;
if (_anno > 0 && _codnum.full() && _ndoc > 0) if (_archive)
ok = TSkeleton_application::get_next_pdf(_anno, ditta, _codnum, _ndoc, pdf); ok = TSkeleton_application::get_next_pdf(_anno, ditta, _codnum, _ndoc, pdf);
return ok; return ok;
} }
bool TReport_doc_app::get_next_mail(TToken_string& to, TToken_string& cc, TToken_string& ccn,
TString& subj, TString& text, TToken_string& attach, bool& ui) const
{
const bool ok = TApplication::get_next_mail(to, cc, ccn, subj, text, attach, ui);
if (_ndoc > 0L)
{
TDocumento doc('D', _anno, _codnum, _ndoc);
to = doc.clifor().get(CLI_MAIL);
doc.riferimento(subj);
}
return ok;
}
void TReport_doc_app::add_data_filter(TString& query, bool from) const void TReport_doc_app::add_data_filter(TString& query, bool from) const
{ {
if (from) if (from)
@ -895,14 +918,10 @@ bool TReport_doc_app::print_loop(const TString& query)
if (is_definitive) if (is_definitive)
{ {
const TString& codnum = doc.get(DOC_CODNUM).as_string(); const TString& codnum = doc.get(DOC_CODNUM).as_string();
arc = cache().get("%NUM", codnum, "B6").full(); arc = cache().get("%NUM", codnum, "B6").full();
if (arc)
{
set_next_pdf(doc.get(DOC_ANNO).as_int(),
doc.get(DOC_CODNUM).as_string(),
doc.get(DOC_NDOC).as_int());
}
} }
set_next_pdf(doc.get(DOC_ANNO).as_int(), doc.get(DOC_CODNUM).as_string(), doc.get(DOC_NDOC).as_int());
const TString& tipodoc = doc.get(DOC_TIPODOC).as_string(); const TString& tipodoc = doc.get(DOC_TIPODOC).as_string();
const TTipo_documento& tipo = _tipi_cache.tipo(tipodoc); const TTipo_documento& tipo = _tipi_cache.tipo(tipodoc);

View File

@ -1,9 +1,11 @@
#include <automask.h> #include <automask.h>
#include <config.h> #include <config.h>
#include <expr.h>
#include <execp.h> #include <execp.h>
#include <mailbox.h> #include <mailbox.h>
#include <progind.h> #include <progind.h>
#include <relapp.h> #include <relapp.h>
#include <recarray.h>
#include <tabutil.h> #include <tabutil.h>
#include <utility.h> #include <utility.h>
@ -418,11 +420,20 @@ bool TCondizioni_vendita::handle_copy(TMask_field &b, KEY k)
TRelation rel(LF_RCONDV); // creo un relazione sul file delle righe delle condizioni di vendita TRelation rel(LF_RCONDV); // creo un relazione sul file delle righe delle condizioni di vendita
TRectype& rec = rel.curr(); // creo il record che usa nel filtro; case in base al tipo documentovendita TRectype& rec = rel.curr(); // creo il record che usa nel filtro; case in base al tipo documentovendita
rec.put("TIPO",m.get(F_TIPO)); rec.put("TIPO",m.get(F_TIPO));
rel.add(LF_ANAMAG, "CODART==CODRIGA");
TString16 newcode; //var stringa in cui mettere il nuovo codice del listino/contratto/offerta TString16 newcode; //var stringa in cui mettere il nuovo codice del listino/contratto/offerta
const bool overwrite = m.get_bool(F_OVERWRITE); //deve sovrascrivere le righe doc gia' esistenti? const bool overwrite = m.get_bool(F_OVERWRITE); //deve sovrascrivere le righe doc gia' esistenti?
const real perc = (CENTO + m.get_real(F_PERC)) / CENTO; const TString & source = m.get(F_PERC);
const bool multiply = source.full();
TExpression e(source);
TArray v;
const char tipo = m.get(F_TIPO)[0]; const char tipo = m.get(F_TIPO)[0];
for (int i = 0; i < e.numvar(); i ++)
{
const TString name(e.varname(i));
v.add(new TFieldref(name, 0));
}
switch(tipo) switch(tipo)
{ {
case 'L': case 'L':
@ -452,13 +463,17 @@ bool TCondizioni_vendita::handle_copy(TMask_field &b, KEY k)
const bool gestum = msk.get_bool(F_GESTUM); const bool gestum = msk.get_bool(F_GESTUM);
const bool gestscagl = msk.get_bool(F_GESTSCAGL); const bool gestscagl = msk.get_bool(F_GESTSCAGL);
rel_umart.add(LF_ANAMAG, "CODART==CODART");
if (!gestum) if (!gestum)
filtro = "NRIGA==1"; filtro = "NRIGA==1";
TCursor curs(&rel_umart, filtro);
TRectype from(LF_UMART);
TRectype to(LF_UMART);
TCursor curs(&rel_umart, filtro, 1, from.empty() ? NULL : &from, to.empty() ? NULL : &to);
const long items = curs.items(); // metto in items il numero di elementi del cursore const long items = curs.items(); // metto in items il numero di elementi del cursore
curs.freeze();
TProgind bar(items,"Scansione articoli", FALSE, TRUE); //barra di avanzamento TProgind bar(items,"Scansione articoli", FALSE, TRUE); //barra di avanzamento
curs.freeze();
for (curs = 0; curs.pos() < items; ++curs) for (curs = 0; curs.pos() < items; ++curs)
{ {
bar.addstatus(1); bar.addstatus(1);
@ -477,7 +492,18 @@ bool TCondizioni_vendita::handle_copy(TMask_field &b, KEY k)
else else
rec.zero(RCONDV_NSCAGL); rec.zero(RCONDV_NSCAGL);
const real prezzo = rec_umart.get_real(UMART_PREZZO) * perc; real prezzo = rec_umart.get_real(UMART_PREZZO);
if (multiply)
{
FOR_EACH_ARRAY_ITEM(v, j, obj)
{
const TFieldref * f = (const TFieldref *) obj;
e.setvar(j, f->read(rel_umart));
}
prezzo *= (CENTO + e.as_real()) / CENTO;
}
rec.put(RCONDV_PREZZO, prezzo); rec.put(RCONDV_PREZZO, prezzo);
int err = rel.write(); int err = rel.write();
@ -488,14 +514,44 @@ bool TCondizioni_vendita::handle_copy(TMask_field &b, KEY k)
} }
else else
{ {
TCursor curs(&rel,"",1,&rec,&rec); //creo anche il cursore della relazione, con chiave 1(codice) e record iniz. e fin. uguali nel filtro TRectype from(rec);
TRectype to(rec);
const TString & codf = m.get(F_FROMCOD);
if (codf.full())
{
from.put(RCONDV_TIPORIGA, "A");
from.put(RCONDV_CODRIGA, codf);
}
const TString & codt = m.get(F_TOCOD);
if (codt.full())
{
to.put(RCONDV_TIPORIGA, "A");
to.put(RCONDV_CODRIGA, codt);
}
TCursor curs(&rel,"",1, &from, &to); //creo anche il cursore della relazione, con chiave 1(codice) e record iniz. e fin. uguali nel filtro
const long items = curs.items(); // metto in items il numero di elementi del cursore const long items = curs.items(); // metto in items il numero di elementi del cursore
curs.freeze(); curs.freeze();
TProgind bar(items,"Scansione righe di origine", FALSE, TRUE); //barra di avanzamento TProgind bar(items,"Scansione righe di origine", FALSE, TRUE); //barra di avanzamento
for (curs=0; curs.pos() < items; ++curs) for (curs=0; curs.pos() < items; ++curs)
{ {
const real prezzo = rec.get_real(RCONDV_PREZZO) * perc; real prezzo = rec.get_real(RCONDV_PREZZO);
if (multiply)
{
FOR_EACH_ARRAY_ITEM(v, j, obj)
{
const TFieldref * f = (const TFieldref *) obj;
e.setvar(j, f->read(rel));
}
prezzo *= (CENTO + e.as_real()) / CENTO;
}
bar.addstatus(1); bar.addstatus(1);
rec.put(RCONDV_COD, newcode); rec.put(RCONDV_COD, newcode);
@ -507,7 +563,7 @@ bool TCondizioni_vendita::handle_copy(TMask_field &b, KEY k)
} }
} }
} }
return TRUE; return true;
} }

View File

@ -1,6 +1,6 @@
#include "ve2200x.h" #include "ve2200x.h"
PAGE "Copia" -1 -1 70 10 PAGE "Copia" -1 -1 70 12
GROUPBOX DLG_NULL -1 6 GROUPBOX DLG_NULL -1 6
BEGIN BEGIN
@ -173,9 +173,36 @@ BEGIN
PROMPT 2 6 "Sovrascrivere record gia' presenti in caso di copia" PROMPT 2 6 "Sovrascrivere record gia' presenti in caso di copia"
END END
NUMBER F_PERC 6 2 STRING F_PERC 70
BEGIN BEGIN
PROMPT 2 7 "Percentuale di aumento " PROMPT 2 7 "Percentuale di aumento "
FLAGS "U"
END
STRING F_FROMCOD 20
BEGIN
PROMPT 2 8 "Da Codice articolo "
USE LF_ANAMAG
INPUT CODART F_FROMCOD
DISPLAY "Articolo@20" CODART
DISPLAY "Descrizione@50" DESCR
OUTPUT F_FROMCOD CODART
CHECKTYPE SEARCH
FLAGS "U"
ADD RUN ve2 -3
END
STRING F_TOCOD 20
BEGIN
PROMPT 2 9 "Da Codice articolo "
USE LF_ANAMAG
INPUT CODART F_TOCOD
DISPLAY "Articolo@20" CODART
DISPLAY "Descrizione@50" DESCR
OUTPUT F_TOCOD CODART
CHECKTYPE SEARCH
FLAGS "U"
ADD RUN ve2 -3
END END
BUTTON DLG_OK 10 2 BUTTON DLG_OK 10 2

View File

@ -42,3 +42,5 @@
#define BTN_COPIA 162 #define BTN_COPIA 162
#define F_OVERWRITE 163 #define F_OVERWRITE 163
#define F_PERC 164 #define F_PERC 164
#define F_FROMCOD 165
#define F_TOCOD 166

View File

@ -8,9 +8,12 @@
#include <tabutil.h> #include <tabutil.h>
#include "../cg/cg2103.h" #include "../cg/cg2103.h"
#include "../gv/gvlib.h"
#include "velib.h" #include "velib.h"
#include "velib07.h" #include "velib07.h"
#include <nditte.h>
#include "ve8.h" #include "ve8.h"
#include "ve8100a.h" #include "ve8100a.h"
@ -62,6 +65,11 @@ public:
bool TListaRitFisc::crea_righe(const TListaRitFisc_mask& m) const bool TListaRitFisc::crea_righe(const TListaRitFisc_mask& m) const
{ {
// cerca abi e cab della ditta
const TString16 abi = prefix().firm().get(NDT_ABIBAN);
const TString16 cab = prefix().firm().get(NDT_CABBAN);
const TDate datascad = m.get(F_DATASCAD);
int err=NOERR; int err=NOERR;
TLocalisamfile righe(LF_RIGHEF24); TLocalisamfile righe(LF_RIGHEF24);
TDocument_recordset rdoc("USE RDOC\nSELECT (TIPORIGA=='04')&&(110@->S10!='')&&(NUM(ANSI(33.DATADOC)>=ANSI(#DADATA)))&&(NUM(ANSI(33.DATADOC)<=ANSI(#ADATA)))\nJOIN SPP ALIAS 110 INTO CODTAB=CODART\nJOIN DOC INTO PROVV=PROVV ANNO=ANNO CODNUM=CODNUM NDOC=NDOC\nFROM CODNUM=#NUM\nTO CODNUM=#NUM"); TDocument_recordset rdoc("USE RDOC\nSELECT (TIPORIGA=='04')&&(110@->S10!='')&&(NUM(ANSI(33.DATADOC)>=ANSI(#DADATA)))&&(NUM(ANSI(33.DATADOC)<=ANSI(#ADATA)))\nJOIN SPP ALIAS 110 INTO CODTAB=CODART\nJOIN DOC INTO PROVV=PROVV ANNO=ANNO CODNUM=CODNUM NDOC=NDOC\nFROM CODNUM=#NUM\nTO CODNUM=#NUM");
@ -72,21 +80,24 @@ bool TListaRitFisc::crea_righe(const TListaRitFisc_mask& m) const
rdoc.set_var("#ADATA", var); rdoc.set_var("#ADATA", var);
var = m.get(F_CODNUM); var = m.get(F_CODNUM);
rdoc.set_var("#NUM", var); rdoc.set_var("#NUM", var);
righe.last(); long cont = get_next_progr_f24();
int cont=righe.get_long("PROGR"); long numf24 = get_next_f24();
// trucco per poter usare la get (nei TDocument_recordset la get ha 2 par. ed e' protected!) // trucco per poter usare la get (nei TDocument_recordset la get ha 2 par. ed e' protected!)
const TRecordset& curr = rdoc; const TRecordset& curr = rdoc;
for (bool ok = rdoc.move_first(); ok; ok = rdoc.move_next()) for (bool ok = rdoc.move_first(); ok; ok = rdoc.move_next())
{ {
cont++;
righe.zero(); righe.zero();
righe.put("PROGR", cont); righe.put("PROGR", cont++);
righe.put("F24", 0); righe.put("F24", numf24++);
righe.put("TRIBUTO", curr.get("SPP.S10").as_string()); righe.put("TRIBUTO", curr.get("SPP.S10").as_string());
righe.put("TIPOINTEST", 'C'); righe.put("TIPOINTEST", 'C');
righe.put("INTEST", curr.get("DOC.CODCF").as_int()); righe.put("INTEST", curr.get("DOC.CODCF").as_int());
righe.put("DESCR", "Riga generata"); righe.put("DESCR", "Riga generata");
righe.put("IMPORTODEB", curr.get("RDOC.RITENUTA").as_real()); righe.put("IMPORTODEB", curr.get("RDOC.RITENUTA").as_real());
righe.put("ABI", abi);
righe.put("CAB", cab);
righe.put("DATAVERS", datascad);
righe.put("DATASCAD", datascad);
err = righe.write(); err = righe.write();
} }
return (err==NOERR); return (err==NOERR);

View File

@ -9,7 +9,7 @@ END
BUTTON DLG_ELABORA 10 2 BUTTON DLG_ELABORA 10 2
BEGIN BEGIN
PROMPT -23 -1 "~Crea righe F24" PROMPT -23 -1 ""
PICTURE BMP_ELABORA PICTURE BMP_ELABORA
MESSAGE EXIT,K_SAVE MESSAGE EXIT,K_SAVE
END END
@ -27,6 +27,7 @@ DATE F_DATAINI
BEGIN BEGIN
PROMPT 2 1 "Documenti dal " PROMPT 2 1 "Documenti dal "
WARNING "La data di inizio intervallo e' obbligatoria" WARNING "La data di inizio intervallo e' obbligatoria"
CHECKTYPE REQUIRED
FIELD #DADATA FIELD #DADATA
END END
@ -34,6 +35,7 @@ DATE F_DATAFIN
BEGIN BEGIN
PROMPT 28 1 "al " PROMPT 28 1 "al "
WARNING "La data di fine intervallo e' obbligatoria" WARNING "La data di fine intervallo e' obbligatoria"
CHECKTYPE REQUIRED
FIELD #ADATA FIELD #ADATA
END END
@ -62,6 +64,13 @@ BEGIN
COPY OUTPUT F_CODNUM COPY OUTPUT F_CODNUM
END END
DATE F_DATASCAD
BEGIN
PROMPT 2 5 "Data scadenza "
CHECKTYPE REQUIRED
WARNING "La data di scadenza e' obbligatoria"
END
ENDPAGE ENDPAGE
ENDMASK ENDMASK

View File

@ -4,4 +4,4 @@
#define F_DATAFIN 102 #define F_DATAFIN 102
#define F_CODNUM 103 #define F_CODNUM 103
#define F_DESNUM 104 #define F_DESNUM 104
#define F_DATASCAD 105

File diff suppressed because it is too large Load Diff

View File

@ -14,6 +14,7 @@ Item_08 = "Servizi", [ACQVEN_021]
Item_09 = "Configurazione", [ACQVEN_020] Item_09 = "Configurazione", [ACQVEN_020]
Item_10 = "Importazione documenti STORE", <dtmenu.men> Item_10 = "Importazione documenti STORE", <dtmenu.men>
Item_11 = "Trasferimento PACK", <tpmenu.men> Item_11 = "Trasferimento PACK", <tpmenu.men>
Item_12 = "Vendita al dettaglio", <vdmenu.men>, "E"
[ACQVEN_001] [ACQVEN_001]
Caption = "Archivi e tabelle di base" Caption = "Archivi e tabelle di base"

View File

@ -15,9 +15,7 @@ JOIN %CTR TO 33 ALIAS 207 INTO CODTAB==CAUSTRASP
JOIN %BAN TO 33 ALIAS 208 INTO CODTAB==CODABIA JOIN %BAN TO 33 ALIAS 208 INTO CODTAB==CODABIA
JOIN %VAL TO 33 ALIAS 209 INTO CODTAB==CODVAL JOIN %VAL TO 33 ALIAS 209 INTO CODTAB==CODVAL
JOIN %TIP TO 33 ALIAS 210 INTO CODTAB==TIPODOC JOIN %TIP TO 33 ALIAS 210 INTO CODTAB==TIPODOC
END END
DESCRIPTION DESCRIPTION
BEGIN BEGIN
34->* "Righe documenti di vendita" 34->* "Righe documenti di vendita"
@ -36,7 +34,6 @@ BEGIN
207@->* "Tabella causale del trasporto" 207@->* "Tabella causale del trasporto"
208@->* "Tabella banche agenzia" 208@->* "Tabella banche agenzia"
END END
GENERAL GENERAL
BEGIN BEGIN
OFFSET 0 0 OFFSET 0 0
@ -50,18 +47,13 @@ BEGIN
EXCLUDE "02," EXCLUDE "02,"
EXCLUDE "03," EXCLUDE "03,"
END END
SECTION GRAPHICS ODD SECTION GRAPHICS ODD
FIGURA 99 93 68 FIGURA 99 93 68
BEGIN BEGIN
PROMPT 1 1 "fattura.bmp" PROMPT 1 1 "fattura.bmp"
END END
END END
SECTION HEADER ODD 27 SECTION HEADER ODD 27
STRINGA 200 1 STRINGA 200 1
BEGIN BEGIN
KEY "abilita/disabilita stampa intestazione ditta " KEY "abilita/disabilita stampa intestazione ditta "
@ -69,7 +61,6 @@ BEGIN
MESSAGE ENABLE,15@ MESSAGE ENABLE,15@
FLAGS "H" FLAGS "H"
END END
STRINGA 1 35 1 STRINGA 1 35 1
BEGIN BEGIN
KEY "nome ditta" KEY "nome ditta"
@ -78,7 +69,6 @@ BEGIN
GROUP 15 GROUP 15
FLAGS "D" FLAGS "D"
END END
STRINGA 2 35 1 STRINGA 2 35 1
BEGIN BEGIN
KEY "indirizzo ditta" KEY "indirizzo ditta"
@ -87,7 +77,6 @@ BEGIN
GROUP 15 GROUP 15
FLAGS "D" FLAGS "D"
END END
STRINGA 3 5 1 STRINGA 3 5 1
BEGIN BEGIN
KEY "cap ditta" KEY "cap ditta"
@ -96,7 +85,6 @@ BEGIN
GROUP 15 GROUP 15
FLAGS "D" FLAGS "D"
END END
STRINGA 4 30 1 STRINGA 4 30 1
BEGIN BEGIN
KEY "comune ditta" KEY "comune ditta"
@ -105,7 +93,6 @@ BEGIN
GROUP 15 GROUP 15
FLAGS "D" FLAGS "D"
END END
STRINGA 5 8 1 STRINGA 5 8 1
BEGIN BEGIN
KEY "scritta P.IVA" KEY "scritta P.IVA"
@ -113,7 +100,6 @@ BEGIN
GROUP 15 GROUP 15
FLAGS "D" FLAGS "D"
END END
STRINGA 6 16 1 STRINGA 6 16 1
BEGIN BEGIN
KEY "partita iva ditta" KEY "partita iva ditta"
@ -122,7 +108,6 @@ BEGIN
GROUP 15 GROUP 15
FLAGS "D" FLAGS "D"
END END
STRINGA 7 12 1 STRINGA 7 12 1
BEGIN BEGIN
KEY "scritta COD.FISC." KEY "scritta COD.FISC."
@ -130,7 +115,6 @@ BEGIN
GROUP 15 GROUP 15
FLAGS "D" FLAGS "D"
END END
STRINGA 8 16 1 STRINGA 8 16 1
BEGIN BEGIN
KEY "codice fiscale ditta" KEY "codice fiscale ditta"
@ -139,14 +123,12 @@ BEGIN
GROUP 15 GROUP 15
FLAGS "D" FLAGS "D"
END END
STRINGA 9 2 STRINGA 9 2
BEGIN BEGIN
KEY "Numero di pagina" KEY "Numero di pagina"
PROMPT 88 20 "" PROMPT 88 20 ""
MESSAGE _PAGENO MESSAGE _PAGENO
END END
DATA 10 8 DATA 10 8
BEGIN BEGIN
KEY "data fattura" KEY "data fattura"
@ -154,42 +136,36 @@ BEGIN
FIELD 33->DATADOC FIELD 33->DATADOC
FORMAT "1442-" FORMAT "1442-"
END END
STRINGA 11 7 STRINGA 11 7
BEGIN BEGIN
KEY "numero fattura" KEY "numero fattura"
PROMPT 77 20 "" PROMPT 77 20 ""
FIELD 33->NDOC FIELD 33->NDOC
END END
STRINGA 12 5 STRINGA 12 5
BEGIN BEGIN
KEY "codice cliente" KEY "codice cliente"
PROMPT 2 22 "" PROMPT 2 22 ""
FIELD 33->CODCF FIELD 33->CODCF
END END
STRINGA 13 3 STRINGA 13 3
BEGIN BEGIN
KEY "codice agente" KEY "codice agente"
PROMPT 10 22 "" PROMPT 10 22 ""
FIELD 33->CODAG FIELD 33->CODAG
END END
STRINGA 14 14 STRINGA 14 14
BEGIN BEGIN
KEY "porto" KEY "porto"
PROMPT 57 22 "" PROMPT 57 22 ""
FIELD 203@->S0 FIELD 203@->S0
END END
STRING 15 6 STRING 15 6
BEGIN BEGIN
KEY "ordine" KEY "ordine"
PROMPT 26 22 "" PROMPT 26 22 ""
FIELD 33->NUMDOCRIF FIELD 33->NUMDOCRIF
END END
DATA 16 8 DATA 16 8
BEGIN BEGIN
KEY "data conferma" KEY "data conferma"
@ -197,56 +173,48 @@ BEGIN
FIELD 33->DATADOCRIF FIELD 33->DATADOCRIF
FORMAT "1442-" FORMAT "1442-"
END END
STRINGA 17 32 STRINGA 17 32
BEGIN BEGIN
KEY "condizioni di pagamento" KEY "condizioni di pagamento"
PROMPT 2 24 "" PROMPT 2 24 ""
FIELD 201@->S0 FIELD 201@->S0
END END
STRINGA 18 27 STRINGA 18 27
BEGIN BEGIN
KEY "banca d'appoggio istituto" KEY "banca d'appoggio istituto"
PROMPT 37 24 "" PROMPT 37 24 ""
FIELD 208@->S0 FIELD 208@->S0
END END
STRINGA 19 27 STRINGA 19 27
BEGIN BEGIN
KEY "banca d'appoggio agenzia" KEY "banca d'appoggio agenzia"
PROMPT 65 24 "" PROMPT 65 24 ""
FIELD 204@->S0 FIELD 204@->S0
END END
STRINGA 20 40 2 STRINGA 20 40 2
BEGIN BEGIN
KEY "cliente ragione sociale " KEY "cliente ragione sociale "
PROMPT 48 11 "" PROMPT 48 11 ""
MESSAGE _CLIENTE,!RAGSOC MESSAGE _CLIENTE,!RAGSOC
END END
STRINGA 21 40 2 STRINGA 21 40 2
BEGIN BEGIN
KEY "cliente indirizzo con numero civico" KEY "cliente indirizzo con numero civico"
PROMPT 48 13 "" PROMPT 48 13 ""
MESSAGE _CLIENTE,!INDNUM MESSAGE _CLIENTE,!INDNUM
END END
STRING 22 40 1 STRING 22 40 1
BEGIN BEGIN
KEY "destinatario, localita" KEY "destinatario, localita"
PROMPT 48 15 "" PROMPT 48 15 ""
MESSAGE _CLIENTE,LOCALITACF MESSAGE _CLIENTE,LOCALITACF
END END
STRINGA 23 5 1 STRINGA 23 5 1
BEGIN BEGIN
KEY "cliente cap" KEY "cliente cap"
PROMPT 48 16 "" PROMPT 48 16 ""
MESSAGE _CLIENTE,!CAP MESSAGE _CLIENTE,!CAP
END END
STRINGA 24 35 2 STRINGA 24 35 2
BEGIN BEGIN
KEY "cliente comune" KEY "cliente comune"
@ -255,7 +223,6 @@ BEGIN
MESSAGE COPY,26 MESSAGE COPY,26
FLAGS "H" FLAGS "H"
END END
STRINGA 25 2 1 STRINGA 25 2 1
BEGIN BEGIN
KEY "cliente provincia" KEY "cliente provincia"
@ -264,13 +231,11 @@ BEGIN
MESSAGE APPEND,26 MESSAGE APPEND,26
FLAGS "H" FLAGS "H"
END END
STRINGA 26 30 2 STRINGA 26 30 2
BEGIN BEGIN
KEY "cliente comune+prov." KEY "cliente comune+prov."
PROMPT 54 16 "" PROMPT 54 16 ""
END END
STRINGA 27 3 STRINGA 27 3
BEGIN BEGIN
KEY "cliente codice stato" KEY "cliente codice stato"
@ -278,7 +243,6 @@ BEGIN
MESSAGE _CLIENTE,STATOCF MESSAGE _CLIENTE,STATOCF
FLAGS "H" FLAGS "H"
END END
STRINGA 28 25 STRINGA 28 25
BEGIN BEGIN
KEY "cliente nome stato" KEY "cliente nome stato"
@ -287,87 +251,62 @@ BEGIN
FLAGS "D" FLAGS "D"
END END
STRING 29 11
BEGIN
KEY "copy partita iva"
PROMPT 1 1 ""
MESSAGE _CLIENTE,PAIV
MESSAGE COPY,30
FLAGS "H"
END
STRING 30 11
BEGIN
KEY "test PIVA/CF"
PROMPT 1 1 ""
MESSAGE EMPTY ENABLE,32
MESSAGE ENABLE,31
FLAGS "H"
END
STRING 31 11 STRING 31 11
BEGIN BEGIN
KEY "partita iva cliente" KEY "partita iva cliente"
PROMPT 36 22 "" PROMPT 37 22 ""
MESSAGE _CLIENTE,PAIV MESSAGE _CLIENTE,PAIV
FLAGS "D" FLAGS ""
END END
STRING 32 16 STRING 32 16
BEGIN BEGIN
KEY "codice fiscale cliente" KEY "codice fiscale cliente"
PROMPT 36 22 "" PROMPT 36 20 ""
MESSAGE _CLIENTE,COFI MESSAGE _CLIENTE,COFI
FLAGS "D" FLAGS ""
END END
STRING 33 2 STRING 33 2
BEGIN BEGIN
KEY "codice iso iva cliente" KEY "codice iso iva cliente"
PROMPT 35 23 "" PROMPT 35 22 ""
MESSAGE _CLIENTE,STATOPAIV MESSAGE _CLIENTE,STATOPAIV
FLAGS "D" FLAGS ""
END END
STRING 34 15 STRING 34 15
BEGIN BEGIN
KEY "causale di trasporto" KEY "causale di trasporto"
PROMPT 75 22 "" PROMPT 75 22 ""
FIELD 207@->S0 FIELD 207@->S0
END END
STRING 35 27 STRING 35 27
BEGIN BEGIN
KEY "valuta" KEY "valuta"
PROMPT 57 20 "" PROMPT 57 20 ""
FIELD CODVAL FIELD CODVAL
END END
STRING 36 27 STRING 36 27
BEGIN BEGIN
KEY "tipo documento" KEY "tipo documento"
PROMPT 2 20 "" PROMPT 2 20 ""
FIELD 210@->S0 FIELD 210@->S0
END END
END END
SECTION BODY ODD 5 SECTION BODY ODD 5
STRINGA 51 12 1 STRINGA 51 12 1
BEGIN BEGIN
KEY "codice articolo" KEY "codice articolo"
FIELD 34->CODART FIELD 34->CODART
PROMPT 2 1 "" PROMPT 2 1 ""
END END
STRINGA 52 20 22 STRINGA 52 20 22
BEGIN BEGIN
KEY "descrizione articolo" KEY "descrizione articolo"
MESSAGE _DESCRIGA MESSAGE _DESCRIGA
PROMPT 16 1 "" PROMPT 16 1 ""
END END
STRINGA 53 2 STRINGA 53 2
BEGIN BEGIN
KEY "unita' di misura" KEY "unita' di misura"
@ -375,7 +314,6 @@ BEGIN
FIELD 34->UMQTA FIELD 34->UMQTA
MESSAGE _ALIGN,#52,BOTTOM MESSAGE _ALIGN,#52,BOTTOM
END END
NUMBER 54 10 NUMBER 54 10
BEGIN BEGIN
KEY "quantita'" KEY "quantita'"
@ -385,7 +323,6 @@ BEGIN
GROUP 30 GROUP 30
MESSAGE _ALIGN,#52,BOTTOM MESSAGE _ALIGN,#52,BOTTOM
END END
NUMBER 55 12 NUMBER 55 12
BEGIN BEGIN
KEY "prezzo unitario" KEY "prezzo unitario"
@ -395,7 +332,6 @@ BEGIN
GROUP 29 GROUP 29
MESSAGE _ALIGN,#52,BOTTOM MESSAGE _ALIGN,#52,BOTTOM
END END
STRINGA 56 3 STRINGA 56 3
BEGIN BEGIN
KEY "sconto" KEY "sconto"
@ -403,7 +339,6 @@ BEGIN
FIELD 34->SCONTO FIELD 34->SCONTO
MESSAGE _ALIGN,#52,BOTTOM MESSAGE _ALIGN,#52,BOTTOM
END END
NUMBER 57 12 NUMBER 57 12
BEGIN BEGIN
KEY "importo netto" KEY "importo netto"
@ -413,7 +348,6 @@ BEGIN
GROUP 29 GROUP 29
MESSAGE _ALIGN,#52,BOTTOM MESSAGE _ALIGN,#52,BOTTOM
END END
STRINGA 58 3 STRINGA 58 3
BEGIN BEGIN
KEY "iva" KEY "iva"
@ -421,7 +355,6 @@ BEGIN
FIELD 34->CODIVA FIELD 34->CODIVA
MESSAGE _ALIGN,#52,BOTTOM MESSAGE _ALIGN,#52,BOTTOM
END END
NUMBER 59 15 NUMBER 59 15
BEGIN BEGIN
KEY "prezzo unitario scontato" KEY "prezzo unitario scontato"
@ -432,7 +365,6 @@ BEGIN
MESSAGE _ALIGN,#52,BOTTOM MESSAGE _ALIGN,#52,BOTTOM
FLAGS "H" FLAGS "H"
END END
NUMBER 60 15 NUMBER 60 15
BEGIN BEGIN
KEY "provvigione" KEY "provvigione"
@ -443,7 +375,6 @@ BEGIN
GROUP 31 GROUP 31
FLAGS "H" FLAGS "H"
END END
NUMBER 61 15 NUMBER 61 15
BEGIN BEGIN
KEY "Imposta" KEY "Imposta"
@ -454,21 +385,15 @@ BEGIN
GROUP 31 GROUP 31
FLAGS "H" FLAGS "H"
END END
END END
SECTION FOOTER ODD -49 SECTION FOOTER ODD -49
STRINGA 100 5 1 STRINGA 100 5 1
BEGIN BEGIN
KEY "stampa 'segue' in coda" KEY "stampa 'segue' in coda"
PROMPT 73 13 "SEGUE" PROMPT 73 13 "SEGUE"
END END
END END
SECTION FOOTER LAST -49 SECTION FOOTER LAST -49
NUMBER 101 12 NUMBER 101 12
BEGIN BEGIN
KEY "totale importi netti (non scontati)" KEY "totale importi netti (non scontati)"
@ -477,14 +402,12 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
STRINGA 102 7 STRINGA 102 7
BEGIN BEGIN
KEY "% sconto" KEY "% sconto"
PROMPT 23 3 "" PROMPT 23 3 ""
FIELD 33->SCONTOPERC FIELD 33->SCONTOPERC
END END
NUMBER 103 11 NUMBER 103 11
BEGIN BEGIN
KEY "totale sconti" KEY "totale sconti"
@ -493,7 +416,6 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
NUMBER 104 11 NUMBER 104 11
BEGIN BEGIN
KEY "spese di trasporto" KEY "spese di trasporto"
@ -502,7 +424,6 @@ BEGIN
FIELD SPESTRA FIELD SPESTRA
GROUP 31 GROUP 31
END END
NUMBER 105 11 NUMBER 105 11
BEGIN BEGIN
KEY "spese di imballo" KEY "spese di imballo"
@ -511,7 +432,6 @@ BEGIN
FIELD SPESIMB FIELD SPESIMB
GROUP 31 GROUP 31
END END
NUMBER 106 11 NUMBER 106 11
BEGIN BEGIN
KEY "acconto" KEY "acconto"
@ -520,14 +440,12 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
STRING 107 3 STRING 107 3
BEGIN BEGIN
KEY "codice iva 1" KEY "codice iva 1"
PROMPT 2 5 "" PROMPT 2 5 ""
MESSAGE _RIEPILOGOIVA,1,COD,0 MESSAGE _RIEPILOGOIVA,1,COD,0
END END
NUMBER 108 12 NUMBER 108 12
BEGIN BEGIN
KEY "imponibile 1" KEY "imponibile 1"
@ -536,7 +454,6 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
NUMBER 109 2 NUMBER 109 2
BEGIN BEGIN
KEY "iva 1" KEY "iva 1"
@ -544,7 +461,6 @@ BEGIN
MESSAGE _RIEPILOGOIVA,1,ALI,0 MESSAGE _RIEPILOGOIVA,1,ALI,0
PICTURE "##" PICTURE "##"
END END
NUMBER 110 10 NUMBER 110 10
BEGIN BEGIN
KEY "imposta 1" KEY "imposta 1"
@ -553,14 +469,12 @@ BEGIN
PICTURE "##.###.###" PICTURE "##.###.###"
GROUP 31 GROUP 31
END END
STRING 111 3 STRING 111 3
BEGIN BEGIN
KEY "codice iva 2" KEY "codice iva 2"
PROMPT 2 6 "" PROMPT 2 6 ""
MESSAGE _RIEPILOGOIVA,1,COD,0 MESSAGE _RIEPILOGOIVA,1,COD,0
END END
NUMBER 112 12 NUMBER 112 12
BEGIN BEGIN
KEY "imponibile 2" KEY "imponibile 2"
@ -569,7 +483,6 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
NUMBER 113 2 NUMBER 113 2
BEGIN BEGIN
KEY "iva 2" KEY "iva 2"
@ -577,7 +490,6 @@ BEGIN
MESSAGE _RIEPILOGOIVA,1,ALI,0 MESSAGE _RIEPILOGOIVA,1,ALI,0
PICTURE "##" PICTURE "##"
END END
NUMBER 114 10 NUMBER 114 10
BEGIN BEGIN
KEY "imposta 2" KEY "imposta 2"
@ -586,14 +498,12 @@ BEGIN
PICTURE "##.###.###" PICTURE "##.###.###"
GROUP 31 GROUP 31
END END
STRING 115 3 STRING 115 3
BEGIN BEGIN
KEY "codice iva 3" KEY "codice iva 3"
PROMPT 2 7 "" PROMPT 2 7 ""
MESSAGE _RIEPILOGOIVA,1,COD,0 MESSAGE _RIEPILOGOIVA,1,COD,0
END END
NUMBER 116 12 NUMBER 116 12
BEGIN BEGIN
KEY "imponibile 3" KEY "imponibile 3"
@ -602,7 +512,6 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
NUMBER 117 2 NUMBER 117 2
BEGIN BEGIN
KEY "iva 3" KEY "iva 3"
@ -610,7 +519,6 @@ BEGIN
MESSAGE _RIEPILOGOIVA,1,ALI,0 MESSAGE _RIEPILOGOIVA,1,ALI,0
PICTURE "##" PICTURE "##"
END END
NUMBER 118 10 NUMBER 118 10
BEGIN BEGIN
KEY "imposta 3" KEY "imposta 3"
@ -619,7 +527,6 @@ BEGIN
PICTURE "##.###.###" PICTURE "##.###.###"
GROUP 31 GROUP 31
END END
NUMBER 119 12 NUMBER 119 12
BEGIN BEGIN
KEY "imponibile 4" KEY "imponibile 4"
@ -628,21 +535,18 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
STRINGA 120 3 STRINGA 120 3
BEGIN BEGIN
KEY "codice iva 4" KEY "codice iva 4"
PROMPT 2 9 "" PROMPT 2 9 ""
MESSAGE _RIEPILOGOIVA,30,COD,0 MESSAGE _RIEPILOGOIVA,30,COD,0
END END
STRINGA 121 45 STRINGA 121 45
BEGIN BEGIN
KEY "descrizione altri 4" KEY "descrizione altri 4"
PROMPT 44 9 "" PROMPT 44 9 ""
MESSAGE _RIEPILOGOIVA,30,DES,1 MESSAGE _RIEPILOGOIVA,30,DES,1
END END
NUMBER 122 12 NUMBER 122 12
BEGIN BEGIN
KEY "imponibile 5" KEY "imponibile 5"
@ -651,21 +555,18 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
STRINGA 123 3 STRINGA 123 3
BEGIN BEGIN
KEY "codice iva 5" KEY "codice iva 5"
PROMPT 2 10 "" PROMPT 2 10 ""
MESSAGE _RIEPILOGOIVA,30,COD,0 MESSAGE _RIEPILOGOIVA,30,COD,0
END END
STRINGA 124 45 STRINGA 124 45
BEGIN BEGIN
KEY "descrizione altri 5" KEY "descrizione altri 5"
PROMPT 44 10 "" PROMPT 44 10 ""
MESSAGE _RIEPILOGOIVA,30,DES,1 MESSAGE _RIEPILOGOIVA,30,DES,1
END END
NUMBER 125 12 NUMBER 125 12
BEGIN BEGIN
KEY "totale imponibile" KEY "totale imponibile"
@ -674,7 +575,6 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
NUMBER 126 11 NUMBER 126 11
BEGIN BEGIN
KEY "totale imposta" KEY "totale imposta"
@ -683,7 +583,6 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
NUMBER 127 11 NUMBER 127 11
BEGIN BEGIN
KEY "totale esenti" KEY "totale esenti"
@ -692,7 +591,6 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
NUMBER 128 7 NUMBER 128 7
BEGIN BEGIN
KEY "spese di incasso" KEY "spese di incasso"
@ -701,7 +599,6 @@ BEGIN
FIELD SPESINC FIELD SPESINC
GROUP 31 GROUP 31
END END
NUMBER 129 7 NUMBER 129 7
BEGIN BEGIN
KEY "spese bolli" KEY "spese bolli"
@ -710,7 +607,6 @@ BEGIN
PICTURE "###.###" PICTURE "###.###"
GROUP 31 GROUP 31
END END
NUMBER 130 11 NUMBER 130 11
BEGIN BEGIN
KEY "totale fattura" KEY "totale fattura"
@ -720,7 +616,6 @@ BEGIN
GROUP 31 GROUP 31
MESSAGE COPY,138 MESSAGE COPY,138
END END
NUMBER 137 11 NUMBER 137 11
BEGIN BEGIN
KEY "acconto" KEY "acconto"
@ -730,7 +625,6 @@ BEGIN
GROUP 31 GROUP 31
MESSAGE SUB,138 MESSAGE SUB,138
END END
NUMBER 138 11 NUMBER 138 11
BEGIN BEGIN
KEY "netto a pagare" KEY "netto a pagare"
@ -738,7 +632,6 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
DATA 143 8 DATA 143 8
BEGIN BEGIN
KEY "scadenza pagamento 1" KEY "scadenza pagamento 1"
@ -746,7 +639,6 @@ BEGIN
MESSAGE _SCADENZE,DATA,0 MESSAGE _SCADENZE,DATA,0
FORMAT "1442-" FORMAT "1442-"
END END
NUMBER 144 12 NUMBER 144 12
BEGIN BEGIN
KEY "importo scadenza 1" KEY "importo scadenza 1"
@ -755,7 +647,6 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
DATA 145 8 DATA 145 8
BEGIN BEGIN
KEY "scadenza pagamento 2" KEY "scadenza pagamento 2"
@ -763,7 +654,6 @@ BEGIN
MESSAGE _SCADENZE,DATA,0 MESSAGE _SCADENZE,DATA,0
FORMAT "1442-" FORMAT "1442-"
END END
NUMBER 146 12 NUMBER 146 12
BEGIN BEGIN
KEY "importo scadenza 2" KEY "importo scadenza 2"
@ -772,7 +662,6 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
DATA 147 8 1 DATA 147 8 1
BEGIN BEGIN
KEY "scadenza pagamento 3" KEY "scadenza pagamento 3"
@ -780,7 +669,6 @@ BEGIN
MESSAGE _SCADENZE,DATA,0 MESSAGE _SCADENZE,DATA,0
FORMAT "1442-" FORMAT "1442-"
END END
NUMBER 148 12 NUMBER 148 12
BEGIN BEGIN
KEY "importo scadenza 3" KEY "importo scadenza 3"
@ -789,7 +677,6 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
DATA 149 8 1 DATA 149 8 1
BEGIN BEGIN
KEY "scadenza pagamento 4" KEY "scadenza pagamento 4"
@ -797,7 +684,6 @@ BEGIN
MESSAGE _SCADENZE,DATA,0 MESSAGE _SCADENZE,DATA,0
FORMAT "1442-" FORMAT "1442-"
END END
NUMBER 150 12 NUMBER 150 12
BEGIN BEGIN
KEY "importo scadenza 4" KEY "importo scadenza 4"
@ -806,7 +692,6 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
DATA 151 8 1 DATA 151 8 1
BEGIN BEGIN
KEY "scadenza pagamento 5" KEY "scadenza pagamento 5"
@ -814,7 +699,6 @@ BEGIN
MESSAGE _SCADENZE,DATA,0 MESSAGE _SCADENZE,DATA,0
FORMAT "1442-" FORMAT "1442-"
END END
NUMBER 152 12 NUMBER 152 12
BEGIN BEGIN
KEY "importo scadenza 5" KEY "importo scadenza 5"
@ -823,182 +707,4 @@ BEGIN
PICTURE "###.###.###" PICTURE "###.###.###"
GROUP 31 GROUP 31
END END
END END
// NOTE SULLA COMPILAZIONE DEI FORM DI STAMPA
//
// SEZIONE GENERAL
// ===============
// Posizionamento:
// e' possibile effettuari posizionamenti manuali dei form con le seguenti istruzioni:
// CARATTERE <S>
// INIZIALE <N> <N>
// FINALE <N> <N>
// dove:
// CARATTERE indica il carattere da stampare per contrassegnare il posizionamento, racchiuso tra doppi apici (eg "X")
// INIZIALE indica le coordinate X ed Y per il posizionamento iniziale (dove stampare il primo carattere)
// FINALE indica le coordinate X ed Y per il posizionamento finale (dove stampare il secondo carattere)
// FINALE puo' essere omesso; se definito e' comunque buona norma tenere la coordinata verticale (Y) uguale
// a quella indicata in INIZIALE, se diversi il programma tiene conto solo della prima.
// Non e' possibile definire sia posizionamenti manuali che OFFSET, quindi o l'uno o l'altro, preferibilmente
// e' meglio scegliere OFFSET.
//
// Modificatori di pictures:
// i parametri IMP_DECIMALS, QTA_DECIMALS, e PRI_DECIMALS settano i decimali da stampare/arrotondare
// per i seguenti: importi in genere, quantita', e prezzi. Il primo parametro intero e' per gli importi in lire
// il secondo per gli importi in valuta. Naturalmente per le quantita' non ha senso fare una cosa del genere, ma per completezza
// e' stata implementata.
// PRI_DECIMALS corrisponde al gruppo 29
// QTA_DECIMALS corrisponde al gruppo 30
// IMP_DECIMALS corrisponde al gruppo 31
// pertanto tutti i campi che apparterranno al gruppo 29,30 o 31 avranno gli importi stampati al numero di decimali impostati a
// seconda se il documento e' in lire o valuta. Se il numero di decimali e' 0 la picture rimarra' invariata.
// Altri gruppi definiti dall'utente saranno cosi' sintatticamente impostati:
// NEW_GROUP <n> <lit_dec> <val_dec>
// Dove <n> e' il numero del gruppo
// <lit_dec> e' il numero di decimali per i documenti in lire
// <val_dec> e' il numero di decimali per i documenti in valuta
//
// Definizione di liste di esclusione (facoltativo):
// EXCLUDE esclude dalla stampa le righe che soddisfano la condizione specificata.
// Si indicano in questo modo: "<tipo riga>,<cod. art>". Naturalmente si possono indicare tutti gli EXLCUDE che si vogliono.
// Es: EXCLUDE "V01,ART1" escludera' tutte le righe di tipo V01 con codice articolo ART1
// EXCLUDE ",ART1" escludera' tutte le righe che hanno codice articolo ART1
// EXCLUDE "V01," escludera' tutte le righe che hanno tipo riga V01
// EXCLUDE "," non escludera' nulla.
//
// MESSAGGI UTENTE
// ===============
// Note sui messaggi della testata/body/footer:
//
// _ISAMREAD:
// lettura generica di un file del database
// sintassi: _ISAMREAD,<file>,<espressione input>[!<espressione input>!...],{<campo file>|<espressione output>[!<espressione output>!...]}
// dove: <file> è il numero logico del file o il nome della tabella
// <espressione input> è un'espressione del tipo <campo file>=<espressione campi form>
// <espressione campi form> è un'espressione di costanti numeriche, stringhe e valori di campi della form (indicati con il loro numero preceduto da #)
// <espressione output> è un'espressione del tipo <campo form o gruppo>=<campo file> (se è un gruppo deve essere seguito da @) oppure solo <campo file> (il campo della form è quello corrente)
//
// _TABLEREAD:
// lettura generica di un campo di una tabella
// sintassi: _TABLEREAD,<tabella>,<chiave>,<campo file>
// dove: <tabella> nome tabella da leggere
// <chiave> costante stringa o riferimento a campo della form (preceduto da '#') da usare come chiave di ricerca
// <campo file> identificativo del campo da leggere dalla tabella
//
// _DITTA:
// lettura dei dati della ditta
// sintassi: _DITTA,{<campo relazione>|<macro>}
// dove: <campo relazione> è un riferimento alla relazione di gestione dei dati della ditta (es. 113@->DENCOM è la denominazione del comune di residenza della ditta)
// <macro> è uno delle macro seguenti:
// !RAGSOC ragione sociale
// !IND indirizzo (fiscale se c'è, oppure di residenza)
// !NUM numero civico (fiscale se c'è, oppure di residenza)
// !CAP CAP (fiscale se c'è, oppure di residenza)
// !COM comune (fiscale se c'è, oppure di residenza)
// !PROV provincia (fiscale se c'è, oppure di residenza)
// !IVA partita iva
// !CF codice fiscale
// !TEL numero di telefono (con prefisso)
// !FAX numero di fax (con prefisso)
// !REGSOC numero di registrazione presso il Tribunale
// !CCIAA numero di registrazione presso la camera di commercio
// nota: la relazione della ditta è così strutturata:
// %NDITTE (9) Dati ditte
// + %ANAGR (6) Anagrafica generale (indirizzo, ecc.)
// + %COMUNI (113@) Comune di residenza
// + %COMUNI (213@) Comune di residenza fiscale
// viene utilizzato perche' non e' possibile stabilire altrimenti una relazione con il file ditte
// dall'interno del form.
//
// _CLIENTE
// lettura dei dati del cliente
// sintassi: _CLIENTE,{<campo relazione>|<macro>}
// dove: <campo relazione> è un riferimento alla relazione di gestione dei dati del cliente
// <macro> è uno delle macro seguenti:
// !RAGSOC ragione sociale
// !CAP Codice Avviamento Postale (viene implementato un messaggio perche' sugli occasionali ha un nome campo diverso!!)
// !IND indirizzo
// !NUM numero civico
// !INDNUM indirizzo + numero civico
// !INDSPED indirizzo spedizione + numero civico
// !TEL primo numero di telefono (con prefisso)
// !TEL2 secondo numero di telefono (con prefisso)
// !TEL3 terzo numero di telefono (con prefisso)
// !FAX numero di fax (con prefisso)
// !COM-><FIELD> accede ai campi del comune di residenza cliente
// !COMN-><FIELD> accede ai campi del comune di nascita del cliente
// nota: la relazione del cliente è così strutturata:
// CLIFO (20) Clienti/fornitori
// + CFVEN (17) Clienti/fornitori per vendite
// + %COMUNI (113@) Comune di residenza
// + %COMUNI (213@) Comune di nascita
// viene utilizzato al posto del file 17 collegato perche' vi sono particolari
// accorgimenti per quanto riguarda i clienti occasionali.
//
// _DESCRIGA:
// Messaggio per reperire e formattare anche la descrizione estesa sulle righe del documento
//
// _ALIGN:
// allineamento della posizione di un campo rispetto ad un altro
// sintassi: _ALIGN,<campo form>[,<allineamento>][,<allineamento>...]
// dove: <campo form> è il campo della form (preceduto da '#') da cui prendere l'allineamento
// <allineamento> è uno dei seguenti valori:
// TOP allinea sulla riga d'inizio
// MIDDLE allinea al centro (effettivo)
// BOTTOM allinea sulla riga di fine (effettiva, non preimpostata)
// LEFT allinea sulla colonna d'inizio
// RIGHT allinea sulla colonna di fine
//
// _PAGENO:
// Messaggio per stampare il numero di pagina corrente
//
// _RIEPILOGOIVA:
// messaggio per stampare la tabella ripelogativa delle aliquote IVA e relative imposte
// sintassi: _RIEPILOGOIVA,<selettore>,<macro>,<cambio codice>
// dove: <selettore> è uno dei seguenti:
// 1 = codici IVA a regime normale
// 2 = codici IVA da ventilare
// 4 = codici IVA esenti
// 8 = codici IVA non imponibili
// 16 = codici IVA non soggetti
// oppure la combinazione di uno o piu' di essi:
// 12 = 4+8, 19 = 1+2+16, 29 = 1+4+8+16 ecc...
// pertanto per avere i non imponibili in totale il selettore sara' 1,
// per avere gli esenti il selettore sara' 4; per avere i non soggetti + esenti
// il selettore sara' 20 e cosi' via.
// dove: <macro> è uno dei seguenti:
// COD colonna dei codici
// IMP colonna degli imponibili
// IVA colonna delle imposte
// ALI colonna delle aliquote
// DES colonna delle descrizioni (stampata solo se il regime IVA non e' normale)
// dove: <cambio codice> è uno dei seguenti:
// 0 indica di non leggere il successivo codice IVA nella tabella riepilogativa
// 1 indica di leggere il successivo codice IVA nella tabella riepilogativa
//
// _TOTIMPONIBILI:
// messaggio per stampare diverse totalizzazioni di imponibili
// sintassi: _TOTIMPONIBILI,<selettore>
// dove: <selettore> funge da filtro per la somma degli imponibili
// vedi _RIEPILOGOIVA per la spiegazione dei filtri selettivi
//
// _SCADENZE:
// messaggio per stampare le scadenze
// sintassi: _SCADENZE,<macro>,<cambio codice>
// dove <macro> e' uno dei seguenti:
// DATA : stampa la data di scadenza
// IMPORTO : stampa l'importo in scadenza
// dove <cambio codice> vale 0 o 1 se indica di rendere corrente la prossima scadenza
//
// CAMPI VIRTUALI
// ==============
// Oltre a stampare i campi normali del file e' anche possibile stampare i campi virtuali
// definiti nei profili semplicemente indicandoli nella istruzione FIELD:
// per la testata del documento:
// BOLLI, BASESCONTO, IMPOSTE, PROVVD, SCONTOD, SPESEINC, TOTDOC, TOTMER, TOTNS, TOTPRE, TOTSPE
// per le righe:
// IMPLN, IMPLS, IMPNN, IMPNS, IMPOSTA, PREZZOLN, PREZZOLS, PREZZONN, PREZZONS, PROVVR, SCONTOR
// oltre, naturalmente a quelli definiti dall'utente

View File

@ -17,6 +17,10 @@ class TViswin;
#include "../ve/clifor.h" #include "../ve/clifor.h"
#endif #endif
#ifndef __RELAPP_H
#include <relapp.h>
#endif
#ifndef __CGLIB01_H #ifndef __CGLIB01_H
#include "../cg/cglib01.h" #include "../cg/cglib01.h"
#endif #endif
@ -199,6 +203,8 @@ public:
class TTipo_documento : public TRectype // velib03 class TTipo_documento : public TRectype // velib03
{ {
enum { _altro, _bolla, _fattura, _ordine, _scontrino};
static TAssoc_array _formule_documento; static TAssoc_array _formule_documento;
TToken_string _formule; TToken_string _formule;
TString_array _keys_descrs; // Tipi riga per listbox TString_array _keys_descrs; // Tipi riga per listbox
@ -232,8 +238,6 @@ protected:
public: public:
TObject* dup() const { return new TTipo_documento(codice()); } TObject* dup() const { return new TTipo_documento(codice()); }
enum { _altro, _bolla, _fattura, _ordine};
public: public:
const TFilename& profile_name(TFilename& name) const; const TFilename& profile_name(TFilename& name) const;
@ -244,7 +248,7 @@ public:
const TString_array& sheet_columns() const; const TString_array& sheet_columns() const;
const TString_array& handlers() const; const TString_array& handlers() const;
const TString& mask_name() const { return get("S4");} const TString& mask_name() const;
const TString& causale() const { return get("S6"); } const TString& causale() const { return get("S6"); }
int tipo() const { return get_int("I1"); } int tipo() const { return get_int("I1"); }
const TString& codice() const { return get("CODTAB");} const TString& codice() const { return get("CODTAB");}
@ -253,6 +257,7 @@ public:
bool is_fattura() const { return tipo() == _fattura; } bool is_fattura() const { return tipo() == _fattura; }
bool is_bolla() const { return tipo() == _bolla; } bool is_bolla() const { return tipo() == _bolla; }
bool is_ordine() const { return tipo() == _ordine; } bool is_ordine() const { return tipo() == _ordine; }
bool is_scontrino() const { return tipo() == _scontrino; }
bool controllo_prezzi() const { return _cnt_prezzi; } bool controllo_prezzi() const { return _cnt_prezzi; }
const char * field_prezzo() const { return _field_prezzo; } const char * field_prezzo() const { return _field_prezzo; }
const TString& field_qta() const { return _field_qta; } const TString& field_qta() const { return _field_qta; }
@ -285,6 +290,7 @@ public:
const char stato_finale_inserimento() const {return get("S2")[0]; } const char stato_finale_inserimento() const {return get("S2")[0]; }
const char stato_finale_stampa() const {return get("S2")[1]; } const char stato_finale_stampa() const {return get("S2")[1]; }
const char stato_bloccato() const {return get("S2")[2]; } const char stato_bloccato() const {return get("S2")[2]; }
const char stato_chiuso() const {return get("S2")[3]; }
const TString & stati_iniziali_modifica() const {return get("S2").mid(9,20); } const TString & stati_iniziali_modifica() const {return get("S2").mid(9,20); }
const TString & stati_iniziali_cancellazione() const {return get("S2").mid(29,20); } const TString & stati_iniziali_cancellazione() const {return get("S2").mid(29,20); }
const TString & stati_iniziali_stampa() const {return get("S2").mid(49,20); } const TString & stati_iniziali_stampa() const {return get("S2").mid(49,20); }
@ -550,6 +556,7 @@ class TRiepilogo_iva : public TObject
{ {
TCodiceIVA _codiva; TCodiceIVA _codiva;
real _imp; real _imp;
real _imp_orig;
real _imp_spese; real _imp_spese;
real _imp_spese_row; real _imp_spese_row;
real _iva; real _iva;
@ -564,9 +571,10 @@ protected:
virtual TRiepilogo_iva & copy(const TRiepilogo_iva & a); virtual TRiepilogo_iva & copy(const TRiepilogo_iva & a);
public: public:
real imponibile(bool spese = true) const { return _imp + (spese ? _imp_spese : ZERO);} // Imponibile real imponibile(bool spese = TRUE) const { return _imp + (spese ? _imp_spese : ZERO);} // Imponibile
real imposta(bool spese = true) const { return _iva + (spese ? _iva_spese : ZERO);} // Iva real imposta(bool spese = TRUE) const { return _iva + (spese ? _iva_spese : ZERO);} // Iva
real & imp() { return _imp;}; real & imp() { return _imp;};
real & imp_orig() { return _imp_orig;};
real & imp_spese() { return _imp_spese;}; real & imp_spese() { return _imp_spese;};
real & imp_spese_row() { return _imp_spese_row;}; real & imp_spese_row() { return _imp_spese_row;};
real & iva() { return _iva;}; real & iva() { return _iva;};
@ -607,7 +615,6 @@ class TDocumento : public TMultiple_rectype // velib03
TRiga_documento * _esenzione; // Riga per l' esenzione iva TRiga_documento * _esenzione; // Riga per l' esenzione iva
bool _dirty_deny; bool _dirty_deny;
bool _spese_updated;
static TAssoc_array _tipi; static TAssoc_array _tipi;
static TAssoc_array _numerazioni; static TAssoc_array _numerazioni;
@ -620,7 +627,9 @@ class TDocumento : public TMultiple_rectype // velib03
static TCodgiac_livelli *_livelli; static TCodgiac_livelli *_livelli;
protected: protected:
virtual TRectype * new_body_record(int logicnum = 0) { return new TRiga_documento(this); } virtual TRectype * new_body_record(int logicnum = 0)
{ return new TRiga_documento(this); }
TRiga_documento & row(int index); TRiga_documento & row(int index);
const TRiga_documento& physical_row(int index) const; const TRiga_documento& physical_row(int index) const;
@ -634,7 +643,7 @@ protected:
virtual TDocumento & copy(const TDocumento & d); virtual TDocumento & copy(const TDocumento & d);
virtual TObject* dup() const { return new TDocumento(*this); } virtual TObject* dup() const { return new TDocumento(*this); }
void calc_iva_fattura_commerciale(); void calc_iva_fattura_commerciale();
void update_tabella_iva(); void update_tabella_iva(bool solo_imponibili);
void dirty_tabella_iva() { _tabella_iva.destroy();} void dirty_tabella_iva() { _tabella_iva.destroy();}
static void test_firm(); static void test_firm();
@ -644,17 +653,15 @@ protected:
int set_row_ids(); int set_row_ids();
public: public:
virtual bool renum() { return renum_ndoc() > 0;}
long renum_ndoc(long numdoc = 0); long renum_ndoc(long numdoc = 0);
virtual bool renum() { return renum_ndoc() > 0;}
const TString& codiva_spese() const ; const TString& codiva_spese() const ;
const TString& codiva_bolli() const ; const TString& codiva_bolli() const ;
TCodgiac_livelli & livelli() const ; TCodgiac_livelli & livelli() const ;
void dirty_fields(); void dirty_fields();
bool & spese_updated() { return _spese_updated;} TAssoc_array & tabella_iva(bool solo_imponibili = false) { update_tabella_iva(solo_imponibili); return _tabella_iva; }
TAssoc_array & tabella_iva() { update_tabella_iva(); return _tabella_iva; }
TCli_for & clifor() const; TCli_for & clifor() const;
TOccasionale & occas() const; TOccasionale & occas() const;
const TAgente & agente() const; const TAgente & agente() const;
@ -720,6 +727,8 @@ public:
bool cancellabile() const; bool cancellabile() const;
bool stampabile() const; bool stampabile() const;
bool bloccato() const; bool bloccato() const;
bool chiuso() const;
bool sospeso() const { return !chiuso();}
bool raggruppabile() const { return get_bool("RAGGR"); } bool raggruppabile() const { return get_bool("RAGGR"); }
bool raggruppabile(const TDocumento& doc, TToken_string& campi) const; bool raggruppabile(const TDocumento& doc, TToken_string& campi) const;
@ -806,18 +815,24 @@ class TDocumento_mask : public TVariable_mask // velib06
short _last_cms_dlg; short _last_cms_dlg;
protected: protected:
void update_progs(bool stop_run = false);
virtual void next_page(int p); virtual void next_page(int p);
virtual void start_run(); virtual void start_run();
virtual bool stop_run(KEY key); virtual bool stop_run(KEY key);
void sconto_testa2mask(); void sconto_testa2mask();
void spese2mask(); void spese2mask();
void configura_sheet(TSheet_field& sheet);
static TMask* ss_getmask(int numriga, TMask& fullmask);
int insert_anal_fields(TMask& m, int page, int lf, int& y, short& dlg, short& dlgd, bool required); int insert_anal_fields(TMask& m, int page, int lf, int& y, short& dlg, short& dlgd, bool required);
void insert_anal_page(); void insert_anal_page();
void configura_sheet(TSheet_field& sheet); public:
static TMask* ss_getmask(int numriga, TMask& fullmask); virtual bool is_omaggio_enabled() { return true;}
void update_progs(bool stop_run = false);
TVariable_mask* riga_mask(int numriga);
virtual bool on_key(KEY key);
virtual bool stop_run(KEY key);
void set_field_handler(short fieldid, CONTROL_HANDLER handler); void set_field_handler(short fieldid, CONTROL_HANDLER handler);
bool call_handler( TMask_field& f, KEY key); bool call_handler( TMask_field& f, KEY key);
@ -838,8 +853,6 @@ protected:
void user_set_handler( int fieldid, int index); void user_set_handler( int fieldid, int index);
void reset_masks(const TString& tipo_doc); void reset_masks(const TString& tipo_doc);
public:
TVariable_mask* riga_mask(int numriga); TVariable_mask* riga_mask(int numriga);
virtual bool on_key(KEY key); virtual bool on_key(KEY key);

View File

@ -166,6 +166,7 @@ bool scontoexpr2perc(const char * exp, bool signal , TString & goodexp, real & v
goodexp.cut(0); goodexp.cut(0);
// Elimina gli spazi molesti // Elimina gli spazi molesti
// work.strip_spaces( ); // work.strip_spaces( );
val_perc = 1.0;
if (exp && *exp) if (exp && *exp)
{ {
TString80 num; TString80 num;
@ -173,7 +174,6 @@ bool scontoexpr2perc(const char * exp, bool signal , TString & goodexp, real & v
bool startnum = TRUE; // Flag che indica se siamo all'inizio di un numero bool startnum = TRUE; // Flag che indica se siamo all'inizio di un numero
int errorchar = ' '; int errorchar = ' ';
val_perc = 1.0;
// Flag che indica se sono nella parte decimale di un numero // Flag che indica se sono nella parte decimale di un numero
for (const char * s = exp; *s && errorchar == ' '; s++) for (const char * s = exp; *s && errorchar == ' '; s++)
{ {

View File

@ -408,20 +408,6 @@ TRiga_documento& TRiga_documento::operator +=(const TRiga_documento& r)
{ {
const TTipo_documento& tipo = doc().tipo(); const TTipo_documento& tipo = doc().tipo();
/* Jurassic mode
TToken_string campi("NCOLLI");
campi.add(tipo.field_qta());
campi.add(tipo.field_qtaevasa());
for (const char* c = campi.get(0); c; c = campi.get())
{
real num = r.get_real(c);
if (!num.is_zero())
{
num += get_real(c);
put(c, num);
}
}
*/
// New age mode // New age mode
const char* const campi[5] = { RDOC_NCOLLI, RDOC_TARA, RDOC_PNETTO, tipo.field_qta(), tipo.field_qtaevasa() }; const char* const campi[5] = { RDOC_NCOLLI, RDOC_TARA, RDOC_PNETTO, tipo.field_qta(), tipo.field_qtaevasa() };
for (int i = 0; i < 5; i++) for (int i = 0; i < 5; i++)
@ -457,28 +443,40 @@ void TRiga_documento::set_fields(TAuto_variable_rectype & rec)
real TRiga_documento::prezzo(bool scontato, bool lordo, int ndec) const real TRiga_documento::prezzo(bool scontato, bool lordo, int ndec) const
{ {
real prezzo;
if (ndec == AUTO_DECIMALS) if (ndec == AUTO_DECIMALS)
ndec = doc().decimals(TRUE); ndec = doc().decimals(TRUE);
real prezzo = get_real("PREZZO");
if (doc().tipo().calcolo_lordo()) if (doc().tipo().calcolo_lordo())
{ {
if (lordo) prezzo = get_real(RDOC_PREZZOL);
prezzo = iva().lordo(prezzo, ndec); if (prezzo == ZERO)
prezzo.round(ndec); {
prezzo = get_real("PREZZO");
if (scontato) if (scontato)
prezzo = prezzo_scontato(prezzo, get("SCONTO")); prezzo = prezzo_scontato(prezzo, get("SCONTO"));
prezzo.round(ndec); if (lordo)
prezzo = iva().lordo(prezzo, ndec);
} }
else else
{ {
if (scontato) if (scontato)
prezzo = prezzo_scontato(prezzo, get("SCONTO")); prezzo = prezzo_scontato(prezzo, get("SCONTO"));
prezzo.round(ndec); if (!lordo)
iva().scorpora(prezzo, ndec);
}
}
else
{
prezzo = get_real("PREZZO");
if (scontato)
prezzo = prezzo_scontato(prezzo, get("SCONTO"));
// prezzo.round(ndec);
if (lordo) if (lordo)
prezzo = iva().lordo(prezzo, ndec); prezzo = iva().lordo(prezzo, ndec);
prezzo.round(ndec);
} }
prezzo.round(ndec);
return prezzo; return prezzo;
} }
@ -488,11 +486,11 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
ndec = doc().decimals(); ndec = doc().decimals();
real importo; real importo;
const bool doc_al_lordo = doc().tipo().calcolo_lordo(); bool doc_al_lordo = doc().tipo().calcolo_lordo();
TTipo_calcolo c = _nessun_calcolo; TTipo_calcolo c = _nessun_calcolo;
const char tipor = tipo().tipo(); const char tipor = tipo().tipo();
const real qta = get_real(RDOC_QTA); const real qta = get_real(RDOC_QTA);
real r1; real valore, perc;
switch (tipor) switch (tipor)
{ {
@ -516,7 +514,9 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
{ {
const TString16 field_perc(s.field_perc()); const TString16 field_perc(s.field_perc());
c = _percentuale; c = _percentuale;
r1 = doc().get_real(field_perc); valore = doc().get_real(field_perc);
if (doc_al_lordo)
valore = iva().lordo(valore, ALL_DECIMALS, doc().valuta());
} }
break; break;
case 'V': case 'V':
@ -528,15 +528,7 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
} }
break; break;
case RIGA_SCONTI: case RIGA_SCONTI:
{ c = _scontopi;
TCond_vendita cv(NULL, NULL);
cv.set_sconto(get("SCONTO"));
if (cv.get_sconto().not_empty())
c = _scontoperc;
else
c = _scontoimp;
r1 = cv.sconto_val();
}
break; break;
case RIGA_OMAGGI: case RIGA_OMAGGI:
if (_iva_calc_mode > 1 || (_iva_calc_mode == 1 && get_bool("ADDIVA"))) if (_iva_calc_mode > 1 || (_iva_calc_mode == 1 && get_bool("ADDIVA")))
@ -547,38 +539,77 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
switch (c) switch (c)
{ {
case _qtaprezzo: case _qtaprezzo:
if (doc_al_lordo)
{
// Altamente impreciso: moltiplica per qta un prezzo arrotondato a priori!
// importo = prezzo(scontato, TRUE, ndec) * qta;
// Rimanda l'arrotondamento a dopo aver calcolato il totale riga!
importo = prezzo(scontato, TRUE, ALL_DECIMALS) * qta;
importo.round(ndec); // Riga inutile ma esplicatrice;
}
else
importo = prezzo(scontato, lordo, ALL_DECIMALS) * qta; importo = prezzo(scontato, lordo, ALL_DECIMALS) * qta;
break; break;
case _valore: case _valore:
importo = prezzo(scontato, doc_al_lordo ? TRUE : lordo, ndec); importo = prezzo(scontato, lordo, ndec);
break; break;
case _percentuale: case _percentuale:
importo = r1 * get_real(RDOC_QTA) / CENTO; importo = valore * get_real(RDOC_QTA) / CENTO;
break; break;
case _scontoimp: case _scontopi:
importo = -prezzo(FALSE, doc_al_lordo ? TRUE : lordo, ndec); {
break; TCond_vendita cv(NULL, NULL);
case _scontoperc:
importo = doc().basesconto() * (r1 - UNO); cv.set_sconto(get("SCONTO"));
if (cv.get_sconto().not_empty())
{
importo = doc().basesconto();
importo *= (cv.sconto_val() - UNO);
doc_al_lordo = false;
}
else
importo = -prezzo(false, lordo, ALL_DECIMALS);
TGeneric_distrib d(importo, ALL_DECIMALS);
TAssoc_array & table = ((TDocumento &) doc()).tabella_iva(true);
TRiepilogo_iva * aliquota;
if (doc_al_lordo)
{
if (!lordo)
{
importo = ZERO;
table.restart();
for (aliquota = (TRiepilogo_iva *) table.get(); aliquota != NULL;
aliquota = (TRiepilogo_iva *) table.get())
d.add(aliquota->imp_orig());
table.restart();
for (aliquota = (TRiepilogo_iva *) table.get(); aliquota != NULL;
aliquota = (TRiepilogo_iva *) table.get())
{
const TCodiceIVA & iva = aliquota->cod_iva();
real slice = d.get();
iva.scorpora(slice, ALL_DECIMALS, ((TDocumento &) doc()).valuta());
importo += slice;
}
}
}
else
{
if (lordo)
{
importo = ZERO;
table.restart();
for (aliquota = (TRiepilogo_iva *) table.get(); aliquota != NULL;
aliquota = (TRiepilogo_iva *) table.get())
d.add(aliquota->imp_orig());
table.restart();
for (aliquota = (TRiepilogo_iva *) table.get(); aliquota != NULL;
aliquota = (TRiepilogo_iva *) table.get())
{
const TCodiceIVA & iva = aliquota->cod_iva();
importo += iva.lordo(d.get(), ALL_DECIMALS, ((TDocumento &) doc()).valuta());
}
}
}
}
break; break;
default: default:
break; break;
} }
importo.round(ndec); importo.round(ndec); // arrotondamento finale
if (doc_al_lordo && !lordo)
iva().scorpora(importo, ndec);
return importo; return importo;
} }
@ -644,7 +675,7 @@ real TRiga_documento::imponibile(bool lordo) const
r = iva().lordo(r, doc().decimals(TRUE)); r = iva().lordo(r, doc().decimals(TRUE));
return r; return r;
} }
return importo(TRUE, lordo, doc().decimals()); return importo(true, lordo, doc().decimals());
} }
real TRiga_documento::imposta(bool round) const real TRiga_documento::imposta(bool round) const
@ -868,13 +899,13 @@ void TRiga_documento::autosave(TSheet_field& f)
TMask& m = f.sheet_mask(); TMask& m = f.sheet_mask();
TToken_string & row = f.row(num); TToken_string & row = f.row(num);
const int lordo_id = f.cid2index(FR_LORDO); /* const int lordo_id = f.cid2index(FR_LORDO);
const bool lordo = strcmp(row.get(lordo_id), "X") == 0; const bool lordo = strcmp(row.get(lordo_id), "X") == 0;
if (lordo) if (lordo)
{ {
row.add(" ", lordo_id); row.add(" ", lordo_id);
m.reset(FR_LORDO); m.reset(FR_LORDO);
} } */
put( RDOC_TIPORIGA, row.get( f.cid2index(FR_TIPORIGA )) ); put( RDOC_TIPORIGA, row.get( f.cid2index(FR_TIPORIGA )) );
TString8 codmag(row.get(f.cid2index(FR_CODMAG))); TString8 codmag(row.get(f.cid2index(FR_CODMAG)));
@ -912,11 +943,8 @@ void TRiga_documento::autosave(TSheet_field& f)
const TString8 codiva(row.get(f.cid2index(FR_CODIVA))); const TString8 codiva(row.get(f.cid2index(FR_CODIVA)));
if (lordo) if (lordo)
{ {
put( RDOC_PREZZOL, prezzo);
iva(codiva).scorpora(prezzo, doc().decimals(TRUE)); iva(codiva).scorpora(prezzo, doc().decimals(TRUE));
const TString prezzo_str(prezzo.string());
row.add(prezzo_str, prezzo_id);
f.sheet_mask().set(FR_PREZZO, prezzo_str);
} }
put( RDOC_PREZZO, prezzo); put( RDOC_PREZZO, prezzo);
put( RDOC_UMQTA, row.get( f.cid2index(FR_UMQTA )) ); put( RDOC_UMQTA, row.get( f.cid2index(FR_UMQTA )) );
@ -990,7 +1018,22 @@ void TRiga_documento::autoload(TSheet_field & f)
s << get(RDOC_DESCEST); s << get(RDOC_DESCEST);
row.add(s, f.cid2index(FR_DESCR )); row.add(s, f.cid2index(FR_DESCR ));
row.add( get( RDOC_UMQTA ), f.cid2index(FR_UMQTA )); row.add( get( RDOC_UMQTA ), f.cid2index(FR_UMQTA ));
row.add( get( RDOC_PREZZO ), f.cid2index(FR_PREZZO ));
TString8 codiva(get(RDOC_CODIVA));
real prezzo = get_real( RDOC_PREZZO );
if (doc().tipo().calcolo_lordo())
{
const real prezzol = get_real(RDOC_PREZZOL);
if (prezzol != ZERO)
prezzo = prezzol;
else
prezzo = iva(codiva).lordo(prezzo, ALL_DECIMALS);
}
row.add(prezzo.string(), f.cid2index(FR_PREZZO ));
row.add( get( RDOC_QTA ), f.cid2index(FR_QTA )); row.add( get( RDOC_QTA ), f.cid2index(FR_QTA ));
row.add( get( RDOC_QTAEVASA ), f.cid2index(FR_QTAEVASA )); row.add( get( RDOC_QTAEVASA ), f.cid2index(FR_QTAEVASA ));
row.add( get( RDOC_RIGAEVASA ), f.cid2index(FR_RIGAEVASA )); row.add( get( RDOC_RIGAEVASA ), f.cid2index(FR_RIGAEVASA ));
@ -1002,7 +1045,7 @@ void TRiga_documento::autoload(TSheet_field & f)
row.add( get( RDOC_PERCPROV ), f.cid2index(FR_PERCPROV )); row.add( get( RDOC_PERCPROV ), f.cid2index(FR_PERCPROV ));
row.add( get( RDOC_IMPFISUN ), f.cid2index(FR_IMPFISUN )); row.add( get( RDOC_IMPFISUN ), f.cid2index(FR_IMPFISUN ));
row.add( get( RDOC_IMPFISSO ), f.cid2index(FR_IMPFISSO )); row.add( get( RDOC_IMPFISSO ), f.cid2index(FR_IMPFISSO ));
row.add( get( RDOC_CODIVA ), f.cid2index(FR_CODIVA )); row.add( codiva, f.cid2index(FR_CODIVA ));
row.add( get( RDOC_ADDIVA ), f.cid2index(FR_ADDIVA )); row.add( get( RDOC_ADDIVA ), f.cid2index(FR_ADDIVA ));
row.add( get( RDOC_ASPBENI ), f.cid2index(FR_ASPBENI )); row.add( get( RDOC_ASPBENI ), f.cid2index(FR_ASPBENI ));
row.add( get( RDOC_CAUSMAG ), f.cid2index(FR_CAUS )); row.add( get( RDOC_CAUSMAG ), f.cid2index(FR_CAUS ));

View File

@ -89,6 +89,7 @@ TRiepilogo_iva& TRiepilogo_iva::copy(const TRiepilogo_iva& a)
{ {
(TRectype &) _codiva = (TRectype &) a._codiva; (TRectype &) _codiva = (TRectype &) a._codiva;
_imp = a._imp; _imp = a._imp;
_imp_orig = a._imp_orig;
_imp_spese = a._imp_spese; _imp_spese = a._imp_spese;
_imp_spese_row = a._imp_spese_row; _imp_spese_row = a._imp_spese_row;
_iva = a._iva; _iva = a._iva;
@ -560,12 +561,27 @@ bool TDocumento::bloccato() const
const char stato_attuale = stato(); const char stato_attuale = stato();
if (stato_attuale <= ' ') if (stato_attuale <= ' ')
return FALSE; return false;
char stato_bloccato = tipo().stato_bloccato(); char stato_bloccato = tipo().stato_bloccato();
if (stato_bloccato <= ' ') if (stato_bloccato <= ' ')
return FALSE; return false;
return stato_attuale >= stato_bloccato;
}
bool TDocumento::chiuso() const
{
const char stato_attuale = stato();
if (stato_attuale <= ' ')
return false;
char stato_bloccato = tipo().stato_chiuso();
if (stato_bloccato <= ' ')
return false;
return stato_attuale >= stato_bloccato; return stato_attuale >= stato_bloccato;
} }
@ -1599,6 +1615,14 @@ void TDocumento::set_fields(TAuto_variable_rectype & rec)
} }
} }
} }
for (TVariable_field * src_field = rec.first_variable_field();
src_field != NULL; src_field = rec.succ_variable_field())
{
const char * fieldname = src_field->name();
if (!exist(fieldname))
put(fieldname, rec.get(fieldname));
}
} }
} }
@ -1732,31 +1756,67 @@ void TDocumento::calc_iva_fattura_commerciale()
} }
} }
void TDocumento::update_tabella_iva() void TDocumento::update_tabella_iva(bool solo_imponibili)
{ {
const int items = rows(); const int items = rows();
TAssoc_array & table = _tabella_iva; TAssoc_array & table = _tabella_iva;
if (table.items() > 0 || items == 0) if (items == 0)
{
table.destroy();
return;
}
if (table.items() > 0)
{ {
if (items == 0) if (items == 0)
table.destroy(); table.destroy();
return; return;
} }
const bool doc_al_lordo = tipo().calcolo_lordo();
TRiepilogo_iva * aliquota;
const int ndec = decimals();
for (int j = items; j > 0; j--)
{
const TRiga_documento& r = row(j);
if (!r.is_sconto() && !r.is_descrizione())
{
const TCodiceIVA & iva = r.iva();
if (iva.ok())
{
const TString & cod = iva.codice();
aliquota = (TRiepilogo_iva *) table.objptr(cod);
if (aliquota == NULL)
{
aliquota = new TRiepilogo_iva(iva);
table.add(cod, aliquota);
}
const real imponibile = doc_al_lordo ? r.importo(true, true, ndec) : r.imponibile();
aliquota->imp_orig() += imponibile;
}
}
}
if (solo_imponibili)
return;
real tot_doc; real tot_doc;
real tot_sconti; real tot_sconti;
real tot_sconti_perc; real tot_sconti_perc;
const bool doc_al_lordo = tipo().calcolo_lordo(); TArray imponibili;
const int ndec = decimals();
const bool fatt_comm = tipo().fattura_commerciale(); const bool fatt_comm = tipo().fattura_commerciale();
TString4 codiva_es; TString4 codiva_es;
iva_esente(codiva_es); iva_esente(codiva_es);
for (int i = items; i > 0; i--) for (int i = items; i > 0; i--)
{ {
const TRiga_documento& r = row(i); const TRiga_documento& r = row(i);
const real imponibile = r.imponibile(doc_al_lordo); const real imponibile = doc_al_lordo ? r.importo(true, true, ndec) : r.imponibile();
tot_doc += imponibile; tot_doc += imponibile;
if (r.is_sconto()) if (r.is_sconto())
@ -1771,15 +1831,18 @@ void TDocumento::update_tabella_iva()
const real imposta = doc_al_lordo ? ZERO :r.imposta(FALSE); const real imposta = doc_al_lordo ? ZERO :r.imposta(FALSE);
// Aggiorna o aggiunge l'elemento se non esiste // Aggiorna o aggiunge l'elemento se non esiste
const TCodiceIVA & iva = r.iva(); const TCodiceIVA & iva = r.iva();
const TString4 cod(iva.codice());
if (cod.full()) if (iva.ok())
{ {
TRiepilogo_iva * aliquota = (TRiepilogo_iva *) table.objptr(cod); const TString & cod = iva.codice();
aliquota = (TRiepilogo_iva *) table.objptr(cod);
if (aliquota == NULL) if (aliquota == NULL)
{ {
aliquota = new TRiepilogo_iva(iva); aliquota = new TRiepilogo_iva(iva);
table.add(cod, aliquota); table.add(cod, aliquota);
} }
aliquota->imp() += imponibile; aliquota->imp() += imponibile;
if (r.is_spese() && iva.tipo().not_empty()) if (r.is_spese() && iva.tipo().not_empty())
aliquota->imp_spese_row() += imponibile; aliquota->imp_spese_row() += imponibile;
@ -1797,21 +1860,22 @@ void TDocumento::update_tabella_iva()
TGeneric_distrib d(tot_sconti, ndec); TGeneric_distrib d(tot_sconti, ndec);
real tot_sconti_imp = tot_sconti - tot_sconti_perc; real tot_sconti_imp = tot_sconti - tot_sconti_perc;
table.restart();
TRiepilogo_iva * ri;
for (ri = (TRiepilogo_iva *) table.get(); ri != NULL;
ri = (TRiepilogo_iva *) table.get())
d.add(ri->imp() - ri->imp_spese_row());
table.restart();
for (ri = (TRiepilogo_iva *) table.get(); ri != NULL;
ri = (TRiepilogo_iva *) table.get())
{ {
const TCodiceIVA & ci = ri->cod_iva(); FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
{
TRiepilogo_iva * aliquota = (TRiepilogo_iva *) o;
d.add(aliquota->imp() - aliquota->imp_spese_row());
}
}
FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
{
TRiepilogo_iva * aliquota = (TRiepilogo_iva *) o;
const TCodiceIVA & ci = aliquota->cod_iva();
const real i(d.get()); const real i(d.get());
real & imponibile = ri->imp(); real & imponibile = aliquota->imp();
imponibile += i; imponibile += i;
TGeneric_distrib s(i, ndec); TGeneric_distrib s(i, ndec);
@ -1819,12 +1883,12 @@ void TDocumento::update_tabella_iva()
s.add(tot_sconti_imp); s.add(tot_sconti_imp);
s.add(tot_sconti_perc); s.add(tot_sconti_perc);
ri->sconto_imp() = s.get(); aliquota->sconto_imp() = s.get();
ri->sconto_perc() = s.get(); aliquota->sconto_perc() = s.get();
real & iva = ri->iva(); real & iva = aliquota->iva();
if (doc_al_lordo) /* if (doc_al_lordo)
{ {
const real imposta(ci.imposta(i, ndec)); const real imposta(ci.imposta(i, ndec));
@ -1833,17 +1897,18 @@ void TDocumento::update_tabella_iva()
iva.add(tot_sconti_perc); iva.add(tot_sconti_perc);
imponibile += imposta; imponibile += imposta;
ri->sconto_imp() += iva.get(); aliquota->sconto_imp() += iva.get();
ri->sconto_perc() += iva.get(); aliquota->sconto_perc() += iva.get();
tot_doc += imposta; tot_doc += imposta;
} }
else else */
if (!doc_al_lordo)
{ {
const real imposta(ci.imposta(i, ALL_DECIMALS)); const real imposta(ci.imposta(i, ndec));
iva += imposta; iva += imposta;
ri->iva_sconto() = ci.imposta(i, ndec); aliquota->iva_sconto() = imposta;
tot_doc += imposta; tot_doc += imposta;
} }
} }
@ -1904,17 +1969,17 @@ void TDocumento::update_tabella_iva()
// SCORPORO // SCORPORO
if (doc_al_lordo) if (doc_al_lordo)
{ {
table.restart(); FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
for (TRiepilogo_iva* ri = (TRiepilogo_iva*)table.get(); ri != NULL; ri = (TRiepilogo_iva*)table.get())
{ {
const TCodiceIVA& iva = ri->cod_iva(); TRiepilogo_iva * aliquota = (TRiepilogo_iva*) o;
const TCodiceIVA& iva = aliquota->cod_iva();
ri->iva() = iva.scorpora(ri->imp(), ndec); aliquota->iva() = iva.scorpora(aliquota->imp(), ndec);
ri->iva_spese() = iva.scorpora(ri->imp_spese(), ndec); aliquota->iva_spese() = iva.scorpora(aliquota->imp_spese(), ndec);
iva.scorpora(ri->imp_spese_row(), ndec); iva.scorpora(aliquota->imp_spese_row(), ndec);
ri->iva_sconto() = iva.scorpora(ri->sconto_imp(), ndec); aliquota->iva_sconto() = iva.scorpora(aliquota->sconto_imp(), ndec);
ri->iva_sconto() += iva.scorpora(ri->sconto_perc(), ndec); aliquota->iva_sconto() += iva.scorpora(aliquota->sconto_perc(), ndec);
} }
} }
} }
@ -1972,7 +2037,11 @@ real TDocumento::totale_doc() const
if (field.blank()) if (field.blank())
{ {
const int ndec = decimals(); const int ndec = decimals();
r = imponibile() + imposta(); const bool lordo = tipo().calcolo_lordo();
r = imponibile(lordo);
if (!lordo)
r += imposta();
r += spese_incasso(ndec); r += spese_incasso(ndec);
r += bolli(real(r - ritenute()), ndec); r += bolli(real(r - ritenute()), ndec);
} }
@ -2157,9 +2226,7 @@ TDocumento & TDocumento::copy(const TDocumento & d)
{ {
TMultiple_rectype::operator=((TMultiple_rectype &)d); TMultiple_rectype::operator=((TMultiple_rectype &)d);
reset_fields(*this); reset_fields(*this);
set_fields(*this); set_fields((TAuto_variable_rectype &) d);
put(DOC_SPESEUPD, d.get(DOC_SPESEUPD));
_spese_updated = d._spese_updated;
for (int i = physical_rows(); i > 0; i--) for (int i = physical_rows(); i > 0; i--)
{ {
TRiga_documento & r = row(i); TRiga_documento & r = row(i);
@ -2289,6 +2356,8 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
real prezzo = sp.prezzo(); real prezzo = sp.prezzo();
sppr_calc(sp, valuta, cambio, prezzo, controeuro); sppr_calc(sp, valuta, cambio, prezzo, controeuro);
if (this->tipo().calcolo_lordo())
prezzo = riga.iva().lordo(prezzo, ALL_DECIMALS);
riga.put(RDOC_PREZZO, prezzo); riga.put(RDOC_PREZZO, prezzo);
riga.put(RDOC_UMQTA, sp.um()); riga.put(RDOC_UMQTA, sp.um());
} }
@ -2462,6 +2531,8 @@ void TDocumento::update_conai()
real prezzo = cli_esente ? ZERO : sp.prezzo(); real prezzo = cli_esente ? ZERO : sp.prezzo();
sppr_calc(sp, valuta, cambio, prezzo, controeuro ? _exchange_contro : _exchange_base); sppr_calc(sp, valuta, cambio, prezzo, controeuro ? _exchange_contro : _exchange_base);
if (this->tipo().calcolo_lordo())
prezzo = riga.iva().lordo(prezzo, ALL_DECIMALS);
riga.put("PREZZO", prezzo); riga.put("PREZZO", prezzo);
riga.put("UMQTA", sp.um()); riga.put("UMQTA", sp.um());
if (cod_iva_cli.empty()) if (cod_iva_cli.empty())

View File

@ -44,9 +44,20 @@ int TTipo_documento::read(const char* tipodoc)
return err; return err;
} }
const TString& TTipo_documento::mask_name() const
{
TString& name = get_tmp_string();
name = get("S4");
name.cut(8);
name.trim();
return name;
}
const TFilename& TTipo_documento::profile_name(TFilename& profile) const const TFilename& TTipo_documento::profile_name(TFilename& profile) const
{ {
profile = get("S4"); profile = get("S4");
profile.cut(8);
profile.trim();
profile.ext("ini"); profile.ext("ini");
return profile; return profile;
} }
@ -156,24 +167,20 @@ const TString_array& TTipo_documento::keys_descrs()
TFilename pn; profile_name(pn); TFilename pn; profile_name(pn);
TConfig prof(pn); TConfig prof(pn);
TTipo_riga_documento tr; TTipo_riga_documento tr;
TToken_string k, d;
_keys_descrs.add("");
_keys_descrs.add("");
TToken_string& k = (TToken_string&)_keys_descrs[0];
TToken_string& d = (TToken_string&)_keys_descrs[1];
int i; int i;
for (i = 0; ; i++) for (i = 0; ; i++)
{ {
const TString16 tiporiga(prof.get("Tipo", "RIGHE", i)); const TString16 tiporiga(prof.get("Tipo", "RIGHE", i));
if (tiporiga.empty()) if (tiporiga.full())
break; {
tr.read(tiporiga); tr.read(tiporiga);
k.add(tr.codice()); k.add(tr.codice());
d.add(tr.descrizione()); d.add(tr.descrizione());
} }
}
if (i == 0) if (i == 0)
{ {
@ -185,6 +192,8 @@ const TString_array& TTipo_documento::keys_descrs()
d.add(tri.get("S0")); d.add(tri.get("S0"));
} }
} }
_keys_descrs.add(k);
_keys_descrs.add(d);
} }
return _keys_descrs; return _keys_descrs;
@ -194,7 +203,8 @@ const TString_array& TTipo_documento::sheet_columns() const
{ {
if (_sheet_columns.empty()) if (_sheet_columns.empty())
{ {
TFilename pn; profile_name(pn); TFilename pn;
profile_name(pn);
TConfig prof(pn, "SHEET"); TConfig prof(pn, "SHEET");
for (int i = 0; i < MAX_COLUMNS; i++) for (int i = 0; i < MAX_COLUMNS; i++)
{ {

View File

@ -131,15 +131,9 @@ void TDocumentoEsteso::scadenze_recalc()
_scadenze_array.destroy(); _scadenze_array.destroy();
_scadenze_current = -1; _scadenze_current = -1;
TRectype& hh = head(); TRectype& hh = head();
/*
TString16 codpag(hh.get("CODPAG"));
TString16 data(hh.get("DATAINSC"));
if (data.empty()) data = hh.get("DATADOC");
TPagamento pag( codpag, data);
*/
TPagamento& pag = pagamento(); TPagamento& pag = pagamento();
real totspese = spese();//tot_spese(); real totspese = spese();
real totimposte = imposta(TRUE);//tot_imposte(); real totimposte = imposta(TRUE);
real pagato = hh.get_real(DOC_IMPPAGATO); real pagato = hh.get_real(DOC_IMPPAGATO);
const bool saldo = hh.get_bool(DOC_ACCSALDO); const bool saldo = hh.get_bool(DOC_ACCSALDO);
real totimponibili = totale_doc() - ritenute() - totimposte - totspese;//tot_documento() - totimposte - totspese; real totimponibili = totale_doc() - ritenute() - totimposte - totspese;//tot_documento() - totimposte - totspese;

View File

@ -63,8 +63,9 @@ TDocumento_mask::TDocumento_mask(const char* td)
_std_mag = m.standardmag(); _std_mag = m.standardmag();
_std_dep = m.standarddep(); _std_dep = m.standarddep();
} }
_doc.set_tipo(td); TDocumento & d = doc();
const TString16 mname = _doc.tipo().mask_name(); d.set_tipo(td);
const TString16 mname = d.tipo().mask_name();
read_mask(mname, 0, MAX_PAGES); read_mask(mname, 0, MAX_PAGES);
_sheet = &sfield(F_SHEET); _sheet = &sfield(F_SHEET);
@ -74,7 +75,7 @@ TDocumento_mask::TDocumento_mask(const char* td)
TList_field& listbox = (TList_field&)field(F_LBTIPORIGA); TList_field& listbox = (TList_field&)field(F_LBTIPORIGA);
TTipo_documento& tdoc = (TTipo_documento&)_doc.tipo(); TTipo_documento& tdoc = (TTipo_documento&)d.tipo();
TToken_string& keys = (TToken_string&)tdoc.keys_descrs()[0]; TToken_string& keys = (TToken_string&)tdoc.keys_descrs()[0];
TToken_string& descrs = (TToken_string&)tdoc.keys_descrs()[1]; TToken_string& descrs = (TToken_string&)tdoc.keys_descrs()[1];
listbox.replace_items(keys, descrs); listbox.replace_items(keys, descrs);
@ -423,13 +424,10 @@ void TDocumento_mask::configura_sheet(TSheet_field& sheet)
if (size != 0) if (size != 0)
sheet.set_column_width( field_id, size); sheet.set_column_width( field_id, size);
if (field_id != FR_LORDO || tdoc.calcolo_lordo()) if (field_id != FR_LORDO)
colonne.add(field_id); colonne.add(field_id);
} }
if (tdoc.calcolo_lordo())
to_delete.reset(0L);
else
to_delete.set(0L); to_delete.set(0L);
to_delete.reset(1); to_delete.reset(1);
@ -493,18 +491,8 @@ void TDocumento_mask::update_progs(bool stop_run)
TWait_cursor hourglass; TWait_cursor hourglass;
const int page = curr_page(); const int page = curr_page();
const int last_field = fields() - 1; const int last_field = fields() - 1;
int f;
for (f = last_field; f >= 0; f--) doc().set_riga_esenzione(); // da verificare
{
const TMask_field & mf = fld(f);
const TFieldref * fr = mf.field();
if (fr)
_doc.put(fr->name(), mf.get());
}
_doc.set_riga_esenzione();
for (f = last_field; f >= 0; f--) for (f = last_field; f >= 0; f--)
{ {
@ -518,7 +506,7 @@ void TDocumento_mask::update_progs(bool stop_run)
if (recfld != NULL) if (recfld != NULL)
{ {
const TString & name = recfld->name(); const TString & name = recfld->name();
const TString& val = _doc.get(name); const TString& val = doc().get(name);
set(id, val, true); set(id, val, true);
} }
} }
@ -1302,6 +1290,9 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
doc.destroy_row(r + 1, TRUE); doc.destroy_row(r + 1, TRUE);
} }
} }
doc.dirty_fields();
if (m.is_calculated_page(m.curr_page()))
m.update_progs();
} }
break; break;
case K_INS: // Inserimento case K_INS: // Inserimento
@ -1310,7 +1301,15 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
{ {
TRiga_documento & riga = doc[r + 1]; TRiga_documento & riga = doc[r + 1];
if (riga.is_omaggio() && riga.is_generata()) if (riga.is_omaggio() && riga.is_generata())
return FALSE; {
const bool enabled = ss.cell_enabled(r, 0);
if (!enabled) ss.enable_row(r);
ss.force_update(r);
ss.select(r);
m.send_key(K_CTRL + '+', 0);
if (!enabled) ss.disable_row(r);
ss.force_update(r);
} }
doc.insert_row(r + 1, m.get( F_LBTIPORIGA )); doc.insert_row(r + 1, m.get( F_LBTIPORIGA ));
} }
@ -1345,6 +1344,42 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
riga.tipo().set_defaults(ss, r + 1); riga.tipo().set_defaults(ss, r + 1);
} }
break; break;
case K_CTRL + K_INS:
{
TRiga_documento & riga = doc[r + 1];
TRectype & ven_rec = doc.clifor().vendite();
TString16 s(ven_rec.get(CFV_CODMAG));
const TTipo_riga_documento & t = riga.tipo();
if (s.not_empty())
{
s.left_just(3);
s << ven_rec.get(CFV_CODDEP);
}
else
{
s = m.get(F_CAUSMAG);
if (!s.blank())
{
const TRectype & c=cache().get("%CAU", s);
if (!c.empty() && !c.get("S10").blank())
s = c.get("S10");
else
{
s = m._std_mag;
s.left_just(3);
s << m._std_dep;
}
}
}
riga.put("CODMAG", s);
riga.autoload(ss);
ss.check_row(r);
t.set_defaults(ss, r + 1);
}
break;
case K_TAB: // ingresso nella riga case K_TAB: // ingresso nella riga
if (!selecting && m.is_running()) if (!selecting && m.is_running())
{ {

View File

@ -866,7 +866,7 @@ void search_price(TMask_field& f, KEY key )
row_mask.field(FR_CODART).set_dirty(false); row_mask.field(FR_CODART).set_dirty(false);
const TString & prezzo = sheet.row(-1).get(3); const TString & prezzo = sheet.row(-1).get(3);
row_mask.set(FR_PREZZO, prezzo); row_mask.set(FR_PREZZO, prezzo);
const TString & sconto = sheet.row(-1).get(5); const TString & sconto = sheet.row(-1).get(6);
row_mask.set(FR_SCONTO, sconto); row_mask.set(FR_SCONTO, sconto);
__in_handler = false; __in_handler = false;
} }
@ -1174,6 +1174,9 @@ bool codart_handler(TMask_field& f, KEY key )
} }
condv.ricerca(); condv.ricerca();
if (mask.doc().tipo().calcolo_lordo())
mask.doc()[current_doc_row].put(RDOC_PREZZOL, row_mask.get(FR_PREZZO));
else
mask.doc()[current_doc_row].put(RDOC_PREZZO, row_mask.get(FR_PREZZO)); mask.doc()[current_doc_row].put(RDOC_PREZZO, row_mask.get(FR_PREZZO));
const int pos = row_mask.id2pos(FR_CODIVA); const int pos = row_mask.id2pos(FR_CODIVA);
@ -1474,6 +1477,9 @@ bool umart_handler( TMask_field& f, KEY key )
curr_um = um; curr_um = um;
curr_fc = fc; curr_fc = fc;
condv.ricerca(true); condv.ricerca(true);
if (mask.doc().tipo().calcolo_lordo())
mask.doc()[current_doc_row].put(RDOC_PREZZOL, row_mask.get(FR_PREZZO));
else
mask.doc()[current_doc_row].put(RDOC_PREZZO, row_mask.get(FR_PREZZO)); mask.doc()[current_doc_row].put(RDOC_PREZZO, row_mask.get(FR_PREZZO));
const int pos = row_mask.id2pos(FR_CODIVA); const int pos = row_mask.id2pos(FR_CODIVA);
@ -1614,6 +1620,21 @@ bool qtaart_handler( TMask_field& f, KEY key )
TCausale_magazzino c(caus); TCausale_magazzino c(caus);
const long nmovmag = doc.get_long(DOC_MOVMAG); const long nmovmag = doc.get_long(DOC_MOVMAG);
TCond_vendita & condv = mask.condv();
condv.set_riga(&row_mask);
condv.ricerca(false, true);
if (mask.doc().tipo().calcolo_lordo())
mask.doc()[current_doc_row].put(RDOC_PREZZOL, row_mask.get(FR_PREZZO));
else
mask.doc()[current_doc_row].put(RDOC_PREZZO, row_mask.get(FR_PREZZO));
const TString& codart = row_mask.get(FR_CODARTMAG);
if (codart.not_empty())
{
const TRectype& anamag = cache().get(LF_ANAMAG, codart);
if (!anamag.empty())
upd_colli_peso_tara(row_mask, anamag);
}
if (nmovmag != 0) if (nmovmag != 0)
{ {
@ -1806,6 +1827,8 @@ bool sppr_handler( TMask_field& f, KEY key )
const bool controeuro = mask.get_bool(F_CONTROEURO); const bool controeuro = mask.get_bool(F_CONTROEURO);
sppr_calc(sp, doc_valuta, cambio, prezzo, controeuro ? _exchange_contro : _exchange_base); sppr_calc(sp, doc_valuta, cambio, prezzo, controeuro ? _exchange_contro : _exchange_base);
if (mask.doc().tipo().calcolo_lordo())
prezzo = TRiga_documento::iva(sp.cod_iva()).lordo(prezzo, ALL_DECIMALS);
row_mask.set(FR_PREZZO, prezzo); row_mask.set(FR_PREZZO, prezzo);
} }
} }

View File

@ -4,7 +4,7 @@
enum _formule {_somma, _bolli, _bolli_int, _spinc, _prezzo, _importo, _imponibile, _sconto, _iva, enum _formule {_somma, _bolli, _bolli_int, _spinc, _prezzo, _importo, _imponibile, _sconto, _iva,
_provv, _qtares, _valdoc, _tipo, _imponibili, _imposte, _totprovv, _pscontot, _ritenuta, _provv, _qtares, _valdoc, _tipo, _imponibili, _imposte, _totprovv, _pscontot, _ritenuta,
_tipo_ritenuta, _quant, _quantevasa, _componente, _comp_qta }; _tipo_ritenuta, _quant, _quantevasa, _componente, _comp_qta };
enum TTipo_calcolo { _nessun_calcolo, _qtaprezzo, _valore, _percentuale, _scontoimp, _scontoperc}; enum TTipo_calcolo { _nessun_calcolo, _qtaprezzo, _valore, _percentuale, _scontopi};
void row_set_handler( TMask& m, const int field, const int index ); void row_set_handler( TMask& m, const int field, const int index );
bool liv_handler( TMask_field& f, KEY key ); bool liv_handler( TMask_field& f, KEY key );

View File

@ -109,5 +109,21 @@
#define F_CDC12 262 #define F_CDC12 262
#define F_DESCDC1 271 #define F_DESCDC1 271
#define F_DESCDC12 282 #define F_DESCDC12 282
//#define F_SELECT 101
//scontrini
#define DLG_CHIUDI 401
#define DLG_TURNO 402
#define DLG_RICCHIUSI 403
#define DLG_RICSOSP 404
#define DLG_PERMS 405
#define DLG_FUNC01 411
#define DLG_FUNC02 412
#define DLG_FUNC03 413
#define DLG_FUNC04 414
#define DLG_FUNC05 415
#define DLG_FUNC06 416
#define DLG_FUNC07 417
#define DLG_FUNC08 418
#endif // veuml.h #endif // veuml.h