Patch level :10.0

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
programma per dinamica rivisto e corretto


git-svn-id: svn://10.65.10.50/trunk@20258 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2010-03-22 16:12:26 +00:00
parent 22ad03876d
commit 90921f3979
3 changed files with 108 additions and 40 deletions

View File

@ -185,13 +185,7 @@ TRecnotype TImporta_movana_recordset::new_rec(const char* buf)
TImporta_movana_recordset::TImporta_movana_recordset(const char * filename, char sep_field)
: TCSV_recordset("CSV(;)"), _sep_field(sep_field) //separatore campi
{
TString query;
query << "CSV(" << sep_field << ")\n"
<< "SELECT * FROM " << filename;
TFilename n;
if (parse_query(query, n) == _qt_select && n.exist())
load_file(n);
load_file(filename);
}
///////////////////////////////////////
@ -218,8 +212,10 @@ public:
bool TImporta_movana::transfer(const TFilename& file)
{
//roba dalla maschera
//parametri di importazione
const char sep_field = _msk->get(F_SEP_FIELD)[0]; //separatore dei campi
const char sep_dec = _msk->get(F_SEP_DEC)[0]; //separatore decimali
//parametri del movana
const int annoes = _msk->get_int(F_ANNOES);
const TDate datareg = _msk->get_date(F_DATAREG);
const TDate datacomp = _msk->get_date(F_DATACOMP);
@ -228,6 +224,8 @@ bool TImporta_movana::transfer(const TFilename& file)
const TString descrizione = _msk->get(F_DESCR);
const char tipomov = _msk->get(F_TIPO)[0];
const TString4 codcaus = _msk->get(F_CODCAUS);
const real ori_totimp = _msk->get_real(F_TOTMOV);
const char ori_totsez = _msk->get(F_TOTMOV_SEZ)[0];
//crea il recordset sul file di input utilizzando il separatore
@ -262,8 +260,6 @@ bool TImporta_movana::transfer(const TFilename& file)
break;
curr_line ++;
//nuova riga del movana (sfrutta il fatto che è un multiple rectype)
TRectype& rmovana = movana.new_row();
//prende i dati dal record di input del file csv
//----------------------------------------------
//codcms ci deve essere e va maiuscolizzato; se non c'è va segnalato sul log..
@ -294,14 +290,11 @@ bool TImporta_movana::transfer(const TFilename& file)
TString80 str_importo = s.get(2).as_string();
if (sep_dec == ',')
{
str_importo.replace('.',' '); //togle il separatore delle migliaia
str_importo.strip("."); //togle il separatore delle migliaia
str_importo.replace(',','.'); //sostituisce il separatore decimale
}
else
str_importo.replace(',',' '); //togle il separatore delle migliaia
str_importo.strip_spaces();
str_importo.trim();
str_importo.strip(",");
const real importo = str_importo;
/*if (importo == ZERO)
@ -339,13 +332,16 @@ bool TImporta_movana::transfer(const TFilename& file)
//riempie la riga analitica
//-------------------------
//nuova riga del movana (sfrutta il fatto che è un multiple rectype)
TRectype& rmovana = movana.new_row();
rmovana.put(RMOVANA_DESCR, "Riga importata");
rmovana.put(RMOVANA_CODCONTO, conto);
rmovana.put(RMOVANA_CODCMS, codcms);
rmovana.put(RMOVANA_CODCCOSTO, cdc);
rmovana.put(RMOVANA_SEZIONE, sezione);
rmovana.put(RMOVANA_IMPORTO, importo);
//aggiorna anche il totale documento
//aggiorna anche il totale documento..
TImporto importo_riga(sezione, importo);
totale += importo_riga;
}
@ -353,19 +349,36 @@ bool TImporta_movana::transfer(const TFilename& file)
//completa la testata
//-------------------
totale.normalize();
const char totsez = totale.sezione();
const real totimp = totale.valore();
//controllo sul totmov in caso di riscrittura
if (ori_totimp != totimp || ori_totsez != totsez)
{
TString str_totimp;
str_totimp << totimp;
TString str_ori_totimp;
str_ori_totimp << ori_totimp;
TString msg;
msg.format("Il totale movimento originale e' %s %c, quello importato e' %s %c.\n"
"Registrare il movimento con il totale delle righe importate?",
(const char*)str_totimp, totsez, (const char*)str_ori_totimp, ori_totsez);
if (!yesno_box(msg))
log.log(2, "Totale movimento originale NON coincidente con quello importato !");
}
movana.put(MOVANA_SEZIONE, totale.sezione());
movana.put(MOVANA_TOTDOC, totale.valore());
//solo se non ci sono errori procede alla registrazione del movimento
const int items = log.recordset()->items();
if (items > 1)
if (items > 0)
log.preview();
else
{
TLocalisamfile fmovana(LF_MOVANA);
int err = movana.rewrite_write(fmovana);
if (err != NOERR)
error_box("Impossibile registrare il movimento analitico generato!");
error_box("Impossibile registrare il movimento analitico !");
}
return true;
}

View File

@ -1,5 +1,4 @@
#define F_CODITTA 101
#define F_RAGSOC 102
#define F_NUMREGCA 102
#define F_PATH 103
#define F_NAME 104
#define F_SEP_FIELD 105
@ -14,3 +13,5 @@
#define F_DESCR 116
#define F_CODCAUS 117
#define F_DESCAUS 118
#define F_TOTMOV 119
#define F_TOTMOV_SEZ 120

View File

@ -46,9 +46,33 @@ BEGIN
PROMPT 1 7 "@bParametri testata movimento"
END
NUMBER F_NUMREGCA 7
BEGIN
PROMPT 2 8 "Movimento analitico da aggiornare o creare "
USE MOVANA
INPUT NUMREG F_NUMREGCA
DISPLAY "Numreg" NUMREG
DISPLAY "Anno" ANNOES
DISPLAY "Data Reg@10" DATAREG
DISPLAY "Data Comp@10" DATACOMP
DISPLAY "Descrizione@50" DESCR
OUTPUT F_NUMREGCA NUMREG
OUTPUT F_TIPO TIPOMOV
OUTPUT F_DATAREG DATAREG
OUTPUT F_ANNOES ANNOES
OUTPUT F_DATACOMP DATAFCOMP
OUTPUT F_DATAFCOMP DATAFCOMP
OUTPUT F_AUTOFCOMP AUTOFCOMP
OUTPUT F_DESCR DESCR
OUTPUT F_CODCAUS CODCAUS
OUTPUT F_TOTMOV TOTDOC
OUTPUT F_TOTMOV_SEZ SEZIONE
CHECKTYPE SEARCH
END
LIST F_TIPO 1 25
BEGIN
PROMPT 2 8 "Tipo movimento "
PROMPT 2 9 "Tipo movimento "
ITEM " |Normale"
ITEM "P|Preventivo"
ITEM "V|Variazione preventivo"
@ -56,7 +80,7 @@ END
DATE F_DATAREG
BEGIN
PROMPT 2 9 "Data di registrazione "
PROMPT 2 10 "Data di registrazione "
CHECKTYPE REQUIRED
FLAGS "A"
WARNING "La data di registrazione non appartiene ad un esercizio valido"
@ -64,38 +88,38 @@ END
NUMBER F_ANNOES 4
BEGIN
PROMPT 54 9 "Esercizio "
PROMPT 54 10 "Esercizio "
FLAGS "DG"
END
DATE F_DATACOMP
BEGIN
PROMPT 2 10 "Data di competenza "
PROMPT 2 11 "Data di competenza "
CHECKTYPE REQUIRED
WARNING "La data di competenza non appartiene ad un esercizio valido"
END
DATE F_DATAFCOMP
BEGIN
PROMPT 43 10 "Data di fine competenza "
PROMPT 43 11 "Data di fine competenza "
WARNING "La data di fine competenza non puo' essere anteriore alla data di competenza"
END
BOOLEAN F_AUTOFCOMP
BEGIN
PROMPT 2 11 "Fine competenza coincidente con fine commessa di ogni riga"
PROMPT 2 12 "Fine competenza coincidente con fine commessa di ogni riga"
MESSAGE FALSE ENABLE,F_DATAFCOMP
MESSAGE TRUE CLEAR,F_DATAFCOMP
END
STRING F_DESCR 50
BEGIN
PROMPT 2 12 "Descrizione "
PROMPT 2 13 "Descrizione "
END
STRINGA F_CODCAUS 3
BEGIN
PROMPT 2 13 "Causale "
PROMPT 2 14 "Causale "
USE LF_CAUSALI SELECT MOVIND!=''
INPUT CODCAUS F_CODCAUS
DISPLAY "Codice" CODCAUS
@ -108,7 +132,7 @@ END
STRINGA F_DESCAUS 50 40
BEGIN
PROMPT 24 13 ""
PROMPT 24 14 ""
USE LF_CAUSALI KEY 2 SELECT MOVIND!=''
INPUT DESCR F_DESCAUS
DISPLAY "Descrizione@50" DESCR
@ -117,6 +141,16 @@ BEGIN
CHECKTYPE REQUIRED
END
CURRENCY F_TOTMOV 18
BEGIN
PROMPT 2 15 "Totale movimento "
END
STRING F_TOTMOV_SEZ 1
BEGIN
PROMPT 40 15 ""
END
STRING DLG_PROFILE 50
BEGIN
PROMPT 2 -2 "Profilo "
@ -129,9 +163,9 @@ ENDPAGE
PAGE "Istruzioni " 0 2 0 0
TEXT -1
GROUPBOX DLG_NULL 80 15
BEGIN
PROMPT 1 1 "@bIstruzioni"
PROMPT 0 1 "@bIstruzioni"
END
TEXT -1
@ -161,7 +195,27 @@ END
TEXT -1
BEGIN
PROMPT 1 7 "_ I campi dei sepatratori dipendono dalle impostazioni del proprio computer. Si controllano aprendo il file di input con un editor di testo."
PROMPT 1 7 "_ I campi dei sepatratori dipendono dalle impostazioni del proprio computer. Si controllano aprendo il file di input"
END
TEXT -1
BEGIN
PROMPT 1 8 " con un editor di testo."
END
TEXT -1
BEGIN
PROMPT 1 9 "@bGestione movimento"
END
TEXT -1
BEGIN
PROMPT 1 10 "_ Selezionando un movimento analitico già esistente, sarà sovrascritto con i dati di testata eventualmente modificati "
END
TEXT -1
BEGIN
PROMPT 1 11 " e con le righe importate."
END
ENDPAGE