Patch level :10.0 4.0
Files correlati : Ricompilazione Demo : [ ] Commento :iniziato programma dichiarazione conai git-svn-id: svn://10.65.10.50/trunk@16187 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
5b325dcd5e
commit
0417b13978
105
tp/tp0900.cpp
105
tp/tp0900.cpp
@ -2,6 +2,7 @@
|
||||
|
||||
#include <applicat.h>
|
||||
#include <automask.h>
|
||||
#include <config.h>
|
||||
#include <modaut.h>
|
||||
#include <progind.h>
|
||||
#include <reprint.h>
|
||||
@ -44,18 +45,120 @@ bool TDichiarazione_CONAI_mask::on_field_event(TOperable_field& o, TField_event
|
||||
class TDichiarazione_CONAI : public TSkeleton_application
|
||||
{
|
||||
|
||||
protected:
|
||||
void crea_csv(const TMask& mask) const;
|
||||
|
||||
public:
|
||||
virtual bool create();
|
||||
virtual void main_loop();
|
||||
|
||||
};
|
||||
|
||||
//metodo di base per la ricerca delle righe documento che soddisfano i parametri dell'utonto
|
||||
void TDichiarazione_CONAI::crea_csv(const TMask& mask) const
|
||||
{
|
||||
//Tanto per cominciare stabilisce il range di date...
|
||||
const int anno = mask.get_int(F_ANNO);
|
||||
|
||||
TDate dataini(1, 1, anno);
|
||||
TDate datafin(31, 12, anno);
|
||||
|
||||
const int tipo_periodo = mask.get_int(F_PERIODO);
|
||||
//se il periodo scelto non e' un anno intero...
|
||||
switch (tipo_periodo)
|
||||
{
|
||||
case 2:
|
||||
{
|
||||
const int mese = mask.get_int(F_TRIMESTRE);
|
||||
dataini.set_month(mese);
|
||||
datafin = dataini;
|
||||
datafin.addmonth(2);
|
||||
datafin.set_end_month();
|
||||
}
|
||||
break;
|
||||
case 3:
|
||||
{
|
||||
const int mese = mask.get_int(F_MESE);
|
||||
dataini.set_month(mese);
|
||||
datafin = dataini;
|
||||
datafin.set_end_month();
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//Adesso tocca al codice articolo in base alla specie CONAI
|
||||
const int specie_conai = mask.get_int(F_SPECIECONAI);
|
||||
TConfig ditta_ini(CONFIG_DITTA, "ve");
|
||||
|
||||
TVariant codart;
|
||||
|
||||
switch (specie_conai)
|
||||
{
|
||||
case 1:
|
||||
codart = ditta_ini.get("CODACC"); //acciaio
|
||||
break;
|
||||
case 2:
|
||||
codart = ditta_ini.get("CODALL"); //alluminio
|
||||
break;
|
||||
case 3:
|
||||
codart = ditta_ini.get("CODCAR"); //carta
|
||||
break;
|
||||
case 4:
|
||||
codart = ditta_ini.get("CODPLA"); //plastica
|
||||
break;
|
||||
case 5:
|
||||
codart = ditta_ini.get("CODLEG"); //legno
|
||||
break;
|
||||
case 6:
|
||||
codart = ditta_ini.get("CODVET"); //vetro
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
//Adesso prende le numerazioni e i tipi documento
|
||||
TSheet_field& sf = mask.sfield(F_TIPI);
|
||||
|
||||
//la query e' sulle righe documento
|
||||
TString query;
|
||||
query << "USE RDOC KEY 5\n";
|
||||
query << "SELECT ((NUM(ANSI(33.DATADOC))>=NUM(ANSI(#DADATA)))&&(NUM(ANSI(33.DATADOC))<=NUM(ANSI(#ADATA))))&&(33.TIPODOC=#TIPODOC)&&(GENERATA=\"X\")\n";
|
||||
query << "JOIN DOC INTO PROVV==PROVV ANNO==ANNO CODNUM==CODNUM NDOC==NDOC\n";
|
||||
query << "FROM CODART=#CODART ANNO=#ANNO CODNUM=#CODNUM PROVV=\"D\"\n";
|
||||
query << "TO CODART=#CODART ANNO=#ANNO CODNUM=#CODNUM PROVV=\"D\"\n";
|
||||
|
||||
//crea il recordset ed assegna subito i valori delle variabili che restano costanti al cambio..
|
||||
//..numerazione/tipo: sono le date ed il codice articolo
|
||||
TISAM_recordset rdoc(query);
|
||||
|
||||
rdoc.set_var("#ANNO", TVariant((long)anno));
|
||||
rdoc.set_var("#DADATA", dataini);
|
||||
rdoc.set_var("#ADATA", datafin);
|
||||
rdoc.set_var("#CODART", codart);
|
||||
|
||||
//Visto che e' possibile avere una secchiata di numerazioni, gli tocca fare un giro per ogni numerazione
|
||||
FOR_EACH_SHEET_ROW(sf, r, row)
|
||||
{
|
||||
//estrazione della numerazione e del tipo del record corrente dello sheet
|
||||
|
||||
rdoc.set_var("#CODNUM", TVariant(row->get(0)));
|
||||
rdoc.set_var("#TIPODOC", TVariant(row->get(2)));
|
||||
|
||||
const long items = rdoc.items();
|
||||
warning_box("Hai trovato %ld righe bello!", items);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
void TDichiarazione_CONAI::main_loop()
|
||||
{
|
||||
TDichiarazione_CONAI_mask mask;
|
||||
while (mask.run() == K_ENTER)
|
||||
{
|
||||
|
||||
crea_csv(mask);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,13 @@
|
||||
|
||||
TOOLBAR "" 0 -3 0 3
|
||||
|
||||
STRING DLG_PROFILE 50
|
||||
BEGIN
|
||||
PROMPT 9 0 "Profilo "
|
||||
PSELECT
|
||||
FLAGS "H"
|
||||
END
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -11 ""
|
||||
|
Loading…
x
Reference in New Issue
Block a user