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:
parent
cf9f70b8c7
commit
dcf8d84484
@ -1,3 +1,3 @@
|
||||
34
|
||||
0
|
||||
$rdoc|||520|31|Righe documenti di vendita|NDOC*3||
|
||||
$rdoc|||539|0|Righe documenti di vendita|||
|
||||
|
@ -1,5 +1,5 @@
|
||||
34
|
||||
56
|
||||
58
|
||||
CODNUM|1|4|0|Codice Numeriazione
|
||||
ANNO|2|4|0|Anno
|
||||
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
|
||||
DESCEST|11|10|0|Descrizione estesa
|
||||
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
|
||||
QTA|4|15|5|Quantita'
|
||||
QTAEVASA|4|13|5|Quantita' evasa
|
||||
@ -56,6 +57,7 @@ CODCOSTO|1|20|0|Centro di costo
|
||||
CODAGG1|1|20|0|Codice aggiuntivo 1
|
||||
CODAGG2|1|20|0|Codice aggiuntivo 2
|
||||
PRIORITY|3|7|0|Priorita' MSP
|
||||
TIPODET|1|1|0|Tipo detraibilità
|
||||
7
|
||||
CODNUM+ANNO+PROVV+NDOC+NRIGA|
|
||||
CODNUM+ANNO+PROVV+CODART+LIVELLO+CODMAG|X
|
||||
|
BIN
ve/fattacc.bmp
BIN
ve/fattacc.bmp
Binary file not shown.
Before Width: | Height: | Size: 103 KiB After Width: | Height: | Size: 103 KiB |
BIN
ve/fattura.bmp
BIN
ve/fattura.bmp
Binary file not shown.
Before Width: | Height: | Size: 96 KiB After Width: | Height: | Size: 96 KiB |
@ -78,7 +78,7 @@ void TCond_vendita::set_prezzo(const real & prezzo, const char * 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);
|
||||
}
|
||||
|
||||
@ -370,8 +370,6 @@ void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
|
||||
set_sconto("");
|
||||
set_iva("");
|
||||
set_provv(ZERO);
|
||||
if (doc_al_lordo)
|
||||
riga().set(FR_LORDO, "X");
|
||||
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_um = _condv.get_bool("GESTUM");
|
||||
|
||||
if (doc_al_lordo)
|
||||
riga().set(FR_LORDO, "X");
|
||||
else
|
||||
riga().reset(FR_LORDO);
|
||||
|
||||
real prezzo;
|
||||
bool prezzo_lordo = false;
|
||||
TString16 valuta;
|
||||
@ -406,8 +399,6 @@ void TCond_vendita::ricerca(bool load_um_only, bool load_scagl_only)
|
||||
prezzo = _rcondv.get_real("PREZZO");
|
||||
valuta = _condv.get("CODVAL");
|
||||
prezzo_lordo = _condv.get_bool("IMPLORDI");
|
||||
|
||||
_load_mask = !load_um_only && !load_scagl_only;
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -614,7 +605,6 @@ void TCond_vendita::update_omaggi(bool full)
|
||||
TSheet_field & sh = (TSheet_field &) testa().field(F_SHEET);
|
||||
int current_doc_row = sh.selected() + 1;
|
||||
TDocumento & doc = testa().doc();
|
||||
bool update = FALSE;
|
||||
|
||||
if (doc[current_doc_row].is_omaggio())
|
||||
return;
|
||||
@ -626,9 +616,8 @@ void TCond_vendita::update_omaggi(bool full)
|
||||
if (r.is_omaggio() && r.is_generata())
|
||||
{
|
||||
sh.update_row(current_doc_row - 1);
|
||||
doc.destroy_row(current_doc_row + 1, TRUE);
|
||||
sh.destroy(current_doc_row, FALSE);
|
||||
update = TRUE;
|
||||
doc.destroy_row(current_doc_row + 1, true);
|
||||
sh.destroy(current_doc_row, true);
|
||||
}
|
||||
}
|
||||
|
||||
@ -685,7 +674,7 @@ void TCond_vendita::update_omaggi(bool full)
|
||||
else
|
||||
r.put("CODIVA", _rcondv.get("CODIVA"));
|
||||
r.put("ADDIVA", _rcondv.get("ADDIVA"));
|
||||
sh.insert(current_doc_row, FALSE);
|
||||
sh.insert(current_doc_row, false);
|
||||
r.autoload(sh);
|
||||
sh.check_row(current_doc_row);
|
||||
r.autosave(sh);
|
||||
@ -693,15 +682,14 @@ void TCond_vendita::update_omaggi(bool full)
|
||||
prezzo = normalize_valuta(prezzo, codval);
|
||||
r.put("PREZZO", prezzo);
|
||||
r.autoload(sh);
|
||||
update = TRUE;
|
||||
// curr_row.autoload(sh);
|
||||
if (!testa().is_omaggio_enabled())
|
||||
{
|
||||
sh.disable_row(current_doc_row);
|
||||
sh.check_row(current_doc_row);
|
||||
}
|
||||
sh.force_update();
|
||||
}
|
||||
}
|
||||
if (update)
|
||||
{
|
||||
sh.force_update();
|
||||
sh.select(creata ? current_doc_row : current_doc_row - 1);
|
||||
}
|
||||
}
|
||||
|
||||
TCond_vendita::TCond_vendita(TDocumento_mask * testa, TMask * riga)
|
||||
|
162
ve/ve0100.cpp
162
ve/ve0100.cpp
@ -7,11 +7,13 @@
|
||||
#include "ve0100.h"
|
||||
#include "veini.h"
|
||||
|
||||
#include "vepriv.h"
|
||||
#include "veuml.h"
|
||||
#include "veuml1.h"
|
||||
#include "verig.h"
|
||||
|
||||
#include "sconti.h"
|
||||
#include "../mg/anamag.h"
|
||||
#include "../mg/mglib.h"
|
||||
|
||||
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 )
|
||||
{
|
||||
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);
|
||||
m.enable(DLG_PRINT, enable_print);
|
||||
m.enable(DLG_ELABORA);
|
||||
@ -266,8 +268,8 @@ const char* TMotore_application::get_next_key( )
|
||||
|
||||
int TMotore_application::read( TMask& m )
|
||||
{
|
||||
// m.autoload(*_rel);
|
||||
TRelation_application::read(m);
|
||||
|
||||
doc() = (TDocumento &)_rel->curr();
|
||||
_codnum = m.get(F_CODNUM);
|
||||
_tipodoc = m.get(F_TIPODOC);
|
||||
@ -434,9 +436,40 @@ void TMotore_application::sheet2ini(TSheet_field &sheet,TConfig& ini)
|
||||
str.overwrite("\\", p);
|
||||
str.insert("n", p+1);
|
||||
}
|
||||
}
|
||||
campo.field()->write(ini, defpar, str);
|
||||
}
|
||||
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);
|
||||
}
|
||||
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++)
|
||||
@ -472,6 +505,95 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
||||
}
|
||||
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);
|
||||
|
||||
TTipo_riga_documento tr;
|
||||
@ -489,7 +611,7 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
// 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
|
||||
rec.put(key, val);
|
||||
}
|
||||
|
||||
// solo la insert chiama la post_insert necessaria alla disabilitazione verifichiamo
|
||||
// l'autoload ??
|
||||
f.insert(-1, FALSE);
|
||||
@ -543,7 +666,8 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
||||
if (checked)
|
||||
{
|
||||
const TString& codart = rec.get(RDOC_CODARTMAG);
|
||||
if (!codart.blank())
|
||||
|
||||
if (codart.full())
|
||||
{
|
||||
const TRectype& art = cache().get(LF_ANAMAG, codart);
|
||||
if (art.empty())
|
||||
@ -553,9 +677,31 @@ 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);
|
||||
f.check_row(f.items()-1, 0x2);
|
||||
f.check_row(f.items() - 1, 0x2);
|
||||
|
||||
if (!checked) //se non e' checked, il record viene autosalvato (in modo che sia salvato completamente)
|
||||
rec.autosave(f);
|
||||
@ -567,7 +713,7 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
|
||||
|
||||
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();
|
||||
|
||||
|
13
ve/ve0100.h
13
ve/ve0100.h
@ -37,7 +37,10 @@ class TMotore_application : public TRelation_application
|
||||
int _link_pos;
|
||||
bool _print_directly;
|
||||
|
||||
// Ridefinizione dei metodi virtuali
|
||||
|
||||
protected:
|
||||
|
||||
// Ridefinizione dei metodi virtuali
|
||||
virtual bool user_create( );
|
||||
virtual bool user_destroy( );
|
||||
virtual bool menu(MENU_TAG mt);
|
||||
@ -47,10 +50,10 @@ class TMotore_application : public TRelation_application
|
||||
virtual void init_insert_mode( TMask& m );
|
||||
virtual void init_modify_mode( TMask& m );
|
||||
virtual int read( TMask& m );
|
||||
virtual int write( const TMask& m );
|
||||
virtual int write( const TMask& m );
|
||||
virtual int rewrite( const TMask& m );
|
||||
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;
|
||||
// Funzioni da associare ad ogni procedura
|
||||
int user_function( int index );
|
||||
@ -59,8 +62,6 @@ class TMotore_application : public TRelation_application
|
||||
|
||||
virtual const char * extra_modules() const {return "dt";}
|
||||
|
||||
protected:
|
||||
|
||||
virtual void on_firm_change();
|
||||
|
||||
// Procedure e funzioni per la gestione degli stati
|
||||
@ -78,7 +79,7 @@ public:
|
||||
// Funzioni di accesso alle variabili private
|
||||
|
||||
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; }
|
||||
TSheet_field & sheet() { return edit_mask().sheet(); }
|
||||
TConfig & config_ditta() {return *_config_ditta; }
|
||||
|
@ -9,6 +9,7 @@
|
||||
#include <reprint.h>
|
||||
#include <statbar.h>
|
||||
|
||||
#include <clifo.h>
|
||||
#include <cfven.h>
|
||||
#include <comuni.h>
|
||||
#include <nditte.h>
|
||||
@ -782,6 +783,7 @@ class TReport_doc_app : public TSkeleton_application
|
||||
int _anno;
|
||||
TString4 _codnum;
|
||||
long _ndoc;
|
||||
bool _archive;
|
||||
|
||||
protected:
|
||||
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);
|
||||
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:
|
||||
virtual bool create();
|
||||
@ -801,19 +805,38 @@ public:
|
||||
|
||||
void TReport_doc_app::set_next_pdf(int a, const char* c, long n)
|
||||
{
|
||||
_anno = a;
|
||||
_codnum = c;
|
||||
_ndoc = n;
|
||||
_archive = n > 0L;
|
||||
if (_archive)
|
||||
{
|
||||
_anno = a;
|
||||
_codnum = c;
|
||||
_ndoc = n;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bool TReport_doc_app::get_next_pdf(int anno, long ditta, const char* codnum, long ndoc, TFilename& pdf) const
|
||||
{
|
||||
bool ok = false;
|
||||
if (_anno > 0 && _codnum.full() && _ndoc > 0)
|
||||
if (_archive)
|
||||
ok = TSkeleton_application::get_next_pdf(_anno, ditta, _codnum, _ndoc, pdf);
|
||||
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
|
||||
{
|
||||
if (from)
|
||||
@ -895,14 +918,10 @@ bool TReport_doc_app::print_loop(const TString& query)
|
||||
if (is_definitive)
|
||||
{
|
||||
const TString& codnum = doc.get(DOC_CODNUM).as_string();
|
||||
|
||||
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 TTipo_documento& tipo = _tipi_cache.tipo(tipodoc);
|
||||
|
@ -1,9 +1,11 @@
|
||||
#include <automask.h>
|
||||
#include <config.h>
|
||||
#include <expr.h>
|
||||
#include <execp.h>
|
||||
#include <mailbox.h>
|
||||
#include <progind.h>
|
||||
#include <relapp.h>
|
||||
#include <recarray.h>
|
||||
#include <tabutil.h>
|
||||
#include <utility.h>
|
||||
|
||||
@ -418,12 +420,21 @@ 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
|
||||
TRectype& rec = rel.curr(); // creo il record che usa nel filtro; case in base al tipo documentovendita
|
||||
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
|
||||
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];
|
||||
switch(tipo)
|
||||
|
||||
for (int i = 0; i < e.numvar(); i ++)
|
||||
{
|
||||
const TString name(e.varname(i));
|
||||
v.add(new TFieldref(name, 0));
|
||||
}
|
||||
switch(tipo)
|
||||
{
|
||||
case 'L':
|
||||
rec.put(RCONDV_CATVEN,m.get(F_L_CATVEN));
|
||||
@ -440,7 +451,7 @@ bool TCondizioni_vendita::handle_copy(TMask_field &b, KEY k)
|
||||
rec.put(RCONDV_COD,m.get(F_O_COD));
|
||||
newcode = msk.get(F_O_COD);
|
||||
break;
|
||||
default:
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
@ -452,14 +463,18 @@ bool TCondizioni_vendita::handle_copy(TMask_field &b, KEY k)
|
||||
const bool gestum = msk.get_bool(F_GESTUM);
|
||||
const bool gestscagl = msk.get_bool(F_GESTSCAGL);
|
||||
|
||||
rel_umart.add(LF_ANAMAG, "CODART==CODART");
|
||||
if (!gestum)
|
||||
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
|
||||
curs.freeze();
|
||||
TProgind bar(items,"Scansione articoli", FALSE, TRUE); //barra di avanzamento
|
||||
|
||||
for (curs=0; curs.pos() < items; ++curs)
|
||||
TProgind bar(items,"Scansione articoli", FALSE, TRUE); //barra di avanzamento
|
||||
|
||||
curs.freeze();
|
||||
for (curs = 0; curs.pos() < items; ++curs)
|
||||
{
|
||||
bar.addstatus(1);
|
||||
//riempie le righe del nuovo listino generato da umart
|
||||
@ -476,8 +491,19 @@ bool TCondizioni_vendita::handle_copy(TMask_field &b, KEY k)
|
||||
rec.put(RCONDV_NSCAGL, 1);
|
||||
else
|
||||
rec.zero(RCONDV_NSCAGL);
|
||||
|
||||
real prezzo = rec_umart.get_real(UMART_PREZZO);
|
||||
|
||||
const real prezzo = rec_umart.get_real(UMART_PREZZO) * perc;
|
||||
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);
|
||||
int err = rel.write();
|
||||
@ -488,16 +514,46 @@ bool TCondizioni_vendita::handle_copy(TMask_field &b, KEY k)
|
||||
}
|
||||
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
|
||||
curs.freeze();
|
||||
TProgind bar(items,"Scansione righe di origine", FALSE, TRUE); //barra di avanzamento
|
||||
|
||||
for (curs=0; curs.pos() < items; ++curs)
|
||||
{
|
||||
const real prezzo = rec.get_real(RCONDV_PREZZO) * perc;
|
||||
real prezzo = rec.get_real(RCONDV_PREZZO);
|
||||
|
||||
bar.addstatus(1);
|
||||
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);
|
||||
rec.put(RCONDV_COD, newcode);
|
||||
rec.put(RCONDV_PREZZO, prezzo);
|
||||
int err = rel.write();
|
||||
@ -507,7 +563,7 @@ bool TCondizioni_vendita::handle_copy(TMask_field &b, KEY k)
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
|
@ -1,6 +1,6 @@
|
||||
#include "ve2200x.h"
|
||||
|
||||
PAGE "Copia" -1 -1 70 10
|
||||
PAGE "Copia" -1 -1 70 12
|
||||
|
||||
GROUPBOX DLG_NULL -1 6
|
||||
BEGIN
|
||||
@ -173,9 +173,36 @@ BEGIN
|
||||
PROMPT 2 6 "Sovrascrivere record gia' presenti in caso di copia"
|
||||
END
|
||||
|
||||
NUMBER F_PERC 6 2
|
||||
STRING F_PERC 70
|
||||
BEGIN
|
||||
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
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
|
@ -42,3 +42,5 @@
|
||||
#define BTN_COPIA 162
|
||||
#define F_OVERWRITE 163
|
||||
#define F_PERC 164
|
||||
#define F_FROMCOD 165
|
||||
#define F_TOCOD 166
|
||||
|
@ -8,9 +8,12 @@
|
||||
#include <tabutil.h>
|
||||
|
||||
#include "../cg/cg2103.h"
|
||||
#include "../gv/gvlib.h"
|
||||
#include "velib.h"
|
||||
#include "velib07.h"
|
||||
|
||||
#include <nditte.h>
|
||||
|
||||
#include "ve8.h"
|
||||
#include "ve8100a.h"
|
||||
|
||||
@ -62,6 +65,11 @@ public:
|
||||
|
||||
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;
|
||||
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");
|
||||
@ -72,21 +80,24 @@ bool TListaRitFisc::crea_righe(const TListaRitFisc_mask& m) const
|
||||
rdoc.set_var("#ADATA", var);
|
||||
var = m.get(F_CODNUM);
|
||||
rdoc.set_var("#NUM", var);
|
||||
righe.last();
|
||||
int cont=righe.get_long("PROGR");
|
||||
long cont = get_next_progr_f24();
|
||||
long numf24 = get_next_f24();
|
||||
// trucco per poter usare la get (nei TDocument_recordset la get ha 2 par. ed e' protected!)
|
||||
const TRecordset& curr = rdoc;
|
||||
for (bool ok = rdoc.move_first(); ok; ok = rdoc.move_next())
|
||||
{
|
||||
cont++;
|
||||
righe.zero();
|
||||
righe.put("PROGR", cont);
|
||||
righe.put("F24", 0);
|
||||
righe.put("PROGR", cont++);
|
||||
righe.put("F24", numf24++);
|
||||
righe.put("TRIBUTO", curr.get("SPP.S10").as_string());
|
||||
righe.put("TIPOINTEST", 'C');
|
||||
righe.put("INTEST", curr.get("DOC.CODCF").as_int());
|
||||
righe.put("DESCR", "Riga generata");
|
||||
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();
|
||||
}
|
||||
return (err==NOERR);
|
||||
|
@ -9,7 +9,7 @@ END
|
||||
|
||||
BUTTON DLG_ELABORA 10 2
|
||||
BEGIN
|
||||
PROMPT -23 -1 "~Crea righe F24"
|
||||
PROMPT -23 -1 ""
|
||||
PICTURE BMP_ELABORA
|
||||
MESSAGE EXIT,K_SAVE
|
||||
END
|
||||
@ -27,6 +27,7 @@ DATE F_DATAINI
|
||||
BEGIN
|
||||
PROMPT 2 1 "Documenti dal "
|
||||
WARNING "La data di inizio intervallo e' obbligatoria"
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD #DADATA
|
||||
END
|
||||
|
||||
@ -34,6 +35,7 @@ DATE F_DATAFIN
|
||||
BEGIN
|
||||
PROMPT 28 1 "al "
|
||||
WARNING "La data di fine intervallo e' obbligatoria"
|
||||
CHECKTYPE REQUIRED
|
||||
FIELD #ADATA
|
||||
END
|
||||
|
||||
@ -62,6 +64,13 @@ BEGIN
|
||||
COPY OUTPUT F_CODNUM
|
||||
END
|
||||
|
||||
DATE F_DATASCAD
|
||||
BEGIN
|
||||
PROMPT 2 5 "Data scadenza "
|
||||
CHECKTYPE REQUIRED
|
||||
WARNING "La data di scadenza e' obbligatoria"
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
ENDMASK
|
||||
|
||||
|
@ -4,4 +4,4 @@
|
||||
#define F_DATAFIN 102
|
||||
#define F_CODNUM 103
|
||||
#define F_DESNUM 104
|
||||
|
||||
#define F_DATASCAD 105
|
||||
|
1566
ve/veaccbmp.frm
1566
ve/veaccbmp.frm
File diff suppressed because it is too large
Load Diff
@ -14,6 +14,7 @@ Item_08 = "Servizi", [ACQVEN_021]
|
||||
Item_09 = "Configurazione", [ACQVEN_020]
|
||||
Item_10 = "Importazione documenti STORE", <dtmenu.men>
|
||||
Item_11 = "Trasferimento PACK", <tpmenu.men>
|
||||
Item_12 = "Vendita al dettaglio", <vdmenu.men>, "E"
|
||||
|
||||
[ACQVEN_001]
|
||||
Caption = "Archivi e tabelle di base"
|
||||
|
1102
ve/vefatbmp.frm
1102
ve/vefatbmp.frm
File diff suppressed because it is too large
Load Diff
49
ve/velib.h
49
ve/velib.h
@ -16,7 +16,11 @@ class TViswin;
|
||||
#ifndef __CLIFOR_H
|
||||
#include "../ve/clifor.h"
|
||||
#endif
|
||||
|
||||
|
||||
#ifndef __RELAPP_H
|
||||
#include <relapp.h>
|
||||
#endif
|
||||
|
||||
#ifndef __CGLIB01_H
|
||||
#include "../cg/cglib01.h"
|
||||
#endif
|
||||
@ -199,6 +203,8 @@ public:
|
||||
|
||||
class TTipo_documento : public TRectype // velib03
|
||||
{
|
||||
enum { _altro, _bolla, _fattura, _ordine, _scontrino};
|
||||
|
||||
static TAssoc_array _formule_documento;
|
||||
TToken_string _formule;
|
||||
TString_array _keys_descrs; // Tipi riga per listbox
|
||||
@ -232,8 +238,6 @@ protected:
|
||||
|
||||
public:
|
||||
TObject* dup() const { return new TTipo_documento(codice()); }
|
||||
enum { _altro, _bolla, _fattura, _ordine};
|
||||
|
||||
public:
|
||||
const TFilename& profile_name(TFilename& name) const;
|
||||
|
||||
@ -244,7 +248,7 @@ public:
|
||||
const TString_array& sheet_columns() 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"); }
|
||||
int tipo() const { return get_int("I1"); }
|
||||
const TString& codice() const { return get("CODTAB");}
|
||||
@ -253,6 +257,7 @@ public:
|
||||
bool is_fattura() const { return tipo() == _fattura; }
|
||||
bool is_bolla() const { return tipo() == _bolla; }
|
||||
bool is_ordine() const { return tipo() == _ordine; }
|
||||
bool is_scontrino() const { return tipo() == _scontrino; }
|
||||
bool controllo_prezzi() const { return _cnt_prezzi; }
|
||||
const char * field_prezzo() const { return _field_prezzo; }
|
||||
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_stampa() const {return get("S2")[1]; }
|
||||
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_cancellazione() const {return get("S2").mid(29,20); }
|
||||
const TString & stati_iniziali_stampa() const {return get("S2").mid(49,20); }
|
||||
@ -550,6 +556,7 @@ class TRiepilogo_iva : public TObject
|
||||
{
|
||||
TCodiceIVA _codiva;
|
||||
real _imp;
|
||||
real _imp_orig;
|
||||
real _imp_spese;
|
||||
real _imp_spese_row;
|
||||
real _iva;
|
||||
@ -564,9 +571,10 @@ protected:
|
||||
virtual TRiepilogo_iva & copy(const TRiepilogo_iva & a);
|
||||
|
||||
public:
|
||||
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 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 & imp() { return _imp;};
|
||||
real & imp_orig() { return _imp_orig;};
|
||||
real & imp_spese() { return _imp_spese;};
|
||||
real & imp_spese_row() { return _imp_spese_row;};
|
||||
real & iva() { return _iva;};
|
||||
@ -607,7 +615,6 @@ class TDocumento : public TMultiple_rectype // velib03
|
||||
TRiga_documento * _esenzione; // Riga per l' esenzione iva
|
||||
|
||||
bool _dirty_deny;
|
||||
bool _spese_updated;
|
||||
|
||||
static TAssoc_array _tipi;
|
||||
static TAssoc_array _numerazioni;
|
||||
@ -620,7 +627,9 @@ class TDocumento : public TMultiple_rectype // velib03
|
||||
static TCodgiac_livelli *_livelli;
|
||||
|
||||
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);
|
||||
const TRiga_documento& physical_row(int index) const;
|
||||
|
||||
@ -634,7 +643,7 @@ protected:
|
||||
virtual TDocumento & copy(const TDocumento & d);
|
||||
virtual TObject* dup() const { return new TDocumento(*this); }
|
||||
void calc_iva_fattura_commerciale();
|
||||
void update_tabella_iva();
|
||||
void update_tabella_iva(bool solo_imponibili);
|
||||
void dirty_tabella_iva() { _tabella_iva.destroy();}
|
||||
static void test_firm();
|
||||
|
||||
@ -644,17 +653,15 @@ protected:
|
||||
int set_row_ids();
|
||||
|
||||
public:
|
||||
virtual bool renum() { return renum_ndoc() > 0;}
|
||||
long renum_ndoc(long numdoc = 0);
|
||||
virtual bool renum() { return renum_ndoc() > 0;}
|
||||
const TString& codiva_spese() const ;
|
||||
const TString& codiva_bolli() const ;
|
||||
|
||||
TCodgiac_livelli & livelli() const ;
|
||||
void dirty_fields();
|
||||
|
||||
bool & spese_updated() { return _spese_updated;}
|
||||
|
||||
TAssoc_array & tabella_iva() { update_tabella_iva(); return _tabella_iva; }
|
||||
TAssoc_array & tabella_iva(bool solo_imponibili = false) { update_tabella_iva(solo_imponibili); return _tabella_iva; }
|
||||
TCli_for & clifor() const;
|
||||
TOccasionale & occas() const;
|
||||
const TAgente & agente() const;
|
||||
@ -720,6 +727,8 @@ public:
|
||||
bool cancellabile() const;
|
||||
bool stampabile() const;
|
||||
bool bloccato() const;
|
||||
bool chiuso() const;
|
||||
bool sospeso() const { return !chiuso();}
|
||||
|
||||
bool raggruppabile() const { return get_bool("RAGGR"); }
|
||||
bool raggruppabile(const TDocumento& doc, TToken_string& campi) const;
|
||||
@ -806,18 +815,24 @@ class TDocumento_mask : public TVariable_mask // velib06
|
||||
short _last_cms_dlg;
|
||||
|
||||
protected:
|
||||
void update_progs(bool stop_run = false);
|
||||
virtual void next_page(int p);
|
||||
virtual void start_run();
|
||||
virtual bool stop_run(KEY key);
|
||||
void sconto_testa2mask();
|
||||
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);
|
||||
void insert_anal_page();
|
||||
|
||||
void configura_sheet(TSheet_field& sheet);
|
||||
static TMask* ss_getmask(int numriga, TMask& fullmask);
|
||||
public:
|
||||
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);
|
||||
bool call_handler( TMask_field& f, KEY key);
|
||||
@ -838,8 +853,6 @@ protected:
|
||||
void user_set_handler( int fieldid, int index);
|
||||
|
||||
void reset_masks(const TString& tipo_doc);
|
||||
|
||||
public:
|
||||
TVariable_mask* riga_mask(int numriga);
|
||||
virtual bool on_key(KEY key);
|
||||
|
||||
|
@ -166,6 +166,7 @@ bool scontoexpr2perc(const char * exp, bool signal , TString & goodexp, real & v
|
||||
goodexp.cut(0);
|
||||
// Elimina gli spazi molesti
|
||||
// work.strip_spaces( );
|
||||
val_perc = 1.0;
|
||||
if (exp && *exp)
|
||||
{
|
||||
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
|
||||
int errorchar = ' ';
|
||||
|
||||
val_perc = 1.0;
|
||||
// Flag che indica se sono nella parte decimale di un numero
|
||||
for (const char * s = exp; *s && errorchar == ' '; s++)
|
||||
{
|
||||
|
183
ve/velib02.cpp
183
ve/velib02.cpp
@ -408,20 +408,6 @@ TRiga_documento& TRiga_documento::operator +=(const TRiga_documento& r)
|
||||
{
|
||||
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
|
||||
const char* const campi[5] = { RDOC_NCOLLI, RDOC_TARA, RDOC_PNETTO, tipo.field_qta(), tipo.field_qtaevasa() };
|
||||
for (int i = 0; i < 5; i++)
|
||||
@ -456,29 +442,41 @@ void TRiga_documento::set_fields(TAuto_variable_rectype & rec)
|
||||
}
|
||||
|
||||
real TRiga_documento::prezzo(bool scontato, bool lordo, int ndec) const
|
||||
{
|
||||
{
|
||||
real prezzo;
|
||||
if (ndec == AUTO_DECIMALS)
|
||||
ndec = doc().decimals(TRUE);
|
||||
|
||||
real prezzo = get_real("PREZZO");
|
||||
if (doc().tipo().calcolo_lordo())
|
||||
{
|
||||
if (lordo)
|
||||
prezzo = iva().lordo(prezzo, ndec);
|
||||
prezzo.round(ndec);
|
||||
if (scontato)
|
||||
prezzo = prezzo_scontato(prezzo, get("SCONTO"));
|
||||
prezzo.round(ndec);
|
||||
prezzo = get_real(RDOC_PREZZOL);
|
||||
if (prezzo == ZERO)
|
||||
{
|
||||
prezzo = get_real("PREZZO");
|
||||
|
||||
if (scontato)
|
||||
prezzo = prezzo_scontato(prezzo, get("SCONTO"));
|
||||
if (lordo)
|
||||
prezzo = iva().lordo(prezzo, ndec);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (scontato)
|
||||
prezzo = prezzo_scontato(prezzo, get("SCONTO"));
|
||||
if (!lordo)
|
||||
iva().scorpora(prezzo, ndec);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
prezzo = get_real("PREZZO");
|
||||
if (scontato)
|
||||
prezzo = prezzo_scontato(prezzo, get("SCONTO"));
|
||||
prezzo.round(ndec);
|
||||
// prezzo.round(ndec);
|
||||
if (lordo)
|
||||
prezzo = iva().lordo(prezzo, ndec);
|
||||
prezzo.round(ndec);
|
||||
}
|
||||
prezzo.round(ndec);
|
||||
return prezzo;
|
||||
}
|
||||
|
||||
@ -488,11 +486,11 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
|
||||
ndec = doc().decimals();
|
||||
|
||||
real importo;
|
||||
const bool doc_al_lordo = doc().tipo().calcolo_lordo();
|
||||
bool doc_al_lordo = doc().tipo().calcolo_lordo();
|
||||
TTipo_calcolo c = _nessun_calcolo;
|
||||
const char tipor = tipo().tipo();
|
||||
const real qta = get_real(RDOC_QTA);
|
||||
real r1;
|
||||
const real qta = get_real(RDOC_QTA);
|
||||
real valore, perc;
|
||||
|
||||
switch (tipor)
|
||||
{
|
||||
@ -516,7 +514,9 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
|
||||
{
|
||||
const TString16 field_perc(s.field_perc());
|
||||
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;
|
||||
case 'V':
|
||||
@ -528,15 +528,7 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
|
||||
}
|
||||
break;
|
||||
case RIGA_SCONTI:
|
||||
{
|
||||
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();
|
||||
}
|
||||
c = _scontopi;
|
||||
break;
|
||||
case RIGA_OMAGGI:
|
||||
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)
|
||||
{
|
||||
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;
|
||||
case _valore:
|
||||
importo = prezzo(scontato, doc_al_lordo ? TRUE : lordo, ndec);
|
||||
importo = prezzo(scontato, lordo, ndec);
|
||||
break;
|
||||
case _percentuale:
|
||||
importo = r1 * get_real(RDOC_QTA) / CENTO;
|
||||
importo = valore * get_real(RDOC_QTA) / CENTO;
|
||||
break;
|
||||
case _scontoimp:
|
||||
importo = -prezzo(FALSE, doc_al_lordo ? TRUE : lordo, ndec);
|
||||
break;
|
||||
case _scontoperc:
|
||||
importo = doc().basesconto() * (r1 - UNO);
|
||||
break;
|
||||
case _scontopi:
|
||||
{
|
||||
TCond_vendita cv(NULL, NULL);
|
||||
|
||||
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;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
importo.round(ndec);
|
||||
|
||||
if (doc_al_lordo && !lordo)
|
||||
iva().scorpora(importo, ndec);
|
||||
|
||||
importo.round(ndec); // arrotondamento finale
|
||||
return importo;
|
||||
}
|
||||
|
||||
@ -644,7 +675,7 @@ real TRiga_documento::imponibile(bool lordo) const
|
||||
r = iva().lordo(r, doc().decimals(TRUE));
|
||||
return r;
|
||||
}
|
||||
return importo(TRUE, lordo, doc().decimals());
|
||||
return importo(true, lordo, doc().decimals());
|
||||
}
|
||||
|
||||
real TRiga_documento::imposta(bool round) const
|
||||
@ -868,13 +899,13 @@ void TRiga_documento::autosave(TSheet_field& f)
|
||||
TMask& m = f.sheet_mask();
|
||||
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;
|
||||
if (lordo)
|
||||
{
|
||||
row.add(" ", lordo_id);
|
||||
m.reset(FR_LORDO);
|
||||
}
|
||||
} */
|
||||
put( RDOC_TIPORIGA, row.get( f.cid2index(FR_TIPORIGA )) );
|
||||
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)));
|
||||
if (lordo)
|
||||
{
|
||||
put( RDOC_PREZZOL, prezzo);
|
||||
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_UMQTA, row.get( f.cid2index(FR_UMQTA )) );
|
||||
@ -990,7 +1018,22 @@ void TRiga_documento::autoload(TSheet_field & f)
|
||||
s << get(RDOC_DESCEST);
|
||||
row.add(s, f.cid2index(FR_DESCR ));
|
||||
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_QTAEVASA ), f.cid2index(FR_QTAEVASA ));
|
||||
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_IMPFISUN ), f.cid2index(FR_IMPFISUN ));
|
||||
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_ASPBENI ), f.cid2index(FR_ASPBENI ));
|
||||
row.add( get( RDOC_CAUSMAG ), f.cid2index(FR_CAUS ));
|
||||
|
171
ve/velib03.cpp
171
ve/velib03.cpp
@ -89,6 +89,7 @@ TRiepilogo_iva& TRiepilogo_iva::copy(const TRiepilogo_iva& a)
|
||||
{
|
||||
(TRectype &) _codiva = (TRectype &) a._codiva;
|
||||
_imp = a._imp;
|
||||
_imp_orig = a._imp_orig;
|
||||
_imp_spese = a._imp_spese;
|
||||
_imp_spese_row = a._imp_spese_row;
|
||||
_iva = a._iva;
|
||||
@ -560,12 +561,27 @@ bool TDocumento::bloccato() const
|
||||
const char stato_attuale = stato();
|
||||
|
||||
if (stato_attuale <= ' ')
|
||||
return FALSE;
|
||||
return false;
|
||||
|
||||
char stato_bloccato = tipo().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;
|
||||
}
|
||||
@ -1598,7 +1614,15 @@ void TDocumento::set_fields(TAuto_variable_rectype & rec)
|
||||
add_field(new TDocumento_variable_field(f->name(), *exp));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
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,34 +1756,70 @@ void TDocumento::calc_iva_fattura_commerciale()
|
||||
}
|
||||
}
|
||||
|
||||
void TDocumento::update_tabella_iva()
|
||||
void TDocumento::update_tabella_iva(bool solo_imponibili)
|
||||
{
|
||||
const int items = rows();
|
||||
TAssoc_array & table = _tabella_iva;
|
||||
|
||||
if (table.items() > 0 || items == 0)
|
||||
if (items == 0)
|
||||
{
|
||||
table.destroy();
|
||||
return;
|
||||
}
|
||||
|
||||
if (table.items() > 0)
|
||||
{
|
||||
if (items == 0)
|
||||
table.destroy();
|
||||
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_sconti;
|
||||
real tot_sconti_perc;
|
||||
const bool doc_al_lordo = tipo().calcolo_lordo();
|
||||
const int ndec = decimals();
|
||||
TArray imponibili;
|
||||
const bool fatt_comm = tipo().fattura_commerciale();
|
||||
|
||||
TString4 codiva_es;
|
||||
|
||||
iva_esente(codiva_es);
|
||||
for (int i = items; i > 0; i--)
|
||||
{
|
||||
const TRiga_documento& r = row(i);
|
||||
const real imponibile = r.imponibile(doc_al_lordo);
|
||||
|
||||
tot_doc += imponibile;
|
||||
if (r.is_sconto())
|
||||
const real imponibile = doc_al_lordo ? r.importo(true, true, ndec) : r.imponibile();
|
||||
|
||||
tot_doc += imponibile;
|
||||
if (r.is_sconto())
|
||||
{
|
||||
tot_sconti += imponibile;
|
||||
if (r.is_sconto_perc())
|
||||
@ -1771,15 +1831,18 @@ void TDocumento::update_tabella_iva()
|
||||
const real imposta = doc_al_lordo ? ZERO :r.imposta(FALSE);
|
||||
// Aggiorna o aggiunge l'elemento se non esiste
|
||||
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)
|
||||
{
|
||||
aliquota = new TRiepilogo_iva(iva);
|
||||
table.add(cod, aliquota);
|
||||
}
|
||||
}
|
||||
|
||||
aliquota->imp() += imponibile;
|
||||
if (r.is_spese() && iva.tipo().not_empty())
|
||||
aliquota->imp_spese_row() += imponibile;
|
||||
@ -1797,21 +1860,22 @@ void TDocumento::update_tabella_iva()
|
||||
TGeneric_distrib d(tot_sconti, ndec);
|
||||
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());
|
||||
{
|
||||
FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
|
||||
{
|
||||
TRiepilogo_iva * aliquota = (TRiepilogo_iva *) o;
|
||||
|
||||
d.add(aliquota->imp() - aliquota->imp_spese_row());
|
||||
}
|
||||
}
|
||||
|
||||
table.restart();
|
||||
for (ri = (TRiepilogo_iva *) table.get(); ri != NULL;
|
||||
ri = (TRiepilogo_iva *) table.get())
|
||||
FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
|
||||
{
|
||||
const TCodiceIVA & ci = ri->cod_iva();
|
||||
TRiepilogo_iva * aliquota = (TRiepilogo_iva *) o;
|
||||
const TCodiceIVA & ci = aliquota->cod_iva();
|
||||
const real i(d.get());
|
||||
real & imponibile = ri->imp();
|
||||
real & imponibile = aliquota->imp();
|
||||
|
||||
imponibile += i;
|
||||
|
||||
TGeneric_distrib s(i, ndec);
|
||||
@ -1819,12 +1883,12 @@ void TDocumento::update_tabella_iva()
|
||||
s.add(tot_sconti_imp);
|
||||
s.add(tot_sconti_perc);
|
||||
|
||||
ri->sconto_imp() = s.get();
|
||||
ri->sconto_perc() = s.get();
|
||||
aliquota->sconto_imp() = 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));
|
||||
|
||||
@ -1833,17 +1897,18 @@ void TDocumento::update_tabella_iva()
|
||||
iva.add(tot_sconti_perc);
|
||||
|
||||
imponibile += imposta;
|
||||
ri->sconto_imp() += iva.get();
|
||||
ri->sconto_perc() += iva.get();
|
||||
aliquota->sconto_imp() += iva.get();
|
||||
aliquota->sconto_perc() += iva.get();
|
||||
|
||||
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;
|
||||
ri->iva_sconto() = ci.imposta(i, ndec);
|
||||
aliquota->iva_sconto() = imposta;
|
||||
tot_doc += imposta;
|
||||
}
|
||||
}
|
||||
@ -1904,17 +1969,17 @@ void TDocumento::update_tabella_iva()
|
||||
// SCORPORO
|
||||
if (doc_al_lordo)
|
||||
{
|
||||
table.restart();
|
||||
for (TRiepilogo_iva* ri = (TRiepilogo_iva*)table.get(); ri != NULL; ri = (TRiepilogo_iva*)table.get())
|
||||
{
|
||||
const TCodiceIVA& iva = ri->cod_iva();
|
||||
FOR_EACH_ASSOC_OBJECT(table, obj, key, o)
|
||||
{
|
||||
TRiepilogo_iva * aliquota = (TRiepilogo_iva*) o;
|
||||
const TCodiceIVA& iva = aliquota->cod_iva();
|
||||
|
||||
ri->iva() = iva.scorpora(ri->imp(), ndec);
|
||||
ri->iva_spese() = iva.scorpora(ri->imp_spese(), ndec);
|
||||
iva.scorpora(ri->imp_spese_row(), ndec);
|
||||
aliquota->iva() = iva.scorpora(aliquota->imp(), ndec);
|
||||
aliquota->iva_spese() = iva.scorpora(aliquota->imp_spese(), ndec);
|
||||
iva.scorpora(aliquota->imp_spese_row(), ndec);
|
||||
|
||||
ri->iva_sconto() = iva.scorpora(ri->sconto_imp(), ndec);
|
||||
ri->iva_sconto() += iva.scorpora(ri->sconto_perc(), ndec);
|
||||
aliquota->iva_sconto() = iva.scorpora(aliquota->sconto_imp(), ndec);
|
||||
aliquota->iva_sconto() += iva.scorpora(aliquota->sconto_perc(), ndec);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -1972,7 +2037,11 @@ real TDocumento::totale_doc() const
|
||||
if (field.blank())
|
||||
{
|
||||
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 += bolli(real(r - ritenute()), ndec);
|
||||
}
|
||||
@ -2156,10 +2225,8 @@ const TAgente & TDocumento::agente() const
|
||||
TDocumento & TDocumento::copy(const TDocumento & d)
|
||||
{
|
||||
TMultiple_rectype::operator=((TMultiple_rectype &)d);
|
||||
reset_fields(*this);
|
||||
set_fields(*this);
|
||||
put(DOC_SPESEUPD, d.get(DOC_SPESEUPD));
|
||||
_spese_updated = d._spese_updated;
|
||||
reset_fields(*this);
|
||||
set_fields((TAuto_variable_rectype &) d);
|
||||
for (int i = physical_rows(); i > 0; 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();
|
||||
|
||||
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_UMQTA, sp.um());
|
||||
}
|
||||
@ -2462,6 +2531,8 @@ void TDocumento::update_conai()
|
||||
real prezzo = cli_esente ? ZERO : sp.prezzo();
|
||||
|
||||
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("UMQTA", sp.um());
|
||||
if (cod_iva_cli.empty())
|
||||
|
@ -44,9 +44,20 @@ int TTipo_documento::read(const char* tipodoc)
|
||||
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
|
||||
{
|
||||
profile = get("S4");
|
||||
profile.cut(8);
|
||||
profile.trim();
|
||||
profile.ext("ini");
|
||||
return profile;
|
||||
}
|
||||
@ -155,24 +166,20 @@ const TString_array& TTipo_documento::keys_descrs()
|
||||
TString16 var, tiporiga;
|
||||
TFilename pn; profile_name(pn);
|
||||
TConfig prof(pn);
|
||||
TTipo_riga_documento tr;
|
||||
TTipo_riga_documento tr;
|
||||
TToken_string k, d;
|
||||
int i;
|
||||
|
||||
_keys_descrs.add("");
|
||||
_keys_descrs.add("");
|
||||
TToken_string& k = (TToken_string&)_keys_descrs[0];
|
||||
TToken_string& d = (TToken_string&)_keys_descrs[1];
|
||||
int i;
|
||||
for (i = 0; ; i++)
|
||||
{
|
||||
const TString16 tiporiga(prof.get("Tipo", "RIGHE", i));
|
||||
|
||||
for (i = 0; ; i++)
|
||||
{
|
||||
const TString16 tiporiga(prof.get("Tipo", "RIGHE", i));
|
||||
|
||||
if (tiporiga.empty())
|
||||
break;
|
||||
|
||||
tr.read(tiporiga);
|
||||
k.add(tr.codice());
|
||||
d.add(tr.descrizione());
|
||||
if (tiporiga.full())
|
||||
{
|
||||
tr.read(tiporiga);
|
||||
k.add(tr.codice());
|
||||
d.add(tr.descrizione());
|
||||
}
|
||||
}
|
||||
|
||||
if (i == 0)
|
||||
@ -185,6 +192,8 @@ const TString_array& TTipo_documento::keys_descrs()
|
||||
d.add(tri.get("S0"));
|
||||
}
|
||||
}
|
||||
_keys_descrs.add(k);
|
||||
_keys_descrs.add(d);
|
||||
}
|
||||
|
||||
return _keys_descrs;
|
||||
@ -194,7 +203,8 @@ const TString_array& TTipo_documento::sheet_columns() const
|
||||
{
|
||||
if (_sheet_columns.empty())
|
||||
{
|
||||
TFilename pn; profile_name(pn);
|
||||
TFilename pn;
|
||||
profile_name(pn);
|
||||
TConfig prof(pn, "SHEET");
|
||||
for (int i = 0; i < MAX_COLUMNS; i++)
|
||||
{
|
||||
|
@ -131,15 +131,9 @@ void TDocumentoEsteso::scadenze_recalc()
|
||||
_scadenze_array.destroy();
|
||||
_scadenze_current = -1;
|
||||
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();
|
||||
real totspese = spese();//tot_spese();
|
||||
real totimposte = imposta(TRUE);//tot_imposte();
|
||||
real totspese = spese();
|
||||
real totimposte = imposta(TRUE);
|
||||
real pagato = hh.get_real(DOC_IMPPAGATO);
|
||||
const bool saldo = hh.get_bool(DOC_ACCSALDO);
|
||||
real totimponibili = totale_doc() - ritenute() - totimposte - totspese;//tot_documento() - totimposte - totspese;
|
||||
|
@ -63,8 +63,9 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
||||
_std_mag = m.standardmag();
|
||||
_std_dep = m.standarddep();
|
||||
}
|
||||
_doc.set_tipo(td);
|
||||
const TString16 mname = _doc.tipo().mask_name();
|
||||
TDocumento & d = doc();
|
||||
d.set_tipo(td);
|
||||
const TString16 mname = d.tipo().mask_name();
|
||||
read_mask(mname, 0, MAX_PAGES);
|
||||
|
||||
_sheet = &sfield(F_SHEET);
|
||||
@ -74,7 +75,7 @@ TDocumento_mask::TDocumento_mask(const char* td)
|
||||
|
||||
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& descrs = (TToken_string&)tdoc.keys_descrs()[1];
|
||||
listbox.replace_items(keys, descrs);
|
||||
@ -423,14 +424,11 @@ void TDocumento_mask::configura_sheet(TSheet_field& sheet)
|
||||
if (size != 0)
|
||||
sheet.set_column_width( field_id, size);
|
||||
|
||||
if (field_id != FR_LORDO || tdoc.calcolo_lordo())
|
||||
if (field_id != FR_LORDO)
|
||||
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);
|
||||
|
||||
if (!to_delete[sheet.cid2index(FR_CODDEP)])
|
||||
@ -493,19 +491,9 @@ void TDocumento_mask::update_progs(bool stop_run)
|
||||
TWait_cursor hourglass;
|
||||
const int page = curr_page();
|
||||
const int last_field = fields() - 1;
|
||||
int f;
|
||||
|
||||
for (f = last_field; f >= 0; f--)
|
||||
{
|
||||
const TMask_field & mf = fld(f);
|
||||
const TFieldref * fr = mf.field();
|
||||
|
||||
if (fr)
|
||||
_doc.put(fr->name(), mf.get());
|
||||
}
|
||||
|
||||
_doc.set_riga_esenzione();
|
||||
|
||||
doc().set_riga_esenzione(); // da verificare
|
||||
|
||||
for (f = last_field; f >= 0; f--)
|
||||
{
|
||||
const TMask_field & mf = fld(f);
|
||||
@ -518,7 +506,7 @@ void TDocumento_mask::update_progs(bool stop_run)
|
||||
if (recfld != NULL)
|
||||
{
|
||||
const TString & name = recfld->name();
|
||||
const TString& val = _doc.get(name);
|
||||
const TString& val = doc().get(name);
|
||||
set(id, val, true);
|
||||
}
|
||||
}
|
||||
@ -1302,15 +1290,26 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
||||
doc.destroy_row(r + 1, TRUE);
|
||||
}
|
||||
}
|
||||
doc.dirty_fields();
|
||||
if (m.is_calculated_page(m.curr_page()))
|
||||
m.update_progs();
|
||||
}
|
||||
break;
|
||||
case K_INS: // Inserimento
|
||||
{
|
||||
if (r < doc.rows())
|
||||
{
|
||||
TRiga_documento & riga = doc[r + 1];
|
||||
if (riga.is_omaggio() && riga.is_generata())
|
||||
return FALSE;
|
||||
TRiga_documento & riga = doc[r + 1];
|
||||
if (riga.is_omaggio() && riga.is_generata())
|
||||
{
|
||||
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 ));
|
||||
}
|
||||
@ -1345,7 +1344,43 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
|
||||
riga.tipo().set_defaults(ss, r + 1);
|
||||
}
|
||||
break;
|
||||
case K_TAB: // ingresso nella riga
|
||||
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
|
||||
if (!selecting && m.is_running())
|
||||
{
|
||||
m.update_giacenza();
|
||||
|
@ -866,7 +866,7 @@ void search_price(TMask_field& f, KEY key )
|
||||
row_mask.field(FR_CODART).set_dirty(false);
|
||||
const TString & prezzo = sheet.row(-1).get(3);
|
||||
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);
|
||||
__in_handler = false;
|
||||
}
|
||||
@ -1173,9 +1173,12 @@ bool codart_handler(TMask_field& f, KEY key )
|
||||
upd_colli_peso_tara(row_mask, anamag);
|
||||
}
|
||||
|
||||
condv.ricerca();
|
||||
mask.doc()[current_doc_row].put(RDOC_PREZZO, row_mask.get(FR_PREZZO));
|
||||
|
||||
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));
|
||||
|
||||
const int pos = row_mask.id2pos(FR_CODIVA);
|
||||
|
||||
if (pos >= 0)
|
||||
@ -1474,7 +1477,10 @@ bool umart_handler( TMask_field& f, KEY key )
|
||||
curr_um = um;
|
||||
curr_fc = fc;
|
||||
condv.ricerca(true);
|
||||
mask.doc()[current_doc_row].put(RDOC_PREZZO, row_mask.get(FR_PREZZO));
|
||||
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 int pos = row_mask.id2pos(FR_CODIVA);
|
||||
|
||||
@ -1614,6 +1620,21 @@ bool qtaart_handler( TMask_field& f, KEY key )
|
||||
TCausale_magazzino c(caus);
|
||||
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)
|
||||
{
|
||||
@ -1806,6 +1827,8 @@ bool sppr_handler( TMask_field& f, KEY key )
|
||||
const bool controeuro = mask.get_bool(F_CONTROEURO);
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
@ -4,7 +4,7 @@
|
||||
enum _formule {_somma, _bolli, _bolli_int, _spinc, _prezzo, _importo, _imponibile, _sconto, _iva,
|
||||
_provv, _qtares, _valdoc, _tipo, _imponibili, _imposte, _totprovv, _pscontot, _ritenuta,
|
||||
_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 );
|
||||
bool liv_handler( TMask_field& f, KEY key );
|
||||
|
16
ve/veuml.h
16
ve/veuml.h
@ -109,5 +109,21 @@
|
||||
#define F_CDC12 262
|
||||
#define F_DESCDC1 271
|
||||
#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
|
||||
|
Loading…
x
Reference in New Issue
Block a user