Quasi finita la fatturazione bolle!
git-svn-id: svn://10.65.10.50/trunk@3395 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
c96384c878
commit
ef4eb3bc6a
22
ve/batbeld.h
22
ve/batbeld.h
@ -24,3 +24,25 @@
|
|||||||
#define F_DOC5 155
|
#define F_DOC5 155
|
||||||
#define F_ATTIVA_PROVVISORIO 160
|
#define F_ATTIVA_PROVVISORIO 160
|
||||||
#define F_PROVVISORIO 161
|
#define F_PROVVISORIO 161
|
||||||
|
|
||||||
|
#define F_CAMBIO 201
|
||||||
|
#define F_SCONTO 202
|
||||||
|
#define F_TIPODOC 203
|
||||||
|
#define F_CODNUM 204
|
||||||
|
#define F_CONDPAG 205
|
||||||
|
#define F_BANCA 206
|
||||||
|
#define F_LISTINO 207
|
||||||
|
#define F_AGENTE 208
|
||||||
|
#define F_SPEDIZIONE 209
|
||||||
|
#define F_PORTO 210
|
||||||
|
#define F_TRASPORTO 211
|
||||||
|
#define F_VETTORI 212
|
||||||
|
|
||||||
|
#define F_SOMMA_RIGHE 301
|
||||||
|
#define F_MAGAZZINO 310
|
||||||
|
#define F_IVA 311
|
||||||
|
#define F_PREZZO 312
|
||||||
|
#define F_RIFERIMENTI 320
|
||||||
|
#define F_RIFERIMENTI_IN_TESTA 321
|
||||||
|
#define F_IGNORA_DESCRIZIONI 330
|
||||||
|
|
||||||
|
170
ve/batbeld.uml
170
ve/batbeld.uml
@ -30,26 +30,27 @@ END
|
|||||||
|
|
||||||
STRING F_DESCR 50
|
STRING F_DESCR 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 3 "Descrizione "
|
PROMPT 2 3 "Descrizione "
|
||||||
FIELD S0
|
FIELD S0
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
WARNING "E' necessario specificare un valore"
|
WARNING "E' necessario specificare un valore"
|
||||||
USE %ELD KEY 2
|
USE %ELD KEY 2
|
||||||
INPUT S0 F_DESCR
|
INPUT S0 F_DESCR
|
||||||
DISPLAY "Descrizione@50" S0
|
DISPLAY "Descrizione@50" S0
|
||||||
DISPLAY "Codice" CODTAB
|
DISPLAY "Codice" CODTAB
|
||||||
COPY OUTPUT F_CODICE
|
COPY OUTPUT F_CODICE
|
||||||
KEY 2
|
KEY 2
|
||||||
END
|
END
|
||||||
|
|
||||||
LIST F_TIPO 50
|
LIST F_TIPO 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 4 "Tipo "
|
PROMPT 2 4 "Tipo "
|
||||||
ITEM " |Altro"
|
ITEM " |Altro"
|
||||||
ITEM "CO|Consegna Ordini"
|
ITEM "CO|Consegna Ordini"
|
||||||
ITEM "FB|Fatturazione bolle"
|
ITEM "FB|Fatturazione bolle"
|
||||||
ITEM "SM|Scarico magazzino"
|
ITEM "SM|Scarico magazzino"
|
||||||
ITEM "TC|Trasferimento a contabilita'"
|
ITEM "TC|Trasferimento a contabilita'"
|
||||||
|
FIELD S3
|
||||||
END
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 78 6
|
GROUPBOX DLG_NULL 78 6
|
||||||
@ -278,11 +279,142 @@ END
|
|||||||
RADIOBUTTON F_PROVVISORIO 20
|
RADIOBUTTON F_PROVVISORIO 20
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 42 13 "Tipo numerazione"
|
PROMPT 42 13 "Tipo numerazione"
|
||||||
ITEM "D|Definitiva"
|
ITEM " |Definitiva"
|
||||||
ITEM "P|Provvisioria"
|
ITEM "X|Provvisioria"
|
||||||
FIELD S3
|
FIELD B4
|
||||||
END
|
END
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
|
PAGE "Parametri per raggruppamenti" -1 -1 78 20
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 75 8
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 "Condizioni per raggruppamento documenti"
|
||||||
|
FLAG "R"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_CAMBIO
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 2 "Cambio"
|
||||||
|
FIELD S1[1,1]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_SCONTO
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 3 "Sconto"
|
||||||
|
FIELD S1[2,2]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_TIPODOC
|
||||||
|
BEGIN
|
||||||
|
PROMP 2 4 "Tipo documento"
|
||||||
|
FIELD S1[3,3]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_CODNUM
|
||||||
|
BEGIN
|
||||||
|
PROMP 2 5 "Codice numerazione"
|
||||||
|
FIELD S1[4,4]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_SPEDIZIONE
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 6 "Modalita' di spedizione"
|
||||||
|
FIELD S1[9,9]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_PORTO
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 7 "Porto"
|
||||||
|
FIELD S1[10,10]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_CONDPAG
|
||||||
|
BEGIN
|
||||||
|
PROMP 40 2 "Condizione di pagamento"
|
||||||
|
FIELD S1[5,5]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_BANCA
|
||||||
|
BEGIN
|
||||||
|
PROMPT 40 3 "Banca di appoggio"
|
||||||
|
FIELD S1[6,6]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_LISTINO
|
||||||
|
BEGIN
|
||||||
|
PROMPT 40 4 "Listino"
|
||||||
|
FIELD S1[7,7]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_AGENTE
|
||||||
|
BEGIN
|
||||||
|
PROMP 40 5 "Agente"
|
||||||
|
FIELD S1[8,8]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_TRASPORTO
|
||||||
|
BEGIN
|
||||||
|
PROMPT 40 6 "Causale di trasporto"
|
||||||
|
FIELD S1[11,11]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_VETTORI
|
||||||
|
BEGIN
|
||||||
|
PROMPT 40 7 "Vettori"
|
||||||
|
FIELD S1[12,12]
|
||||||
|
END
|
||||||
|
|
||||||
|
GROUPBOX DLG_NULL 75 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 10 "Modalita' di raggruppamento delle righe"
|
||||||
|
FLAG "R"
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_SOMMA_RIGHE
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 11 "Somma righe simili"
|
||||||
|
MESSAGE FALSE ENABLE,F_RIFERIMENTI_IN_TESTA
|
||||||
|
MESSAGE TRUE DISABLE,F_RIFERIMENTI_IN_TESTA|"X",F_RIFERIMENTI_IN_TESTA
|
||||||
|
FIELD B0
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_MAGAZZINO
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 12 "Magazzino"
|
||||||
|
FIELD S1[40,40]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_IVA
|
||||||
|
BEGIN
|
||||||
|
PROMPT 28 12 "Codice IVA"
|
||||||
|
FIELD S1[41,41]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_PREZZO
|
||||||
|
BEGIN
|
||||||
|
PROMPT 56 12 "Prezzo e Sconto"
|
||||||
|
FIELD S1[42,42]
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_RIFERIMENTI
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 14 "Gestione riferimenti"
|
||||||
|
FIELD B1
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_RIFERIMENTI_IN_TESTA
|
||||||
|
BEGIN
|
||||||
|
PROMPT 40 14 "Tutti i riferimenti in testa"
|
||||||
|
FIELD B2
|
||||||
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_IGNORA_DESCRIZIONI
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 15 "Ignora righe con la sola descrizione"
|
||||||
|
FIELD B3
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
@ -93,9 +93,10 @@ PAGE "Tipi documento validi" -1 -1 60 14
|
|||||||
STRING F_TIPODOC1 4
|
STRING F_TIPODOC1 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 4 ""
|
PROMPT 2 4 ""
|
||||||
USE %TIP
|
FLAGS "U"
|
||||||
INPUT CODTAB F_TIPODOC1
|
USE %TIP
|
||||||
DISPLAY "Codice" CODTAB
|
INPUT CODTAB F_TIPODOC1
|
||||||
|
DISPLAY "Codice" CODTAB
|
||||||
DISPLAY "Descrizione@50" S0
|
DISPLAY "Descrizione@50" S0
|
||||||
OUTPUT F_TIPODOC1 CODTAB
|
OUTPUT F_TIPODOC1 CODTAB
|
||||||
OUTPUT F_DESDOC1 S0
|
OUTPUT F_DESDOC1 S0
|
||||||
@ -113,9 +114,10 @@ PAGE "Tipi documento validi" -1 -1 60 14
|
|||||||
STRING F_TIPODOC2 4
|
STRING F_TIPODOC2 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 6 ""
|
PROMPT 2 6 ""
|
||||||
USE %TIP
|
FLAGS "U"
|
||||||
INPUT CODTAB F_TIPODOC2
|
USE %TIP
|
||||||
DISPLAY "Codice" CODTAB
|
INPUT CODTAB F_TIPODOC2
|
||||||
|
DISPLAY "Codice" CODTAB
|
||||||
DISPLAY "Descrizione@50" S0
|
DISPLAY "Descrizione@50" S0
|
||||||
OUTPUT F_TIPODOC2 CODTAB
|
OUTPUT F_TIPODOC2 CODTAB
|
||||||
OUTPUT F_DESDOC2 S0
|
OUTPUT F_DESDOC2 S0
|
||||||
@ -133,9 +135,10 @@ PAGE "Tipi documento validi" -1 -1 60 14
|
|||||||
STRING F_TIPODOC3 4
|
STRING F_TIPODOC3 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 8 ""
|
PROMPT 2 8 ""
|
||||||
USE %TIP
|
FLAGS "U"
|
||||||
INPUT CODTAB F_TIPODOC3
|
USE %TIP
|
||||||
DISPLAY "Codice" CODTAB
|
INPUT CODTAB F_TIPODOC3
|
||||||
|
DISPLAY "Codice" CODTAB
|
||||||
DISPLAY "Descrizione@50" S0
|
DISPLAY "Descrizione@50" S0
|
||||||
OUTPUT F_TIPODOC3 CODTAB
|
OUTPUT F_TIPODOC3 CODTAB
|
||||||
OUTPUT F_DESDOC3 S0
|
OUTPUT F_DESDOC3 S0
|
||||||
@ -153,9 +156,10 @@ PAGE "Tipi documento validi" -1 -1 60 14
|
|||||||
STRING F_TIPODOC4 4
|
STRING F_TIPODOC4 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 10 ""
|
PROMPT 2 10 ""
|
||||||
USE %TIP
|
FLAGS "U"
|
||||||
INPUT CODTAB F_TIPODOC4
|
USE %TIP
|
||||||
DISPLAY "Codice" CODTAB
|
INPUT CODTAB F_TIPODOC4
|
||||||
|
DISPLAY "Codice" CODTAB
|
||||||
DISPLAY "Descrizione@50" S0
|
DISPLAY "Descrizione@50" S0
|
||||||
OUTPUT F_TIPODOC4 CODTAB
|
OUTPUT F_TIPODOC4 CODTAB
|
||||||
OUTPUT F_DESDOC4 S0
|
OUTPUT F_DESDOC4 S0
|
||||||
@ -173,9 +177,10 @@ PAGE "Tipi documento validi" -1 -1 60 14
|
|||||||
STRING F_TIPODOC5 4
|
STRING F_TIPODOC5 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 12 ""
|
PROMPT 2 12 ""
|
||||||
USE %TIP
|
FLAGS "U"
|
||||||
INPUT CODTAB F_TIPODOC5
|
USE %TIP
|
||||||
DISPLAY "Codice" CODTAB
|
INPUT CODTAB F_TIPODOC5
|
||||||
|
DISPLAY "Codice" CODTAB
|
||||||
DISPLAY "Descrizione@50" S0
|
DISPLAY "Descrizione@50" S0
|
||||||
OUTPUT F_TIPODOC5 CODTAB
|
OUTPUT F_TIPODOC5 CODTAB
|
||||||
OUTPUT F_DESDOC5 S0
|
OUTPUT F_DESDOC5 S0
|
||||||
|
21
ve/batbtip.h
21
ve/batbtip.h
@ -1,16 +1,5 @@
|
|||||||
#define F_CODTAB 101
|
#define F_CODTAB 101
|
||||||
#define F_DESNUM 102
|
#define F_DESNUM 102
|
||||||
#define F_PROFILO 103
|
#define F_RIFERIMENTO 103
|
||||||
#define F_PSTAMPA 104
|
#define F_PROFILO 104
|
||||||
#define F_CAMBIO 105
|
#define F_PSTAMPA 105
|
||||||
#define F_SCONTO 106
|
|
||||||
#define F_TIPODOC 107
|
|
||||||
#define F_CODNUM 108
|
|
||||||
#define F_CONDPAG 109
|
|
||||||
#define F_BANCA 110
|
|
||||||
#define F_LISTINO 111
|
|
||||||
#define F_AGENTE 112
|
|
||||||
#define F_SPEDIZIONE 113
|
|
||||||
#define F_PORTO 114
|
|
||||||
#define F_TRASPORTO 115
|
|
||||||
#define F_VETTORI 116
|
|
||||||
|
@ -8,17 +8,16 @@ ENDPAGE
|
|||||||
|
|
||||||
PAGE "Tabella tipi di documento" -1 -1 60 14
|
PAGE "Tabella tipi di documento" -1 -1 60 14
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 75 7
|
GROUPBOX DLG_NULL 75 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 0 ""
|
PROMPT 1 1 ""
|
||||||
FLAG "R"
|
FLAG "R"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRING F_CODTAB 4
|
STRING F_CODTAB 4
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 2 "Cod. tipo docum. "
|
PROMPT 2 2 "Codice "
|
||||||
FIELD CODTAB
|
FIELD CODTAB
|
||||||
HELP "Codice tipo documento"
|
|
||||||
USE %TIP
|
USE %TIP
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
INPUT CODTAB F_CODTAB
|
INPUT CODTAB F_CODTAB
|
||||||
@ -32,7 +31,7 @@ END
|
|||||||
|
|
||||||
STRING F_DESNUM 50
|
STRING F_DESNUM 50
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 4 "Descrizione "
|
PROMPT 2 3 "Descrizione "
|
||||||
FIELD S0
|
FIELD S0
|
||||||
HELP "Descrizione tipo documento"
|
HELP "Descrizione tipo documento"
|
||||||
USE %TIP KEY 2
|
USE %TIP KEY 2
|
||||||
@ -44,9 +43,15 @@ BEGIN
|
|||||||
KEY 2
|
KEY 2
|
||||||
END
|
END
|
||||||
|
|
||||||
|
STRING F_RIFERIMENTO 50
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 6 "Riferimento "
|
||||||
|
FIELD S1
|
||||||
|
END
|
||||||
|
|
||||||
STRING F_PROFILO 8
|
STRING F_PROFILO 8
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 2 7 "Profilo documento "
|
PROMPT 2 8 "Profilo documento "
|
||||||
FIELD S4
|
FIELD S4
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
END
|
END
|
||||||
@ -58,84 +63,6 @@ BEGIN
|
|||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
END
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 75 8
|
|
||||||
BEGIN
|
|
||||||
PROMPT 1 11 "Condizioni per raggruppamento"
|
|
||||||
FLAG "R"
|
|
||||||
END
|
|
||||||
|
|
||||||
BOOLEAN F_CAMBIO
|
|
||||||
BEGIN
|
|
||||||
PROMPT 2 12 "Cambio"
|
|
||||||
FIELD S2[1,1]
|
|
||||||
END
|
|
||||||
|
|
||||||
BOOLEAN F_SCONTO
|
|
||||||
BEGIN
|
|
||||||
PROMPT 2 13 "Sconto"
|
|
||||||
FIELD S2[2,2]
|
|
||||||
END
|
|
||||||
|
|
||||||
BOOLEAN F_TIPODOC
|
|
||||||
BEGIN
|
|
||||||
PROMP 2 14 "Tipo documento"
|
|
||||||
FIELD S2[3,3]
|
|
||||||
END
|
|
||||||
|
|
||||||
BOOLEAN F_CODNUM
|
|
||||||
BEGIN
|
|
||||||
PROMP 2 15 "Codice numerazione"
|
|
||||||
FIELD S2[4,4]
|
|
||||||
END
|
|
||||||
|
|
||||||
BOOLEAN F_SPEDIZIONE
|
|
||||||
BEGIN
|
|
||||||
PROMPT 2 16 "Modalita' di spedizione"
|
|
||||||
FIELD S2[9,9]
|
|
||||||
END
|
|
||||||
|
|
||||||
BOOLEAN F_PORTO
|
|
||||||
BEGIN
|
|
||||||
PROMPT 2 17 "Porto"
|
|
||||||
FIELD S2[10,10]
|
|
||||||
END
|
|
||||||
|
|
||||||
BOOLEAN F_CONDPAG
|
|
||||||
BEGIN
|
|
||||||
PROMP 40 12 "Condizione di pagamento"
|
|
||||||
FIELD S2[5,5]
|
|
||||||
END
|
|
||||||
|
|
||||||
BOOLEAN F_BANCA
|
|
||||||
BEGIN
|
|
||||||
PROMPT 40 13 "Banca di appoggio"
|
|
||||||
FIELD S2[6,6]
|
|
||||||
END
|
|
||||||
|
|
||||||
BOOLEAN F_LISTINO
|
|
||||||
BEGIN
|
|
||||||
PROMPT 40 14 "Listino"
|
|
||||||
FIELD S2[7,7]
|
|
||||||
END
|
|
||||||
|
|
||||||
BOOLEAN F_AGENTE
|
|
||||||
BEGIN
|
|
||||||
PROMP 40 15 "Agente"
|
|
||||||
FIELD S2[8,8]
|
|
||||||
END
|
|
||||||
|
|
||||||
BOOLEAN F_TRASPORTO
|
|
||||||
BEGIN
|
|
||||||
PROMPT 40 16 "Causale di trasporto"
|
|
||||||
FIELD S2[11,11]
|
|
||||||
END
|
|
||||||
|
|
||||||
BOOLEAN F_VETTORI
|
|
||||||
BEGIN
|
|
||||||
PROMPT 40 17 "Vettore"
|
|
||||||
FIELD S2[12,12]
|
|
||||||
END
|
|
||||||
|
|
||||||
ENDPAGE
|
ENDPAGE
|
||||||
|
|
||||||
ENDMASK
|
ENDMASK
|
||||||
|
@ -8,6 +8,9 @@
|
|||||||
|
|
||||||
class TFatturazione_bolle_app : public TApplication
|
class TFatturazione_bolle_app : public TApplication
|
||||||
{
|
{
|
||||||
|
TArray _file;
|
||||||
|
void open_files(int logicnum, ...);
|
||||||
|
|
||||||
protected: // TApplication
|
protected: // TApplication
|
||||||
virtual bool create();
|
virtual bool create();
|
||||||
virtual bool menu(MENU_TAG mt);
|
virtual bool menu(MENU_TAG mt);
|
||||||
@ -17,8 +20,22 @@ public:
|
|||||||
virtual ~TFatturazione_bolle_app() { }
|
virtual ~TFatturazione_bolle_app() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void TFatturazione_bolle_app::open_files(int logicnum, ...)
|
||||||
|
{
|
||||||
|
va_list marker;
|
||||||
|
va_start(marker, logicnum);
|
||||||
|
while (logicnum > 0)
|
||||||
|
{
|
||||||
|
CHECKD(_file.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
|
||||||
|
_file.add(new TLocalisamfile(logicnum), logicnum);
|
||||||
|
logicnum = va_arg(marker, int);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
bool TFatturazione_bolle_app::create()
|
bool TFatturazione_bolle_app::create()
|
||||||
{
|
{
|
||||||
|
open_files(LF_TABCOM, LF_CLIFO, LF_CFVEN, LF_DOC, LF_RIGHEDOC, 0);
|
||||||
dispatch_e_menu(MENU_ITEM(1));
|
dispatch_e_menu(MENU_ITEM(1));
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
@ -28,6 +45,8 @@ bool TFatturazione_bolle_app::menu(MENU_TAG)
|
|||||||
TMask m("ve6000");
|
TMask m("ve6000");
|
||||||
while (m.run() == K_ENTER)
|
while (m.run() == K_ENTER)
|
||||||
{
|
{
|
||||||
|
begin_wait();
|
||||||
|
|
||||||
const TDate data_elab = m.get(F_DATA_ELAB);
|
const TDate data_elab = m.get(F_DATA_ELAB);
|
||||||
const int anno = data_elab.year();
|
const int anno = data_elab.year();
|
||||||
|
|
||||||
@ -53,8 +72,19 @@ bool TFatturazione_bolle_app::menu(MENU_TAG)
|
|||||||
TLista_documenti din, dout;
|
TLista_documenti din, dout;
|
||||||
din.read('C', clienti[c], anno, dd, ad, codnum, dn, an);
|
din.read('C', clienti[c], anno, dd, ad, codnum, dn, an);
|
||||||
const bool ok = eld.elabora(din, dout);
|
const bool ok = eld.elabora(din, dout);
|
||||||
if (!ok) break;
|
if (ok)
|
||||||
|
{
|
||||||
|
din.rewrite();
|
||||||
|
dout.write();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
error_box("I documenti relativi al cliente %ld non sono stati elaborati.",
|
||||||
|
clienti[c]);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
end_wait();
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
303
ve/velib01.cpp
303
ve/velib01.cpp
@ -66,14 +66,15 @@ real netto2lordo(const real& netto, const real& iva, bool is_valuta)
|
|||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TTipo_documento::TTipo_documento(const char* tipodoc)
|
TTipo_documento::TTipo_documento(const char* tipodoc)
|
||||||
: _rec(LF_TABCOM)
|
: TRectype(LF_TABCOM)
|
||||||
{
|
{
|
||||||
|
settab("TIP");
|
||||||
if (tipodoc && *tipodoc)
|
if (tipodoc && *tipodoc)
|
||||||
read(tipodoc);
|
read(tipodoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
TTipo_documento::TTipo_documento(const TRectype& rec)
|
TTipo_documento::TTipo_documento(const TRectype& rec)
|
||||||
: _rec(rec)
|
: TRectype(rec)
|
||||||
{ }
|
{ }
|
||||||
|
|
||||||
TTipo_documento::~TTipo_documento()
|
TTipo_documento::~TTipo_documento()
|
||||||
@ -83,13 +84,58 @@ TTipo_documento::~TTipo_documento()
|
|||||||
int TTipo_documento::read(const char* tipodoc)
|
int TTipo_documento::read(const char* tipodoc)
|
||||||
{
|
{
|
||||||
TTable t("%TIP");
|
TTable t("%TIP");
|
||||||
t.put("CODTAB", tipodoc);
|
put("CODTAB", tipodoc);
|
||||||
int err = t.read();
|
int err = TRectype::read(t);
|
||||||
if (err == NOERR)
|
if (err != NOERR)
|
||||||
_rec = t.curr();
|
yesnofatal_box("Tipo documento errato: %s", tipodoc);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
// Riga documento per vendite
|
||||||
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
bool TRiga_documento::solo_descrizione() const
|
||||||
|
{
|
||||||
|
return get("QTA").empty() && get("PREZZO").empty();
|
||||||
|
}
|
||||||
|
|
||||||
|
// Ritorna TRUE se le due righe del documento possono essere sommate
|
||||||
|
bool TRiga_documento::raggruppabile(const TRiga_documento& r, TToken_string& campi) const
|
||||||
|
{
|
||||||
|
bool ok = TRUE;
|
||||||
|
TString campo;
|
||||||
|
for (const char* c = campi.get(0); c && ok; c = campi.get())
|
||||||
|
{
|
||||||
|
campo = get(c); // Separare le due get!
|
||||||
|
ok &= campo == r.get(c);
|
||||||
|
}
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
TRiga_documento& TRiga_documento::operator +=(const TRiga_documento& r)
|
||||||
|
{
|
||||||
|
TToken_string campi("QTA|NCOLLI|QTAEVASA|DAEVADERE");
|
||||||
|
for (const char* c = campi.get(0); c && ok; c = campi.get())
|
||||||
|
{
|
||||||
|
real num(r.get_real(c));
|
||||||
|
if (!num.is_zero())
|
||||||
|
{
|
||||||
|
num += get_real(c);
|
||||||
|
put(c, num);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!get_bool("RIGAEVASA"))
|
||||||
|
{
|
||||||
|
const real qta = get_real("QTA");
|
||||||
|
const real qtaeva = get_real("QTAEVASA");
|
||||||
|
if (qtaeva >= qta)
|
||||||
|
put("RIGAEVASA", "X");
|
||||||
|
}
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Documento per vendite
|
// Documento per vendite
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
@ -97,26 +143,26 @@ int TTipo_documento::read(const char* tipodoc)
|
|||||||
TAssoc_array TDocumento::_tipi;
|
TAssoc_array TDocumento::_tipi;
|
||||||
|
|
||||||
TDocumento::TDocumento()
|
TDocumento::TDocumento()
|
||||||
: _head(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA")
|
: TRectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA")
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc)
|
TDocumento::TDocumento(char provv, int anno, const char* codnum, long numdoc)
|
||||||
: _head(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA")
|
: TRectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA")
|
||||||
{
|
{
|
||||||
if (numdoc <= 0)
|
if (numdoc <= 0)
|
||||||
{
|
{
|
||||||
numdoc = get_next_key(provv, anno, codnum);
|
numdoc = get_next_key(provv, anno, codnum);
|
||||||
set_key(_head, provv, anno, codnum, numdoc);
|
set_key(*this, provv, anno, codnum, numdoc);
|
||||||
|
|
||||||
TRectype* key = new TRectype(LF_RIGHEDOC);
|
TRiga_documento* key = new TRiga_documento(this);
|
||||||
set_key(*key, provv, anno, codnum, numdoc);
|
set_key(*key, provv, anno, codnum, numdoc);
|
||||||
_rows.set_key(key);
|
_rows.set_key(key);
|
||||||
#ifdef DBG
|
#ifdef DBG
|
||||||
TLocalisamfile doc(LF_DOC);
|
TLocalisamfile doc(LF_DOC);
|
||||||
TRectype test(_head);
|
set_key(doc.curr(), provv, anno, codnum, numdoc);
|
||||||
if (test.read(doc) != NOERR)
|
if (doc.read() == NOERR)
|
||||||
yesnofatal_box("Documento gia' esistente: %c %d %s %l", provv, anno, codnum, numdoc);
|
yesnofatal_box("Documento gia' esistente: %c %d %s %ld", provv, anno, codnum, numdoc);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -150,31 +196,29 @@ void TDocumento::copy_data(TRectype& dst, const TRectype& src)
|
|||||||
|
|
||||||
|
|
||||||
TDocumento::TDocumento(const TRectype& rec)
|
TDocumento::TDocumento(const TRectype& rec)
|
||||||
: _head(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA")
|
: TRectype(LF_DOC), _rows(LF_RIGHEDOC, "NRIGA")
|
||||||
{
|
{
|
||||||
read(rec);
|
read(rec);
|
||||||
}
|
}
|
||||||
|
|
||||||
int TDocumento::read(const TRectype& rec)
|
int TDocumento::read(const TRectype& rec)
|
||||||
{
|
{
|
||||||
_head = rec;
|
head() = rec;
|
||||||
|
TRiga_documento* key = new TRiga_documento(this);
|
||||||
TRectype* key = new TRectype(LF_RIGHEDOC);
|
|
||||||
const char pr = tipo_numerazione();
|
const char pr = tipo_numerazione();
|
||||||
const int an = anno();
|
const int an = anno();
|
||||||
const TString16 cn = numerazione();
|
const TString16 cn = numerazione();
|
||||||
const long nu = numero();
|
const long nu = numero();
|
||||||
set_key(*key, pr, an, cn, nu);
|
set_key(*key, pr, an, cn, nu);
|
||||||
|
|
||||||
TLocalisamfile doc(LF_DOC);
|
TLocalisamfile doc(LF_DOC);
|
||||||
TLocalisamfile rdoc(LF_RIGHEDOC);
|
int err = TRectype::read(doc);
|
||||||
int err = _head.read(doc);
|
|
||||||
|
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
_rows.read(key);
|
_rows.read(key);
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
_head = rec;
|
*this = rec;
|
||||||
|
destroy_rows();
|
||||||
_rows.set_key(key);
|
_rows.set_key(key);
|
||||||
}
|
}
|
||||||
return err;
|
return err;
|
||||||
@ -191,22 +235,21 @@ int TDocumento::write(bool re) const
|
|||||||
{
|
{
|
||||||
TLocalisamfile doc(LF_DOC);
|
TLocalisamfile doc(LF_DOC);
|
||||||
int err = NOERR;
|
int err = NOERR;
|
||||||
|
|
||||||
if (re)
|
if (re)
|
||||||
{
|
{
|
||||||
err = _rows.write(re);
|
err = _rows.write(re);
|
||||||
if (err == NOERR)
|
if (err != NOERR)
|
||||||
{
|
{
|
||||||
err = _head.rewrite(doc);
|
err = TRectype::rewrite(doc);
|
||||||
if (err != NOERR)
|
if (err != NOERR)
|
||||||
err = _head.write(doc);
|
err = TRectype::write(doc);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
err = _head.write(doc);
|
err = TRectype::write(doc);
|
||||||
if (err != NOERR)
|
if (err != NOERR)
|
||||||
err = _head.rewrite(doc);
|
err = TRectype::rewrite(doc);
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
err = _rows.write(re);
|
err = _rows.write(re);
|
||||||
}
|
}
|
||||||
@ -218,7 +261,7 @@ int TDocumento::remove() const
|
|||||||
TLocalisamfile doc(LF_DOC);
|
TLocalisamfile doc(LF_DOC);
|
||||||
int err = _rows.remove();
|
int err = _rows.remove();
|
||||||
if (err == NOERR)
|
if (err == NOERR)
|
||||||
err = _head.remove(doc);
|
err = TRectype::remove(doc);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -235,7 +278,7 @@ long TDocumento::get_next_key(char provv, int anno, const char* codnum) const
|
|||||||
set_key(curr, provv, anno, codnum, 9999999L);
|
set_key(curr, provv, anno, codnum, 9999999L);
|
||||||
|
|
||||||
const int err = doc.read(_isgreat);
|
const int err = doc.read(_isgreat);
|
||||||
|
|
||||||
long n = 1;
|
long n = 1;
|
||||||
if (err != _isemptyfile)
|
if (err != _isemptyfile)
|
||||||
{
|
{
|
||||||
@ -251,7 +294,7 @@ long TDocumento::get_next_key(char provv, int anno, const char* codnum) const
|
|||||||
|
|
||||||
const TTipo_documento& TDocumento::tipo() const
|
const TTipo_documento& TDocumento::tipo() const
|
||||||
{
|
{
|
||||||
const TString16 tipodoc(_head.get("TIPODOC"));
|
const TString16 tipodoc(get("TIPODOC"));
|
||||||
CHECK(*tipodoc, "Tipo documento nullo");
|
CHECK(*tipodoc, "Tipo documento nullo");
|
||||||
TTipo_documento * o = (TTipo_documento*)_tipi.objptr(tipodoc);
|
TTipo_documento * o = (TTipo_documento*)_tipi.objptr(tipodoc);
|
||||||
if (o == NULL)
|
if (o == NULL)
|
||||||
@ -262,34 +305,20 @@ const TTipo_documento& TDocumento::tipo() const
|
|||||||
return *o;
|
return *o;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TDocumento::raggruppabile(const TDocumento& doc) const
|
bool TDocumento::raggruppabile(const TDocumento& doc, TToken_string& campi) const
|
||||||
{
|
{
|
||||||
if (!raggruppabile() || !doc.raggruppabile())
|
bool ok = raggruppabile() && doc.raggruppabile();
|
||||||
return FALSE;
|
if (ok)
|
||||||
|
{
|
||||||
TToken_string campi(128);
|
TString campo;
|
||||||
campi = "TIPOCF|CODCF|CODVAL|CODLIN"; // Uguali sempre
|
for (const char* c = campi.get(0); c && ok; c = campi.get())
|
||||||
|
{
|
||||||
// Uguali opzionalmente
|
campo = get(c);
|
||||||
const char* cond[] = { "CAMBIO", "SCONTO", "TIPODOC", "CODNUM",
|
ok &= campo == doc.get(c);
|
||||||
"CODPAG", "CODABIA|CODCABA", "CODLIST", "CODAG",
|
}
|
||||||
"CODSPMEZZO", "CODPORTO", "CAUSTRASP", "CODVETT1|CODVETT2|CODVETT3",
|
}
|
||||||
NULL };
|
|
||||||
const TTipo_documento& tipodoc = tipo();
|
|
||||||
for (int u = 0; cond[u]; u++)
|
|
||||||
{
|
|
||||||
if (tipodoc.uguale(u))
|
|
||||||
campi.add(cond[u]);
|
|
||||||
}
|
|
||||||
|
|
||||||
const TRectype& other = doc.head();
|
|
||||||
|
|
||||||
bool ok = TRUE;
|
|
||||||
for (const char* c = campi.get(0); c && ok; c = campi.get())
|
|
||||||
ok &= _head.get(c) == other.get(c);
|
|
||||||
|
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
// Lista di documenti
|
// Lista di documenti
|
||||||
@ -298,14 +327,10 @@ bool TDocumento::raggruppabile(const TDocumento& doc) const
|
|||||||
TDate TLista_documenti::num2date(char provv, int anno, const char* codnum, long num) const
|
TDate TLista_documenti::num2date(char provv, int anno, const char* codnum, long num) const
|
||||||
{
|
{
|
||||||
TLocalisamfile doc(LF_DOC);
|
TLocalisamfile doc(LF_DOC);
|
||||||
|
TDocumento::set_key(doc.curr(), provv, anno, codnum, num);
|
||||||
TRectype& curr = doc.curr();
|
|
||||||
TDocumento::set_key(curr, provv, anno, codnum, num);
|
|
||||||
|
|
||||||
TDate d;
|
TDate d;
|
||||||
if (doc.read() == NOERR)
|
if (doc.read() == NOERR)
|
||||||
d = curr.get("DATADOC");
|
d = doc.get("DATADOC");
|
||||||
|
|
||||||
return d;
|
return d;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -553,8 +578,9 @@ int TLista_clifo::add(long cod)
|
|||||||
// TElaborazione
|
// TElaborazione
|
||||||
///////////////////////////////////////////////////////////
|
///////////////////////////////////////////////////////////
|
||||||
|
|
||||||
TElaborazione::TElaborazione(const char* cod) : _rec(LF_TAB)
|
TElaborazione::TElaborazione(const char* cod) : TRectype(LF_TABCOM)
|
||||||
{
|
{
|
||||||
|
settab("ELD");
|
||||||
if (cod && *cod)
|
if (cod && *cod)
|
||||||
read(cod);
|
read(cod);
|
||||||
}
|
}
|
||||||
@ -563,11 +589,9 @@ int TElaborazione::read(const char* cod)
|
|||||||
{
|
{
|
||||||
CHECK(cod && *cod, "Codice elaborazione nullo");
|
CHECK(cod && *cod, "Codice elaborazione nullo");
|
||||||
TTable eld("%ELD");
|
TTable eld("%ELD");
|
||||||
eld.put("CODTAB", cod);
|
put("CODTAB", cod);
|
||||||
const int err = eld.read();
|
const int err = TRectype::read(eld);
|
||||||
if (err == NOERR)
|
if (err != NOERR)
|
||||||
_rec = eld.curr();
|
|
||||||
else
|
|
||||||
yesnofatal_box("Codice elaborazione non valido: %s", cod);
|
yesnofatal_box("Codice elaborazione non valido: %s", cod);
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
@ -578,25 +602,104 @@ int TElaborazione::read(const char* cod)
|
|||||||
|
|
||||||
bool TFatturazione_bolle::raggruppa(TDocumento& doc_in, TDocumento& doc_out)
|
bool TFatturazione_bolle::raggruppa(TDocumento& doc_in, TDocumento& doc_out)
|
||||||
{
|
{
|
||||||
const TString tipi = _rec.get("S2");
|
#ifdef DBG
|
||||||
|
const TString tipi = get("S2");
|
||||||
|
const TString& tipodoc = doc_in.tipo().codice();
|
||||||
for (int i = 0; i < 5; i++)
|
for (int i = 0; i < 5; i++)
|
||||||
{
|
{
|
||||||
if (doc_in.tipo() == tipi.mid(i*4, 4))
|
if (tipodoc == tipi.mid(i*4, 4))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
CHECK(i < 5, "Tipo documento non valido");
|
if (i >= 5)
|
||||||
|
{
|
||||||
|
yesnofatal_box("Tipo documento non valido: ", (const char*)tipodoc);
|
||||||
|
return FALSE;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
const char stato_finale_in = _rec.get("S7")[i];
|
const char stato_finale_in = get_char("S4");
|
||||||
doc_in.stato(stato_finale_in);
|
doc_in.stato(stato_finale_in);
|
||||||
|
|
||||||
const char stato_finale_out = _rec.get_char("S9");
|
const TString& tipo_out = get("S8");
|
||||||
|
doc_out.put("TIPODOC", tipo_out);
|
||||||
|
|
||||||
|
const char stato_finale_out = get_char("S9");
|
||||||
doc_out.stato(stato_finale_out);
|
doc_out.stato(stato_finale_out);
|
||||||
|
|
||||||
for (i = 1; i <= doc_in.rows(); i++)
|
if (gestione_riferimenti())
|
||||||
|
{
|
||||||
|
// Determina ed eventualmente crea la riga di riferimento
|
||||||
|
const int riga_rif = riferimenti_in_testa() ? 1 : doc_out.rows()+1;
|
||||||
|
if (riga_rif > doc_out.rows())
|
||||||
|
doc_out.new_row();
|
||||||
|
TRiga_documento& rout = doc_out[riga_rif];
|
||||||
|
|
||||||
|
// Costruisce la stringa di riferimento
|
||||||
|
TString riferimento(80);
|
||||||
|
riferimento = doc_in.tipo().riferimento();
|
||||||
|
if (riferimento.empty())
|
||||||
|
riferimento = doc_in.tipo().descrizione();
|
||||||
|
riferimento << " n. " << doc_in.numero();
|
||||||
|
riferimento << " del " << doc_in.data().string();
|
||||||
|
|
||||||
|
// Setta la descrizione se vuota
|
||||||
|
if (rout.get("DESCR").empty())
|
||||||
|
rout.put("DESCR", riferimento);
|
||||||
|
else
|
||||||
|
{
|
||||||
|
// Altrimenti aggiungi il riferimento al memo
|
||||||
|
TString memo(1024);
|
||||||
|
memo = rout.get("DESCEST");
|
||||||
|
if (memo.empty())
|
||||||
|
rout.put("DESCLUNGA", "X");
|
||||||
|
else
|
||||||
|
memo << '\n';
|
||||||
|
memo << riferimento;
|
||||||
|
rout.put("DESCEST", memo);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
const bool ignora_desc = ignora_descrizioni();
|
||||||
|
|
||||||
|
TToken_string campi_riga(80);
|
||||||
|
const bool ragg_rig = raggruppa_righe();
|
||||||
|
if (ragg_rig)
|
||||||
{
|
{
|
||||||
TRectype& nr = doc_out.new_row();
|
campi_riga = "CODART|UMQTA"; // Uguali sempre
|
||||||
doc_out.copy_data(nr, doc_in[i]);
|
// Uguali opzionalmente
|
||||||
|
if (riga_uguale(0)) campi_riga.add("CODMAG");
|
||||||
|
if (riga_uguale(1)) campi_riga.add("CODIVA");
|
||||||
|
if (riga_uguale(2)) campi_riga.add("PREZZO|SCONTO");
|
||||||
|
}
|
||||||
|
|
||||||
|
for (int r = 1; r <= doc_in.rows(); r++)
|
||||||
|
{
|
||||||
|
const TRiga_documento& rin = doc_in[r];
|
||||||
|
if (ignora_desc && rin.solo_descrizione())
|
||||||
|
continue;
|
||||||
|
|
||||||
|
bool elaborata = FALSE;
|
||||||
|
if (ragg_rig) // Se devo raggruppare le righe ...
|
||||||
|
{
|
||||||
|
const int last = doc_out.rows();
|
||||||
|
for (int o = 1; o <= last; o++) // ... cerca una riga compatibile
|
||||||
|
{
|
||||||
|
TRiga_documento& rout = doc_out[o];
|
||||||
|
if (rout.solo_descrizione())
|
||||||
|
continue;
|
||||||
|
if (rin.raggruppabile(rout, campi_riga)) // Se esiste una riga compatibile ...
|
||||||
|
{
|
||||||
|
rout += rin; // ... sommaci la quantita' ecc.
|
||||||
|
elaborata = TRUE; // Ricorda di averla gia' elaborata
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!elaborata) // Se la riga non e' stata gia' sommata ...
|
||||||
|
{
|
||||||
|
TRiga_documento& rout = doc_out.new_row(); // ... crea una riga nuova e ...
|
||||||
|
doc_out.copy_data(rout, rin); // ... copiaci tutti i campi della riga sorgente.
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
@ -605,29 +708,41 @@ bool TFatturazione_bolle::raggruppa(TDocumento& doc_in, TDocumento& doc_out)
|
|||||||
bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& doc_out)
|
bool TFatturazione_bolle::elabora(TLista_documenti& doc_in, TLista_documenti& doc_out)
|
||||||
{
|
{
|
||||||
bool ok = TRUE;
|
bool ok = TRUE;
|
||||||
|
|
||||||
|
TToken_string campi_doc(128); // Lista di campi che devono essere uguali
|
||||||
|
campi_doc = "TIPOCF|CODCF|CODVAL|CODLIN"; // Uguali sempre
|
||||||
|
|
||||||
|
// Uguali opzionalmente
|
||||||
|
const char* cond[] = { "CAMBIO", "SCONTO", "TIPODOC", "CODNUM",
|
||||||
|
"CODPAG", "CODABIA|CODCABA", "CODLIST", "CODAG",
|
||||||
|
"CODSPMEZZO", "CODPORTO", "CAUSTRASP", "CODVETT1|CODVETT2|CODVETT3",
|
||||||
|
NULL };
|
||||||
|
for (int u = 0; cond[u]; u++)
|
||||||
|
if (doc_uguale(u)) campi_doc.add(cond[u]);
|
||||||
|
|
||||||
for (int id = 0; id < doc_in.items() && ok; id++)
|
for (int id = 0; id < doc_in.items() && ok; id++)
|
||||||
{
|
{
|
||||||
TDocumento& campione = doc_in[id];
|
TDocumento& campione = doc_in[id];
|
||||||
const int tot = doc_out.items();
|
const int tot = doc_out.items();
|
||||||
|
|
||||||
int od = tot;
|
int od = tot;
|
||||||
if (campione.raggruppabile())
|
if (campione.raggruppabile()) // Se il documento ha il flag di raggruppabilita' ...
|
||||||
{
|
{
|
||||||
for (od = 0; od < tot; od++)
|
for (od = 0; od < tot; od++) // ... cerca un documento compatibile.
|
||||||
{
|
{
|
||||||
if (campione.raggruppabile(doc_out[od]))
|
if (campione.raggruppabile(doc_out[od], campi_doc))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (od >= tot) // Se non ho trovato un documento compatibile ...
|
||||||
if (od >= tot)
|
{ // ... creane uno nuovo (certamente compatibile)
|
||||||
{
|
const char provv = tipo_numerazione();
|
||||||
const char provv = _rec.get_char("S3");
|
|
||||||
const int anno = campione.anno();
|
const int anno = campione.anno();
|
||||||
const TString codnum = _rec.get("S5");
|
const TString codnum = codice_numerazione_finale();
|
||||||
TDocumento* new_doc = new TDocumento(provv, anno, codnum, -1);
|
TDocumento* new_doc = new TDocumento(provv, anno, codnum, -1);
|
||||||
new_doc->copy_data(new_doc->head(), campione.head());
|
// Copia i dati della testata
|
||||||
od = doc_out.add(new_doc);
|
TDocumento::copy_data(new_doc->head(), campione.head());
|
||||||
|
// Aggiungilo alla lista dei documenti in uscita
|
||||||
|
od = doc_out.add(new_doc);
|
||||||
}
|
}
|
||||||
ok = raggruppa(campione, doc_out[od]);
|
ok = raggruppa(campione, doc_out[od]);
|
||||||
}
|
}
|
||||||
|
104
ve/velib01.h
104
ve/velib01.h
@ -10,12 +10,8 @@ real netto2lordo(const real& netto, const TString& codiva, bool is_valuta = FALS
|
|||||||
real lordo2netto(real& lordo, const real& iva, bool is_valuta = FALSE);
|
real lordo2netto(real& lordo, const real& iva, bool is_valuta = FALSE);
|
||||||
real netto2lordo(const real& netto, const real& iva, bool is_valuta = FALSE);
|
real netto2lordo(const real& netto, const real& iva, bool is_valuta = FALSE);
|
||||||
|
|
||||||
class TMask;
|
class TTipo_documento : public TRectype
|
||||||
|
|
||||||
class TTipo_documento : public TObject
|
|
||||||
{
|
{
|
||||||
TRectype _rec;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int read(const char* tipodoc);
|
int read(const char* tipodoc);
|
||||||
|
|
||||||
@ -23,38 +19,64 @@ public:
|
|||||||
TObject* dup() const { return new TTipo_documento(codice()); }
|
TObject* dup() const { return new TTipo_documento(codice()); }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const TString& profile_name() const { return _rec.get("S4");}
|
const TString& profile_name() const { return get("S4");}
|
||||||
const TString& mask_name() const { return _rec.get("S4");}
|
const TString& mask_name() const { return get("S4");}
|
||||||
|
const TString& codice() const { return get("CODTAB");}
|
||||||
|
|
||||||
const TString& codice() const { return _rec.get("CODTAB");}
|
const TString& descrizione() const { return get("S0"); }
|
||||||
|
const TString& riferimento() const { return get("S1"); }
|
||||||
bool uguale(int u) const { return _rec.get("S2")[(int)u]; }
|
|
||||||
|
|
||||||
bool operator ==(const char* cod) const { return codice() == cod; }
|
|
||||||
|
|
||||||
TTipo_documento(const char* tipodoc = NULL);
|
TTipo_documento(const char* tipodoc = NULL);
|
||||||
TTipo_documento(const TRectype& rec);
|
TTipo_documento(const TRectype& rec);
|
||||||
virtual ~TTipo_documento();
|
virtual ~TTipo_documento();
|
||||||
};
|
};
|
||||||
|
|
||||||
class TDocumento : public TObject
|
class TRiga_documento : public TRectype
|
||||||
|
{
|
||||||
|
friend class TDocumento;
|
||||||
|
const TDocumento* _doc;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
void set_doc(const TDocumento* doc) { _doc = doc; }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
TObject* dup() const { return new TRiga_documento(*this); }
|
||||||
|
|
||||||
|
public:
|
||||||
|
const TDocumento& documento() const
|
||||||
|
{ CHECK(_doc, "Riga documento orfana"); return *_doc; }
|
||||||
|
|
||||||
|
bool solo_descrizione() const;
|
||||||
|
|
||||||
|
TRiga_documento& operator =(const TRiga_documento& r)
|
||||||
|
{ TRectype::operator=(r); _doc = r._doc; return *this; }
|
||||||
|
|
||||||
|
bool raggruppabile(const TRiga_documento& r, TToken_string& campi) const;
|
||||||
|
TRiga_documento& operator +=(const TRiga_documento& r);
|
||||||
|
|
||||||
|
TRiga_documento(const TDocumento* doc) : TRectype(LF_RIGHEDOC), _doc(doc) { }
|
||||||
|
TRiga_documento(const TRiga_documento& rec) : TRectype(rec), _doc(rec._doc) { }
|
||||||
|
virtual ~TRiga_documento() { }
|
||||||
|
};
|
||||||
|
|
||||||
|
class TDocumento : public TRectype
|
||||||
{
|
{
|
||||||
static TAssoc_array _tipi;
|
static TAssoc_array _tipi;
|
||||||
|
|
||||||
TRectype _head; // Record di testata
|
|
||||||
TRecord_array _rows; // Array di TRectype per le righe documenti di vendita.
|
TRecord_array _rows; // Array di TRectype per le righe documenti di vendita.
|
||||||
protected:
|
protected:
|
||||||
TRectype & row(int index) { return _rows.row(index, FALSE); }
|
TRectype & row(int index) { return _rows.row(index, FALSE); }
|
||||||
long get_next_key(char provv, int anno, const char* codnum) const;
|
long get_next_key(char provv, int anno, const char* codnum) const;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
int rows() const { return _rows.rows(); }
|
const TRectype& head() const { return *this; } // Ritorna la testata del documento
|
||||||
|
TRectype& head() { return *this; } // Ritorna la testata del documento
|
||||||
|
|
||||||
const TRectype & head() const { return _head; } // Ritorna la testata del documento
|
int rows() const { return _rows.rows(); }
|
||||||
TRectype & head() { return _head; } // Ritorna la testata del documento
|
const TRiga_documento& operator[](int index) const { return (const TRiga_documento&)_rows.row(index); }
|
||||||
const TRectype & operator[](int index) const { return _rows.row(index); } // Ritorna la riga n-esima del documento
|
TRiga_documento& operator[](int index) { return (TRiga_documento&)_rows.row(index, FALSE); }
|
||||||
TRectype & operator[](int index) { return _rows.row(index, FALSE); }
|
|
||||||
TRectype& new_row() { return _rows.row(-1, TRUE); }
|
TRiga_documento& new_row() { return (TRiga_documento&)_rows.row(-1, TRUE); }
|
||||||
bool destroy_row(int n) { return _rows.destroy_row(n); }
|
bool destroy_row(int n) { return _rows.destroy_row(n); }
|
||||||
void destroy_rows() { _rows.destroy_rows(); }
|
void destroy_rows() { _rows.destroy_rows(); }
|
||||||
|
|
||||||
@ -65,22 +87,21 @@ public:
|
|||||||
int rewrite() const { return write(TRUE); }
|
int rewrite() const { return write(TRUE); }
|
||||||
int remove() const;
|
int remove() const;
|
||||||
|
|
||||||
char tipo_numerazione() const { return _head.get_int("PROVV"); }
|
char tipo_numerazione() const { return get_char("PROVV"); }
|
||||||
int anno() const { return _head.get_int("ANNO"); }
|
int anno() const { return get_int("ANNO"); }
|
||||||
const TString& numerazione() { return _head.get("CODNUM"); }
|
const TString& numerazione() { return get("CODNUM"); }
|
||||||
long numero() const { return _head.get_long("NDOC"); }
|
long numero() const { return get_long("NDOC"); }
|
||||||
const TString & valuta() { return _head.get("CODVAL"); }
|
TDate data() const { return get_date("DATADOC"); }
|
||||||
const bool in_valuta();
|
const bool in_valuta();
|
||||||
const real cambio() { return _head.get_real("CAMBIO"); }
|
const TString & valuta() { return get("CODVAL"); }
|
||||||
const TDate& data() const { return _head.get_date("DATADOC"); }
|
const real cambio() { return get_real("CAMBIO"); }
|
||||||
// const TString& tipodoc() { return _head.get("TIPODOC"); }
|
|
||||||
const TTipo_documento& tipo() const;
|
const TTipo_documento& tipo() const;
|
||||||
|
|
||||||
char stato() const { return _head.get_char("STATO"); }
|
char stato() const { return get_char("STATO"); }
|
||||||
void stato(char s) { _head.put("STATO", s); }
|
void stato(char s) { put("STATO", s); }
|
||||||
|
|
||||||
bool raggruppabile() const { return _head.get_bool("RAGGR"); }
|
bool raggruppabile() const { return get_bool("RAGGR"); }
|
||||||
bool raggruppabile(const TDocumento& doc) const;
|
bool raggruppabile(const TDocumento& doc, TToken_string& campi) const;
|
||||||
|
|
||||||
static void set_key(TRectype& rec, char provv, int anno, const char* codnum, long numdoc);
|
static void set_key(TRectype& rec, char provv, int anno, const char* codnum, long numdoc);
|
||||||
static void copy_data(TRectype& dst, const TRectype& src);
|
static void copy_data(TRectype& dst, const TRectype& src);
|
||||||
@ -180,21 +201,28 @@ protected:
|
|||||||
virtual char tipo() const { return 'F'; }
|
virtual char tipo() const { return 'F'; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class TElaborazione : public TObject
|
class TElaborazione : public TRectype
|
||||||
{
|
{
|
||||||
protected:
|
|
||||||
TRectype _rec;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int read(const char* cod);
|
int read(const char* cod);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
const TString& codice() const { return _rec.get("CODTAB"); }
|
const TString& codice() const { return get("CODTAB"); }
|
||||||
|
|
||||||
|
bool doc_uguale(int u) const { return get("S1")[u] == 'X'; }
|
||||||
|
bool riga_uguale(int u) const { return get("S1")[40+u] == 'X'; }
|
||||||
|
bool raggruppa_righe() const { return get_bool("B0"); }
|
||||||
|
bool gestione_riferimenti() const { return get_bool("B1"); }
|
||||||
|
bool riferimenti_in_testa() const { return get_bool("B2"); }
|
||||||
|
bool ignora_descrizioni() const { return get_bool("B3"); }
|
||||||
|
|
||||||
|
char tipo_numerazione() const { return get_bool("B4") ? 'P' : 'D'; }
|
||||||
|
const TString& codice_numerazione_finale() const { return get("S6"); }
|
||||||
|
|
||||||
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out) pure;
|
virtual bool elabora(TLista_documenti& doc_in, TLista_documenti& doc_out) pure;
|
||||||
|
|
||||||
TElaborazione(const char* cod);
|
TElaborazione(const char* cod);
|
||||||
TElaborazione(const TRectype& rec) : _rec(rec) { }
|
TElaborazione(const TRectype& rec) : TRectype(rec) { }
|
||||||
virtual ~TElaborazione() { }
|
virtual ~TElaborazione() { }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user