Patch level : 2.1.059
Files correlati : Quelli delle patch 2.0 Ricompilazione Demo : [ ] Commento : Riportata la versione 2.0 patch 756 git-svn-id: svn://10.65.10.50/trunk@12146 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
185562c39b
commit
82496e7b61
@ -12,6 +12,7 @@
|
||||
#include "batbdel.h"
|
||||
#include "batbval.h"
|
||||
#include "batbver.h"
|
||||
#include "batbnot.h"
|
||||
|
||||
#define REG_JOURNAL 5
|
||||
#define TAB_BANCHE "%BAN"
|
||||
@ -23,6 +24,7 @@
|
||||
#define TAB_VERSAMENTI "%VER"
|
||||
// #define TAB_MAGAZZINI "MAG" // Spostato in mg0 -0
|
||||
#define TAB_GRMERC "GMC"
|
||||
#define TAB_NOTECLI "%NOT"
|
||||
|
||||
class TGeneric_table_app : public TTable_application
|
||||
{
|
||||
@ -43,6 +45,8 @@ protected: // TRelation_application
|
||||
virtual void init_insert_mode(TMask& m) ;
|
||||
virtual void init_modify_mode(TMask& m);
|
||||
virtual void init_query_mode (TMask&);
|
||||
virtual int read(TMask& m);
|
||||
virtual int write(const TMask& m);
|
||||
virtual int rewrite(const TMask& m);
|
||||
|
||||
protected:
|
||||
@ -51,6 +55,10 @@ protected:
|
||||
static bool codcab_handler(TMask_field& f, KEY k);
|
||||
static bool codmag_handler(TMask_field& f, KEY k);
|
||||
static bool codgmc_handler(TMask_field& f, KEY k);
|
||||
static bool desnot_handler(TMask_field& f, KEY k);
|
||||
|
||||
void fragment_string();
|
||||
void glue_string();
|
||||
|
||||
public:
|
||||
bool exist_journal() { return _exist_journal; }
|
||||
@ -578,6 +586,17 @@ bool TGeneric_table_app::codgmc_handler(TMask_field& f, KEY k)
|
||||
}
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
bool TGeneric_table_app::desnot_handler(TMask_field& f, KEY k)
|
||||
{
|
||||
if (k == K_ENTER)
|
||||
{
|
||||
const TString& stringone = f.get();
|
||||
if (stringone.len() > 320)
|
||||
return f.error_box("La nota non puo' superare i 320 caratteri");
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
bool TGeneric_table_app::user_create()
|
||||
{
|
||||
@ -613,23 +632,7 @@ bool TGeneric_table_app::user_create()
|
||||
{
|
||||
mask.set_handler(FLD_TABCAM_S4, change_decimals_handler);
|
||||
}
|
||||
/* OB600040
|
||||
if (name == TAB_VERSAMENTI)
|
||||
{
|
||||
TLocalisamfile& ver = get_relation()->lfile();
|
||||
ver.put("CODTAB","199301");
|
||||
if (ver.read() != NOERR) // Se %VER non esiste la crea
|
||||
{
|
||||
ver.put("CODTAB","199301");
|
||||
ver.put("R0","1.5"); ver.put("R1","1.5");
|
||||
ver.put("R2","1.5"); ver.put("R3","1.5"); ver.put("R4","1.5");
|
||||
ver.put("R5","50500"); ver.put("R7","200000");
|
||||
ver.put("R11","88"); ver.put("R12","88");
|
||||
if (ver.write() != NOERR)
|
||||
error_box("Errore %d in scrittura sulla tabella versamenti",ver.status());
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
if (name == TAB_CAMBI)
|
||||
set_search_field(FLD_TABCAM_D0);
|
||||
|
||||
@ -641,16 +644,70 @@ bool TGeneric_table_app::user_create()
|
||||
|
||||
if (name == TAB_GRMERC)
|
||||
mask.set_handler(101, codgmc_handler);
|
||||
|
||||
if (name == TAB_NOTECLI)
|
||||
mask.set_handler(F_NOT_DESC, desnot_handler);
|
||||
}
|
||||
|
||||
return ok;
|
||||
}
|
||||
|
||||
//folle metodo per suddividere una stringa lunga in piu' stringhe corte da mettere nei campi
|
||||
//stringa delle tabelle (per ora solo tabella %NOT)
|
||||
void TGeneric_table_app::fragment_string()
|
||||
{
|
||||
TMask& mask = *get_mask();
|
||||
TString stringone = mask.get(F_NOT_DESC);
|
||||
TRectype& rec = get_relation()->curr();
|
||||
TString4 fieldname;
|
||||
int tot_length = 0;
|
||||
stringone.replace('\n', (char)0xB6);
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
fieldname.format("S%d", i);
|
||||
const int length = rec.length(fieldname);
|
||||
const TString& pezzo = stringone.mid(tot_length, length);
|
||||
rec.put(fieldname, pezzo);
|
||||
tot_length += length;
|
||||
}
|
||||
}
|
||||
|
||||
void TGeneric_table_app::glue_string()
|
||||
{
|
||||
TMask& mask = *get_mask();
|
||||
TString stringone;
|
||||
TRectype& rec = get_relation()->curr();
|
||||
TString4 fieldname;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
fieldname.format("S%d", i);
|
||||
stringone << rec.get(fieldname);
|
||||
}
|
||||
stringone.replace((char)0xB6, '\n');
|
||||
mask.set(F_NOT_DESC, stringone);
|
||||
}
|
||||
|
||||
bool TGeneric_table_app::user_destroy()
|
||||
{
|
||||
return Tab_application::user_destroy();
|
||||
}
|
||||
|
||||
int TGeneric_table_app::read(TMask& m)
|
||||
{
|
||||
int err = Tab_application::read(m);
|
||||
if (get_tabname() == TAB_NOTECLI)
|
||||
glue_string();
|
||||
return err;
|
||||
}
|
||||
|
||||
int TGeneric_table_app::write(const TMask& m)
|
||||
{
|
||||
if (get_tabname() == TAB_NOTECLI)
|
||||
fragment_string();
|
||||
|
||||
return Tab_application::write(m);
|
||||
}
|
||||
|
||||
int TGeneric_table_app::rewrite(const TMask& m)
|
||||
{
|
||||
if (get_tabname() == TAB_REGISTRI && !m.get_bool(F_CONFIG))
|
||||
@ -663,6 +720,9 @@ int TGeneric_table_app::rewrite(const TMask& m)
|
||||
if (what >= 0)
|
||||
ini.set("Type", -1);
|
||||
}
|
||||
|
||||
if (get_tabname() == TAB_NOTECLI)
|
||||
fragment_string();
|
||||
|
||||
return Tab_application::rewrite(m);
|
||||
}
|
||||
|
@ -327,7 +327,7 @@ void BA3200_application::set_rows()
|
||||
}
|
||||
else if (!is_compound)
|
||||
{
|
||||
if (formato_campo.find("@pn"))
|
||||
if (formato_campo.find("@pn") >= 0)
|
||||
picture = line.get();
|
||||
else
|
||||
picture = "";
|
||||
@ -345,8 +345,30 @@ void BA3200_application::set_rows()
|
||||
_string_compound.add("");
|
||||
_field_compound.add(s);
|
||||
const int last = _string_compound.items() - 1;
|
||||
|
||||
set_row (riga_record, formato_campo, _string_compound.objptr(last));
|
||||
//versione speciale per la stampa della tabella Note clienti!
|
||||
if (_tabname == "%NOT")
|
||||
{
|
||||
//deve costruire la stampa tenendo conto anche dei return
|
||||
|
||||
TString stringone;
|
||||
TRectype& rec = current_cursor()->curr();
|
||||
TString4 fieldname;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
fieldname.format("S%d", i);
|
||||
stringone << rec.get(fieldname);
|
||||
}
|
||||
stringone.replace((char)0xB6, '\n');
|
||||
|
||||
TParagraph_string para(stringone, 75);
|
||||
for (int r = 0; r < para.items(); r++)
|
||||
set_row(riga_record + r, "@3g%s", para.get());
|
||||
|
||||
//mette a TRUE la variabile _force_setpage delle printapp in modo da richiamare la set_rows() ad ogni cambio record
|
||||
force_setpage();
|
||||
}
|
||||
else
|
||||
set_row (riga_record, formato_campo, _string_compound.objptr(last));
|
||||
}
|
||||
line = (const char *) _rpt->line();
|
||||
}
|
||||
|
@ -5,14 +5,13 @@ STRING F_INIZIO1 3
|
||||
BEGIN
|
||||
PROMPT 2 1 "Da codice "
|
||||
FLAGS "U"
|
||||
HELP "Codice da cui iniziare la stampa. Vuoto = inizio archivio"
|
||||
FIELD LF_TABCOM->CODTAB
|
||||
HELP "Codice da cui iniziare la stampa. Vuoto = inizio archivio"
|
||||
FIELD LF_TABCOM->CODTAB
|
||||
USE %NOT
|
||||
INPUT CODTAB F_INIZIO1
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Destinazione@30" S0
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Blocca imm." B0
|
||||
DISPLAY "Documento" B1
|
||||
OUTPUT F_INIZIO1 CODTAB
|
||||
GROUP 1
|
||||
END
|
||||
@ -21,8 +20,8 @@ STRING F_FINE1 3
|
||||
BEGIN
|
||||
PROMPT 2 3 "A codice "
|
||||
FLAGS "U"
|
||||
HELP "Codice di fine. Vuoto = fine archivio"
|
||||
FIELD LF_TABCOM->CODTAB
|
||||
HELP "Codice di fine. Vuoto = fine archivio"
|
||||
FIELD LF_TABCOM->CODTAB
|
||||
COPY USE F_INIZIO1
|
||||
INPUT CODTAB F_FINE1
|
||||
COPY DISPLAY F_INIZIO1
|
||||
|
@ -1,8 +1,8 @@
|
||||
// campi maschera batb%not.msk
|
||||
|
||||
#define F_CODICE 101
|
||||
#define F_DEST 102
|
||||
#define F_BLOCCA 103
|
||||
#define F_NOT_COD 101
|
||||
#define F_NOT_DESC 102
|
||||
#define F_NOT_BLOCCA 103
|
||||
|
||||
|
||||
|
||||
|
@ -1,12 +1,12 @@
|
||||
[Headers]
|
||||
80
|
||||
Tabella Note cliente
|
||||
1|@2g%s|Codice
|
||||
1|@10g%s|Descrizione
|
||||
1|@62g%s|Blocca immissione
|
||||
1|@0g%s|Codice
|
||||
1|@35g%s|Descrizione
|
||||
1|@63g%s|Blocca immissione
|
||||
|
||||
[Rows]
|
||||
1|CODTAB|@2g@2s
|
||||
1|S0|@10g@50,ls
|
||||
1|B0|@62g@2f
|
||||
1|CODTAB|@0g@2s
|
||||
1|S0+S1|@3g#-75t
|
||||
1|B0|@79g@1f
|
||||
|
||||
|
@ -8,53 +8,40 @@ ENDPAGE
|
||||
|
||||
PAGE "Tabella Note cliente" -1 -1 78 8
|
||||
|
||||
GROUPBOX DLG_NULL 75 7
|
||||
GROUPBOX DLG_NULL 75 3
|
||||
BEGIN
|
||||
PROMPT 1 0 ""
|
||||
FLAGS "R"
|
||||
END
|
||||
|
||||
STRING F_CODICE 2
|
||||
STRING F_NOT_COD 2
|
||||
BEGIN
|
||||
PROMPT 4 2 "Codice "
|
||||
PROMPT 3 1 "Codice "
|
||||
HELP "Codice note del cliente"
|
||||
FIELD CODTAB
|
||||
FLAGS "U"
|
||||
KEY 1
|
||||
USE %NOT
|
||||
INPUT CODTAB F_CODICE
|
||||
INPUT CODTAB F_NOT_COD
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Destinazione@50" S0
|
||||
DISPLAY "Descrizione@50" S0
|
||||
DISPLAY "Blocca immissione" B0
|
||||
OUTPUT F_CODICE CODTAB
|
||||
OUTPUT F_DEST S0
|
||||
OUTPUT F_BLOCCA B0
|
||||
OUTPUT F_NOT_COD CODTAB
|
||||
CHECKTYPE REQUIRED
|
||||
END
|
||||
|
||||
STRING F_DEST 50
|
||||
BOOLEAN F_NOT_BLOCCA
|
||||
BEGIN
|
||||
PROMPT 4 4 "Descrizione "
|
||||
HELP "Descrizione della nota del cliente"
|
||||
FIELD LF_TABCOM->S0
|
||||
USE %NOT KEY 2
|
||||
INPUT S0 F_DEST
|
||||
DISPLAY "Destinazione@50" S0
|
||||
DISPLAY "Codice" CODTAB
|
||||
DISPLAY "Blocca immissione" B0
|
||||
DISPLAY "Documento" B1
|
||||
OUTPUT F_CODICE CODTAB
|
||||
OUTPUT F_DEST S0
|
||||
OUTPUT F_BLOCCA B0
|
||||
CHECKTYPE REQUIRED
|
||||
KEY 2
|
||||
END
|
||||
|
||||
BOOLEAN F_BLOCCA
|
||||
BEGIN
|
||||
PROMPT 4 8 "Blocca immissione "
|
||||
PROMPT 3 3 "Blocca immissione"
|
||||
HELP "Indicare se bloccare l'inserimento del documento"
|
||||
FIELD LF_TABCOM->B0
|
||||
FIELD B0
|
||||
END
|
||||
|
||||
MEMO F_NOT_DESC 75 -2
|
||||
BEGIN
|
||||
PROMPT 1 5 "Descrizione"
|
||||
HELP "Descrizione della nota del cliente"
|
||||
CHECKTYPE SEARCH
|
||||
END
|
||||
|
||||
ENDPAGE
|
||||
|
@ -390,7 +390,7 @@ bool TStampa_IVdirettiva::data_limite (TMask_field& f, KEY key)
|
||||
else
|
||||
if ((datalim < in)||(datalim > fin))
|
||||
{
|
||||
f.error_box(TR("La data limite non appartiene all' esercizio indicato"));
|
||||
f.error_box(TR("La data limite non appartiene all'esercizio indicato"));
|
||||
return FALSE;
|
||||
}
|
||||
else
|
||||
@ -4681,37 +4681,45 @@ void TStampa_IVdirettiva::setta_righe_descr_verifica(TParagraph_string* str,cons
|
||||
const char* TStampa_IVdirettiva::descrizione_sezione(char sezione)
|
||||
{
|
||||
const char sez[2] = { sezione, '\0' };
|
||||
tmp = cache().get(TAB_IVD, sez, "S0");
|
||||
return tmp;
|
||||
return cache().get(TAB_IVD, sez, "S0");
|
||||
}
|
||||
|
||||
const char* TStampa_IVdirettiva::descrizione_lettera(char sezione, char lettera)
|
||||
{
|
||||
const char let[3] = { sezione, lettera, '\0' };
|
||||
tmp = cache().get(TAB_IVD, let, "S0");
|
||||
return tmp;
|
||||
return cache().get(TAB_IVD, let, "S0");
|
||||
}
|
||||
|
||||
const char* TStampa_IVdirettiva::descrizione_numeroromano(char sezione, char lettera, int numr)
|
||||
{
|
||||
TString8 cod; cod.format("%c%c%04d", sezione, lettera, numr);
|
||||
tmp = cache().get(TAB_IVD, cod, "S0");
|
||||
return tmp;
|
||||
if (numr > 0)
|
||||
{
|
||||
TString8 cod;
|
||||
cod.format("%c%c%04d", sezione, lettera, numr);
|
||||
return cache().get(TAB_IVD, cod, "S0");
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
const char* TStampa_IVdirettiva::descrizione_numero(char sezione, char lettera, int numr, int numero)
|
||||
{
|
||||
TString8 cod; cod.format("%c%c%04d%02d", sezione, lettera, numr, numero);
|
||||
tmp = cache().get(TAB_IVD, cod, "S0");
|
||||
return tmp;
|
||||
TString8 cod;
|
||||
if (numr > 0)
|
||||
cod.format("%c%c%04d%02d", sezione, lettera, numr, numero);
|
||||
else
|
||||
cod.format("%c%c %02d", sezione, lettera, numero);
|
||||
return cache().get(TAB_IVD, cod, "S0");
|
||||
}
|
||||
|
||||
const char* TStampa_IVdirettiva::descrizione_sottoconto(int gruppo, int conto, long sottoc)
|
||||
{
|
||||
// Cache non strettamente necessaria in quanto i conti vengono letti solo una volta
|
||||
TString16 cod; cod.format("%d|%d|%ld", gruppo, conto, sottoc);
|
||||
tmp = cache().get(LF_PCON, cod, PCN_DESCR);
|
||||
return tmp;
|
||||
if (gruppo > 0)
|
||||
{
|
||||
// Cache non strettamente necessaria in quanto i conti vengono letti solo una volta
|
||||
TString16 cod; cod.format("%d|%d|%ld", gruppo, conto, sottoc);
|
||||
return cache().get(LF_PCON, cod, PCN_DESCR);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
const char* TStampa_IVdirettiva::descr_sottoc_clifo(char tipocf,long s)
|
||||
|
@ -2509,7 +2509,9 @@ void TPrimanota_application::add_cgs_tot(TMask& m)
|
||||
descr = cgs().row(riga_totale).get(8);
|
||||
if (descr.blank())
|
||||
descr = m.get(F_DESCR);
|
||||
set_cgs_row(riga_totale, real2imp(tot, 'T'), nuovo, descr, 'T');
|
||||
TImporto imp = real2imp(tot, 'T');
|
||||
imp.normalize();
|
||||
set_cgs_row(riga_totale, imp, nuovo, descr, 'T');
|
||||
}
|
||||
|
||||
calcola_imp(); // Ricalcola totale IVA
|
||||
|
@ -951,7 +951,7 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
||||
const TString8 codcaus = causale().codice();
|
||||
const TValuta cambio(m, SK_VALUTA, SK_DATACAMBIO, SK_CAMBIO, SK_CONTROEURO);
|
||||
const TString& agente = m.get(FS_AGENTE);
|
||||
const char sezione = get_cgs_imp(0).sezione(); // Dare/Avere
|
||||
const char sezione = causale().sezione(1); //get_cgs_imp(0).sezione(); // Dare/Avere
|
||||
|
||||
TBill clifo;
|
||||
const int riga_clifo = cerca_conto_cf(clifo);
|
||||
@ -978,7 +978,8 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
||||
if (iva() != nessuna_iva)
|
||||
partita.put(PART_PROTIVA, m.get_long(F_PROTIVA));
|
||||
|
||||
const TImporto totdoc = get_cgs_imp(riga_clifo);
|
||||
TImporto totdoc = get_cgs_imp(riga_clifo);
|
||||
totdoc.normalize(sezione);
|
||||
partita.put(PART_IMPTOTDOC, totdoc.valore());
|
||||
|
||||
cambio.put(partita);
|
||||
@ -996,7 +997,7 @@ void TPrimanota_application::write_scadenze(const TMask& m)
|
||||
imponibile_val += pag.tval_rata(i);
|
||||
imponibile += pag.tlit_rata(i);
|
||||
}
|
||||
|
||||
|
||||
partita.put(PART_IMPORTO, imponibile);
|
||||
partita.put(PART_IMPORTOVAL, imponibile_val);
|
||||
partita.put(PART_SPESE, pag.spese());
|
||||
|
@ -77,10 +77,10 @@ const TContoOccas& TContoOccas::set(int g, int c, long s, char t, const char* oc
|
||||
|
||||
const TString& TContoOccas::descrizione()
|
||||
{
|
||||
if (_occfpi.not_empty())
|
||||
if (tipo() > ' ' && _occfpi.not_empty())
|
||||
{
|
||||
TString16 code; code << tipo() << '|' << sottoconto();
|
||||
bool really_occas = cache().get(LF_CLIFO, code, CLI_OCCAS).not_empty();
|
||||
const bool really_occas = cache().get(LF_CLIFO, code, CLI_OCCAS).not_empty();
|
||||
if (really_occas)
|
||||
return cache().get(LF_OCCAS, _occfpi, "RAGSOC");
|
||||
}
|
||||
@ -500,7 +500,7 @@ void TStampa_giornale::preprocess_footer()
|
||||
riga.format ("@b@%dg%s@%dg%c %s @%dg%c @%dg%s",
|
||||
_stampa_width == 132 ? SCRITTA : DARE198-STUMB,
|
||||
TR("A riportare "),
|
||||
_stampa_width == 132 ? TOTDARE132 : DARE198,
|
||||
_stampa_width == 132 ? TOTDARE132 : DARE198-2,
|
||||
'D',
|
||||
(const char *) dts,
|
||||
_stampa_width == 132 ? SEZA132 : AVERE198-2,
|
||||
@ -1092,7 +1092,11 @@ void TStampa_giornale::set_rows (int file, int counter)
|
||||
if (s != 0L)
|
||||
set_row (r, "%06ld", s);
|
||||
|
||||
_tc.set(g,c,s,cf,_occfpi);
|
||||
if (cf > ' ' && _occfpi.not_empty() && s == _cur->curr(LF_MOV).get_long(MOV_CODCF))
|
||||
_tc.set(g,c,s,cf,_occfpi);
|
||||
else
|
||||
_tc.set(g,c,s,cf,"");
|
||||
|
||||
|
||||
TParagraph_string descr_conto("", 198);
|
||||
if (_stampa_width == 132)
|
||||
|
@ -111,6 +111,10 @@ bool TApertura_chiusura::mask_datac(TMask_field& f, KEY k)
|
||||
{
|
||||
TDate data = f.get();
|
||||
int anno = app()._esc->date2esc(data);
|
||||
const int annoap = f.mask().get_int(F_ANNO);
|
||||
|
||||
if (anno == annoap)
|
||||
anno = app()._esc->pred(annoap);
|
||||
|
||||
f.mask().set(F_ANNOCH, anno); // Esercizio di chiusura
|
||||
if (anno == 0)
|
||||
|
@ -4,6 +4,7 @@
|
||||
// Aggiornamento saldi
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include <diction.h>
|
||||
#include <progind.h>
|
||||
#include <relation.h>
|
||||
|
@ -830,7 +830,7 @@ void TPag_per_cms::scan_pags()
|
||||
if (acodfor >= acodfor)
|
||||
arec.put(PART_SOTTOCONTO, acodfor);
|
||||
|
||||
TString filtro = "(TIPOPAG>=\"3\")"; //deve essere un pagamento a fornitore!!!
|
||||
TString filtro = "(TIPOMOV>=\"3\")"; //deve essere un pagamento a fornitore!!!
|
||||
const TDate dataini = _mask->get(F_DATAINI);
|
||||
const TDate datafin = _mask->get(F_DATAFIN);
|
||||
if (dataini.ok())
|
||||
|
110
sc/sc2200.cpp
110
sc/sc2200.cpp
@ -1,7 +1,4 @@
|
||||
#include <config.h>
|
||||
#include <currency.h>
|
||||
#include <printapp.h>
|
||||
#include <recarray.h>
|
||||
|
||||
#include "../cg/cgsaldac.h"
|
||||
#include "sc2.h"
|
||||
@ -638,25 +635,25 @@ bool TStampaScadenzario::preprocess_page(int file, int counter)
|
||||
_altri="";
|
||||
_imp_pag = "";
|
||||
|
||||
const bool print_in_valuta = _stvaluta && _codval != " ";
|
||||
const bool print_in_valuta = _stvaluta && is_true_value(_codval);
|
||||
|
||||
print_real(_imp_scad, imp_scad, print_in_valuta ? _codval : "_FIRM");
|
||||
print_real(_imp_scad, imp_scad, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
|
||||
if (_w_imp_pag != ZERO)
|
||||
print_real(_imp_pag, _w_imp_pag, print_in_valuta ? _codval : "_FIRM");
|
||||
print_real(_imp_pag, _w_imp_pag, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
|
||||
if (_w_imp_res != ZERO)
|
||||
switch (tipo_pag)
|
||||
{
|
||||
case 1: // Rimesse dirette
|
||||
print_real(_rimdir, _w_imp_res, print_in_valuta ? _codval : "_FIRM");
|
||||
print_real(_rimdir, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
break;
|
||||
case 2: // ri.ba / Tratte
|
||||
case 3:
|
||||
print_real(_riba, _w_imp_res, print_in_valuta ? _codval : "_FIRM");
|
||||
print_real(_riba, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
break;
|
||||
default: // Altri
|
||||
print_real(_altri, _w_imp_res, print_in_valuta ? _codval : "_FIRM");
|
||||
print_real(_altri, _w_imp_res, print_in_valuta ? _codval : EMPTY_STRING);
|
||||
break;
|
||||
}
|
||||
}
|
||||
@ -675,13 +672,16 @@ bool TStampaScadenzario::preprocess_page(int file, int counter)
|
||||
(file == LF_PCON && _tipost == altri) ||
|
||||
(file ==LF_CLIFO && (_tipost == clienti || _tipost == fornitori)))
|
||||
{
|
||||
if (_cur_data != botime && _cur_data != datascad)
|
||||
bool date_changed = false;
|
||||
if (_cur_data.ok())
|
||||
date_changed = _cur_data != datascad;
|
||||
if (date_changed)
|
||||
{
|
||||
// Se la data di scadenza e' cambiata e non e' il primo record della relazione
|
||||
// allora stampa i totali del giorno.
|
||||
// Controlla poi se e' cambiato il mese, in caso affermativo stampa anche i
|
||||
// totali del mese e lo schema riepilogativo mensile
|
||||
bool month_changed = _cur_data.month() != datascad.month();
|
||||
const bool month_changed = _cur_data.month() != datascad.month();
|
||||
|
||||
for (int i=1; i<MaxRowsForTotal; i++) reset_row(i);
|
||||
int n = 1;
|
||||
@ -1095,7 +1095,7 @@ bool TStampaScadenzario::set_print(int)
|
||||
TSorted_cursor* sorcur = (TSorted_cursor*)current_cursor();
|
||||
TToken_string sortexpr = sorcur->get_order();
|
||||
|
||||
const bool has_ban = sortexpr.get(0) == SCAD_CODABIPR;
|
||||
const bool has_ban = sortexpr.starts_with(SCAD_CODABIPR);
|
||||
if (_group_ban != has_ban)
|
||||
{
|
||||
if (_group_ban)
|
||||
@ -1345,24 +1345,26 @@ void TStampaScadenzario::print_riepilogo(int &nriga, bool type)
|
||||
set_row(nriga++,"@0g! %s@82g!",itom(_cur_data.month()));
|
||||
set_row(nriga++,"%s",(const char*)s);
|
||||
}
|
||||
} else
|
||||
{
|
||||
set_row(nriga,FR("!@5gTotali dal %s al "),_datai.string(brief));
|
||||
set_row(nriga++,"%s@82g!",_dataf.string(brief));
|
||||
set_row(nriga++,"%s",(const char *)s);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
set_row(nriga,FR("!@5gTotali dal %s al "),_datai.string(brief));
|
||||
set_row(nriga++,"%s@82g!",_dataf.string(brief));
|
||||
set_row(nriga++,"%s",(const char *)s);
|
||||
}
|
||||
print_rows_riepilogo(nriga, type, totali);
|
||||
totali.get_keys(as);
|
||||
as.sort();
|
||||
const int items = totali.items();
|
||||
|
||||
TString val, value;
|
||||
for (int i=0; i < items; i++)
|
||||
{
|
||||
TString val(as.row(i));
|
||||
TString value;
|
||||
const bool stampa_in_valuta = _stvaluta && val != " ";
|
||||
real& tot = (real&)totali[val];
|
||||
val = as.row(i);
|
||||
const bool stampa_in_valuta = _stvaluta && is_true_value(val);
|
||||
const real& tot = (real&)totali[val];
|
||||
|
||||
print_real(value, tot, stampa_in_valuta ? val : "_FIRM");
|
||||
print_real(value, tot, stampa_in_valuta ? val : EMPTY_STRING);
|
||||
|
||||
if (tot != ZERO)
|
||||
{
|
||||
@ -1372,7 +1374,8 @@ void TStampaScadenzario::print_riepilogo(int &nriga, bool type)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (val.blank()) val = "EUR";
|
||||
if (!is_true_value(val))
|
||||
val = TCurrency::get_firm_val();
|
||||
set_row(nriga++,FR("! Partite pareggiate in %s. @82g!"),(const char*) val);
|
||||
}
|
||||
}
|
||||
@ -1402,37 +1405,41 @@ void TStampaScadenzario::print_rows_totali(int &nriga, tipo_pe p)
|
||||
const int items = xassoc.items();
|
||||
xassoc.get_keys(as);
|
||||
as.sort();
|
||||
|
||||
TString k, value;
|
||||
for (int i=0; i < items; i++)
|
||||
{
|
||||
TString k(as.row(i)); // Chiave di ordinamento(valuta)
|
||||
TString value;
|
||||
const bool stampa_in_valuta = _stvaluta && k != " ";
|
||||
k = as.row(i); // Chiave di ordinamento(valuta)
|
||||
const bool stampa_in_valuta = _stvaluta && is_true_value(k);
|
||||
_LinearTotal& v = (_LinearTotal&)xassoc[k];
|
||||
|
||||
if (k != " ")
|
||||
if (is_true_value(k))
|
||||
set_row(nriga,"@97g%3s",(const char*)k);
|
||||
|
||||
print_real(value, v._is, stampa_in_valuta ? k : "_FIRM");
|
||||
if (!stampa_in_valuta)
|
||||
k.cut(0);
|
||||
|
||||
print_real(value, v._is, k);
|
||||
|
||||
if (v._is != ZERO)
|
||||
set_row(nriga,"@101g%18s",(const char*) value);
|
||||
|
||||
print_real(value, v._ip, stampa_in_valuta ? k : "_FIRM");
|
||||
print_real(value, v._ip, k);
|
||||
|
||||
if (v._ip != ZERO)
|
||||
set_row(nriga,"@120g%18s",(const char*) value);
|
||||
|
||||
print_real(value, v._rd, stampa_in_valuta ? k : "_FIRM");
|
||||
print_real(value, v._rd, k);
|
||||
|
||||
if (v._rd != ZERO)
|
||||
set_row(nriga,"@139g%18s",(const char*) value);
|
||||
|
||||
print_real(value, v._ri, stampa_in_valuta ? k : "_FIRM");
|
||||
print_real(value, v._ri, k);
|
||||
|
||||
if (v._ri != ZERO)
|
||||
set_row(nriga,"@158g%18s",(const char*) value);
|
||||
|
||||
print_real(value, v._al, stampa_in_valuta ? k : "_FIRM");
|
||||
print_real(value, v._al, k);
|
||||
|
||||
if (v._al != ZERO)
|
||||
set_row(nriga,"@177g%18s",(const char*) value);
|
||||
@ -1452,7 +1459,8 @@ void TStampaScadenzario::print_totali(int &nriga, bool month_changed, bool ended
|
||||
{
|
||||
set_row(nriga,FR("@36g** TOTALI DI @51g%s"),itom(_cur_data.month()));
|
||||
print_rows_totali(nriga, monthly);
|
||||
if (_striepilogo) print_riepilogo(nriga,FALSE);
|
||||
if (_striepilogo)
|
||||
print_riepilogo(nriga,FALSE);
|
||||
}
|
||||
if (ended)
|
||||
{
|
||||
@ -1502,13 +1510,29 @@ void TStampaScadenzario::print_totali_bank(int &nriga)
|
||||
// Setta le righe per stampare i totali della banca
|
||||
// Ordinamento primario per codice o ragione sociale!
|
||||
{
|
||||
set_row(nriga++, "");
|
||||
if (_ordata)
|
||||
set_row(nriga,FR("@36g** TOTALI BANCA"));
|
||||
else
|
||||
set_row(nriga,FR("@70g** TOTALE BANCA"));
|
||||
print_rows_totali(nriga, bank);
|
||||
_totbank_printed = TRUE;
|
||||
if (!real::is_null(_last_ban))
|
||||
{
|
||||
if (_ordata) // Errore 158 - Non stampa il totale del giorno se cambia solo la banca e non il giorno
|
||||
{
|
||||
const TRectype &rc = current_cursor()->curr(LF_SCADENZE);
|
||||
const TDate datascad = rc.get(SCAD_DATASCAD);
|
||||
if (datascad == _cur_data) // Non e' cambiato il giorno
|
||||
{
|
||||
nriga++; // Salto una riga
|
||||
print_totali(nriga, true, false); // Stampa totali del giorno e del mese
|
||||
((TAssoc_array&)_tl[0]).destroy(); // Azzera totali del giorno
|
||||
((TAssoc_array&)_tl[1]).destroy(); // Azzera totali del mese
|
||||
}
|
||||
}
|
||||
|
||||
nriga++;
|
||||
if (_ordata)
|
||||
set_row(nriga,FR("@36g** TOTALI BANCA"));
|
||||
else
|
||||
set_row(nriga,FR("@70g** TOTALE BANCA"));
|
||||
print_rows_totali(nriga, bank);
|
||||
_totbank_printed = true;
|
||||
}
|
||||
}
|
||||
|
||||
void TStampaScadenzario::print_intestazione_banca(int &nriga)
|
||||
@ -1518,7 +1542,7 @@ void TStampaScadenzario::print_intestazione_banca(int &nriga)
|
||||
const TString8 cab = rc.get(SCAD_CODCABPR);
|
||||
TString16 curr_ban; curr_ban << abi << cab;
|
||||
|
||||
bool print_bank = FALSE;
|
||||
bool print_bank = false;
|
||||
if (curr_ban != _last_ban)
|
||||
{
|
||||
_last_ban = curr_ban;
|
||||
@ -1532,7 +1556,7 @@ void TStampaScadenzario::print_intestazione_banca(int &nriga)
|
||||
else
|
||||
_desc_ban = FR("NON INDICATA");
|
||||
_last_bank_rec = current_cursor()->pos();
|
||||
print_bank = TRUE;
|
||||
print_bank = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -165,6 +165,7 @@ bool TMotore_application::changing_mask( int mode )
|
||||
|
||||
TMask* TMotore_application::get_mask( int mode )
|
||||
{
|
||||
/*
|
||||
switch ( mode )
|
||||
{
|
||||
case MODE_INS:
|
||||
@ -185,6 +186,22 @@ TMask* TMotore_application::get_mask( int mode )
|
||||
return _msk;
|
||||
break;
|
||||
}
|
||||
*/
|
||||
if (mode != MODE_INS && mode != MODE_MOD)
|
||||
return _msk;
|
||||
|
||||
TString4 tipodoc = _msk->get(F_TIPODOC); // Prendo il tipo documento dalla maschera di query;
|
||||
if (mode == MODE_MOD)
|
||||
tipodoc = get_relation()->curr().get(DOC_TIPODOC); // Lo prendo dalla relazione (Gelai)
|
||||
|
||||
_docmsk = (TDocumento_mask*)_doc_masks.objptr(tipodoc);
|
||||
if (_docmsk == NULL)
|
||||
{
|
||||
_docmsk = new TDocumento_mask(tipodoc);
|
||||
_doc_masks.add(tipodoc, _docmsk);
|
||||
}
|
||||
|
||||
return _docmsk;
|
||||
}
|
||||
|
||||
const char* TMotore_application::get_next_key( )
|
||||
|
@ -36,8 +36,8 @@ class TStampa_condizioni_vendita: public TPrint_application {
|
||||
bool _gest_val, _gest_um, _gest_sca, _gest_so; // booleani per l'abilitazione di valute, unità di misura, scaglioni e sconti/omaggi
|
||||
bool _filter_by_grm; //Filtro per gruppo merceologico nel caso di stampa righe articoli
|
||||
TString _codiva, _um, _descragg;
|
||||
TString _strprezzo, _stromaggio; //stringhe per la stampa del prezzo dell'articolo (normale ed omaggiato)
|
||||
//int _rcondv_link_id; // id del link ipertestuale all'anagrafica di magazzino
|
||||
TString _strprezzo, _stromaggio, _strstorico; //stringhe per la stampa del prezzo dell'articolo (normale, omaggiato e storico!)
|
||||
|
||||
protected:
|
||||
static bool tipo_handler(TMask_field& f, KEY k);
|
||||
virtual bool user_create(void);
|
||||
@ -381,7 +381,7 @@ void TStampa_condizioni_vendita::preprocess_header() {
|
||||
if (_condven=="O")
|
||||
set_header(i, "@73gEsaur."); // setta l'header dell'articolo in esaurimento
|
||||
if (_condven=="C" && _printstorico) //header della riga prezii e date storici
|
||||
set_header(++i, "@87gData prezzo storico @109gPrezzo storico");
|
||||
set_header(++i, "@79gData prezzo storico @101gPrezzo storico");
|
||||
}
|
||||
set_header(++i,(const char*)rw);
|
||||
set_header(++i, "@14g%3s", (const char *) condv.get("COD"));
|
||||
@ -504,14 +504,16 @@ void TStampa_condizioni_vendita::set_page(int file, int) {
|
||||
|
||||
set_row(++i, "Prezzo: #t", &_strprezzo);
|
||||
if (_printstorico && tiporiga[0] == 'A')
|
||||
set_row(++i, "Prezzo storico: @pn", FLD(LF_RCONDV, "PRZSTO", "###.###.###,@@"));
|
||||
{
|
||||
curr2str("PRZSTO", _strstorico);
|
||||
set_row(++i, "Prezzo storico: #t", &_strstorico);
|
||||
}
|
||||
set_row(++i, "Pz per conf.: @pn", FLD(-ART1, "PPCONF","###.###.###,@@"));
|
||||
set_row(++i, "Data ultimo aumento: @d", FLD(LF_RCONDV, "DATAULTAUM"));
|
||||
if (_printstorico && tiporiga[0] == 'A')
|
||||
set_row(++i, "Data prezzo storico: @d", FLD(LF_RCONDV, "DATAPRZSTO"));
|
||||
set_row(++i, "Sconto: @25s", FLD(LF_RCONDV, "SCONTO"));
|
||||
set_row(++i, "Addebito IVA: @f", FLD(LF_RCONDV, "ADDIVA"));
|
||||
//set_row(++i, "Codice IVA: @4s", FLD(LF_RCONDV, "CODIVA"));
|
||||
set_row(++i, "Codice IVA: #4t", &_codiva);
|
||||
set_row(++i, "Percentuale di provvigione: @pn", FLD(LF_RCONDV, "PERCPROVV","###,@@"));
|
||||
if (condv.get_bool("GESTSCO")) {
|
||||
@ -584,7 +586,8 @@ void TStampa_condizioni_vendita::set_page(int file, int) {
|
||||
// quarta riga: storico (solo per contratti,opzionale)
|
||||
if (_printstorico)
|
||||
{
|
||||
set_row(++i, "@87g@10s @109g@pn", FLD(LF_RCONDV, "DATAPRZSTO"), FLD(LF_RCONDV, "PRZSTO", "###.###.###,@@"));
|
||||
curr2str("PRZSTO", _strstorico);
|
||||
set_row(++i, "@79g@10s @101g#t", FLD(LF_RCONDV, "DATAPRZSTO"), &_strstorico);
|
||||
}
|
||||
|
||||
set_row(++i, ""); // salta una riga
|
||||
|
27
ve/velib.h
27
ve/velib.h
@ -136,26 +136,6 @@ public:
|
||||
virtual ~TSpesa_prest() {}
|
||||
};
|
||||
|
||||
/*class TIVA : public TRectype // velib01
|
||||
{
|
||||
|
||||
protected:
|
||||
int read(const char* codice);
|
||||
|
||||
public:
|
||||
TObject* dup() const { return new TIVA(codice()); }
|
||||
|
||||
public:
|
||||
const TString& codice() const { return get("CODTAB");}
|
||||
const TString& descrizione() const { return get("S0"); }
|
||||
const real aliquota() const { return get_real("R0"); }
|
||||
const TString& tipo() const { return get("S1"); }
|
||||
|
||||
TIVA(const char* codice = NULL);
|
||||
TIVA(const TRectype& rec);
|
||||
virtual ~TIVA() {}
|
||||
};*/
|
||||
|
||||
class TExpr_documento : public TExpression // velib01
|
||||
{
|
||||
TDocumento * _doc;
|
||||
@ -425,6 +405,7 @@ class TRiga_documento : public TAuto_variable_rectype // velib02
|
||||
static TAssoc_array _ive;
|
||||
static TCache_articoli * _articoli;
|
||||
static int _iva_calc_mode;
|
||||
static bool _rit_calc;
|
||||
|
||||
protected:
|
||||
// @cmember Setta il contenuto del campo <p fieldname> (non tipizzata)
|
||||
@ -501,6 +482,7 @@ public:
|
||||
real iva_omaggio(int ndec, int iva_calc_mode = 1) const;
|
||||
real imposta(bool round = TRUE) const;
|
||||
real provvigione(int ndec = AUTO_DECIMALS) const;
|
||||
real ritenuta(const char tipor = '\0', bool lordo = false, int ndec = AUTO_DECIMALS) const;
|
||||
|
||||
const TString& field_qta() const;
|
||||
const TString& field_qtaevasa() const;
|
||||
@ -708,7 +690,7 @@ public:
|
||||
void set_riga_esenzione();
|
||||
|
||||
void iva_esente(TString & codiva_es) const;
|
||||
real spese_incasso(real & imp, int ndec, TTipo_importo netto = _lordo) const ;
|
||||
real spese_incasso(int ndec, TTipo_importo netto = _lordo) const ;
|
||||
real bolli(real & imp, int ndec, TTipo_importo netto = _lordo) const ;
|
||||
|
||||
real imponibile(bool spese = FALSE, int ndec = AUTO_DECIMALS) const;
|
||||
@ -717,6 +699,7 @@ public:
|
||||
real totale_netto() const;
|
||||
real basesconto() const;
|
||||
real spese() const;
|
||||
real ritenute(const char tipo = '\0', bool lordo = false, int ndec = AUTO_DECIMALS) const;
|
||||
real provvigione(int ndec = AUTO_DECIMALS) const;
|
||||
real valore(bool totale, int ndec = AUTO_DECIMALS) const;
|
||||
|
||||
@ -726,7 +709,7 @@ public:
|
||||
real calc_conai_qta(int type);
|
||||
void update_conai();
|
||||
|
||||
bool is_generic() const { return tipo_valido() && tipo().is_generic(); }
|
||||
bool is_generic() const { return tipo_valido() && tipo().is_generic(); }
|
||||
bool is_fattura() const { return tipo_valido() && tipo().is_fattura(); }
|
||||
bool is_bolla() const { return tipo_valido() && tipo().is_bolla(); }
|
||||
bool is_ordine() const { return tipo_valido() && tipo().is_ordine(); }
|
||||
|
@ -167,7 +167,8 @@ TAssoc_array TRiga_documento::_ive;
|
||||
TCache_articoli * TRiga_documento::_articoli = NULL;
|
||||
|
||||
// 0=ignora IVA; 1=consedera iva solo se c'e' addebito; 2=considera sempre IVA
|
||||
int TRiga_documento::_iva_calc_mode = 0;
|
||||
int TRiga_documento::_iva_calc_mode = 0;
|
||||
bool TRiga_documento::_rit_calc = false;
|
||||
|
||||
TRiga_documento::TRiga_documento(TDocumento* doc, const char * tipo)
|
||||
: TAuto_variable_rectype(LF_RIGHEDOC), _doc(doc)
|
||||
@ -451,7 +452,7 @@ real TRiga_documento::importo(bool scontato, bool lordo, int ndec) const
|
||||
case RIGA_SPESEDOC:
|
||||
{
|
||||
const TSpesa_prest & s = spesa();
|
||||
const bool to_calc = s.tipo_ritenuta() == '\0';
|
||||
const bool to_calc = _rit_calc || s.tipo_ritenuta() == '\0';
|
||||
|
||||
if (to_calc)
|
||||
{
|
||||
@ -615,6 +616,24 @@ real TRiga_documento::provvigione(int ndec) const
|
||||
return val;
|
||||
}
|
||||
|
||||
real TRiga_documento::ritenuta(const char tipor, bool lordo, int ndec) const
|
||||
{
|
||||
real val;
|
||||
|
||||
if (tipo().tipo() == RIGA_SPESEDOC)
|
||||
{
|
||||
const char tipo_rit = spesa().tipo_ritenuta();
|
||||
|
||||
if ((tipor != '\0' && tipo_rit == tipor) || (tipor == '\0' && tipo_rit != '\0'))
|
||||
{
|
||||
_rit_calc = TRUE;
|
||||
val = importo(true, lordo, ndec);
|
||||
_rit_calc = FALSE;
|
||||
}
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
const TString& TRiga_documento::field_qta() const
|
||||
{
|
||||
const TString& rowtype_field = tipo().field_qta();
|
||||
|
@ -268,7 +268,7 @@ void TDocumento::test_firm()
|
||||
}
|
||||
}
|
||||
|
||||
real TDocumento::spese_incasso(real& /* imp */, int ndec, TTipo_importo t) const
|
||||
real TDocumento::spese_incasso(int ndec, TTipo_importo t) const
|
||||
{
|
||||
real imp_spese;
|
||||
const real percentuale = get_real("PERCSPINC");
|
||||
@ -394,6 +394,9 @@ real TDocumento::bolli(real & imp, int ndec, TTipo_importo t) const
|
||||
spese_val.change_to_firm_val();
|
||||
const real sp_orig = spese_val.get_num();
|
||||
bool estero = FALSE; // Assumiamo per ora non estero
|
||||
TString16 codiva_es;
|
||||
|
||||
iva_esente(codiva_es);
|
||||
|
||||
for (int j = 0; j < 5 && tot_bolli+iva_bolli != old_bolli; j++)
|
||||
{
|
||||
@ -475,7 +478,7 @@ real TDocumento::bolli(real & imp, int ndec, TTipo_importo t) const
|
||||
break;
|
||||
}
|
||||
}
|
||||
iva_bolli = TRiga_documento::iva(codiva_bolli()).imposta(tot_bolli, ndec);
|
||||
iva_bolli = TRiga_documento::iva(codiva_es.not_empty() ? (const TString &) codiva_es : codiva_bolli()).imposta(tot_bolli, ndec);
|
||||
importo += (tot_bolli + iva_bolli - old_bolli);
|
||||
}
|
||||
if (t == _lordo)
|
||||
@ -1761,7 +1764,7 @@ void TDocumento::update_tabella_iva()
|
||||
if (fatt_comm)
|
||||
calc_iva_fattura_commerciale();
|
||||
|
||||
real val = spese_incasso(tot_doc, ALL_DECIMALS, doc_al_lordo ? _lordo : _netto);
|
||||
real val = spese_incasso(ALL_DECIMALS, doc_al_lordo ? _lordo : _netto);
|
||||
|
||||
if (val != ZERO)
|
||||
{
|
||||
@ -1778,32 +1781,32 @@ void TDocumento::update_tabella_iva()
|
||||
|
||||
if (!doc_al_lordo)
|
||||
{
|
||||
val = spese_incasso(tot_doc, ALL_DECIMALS, _imposta);
|
||||
val = spese_incasso(ALL_DECIMALS, _imposta);
|
||||
ri->iva_spese() += val;
|
||||
tot_doc += val;
|
||||
}
|
||||
}
|
||||
|
||||
val = bolli(tot_doc, ALL_DECIMALS, doc_al_lordo ? _lordo : _netto);
|
||||
const real rit = ritenute();
|
||||
val = bolli(real(tot_doc - rit), ALL_DECIMALS, doc_al_lordo ? _lordo : _netto);
|
||||
if (val != ZERO)
|
||||
{
|
||||
const TString16 codiva = codiva_bolli();
|
||||
TRiepilogo_iva* ri = (TRiepilogo_iva *) table.objptr(codiva);
|
||||
|
||||
if (ri == NULL)
|
||||
{
|
||||
ri = new TRiepilogo_iva(TCodiceIVA(codiva));
|
||||
table.add(codiva, ri);
|
||||
}
|
||||
|
||||
ri->imp_spese() += val;
|
||||
tot_doc += val;
|
||||
|
||||
if (!doc_al_lordo)
|
||||
{
|
||||
val = bolli(tot_doc, ALL_DECIMALS, _imposta);
|
||||
ri->iva_spese() += val;
|
||||
tot_doc += val;
|
||||
real valiva = bolli(real(tot_doc - rit), ALL_DECIMALS, _imposta);
|
||||
ri->iva_spese() += valiva;
|
||||
tot_doc += valiva;
|
||||
}
|
||||
ri->imp_spese() += val;
|
||||
tot_doc += val;
|
||||
}
|
||||
|
||||
// SCORPORO
|
||||
@ -1865,8 +1868,8 @@ real TDocumento::totale_doc() const
|
||||
real r = imponibile() + imposta();
|
||||
const int ndec = decimals();
|
||||
|
||||
r += spese_incasso(r, ndec);
|
||||
r += bolli(r, ndec);
|
||||
r += spese_incasso(ndec);
|
||||
r += bolli(real(r - ritenute()), ndec);
|
||||
return r;
|
||||
}
|
||||
}
|
||||
@ -1899,6 +1902,18 @@ real TDocumento::spese() const
|
||||
return ZERO;
|
||||
}
|
||||
|
||||
real TDocumento::ritenute(const char tipo, bool lordo, int ndec) const
|
||||
{
|
||||
real val;
|
||||
for (int i = rows() ; i > 0; i--)
|
||||
{
|
||||
TRiga_documento &r = ((TRiga_documento &) ((TDocumento *)this)->row(i));
|
||||
|
||||
val += r.ritenuta(tipo, lordo, ndec);
|
||||
}
|
||||
return val;
|
||||
}
|
||||
|
||||
TPagamento& TDocumento::pagamento()
|
||||
{
|
||||
const char tipocf = get_char(DOC_TIPOCF);
|
||||
|
@ -444,7 +444,7 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
|
||||
real & r = stack.peek_real();
|
||||
|
||||
if (_doc)
|
||||
r = _doc->spese_incasso(r, ndec, netto ? _netto : _lordo);
|
||||
r = _doc->spese_incasso(ndec, netto ? _netto : _lordo);
|
||||
else
|
||||
r = ZERO;
|
||||
}
|
||||
@ -463,8 +463,8 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
|
||||
|
||||
if (_doc)
|
||||
{
|
||||
r += _doc->spese_incasso(r, ndec);
|
||||
r = _doc->bolli(r, ndec, netto ? _netto : _lordo);
|
||||
r += _doc->spese_incasso(ndec);
|
||||
r = _doc->bolli(real(r - _doc->ritenute()), ndec, netto ? _netto : _lordo);
|
||||
}
|
||||
else
|
||||
r = ZERO;
|
||||
@ -481,9 +481,9 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
|
||||
|
||||
if (_doc)
|
||||
{
|
||||
real r1 = _doc->spese_incasso(r, ndec);
|
||||
real r1 = _doc->spese_incasso(ndec);
|
||||
r += r1;
|
||||
r1 += _doc->bolli(r, ndec);
|
||||
r1 += _doc->bolli(real(r - _doc->ritenute()), ndec);
|
||||
r = r1;
|
||||
}
|
||||
else
|
||||
@ -728,25 +728,9 @@ void TExpr_documento::evaluate_user_func(int index, int nparms, TEval_stack & st
|
||||
stack.push(ZERO);
|
||||
real & val = stack.peek_real();
|
||||
|
||||
const bool spesa = _row->tipo().tipo() == 'S';
|
||||
const char tipo = _row->spesa().tipo_ritenuta();
|
||||
|
||||
if (spesa)
|
||||
{
|
||||
const bool tipo_rit = _row->spesa().tipo_ritenuta() != 0;
|
||||
|
||||
if (tipo_rit != '\0')
|
||||
{
|
||||
((TSpesa_prest &)_row->spesa()).zero("S9");
|
||||
_row->dirty_fields();
|
||||
val = _row->importo(TRUE, lordo, ndec);
|
||||
_row->dirty_fields();
|
||||
((TSpesa_prest &)_row->spesa()).put("S9", (char)tipo_rit);
|
||||
}
|
||||
else
|
||||
val = ZERO;
|
||||
}
|
||||
else
|
||||
val = ZERO;
|
||||
val = _row->ritenuta(tipo, lordo, ndec);
|
||||
}
|
||||
break;
|
||||
case _tipo_ritenuta:
|
||||
|
124
ve/velib04b.cpp
124
ve/velib04b.cpp
@ -1811,6 +1811,8 @@ void TContabilizzazione::calculate_spese(real& spese, real& sp_iva, int ndec, bo
|
||||
r.put(RDOC_PREZZO, spese);
|
||||
r.put(RDOC_CODIVA, codiva_es);
|
||||
_righe_iva->add(r, zio, ndec);
|
||||
sp_iva = r.imposta(FALSE);
|
||||
sp_iva.round(ndec);
|
||||
if (doc.tipo().calcolo_lordo()) // Si ricorda che calcolo_lordo() e fattura_commerciale sono esclusivi.
|
||||
{
|
||||
// Totalizza per ogni codice iva il lordo
|
||||
@ -1818,9 +1820,7 @@ void TContabilizzazione::calculate_spese(real& spese, real& sp_iva, int ndec, bo
|
||||
if (!_totali_lordi.is_key(codiva_es))
|
||||
_totali_lordi.add(codiva_es, new real);
|
||||
real& rl = (real&) _totali_lordi[codiva_es];
|
||||
real iva = r.imposta(FALSE);
|
||||
iva.round(ndec);
|
||||
rl += spese + iva;
|
||||
rl += spese + sp_iva;
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1832,20 +1832,23 @@ error_type TContabilizzazione::add_spese_inbo(TDocumento& doc, const int ndec)
|
||||
{
|
||||
real tot_netto, sp_incasso, sp_bolli;
|
||||
real iva_sp_incasso, iva_sp_bolli;
|
||||
const real rit = doc.ritenute();
|
||||
bool is_cli = doc.get(DOC_TIPOCF) == "C";
|
||||
// Aggiunge le spese d'incasso
|
||||
tot_netto = doc.totale_netto();
|
||||
sp_incasso = doc.spese_incasso(tot_netto,ndec,_netto);
|
||||
|
||||
sp_incasso = doc.spese_incasso(ndec, _netto);
|
||||
TString16 codiva_es;
|
||||
|
||||
doc.iva_esente(codiva_es);
|
||||
|
||||
if (sp_incasso != 0.0)
|
||||
calculate_spese(sp_incasso,iva_sp_incasso,ndec,TRUE,is_cli, doc.codiva_spese(), doc);
|
||||
calculate_spese(sp_incasso,iva_sp_incasso,ndec,TRUE,is_cli, codiva_es.not_empty() ? codiva_es : doc.codiva_spese(), doc);
|
||||
|
||||
// Aggiunge le spese bolli
|
||||
tot_netto += sp_incasso + iva_sp_incasso;
|
||||
sp_bolli = doc.bolli(tot_netto,ndec, _netto);
|
||||
tot_netto += sp_incasso + iva_sp_incasso - rit;
|
||||
sp_bolli = doc.bolli(tot_netto, ndec, _netto);
|
||||
if (sp_bolli != 0)
|
||||
calculate_spese(sp_bolli, iva_sp_bolli, ndec, FALSE, is_cli, doc.codiva_bolli(), doc);
|
||||
calculate_spese(sp_bolli, iva_sp_bolli, ndec, FALSE, is_cli, codiva_es.not_empty() ? codiva_es : doc.codiva_bolli(), doc);
|
||||
|
||||
return _error;
|
||||
}
|
||||
@ -2216,7 +2219,16 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
||||
const bool riga_omaggio = r.get_bool(RDOC_ADDIVA) && tipo == 'O';
|
||||
if ((tipo != RIGA_DESCRIZIONI && tipo != RIGA_SCONTI) || riga_omaggio)
|
||||
{
|
||||
search_costo_ricavo(conto,r); // l'errore eventuale viene settato qui dentro
|
||||
const bool spesa = r.tipo().tipo() == RIGA_SPESEDOC;
|
||||
char tipo_rit = '\0';
|
||||
|
||||
if (spesa)
|
||||
tipo_rit = r.spesa().tipo_ritenuta();
|
||||
|
||||
const bool ritenuta = tipo_rit != '\0' && !_caus->intra();
|
||||
|
||||
if (!ritenuta)
|
||||
search_costo_ricavo(conto,r); // l'errore eventuale viene settato qui dentro
|
||||
if (good())
|
||||
{
|
||||
if (fat_com)
|
||||
@ -2238,57 +2250,49 @@ error_type TContabilizzazione::compile_rows_mov(TDocumento& doc)
|
||||
r.put(RDOC_CODIVA, codiva2); //Restore
|
||||
}
|
||||
else
|
||||
{
|
||||
if (riga_omaggio)
|
||||
_righe_iva->add_omaggi(r, conto);
|
||||
else
|
||||
_righe_iva->add(r, conto);
|
||||
const TString16 cod(r.get(RDOC_CODIVA));
|
||||
if (ritenuta)
|
||||
{
|
||||
TCurrency_documento c(r.ritenuta(tipo_rit));
|
||||
TRectype & h = _movimento->lfile().curr();
|
||||
real val;
|
||||
if (r.doc().in_valuta())
|
||||
{
|
||||
val = h.get_real(MOV_TOTDOCVAL) - c.get_num();
|
||||
h.put(MOV_TOTDOCVAL, val);
|
||||
}
|
||||
c.change_to_firm_val();
|
||||
val = h.get_real(MOV_TOTDOC) - c.get_num();
|
||||
h.put(MOV_TOTDOC, val);
|
||||
|
||||
if (r.doc().tipo().calcolo_lordo()) // Si ricorda che calcolo_lordo() e fattura_commerciale() sono esclusivi.
|
||||
{
|
||||
// Totalizza per ogni codice iva il lordo
|
||||
if (!_totali_lordi.is_key(cod))
|
||||
_totali_lordi.add(cod, new real);
|
||||
real& rl = (real&) _totali_lordi[cod];
|
||||
rl += r.imponibile(TRUE);
|
||||
}
|
||||
}
|
||||
if (r.tipo().tipo() == RIGA_SPESEDOC && !_caus->intra())
|
||||
{
|
||||
const char tipo_rit = r.spesa().tipo_ritenuta();
|
||||
|
||||
if (tipo_rit != '\0')
|
||||
{
|
||||
((TSpesa_prest &)r.spesa()).zero("S9");
|
||||
((TRiga_documento &)r).dirty_fields();
|
||||
TCurrency_documento c(r.imponibile());
|
||||
((TRiga_documento &)r).dirty_fields();
|
||||
((TSpesa_prest &)r.spesa()).put("S9", (char) tipo_rit);
|
||||
TRectype & h = _movimento->lfile().curr();
|
||||
real val;
|
||||
if (r.doc().in_valuta())
|
||||
{
|
||||
val = h.get_real(MOV_TOTDOCVAL) - c.get_num();
|
||||
h.put(MOV_TOTDOCVAL, val);
|
||||
}
|
||||
c.change_to_firm_val();
|
||||
val = h.get_real(MOV_TOTDOC) - c.get_num();
|
||||
h.put(MOV_TOTDOC, val);
|
||||
|
||||
if (tipo_rit == 'F')
|
||||
{
|
||||
val = h.get_real(MOV_RITFIS) + c.get_num();
|
||||
h.put(MOV_RITFIS, val);
|
||||
}
|
||||
else
|
||||
if (tipo_rit == 'S')
|
||||
{
|
||||
val = h.get_real(MOV_RITSOC) + c.get_num();
|
||||
h.put(MOV_RITSOC, val);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (tipo_rit == 'F')
|
||||
{
|
||||
val = h.get_real(MOV_RITFIS) + c.get_num();
|
||||
h.put(MOV_RITFIS, val);
|
||||
}
|
||||
else
|
||||
if (tipo_rit == 'S')
|
||||
{
|
||||
val = h.get_real(MOV_RITSOC) + c.get_num();
|
||||
h.put(MOV_RITSOC, val);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (riga_omaggio)
|
||||
_righe_iva->add_omaggi(r, conto);
|
||||
else
|
||||
_righe_iva->add(r, conto);
|
||||
const TString16 cod(r.get(RDOC_CODIVA));
|
||||
|
||||
if (r.doc().tipo().calcolo_lordo()) // Si ricorda che calcolo_lordo() e fattura_commerciale() sono esclusivi.
|
||||
{
|
||||
// Totalizza per ogni codice iva il lordo
|
||||
if (!_totali_lordi.is_key(cod))
|
||||
_totali_lordi.add(cod, new real);
|
||||
real& rl = (real&) _totali_lordi[cod];
|
||||
rl += r.imponibile(TRUE);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -293,10 +293,10 @@ long TGenerazione_effetti::group_bills(TAssoc_array& group_array)
|
||||
display_error(doc);
|
||||
return 0L;
|
||||
}
|
||||
real tot = doc.totale_doc();
|
||||
const real tot = doc.totale_doc() - doc.ritenute();
|
||||
doc.put(DOC_CODPAG, codpag); //placeholder
|
||||
|
||||
const TCurrency_documento totale_fatt(doc.totale_doc(), doc);
|
||||
const TCurrency_documento totale_fatt(tot, doc);
|
||||
const bool valuta = doc.in_valuta();
|
||||
const real change = doc.cambio();
|
||||
const TDate datafatt = doc.get_date(DOC_DATADOC);
|
||||
@ -486,7 +486,8 @@ void TGenerazione_effetti::calc_pagamento(TDocumento& doc)
|
||||
TPagamento& pag = doc.pagamento();
|
||||
|
||||
// const real change = doc.cambio();
|
||||
const TCurrency_documento tot_doc(doc.totale_doc(), doc);
|
||||
const real tot = doc.totale_doc() - doc.ritenute();
|
||||
const TCurrency_documento tot_doc(tot, doc);
|
||||
const TCurrency_documento totspese(doc.spese(), doc);
|
||||
const TCurrency_documento totimposte(doc.imposta(TRUE), doc);
|
||||
const TCurrency_documento totimponibili(tot_doc - totimposte - totspese);
|
||||
@ -558,7 +559,8 @@ void TGenerazione_effetti::generate_bill(TDocumento& doc) // bill in inglese sig
|
||||
if (data.empty())
|
||||
data = doc.get(DOC_DATADOC);
|
||||
|
||||
const TCurrency_documento totale_fatt(doc.totale_doc(), doc); // Importo in valuta
|
||||
const real tot = doc.totale_doc() - doc.ritenute();
|
||||
const TCurrency_documento totale_fatt(tot, doc); // Importo in valuta
|
||||
const TCurrency_documento imppagato(doc.get_real(DOC_IMPPAGATO), doc); // Anticipo pagamento
|
||||
if (totale_fatt > imppagato && !doc.get_bool(DOC_ACCSALDO)) // procede se non e' a saldo
|
||||
{
|
||||
|
@ -180,8 +180,20 @@ bool note_hndl( TMask_field& f, KEY key )
|
||||
TDocumento_mask & m = (TDocumento_mask &) f.mask();
|
||||
|
||||
if (key == K_TAB && (f.focusdirty() || !m.is_running()))
|
||||
{
|
||||
{
|
||||
TTable & note = (TTable &) ((TEdit_field &) f).browse()->cursor()->file();
|
||||
// gestione del campo con descrizione estesa
|
||||
TString stringone;
|
||||
TRectype& rec = note.curr();
|
||||
TString4 fieldname;
|
||||
for (int i = 0; i < 6; i++)
|
||||
{
|
||||
fieldname.format("S%d", i);
|
||||
stringone << rec.get(fieldname);
|
||||
}
|
||||
stringone.replace((char)0xB6, '\n');
|
||||
m.set(F_NOTECLI, stringone);
|
||||
|
||||
note.setkey(1);
|
||||
const TString16 cod(f.get());
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user