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:
parent
ebbec3c037
commit
7fdbb59ab5
@ -7,12 +7,13 @@ int main(int argc, char** argv)
|
|||||||
int n = argc > 1 ? atoi(argv[1]+1) : 0;
|
int n = argc > 1 ? atoi(argv[1]+1) : 0;
|
||||||
switch(n)
|
switch(n)
|
||||||
{
|
{
|
||||||
case 0: ps0713100(argc, argv); break; //Esportazione righe IVA
|
case 0: ps0713100(argc, argv); break; //Esportazione righe IVA
|
||||||
case 1: ps0713200(argc, argv); break; //Importazione commesse
|
case 1: ps0713200(argc, argv); break; //Importazione commesse
|
||||||
case 2: ps0713300(argc, argv); break; //Importazione fatture di acquisto
|
case 2: ps0713300(argc, argv); break; //Importazione fatture di acquisto
|
||||||
case 3: ps0713400(argc, argv); break; //Importazione fatture di vendita
|
case 3: ps0713400(argc, argv); break; //Importazione fatture di vendita
|
||||||
case 4: ps0713500(argc, argv); break; //Importazione spese
|
case 4: ps0713500(argc, argv); break; //Importazione spese
|
||||||
case 5: ps0713600(argc, argv); break; //Importazione fatture fornitori / fatture da ricevere
|
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
|
default: ps0713100(argc, argv); break; //Esportazione righe IVA
|
||||||
}
|
}
|
||||||
exit(0);
|
exit(0);
|
||||||
|
@ -3,4 +3,5 @@ int ps0713200(int argc, char* argv[]);
|
|||||||
int ps0713300(int argc, char* argv[]);
|
int ps0713300(int argc, char* argv[]);
|
||||||
int ps0713400(int argc, char* argv[]);
|
int ps0713400(int argc, char* argv[]);
|
||||||
int ps0713500(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
84
ps/ps0713700.cpp
Executable 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;
|
||||||
|
}
|
@ -1007,6 +1007,8 @@ int TVariazione_budget_mask::load_saldana(const TString& cms, const long max_num
|
|||||||
|
|
||||||
TAssoc_array chiavi_saldana;
|
TAssoc_array chiavi_saldana;
|
||||||
TToken_string chiave;
|
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
|
//riempie l'assoc_array conto/cdc/cms/fase/saldo
|
||||||
for (bool ok = saldana.move_first(); ok; ok = saldana.move_next())
|
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(conto);
|
||||||
chiave.add(cdc);
|
chiave.add(cdc);
|
||||||
chiave.add(cms);
|
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
|
//se non trova la chiave la aggiunge
|
||||||
TImporto* s = (TImporto*)chiavi_saldana.objptr(chiave);
|
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 conto = key_bill.get(0);
|
||||||
const TString80 cdc = key_bill.get(1);
|
const TString80 cdc = key_bill.get(1);
|
||||||
const TString80 cms = key_bill.get(2);
|
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(cms, _pos_cms);
|
||||||
row.add(cdc, _pos_cdc);
|
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(conto, _pos_conto);
|
||||||
|
|
||||||
row.add(datacomp, _pos_datacomp);
|
row.add(datacomp, _pos_datacomp);
|
||||||
|
@ -6,9 +6,10 @@
|
|||||||
#define F_PROROGATA 205
|
#define F_PROROGATA 205
|
||||||
#define F_DATAPRORCMS 206
|
#define F_DATAPRORCMS 206
|
||||||
#define F_INCLUDESUPP 207
|
#define F_INCLUDESUPP 207
|
||||||
#define F_DATAREG 208
|
#define F_EXCLUDEFASI 208
|
||||||
#define F_CODCAUS 209
|
#define F_DATAREG 209
|
||||||
#define F_DESCAUS 210
|
#define F_CODCAUS 210
|
||||||
|
#define F_DESCAUS 211
|
||||||
|
|
||||||
#define F_RIGHE 220
|
#define F_RIGHE 220
|
||||||
|
|
||||||
|
@ -55,7 +55,7 @@ ENDPAGE
|
|||||||
|
|
||||||
PAGE "Gestione Budget" 0 2 0 0
|
PAGE "Gestione Budget" 0 2 0 0
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 78 5
|
GROUPBOX DLG_NULL 78 6
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 0 0 "@bCommessa"
|
PROMPT 0 0 "@bCommessa"
|
||||||
END
|
END
|
||||||
@ -119,21 +119,26 @@ BEGIN
|
|||||||
PROMPT 1 3 "Includere le righe con commesse di supporto"
|
PROMPT 1 3 "Includere le righe con commesse di supporto"
|
||||||
END
|
END
|
||||||
|
|
||||||
|
BOOLEAN F_EXCLUDEFASI
|
||||||
|
BEGIN
|
||||||
|
PROMPT 1 4 "Non considerare le fasi nei consuntivi"
|
||||||
|
END
|
||||||
|
|
||||||
GROUPBOX DLG_NULL 78 3
|
GROUPBOX DLG_NULL 78 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 0 5 "@bParametri movimenti analitici da generare"
|
PROMPT 0 6 "@bParametri movimenti analitici da generare"
|
||||||
END
|
END
|
||||||
|
|
||||||
DATE F_DATAREG
|
DATE F_DATAREG
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 6 "Data reg. "
|
PROMPT 1 7 "Data reg. "
|
||||||
CHECKTYPE REQUIRED
|
CHECKTYPE REQUIRED
|
||||||
FLAGS "A"
|
FLAGS "A"
|
||||||
END
|
END
|
||||||
|
|
||||||
STRINGA F_CODCAUS 3
|
STRINGA F_CODCAUS 3
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 24 6 "Causale "
|
PROMPT 24 7 "Causale "
|
||||||
USE LF_CAUSALI SELECT MOVIND!=""
|
USE LF_CAUSALI SELECT MOVIND!=""
|
||||||
INPUT CODCAUS F_CODCAUS
|
INPUT CODCAUS F_CODCAUS
|
||||||
DISPLAY "Codice" CODCAUS
|
DISPLAY "Codice" CODCAUS
|
||||||
@ -146,7 +151,7 @@ END
|
|||||||
|
|
||||||
STRINGA F_DESCAUS 50 37
|
STRINGA F_DESCAUS 50 37
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 38 6 ""
|
PROMPT 38 7 ""
|
||||||
USE LF_CAUSALI KEY 2 SELECT MOVIND!=''
|
USE LF_CAUSALI KEY 2 SELECT MOVIND!=''
|
||||||
INPUT DESCR F_DESCAUS
|
INPUT DESCR F_DESCAUS
|
||||||
DISPLAY "Descrizione@50" DESCR
|
DISPLAY "Descrizione@50" DESCR
|
||||||
@ -157,12 +162,12 @@ END
|
|||||||
|
|
||||||
TEXT DLG_NULL
|
TEXT DLG_NULL
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT -11 8 "@bRighe movimenti di budget e saldi consuntivi"
|
PROMPT -11 9 "@bRighe movimenti di budget e saldi consuntivi"
|
||||||
END
|
END
|
||||||
|
|
||||||
SPREADSHEET F_RIGHE
|
SPREADSHEET F_RIGHE
|
||||||
BEGIN
|
BEGIN
|
||||||
PROMPT 1 9 "Righe"
|
PROMPT 1 10 "Righe"
|
||||||
ITEM "@1C"
|
ITEM "@1C"
|
||||||
ITEM "Commessa@20"
|
ITEM "Commessa@20"
|
||||||
ITEM "Sede@4"
|
ITEM "Sede@4"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user