Aggiornato tracciato record documenti
Ottimizzate put_str Finita la sistemazione della stampa per gli stati TOlta l'aliquota IVA dalle righe di sconto git-svn-id: svn://10.65.10.50/trunk@5103 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
74687059d9
commit
3103a7a6e4
@ -1,3 +1,3 @@
|
||||
33
|
||||
0
|
||||
$doc|0|0|391|31|Documenti di vendita|NDOC||
|
||||
$doc|0|0|395|31|Documenti di vendita|NDOC||
|
||||
|
@ -30,13 +30,13 @@ SCONTOPERC|1|25|0|Sconto testata documento
|
||||
CODINDSP|1|3|0|Codice indirizzo di spedizione
|
||||
DATADOCRIF|5|8|0|Data documento di riferimento
|
||||
NUMDOCRIF|1|7|0|Numero documento di riferimento
|
||||
ZONA|1|2|0|Zona
|
||||
ZONA|1|3|0|Zona
|
||||
CODAG|1|5|0|Codice agente
|
||||
CODAGVIS|1|5|0|Codice agente visitante
|
||||
CODSPMEZZO|1|2|0|Codice mezzo di spedizione
|
||||
CODSPMEZZO|1|3|0|Codice mezzo di spedizione
|
||||
CODPORTO|1|3|0|Codice porto
|
||||
CODNOTESP1|1|2|0|Codice note di spedizione 1
|
||||
CODNOTESP2|1|2|0|Codice note di spedizione 2
|
||||
CODNOTESP1|1|3|0|Codice note di spedizione 1
|
||||
CODNOTESP2|1|3|0|Codice note di spedizione 2
|
||||
CAUSTRASP|1|3|0|Causale di trasporto
|
||||
CODVETT1|1|5|0|Codice vettore 1
|
||||
CODVETT2|1|5|0|Codice vettore 2
|
||||
|
@ -266,12 +266,18 @@ bool TMotore_application::print_handler( TMask_field& f, KEY key )
|
||||
{
|
||||
TString commandline("ve1 -0 ");
|
||||
|
||||
commandline << m.get( F_CODNUM ) << " " << m.get( F_ANNO ) << " ";
|
||||
commandline << m.get( F_PROVV )<< " " << m.get( F_NDOC );
|
||||
commandline << m.get(F_CODNUM) << " " << m.get(F_ANNO) << " ";
|
||||
commandline << m.get(F_PROVV) << " " << m.get(F_NDOC);
|
||||
|
||||
TExternal_app interattivo( commandline );
|
||||
|
||||
interattivo.run( );
|
||||
|
||||
interattivo.run();
|
||||
if (app().doc().stampabile())
|
||||
{
|
||||
const char s[2] = {app().doc().tipo().stato_finale_stampa(), '\0'};
|
||||
|
||||
m.set(F_STATO, s, TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
return TRUE;
|
||||
|
@ -333,6 +333,7 @@ public:
|
||||
class TRiga_documento : public TAuto_variable_rectype // velib02
|
||||
{
|
||||
TDocumento * _doc;
|
||||
static long _firm;
|
||||
static TAssoc_array _tipi;
|
||||
static TAssoc_array _spese;
|
||||
static TAssoc_array _ive;
|
||||
@ -345,6 +346,8 @@ protected:
|
||||
virtual TRiga_documento & copy(const TRiga_documento & r);
|
||||
TObject* dup() const { return new TRiga_documento(*this); }
|
||||
|
||||
static void test_firm();
|
||||
|
||||
public:
|
||||
void dirty_fields(bool dirty_document = TRUE);
|
||||
bool doc_dependent() const;
|
||||
|
@ -1,8 +1,8 @@
|
||||
#include "velib.h"
|
||||
#include "vepriv.h"
|
||||
|
||||
#ifndef __APPLICAT_H
|
||||
#include <applicat.h>
|
||||
#ifndef __PREFIX_H
|
||||
#include <prefix.h>
|
||||
#endif
|
||||
|
||||
#ifndef __TABUTIL_H
|
||||
@ -174,6 +174,7 @@ TVariable_mask * TTipo_riga_documento::mask()
|
||||
// Riga documento per vendite
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
long TRiga_documento::_firm = -1;
|
||||
TAssoc_array TRiga_documento::_tipi;
|
||||
TAssoc_array TRiga_documento::_spese;
|
||||
TAssoc_array TRiga_documento::_ive;
|
||||
@ -231,14 +232,8 @@ const TSpesa_prest & TRiga_documento::spesa() const
|
||||
const char tipor = tipo().tipo();
|
||||
|
||||
CHECK(tipor == RIGA_SPESEDOC || tipor == RIGA_PRESTAZIONI, "Tipo riga incompatibile con le spese");
|
||||
static long firm = -1;
|
||||
long new_firm = main_app().get_firm();
|
||||
|
||||
if (firm != new_firm)
|
||||
{
|
||||
_spese.destroy();
|
||||
firm = new_firm;
|
||||
}
|
||||
|
||||
test_firm();
|
||||
|
||||
const TString16 codice(get("CODART"));
|
||||
TString16 index; index << tipor << codice;
|
||||
@ -298,6 +293,17 @@ TRiga_documento & TRiga_documento::copy(const TRiga_documento & r)
|
||||
return *this;
|
||||
}
|
||||
|
||||
void TRiga_documento::test_firm()
|
||||
{
|
||||
const long new_firm = prefix().get_codditta();
|
||||
|
||||
if (_firm != new_firm)
|
||||
{
|
||||
_spese.destroy();
|
||||
_firm = new_firm;
|
||||
}
|
||||
}
|
||||
|
||||
TRectype & TRiga_documento::operator =(const TRectype & r)
|
||||
{
|
||||
TRectype::operator=(r);
|
||||
@ -394,8 +400,7 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
|
||||
TTipo_calcolo c = _nessun_calcolo;
|
||||
const char tipor = tipo().tipo();
|
||||
const real qta = get_real("QTA");
|
||||
TString16 field_perc;
|
||||
TCond_vendita cv;
|
||||
real r1;
|
||||
|
||||
switch (tipor)
|
||||
{
|
||||
@ -415,22 +420,29 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
|
||||
case 'V':
|
||||
c = _valore;
|
||||
break;
|
||||
case 'P':
|
||||
c = _percentuale;
|
||||
field_perc = s.field_perc();
|
||||
case 'P':
|
||||
{
|
||||
const TString16 field_perc(s.field_perc());
|
||||
|
||||
c = _percentuale;
|
||||
r1 = doc().get_real(field_perc);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
case RIGA_SCONTI:
|
||||
cv.set_sconto(get("SCONTO"));
|
||||
case RIGA_SCONTI:
|
||||
{
|
||||
TCond_vendita cv ; cv.set_sconto(get("SCONTO"));
|
||||
|
||||
if (cv.get_sconto().not_empty())
|
||||
c = _scontoperc;
|
||||
else
|
||||
c = _scontoimp;
|
||||
if (cv.get_sconto().not_empty())
|
||||
c = _scontoperc;
|
||||
else
|
||||
c = _scontoimp;
|
||||
r1 = cv.sconto_val();
|
||||
}
|
||||
break;
|
||||
case RIGA_OMAGGI:
|
||||
if (_iva_calc && get_bool("ADDIVA"))
|
||||
@ -447,13 +459,13 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
|
||||
importo = prezzo(scontato, lordo, ndec);
|
||||
break;
|
||||
case _percentuale:
|
||||
importo = doc().get_real(field_perc) * get_real(RDOC_QTA) / 100;
|
||||
importo = r1 * get_real(RDOC_QTA) / 100;
|
||||
break;
|
||||
case _scontoimp:
|
||||
importo = -prezzo(FALSE, lordo, ndec);
|
||||
break;
|
||||
case _scontoperc:
|
||||
importo = doc().basesconto() * (cv.sconto_val() - 1.0);
|
||||
importo = doc().basesconto() * (r1 - 1.0);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
@ -528,16 +540,22 @@ bool TRiga_documento::doc_dependent() const
|
||||
|
||||
void TRiga_documento::put_str(const char* fieldname, const char* val)
|
||||
{
|
||||
const TString v(val);
|
||||
if (strcmp(fieldname, "TIPORIGA") == 0 && TRectype::get("TIPORIGA") != v)
|
||||
if (strcmp(fieldname, "TIPORIGA") == 0)
|
||||
{
|
||||
TAuto_variable_rectype::put_str(fieldname, v);
|
||||
reset_fields(*this);
|
||||
set_fields(*this);
|
||||
const TString v(val);
|
||||
|
||||
if (TRectype::get("TIPORIGA") != v)
|
||||
{
|
||||
TAuto_variable_rectype::put_str(fieldname, v);
|
||||
reset_fields(*this);
|
||||
set_fields(*this);
|
||||
}
|
||||
else
|
||||
dirty_fields();
|
||||
}
|
||||
else
|
||||
{
|
||||
TAuto_variable_rectype::put_str(fieldname, v);
|
||||
TAuto_variable_rectype::put_str(fieldname, val);
|
||||
dirty_fields();
|
||||
}
|
||||
}
|
||||
@ -606,9 +624,6 @@ void TRiga_documento::autosave(TSheet_field & f)
|
||||
put( "UMQTA", row.get( f.cid2index(FR_UMQTA )) );
|
||||
TMask * m = ((TTipo_riga_documento &)tipo()).mask();
|
||||
const int pos = m->id2pos(FR_QTA);
|
||||
// if (pos >= 0 && m->fld(pos).field()->name() == "PSPESA")
|
||||
// put( "PSPESA", row.get( f.cid2index(FR_QTA )) );
|
||||
// else
|
||||
put( "QTA", row.get( f.cid2index(FR_QTA )) );
|
||||
put( "QTAEVASA", row.get( f.cid2index(FR_QTAEVASA )) );
|
||||
put( "RIGAEVASA", row.get( f.cid2index(FR_RIGAEVASA )) );
|
||||
@ -680,9 +695,6 @@ void TRiga_documento::autoload(TSheet_field & f)
|
||||
row.add( get( "PREZZO" ), f.cid2index(FR_PREZZO ));
|
||||
TMask * m = ((TTipo_riga_documento &)tipo()).mask();
|
||||
const int pos = m->id2pos(FR_QTA);
|
||||
// if (pos >= 0 && m->fld(pos).field()->name() == "PSPESA")
|
||||
// row.add( get( "PSPESA" ), f.cid2index(FR_QTA ));
|
||||
// else
|
||||
row.add( get( "QTA" ), f.cid2index(FR_QTA ));
|
||||
row.add( get( "QTAEVASA" ), f.cid2index(FR_QTAEVASA ));
|
||||
row.add( get( "RIGAEVASA" ), f.cid2index(FR_RIGAEVASA ));
|
||||
|
@ -225,9 +225,9 @@ TRiepilogo_iva::TRiepilogo_iva(const TIVA & codiva) : _codiva(codiva)
|
||||
// Documento per vendite
|
||||
///////////////////////////////////////////////////////////
|
||||
|
||||
long TDocumento::_firm = -1;
|
||||
TAssoc_array TDocumento::_tipi;
|
||||
TAssoc_array TDocumento::_numerazioni;
|
||||
long TDocumento::_firm = -1;
|
||||
TString16 TDocumento::_codiva_spese;
|
||||
TString16 TDocumento::_codiva_bolli;
|
||||
|
||||
@ -309,7 +309,8 @@ void TDocumento::test_firm()
|
||||
_codiva_bolli = conf.get("SPBOCODIVA", "ve");
|
||||
_firm = new_firm;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
real TDocumento::spese_incasso(real & imp, int ndec, TTipo_importo t) const
|
||||
{
|
||||
real imp_spese;
|
||||
@ -847,6 +848,9 @@ int TDocumento::write_rewrite(TBaseisamfile & f, bool re) const
|
||||
((TDocumento *)this)->zero("MOVMAG");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
{
|
||||
TLocalisamfile anamag(LF_ANAMAG);
|
||||
TLocalisamfile codalt(LF_CODCORR);
|
||||
codalt.setkey(2);
|
||||
@ -1170,7 +1174,7 @@ void TDocumento::update_tabella_iva()
|
||||
|
||||
real TDocumento::imposta(bool spese, int ndec) const
|
||||
{
|
||||
TAssoc_array table = ((TDocumento *)this)->tabella_iva();
|
||||
TAssoc_array & table = ((TDocumento *)this)->tabella_iva();
|
||||
real val;
|
||||
|
||||
if (ndec == AUTO_DECIMALS)
|
||||
@ -1248,22 +1252,35 @@ TPagamento & TDocumento::pagamento()
|
||||
|
||||
void TDocumento::put_str(const char* fieldname, const char* val)
|
||||
{
|
||||
TString v(val);
|
||||
if (strcmp(fieldname, "TIPODOC") == 0 && TRectype::get("TIPODOC") != v)
|
||||
{
|
||||
TAuto_variable_rectype::put_str(fieldname, v);
|
||||
reset_fields(*this);
|
||||
set_fields(*this);
|
||||
if (strcmp(fieldname, "TIPODOC") == 0)
|
||||
{
|
||||
const TString v(val);
|
||||
|
||||
if (TRectype::get("TIPODOC") != v)
|
||||
{
|
||||
TAuto_variable_rectype::put_str(fieldname, v);
|
||||
reset_fields(*this);
|
||||
set_fields(*this);
|
||||
}
|
||||
else
|
||||
dirty_fields();
|
||||
}
|
||||
else
|
||||
{
|
||||
if (strcmp(fieldname, "CODCF") == 0)
|
||||
if (strcmp(fieldname, "CODCF") == 0)
|
||||
{
|
||||
const TString v(val);
|
||||
|
||||
put("SPESEUPD", TRectype::get("CODCF") == v);
|
||||
TAuto_variable_rectype::put_str(fieldname, v);
|
||||
dirty_fields();
|
||||
if (strcmp(fieldname, "SCONTOPERC") == 0)
|
||||
set_riga_sconto();
|
||||
}
|
||||
TAuto_variable_rectype::put_str(fieldname, v);
|
||||
dirty_fields();
|
||||
}
|
||||
else
|
||||
{
|
||||
TAuto_variable_rectype::put_str(fieldname, val);
|
||||
dirty_fields();
|
||||
if (strcmp(fieldname, "SCONTOPERC") == 0)
|
||||
set_riga_sconto();
|
||||
}
|
||||
}
|
||||
|
||||
void TDocumento::zero(const char * fieldname)
|
||||
|
@ -1,17 +1,32 @@
|
||||
#include "verigdef.h"
|
||||
|
||||
#define FULL_SCREEN
|
||||
|
||||
#define MASK_TITLE1 "Sconto ad importo"
|
||||
|
||||
DEFINE_FIELD(DESCR)
|
||||
DEFINE_FIELD(VALORE)
|
||||
F_POS(VALORE, 2, 9,"Importo " )
|
||||
DEFINE_FIELD(CODIVA)
|
||||
F_POS(CODIVA, 2, 11,"Cod. IVA " )
|
||||
DEFINE_FIELD(DESIVA)
|
||||
F_POS(DESIVA, 22, 11,"" )
|
||||
|
||||
#include "verig.uml"
|
||||
|
||||
|
||||
#include "verigdef.h"
|
||||
|
||||
|
||||
|
||||
#define FULL_SCREEN
|
||||
|
||||
|
||||
|
||||
#define MASK_TITLE1 "Sconto ad importo"
|
||||
|
||||
|
||||
|
||||
DEFINE_FIELD(DESCR)
|
||||
|
||||
DEFINE_FIELD(VALORE)
|
||||
|
||||
F_POS(VALORE, 2, 9,"Importo " )
|
||||
|
||||
// DEFINE_FIELD(CODIVA)
|
||||
|
||||
// F_POS(CODIVA, 2, 11,"Cod. IVA " )
|
||||
|
||||
// DEFINE_FIELD(DESIVA)
|
||||
|
||||
// F_POS(DESIVA, 22, 11,"" )
|
||||
|
||||
|
||||
|
||||
#include "verig.uml"
|
||||
|
||||
|
||||
|
||||
|
@ -1,17 +1,32 @@
|
||||
#include "verigdef.h"
|
||||
|
||||
#define FULL_SCREEN
|
||||
|
||||
#define MASK_TITLE1 "Sconto percentuale"
|
||||
|
||||
DEFINE_FIELD(DESCR)
|
||||
DEFINE_FIELD(SCONTO)
|
||||
F_POS(SCONTO, 2, 9,"Sconto " )
|
||||
DEFINE_FIELD(CODIVA)
|
||||
F_POS(CODIVA, 2, 11,"Cod. IVA " )
|
||||
DEFINE_FIELD(DESIVA)
|
||||
F_POS(DESIVA, 22, 11,"" )
|
||||
|
||||
#include "verig.uml"
|
||||
|
||||
|
||||
#include "verigdef.h"
|
||||
|
||||
|
||||
|
||||
#define FULL_SCREEN
|
||||
|
||||
|
||||
|
||||
#define MASK_TITLE1 "Sconto percentuale"
|
||||
|
||||
|
||||
|
||||
DEFINE_FIELD(DESCR)
|
||||
|
||||
DEFINE_FIELD(SCONTO)
|
||||
|
||||
F_POS(SCONTO, 2, 9,"Sconto " )
|
||||
|
||||
// DEFINE_FIELD(CODIVA)
|
||||
|
||||
// F_POS(CODIVA, 2, 11,"Cod. IVA " )
|
||||
|
||||
// DEFINE_FIELD(DESIVA)
|
||||
|
||||
// F_POS(DESIVA, 22, 11,"" )
|
||||
|
||||
|
||||
|
||||
#include "verig.uml"
|
||||
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user