Patch level : 12.0 426

Files correlati     : ve0.exe ve0300a.ini ve0100a.msk ve0200g.msk ve1300.alx ve1.exe ve17001.rep ve17002.rep ve1700a.msk ve1700a.msk ve2.exe ve6.exe ve61000a.msk ve17001.rep ve17002.rep ve17002.rep ve17001.rep ve1700a.msk ve6b00a.msk


MODIFICHE CRPA

Se si mette il flag P sulla data documento della maschera di un tipo documento viene proposta l’ultima data inserita.
Possibilità di impostare il numero di copie nell’inserimento/modifica di un documento.
Righe documento massime 10000
Aggiunta ricerca per riferimento cliente (ricerca alternativa).
Aggiunto indirizzo cliente/fornitore sulla ricerca documenti.
Lista documenti avanzata (report).
Aggiunte le regolarizzazioni nella contabilizzazione documenti
Sistema abilitazione della data registrazione in contabilizzazione documenti
Aggiunta la possibilità di usare campi del documento nella dicitura del riferimento.
Gestiti i movimenti di sola iva in contabilizzazione.
Riferimento per mese nelle partite.
Ordinamento per documento nell’evasione ordini con un flag in configurazione
Impostato il tipo CF in base al tipo documento
Aggiunto il messaggio cliente alla stampa report delle vendite



git-svn-id: svn://10.65.10.50/branches/R_10_00@24005 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
bonazzi 2017-07-27 00:00:32 +00:00
parent c535cd5d70
commit 0218c77fb4
39 changed files with 5188 additions and 3409 deletions

View File

@ -4,10 +4,10 @@
#include <modaut.h>
#include <recset.h>
#include <tabutil.h>
#include <toolfld.h>
#include <utility.h>
#include <urldefid.h>
#include "../li/lilib01.h"
#include "ve0100.h"
#include "veini.h"
@ -16,9 +16,13 @@
#include "verig.h"
#include "velib04.h"
#include "../mg/mglib.h"
#include "../li/lilib01.h"
#include "sconti.h"
#include <occas.h>
#include "../mg/anamag.h"
#include "../cg/cfban.h"
TCursor* TMotore_application::get_filtered_cursor() const
{
@ -153,13 +157,18 @@ void TMotore_application::init_insert_mode( TMask& m )
m.set(F_STATO, str_stato);
TDate data_doc(TODAY);
const bool magic_datadoc = m.field(F_DATADOC).automagic();
if (!magic_datadoc)
{
long ndoc = 0; // unused
last_doc(provv, anno, codnum, ndoc, data_doc);
}
m.set(F_DATADOC, data_doc, 0x1);
const bool permanent = m.field(F_DATADOC).persistent();
if (!permanent || m.get(F_DATADOC).blank())
{
const bool magic_datadoc = m.field(F_DATADOC).automagic();
if (!magic_datadoc)
{
long ndoc = 0; // unused
last_doc(provv, anno, codnum, ndoc, data_doc);
}
m.set(F_DATADOC, data_doc, 0x1);
}
int pos = m.id2pos( F_DATACAMBIO1);
if (pos >= 0 && m.fld(pos).active() && !m.get(F_CODVAL).empty())
@ -406,6 +415,17 @@ bool TMotore_application::menu(MENU_TAG mt)
if (_docmsk != NULL)
_docmsk->sel_color();
}
if (mt == MENU_ITEM_ID(2))
{
TMask m("Copie", 1, 40, 8);
m.add_button_tool(DLG_OK, "", TOOL_OK);
m.add_button_tool(DLG_CANCEL, "", TOOL_CANCEL);
m.add_number(101, 0, "Numero di copie", 2, 3, 3);
m.set(101, _ncopie);
if (m.run() == K_ENTER)
_ncopie = m.get_int(101);
}
else
ok = TRelation_application::menu(mt);
return ok;
@ -491,6 +511,7 @@ int TMotore_application::write( const TMask& m ) // C 90
{
TDocumento_mask& mask = (TDocumento_mask&) m;
TDocumento& d = (TDocumento&)_rel->curr();
mask.mask2doc();
d = mask.doc(); // Trasferisce il documento da maschera a record
// Se ho attivato la creazione automatica delle righe allora cancello quelle vuote finali
@ -539,6 +560,7 @@ int TMotore_application::rewrite( const TMask& m ) // C 90
if (d.bloccato())
return NOERR;
mask.mask2doc();
d = ((TDocumento_mask&)m).doc(); // Trasferisce il documento da maschera a record
// Aggiunte per il controllo plafond
@ -707,8 +729,10 @@ bool TMotore_application::user_create( )
_msk->set_handler(F_CODNUM, TDocumento_mask::num_handler);
_msk->set_handler(F_TIPODOC, tdoc_handler);
_msk->set_handler(F_NUMDOCRIF, TDocumento_mask::numdocrif_search_handler);
//_msk->set_handler(F_RAGSOCSEARCH, TDocumento_mask::ragsoc_search_handler);
_msk->set_handler(F_NDOC, ndoc_handler);
// _msk->set_handler(F_RAGSOCSEARCH, TDocumento_mask::ragsoc_search_handler);
if (_msk->id2pos(F_RIFSEARCH) > 0)
_msk->set_handler( F_RIFSEARCH, TDocumento_mask::rif_search_handler );
_msk->set_handler(F_NDOC, ndoc_handler);
const int args = argc() ;
@ -772,6 +796,10 @@ bool TMotore_application::user_create( )
}
}
}
else
if (arg.starts_with("-c"))
_ncopie = atoi(arg.mid(2));
}
TConfig utente(CONFIG_GUI, app().name().left(2));
@ -781,6 +809,7 @@ bool TMotore_application::user_create( )
_tipodoc = utente.get("TIPODOC");
_docmsk = NULL;
TSheet_field::set_line_number_width(4);
load_auto_reopen_data();
return true;
@ -1058,7 +1087,7 @@ void TMotore_application::ini2mask(TConfig& ini, TMask& msk, bool query)
ini.set_paragraph(*pa);
// Considera solo i tipi riga validi
const TString4 tipo(ini.get(RDOC_TIPORIGA));
const TString16 tipo(ini.get(RDOC_TIPORIGA));
if (tr.read(tipo) == NOERR)
{
// Crea una nuova riga documento

View File

@ -34,6 +34,7 @@ class TMotore_application : public TRelation_application
TString4 _codnum;
TString4 _tipodoc;
TString80 __last_key;
int _ncopie;
protected:
// Array di maschere documento
@ -102,7 +103,7 @@ public:
TDocumento & doc() {return edit_mask().doc(); }
// Operazione
TMotore_application( ) { }
TMotore_application( ) : _ncopie(-1){ }
virtual ~TMotore_application( ) { }
virtual const char* get_next_key( );

View File

@ -113,8 +113,9 @@ NUMBER F_NDOC 6
BEGIN
PROMPT 24 7 "Numero "
FIELD NDOC
USE LF_DOC SELECT (#F_STATO=="")||(STATO==#F_STATO)
JOIN LF_CLIFO TO LF_DOC INTO TIPOCF==TIPOCF CODCF==CODCF
USE LF_DOC SELECT (#F_STATO=="")||(STATO==#F_STATO)
JOIN LF_CLIFO TO LF_DOC INTO TIPOCF==TIPOCF CODCF==CODCF
JOIN LF_COMUNI TO LF_CLIFO INTO STATO==STATOCF COM==COMCF
INPUT PROVV F_PROVV SELECT
INPUT ANNO F_ANNO SELECT
INPUT CODNUM F_CODNUM SELECT
@ -129,6 +130,10 @@ BEGIN
DISPLAY "C/F" TIPOCF
DISPLAY "Codice" CODCF
DISPLAY "Ragione Sociale@50" LF_CLIFO->RAGSOC
DISPLAY "Indirizzo@35" LF_CLIFO->INDCF
DISPLAY "Numero@15" LF_CLIFO->CIVCF
DISPLAY "Località@50" LF_CLIFO->LOCALITACF
DISPLAY "Comune@50" LF_COMUNI->DENCOM
OUTPUT F_NDOC NDOC
OUTPUT F_TIPODOC TIPODOC
OUTPUT F_PROVV PROVV
@ -163,6 +168,7 @@ BEGIN
/*
USE LF_DOC KEY 2 SELECT (CODNUM==#F_CODNUM)&&(PROVV==#F_PROVV)&&(ANNO==#F_ANNO)&&((#F_STATO=="")||(STATO==#F_STATO))
JOIN LF_CLIFO INTO TIPOCF==TIPOCF CODCF==CODCF
JOIN LF_COMUNI TO LF_CLIFO INTO STATO==STATOCF COM==COMCF
INPUT TIPOCF F_TIPOCF SELECT
INPUT CODCF F_CODCF SELECT
INPUT PROVV F_PROVV
@ -188,6 +194,11 @@ BEGIN
DISPLAY "Data\ndocumento@10" DATADOC
DISPLAY "Valuta" CODVAL
DISPLAY "Totale\ndocumento@18V" G1:TOTDOC
DISPLAY "Stato" STATO
DISPLAY "Indirizzo@35" LF_CLIFO->INDCF
DISPLAY "Numero@15" LF_CLIFO->CIVCF
DISPLAY "Località@50" LF_CLIFO->LOCALITACF
DISPLAY "Comune@50" LF_COMUNI->DENCOM
COPY OUTPUT F_NDOC
OUTPUT F_CODCF CODCF
CHECKTYPE NORMAL

View File

@ -8,7 +8,7 @@ PAGE "Distinta Base" 0 0 0 0
GROUPBOX DLG_NULL 78 9
BEGIN
PROMPT 1 1 "@bParametri esplosione ditinte"
PROMPT 1 1 "@bParametri esplosione distinte"
END
BOOLEAN F_EXPLODEDB

View File

@ -126,7 +126,10 @@ public:
// DISPLAY
void display( const TString& s ){ outline( s, "DI " ); };
// INPUT
// join
void join( const int file, const TString& s ){ _out << "JO " << file << " INTO " << s << "\n"; };
// INPUT
void input( const TString& s ){ outline( s, "IN " ); };
// OUTPUT
@ -1383,7 +1386,7 @@ void TMask_generator::genera_testata_1()
_m->use( LF_CLIFO, 1 );
temp_s.format( "TIPOCF \"%c\"~CODCF %d", tipo_cf, F_CODCF);
_m->input( temp_s );
_m->display( "\"Codice\" CODCF~\"Ragione Sociale@50\" RAGSOC~\"Partita IVA@12\" PAIV~\"Sospeso\" SOSPESO" );
_m->display( "\"Codice\" CODCF~\"Ragione Sociale@50\" RAGSOC~\"Partita IVA@12\" PAIV~\"Sospeso\" SOSPESO~\"Indirizzo@35\" INDCF ~\"Numero@15\" CIVCF~\"Località@50\" LOCALITACF ~\"Comune@50\" 13->DENCOM" );
temp_s.format( "%d CODCF~%d RAGSOC", F_CODCF, F_RAGSOC );
_m->output( temp_s );
_m->check( S_OBBLIGATORIO );
@ -1407,6 +1410,7 @@ void TMask_generator::genera_testata_1()
_m->prompt( 24, 4, "" );
_m->group( 1 );
_m->use( LF_CLIFO, 2 );
_m->join(LF_COMUNI, "STATO==STATOCF COM==COMCF");
temp_s.format( "TIPOCF \"%c\"~RAGSOC %d", tipo_cf, F_RAGSOC );
_m->input( temp_s );
_m->display( "\"Ragione Sociale@50\" RAGSOC~\"Partita IVA@12\" PAIV~\"Codice\" CODCF" );

View File

@ -17,6 +17,7 @@
// T_CORNICE
// T_ZOOM
// T_CURRENCY
// T_SHEET
// SIZE = E' la dimesione del campo nella maschera. Per i tipi che richiedono due dimensioni,
// si fa dimensione1 * 100 + dimesione2
// PROMPT = E' il prompt di default per il campo ( pur essere cambiato nel .INI )
@ -79,7 +80,7 @@ Y=0
MSKID=F_COFI
TYPE=T_STRINGA
PROMPT="Cod. fisc. "
USE=LF_CLIFO KE 4
USE=LF_CLIFO KE 4~JO LF_COMUNI INTO STATO==STATOCF COM==COMCF
INPUT=TIPOCF F_TIPOCF SELECT~COFI F_COFI
DISPLAY="Codice Fiscale@16" COFI~"Ragione sociale@50" RAGSOC~"Codice" CODCF~"Indrizzo@35" INDCF
OUTPUT=@F_CODCF
@ -127,7 +128,7 @@ Y=1
MSKID=F_PAIVA
TYPE=T_STRINGA
PROMPT=""
USE=LF_CLIFO KE 5
USE=LF_CLIFO KE 5~JO LF_COMUNI INTO STATO==STATOCF COM==COMCF
INPUT=TIPOCF F_TIPOCF SELECT~STATOPAIV F_STATOPAIVA~PAIV F_PAIVA
DISPLAY="Partita IVA@12" PAIV~"Ragione sociale@50" RAGSOC~"Codice" CODCF~"Indrizzo@35" INDCF
OUTPUT=@F_CODCF

View File

@ -12,7 +12,8 @@ int main(int argc, char **argv)
case 3 : ve1400(argc, argv); break; //stampa tabelle vendita ed utilita' varie
case 4 : ve1500(argc, argv); break; //stampa di controllo documenti contabilizzati
case 5 : ve1600(argc, argv); break; //stampa di controllo bolle fatturate
default: ve1100(argc, argv); break; //stampa documenti di vendita
case 6 : ve1700(argc, argv); break; //Lista documento con report
default: ve1100(argc, argv); break; //stampa documenti di vendita
}
return 0;
}

View File

@ -7,6 +7,7 @@ int ve1300(int argc, char* argv[]);
int ve1400(int argc, char* argv[]);
int ve1500(int argc, char* argv[]);
int ve1600(int argc, char* argv[]);
int ve1700(int argc, char* argv[]);
#endif // __VE1_H

View File

@ -46,10 +46,14 @@
DOC_TOT_IMPONIBILI \ user defined word in ve1.exe
;
: MESSAGE_TABELLA_IVA ( b1 s1 n1 -- )
DOC_TABELLA_IVA \ user defined word in ve1.exe
;
: MESSAGE_LV_DOT ( s1 -- )
DOC_LV_DOT \ user defined word in ve1.exe
;
: MESSAGE_ADD_ROW ( s1 s2 s3 -- )
DOC_ADD_ROW \ user defined word in ve1.exe
;
;

484
src/ve/ve1700.cpp Normal file
View File

@ -0,0 +1,484 @@
// freeze
// valuta
// output
// librerie
// 99999
//////////////////////////////////////////////////////////////
// Stampa documenti
//////////////////////////////////////////////////////////////
#include <applicat.h>
#include <automask.h>
#include <config.h>
#include <defmask.h>
#include <progind.h>
#include <reprint.h>
#include <sheet.h>
#include <toolfld.h>
#include "velib07.h"
#include "sconti.h"
#include "ve1700.h"
#include <comuni.h>
#include <nditte.h>
//////////////////////////////////////////////////////////////////////////////////////////////
// classe TListaDoc_application customizzata dalla TApplication per l'applicazione principale
//////////////////////////////////////////////////////////////////////////////////////////////
class TStampa_lista_docs_mask : public TAutomask
{
TCursor_sheet _clifo;
protected:
bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TCursor_sheet & clifo() { return _clifo; }
long select_cod_range(long from, long to);
void reset_choices();
void set_choice_limits();
void build_clifo_list();
TStampa_lista_docs_mask();
virtual ~TStampa_lista_docs_mask() {}
};
long TStampa_lista_docs_mask::select_cod_range(long from, long to)
{
TWait_cursor hourglass;
if (from < 0L)
from = _clifo.row(_clifo.selected()).get_long(1);
if (to < 0L)
to = _clifo.row(_clifo.selected()).get_long(1);
else
if (to == 0L)
to = 999999L;
for (int i = 0; i < _clifo.items(); i++)
{
TToken_string& c = _clifo.row(i);
const long cod = c.get_long(1);
if (cod >= from && cod <= to)
_clifo.check(i);
else
_clifo.uncheck(i);
}
set_choice_limits();
return _clifo.checked();
}
void TStampa_lista_docs_mask::set_choice_limits()
{
long first = 999999L, last = -1L;
for (int i = 0; i < _clifo.items(); i++)
{
if (_clifo.checked(i))
{
const long cf = _clifo.row(i).get_long(1);
if (first > cf)
first = cf;
if (last < cf)
last = cf;
}
}
if (first != -1)
set(F_CODFR, first);
if (last != -1)
set(F_CODTO, last);
set(F_SELECTED, _clifo.checked());
}
void TStampa_lista_docs_mask::build_clifo_list()
{
// Semplice ed efficace
TRectype rec(LF_CLIFO);
rec.put(CLI_TIPOCF, get(F_TIPOCF));
_clifo.cursor()->setregion(rec, rec);
}
void TStampa_lista_docs_mask::reset_choices()
{
reset(F_SELECTED);
reset(F_CODFR);
reset(F_CODTO);
_clifo.check(-1, false);
}
bool TStampa_lista_docs_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_TIPOCF:
if (e == fe_modify)
{
TWait_cursor hourglass;
reset_choices();
build_clifo_list();
}
break;
case F_CODFR :
if (e == fe_button)
{
_clifo.disable_check();
_clifo.disable(DLG_USER);
if (_clifo.run() == K_ENTER)
select_cod_range(-1, o.mask().get_long(F_CODTO));
_clifo.enable(DLG_USER);
}
else
if (e == fe_modify)
select_cod_range(o.get_long(), o.mask().get_long(F_CODTO));
break;
case F_CODTO :
if (e == fe_button)
{
_clifo.disable_check();
_clifo.disable(DLG_USER);
if (_clifo.run() == K_ENTER)
select_cod_range(o.mask().get_long(F_CODFR), -1);
_clifo.enable(DLG_USER);
}
else
if (e == fe_modify)
select_cod_range(o.mask().get_long(F_CODFR), o.get_long());
break;
case BUT_SEL:
if (e == fe_button)
{
_clifo.enable_check();
if (_clifo.run() == K_ENTER)
set_choice_limits();
}
break;
case BUT_ANN:
if (e == fe_button)
reset_choices();
break;
case 102:
if (e == fe_button)
{
TSheet_field & s = sfield(F_SHEETNUMS);
TToken_string & row = s.row(s.selected());
TArray_sheet as(-1,-1,70,20,TR("Tipi documento"),HR("Codice|Descrizione@50")); //costruisce uno sheet di selezione dei tipi doc
const TCodice_numerazione& cn = cached_numerazione(row.get(1));
for (int t = cn.ntipi_doc()-1; t >= 0; t--)
{
const TString4 tipodoc = cn.tipo_doc(t);
TToken_string row; //classica token_string con codice e descrizione del tipodoc: questa viene scelta nella tabella
row.add(tipodoc); //dei tipi docs %TIP
row.add(cache().get("%TIP", tipodoc, "S0"));
as.add(row); //..e viene aggiunta allo sheet di selezione
}
if (as.run() != K_ESC)
{
TToken_string& riga = as.row(-1); //setta sul campo a maschera il codice della riga selezionata di as
o.set(riga.get(0));
}
}
else
if (e == fe_close && o.get().full())
{
TSheet_field & s = sfield(F_SHEETNUMS);
TToken_string & row = s.row(s.selected());
const TCodice_numerazione& cn = cached_numerazione(row.get(s.cid2index(101)));
for (int t = cn.ntipi_doc()-1; t >= 0; t--)
{
const TString& tipodoc = cn.tipo_doc(t);
if (tipodoc == o.get())
return true;
}
return o.error_box(FR("Tipo documento non valido per la numerazione %s"), (const char*)cn.codice());
}
break;
default: break;
}
return true;
}
TStampa_lista_docs_mask::TStampa_lista_docs_mask()
: TAutomask("ve1600a"),
_clifo(new TCursor(new TRelation(LF_CLIFO)),
" |CODCF|RAGSOC", TR("Selezione Clienti/Fornitori"),
HR("@1|Codice@6R|Descrizione@50"), 0, 1)
{
((TButton_tool&)field(DLG_PREVIEW)).set_exit_key('A');
}
///////////////////////////////////////////////////////////
// TLista_documenti_recordset
///////////////////////////////////////////////////////////
static void add_term(TString & expr, const char * term1, const char * op, const char * term2,
const bool string = true, const bool and = true, const bool is_string = true)
{
if (expr.full())
expr << (and ? "&&" : "||");
if (is_string)
{
if (!string)
expr << "STR";
}
else
if (string)
expr << "VAL";
expr << '(' << term1 << op << term2 << ')';
}
static void add_expr(TString & expr, const char * subexpr, const bool string = true,
const bool and = true, const bool is_string = true)
{
if (subexpr && *subexpr)
{
if (expr.full())
expr << (and ? "&&" : "||");
if (is_string)
{
if (!string)
expr << "STR";
}
else
if (string)
expr << "VAL";
expr << '(' << subexpr << ')';
}
}
static const char * stringify(TString & s)
{
s.insert("\"");
s << '"';
return s;
}
class TLista_documenti_recordset : public TDocument_recordset
{
TStampa_lista_docs_mask * _m;
static TAssoc_array _clifo_sel; // Assoc array con solo i cli/fo selezionati. Facilita il filter...
protected:
virtual TCursor* cursor() const;
static bool filter_clifo(const TRelation* r);
public:
TLista_documenti_recordset(const char* use, TStampa_lista_docs_mask * m) : TDocument_recordset(use), _m(m) {}
virtual ~TLista_documenti_recordset() { }
};
TAssoc_array TLista_documenti_recordset::_clifo_sel; // Assoc array con solo i cli/fo selezionati. Facilita il filter...
bool TLista_documenti_recordset::filter_clifo(const TRelation* r)
{
const long codcf = r->curr().get_long(CLI_CODCF);
TString8 key; key.format("%06ld", codcf);
return _clifo_sel.is_key(key);
}
TCursor* TLista_documenti_recordset::cursor() const
{
const bool to_create = !valid_cursor();
TCursor * cur = TDocument_recordset::cursor();
if (to_create && cur != NULL)
{
TStampa_lista_docs_mask & m = *_m;
TCursor_sheet & clifo = m.clifo();
cur->setkey(3);
((TLista_documenti_recordset *) this)->set_firmval(m.get_int(F_SELVAL) == 3);
// Compone la lista dei clienti/forntitori selezionati
_clifo_sel.destroy();
TString16 key;
const long items = clifo.items();
for (long i = 0L; i<items; i++)
if (clifo.checked(i))
{
key.format("%06ld", clifo.row(i).get_long(1)); // Formatta il codice
_clifo_sel.add(key, NULL);
}
cur->set_filterfunction(clifo.checked() > 0 ? filter_clifo : NULL);
// NB: se _clifo_sel non contiene nulla, non viene effettuato alcun filter su CLI/FO (non setta la funzione!!)
TString filter(cur->filter());
TString val = m.get(F_TIPOCF);
const int selval = m.get_int(F_SELVAL);
::add_term(filter, DOC_TIPOCF, "==", stringify(val));
val = m.get(F_ANNO);
::add_term(filter, DOC_ANNO, "==", stringify(val));
val = m.get(F_PROVV);
::add_term(filter, DOC_PROVV, "==", stringify(val));
if (selval == 1) //In Lire
{
TString16 firm_val(TCurrency::get_firm_val());
if (firm_val.full())
::add_term(filter, "(" DOC_CODVAL, "==", stringify(firm_val));
::add_term(filter, DOC_CODVAL, "==", "\"\")", true, false);
}
else
if (selval == 2) // nella valuta specificata
{
val = m.get(F_VALUTA);
::add_term(filter, DOC_CODVAL, "==", stringify(val));
}
// Compone l'espressione filter...
// prende tutte le righe dello spreasheet che non sono totalmente vuote:
// (CODNUM=="xxx"&&(STATO=="x"||STATO=="y"||STATO=="z"...)) ---> questo per una singola riga...
// se vi sono piu' righe, lo si ripete aggiungendo prima un bellissimo "||"
TSheet_field& sf = m.sfield(F_SHEETNUMS);
const int rows = sf.items();
TString docfilter;
TString from_num("ZZZZ");
TString to_num;
for (int j=0; j<rows; j++)
{
TToken_string& riga = sf.row(j);
if (riga.empty())
break;
TString16 str(riga.get(0));
TString statofilter;
if (str.full())
{
::add_term(docfilter, DOC_CODNUM, "==", stringify(str));
if (from_num > str)
from_num = str;
if (to_num < str)
to_num = str;
}
str = riga.get();
if (str.full())
::add_term(docfilter, DOC_TIPODOC, "==", stringify(str));
for (int k = 2; k <= 7; k++) // Famme vede' li stati generali... Aho' A BURINO! Che e' la Rivoluzione Francese?
{
TString4 c = riga.get(k);
if (c.full())
::add_term(statofilter, DOC_STATO, "==", stringify(c), true, false);
}
::add_expr(docfilter, statofilter);
}
::add_expr(filter, docfilter);
TRectype from(LF_DOC);
TRectype to(from);
TDate da = m.get_date(F_DA_DATADOC);
TDate a = m.get_date(F_A_DATADOC);
const int anno = m.get_int(F_ANNO);
if (!da.ok())
da = TDate(1, 1, anno);
if (!a.ok())
a = TDate(31, 12, anno);
from.put(DOC_DATADOC, da);
to.put(DOC_DATADOC, a);
val = m.get(F_ANNO);
from.put(DOC_ANNO, val);
to.put(DOC_ANNO, val);
val = m.get(F_PROVV);
from.put(DOC_PROVV, val);
to.put(DOC_PROVV, val);
from.put(DOC_CODNUM, from_num);
to.put(DOC_CODNUM, to_num);
cur->freeze(false);
cur->setregion(from, to);
cur->setfilter(filter);
const TRecnotype it = cur->items();
cur->freeze();
if (it > 0L)
*cur = 0L;
}
return cur;
}
//////////////////////////////////////////////////////////////////////////////////////////////
// classe TListaDoc_application customizzata dalla TApplication per l'applicazione principale
//////////////////////////////////////////////////////////////////////////////////////////////
// Chiavi di ordinamento LF_DOC:
// Chiave 1: ordinamento per Provvisorio + Anno + Codice numerazione + Numero documento
// Chiave 3: ordinamento per Data documento + Provvisorio + Anno + Codice numerazione + Numero documento
class TLista_documenti_report : public TDocument_report
{
/* TString _codnum; // codice di numerazione
char _provv; // stampa documenti provvisiori o definitivi (D o P)
int _anno; // anno della documentazione
int _ncopie; // numero di copie per ogni documento
long _dalnum, _alnum; // estremi di numerazione dei documenti
TDate _dadata, _adata; // estremi di data dei documenti */
TStampa_lista_docs_mask * _m;
protected:
bool set_recordset(const TString& query);
public:
TLista_documenti_report(TStampa_lista_docs_mask * m) : _m(m) {}
};
bool TLista_documenti_report::set_recordset(const TString& query)
{
return TReport::set_recordset(new TLista_documenti_recordset(query, _m));
}
//////////////////////////////////////////////////////////////////////////////////////////////
// classe TListaDoc_application customizzata dalla TApplication per l'applicazione principale
//////////////////////////////////////////////////////////////////////////////////////////////
class TListaDoc_application: public TSkeleton_application
{
protected:
virtual bool create();
virtual void main_loop();
public:
TListaDoc_application() {};
virtual ~TListaDoc_application() {};
};
bool TListaDoc_application::create()
{
return TSkeleton_application::create();
}
void TListaDoc_application::main_loop()
{
TStampa_lista_docs_mask m;
TLista_documenti_report report(&m);
m.set(F_REPORT, "ve16001");
while (m.run() != K_QUIT)
{
TReport_book book;
TFilename report_name = m.get(F_REPORT);
if (report_name.blank())
report_name = "ve16001";
report.load(report_name);
book.add(report);
if (book.pages() > 0)
book.print_or_preview();
m.set(F_REPORT, "ve16001");
}
}
// Do all the work!
int ve1700(int argc, char* argv[])
{
TListaDoc_application a;
a.run(argc, argv, TR("Lista documenti"));
return 0;
}

30
src/ve/ve1700.h Normal file
View File

@ -0,0 +1,30 @@
#define F_CODNUM 121
#define F_ANNO 122
#define F_PROVV 123
#define F_NCOPIE 124
#define F_DATA_O_NUM 125
#define F_DA_NDOC 126
#define F_A_NDOC 127
#define F_DA_DATADOC 128
#define F_A_DATADOC 129
#define F_TIPOST 130
#define F_TIPOCF 110
#define F_CODFR 111
#define F_CODTO 112
#define F_SELECTED 113
#define BUT_SEL 114
#define BUT_ANN 115
#define F_SELVAL 116
#define F_VALUTA 117
#define F_DESCR_CLI 119
#define F_REPORT 130
#define F_SHEETNUMS 201
#define GROUP_PRICES 29
#define GROUP_QTA 30
#define GROUP_IMPORTI 31

178
src/ve/ve17001.rep Normal file
View File

@ -0,0 +1,178 @@
<?xml version="1.0" encoding="UTF-8" ?>
<report libraries="ve1300" name="ve16001" orientation="2" lpi="6" command="ve1 -5" class="ve1600">
<description>Lista documenti</description>
<font face="Courier New" size="8" />
<section type="Head" height="5" pattern="1">
<field x="104" y="3" type="Testo" width="4" pattern="1" text="Val." />
<field x="8" type="Stringa" width="50" id="1" pattern="1">
<font face="Courier New" bold="1" size="8" />
<source>#SYSTEM.RAGSOC</source>
</field>
<field x="136" type="Stringa" width="11" id="2" pattern="1">
<source>#SYSTEM.DATE</source>
</field>
<field x="162" type="Numero" align="right" width="4" id="3" pattern="1">
<source>#PAGE</source>
</field>
<field y="1.25" type="Testo" align="center" width="170" id="4" pattern="1" text="Lista Documenti">
<font face="Courier New" bold="1" size="10" />
</field>
<field border="2" y="2.8" type="Linea" width="170" height="0" id="5" pattern="1">
<prescript description="H0.5 PRESCRIPT">MESSAGE _SEPARATOR,157</prescript>
</field>
<field border="2" y="4.25" type="Linea" width="170" height="0" id="5" pattern="1">
<prescript description="H0.5 PRESCRIPT">MESSAGE _SEPARATOR,157</prescript>
</field>
<field y="3" type="Testo" width="8" id="6" pattern="1" text="Num&#2F;Tipo" />
<field x="18.5" y="3" type="Testo" width="10" id="7" pattern="1" text="Data" />
<field x="10" y="3" type="Testo" width="8" id="8" pattern="1" text="Numero" />
<field x="28.5" y="3" type="Testo" width="3.5" id="9" pattern="1" text="St." />
<field x="32" y="3" type="Testo" width="36" id="11" pattern="1" text="Cliente&#2F;fornitore" />
<field type="Testo" width="8" id="13" pattern="1" text="Ditta:" />
<field x="130" type="Testo" width="6" id="13" pattern="1" text="Data:" />
<field x="156" type="Testo" width="6" id="13" pattern="1" text="Pag." />
<field x="90" y="3" type="Testo" width="6" id="13" pattern="1" text="Agente" />
<field x="98" y="3" type="Testo" width="4" id="14" pattern="1" text="Pag." />
<field x="110.5" y="3" type="Testo" align="right" width="18" id="17" pattern="1" text="Imponibile" />
<field x="130" y="3" type="Testo" align="right" width="4" id="17" pattern="1" text="IVA" />
<field x="135" y="3" type="Testo" align="right" width="16" id="18" pattern="1" text="Imposta" />
<field x="152" y="3" type="Testo" align="right" width="18" id="21" pattern="1" text="Tot. documento">
<font face="Courier New" bold="1" size="8" />
</field>
</section>
<section type="Head" level="1" pattern="1">
<prescript description="H1 PRESCRIPT">MESSAGE RESET,F1</prescript>
</section>
<section type="Body" height="4" pattern="1">
<field type="Immagine" width="1" id="1" pattern="1">
<source>""</source>
</field>
</section>
<section type="Body" level="1" pattern="1">
<field type="Stringa" hidden="1" link="33.CODNUM" width="4" pattern="1">
<source>CODNUM</source>
</field>
<field x="4" type="Numero" hidden="1" link="33.ANNO" width="4" pattern="1">
<source>ANNO</source>
</field>
<field x="8" type="Stringa" hidden="1" link="33.PROVV" width="1" pattern="1">
<source>PROVV</source>
</field>
<field x="30.5" type="Stringa" hidden="1" width="1" pattern="1">
<source>TIPOCF</source>
</field>
<field x="31.5" type="Numero" align="right" link="20.CODCF" width="6" pattern="1">
<source>CODCF</source>
</field>
<field x="90" type="Stringa" align="right" dynamic_height="1" width="6" pattern="1">
<source>CODAG</source>
</field>
<field x="98" type="Stringa" width="5" pattern="1">
<source>CODPAG</source>
</field>
<field x="110.5" type="Valuta" align="right" width="18" codval="CODVAL" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,0,IMP</prescript>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F1.15</postscript>
</field>
<field x="130" type="Stringa" width="4" pattern="1">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,0,COD</prescript>
</field>
<field x="135" type="Valuta" align="right" width="16" codval="CODVAL" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,0,IVA</prescript>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F1.16</postscript>
</field>
<field x="110.5" y="1" type="Valuta" align="right" width="18" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,1,IMP</prescript>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F1.15</postscript>
</field>
<field x="130" y="1" type="Stringa" width="4" pattern="1">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,1,COD</prescript>
</field>
<field x="135" y="1" type="Valuta" align="right" width="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,1,IVA</prescript>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F1.16</postscript>
</field>
<field x="110.5" y="2" type="Valuta" align="right" width="18" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,2,IMP</prescript>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F1.15</postscript>
</field>
<field x="130" y="2" type="Stringa" width="4" pattern="1">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,2,COD</prescript>
</field>
<field x="135" y="2" type="Valuta" align="right" width="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,2,IVA</prescript>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F1.16</postscript>
</field>
<field x="110.5" y="3" type="Valuta" align="right" width="18" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,3,IMP</prescript>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F1.15</postscript>
</field>
<field x="130" y="3" type="Stringa" width="4" pattern="1">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,3,COD</prescript>
</field>
<field x="135" y="3" type="Valuta" align="right" width="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,3,IVA</prescript>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F1.16</postscript>
</field>
<field x="110.5" y="4" type="Valuta" align="right" width="18" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,4,IMP</prescript>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F1.15</postscript>
</field>
<field x="130" y="4" type="Stringa" width="4" pattern="1">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,4,COD</prescript>
</field>
<field x="135" y="4" type="Valuta" align="right" width="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<prescript description="B1.0 PRESCRIPT">MESSAGE _TABELLA_IVA,4,IVA</prescript>
<postscript description="B1.0 POSTSCRIPT">MESSAGE ADD,F1.16</postscript>
</field>
<field type="Stringa" width="9" id="1" pattern="1">
<font face="Courier New" bold="1" size="8" />
<source>CODNUM+"&#2F;"+TIPODOC</source>
</field>
<field x="17.5" type="Data" width="11" id="3" pattern="1">
<source>DATADOC</source>
</field>
<field x="9.5" type="Numero" align="right" link="33.NDOC" width="7" id="4" pattern="1" hide_zero="1">
<source>33.NDOC</source>
</field>
<field x="29.5" type="Stringa" width="1" id="5" pattern="1">
<font italic="1" face="Courier New" size="8" />
<source>STATO</source>
</field>
<field x="38" type="Stringa" width="51" id="7" pattern="1">
<prescript description="B1.7 PRESCRIPT">MESSAGE _CLIENTE,!RAGSOC</prescript>
</field>
<field x="104" type="Stringa" width="5" id="11" pattern="1">
<source>CODVAL</source>
</field>
<field x="152" type="Valuta" align="right" width="18" codval="CODVAL" id="14" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>TOTDOC</source>
<prescript description="B1.14 PRESCRIPT">#THIS @
"F1.17" +!</prescript>
</field>
<field x="172" type="Valuta" hidden="1" align="right" width="18" codval="CODVAL" id="15" pattern="1" hide_zero="1" text="#########,@@">
<prescript description="B1.15 PRESCRIPT">#THIS @
"F1.17" +!</prescript>
</field>
</section>
<section hidden_if_needed="1" type="Foot" height="3" pattern="1" />
<section type="Foot" level="1" height="11" pattern="1">
<field border="2" y="0.5" type="Linea" width="170" height="0" id="5" pattern="1">
<prescript description="F1.5 PRESCRIPT">MESSAGE _SEPARATOR,157</prescript>
</field>
<field x="24" y="1" type="Testo" width="22" id="15" pattern="1" text="TOTALE ">
<font face="Courier New" bold="1" size="10" />
</field>
<field x="110.5" y="1" type="Valuta" align="right" width="18" codval="CODVAL" id="15" pattern="1" hide_zero="1" text="###.###.###,@@">
<font face="Courier New" bold="1" size="10" />
</field>
<field x="135" y="1" type="Valuta" align="right" width="16" id="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<font face="Courier New" bold="1" size="10" />
</field>
<field x="152" y="1" type="Valuta" align="right" width="18" codval="CODVAL" id="17" pattern="1" hide_zero="1" text="###.###.###,@@">
<font face="Courier New" bold="1" size="10" />
</field>
</section>
<sql>USE DOC
</sql>
</report>

254
src/ve/ve17002.rep Normal file
View File

@ -0,0 +1,254 @@
<?xml version="1.0" encoding="UTF-8" ?>
<report libraries="ve1300" name="ve16002" orientation="2" lpi="6" command="ve1 -5" class="ve1600">
<description>Lista documenti con dettaglio</description>
<font face="Courier New" size="8" />
<section type="Head" height="5" pattern="1">
<field x="101.5" y="3" type="Testo" width="4" pattern="1" text="Val." />
<field x="8" type="Stringa" width="50" id="1" pattern="1">
<font face="Courier New" bold="1" size="8" />
<source>#SYSTEM.RAGSOC</source>
</field>
<field x="136" type="Stringa" width="11" id="2" pattern="1">
<source>#SYSTEM.DATE</source>
</field>
<field x="162" type="Numero" align="right" width="4" id="3" pattern="1">
<source>#PAGE</source>
</field>
<field y="1.25" type="Testo" align="center" width="170" id="4" pattern="1" text="Lista Documenti con Dettaglio">
<font face="Courier New" bold="1" size="10" />
</field>
<field border="2" y="2.8" type="Linea" width="107" height="0" id="5" pattern="1">
<prescript description="H0.5 PRESCRIPT">MESSAGE _SEPARATOR,157</prescript>
</field>
<field border="2" y="4.25" type="Linea" width="107" height="0" id="5" pattern="1">
<prescript description="H0.5 PRESCRIPT">MESSAGE _SEPARATOR,157</prescript>
</field>
<field y="3" type="Testo" width="8" id="6" pattern="1" text="Num&#2F;Tipo" />
<field x="18.5" y="3" type="Testo" width="10" id="7" pattern="1" text="Data" />
<field x="10" y="3" type="Testo" width="8" id="8" pattern="1" text="Numero" />
<field x="28.5" y="3" type="Testo" width="3.5" id="9" pattern="1" text="St." />
<field x="34" y="3" type="Testo" width="36" id="11" pattern="1" text="Cliente&#2F;Fornitore - Ragione Sociale" />
<field type="Testo" width="8" id="13" pattern="1" text="Ditta:" />
<field x="130" type="Testo" width="6" id="13" pattern="1" text="Data:" />
<field x="156" type="Testo" width="6" id="13" pattern="1" text="Pag." />
<field x="87" y="3" type="Testo" width="7" id="13" pattern="1" text="Agente" />
<field x="95.5" y="3" type="Testo" width="4" id="14" pattern="1" text="Pag." />
</section>
<section type="Head" level="1" pattern="1">
<prescript description="H1 PRESCRIPT">MESSAGE RESET,F1</prescript>
</section>
<section repeat="1" type="Head" level="2" pattern="1">
<groupby>CODNUM+NDOC</groupby>
<field type="Stringa" hidden="1" link="33.CODNUM" width="4" pattern="1">
<source>CODNUM</source>
</field>
<field x="4" type="Numero" hidden="1" align="right" link="33.ANNO" width="4" pattern="1">
<source>ANNO</source>
</field>
<field x="8" type="Stringa" hidden="1" link="33.PROVV" width="1" pattern="1">
<source>PROVV</source>
</field>
<field x="30.5" type="Stringa" hidden="1" link="20.TIPOCF" width="1" pattern="1">
<source>TIPOCF</source>
</field>
<field type="Rettangolo" bg_color="#E6E6E6" width="108" id="1" pattern="2" />
<field type="Stringa" width="9" id="2" pattern="1">
<font face="Courier New" bold="1" size="8" />
<source>CODNUM+"&#2F;"+TIPODOC</source>
</field>
<field x="17.5" type="Data" width="11" id="3" pattern="1">
<source>DATADOC</source>
</field>
<field x="9.5" type="Numero" align="right" link="33.NDOC" width="7" id="4" pattern="1" hide_zero="1">
<source>33.NDOC</source>
</field>
<field x="29.5" type="Stringa" width="1" id="5" pattern="1">
<font italic="1" face="Courier New" size="8" />
<source>STATO</source>
</field>
<field x="38" type="Stringa" width="51" id="7" pattern="1">
<font face="Courier New" bold="1" size="8" />
<prescript>MESSAGE _CLIENTE,!RAGSOC</prescript>
</field>
<field x="31.5" type="Numero" align="right" link="20.CODCF" width="6" id="10" pattern="1">
<source>CODCF</source>
</field>
<field x="102" type="Stringa" width="5" id="11" pattern="1">
<source>CODVAL</source>
</field>
<field x="89.5" type="Stringa" align="right" width="6" id="14" pattern="1">
<source>CODAG</source>
</field>
<field x="96" type="Stringa" width="5" id="16" pattern="1">
<source>CODPAG</source>
</field>
</section>
<section type="Body" height="4" pattern="1">
<field type="Immagine" width="1" id="1" pattern="1">
<source>""</source>
</field>
</section>
<section type="Body" level="1" pattern="1">
<field type="Stringa" hidden="1" link="33.CODNUM" width="4" pattern="1">
<source>CODNUM</source>
</field>
<field x="4" type="Numero" hidden="1" align="right" link="33.ANNO" width="4" pattern="1">
<source>ANNO</source>
</field>
<field x="8" type="Stringa" hidden="1" link="33.PROVV" width="1" pattern="1">
<source>PROVV</source>
</field>
<field x="30.5" type="Stringa" hidden="1" width="1" pattern="1">
<source>TIPOCF</source>
</field>
<field type="Rettangolo" hidden="1" bg_color="#E6E6E6" width="108" id="1" pattern="2" />
<field type="Stringa" hidden="1" width="9" id="2" pattern="1">
<font face="Courier New" bold="1" size="8" />
<source>CODNUM+"&#2F;"+TIPODOC</source>
</field>
<field x="17.5" type="Data" hidden="1" width="11" id="3" pattern="1">
<source>DATADOC</source>
</field>
<field x="9.5" type="Numero" hidden="1" align="right" link="33.NDOC" width="7" id="4" pattern="1" hide_zero="1">
<source>33.NDOC</source>
</field>
<field x="29.5" type="Stringa" hidden="1" width="1" id="5" pattern="1">
<font italic="1" face="Courier New" size="8" />
<source>STATO</source>
</field>
<field x="38" type="Stringa" hidden="1" width="51" id="7" pattern="1">
<font face="Courier New" bold="1" size="8" />
<prescript description="B1.7 PRESCRIPT">MESSAGE _CLIENTE,!RAGSOC</prescript>
</field>
<field x="31.5" type="Numero" hidden="1" align="right" link="20.CODCF" width="6" id="10" pattern="1">
<source>CODCF</source>
</field>
<field x="102" type="Stringa" hidden="1" width="5" id="11" pattern="1">
<source>CODVAL</source>
</field>
<field x="89.5" type="Stringa" hidden="1" align="right" width="6" id="14" pattern="1">
<source>CODAG</source>
</field>
<field x="96" type="Stringa" hidden="1" width="5" id="16" pattern="1">
<source>CODPAG</source>
</field>
</section>
<section type="Head" level="11" pattern="1">
<prescript description="H11 PRESCRIPT">MESSAGE RESET,F11</prescript>
<field x="4" y="0.5" type="Testo" width="10" pattern="1" text="Codice">
<font italic="1" face="Courier New" size="8" />
</field>
<field x="25" y="0.5" type="Testo" width="35" pattern="1" text="Descrizione">
<font italic="1" face="Courier New" size="8" />
</field>
<field x="76" y="0.5" type="Testo" width="5" pattern="1" text="Um">
<font italic="1" face="Courier New" size="8" />
</field>
<field x="79" y="0.5" type="Testo" align="right" width="15" pattern="1" text="Q.ta">
<font italic="1" face="Courier New" size="8" />
</field>
<field x="95" y="0.5" type="Testo" align="right" width="12" pattern="1" text="Prezzo">
<font italic="1" face="Courier New" size="8" />
</field>
<field x="109" y="0.5" type="Testo" align="right" width="8" pattern="1" text="Sconto">
<font italic="1" face="Courier New" size="8" />
</field>
<field x="115" y="0.5" type="Testo" align="right" width="18" pattern="1" text="Importo Netto">
<font italic="1" face="Courier New" size="8" />
</field>
<field x="136" y="0.5" type="Testo" width="4" pattern="1" text="Iva">
<font italic="1" face="Courier New" size="8" />
</field>
<field x="141" y="0.5" type="Testo" align="right" width="10.5" pattern="1" text="Imposta">
<font italic="1" face="Courier New" size="8" />
</field>
<field x="152" y="0.5" type="Testo" align="right" width="15" pattern="1" text="Importo Lordo">
<font italic="1" face="Courier New" size="8" />
</field>
<field border="2" y="1.5" type="Linea" width="170" height="0" pattern="1" />
</section>
<section type="Body" level="11" pattern="1">
<sql>USE RDOC SELECT TIPORIGA!="05"
FROM CODNUM=#PARENT.CODNUM ANNO=#PARENT.ANNO PROVV=#PARENT.PROVV NDOC=#PARENT.NDOC
TO CODNUM=#PARENT.CODNUM ANNO=#PARENT.ANNO PROVV=#PARENT.PROVV NDOC=#PARENT.NDOC</sql>
<field type="Stringa" hidden="1" width="3" pattern="1">
<source>TIPORIGA</source>
</field>
<field x="4" type="Stringa" width="20" pattern="1">
<source>CODART</source>
</field>
<field x="25" type="Stringa" width="50" pattern="1">
<prescript description="B11.0 PRESCRIPT">MESSAGE _DESCRIGA</prescript>
</field>
<field x="76" type="Stringa" width="2" pattern="1">
<source>UMQTA</source>
</field>
<field x="79" type="Numero" align="right" width="15" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>QTA</source>
</field>
<field x="95" type="Valuta" align="right" width="12" codval="CODVAL" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>PREZZO</source>
</field>
<field x="108" type="Stringa" width="6" pattern="1">
<source>SCONTO</source>
</field>
<field x="115" type="Valuta" align="right" width="18" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>IMPNS</source>
<postscript description="B11.0 POSTSCRIPT">MESSAGE ADD,F11.15</postscript>
</field>
<field x="136" type="Stringa" width="4" pattern="1">
<source>CODIVA</source>
</field>
<field x="141" type="Valuta" align="right" width="10.5" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>IMPOSTA</source>
<postscript description="B11.0 POSTSCRIPT">MESSAGE ADD,F11.16</postscript>
</field>
<field x="152" type="Valuta" align="right" width="15" pattern="1" hide_zero="1" text="###.###.###,@@">
<source>IMPNS+IMPOSTA</source>
<postscript description="B11.0 POSTSCRIPT">MESSAGE ADD,F11.14</postscript>
</field>
</section>
<section type="Foot" level="11" pattern="1">
<field border="2" type="Linea" width="170" height="0" pattern="1" />
<field x="88" y="0.5" type="Testo" width="26.5" pattern="1" text="Totale documento">
<font face="Courier New" bold="1" size="8" />
</field>
<field x="152" y="0.5" type="Valuta" align="right" width="15" id="14" pattern="1" hide_zero="1" text="###.###.###,@@">
<font face="Courier New" bold="1" size="8" />
<postscript description="F11.14 POSTSCRIPT">MESSAGE ADD,F1.14</postscript>
</field>
<field x="169" type="Valuta" hidden="1" align="right" width="18" id="15" pattern="1" hide_zero="1" text="#########,@@">
<prescript>#THIS @
"F1.17" +!</prescript>
</field>
<field x="115" y="0.5" type="Valuta" align="right" width="18" id="15" pattern="1" hide_zero="1" text="###.###.###,@@">
<font face="Courier New" bold="1" size="8" />
<postscript description="F11.15 POSTSCRIPT">MESSAGE ADD,F1.15</postscript>
</field>
<field x="139.5" y="0.5" type="Valuta" align="right" width="12" id="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<font face="Courier New" bold="1" size="8" />
<postscript description="F11.16 POSTSCRIPT">MESSAGE ADD,F1.16</postscript>
</field>
</section>
<section hidden_if_needed="1" type="Foot" height="3" pattern="1" />
<section type="Foot" level="1" height="11" pattern="1">
<field border="2" y="0.5" type="Linea" width="170" height="0" id="5" pattern="1">
<prescript description="F1.5 PRESCRIPT">MESSAGE _SEPARATOR,157</prescript>
</field>
<field x="24" y="1" type="Testo" width="33" id="15" pattern="1" text="TOTALE GENERALE">
<font face="Courier New" bold="1" size="10" />
</field>
<field x="115" y="1" type="Valuta" align="right" width="18" codval="CODVAL" id="15" pattern="1" hide_zero="1" text="###.###.###,@@">
<font face="Courier New" bold="1" size="10" />
</field>
<field x="139.5" y="1" type="Valuta" align="right" width="12" id="16" pattern="1" hide_zero="1" text="###.###.###,@@">
<font face="Courier New" bold="1" size="10" />
</field>
<field x="152" y="1" type="Valuta" align="right" width="15" codval="CODVAL" id="17" pattern="1" hide_zero="1" text="###.###.###,@@">
<font face="Courier New" bold="1" size="10" />
</field>
</section>
<section type="Foot" level="2" pattern="1" />
<sql>USE DOC
</sql>
</report>

233
src/ve/ve1700a.uml Normal file
View File

@ -0,0 +1,233 @@
#include "ve1700.h"
TOOLBAR "topbar" 0 0 0 2
#include <aprintbar.h>
ENDPAGE
PAGE "Lista documenti" -1 -1 60 21
NUMBER F_ANNO 4 0
BEGIN
PROMPT 2 1 "Anno "
FLAG "AP"
CHECKTYPE REQUIRED
END
LIST F_PROVV 12
BEGIN
PROMPT 24 1 "Tipo numerazione "
ITEM "D|Definitiva"
ITEM "P|Provvisoria"
FLAG "P"
END
SPREADSHEET F_SHEETNUMS 78 8
BEGIN
PROMPT 1 2 ""
ITEM "Cod. num."
ITEM "Tipo doc."
ITEM "Stato 1"
ITEM "Stato 2"
ITEM "Stato 3"
ITEM "Stato 4"
ITEM "Stato 5"
ITEM "Stato 6"
END
DATE F_DA_DATADOC
BEGIN
PROMPT 2 11 "Dalla data "
END
DATE F_A_DATADOC
BEGIN
PROMPT 2 12 "Alla data "
END
LIST F_TIPOCF 1 11
BEGIN
PROMPT 25 12 "Tipo "
ITEM "C|Clienti"
ITEM "F|Fornitori"
END
NUMBER F_CODFR 6
BEGIN
PROMPT 25 13 "Da codice "
FLAGS "B"
END
NUMBER F_CODTO 6
BEGIN
PROMPT 25 14 "A codice "
FLAGS "B"
END
STRING F_SELECTED 5
BEGIN
PROMPT 25 15 "Scelte n. "
FLAGS "DR"
END
BUTTON BUT_SEL 10 2
BEGIN
PROMPT 45 13 "~Selezione"
PICTURE BMP_SELECT
END
BUTTON BUT_ANN 10
BEGIN
PROMPT 45 15 "A~zzera"
END
RADIOBUTTON F_SELVAL 20
BEGIN
PROMPT 2 13 "Stampa documenti"
ITEM "1|Valuta ditta"
MESSAGE CLEAR,F_VALUTA
ITEM "2|In valuta"
MESSAGE ENABLE,F_VALUTA
ITEM "3|Tutti"
MESSAGE CLEAR,F_VALUTA
END
STRING F_VALUTA 3
BEGIN
PROMPT 25 16 "Cod. val. "
FLAGS "U"
USE %VAL
INPUT CODTAB F_VALUTA
DISPLAY "Codice" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT F_VALUTA CODTAB
CHECKTYPE REQUIRED
END
STRING F_DESCR_CLI 50 30
BEGIN
PROMPT 2 18 "Ragione sociale "
USE LF_CLIFO KEY 2
INPUT TIPOCF F_TIPOCF SELECT
INPUT RAGSOC F_DESCR_CLI
DISPLAY "Ragione Sociale@50" RAGSOC
DISPLAY "Codice@15" CODCF
OUTPUT F_CODFR CODCF
OUTPUT F_CODTO CODCF
END
STRING F_REPORT 50
BEGIN
PROMPT 2 -3 "Report "
RSELECT "ve1600"
CHECKTYPE NORMAL
END
STRING DLG_PROFILE 50
BEGIN
PROMPT 2 -2 "Profilo "
PSELECT
END
ENDPAGE
ENDMASK
PAGE "" -1 -1 75 10
STRING 101 4
BEGIN
PROMPT 1 1 "Codice numerazione "
FLAGS "U"
USE %NUM
INPUT CODTAB 101
DISPLAY "Cod. Num." CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT 101 CODTAB
CHECKTYPE NORMAL
END
STRING 102 4
BEGIN
PROMPT 1 2 "Tipo documento "
FLAGS "UB"
END
STRING 103 1
BEGIN
PROMPT 1 3 "Stato 1 "
USE %STD
INPUT CODTAB 103
DISPLAY "Stato" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT 103 CODTAB
CHECKTYPE NORMAL
END
STRING 104 1
BEGIN
PROMPT 1 4 "Stato 2 "
USE %STD
INPUT CODTAB 104
DISPLAY "Stato" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT 104 CODTAB
CHECKTYPE NORMAL
END
STRING 105 1
BEGIN
PROMPT 1 5 "Stato 3 "
USE %STD
INPUT CODTAB 105
DISPLAY "Stato" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT 105 CODTAB
CHECKTYPE NORMAL
END
STRING 106 1
BEGIN
PROMPT 1 6 "Stato 4 "
USE %STD
INPUT CODTAB 106
DISPLAY "Stato" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT 106 CODTAB
CHECKTYPE NORMAL
END
STRING 107 1
BEGIN
PROMPT 1 7 "Stato 5 "
USE %STD
INPUT CODTAB 107
DISPLAY "Stato" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT 107 CODTAB
CHECKTYPE NORMAL
END
STRING 108 1
BEGIN
PROMPT 1 8 "Stato 6 "
USE %STD
INPUT CODTAB 108
DISPLAY "Stato" CODTAB
DISPLAY "Descrizione@50" S0
OUTPUT 108 CODTAB
CHECKTYPE NORMAL
END
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -1 ""
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -1 ""
END
ENDPAGE
ENDMASK

View File

@ -922,18 +922,18 @@ bool TMask_anamag::handle_anno(TMask_field &fld, KEY k)
if (original_row == row)
{
mag.zero();
TString16 codmag = original_row.get(fld_giac.cid2index(F_CODMAG));
codmag.rpad(3);
codmag << original_row.get(fld_giac.cid2index(F_CODDEP));
TString16 codmag = original_row.get(fld_giac.cid2index(F_CODMAG));
codmag.rpad(3);
codmag << original_row.get(fld_giac.cid2index(F_CODDEP));
mag.put(MAG_CODMAG, codmag);
mag.put(MAG_CODART, mask.get(F_CODART));
TString livello = original_row.get(fld_giac.cid2index(F_LIV1));
livello << original_row.get(fld_giac.cid2index(F_LIV2));
livello << original_row.get(fld_giac.cid2index(F_LIV3));
livello << original_row.get(fld_giac.cid2index(F_LIV4));
TString livello = original_row.get(fld_giac.cid2index(F_LIV1));
livello << original_row.get(fld_giac.cid2index(F_LIV2));
livello << original_row.get(fld_giac.cid2index(F_LIV3));
livello << original_row.get(fld_giac.cid2index(F_LIV4));
mag.put(MAG_LIVELLO, livello);
mag.put(MAG_ANNOES, annoes);
@ -2151,18 +2151,18 @@ int TAnagrafica_magazzino::rewrite(const TMask& m)
{
mag.zero();
mag.put(MAG_ANNOES, annoes);
TString16 codmag = original_row.get(fld_giac.cid2index(F_CODMAG));
codmag.rpad(3);
codmag << original_row.get(fld_giac.cid2index(F_CODDEP));
TString16 codmag = original_row.get(fld_giac.cid2index(F_CODMAG));
codmag.rpad(3);
codmag << original_row.get(fld_giac.cid2index(F_CODDEP));
mag.put(MAG_CODMAG, codmag);
mag.put(MAG_CODART, m.get(F_CODART));
TString livello = original_row.get(fld_giac.cid2index(F_LIV1));
livello << original_row.get(fld_giac.cid2index(F_LIV2));
livello << original_row.get(fld_giac.cid2index(F_LIV3));
livello << original_row.get(fld_giac.cid2index(F_LIV4));
TString livello = original_row.get(fld_giac.cid2index(F_LIV1));
livello << original_row.get(fld_giac.cid2index(F_LIV2));
livello << original_row.get(fld_giac.cid2index(F_LIV3));
livello << original_row.get(fld_giac.cid2index(F_LIV4));
mag.put(MAG_LIVELLO, livello);
if (mag.read(_isequal) == NOERR)

View File

@ -107,6 +107,7 @@ void TCodart_mask::start_run()
}
_restart.cut(0);
enable(101, !spegni101);
enable(201, !spegni101);
}
TAutomask::start_run();
}

View File

@ -21,7 +21,8 @@ int main( int argc, char** argv )
case 7: ve6700(argc, argv); break; // copia documenti interattiva da ditta a ditta
case 8: ve6800(argc, argv); break; // contabilizzazione analitica documenti
case 9: ve6900(argc, argv); break; // controllo ordini evasi
case 10: ve61000(argc, argv); break; // Eliminazione documenti
case 10: ve6a00(argc, argv); break; // generazione regolarizzazioni
case 11: ve6b00(argc, argv); break; // Eliminazione documenti
default: ve6100(argc, argv); break; // contabilizzazione documenti
}
return 0;

View File

@ -10,6 +10,7 @@ int ve6600 (int, char**);
int ve6700 (int, char**);
int ve6800 (int, char**);
int ve6900 (int, char**);
int ve61000 (int, char**);
int ve6a00 (int, char**);
int ve6b00 (int, char**);
#endif

View File

@ -68,6 +68,7 @@ END
BOOLEAN F_DATA_AUTO
BEGIN
PROMPT 40 3 "Data registrazione automatica"
MESSAGE FALSE ENABLE,F_DATA_REG
MESSAGE TRUE CLEAR,F_DATA_REG|"",F_DATA_REG
END

137
src/ve/ve6a00.cpp Normal file
View File

@ -0,0 +1,137 @@
#include "velib.h"
#include "ve6700a.h"
#include <applicat.h>
#include <automask.h>
#include <config.h>
#include <defmask.h>
#include <execp.h>
#include <incstr.h>
#include <golem.h>
#include <prefix.h>
#include <clifo.h>
#include <doc.h>
#include <rdoc.h>
#include "ve6700a.h"
#include "velib04.h"
#include "../mg/mglib.h"
///////////////////////////////////////////////////////////
// Applicazione principale
///////////////////////////////////////////////////////////
class TCreazione_regolarizzazione : public TSkeleton_application
{
public:
bool load();
virtual void main_loop();
};
bool TCreazione_regolarizzazione::load()
{
bool ok = false;
if (argc() > 2)
{
const TString& arg = argv(2);
if ((arg[0] != '-' && arg[0] != '/') || (arg[1] != 'i' && arg[1] != 'I'))
return false;
TFilename ini_name(arg.mid(2));
if (ini_name.blank() && argc() > 3)
ini_name = argv(3);
if (ini_name.exist())
{
TConfig ini(ini_name, "33");
char provv = ini.get_char(DOC_PROVV);
const int anno = ini.get_int(DOC_ANNO);
TString16 codnum(ini.get(DOC_CODNUM));
long numdoc = ini.get_long(DOC_NDOC);
TDocumento indoc;
bool ok = numdoc > 0 && indoc.read(provv, anno, codnum, numdoc) == NOERR;
if (ok)
{
const TElaborazione_esterna ee(ini.get("Action", "Transaction"));
provv = 'D';
codnum = ee.codice_numerazione_finale();
numdoc = indoc.get_long("NUMDOCREG");
TDocumento outdoc;
const long codcli = indoc.clifor().get_long(CLI_CODCFASS);
ok = codcli > 0L;
if (!ok)
return message_box("Cliente corrispondente assente");
if (ok && (numdoc == 0 || outdoc.read(provv, anno, codnum, numdoc) != NOERR))
{
outdoc.zero();
TDocumento::set_key(outdoc, provv, anno, codnum, 0L);
outdoc.renum_ndoc();
outdoc.set_tipo(ee.tipo_finale());
outdoc.stato(ee.stato_finale()[0]);
outdoc.put(DOC_DATADOC, indoc.get_date(DOC_DATADOC));
outdoc.put(DOC_TIPOCF, "C");
outdoc.put(DOC_CODCF, codcli);
outdoc.cli2doc();
}
outdoc.put(DOC_DATADOCRIF, indoc.get_date(DOC_DATADOCRIF));
outdoc.put(DOC_NUMDOCRIF, indoc.get(DOC_NUMDOCRIF));
outdoc.destroy_rows();
TAssoc_array & iva = indoc.tabella_iva(); // no reference
// Scorre tutti gli elementi della tabella IVA del documento (elementi per codice iva)
for (const TRiepilogo_iva* riep = (const TRiepilogo_iva*) iva.first_item();
riep != NULL; riep = (const TRiepilogo_iva*) iva.succ_item())
{
TRiga_documento & row = outdoc.new_row("01");
row.put(RDOC_DESCR, "Regolarizzazione");
row.put(RDOC_QTA, UNO);
row.put(RDOC_PREZZO, riep->imponibile());
row.put(RDOC_CODIVA, riep->cod_iva().codice());
}
int err = outdoc.rewrite();
ok = err == NOERR;
if (!ok)
return error_box(FR("Errore %d di riscrittura del documento destinazione"), err);
// qui outdoc.do_elab();
err = outdoc.rewrite();
ok = err == NOERR;
if (!ok)
return error_box(FR("Errore %d di riscrittura del documento destinazione"), err);
ini.set("Result", "OUTDOC");
indoc.put("NUMDOCREG", outdoc.numero());
indoc.stato(ee.stato_finale_doc_iniziale()[0]);
err = indoc.rewrite();
ok = err == NOERR;
if (!ok)
return error_box(FR("Errore %d di riscrittura del documento sorgente"), err);
}
}
}
return ok;
}
void TCreazione_regolarizzazione::main_loop()
{
open_files(LF_TAB, LF_TABCOM, LF_DOC, LF_RIGHEDOC, LF_MOVMAG, NULL);
open_files(LF_ANAMAG, LF_CLIFO, LF_CFVEN, LF_OCCAS, LF_RMOVMAG, NULL);
load();
}
int ve6a00(int argc, char** argv)
{
TCreazione_regolarizzazione app;
app.run(argc, argv, TR("Generazione regolarizzazione"));
return 0;
}

View File

@ -1,5 +1,5 @@
/**************************************************
* File: ve61000.cpp *
* File: ve600.cpp *
* Programma per il controllo degli ordini evasi *
* Authors: Alessandro Bonazzi, Mattia Tollari *
**************************************************/
@ -14,7 +14,7 @@
#include "velib04.h"
#include "../cg/cgsaldac.h"
#include "ve61000a.h"
#include "ve6b00a.h"
///////////////////////////////////////////////
@ -154,7 +154,7 @@ void TEliminazione_documenti_app::main_loop()
check();
}
int ve61000 (int argc, char **argv)
int ve6b00 (int argc, char **argv)
{
TEliminazione_documenti_app a;
a.run(argc,argv, TR("Elimiazione documenti"));

View File

@ -1,4 +1,4 @@
// Include file per ve61000a.uml
// Include file per ve6b00a.uml
#define F_PROVV 101
#define F_DA_ANNO 102

View File

@ -1,4 +1,4 @@
#include "ve61000a.h"
#include "ve6b00a.h"
PAGE "Eliminazione documenti" -1 -1 50 5

View File

@ -9,6 +9,7 @@
#define T_ZOOM 9
#define T_GOLEM 10
#define T_CURRENCY 11
#define T_SHEET 12
#define S_NASCOSTO 0
#define S_NON_VISIBILE 1

View File

@ -118,6 +118,9 @@ class TDocumento_variable_field : public TVariable_field
class TSpesa_prest : public TRectype // velib01
{
protected:
const TString & cod() const { return get("COD"); }
public:
TObject* dup() const { return new TSpesa_prest(codice()); }
@ -140,8 +143,8 @@ public:
char tipo_ritenuta() const { return get_char("S9"); }
const TString& tipo_riga() const { return get("S8"); }
char genere() const;
const TString& conto_analitico_vendite() const { return get("S1").left(20); }
const TString& conto_analitico_acquisti() const { return get("S2"); }
const TString& conto_analitico_vendite() const { return ((cod() == "ATR") || (cod() == "RSS")) ? EMPTY_STRING : get("S1").left(20); }
const TString& conto_analitico_acquisti() const { return ((cod() == "ATR") || (cod() == "RSS")) ? get("S1").left(20) : get("S2"); }
const TString& cdc() const { return get("S1").mid(20, 20); }
const TString& cms() const { return get("S1").mid(40, 20); }
const TString& fase() const { return get("S1").mid(60); }
@ -1074,10 +1077,13 @@ public:
TCodgiac_livelli& livelli() const { return *_livelli_giac; }
static bool anno_handler( TMask_field& f, KEY key);
static bool num_handler( TMask_field& f, KEY key );
static bool tipo_handler( TMask_field& f, KEY key );
static bool numdocrif_search_handler( TMask_field& f, KEY key );
//static bool ragsoc_search_handler( TMask_field& f, KEY key );
static bool ragsoc_search_handler( TMask_field& f, KEY key );
static bool rif_search_handler( TMask_field& f, KEY key );
static bool datadocrif_handler(TMask_field& f, KEY key);
static bool liqdiff_handler( TMask_field& f, KEY key );
static bool sheet_handler(TMask_field& f, KEY key);
static bool liqdiff_handler( TMask_field& f, KEY key );
virtual void highlight_row(int row, COLOR back = COLOR_INVALID, COLOR fore = COLOR_INVALID, bool dirty = true, bool update = true);

File diff suppressed because it is too large Load Diff

View File

@ -170,6 +170,9 @@ const TString& TTipo_documento::riferimento(const TDocumento & doc, TString& rif
TString val;
switch (field.file())
{
case LF_DOC:
val = field.read(doc);
break;
case LF_CLIFO:
case LF_CFVEN:
if (doc.get_long(DOC_CODCF) > 0)

View File

@ -435,6 +435,8 @@ bool TMovimentoPN_VE::movement_ok()
int TMovimentoPN_VE::recalc_cg_rows(const TString& descr_cr, TCausale& caus)
{
if (caus.soloiva())
return 0;
const int righe_IVA = iva_items();
const TRectype& head = curr();
@ -1536,20 +1538,6 @@ error_type TContabilizzazione::compile_head_mov_re(TDocumento& doc)
// calcola il numero documento aggiungendo l'eventuale prefisso/postfisso.
TString numdoc;
cod_num.complete_num(doc.numero(), numdoc);
if (acquisto)
{
const TString& numdocrif = doc.get(DOC_NUMDOCRIF);
if (numdocrif.full())
numdoc = numdocrif;
}
if (numdoc.empty() || !cod_num.ok())
{
_error = nr_doc_error;
return _error;
}
numdoc.upper(); // Il numero documento e' uppercase!
// Istanzia la causale del documento corrente...
_caus = get_caus(doc, data_reg.year());
@ -1561,6 +1549,20 @@ error_type TContabilizzazione::compile_head_mov_re(TDocumento& doc)
_righe_iva->set_caus(_caus);
_movimento->set_caus(_caus);
if (acquisto || _caus->soloiva())
{
TString16 numdocrif(doc.get(DOC_NUMDOCRIF));
if (numdocrif.not_empty())
numdoc = numdocrif;
}
if (numdoc.empty() || !cod_num.ok())
{
_error = nr_doc_error;
return _error;
}
numdoc.upper(); // Il numero documento e' uppercase!
// per reperire il tipo documento ed il tipo movimento
// reperisce la descrizione dal tipo documento e la completa con la data documento ed il
// numero documento
@ -1576,7 +1578,7 @@ error_type TContabilizzazione::compile_head_mov_re(TDocumento& doc)
}
const TString16 rif = doc.get(DOC_NUMDOCRIF);
const bool use_rif = _caus->iva() == iva_acquisti && rif.full();
const bool use_rif = (_caus->soloiva() || _caus->iva() == iva_acquisti) && rif.not_empty();
if (use_rif)
{
descr << "n. " << rif;
@ -2146,7 +2148,7 @@ error_type TContabilizzazione::adjust_iva_rows(TDocumento& doc)
inc_field(rigaiva, RMI_IMPOSTA, diffimp);
}
}
if (_caus->intra())
if (_caus->intra() || _caus->reverse_charge())
{
real ritfis;
for (int i = 0; i < items; i++)
@ -2230,6 +2232,8 @@ error_type TContabilizzazione::create_iva_rows(TDocumento& doc)
error_type TContabilizzazione::create_total_doc_row(TDocumento& doc)
// Crea la riga contabile di totale documento
{
if (_caus->soloiva())
return no_error;
TRectype& rec_cg = _movimento->cg(0);
TRectype& head = _movimento->curr();
const int annoes = head.get_int(MOV_ANNOES);
@ -3183,31 +3187,36 @@ error_type TContabilizzazione::write_all(TDocumento& doc, TMovimentoPN_VE & movi
return generic_error;
}
// Aggiorno subito i saldi
aggiorna_saldi(saldo, movimento, true);
const bool has_sc = sc_enabled(head.get_date(MOV_DATAREG));
if (has_sc)
write_scadenze(doc, numreg == old_numreg); // Recontabilizing?
if (good() && in_enabled())
write_intra(doc);
if (good() && (ca_config().get_int("Authorizations") & 0x5)) // No CI qui
write_anal(doc, movimento);
const int tipocoll = _caus->link_m770();
const bool do_770 = tipocoll == 1 || tipocoll == 5 || tipocoll == 6;
if (good() && dongle().active(M77AUT) && do_770)
write_percip(doc, movimento);
// nella 3.1 testava solo l'importo, ma nella 10.0 testava anche has_sc, dal 2/9/2014 si torna al vecchio modo
if (!doc.get_real(DOC_IMPPAGATO).is_zero())
if (_caus->soloiva())
movimento.destroy_cg_row(-1);
else
{
if (write_anticipo(doc, movimento) != no_error)
movimento.remove(); // Se si è verificato un errore nella scrittura dell'anticipo rimuove il movimento di prima nota
}
aggiorna_saldi(saldo, movimento, true);
const bool has_sc = sc_enabled(head.get_date(MOV_DATAREG));
if (has_sc)
write_scadenze(doc, numreg == old_numreg); // Recontabilizing?
if (good() && in_enabled())
write_intra(doc);
if (good() && (ca_config().get_int("Authorizations") & 0x5)) // No CI qui
write_anal(doc, movimento);
const int tipocoll = _caus->link_m770();
const bool do_770 = tipocoll == 1 || tipocoll == 5 || tipocoll == 6;
if (good() && dongle().active(M77AUT) && do_770)
write_percip(doc, movimento);
// nella 3.1 testava solo l'importo, ma nella 10.0 testava anche has_sc, dal 2/9/2014 si torna al vecchio modo
if (!doc.get_real(DOC_IMPPAGATO).is_zero())
{
if (write_anticipo(doc, movimento) != no_error)
movimento.remove(); // Se si è verificato un errore nella scrittura dell'anticipo rimuove il movimento di prima nota
}
}
if (good())
{
_total_docs++;

View File

@ -1,4 +1,5 @@
#include <progind.h>
#include <utility.h>
#include "velib04.h"
#include "../cg/cgsaldac.h"
@ -502,6 +503,12 @@ long TGenerazione_effetti::group_bills(TAssoc_array& group_array, bool interatti
riga.put(REFF_IMPFATT,totale_fatt.get_num());
riga.put(REFF_IMPORTO,imprata);
riga.put(REFF_ANNO, annodocrif);
const TString4 npart_type = ini_get_string(CONFIG_DITTA, "cg", "RifPro");
if (npart_type == "M" && effetto.get(EFF_TIPOCF) == "C")
riga.put(REFF_NUMPART, format("%02d", datafatt.month()));
else
riga.put(REFF_NUMPART, numdocrif);
if (valuta)
{
@ -553,7 +560,8 @@ void TGenerazione_effetti::calc_pagamento(TDocumento& doc)
const TCurrency_documento totspese(doc.spese(), doc);
const TCurrency_documento totimposte(doc.imposta(TRUE), doc);
const TCurrency_documento totimponibili(tot_doc - totimposte - totspese);
TCurrency_documento anticipo(doc.get_real(DOC_IMPPAGATO), doc);
const bool is_anticipo = doc.clifor().vendite().get(CFV_CODCAUSINC).full() || doc.tipo().caus_anticipo().full();
TCurrency_documento anticipo(is_anticipo ? doc.get_real(DOC_IMPPAGATO) : ZERO, doc);
const bool valuta = doc.in_valuta();
//Riaggiusta le rate a seconda del valore gia' pagato
@ -628,7 +636,8 @@ void TGenerazione_effetti::generate_bill(TDocumento& doc, bool interattivo) // b
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
const bool anticipo = doc.clifor().vendite().get(CFV_CODCAUSINC).full() || doc.tipo().caus_anticipo().full();
const TCurrency_documento imppagato(anticipo ? doc.get_real(DOC_IMPPAGATO) : ZERO, doc); // Anticipo pagamento
if (totale_fatt > imppagato && !doc.get_bool(DOC_ACCSALDO)) // procede se non e' a saldo
{
const bool is_anticipo = imppagato.get_num() != ZERO;
@ -650,7 +659,7 @@ void TGenerazione_effetti::generate_bill(TDocumento& doc, bool interattivo) // b
const long codcf = doc.get_long(DOC_CODCF);
const TString4 codval(doc.get(DOC_CODVAL));
const TDate data_cambio = doc.get_date(DOC_DATACAMBIO);
//const bool contro_euro = doc.get_bool(DOC_CONTROEURO);
const bool contro_euro = doc.get_bool(DOC_CONTROEURO);
const long codabi = doc.get_long(DOC_CODABIA);
const long codcab = doc.get_long(DOC_CODCABA);
const TString80 iban = doc.get(DOC_IBAN);
@ -674,7 +683,6 @@ void TGenerazione_effetti::generate_bill(TDocumento& doc, bool interattivo) // b
effetto.put(EFF_DATASCAD, pag.data_rata(i));
effetto.put(EFF_TIPOPAG,pag.tipo_rata(i));
effetto.put(EFF_ULTCLASS,pag.ulc_rata(i));
effetto.put(EFF_MANDATO,doc.get(DOC_MANDATO));
effetto.put(EFF_TIPOCF, tipocf);
effetto.put(EFF_CODCF, codcf);
effetto.put(EFF_CODVAL, codval);
@ -706,7 +714,21 @@ void TGenerazione_effetti::generate_bill(TDocumento& doc, bool interattivo) // b
reffetto.put(REFF_ANNO, doc.get_date(DOC_DATADOCRIF).year());
reffetto.put(REFF_NUMPART, doc.get(DOC_NUMDOCRIF));
}
else
{
const TString4 npart_type = ini_get_string(CONFIG_DITTA, "cg", "RifPro");
if (npart_type == "M" && effetto.get(EFF_TIPOCF) == "C")
{
reffetto.put(REFF_ANNO, datafatt.year());
reffetto.put(REFF_NUMPART, format("%02d", datafatt.month()));
}
else
{
reffetto.put(REFF_ANNO, doc.get_date(DOC_DATADOCRIF).year());
reffetto.put(REFF_NUMPART, doc.get(DOC_NUMDOCRIF));
}
}
importo = pag.importo_rata(i,FALSE);
effetto.put(EFF_IMPORTO,importo);
reffetto.put(REFF_IMPFATT,totale_fatt.get_num());

View File

@ -702,7 +702,8 @@ bool TConsegna_ordini::elabora(TLista_documenti& doc_in, TLista_documenti& doc_o
{
int j = outdoc.physical_rows();
if (raggruppa_per_riferimento())
const bool ordina_per_doc = ini_get_bool(CONFIG_DITTA, "ve", "ORDINA_PER_DOC", true);
if (ordina_per_doc || raggruppa_per_riferimento())
{
TToken_string key = inrec.get_rdoc_key();

View File

@ -400,7 +400,7 @@ bool TContabilizzazione_analitica::find_conti(const TRiga_documento& riga, TStri
}
else
{
if (!search_costo_ricavo(riga, bill, riclassifica_fdr_fde))
if (_usepdcc && !search_costo_ricavo(riga, bill, riclassifica_fdr_fde))
return true;
if (bill.ok() && !bill.is_analitico())
{
@ -816,7 +816,7 @@ bool TContabilizzazione_analitica::elabora(TDocumento& doc, long numreg_cg, TVis
}
}
if (!amount_to_split.is_zero())
if (amount_to_split != ZERO)
split_sp_amount(mov, has_pareggio, totdoc, spese, amount_to_split, no_ca_amount, doc.decimals());
if (can_write && mov.rows() > 0)

View File

@ -168,7 +168,8 @@ void TDocumentoEsteso::scadenze_recalc()
TPagamento& pag = pagamento();
real totspese = spese();
real totimposte = imposta(TRUE);
real pagato = hh.get_real(DOC_IMPPAGATO);
const bool anticipo = clifor().vendite().get(CFV_CODCAUSINC).full() || tipo().caus_anticipo().full();
real pagato = anticipo ? hh.get_real(DOC_IMPPAGATO) : ZERO;
const bool saldo = hh.get_bool(DOC_ACCSALDO);
real totimponibili = totale_doc() - ritenute() - totimposte - totspese;
const bool is_in_valuta = in_valuta();

View File

@ -155,7 +155,7 @@ TDocumento_mask::TDocumento_mask(const char* td)
set_field_handler( F_NUMDOCRIF, datadocrif_handler);
set_field_handler( F_DATADOCRIF, datadocrif_handler);
set_field_handler( F_LIQDIFF, liqdiff_handler);
set_field_handler( F_SHEET, sheet_handler);
set_handler( DLG_ELABORA, elabora_handler );
set_handler( DLG_PRINT, print_handler );
set_handler( DLG_PREVIEW, print_handler );
@ -566,6 +566,8 @@ void TDocumento_mask::insert_anal_page()
add_number(DLG_NULL, newpage, TR("Cliente "), 2, 4, 6, "D").set_group(10);
add_string(DLG_NULL, newpage, "", 24, 4, 50, "D").set_group(11);
add_groupbox(DLG_NULL, newpage, TR("Contabilita' Analitica"), 1, 6, 78, 14);
const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI);
const bool use_fsc = fasinfo.levels() > 0;
TConfig& ini = ca_config();
@ -1429,7 +1431,7 @@ void TDocumento_mask::spese2mask()
void TDocumento_mask::reset_masks(const TString& tipo_doc)
{
static TString4 last_tipo_doc;
static TString16 last_tipo_doc;
if (tipo_doc != last_tipo_doc)
{
@ -1814,7 +1816,8 @@ void TDocumento_mask::update_giacenza()
break;
}
TString8 causmag = row.get(sf.cid2index(FR_CAUS));
TString16 causmag = row.get(sf.cid2index(FR_CAUS));
if (causmag.blank())
causmag = get(F_CAUSMAG);
@ -1908,7 +1911,9 @@ bool TDocumento_mask::ss_handler(TMask_field& f, KEY key)
const TSheet_field& ss = (TSheet_field&)f;
TDocumento_mask& mask = (TDocumento_mask&)ss.mask();
const short cme = mask.cms_end();
if (!app().is_transaction() && ss.empty())
ok = yesno_box(TR("Il documento e' privo di righe:\n"));
const short cme = mask.cms_end();
// Se la commessa in testata è vuota controllo che sia presente sulle righe
if (cme > 0 && mask.efield(cme).empty())
{
@ -2086,10 +2091,16 @@ bool TDocumento_mask::ss_notify( TSheet_field& ss, int r, KEY key )
riga_mask.enable(DLG_USER, on);
}
const bool merce = TRiga_documento::tipo(riga_mask.get(FR_TIPORIGA)).is_merce();
const bool artmag = merce && riga_mask.get(FR_CODARTMAG).full();
riga_mask.show(FR_UMQTA, artmag);
riga_mask.show(FR_UMQTA2, !artmag);
if (merce)
{
const bool artmag = riga_mask.get(FR_CODARTMAG).full();
riga_mask.show(FR_UMQTA, artmag);
riga_mask.show(FR_UMQTA2, !artmag);
}
else
riga_mask.show(FR_UMQTA);
if (rdoc.get(RDOC_CODART).empty() && rdoc.get(RDOC_DESCR).empty())
{
@ -3426,7 +3437,7 @@ bool TElabora_mask::elabora()
return false ;
char provv = get(F_PROVV_ELAB)[0];
int anno = get_int(F_ANNO_ELAB);
const TString4 codnum = get(F_CODNUM_ELAB);
TString16 codnum(get(F_CODNUM_ELAB));
long ndoc = get_long(F_NDOC_ELAB);
if (ndoc > 0L && !in.find(provv, anno, codnum, ndoc))
@ -3868,27 +3879,33 @@ void TDocumento_mask::set_field_handler(short fieldid, CONTROL_HANDLER handler)
void TDocumento_mask::user_set_handler(short fieldid, int index)
{
switch (index)
switch( index )
{
case 1: set_field_handler(fieldid, ora_hndl); break;
case 2: set_field_handler(fieldid, totdoc_hndl); break;
case 3: set_field_handler(fieldid, numdocrif_hndl); break;
case 4:
/* Cassato il macchinaro!
_smartcard = new TSmart_card();
if (_smartcard->type() != no_smartcard)
{
set_field_handler(fieldid, smart_hndl);
set_handler(fieldid, universal_handler);
}
else
{
disable(fieldid);
delete _smartcard;
_smartcard = NULL;
}
*/
case 1:
set_field_handler(fieldid, ora_hndl);
break;
case 2:
set_field_handler(fieldid, totdoc_hndl);
break;
case 3:
set_field_handler(fieldid, numdocrif_hndl);
break;
/* case 4:
{
_smartcard = new TSmart_card();
if (_smartcard->type() != no_smartcard)
{
set_field_handler(fieldid, smart_hndl);
set_handler(fieldid, universal_handler);
}
else
{
disable(fieldid);
delete _smartcard;
_smartcard = NULL;
}
}
break; */
case 5: set_field_handler(fieldid, dummy_hndl); break;
case 6: set_field_handler(fieldid, fido_hndl); break;
case 7: set_field_handler(fieldid, subappalto_hndl); break;
@ -4010,6 +4027,19 @@ bool TDocumento_mask::num_handler( TMask_field& f, KEY key)
return TRUE;
}
bool TDocumento_mask::tipo_handler( TMask_field& f, KEY key)
{
if (f.to_check(key, true))
{
const TTipo_documento & t = cached_tipodoc(f.get());
if (t.tipocf() == 'F')
f.mask().set(F_TIPOCF, "F");
else
f.mask().set(F_TIPOCF, "C");
}
return true;
}
bool TDocumento_mask::codlist_handler( TMask_field& f, KEY key )
{
if (key == K_TAB && f.focusdirty())
@ -4177,7 +4207,7 @@ void TDocumento_mask::update_father_rows(bool add)
if (r.is_merce() || r.is_omaggio()|| r.is_prestazione())
{
const TRectype* original_row = r.find_original_rdoc();
TRiga_documento * original_row = (TRiga_documento *) r.find_original_rdoc();
if (original_row != NULL && _auto_reopen_nums.objptr(original_row->get(RDOC_CODNUM)) != NULL)
{
@ -4207,7 +4237,7 @@ void TDocumento_mask::update_father_rows(bool add)
*qta += value;
else
*qta -= value;
if (qta->is_zero())
if (*qta == ZERO)
_father_rows.remove(key);
}
}

View File

@ -98,6 +98,59 @@ bool totdoc_hndl( TMask_field& field, KEY key )
return true;
}
/*bool smart_hndl( TMask_field& field, KEY key )
{
if (key == K_SPACE)
{
TDocumento_mask & m = (TDocumento_mask &) field.mask();
TSmart_card * s = m.smartcard();
if (s != NULL)
{
smartcard_error err = s->connect_card();
if (err == no_smarterror)
err = s->check_key(m);
if (err == no_smarterror)
{
s->card2mask(m);
if (s->with_card(m))
m.enable(DLG_SAVEREC);
m.disable(F_CODCF);
m.disable(F_RAGSOC);
}
else
{
s->display_error(err);
if (err == new_card)
if (m.get(F_CODCF).empty() && m.field(F_CODCF).on_key(K_F9) == false)
{
s->disconnect_card();
return false;
}
}
}
}
else
if (key == K_ENTER)
{
TDocumento_mask & m = (TDocumento_mask &) field.mask();
TSmart_card * s = m.smartcard();
if (s != NULL && s->card_connected())
{
s->mask2card(m);
smartcard_error err = s->write();
if (err != no_smarterror)
s->display_error(err);
if (m.insert_mode() && m.doc().codice_numerazione().save_and_new())
s->disconnect_card();
}
}
return true;
} */
bool fido_hndl(TMask_field& field, KEY key)
{
if (key == K_ENTER && !field.empty())
@ -2391,27 +2444,39 @@ bool sppr_handler( TMask_field& f, KEY key )
{
const TRectype& curr = ((TEdit_field&)f).browse()->cursor()->curr();
const TSpesa_prest sp(curr);
const TDocumento_mask& mask = (const TDocumento_mask&)row_mask.get_sheet()->mask();
TSheet_field & s = mask.sfield(F_SHEET);
const int pos = row_mask.id2pos(FR_PREZZO);
if (pos >= 0 && !sp.empty())
{
const char tipo = sp.tipo();
const bool qta_val_fl = tipo == 'Q';
const bool qta_val_fl = (tipo == 'Q') || (tipo <= ' ');
const bool perc_fl = tipo == 'P';
int pos = row_mask.id2pos(FR_UMQTASP);
if (pos >= 0)
{
row_mask.fld(pos).show(!perc_fl);
row_mask.fld(pos).enable(!perc_fl);
s.enable_cell(s.selected(), s.cid2index(FR_UMQTASP), !perc_fl);
}
pos = row_mask.id2pos(FR_PREZZO);
if (pos >= 0)
{
row_mask.fld(pos).enable(!perc_fl);
s.enable_cell(s.selected(), s.cid2index(FR_SCONTO), !perc_fl);
}
pos = row_mask.id2pos(FR_SCONTO);
if (pos >= 0)
row_mask.fld(pos).enable(!perc_fl);
pos = row_mask.id2pos(FR_QTA);
{
row_mask.fld(pos).enable(!perc_fl);
s.enable_cell(s.selected(), s.cid2index(FR_SCONTO), !perc_fl);
}
pos = row_mask.id2pos(FR_QTA);
if (pos >= 0)
{
row_mask.fld(pos).show(!perc_fl);
row_mask.fld(pos).show(qta_val_fl);
row_mask.fld(pos).enable(qta_val_fl);
}
pos = row_mask.id2pos(FR_PERCSP);
@ -2420,9 +2485,14 @@ bool sppr_handler( TMask_field& f, KEY key )
row_mask.fld(pos).show(perc_fl);
row_mask.fld(pos).enable(perc_fl);
}
s.enable_cell(s.selected(), s.cid2index(FR_QTA), perc_fl || qta_val_fl);
if (!perc_fl)
{
const TDocumento_mask& mask = (const TDocumento_mask&)row_mask.get_sheet()->mask();
TSheet_field & s = mask.sfield(F_SHEET);
s.enable_cell(s.selected(), s.cid2index(FR_QTA), qta_val_fl);
const real cambio = mask.get_real(F_CAMBIO);
real prezzo = sp.prezzo();
const TString& doc_valuta = mask.get(F_CODVAL);
@ -2557,7 +2627,6 @@ bool TDocumento_mask::numdocrif_search_handler(TMask_field& f, KEY key)
return true;
}
/*
bool TDocumento_mask::ragsoc_search_handler(TMask_field& f, KEY key)
{
if (key == K_F9)
@ -2566,6 +2635,7 @@ bool TDocumento_mask::ragsoc_search_handler(TMask_field& f, KEY key)
TRelation rel(LF_DOC);
rel.add(LF_CLIFO, "TIPOCF==TIPOCF|CODCF==CODCF");
rel.add(LF_COMUNI, "STATO==STATOCF|COM==COMCF", 1 , LF_CLIFO);
TRectype& filtrec = rel.curr();
filtrec.put(DOC_PROVV, m.get(F_PROVV));
@ -2604,7 +2674,54 @@ bool TDocumento_mask::ragsoc_search_handler(TMask_field& f, KEY key)
}
return true;
}
*/
bool TDocumento_mask::rif_search_handler(TMask_field& f, KEY key)
{
if (key == K_F9)
{
TMask& m = f.mask();
TRelation rel(LF_DOC);
rel.add(LF_CLIFO, "TIPOCF==TIPOCF|CODCF==CODCF");
rel.add(LF_COMUNI, "STATO==STATOCF|COM==COMCF", 1 , LF_CLIFO);
TRectype& filtrec = rel.curr();
filtrec.put(DOC_PROVV, m.get(F_PROVV));
filtrec.put(DOC_ANNO, m.get(F_ANNO));
filtrec.put(DOC_CODNUM, m.get(F_CODNUM));
TSorted_cursor cur(&rel, "TIPOCF|UPPER(20->RICALT)|PROVV|ANNO|CODNUM|PROVV|NDOC", "", 1, &filtrec, &filtrec);
TString filter; filter.format("(CODNUM==\"%s\")&&(PROVV==\"D\")&&(TIPOCF==\"%s\")",
(const char*)m.get(F_CODNUM), (const char*)m.get(F_TIPOCF));
cur.setfilter(filter, true);
TToken_string siblings;
TToken_string header(HR("Ric.Altern.@15|Ragione Sociale@50|Codice|Documento|Data\nDocumento@10|Totale\nDocumento@18V|Valuta|Stato|Partita IVA|Indirizzo@50|Numero@15|Località@50|Comune@50"));
TToken_string fieldlist("20->RICALT|20->RAGSOC|CODCF|NDOC|DATADOC|G1:TOTDOC|CODVAL|STATO|20->PAIV|20->INDCF|20->CIVCF|20->LOCALITACF|13->DENCOM");
add_custom_search_fields(m, fieldlist, header);
TBrowse_sheet sheet(&cur, fieldlist, TR("Ricerca Alternativa"),
header, 0, (TEdit_field&)f, siblings);
if (!f.empty())
{
TString rif(f.get()); rif.upper();
filtrec.zero();
filtrec.put(DOC_TIPOCF, m.get(F_TIPOCF));
rel.curr(LF_CLIFO).put(CLI_RICALT, rif);
cur.read();
}
if (sheet.run() == K_ENTER)
{
const int pos_ndoc = fieldlist.get_pos(DOC_NDOC);
const long ndoc = sheet.row(-1).get_long(pos_ndoc);
m.set(F_NDOC, ndoc);
m.stop_run(K_AUTO_ENTER);
}
}
return true;
}
bool TDocumento_mask::datadocrif_handler(TMask_field& f, KEY key)
{
@ -2622,6 +2739,40 @@ bool TDocumento_mask::datadocrif_handler(TMask_field& f, KEY key)
return true;
}
bool TDocumento_mask::sheet_handler(TMask_field& f, KEY key)
{
if (key == K_CTRL + 'V')
{
TDocumento_mask& m = (TDocumento_mask&)f.mask();
TDocumento & doc = m.doc();
TSheet_field & s = m.sfield(F_SHEET);
int from, to, offset;
if (!s.get_range_selection(from, to))
{
from = 0;
to = s.items() - 1;
}
offset = to - from;
from = s.selected() + 1;
if (from <= 0)
from = 1;
else
if(from > doc.physical_rows())
from = doc.physical_rows() + 1;
to = from + offset;
for (int i = from; i <= to ; i++)
if (i > doc.physical_rows())
doc.new_row(s.row(i - 1).get(s.cid2index(FR_TIPORIGA)));
else
doc.insert_row(i, s.row(i).get(s.cid2index(FR_TIPORIGA)));
for (int i = from; i <= to ; i++)
doc[i].autosave(s);
}
return true;
}
bool TDocumento_mask::liqdiff_handler( TMask_field& f, KEY key )
{
if (key == K_ENTER && f.get().full())

View File

@ -266,6 +266,12 @@ TObject* TDocument_cache::key2obj(const char* key)
return doc;
}
void TDocument_cache::set_firmval(bool firmval)
{
_firmval = firmval;
destroy();
}
TDocumento& TDocument_cache::doc(const TRectype& rec)
{
TToken_string key;
@ -278,7 +284,7 @@ TDocumento& TDocument_cache::doc(const TRectype& rec)
}
TDocument_cache:: TDocument_cache() : TCache(3)
TDocument_cache:: TDocument_cache(bool firmval) : TCache(3), _firmval(firmval)
{
}
@ -441,6 +447,107 @@ void TDocument_report::reset_values(const TString& output)
}
}
bool TDocument_report::msg_cliente(TVariant_stack& stack)
{
TReport_field& cf = *curr_field();
const int idx =((TISAM_recordset *)recordset())->cursor()->relation()->log2ind(LF_DOC);
if (idx < 0)
return false;
const TRectype& rec = ((TISAM_recordset*)recordset())->cursor()->relation()->file(idx).curr();
TDocumento & doc = (TDocumento &)((TDocument_recordset*)recordset())->doc(rec);
const TCli_for& cli_for = doc.clifor();
const TOccasionale& cli_occ = doc.occas();
const bool occasionale = cli_for.occasionale();
TString in = stack.pop().as_string(); // prende la macro o il fieldref
TString valore;
if (in[0] != '!')
{
// Controlla l'esistenza dei campi...
if (occasionale && cli_occ.exist(in))
valore = cli_occ.get(in);
if (!occasionale && cli_for.exist(in))
valore = cli_for.get(in);
cf.set(valore);
return true;
}
in.ltrim(1);
if (in=="INDNUM")
{
valore = occasionale ? cli_occ.get(OCC_INDIR) : cli_for.get(CLI_INDCF);
valore << ' ';
valore << (occasionale ? cli_occ.get(OCC_CIV) : cli_for.get(CLI_CIVCF));
cf.set(valore);
return true;
}
if (in.find("COM") == 0)
{
const bool nascita = in[3] == 'N';
const int p = in.find("->");
if (p > 0)
in.ltrim(p + 2);
TString8 key;
if (nascita)
{
key = occasionale ? cli_occ.get(OCC_STATONASC) : cli_for.get(CLI_STATONASC);
key << '|' << (occasionale ? cli_occ.get(OCC_COMNASC) : cli_for.get(CLI_COMNASC));
}
else
{
key = occasionale ? cli_occ.get(OCC_STATO): cli_for.get(CLI_STATOCF);
key << '|' << (occasionale ? cli_occ.get(OCC_COM): cli_for.get(CLI_COMCF));
}
valore = cache().get(LF_COMUNI, key, in);
cf.set(valore);
return true;
}
if (in.find("CAP") == 0)
{
valore = occasionale ? cli_occ.get(OCC_CAP) : cli_for.get(CLI_CAPCF);
cf.set(valore);
return true;
}
if (in.find("TEL") == 0)
{
if (!occasionale)
{
if (in.len() == 3)
in << "1";
const TString num(cli_for.get(in));
in.insert("P");
valore = cli_for.get(in);
valore << "/" << num;
}
cf.set(valore);
return true;
}
if (in=="FAX")
{
if (!occasionale)
{
valore = cli_for.get("PFAX");
valore << "/" << cli_for.get("FAX");
}
cf.set(valore);
return true;
}
if (in=="RAGSOC")
{
valore = occasionale ? cli_occ.get(in) : cli_for.get(in);
valore.strip_double_spaces();
cf.set(valore);
return true;
}
return false;
}
bool TDocument_report::msg_parent_doc(TVariant_stack& stack)
{
TReport_field& cf = *curr_field();
@ -567,11 +674,61 @@ bool TDocument_report::msg_parent_row(TVariant_stack& stack)
return true;
}
bool TDocument_report::msg_riepilogo_iva(TVariant_stack& stack)
{
// tabella riepilogo aliquote iva e relative imposte
// sintassi: _RIEPILOGOIVA,<indice>,<macro>
// dove: <indice> parte da zero se ' e minore di zero vengono scritti tutti
// dove: <macro> è uno dei seguenti:
// COD colonna dei codici
// IMP colonna degli imponibili
// IVA colonna delle imposte
// ALI colonna delle aliquote
// DES colonna delle descrizioni (stampata solo se il regime IVA non e' normale)
int index = stack.pop().as_int();
const int idx =((TISAM_recordset *)recordset())->cursor()->relation()->log2ind(LF_DOC);
if (idx < 0)
return false;
const TRectype& rec = ((TISAM_recordset*)recordset())->cursor()->relation()->file(idx).curr();
TDocumento & doc = (TDocumento &)((TDocument_recordset*)recordset())->doc(rec);
TAssoc_array & IVA = doc.tabella_iva(); // serve per aggiornare la tebella
TRiepilogo_iva * r = (TRiepilogo_iva *) doc.riepilogo_iva(index);
TString value;
if (r != NULL)
{
const TString& what = stack.pop().as_string(); // cosa deve stampare ?
if (what == "COD") // Ritorna il codice IVA
value = r->cod_iva().codice();
else
if (what == "IMP") // Ritorna l'imponibile
value = r->imp().string();
else
if (what == "IVA") // Ritorna l'imposta
value = r->iva().string();
else
if (what == "ALI") // Ritorna l'aliquota %
value << r->cod_iva().percentuale().string();
else
if (what == "DES" && r->cod_iva().tipo().not_empty())
value == r->cod_iva().descrizione();
}
const bool full = value.full();
curr_field()->show(full);
curr_field()->set(TVariant(full ? value : ""));
return true;
}
size_t TDocument_report::get_usr_words(TString_array& words) const
{
TReport::get_usr_words(words);
const char* const name[] = { "DOC_PARENT_DOC", "DOC_PARENT_ROW", NULL };
const char* const name[] = { "DOC_CLIENTE", "DOC_PARENT_DOC", "DOC_PARENT_ROW",
"DOC_TABELLA_IVA", NULL};
((TDocument_report*)this)->_first_msg = words.items(); // Calcola il primo numero disponibile
for (size_t i = 0; name[i] != NULL; i++)
@ -587,9 +744,11 @@ bool TDocument_report::execute_usr_word(unsigned int opcode, TVariant_stack& sta
opcode -= _first_msg;
switch (opcode)
{
case 0 : msg_parent_doc(stack); break;
case 1 : msg_parent_row(stack); break;
default: break;
case 0: msg_cliente(stack); break;
case 1: msg_parent_doc(stack); break;
case 2: msg_parent_row(stack); break;
case 3: msg_riepilogo_iva(stack); break;
default: break;
}
while (!stack.pop().is_null()); // Svuota eventuali parametri variabili inutilizzati
@ -618,6 +777,8 @@ static const TString_array& mastro(char tipocf)
const int conto = mastri.get(PCN_CONTO).as_int();
const int indbil = mastri.get(PCN_INDBIL).as_int();
const char tipocf = mastri.get(PCN_TMCF).as_string()[0];
if (tipocf > ' ')
{
TToken_string info;
info.add(gruppo);
info.add(conto);
@ -625,10 +786,11 @@ static const TString_array& mastro(char tipocf)
m[tipocf == 'C' ? 0 : 1].add(info);
}
}
}
return a;
}
static real calcola_saldo_contabile(const long codcf, const TDate& datacalc)
static real calcola_saldo_contabile(const char tipocf, const long codcf, const TDate& datacalc)
{
real saldone;
@ -644,7 +806,7 @@ static real calcola_saldo_contabile(const long codcf, const TDate& datacalc)
datainies.set_month(1);
}
const TString_array& a = mastro('C');
const TString_array& a = mastro(tipocf);
//per tutti i mastri selezionati va a calcolare il saldo del cliente/fornitore in input
FOR_EACH_ARRAY_ROW(a, i, row)
@ -669,18 +831,18 @@ static TImporto get_importo(const TISAM_recordset& partite, const char* sezione,
}
static real calcola_esposto_da_saldaconto (long codcf, const TDate& datacalc)
static real calcola_esposto_da_saldaconto (const char tipocf, const long codcf, const TDate& datacalc, const int riskdays)
{
const int riskdays = ini_get_int(CONFIG_DITTA, "ve", "FIDO_RISKDAYS");
//estrae le righe partita relative a pagamenti successivi alla data di rischio (e con tipopag >2,<7)
TString query;
query << "USE PART\nSELECT BETWEEN(DATAPAG,#DATASBF,0)&&BETWEEN(TIPOPAG,2,7)\n";
query << "FROM TIPOC=C GRUPPO=0 CONTO=0 SOTTOCONTO=#CODCF ANNO=#ANNO\n";
query << "TO TIPOC=C GRUPPO=0 CONTO=0 SOTTOCONTO=#CODCF";
query << "FROM TIPOC=#TIPOCF GRUPPO=0 CONTO=0 SOTTOCONTO=#CODCF ANNO=#ANNO\n";
query << "TO TIPOC=#TIPOCF GRUPPO=0 CONTO=0 SOTTOCONTO=#CODCF";
TISAM_recordset partite(query);
TString4 str_tipocf = tipocf;
partite.set_var("#TIPOCF", TVariant(str_tipocf));
partite.set_var("#CODCF", codcf);
partite.set_var("#DATACALC", datacalc);
//data considerante i giorni di rischio ammessi dall'utonto
@ -719,8 +881,8 @@ static real calcola_esposto_da_saldaconto (long codcf, const TDate& datacalc)
}
//la normalizzazione del totale delle partite va fatta in base al fatto che si parli di 'C'liente o 'F'ornitore
//const char sezione_finale = (tipocf == 'C') ? 'A' : 'D';
importone_esposto.normalize('A');
const char sezione_finale = (tipocf == 'C') ? 'A' : 'D';
importone_esposto.normalize(sezione_finale);
//valore in output
real esposto;
@ -730,40 +892,42 @@ static real calcola_esposto_da_saldaconto (long codcf, const TDate& datacalc)
}
static real calcola_fido_da_documenti(long codcf, const TDate& datacalc, const TDoc_key& ignore)
static real calcola_fido_da_documenti(const char tipocf, const long codcf, const TDate& datacalc, const TDoc_key& ignore)
{
real totalone;
// scansione delle righe FIDO_XX(j)=.. sul paragrafo di configurazione VE
// per avere i parametri di numerazione/tipo da considerare
TConfig config(CONFIG_DITTA, "ve");
for (int j = 0; ;j++)
//scansione delle righe FIDO_XX(j)=.. sul paragrafo di configurazione VE per avere i parametri di numerazione/tipo..
//..da considerare
for (int j = 0;;j++)
{
const TString& num_fido = config.get("FIDO_NUM", NULL, j);
//se manca la numerazione si può fermare,in quanto non può esistere un tipo senza numerazione
if (num_fido.blank())
break;
const TString& tipo_fido = config.get("FIDO_TIP", NULL, j);
const TString& da_stato_fido = config.get("FIDO_DASTA", NULL, j);
const TString& a_stato_fido = config.get("FIDO_ASTA", NULL, j);
const bool residuo_fido = config.get_bool("FIDO_RES", NULL, j);
const TString& tipo_fido = config.get("FIDO_TIP", NULL, j);
const TString4 da_stato_fido = config.get("FIDO_DASTA", NULL, j);
const TString4 a_stato_fido = config.get("FIDO_ASTA", NULL, j);
const bool residuo_fido = config.get_bool("FIDO_RES", NULL, j);
//per la numerazione scelta queryzza gli archivi alla ricerca dei documenti che rientrano nei parametri
TString query;
query << "USE DOC KEY 2\n";
query << "SELECT (CODNUM=#CODNUM)&&(TIPODOC=#TIPODOC)&&(BETWEEN(STATO,#DASTATO,#ASTATO))\n";
query << "FROM TIPOCF=C CODCF=#CODCF PROVV='D'\n";
query << "TO TIPOCF=C CODCF=#CODCF PROVV='D' ANNO=#ANNO DATADOC=#DATACALC";
query << "FROM TIPOCF=#TIPOCF CODCF=#CODCF PROVV='D'\n";
query << "TO TIPOCF=#TIPOCF CODCF=#CODCF PROVV='D' ANNO=#ANNO DATADOC=#DATACALC";
TISAM_recordset documenti(query);
documenti.set_var("#CODCF", codcf);
documenti.set_var("#ANNO", (long)datacalc.year());
const char str_tipocf[2] = { tipocf, 0 };
documenti.set_var("#TIPOCF", TVariant(str_tipocf));
documenti.set_var("#CODCF", codcf);
documenti.set_var("#ANNO", TVariant((long)datacalc.year()));
documenti.set_var("#DATACALC", datacalc);
documenti.set_var("#CODNUM", num_fido);
documenti.set_var("#TIPODOC", tipo_fido);
documenti.set_var("#DASTATO", da_stato_fido);
documenti.set_var("#ASTATO", a_stato_fido);
documenti.set_var("#CODNUM", TVariant(num_fido));
documenti.set_var("#TIPODOC", TVariant(tipo_fido));
documenti.set_var("#DASTATO", TVariant(da_stato_fido));
documenti.set_var("#ASTATO", TVariant(a_stato_fido));
const int items = documenti.items();
if (items > 0)
@ -808,11 +972,11 @@ static real calcola_fido_da_documenti(long codcf, const TDate& datacalc, const T
real calcola_fido_cliente (long codcf, const TDate& datacalc, const TDoc_key& ignore)
{
//PRIMA PARTE: controlla i movimenti
real saldo_contabile = calcola_saldo_contabile(codcf, datacalc);
real saldo_contabile = calcola_saldo_contabile('C', codcf, datacalc);
//SECONDA PARTE: controlla il saldaconto
real esposto_saldaconto = calcola_esposto_da_saldaconto(codcf, datacalc);
real esposto_saldaconto = calcola_esposto_da_saldaconto('C', codcf, datacalc, 10); // 10 giorni ?
//TERZA PARTE: controlla i documenti
real tot_documenti = calcola_fido_da_documenti(codcf, datacalc, ignore);
real tot_documenti = calcola_fido_da_documenti('C',codcf, datacalc, ignore);
return saldo_contabile + esposto_saldaconto + tot_documenti;
}

View File

@ -67,13 +67,16 @@ public:
class TDocument_cache : TCache
{
bool _firmval;
protected:
virtual TObject* key2obj(const char* key);
public:
void set_firmval(bool firmval = true);
TDocumento& doc(const TRectype& rec);
TDocument_cache();
TDocument_cache(bool firmval = false);
virtual ~TDocument_cache();
};
@ -90,6 +93,7 @@ protected:
virtual const TVariant& get_field(int num, const char* field) const;
public:
void set_firmval(bool firmval = true) { _cache.set_firmval(firmval);}
const TDocumento& doc(const TRectype& rec) { return _cache.doc(rec);}
TDocument_recordset(const char* use) : TISAM_recordset(use) { }
@ -108,8 +112,11 @@ class TDocument_report : public TReport
protected:
virtual size_t get_usr_words(TString_array& words) const;
virtual bool execute_usr_word(unsigned int opcode, TVariant_stack& stack);
bool msg_cliente(TVariant_stack& stack);
bool msg_parent_doc(TVariant_stack& stack);
bool msg_parent_row(TVariant_stack& stack);
bool msg_riepilogo_iva(TVariant_stack& stack);
void output_values(const TRectype& rec, const TString& output);
void reset_values(const TString& output);

View File

@ -11,6 +11,9 @@ DEFINE_FIELD(DESCRSPV)
DEFINE_FIELD(UMQTASP)
DEFINE_FIELD(VALORE)
DEFINE_FIELD(QTA)
DEFINE_FIELD(QTAEVASA)
DEFINE_FIELD(RIGAEVASA)
DEFINE_FIELD(DATACONS)
DEFINE_FIELD(SCONTO)
F_POS(SCONTO, 2, 11,"Sconto " )
DEFINE_FIELD(CODIVA)

View File

@ -10,6 +10,9 @@ DEFINE_FIELD(DESCRSPQ)
DEFINE_FIELD(UMQTASP)
DEFINE_FIELD(QTA)
DEFINE_FIELD(PREZZO)
DEFINE_FIELD(QTAEVASA)
DEFINE_FIELD(RIGAEVASA)
DEFINE_FIELD(DATACONS)
DEFINE_FIELD(SCONTO)
F_POS(SCONTO, 2, 11,"Sconto " )
DEFINE_FIELD(CODIVA)

View File

@ -104,6 +104,7 @@
#define F_CODDITTA 209
#define F_RAGSOCDITTA 210
#define F_LIQDIFF 211
#define F_RIFSEARCH 212
#define F_CODNUMRIF 212
#define F_ANNORIF 213