Patch level :2.0 454

Files correlati     :ce2.exe,ce2500a.msk
Ricompilazione Demo : [ ]
Commento            :antico OB600074 o roba simile


git-svn-id: svn://10.65.10.50/trunk@11009 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2003-04-14 15:55:23 +00:00
parent 391a5e9a50
commit aa7778d24f
5 changed files with 296 additions and 0 deletions

View File

@ -11,6 +11,7 @@ int main(int argc,char** argv)
case 1: ce2200(argc, argv); break; // Apertura nuovo esercizio
case 2: ce2300(argc, argv); break; // Collegamenti contabili
case 3: ce2400(argc, argv); break; // Generazione movimenti contabili
case 4: ce2500(argc, argv); break; // Ripristino stampa bollato
default: ce2100(argc, argv); break; // Calcolo ammortamenti
}
exit(0);

View File

@ -2,3 +2,4 @@ int ce2100(int argc, char* argv[]);
int ce2200(int argc, char* argv[]);
int ce2300(int argc, char* argv[]);
int ce2400(int argc, char* argv[]);
int ce2500(int argc, char* argv[]);

185
ce/ce2500.cpp Executable file
View File

@ -0,0 +1,185 @@
#include <applicat.h>
#include <automask.h>
#include <progind.h>
#include <recarray.h>
#include <relation.h>
#include <tabutil.h>
#include "ce2500a.h"
#include "celib.h"
#include "cespi.h"
#include "movce.h"
class TRestore_boll_mask : public TAutomask
{
protected:
virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
public:
TRestore_boll_mask() : TAutomask("ce2500a") { }
};
bool TRestore_boll_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
{
switch (o.dlg())
{
case F_ESERCIZIO:
case F_GRUPPO:
case F_SPECIE:
if (e == fe_close)
{
const int esercizio = get_int(F_ESERCIZIO);
const int gruppo = get_int(F_GRUPPO);
const TString16 specie = get(F_SPECIE);
TString80 key; key.format("%4d%02d%s",esercizio, gruppo, (const char*) specie);
const TRectype& ccb = cache().get("CCB", key);
if (ccb.get_bool("B2"))
return error_box("L'attivita' selezionata e' gia' stata chiusa. \nNon e' possibile ripristinare il bollato");
}
break;
default:
break;
}
return TRUE;
}
//===============================================================================================
class TRestore_boll : public TSkeleton_application
{
TRestore_boll_mask* _mask;
protected:
virtual void main_loop();
virtual bool create();
virtual bool destroy();
public:
void pulisci_movce();
void pulisci_ccb();
};
void TRestore_boll::pulisci_movce()
{
int ese;
TString4 gru, specie;
const TRectype& curr = ditta_cespiti().get_attivita(ese, gru, specie);
TDate inies, fines;
ditta_cespiti().esercizio_corrente(inies, fines);
//prende tutti i cespiti con gruppo/specie selezionati nel file cespi...
TRelation relcespi (LF_CESPI);
TRectype& cespi = relcespi.curr();
TRectype cespifilter (LF_CESPI);
cespifilter.put(CESPI_CODCGRA,gru);
cespifilter.put(CESPI_CODSPA,specie);
TString filtro1 = "ANSI(DTCOMP)<=";
filtro1 << fines.string(ANSI);
TCursor curcespi(&relcespi, filtro1, 2, &cespifilter, &cespifilter);
TRecnotype items = curcespi.items();
curcespi.freeze();
TRelation relmovce (LF_MOVCE);
TRectype& movce = relmovce.curr();
TCursor curmovce(&relmovce, "", 2);
TProgind barra(items, "Ripristino movimenti", FALSE, TRUE);
for(curcespi = 0; curcespi.pos() < items; ++curcespi)
{
barra.addstatus(1);
movce.zero();
movce.put(MOVCE_IDCESPITE, cespi.get(CESPI_IDCESPITE));
curmovce.setregion(movce,movce);
TRecnotype movce_items = curmovce.items();
curmovce.freeze();
//pulisce il bool per tutti i movimenti del cespite corrente..
for(curmovce = 0; curmovce.pos() < movce_items; ++curmovce)
{
const TDate dtmov = movce.get_date(MOVCE_DTMOV);
if (dtmov >= inies && dtmov <= fines)
{
movce.put(MOVCE_STAMPATO, "");
relmovce.rewrite();
}
}
curmovce.freeze(FALSE);
}
}
void TRestore_boll::pulisci_ccb()
{
int ese;
TString4 gr, sp;
const TRectype& curr = ditta_cespiti().get_attivita(ese, gr, sp);
if (!curr.empty())
{
TTable ccb ("CCB");
ccb.curr() = curr;
ccb.put("B1", "");
ccb.rewrite();
}
}
bool TRestore_boll::create()
{
open_files(LF_TAB, LF_CESPI, LF_MOVCE, 0);
_mask = new TRestore_boll_mask;
return TSkeleton_application::create();
}
bool TRestore_boll::destroy()
{
delete _mask;
return TRUE;
}
void TRestore_boll::main_loop()
{
KEY k = K_ENTER;
while (k == K_ENTER)
{
TDitta_cespiti& dc = ditta_cespiti();
dc.init_mask(*_mask);
k = _mask->run();
if (k == K_ENTER)
{
const int ese = _mask->get_int(F_ESERCIZIO);
const int gru = _mask->get_int(F_GRUPPO);
const TString& spe = _mask->get(F_SPECIE);
dc.set_attivita(ese, gru, spe);
bool ok = TRUE;
if (dc.bollato_stampato())
ok = yesno_box("Si desidera veramente ripristinare la stampa bollato:\n"
"dell' attivita' selezionata ?");
else
ok = warning_box("Il bollato dell' attivita' selezionata non risulta stampato");
if (ok)
{
pulisci_ccb();
pulisci_movce();
}
}
}
}
int ce2500(int argc, char* argv[])
{
TRestore_boll a;
a.run(argc, argv, "Ripristino stampa bollato");
return 0;
}

9
ce/ce2500a.h Executable file
View File

@ -0,0 +1,9 @@
#define F_DITTA 101
#define F_RAGSOC 102
#define F_ESERCIZIO 103
#define F_INIZIO_ES 104
#define F_FINE_ES 105
#define F_SELECT 106
#define F_GRUPPO 107
#define F_SPECIE 108
#define F_DESC_GRSP 109

100
ce/ce2500a.uml Executable file
View File

@ -0,0 +1,100 @@
#include "ce2500a.h"
TOOLBAR "Toolbar" 0 -3 0 3
BUTTON DLG_OK 10 2
BEGIN
PROMPT -12 -11 ""
END
BUTTON DLG_QUIT 10 2
BEGIN
PROMPT -22 -11 ""
END
ENDPAGE
PAGE "Ripristino stampa bollato" -1 -1 78 10
GROUPBOX DLG_NULL 78 6
BEGIN
PROMPT 0 1 "@bParametri ditta"
END
NUMBER F_DITTA 5
BEGIN
PROMPT 1 2 "Ditta "
FLAGS "DF"
END
STRING F_RAGSOC 50
BEGIN
PROMPT 26 2 ""
USE LF_NDITTE
INPUT CODDITTA F_DITTA
OUTPUT F_RAGSOC RAGSOC
CHECKTYPE NORMAL
FLAGS "D"
END
NUMBER F_ESERCIZIO 4
BEGIN
PROMPT 1 4 "Esercizio "
FLAGS "AZ"
USE CCE
JOIN ESC ALIAS 104 INTO CODTAB==CODTAB
INPUT CODTAB F_ESERCIZIO
DISPLAY "Codice esercizio" CODTAB
DISPLAY "Inizio esercizio" 104@->D0
DISPLAY "Fine esercizio" 104@->D1
OUTPUT F_ESERCIZIO CODTAB
OUTPUT F_INIZIO_ES 104@->D0
OUTPUT F_FINE_ES 104@->D1
CHECKTYPE REQUIRED
END
DATE F_INIZIO_ES
BEGIN
PROMPT 26 4 "Inizio "
FLAGS "D"
END
DATE F_FINE_ES
BEGIN
PROMPT 50 4 "Fine "
FLAGS "D"
END
NUMBER F_GRUPPO 2
BEGIN
PROMPT 1 5 "Gruppo "
FLAGS "Z"
END
STRING F_SPECIE 4
BEGIN
PROMPT 16 5 "Specie "
FLAGS "_"
USE CCB
JOIN %CAT ALIAS 400 INTO CODTAB=CODTAB[5,10]
INPUT CODTAB[1,4] F_ESERCIZIO SELECT
INPUT CODTAB[5,6] F_GRUPPO
INPUT CODTAB[7,10] F_SPECIE
DISPLAY "Gruppo" CODTAB[5,6]
DISPLAY "Specie" CODTAB[7,10]
DISPLAY "Descrizione@50" 400@->S0
OUTPUT F_GRUPPO CODTAB[5,6]
OUTPUT F_SPECIE CODTAB[7,10]
OUTPUT F_DESC_GRSP 400@->S0
CHECKTYPE FORCED
END
STRING F_DESC_GRSP 60 45
BEGIN
PROMPT 31 5 ""
FLAGS "D"
END
ENDPAGE
ENDMASK