Patch level : 12.0 344
Files correlati : ve6.exe, li0.exe Commento : Aggiunto nuovo prograama li0 -2 Per le impostazioni del plafond. Aggiunta nuova libreria lilib01. Al suo interno è presente una classe che per ogni cliente gestisce i controlli sul plafond. git-svn-id: svn://10.65.10.50/branches/R_10_00@23598 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
6c601908d5
commit
8e9ca2fd80
@ -6,10 +6,11 @@ int main(int argc,char** argv)
|
|||||||
const int r = (argc > 1) ? atoi(&argv[1][1]) : -1;
|
const int r = (argc > 1) ? atoi(&argv[1][1]) : -1;
|
||||||
switch (r)
|
switch (r)
|
||||||
{
|
{
|
||||||
case 3: li0400(argc,argv) ; break; //gestione archivio
|
case 2: li0300(argc,argv) ; break; // Impostazioni dichiarazione d'intento (ma perchè li600 è di default sciabolette!?)
|
||||||
case 4: li0500(argc,argv) ; break; //stampa archivio
|
case 3: li0400(argc,argv) ; break; // Gestione archivio
|
||||||
case 5:
|
case 4: li0500(argc,argv) ; break; // Stampa archivio
|
||||||
default: li0600(argc,argv) ; break; //invio dati
|
case 5:
|
||||||
|
default: li0600(argc,argv) ; break; // Invio dati
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
#ifndef __LI0_H
|
#ifndef __LI0_H
|
||||||
#define __LI0_H
|
#define __LI0_H
|
||||||
|
|
||||||
|
int li0300(int argc, char* argv[]);
|
||||||
int li0400(int argc, char* argv[]);
|
int li0400(int argc, char* argv[]);
|
||||||
int li0500(int argc, char* argv[]);
|
int li0500(int argc, char* argv[]);
|
||||||
int li0600(int argc, char* argv[]);
|
int li0600(int argc, char* argv[]);
|
||||||
|
90
src/li/li0300.cpp
Normal file
90
src/li/li0300.cpp
Normal file
@ -0,0 +1,90 @@
|
|||||||
|
#include <automask.h>
|
||||||
|
#include <defmask.h>
|
||||||
|
#include <relapp.h>
|
||||||
|
#include <tabutil.h>
|
||||||
|
#include <filetext.h>
|
||||||
|
|
||||||
|
#include "li0.h"
|
||||||
|
#include "li0300a.h"
|
||||||
|
|
||||||
|
#define CONFIG_DICINT "DICINT.ini"
|
||||||
|
|
||||||
|
class TDI_mask : public TAutomask
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
TSheet_field& sheet; // Sheet
|
||||||
|
|
||||||
|
public:
|
||||||
|
bool on_field_event(TOperable_field& o, TField_event e, long jolly) { return true; };
|
||||||
|
TDI_mask() : TAutomask("li0300a"), sheet(sfield(DOC_STATO)) { load_config(); };
|
||||||
|
void load_config();
|
||||||
|
void save_config();
|
||||||
|
|
||||||
|
};
|
||||||
|
|
||||||
|
void TDI_mask::load_config()
|
||||||
|
{
|
||||||
|
set(FLD_TABIVA_CODTAB, ini_get_string(CONFIG_DITTA, "li", "CODIVA"));
|
||||||
|
TToken_string tipidoc(ini_get_string(CONFIG_DITTA, "li", "TIPIDOC"));
|
||||||
|
|
||||||
|
TString_array& strarr = sheet.rows_array();
|
||||||
|
sheet.hide();
|
||||||
|
sheet.destroy();
|
||||||
|
|
||||||
|
for(int i = 0; i < tipidoc.items(); i++)
|
||||||
|
{
|
||||||
|
TString td = tipidoc.get(i);
|
||||||
|
TToken_string stati(ini_get_string(CONFIG_DITTA, "li", td));
|
||||||
|
for(int j = 0; j < stati.items(); j++)
|
||||||
|
{
|
||||||
|
TToken_string row, s(stati.get(j), ',');
|
||||||
|
row.add(td);
|
||||||
|
row.add(s.get(0));
|
||||||
|
row.add(s.get(1));
|
||||||
|
strarr.add(row);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sheet.force_update();
|
||||||
|
sheet.show();
|
||||||
|
}
|
||||||
|
|
||||||
|
void TDI_mask::save_config()
|
||||||
|
{
|
||||||
|
TToken_string tipidoc;
|
||||||
|
for(int i = 0; i < sheet.items(); i++)
|
||||||
|
{
|
||||||
|
TToken_string row = sheet.row(i), val("",',');
|
||||||
|
// Prelevo il tipo di documento e lo aggiungo alla riga tipidoc
|
||||||
|
tipidoc.add(row.get(0));
|
||||||
|
// Prelevo i valori e aggiungo a una riga
|
||||||
|
val.add(row.get(1));
|
||||||
|
val.add(row.get(2));
|
||||||
|
ini_set_string(CONFIG_DITTA, "li", row.get(0), val);
|
||||||
|
}
|
||||||
|
ini_set_string(CONFIG_DITTA, "li", "CODIVA", get(FLD_TABIVA_CODTAB));
|
||||||
|
ini_set_string(CONFIG_DITTA, "li", "TIPIDOC", tipidoc);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
class TDISettings_app : public TSkeleton_application
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
virtual void main_loop();
|
||||||
|
};
|
||||||
|
|
||||||
|
void TDISettings_app::main_loop()
|
||||||
|
{
|
||||||
|
TDI_mask m;
|
||||||
|
while (m.run() == K_SAVE)
|
||||||
|
{
|
||||||
|
m.save_config();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
int li0300(int argc, char* argv[])
|
||||||
|
{
|
||||||
|
TDISettings_app a;
|
||||||
|
a.run(argc, argv, TR("Lettere d'intento"));
|
||||||
|
return 0;
|
||||||
|
}
|
7
src/li/li0300a.h
Normal file
7
src/li/li0300a.h
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
#define FLD_TIPODOC 101
|
||||||
|
#define FLD_STATODOCDA 102
|
||||||
|
#define FLD_STATODOCA 103
|
||||||
|
|
||||||
|
#define DOC_STATO 201
|
||||||
|
|
||||||
|
#define FLD_TABIVA_CODTAB 301
|
117
src/li/li0300a.uml
Normal file
117
src/li/li0300a.uml
Normal file
@ -0,0 +1,117 @@
|
|||||||
|
#include "li0300a.h"
|
||||||
|
|
||||||
|
TOOLBAR "topbar" 0 0 0 2
|
||||||
|
|
||||||
|
BUTTON DLG_SAVEREC 2 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 1 "~Registra"
|
||||||
|
MESSAGE EXIT,K_SAVE
|
||||||
|
PICTURE TOOL_SAVEREC
|
||||||
|
END
|
||||||
|
|
||||||
|
#include <cancelbar.h>
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
PAGE "Impostazioni dichiarazioni d'intento" 0 2 0 0
|
||||||
|
|
||||||
|
STRING FLD_TABIVA_CODTAB 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 1 "Codice IVA plafond: "
|
||||||
|
FIELD CODTAB
|
||||||
|
KEY 1
|
||||||
|
USE %IVA
|
||||||
|
FLAGS "U"
|
||||||
|
INPUT CODTAB FLD_TABIVA_CODTAB
|
||||||
|
DISPLAY "Codice" CODTAB
|
||||||
|
DISPLAY "Descrizione@50" S0
|
||||||
|
DISPLAY "Tipo" S1
|
||||||
|
DISPLAY "%@5" R0
|
||||||
|
DISPLAY "Vent." S6
|
||||||
|
DISPLAY "Sospeso" B2
|
||||||
|
OUTPUT FLD_TABIVA_CODTAB CODTAB
|
||||||
|
HELP "Inserire il codice IVA"
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
VALIDATE ZEROFILL_FUNC 2
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
SPREADSHEET DOC_STATO 45 10
|
||||||
|
BEGIN
|
||||||
|
PROMPT 30 1 ""
|
||||||
|
ITEM "Tipo Numerazione"
|
||||||
|
ITEM "Da stato"
|
||||||
|
ITEM "A stato"
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
ENDMASK
|
||||||
|
|
||||||
|
PAGE "Riga tipo numerazione" -1 -1 78 8
|
||||||
|
|
||||||
|
STRING FLD_TIPODOC 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 1 "Codice Numerazione "
|
||||||
|
FIELD CODTAB
|
||||||
|
KEY 1
|
||||||
|
USE %NUM
|
||||||
|
FLAGS "U"
|
||||||
|
INPUT CODTAB FLD_TIPODOC
|
||||||
|
DISPLAY "Codice" CODTAB
|
||||||
|
DISPLAY "Descrizione@50" S0
|
||||||
|
OUTPUT FLD_TIPODOC CODTAB
|
||||||
|
CHECKTYPE REQUIRED
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING FLD_STATODOCDA 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 2 "Da Numerazione "
|
||||||
|
FIELD CODTAB
|
||||||
|
KEY 1
|
||||||
|
USE %STD
|
||||||
|
FLAGS "U"
|
||||||
|
INPUT CODTAB FLD_STATODOCA
|
||||||
|
DISPLAY "Stato" CODTAB
|
||||||
|
DISPLAY "Descrizione@50" S0
|
||||||
|
OUTPUT FLD_STATODOCDA CODTAB
|
||||||
|
//CHECKTYPE REQUIRED
|
||||||
|
END
|
||||||
|
|
||||||
|
STRING FLD_STATODOCA 4
|
||||||
|
BEGIN
|
||||||
|
PROMPT 2 3 "A Numerazione "
|
||||||
|
FIELD CODTAB
|
||||||
|
KEY 1
|
||||||
|
USE %STD
|
||||||
|
FLAGS "U"
|
||||||
|
INPUT CODTAB FLD_STATODOCA
|
||||||
|
DISPLAY "Stato" CODTAB
|
||||||
|
DISPLAY "Descrizione@50" S0
|
||||||
|
OUTPUT FLD_STATODOCA CODTAB
|
||||||
|
//CHECKTYPE REQUIRED
|
||||||
|
END
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
TOOLBAR "Documento" 0 0 0 2
|
||||||
|
|
||||||
|
BUTTON DLG_OK 2 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_DELREC 2 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
BUTTON DLG_CANCEL 2 2
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 1 ""
|
||||||
|
END
|
||||||
|
|
||||||
|
|
||||||
|
ENDPAGE
|
||||||
|
|
||||||
|
ENDMASK
|
137
src/li/lilib01.cpp
Normal file
137
src/li/lilib01.cpp
Normal file
@ -0,0 +1,137 @@
|
|||||||
|
#include "lilib01.h"
|
||||||
|
|
||||||
|
#define FINO_A_PLAFOND 2
|
||||||
|
|
||||||
|
void TLi_manager::elabTipiStati(TToken_string& tipi, TToken_string& stati)
|
||||||
|
{
|
||||||
|
for(int i = 0; i < tipidoc.items(); i++)
|
||||||
|
{
|
||||||
|
TToken_string statidoc(ini_get_string(CONFIG_DITTA, "li", tipidoc.get(i)), ',');
|
||||||
|
for(int j = 0; j < statidoc.items(); j++)
|
||||||
|
{
|
||||||
|
tipi.add(tipidoc.get(i));
|
||||||
|
stati.add(statidoc.get(j));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void TLi_manager::elabPlafond()
|
||||||
|
{
|
||||||
|
TRelation letint(LF_LETINT);
|
||||||
|
TRectype filtro(letint.curr());
|
||||||
|
filtro.add("CODCLI", codcli);
|
||||||
|
|
||||||
|
if(year != -1)
|
||||||
|
filtro.add("ANNO", year);
|
||||||
|
|
||||||
|
// Creo un cursore ordinato e prelevo la prima riga non chiusa
|
||||||
|
TSorted_cursor c_dicint(&letint, "ANNO-|NUMPROT-", "", 2, &filtro, &filtro);
|
||||||
|
|
||||||
|
validPlafond = false;
|
||||||
|
|
||||||
|
if(c_dicint.items() > 0)
|
||||||
|
{
|
||||||
|
for(c_dicint = 0; c_dicint.pos() < c_dicint.items(); ++c_dicint)
|
||||||
|
{
|
||||||
|
TRectype row = c_dicint.curr();
|
||||||
|
if(!row.get_bool("CHIUSA"))
|
||||||
|
{
|
||||||
|
if(row.get_int("TIPOOP") != FINO_A_PLAFOND)
|
||||||
|
{
|
||||||
|
plafond = -UNO;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
year = row.get_int("ANNO");
|
||||||
|
iniDicInt = row.get_date("VSDATA");
|
||||||
|
plafond = row.get_real("IMPORTO");
|
||||||
|
validPlafond = true;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
plafond = -UNO;
|
||||||
|
}
|
||||||
|
|
||||||
|
const real TLi_manager::getPlaRes()
|
||||||
|
{
|
||||||
|
if(!validPlafond)
|
||||||
|
return -UNO;
|
||||||
|
|
||||||
|
real resPlafond = plafond;
|
||||||
|
|
||||||
|
TLista_documenti din; // Legge tutti i documenti di input
|
||||||
|
TToken_string tipi, stati;
|
||||||
|
elabTipiStati(tipi, stati);
|
||||||
|
TDate ad(TString(year)<<"1201");
|
||||||
|
|
||||||
|
// Trovo tutti i documenti che mi interessano e sottraggo l'imponibile al plafond
|
||||||
|
din.read('D', tipocf, codcli, year, tipi, stati, iniDicInt, ad);
|
||||||
|
int i = 0;
|
||||||
|
for(; i < din.items(); i++)
|
||||||
|
{
|
||||||
|
int j = 1; // Le righe partono da 1?
|
||||||
|
|
||||||
|
TAssoc_array tabIva = din[i].tabella_iva(true);
|
||||||
|
TString numerazione = din[i].numerazione();
|
||||||
|
int numdoc = din[i].numero();
|
||||||
|
int anno = din[i].anno();
|
||||||
|
TRiepilogo_iva * totali = static_cast<TRiepilogo_iva *>(tabIva.get());
|
||||||
|
if(totali->cod_iva() == codiva)
|
||||||
|
{
|
||||||
|
resPlafond -= totali->imp_orig();
|
||||||
|
}
|
||||||
|
if(resPlafond < 0) break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return resPlafond;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool TLi_manager::testPlafond(TLista_documenti dout, TLog_report& lerr)
|
||||||
|
{
|
||||||
|
bool ok = true;
|
||||||
|
real resPlafond = getPlaRes();
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
|
// Faccio un ragionamento identico a getPlaRes, ma in input ho la lista di documenti appena elaborati
|
||||||
|
for(; i < dout.items(); i++)
|
||||||
|
{
|
||||||
|
int j = 1; // Le righe partono da 1?
|
||||||
|
|
||||||
|
TAssoc_array tabIva = dout[i].tabella_iva(true);
|
||||||
|
TString numerazione = dout[i].numerazione();
|
||||||
|
int numdoc = dout[i].numero();
|
||||||
|
int anno = dout[i].anno();
|
||||||
|
TRiepilogo_iva * totali = static_cast<TRiepilogo_iva *>(tabIva.get());
|
||||||
|
if(totali->cod_iva() == codiva)
|
||||||
|
{
|
||||||
|
resPlafond -= totali->imp_orig();
|
||||||
|
}
|
||||||
|
if(resPlafond < 0)
|
||||||
|
{
|
||||||
|
ok = false;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if(i < dout.items())
|
||||||
|
{
|
||||||
|
TString msgerr; msgerr << "\nSforato plafond cliente N." << dout[i].codcf();
|
||||||
|
lerr.log(2, msgerr);
|
||||||
|
}
|
||||||
|
for(; i < dout.items(); i++)
|
||||||
|
{
|
||||||
|
TString msgerr; msgerr << "Errore doc. tipo: " << dout[i].tipo() << " N." << dout[i].numero() << " data: " << dout[i].data();
|
||||||
|
lerr.log(2, msgerr); // 2 -> Errore
|
||||||
|
}
|
||||||
|
|
||||||
|
return ok;
|
||||||
|
}
|
||||||
|
|
||||||
|
// TIPOCF, CODCLI, ANNO
|
||||||
|
TLi_manager::TLi_manager(const char t, const long c, int y)
|
||||||
|
: tipocf(t), codcli(c), year(y), iniDicInt()
|
||||||
|
{
|
||||||
|
tipidoc = ini_get_string(CONFIG_DITTA, "li", "TIPIDOC");
|
||||||
|
elabPlafond();
|
||||||
|
// Estrapolo il codice iva
|
||||||
|
codiva = TCodiceIVA(ini_get_string(CONFIG_DITTA, "li", "CODIVA"));
|
||||||
|
}
|
56
src/li/lilib01.h
Normal file
56
src/li/lilib01.h
Normal file
@ -0,0 +1,56 @@
|
|||||||
|
#ifndef __LILIB01_H
|
||||||
|
#define __LILIB01_H
|
||||||
|
|
||||||
|
#ifndef __REAL_H
|
||||||
|
#include <real.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __DATE_H
|
||||||
|
#include <date.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __RELATION_H
|
||||||
|
#include <relation.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __VELIB04_H
|
||||||
|
#include "../ve/velib04.h"
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef __REPUTILS_H
|
||||||
|
#include <reputils.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
class TLi_manager : TObject
|
||||||
|
{
|
||||||
|
bool validPlafond;
|
||||||
|
int year;
|
||||||
|
const char tipocf;
|
||||||
|
const long codcli;
|
||||||
|
|
||||||
|
TDate iniDicInt;
|
||||||
|
TToken_string tipidoc;
|
||||||
|
real plafond;
|
||||||
|
|
||||||
|
TCodiceIVA codiva;
|
||||||
|
|
||||||
|
void elabTipiStati(TToken_string& tipi, TToken_string& stati); // Preparo due token string con le tipi[0] -> stati[0], ...
|
||||||
|
void elabPlafond(); // Vado a estrapolare il plafond
|
||||||
|
const real getPlaRes(); // Calcolo il rimanente del plafond
|
||||||
|
|
||||||
|
public:
|
||||||
|
const real getPlafond() { return plafond; }; // Rirno il plafond
|
||||||
|
bool hasValidPlafond() { return validPlafond;} // Ritorno se il plafond è valido
|
||||||
|
bool testPlafond(TLista_documenti dout, TLog_report& lerr); // Testo se con i documenti passati supero il plafond
|
||||||
|
bool checkModule(); // Controllo se il modulo è attivo
|
||||||
|
|
||||||
|
// Costructors/Destructors
|
||||||
|
TLi_manager(const char t, const long c, int y = -1);
|
||||||
|
virtual ~TLi_manager() {};
|
||||||
|
|
||||||
|
void setYear(int y) { year = y; }
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
#endif
|
@ -5,4 +5,5 @@ Module = 16
|
|||||||
Flags = "F"
|
Flags = "F"
|
||||||
Item_01 = "Dichiarazioni d'intento", "li0 -3", ""
|
Item_01 = "Dichiarazioni d'intento", "li0 -3", ""
|
||||||
Item_02 = "Stampa dichiarazioni", "li0 -4", ""
|
Item_02 = "Stampa dichiarazioni", "li0 -4", ""
|
||||||
|
Item_03 = "Impostazioni", "li0 -2", ""
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user