Patch level :10.0

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :
Programma ATS per eliminazione conti non analitici

Programma CRPA preso dal main-trunk e portato sulla 10.0


git-svn-id: svn://10.65.10.50/branches/R_10_00@20712 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2010-07-28 14:32:10 +00:00
parent ebbec3c037
commit 7fdbb59ab5
6 changed files with 119 additions and 20 deletions

View File

@ -7,12 +7,13 @@ int main(int argc, char** argv)
int n = argc > 1 ? atoi(argv[1]+1) : 0;
switch(n)
{
case 0: ps0713100(argc, argv); break; //Esportazione righe IVA
case 1: ps0713200(argc, argv); break; //Importazione commesse
case 2: ps0713300(argc, argv); break; //Importazione fatture di acquisto
case 3: ps0713400(argc, argv); break; //Importazione fatture di vendita
case 4: ps0713500(argc, argv); break; //Importazione spese
case 5: ps0713600(argc, argv); break; //Importazione fatture fornitori / fatture da ricevere
case 0: ps0713100(argc, argv); break; //Esportazione righe IVA
case 1: ps0713200(argc, argv); break; //Importazione commesse
case 2: ps0713300(argc, argv); break; //Importazione fatture di acquisto
case 3: ps0713400(argc, argv); break; //Importazione fatture di vendita
case 4: ps0713500(argc, argv); break; //Importazione spese
case 5: ps0713600(argc, argv); break; //Importazione fatture fornitori / fatture da ricevere
case 6: ps0713700(argc, argv); break; //Eliminazione conti non analitici dai movimenti
default: ps0713100(argc, argv); break; //Esportazione righe IVA
}
exit(0);

View File

@ -3,4 +3,5 @@ int ps0713200(int argc, char* argv[]);
int ps0713300(int argc, char* argv[]);
int ps0713400(int argc, char* argv[]);
int ps0713500(int argc, char* argv[]);
int ps0713600(int argc, char* argv[]);
int ps0713600(int argc, char* argv[]);
int ps0713700(int argc, char* argv[]);

84
ps/ps0713700.cpp Executable file
View File

@ -0,0 +1,84 @@
#include "../cg/cglib01.h"
#include "../ca/calib01.h"
#include "../ca/movana.h"
#include "../ca/rmovana.h"
//--------------------------------------------------------------------
// APPLICAZIONE
//--------------------------------------------------------------------
class TPulisci_app : public TSkeleton_application
{
protected:
virtual const char * extra_modules() const {return "cm";} //deve funzionare anche per le commesse
virtual void main_loop();
static bool elabora_movimento(const TRelation& rel, void* pJolly);
public:
TPulisci_app() {}
virtual ~TPulisci_app() {}
};
bool TPulisci_app::elabora_movimento(const TRelation& rel, void* pJolly)
{
TAnal_mov & mov = (TAnal_mov &) rel.curr();
bool updated = false;
TImporto totdoc(mov.get_char(MOVANA_SEZIONE), mov.get_real(MOVANA_TOTDOC));
for (int i = mov.rows(); i >= 1; i--)
{
const TRectype & row = mov.body()[i];
const TString code = row.get(RMOVANA_CODCONTO);
const int gr = atoi(code.left(3));
const int co = atoi(code.mid(3, 3));
const long sc = atol(code.right(6));
const TBill zio(gr, co, sc);
if (!zio.is_analitico())
{
TImporto importo(row.get_char(RMOVANA_SEZIONE), row.get_real(RMOVANA_IMPORTO));
updated = true;
totdoc -= importo;
mov.body().destroy_row(i, true);
}
}
if (updated)
{
totdoc.normalize();
mov.put(MOVANA_SEZIONE, totdoc.sezione());
mov.put(MOVANA_TOTDOC, totdoc.valore());
if (mov.rows() > 0)
mov.rewrite(rel.lfile());
else
mov.remove(rel.lfile());
}
return true;
}
void TPulisci_app::main_loop()
{
if (ca_config().get_bool("UsePdcc") &&
yesno_box("Si desidera eliminare i conti non analitici") &&
yesno_box("Si desidera veramente eliminare i conti non analitici"))
{
TRelation rel_movana(LF_MOVANA);
TCursor cur_movana(&rel_movana, "", 1);
const long items = cur_movana.items();
if (items > 0)
{
rel_movana.lfile().set_curr(new TAnal_mov); //il record principale della rel e' un TMov_anal!!
cur_movana.scan(elabora_movimento, this, "Eliminazione conti non analitici...");
}
}
}
int ps0713700(int argc, char* argv[])
{
TPulisci_app app;
app.run(argc, argv, "Eliminazione conti non analitici...");
return 0;
}

View File

@ -1007,6 +1007,8 @@ int TVariazione_budget_mask::load_saldana(const TString& cms, const long max_num
TAssoc_array chiavi_saldana;
TToken_string chiave;
const bool exclude_fasi = get_bool(F_EXCLUDEFASI); //si vogliono escludere le fasi dalle chiavi di riga?
//riempie l'assoc_array conto/cdc/cms/fase/saldo
for (bool ok = saldana.move_first(); ok; ok = saldana.move_next())
{
@ -1022,7 +1024,9 @@ int TVariazione_budget_mask::load_saldana(const TString& cms, const long max_num
chiave.add(conto);
chiave.add(cdc);
chiave.add(cms);
chiave.add(fase);
//le fasi vanno aggiunte alla chiave solo se specificato (Adolf rikiesten 20/07/2010)
if (!exclude_fasi)
chiave.add(fase);
//se non trova la chiave la aggiunge
TImporto* s = (TImporto*)chiavi_saldana.objptr(chiave);
@ -1074,11 +1078,14 @@ int TVariazione_budget_mask::load_saldana(const TString& cms, const long max_num
const TString80 conto = key_bill.get(0);
const TString80 cdc = key_bill.get(1);
const TString80 cms = key_bill.get(2);
const TString16 fase = key_bill.get(3);
TString16 fase;
if (!exclude_fasi)
fase << key_bill.get(3);
row.add(cms, _pos_cms);
row.add(cdc, _pos_cdc);
row.add(fase, _pos_fase);
if (!exclude_fasi)
row.add(fase, _pos_fase);
row.add(conto, _pos_conto);
row.add(datacomp, _pos_datacomp);

View File

@ -6,9 +6,10 @@
#define F_PROROGATA 205
#define F_DATAPRORCMS 206
#define F_INCLUDESUPP 207
#define F_DATAREG 208
#define F_CODCAUS 209
#define F_DESCAUS 210
#define F_EXCLUDEFASI 208
#define F_DATAREG 209
#define F_CODCAUS 210
#define F_DESCAUS 211
#define F_RIGHE 220

View File

@ -55,7 +55,7 @@ ENDPAGE
PAGE "Gestione Budget" 0 2 0 0
GROUPBOX DLG_NULL 78 5
GROUPBOX DLG_NULL 78 6
BEGIN
PROMPT 0 0 "@bCommessa"
END
@ -119,21 +119,26 @@ BEGIN
PROMPT 1 3 "Includere le righe con commesse di supporto"
END
BOOLEAN F_EXCLUDEFASI
BEGIN
PROMPT 1 4 "Non considerare le fasi nei consuntivi"
END
GROUPBOX DLG_NULL 78 3
BEGIN
PROMPT 0 5 "@bParametri movimenti analitici da generare"
PROMPT 0 6 "@bParametri movimenti analitici da generare"
END
DATE F_DATAREG
BEGIN
PROMPT 1 6 "Data reg. "
PROMPT 1 7 "Data reg. "
CHECKTYPE REQUIRED
FLAGS "A"
END
STRINGA F_CODCAUS 3
BEGIN
PROMPT 24 6 "Causale "
PROMPT 24 7 "Causale "
USE LF_CAUSALI SELECT MOVIND!=""
INPUT CODCAUS F_CODCAUS
DISPLAY "Codice" CODCAUS
@ -146,7 +151,7 @@ END
STRINGA F_DESCAUS 50 37
BEGIN
PROMPT 38 6 ""
PROMPT 38 7 ""
USE LF_CAUSALI KEY 2 SELECT MOVIND!=''
INPUT DESCR F_DESCAUS
DISPLAY "Descrizione@50" DESCR
@ -157,12 +162,12 @@ END
TEXT DLG_NULL
BEGIN
PROMPT -11 8 "@bRighe movimenti di budget e saldi consuntivi"
PROMPT -11 9 "@bRighe movimenti di budget e saldi consuntivi"
END
SPREADSHEET F_RIGHE
BEGIN
PROMPT 1 9 "Righe"
PROMPT 1 10 "Righe"
ITEM "@1C"
ITEM "Commessa@20"
ITEM "Sede@4"