Corretto errore
git-svn-id: svn://10.65.10.50/trunk@1653 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
abbe16b456
commit
3821817225
322
cg/cg1302.cpp
322
cg/cg1302.cpp
@ -1,159 +1,163 @@
|
|||||||
//****************************
|
//****************************
|
||||||
//* Aggiornamento Tipo Conto *
|
//* Aggiornamento Tipo Conto *
|
||||||
//****************************
|
//****************************
|
||||||
#include <mov.h>
|
#include <mov.h>
|
||||||
#include <rmoviva.h>
|
#include <rmoviva.h>
|
||||||
#include <nditte.h>
|
#include <nditte.h>
|
||||||
#include "conto.h"
|
#include "conto.h"
|
||||||
#include "cg1302.h"
|
#include "cg1302.h"
|
||||||
|
|
||||||
const int TAgg_tconto::look_reg (const char* cod, int anno)
|
const int TAgg_tconto::look_reg (const char* cod, int anno)
|
||||||
{
|
{
|
||||||
TTable tab_reg("REG");
|
TTable tab_reg("REG");
|
||||||
TString codtab;
|
TString codtab;
|
||||||
codtab.format("%4d%-3s", anno, cod);
|
codtab.format("%4d%-3s", anno, cod);
|
||||||
int tipo_reg;
|
int tipo_reg;
|
||||||
|
|
||||||
tab_reg.zero();
|
tab_reg.zero();
|
||||||
tab_reg.put("CODTAB", codtab);
|
tab_reg.put("CODTAB", codtab);
|
||||||
if (tab_reg.read() == NOERR)
|
if (tab_reg.read() == NOERR)
|
||||||
tipo_reg = tab_reg.get_int("I0");
|
tipo_reg = tab_reg.get_int("I0");
|
||||||
else
|
else
|
||||||
tipo_reg = 0;
|
tipo_reg = 0;
|
||||||
|
|
||||||
return tipo_reg;
|
return tipo_reg;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TAgg_tconto::user_create()
|
bool TAgg_tconto::user_create()
|
||||||
{
|
{
|
||||||
_rel = new TRelation(LF_MOV);
|
_rel = new TRelation(LF_MOV);
|
||||||
_rel->add(LF_RMOVIVA, "NUMREG=NUMREG",1);
|
_rel->add(LF_RMOVIVA, "NUMREG=NUMREG",1);
|
||||||
_cur = new TCursor(_rel,"",1);
|
_cur = new TCursor(_rel,"",1);
|
||||||
add_cursor(_cur);
|
add_cursor(_cur);
|
||||||
|
|
||||||
add_file (LF_MOV);
|
add_file (LF_MOV);
|
||||||
add_file (LF_RMOVIVA);
|
add_file (LF_RMOVIVA);
|
||||||
|
|
||||||
_pcon = new TLocalisamfile(LF_PCON);
|
_pcon = new TLocalisamfile(LF_PCON);
|
||||||
_nditte = new TLocalisamfile(LF_NDITTE);
|
_nditte = new TLocalisamfile(LF_NDITTE);
|
||||||
_tabreg = new TTable("REG");
|
_tabreg = new TTable("REG");
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TAgg_tconto::user_destroy()
|
bool TAgg_tconto::user_destroy()
|
||||||
{
|
{
|
||||||
delete _rel;
|
delete _rel;
|
||||||
delete _cur;
|
delete _cur;
|
||||||
delete _pcon;
|
delete _pcon;
|
||||||
delete _nditte;
|
delete _nditte;
|
||||||
delete _tabreg;
|
delete _tabreg;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TAgg_tconto::set_print(int)
|
bool TAgg_tconto::set_print(int)
|
||||||
{
|
{
|
||||||
TMask msk("cg1300a");
|
TMask msk("cg1300a");
|
||||||
|
|
||||||
while (msk.run() == K_ENTER)
|
while (msk.run() == K_ENTER)
|
||||||
{
|
{
|
||||||
setta_intestazione();
|
setta_intestazione();
|
||||||
printer().footerlen(5);
|
printer().footerlen(5);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TAgg_tconto::preprocess_page(int file,int counter)
|
void TAgg_tconto::postclose_print()
|
||||||
{
|
{
|
||||||
if (counter) return TRUE;
|
message_box("Aggiornamento tipo conto completato");
|
||||||
|
}
|
||||||
TCursor* cur = current_cursor();
|
|
||||||
if (file == LF_MOV)
|
bool TAgg_tconto::preprocess_page(int file,int counter)
|
||||||
{
|
{
|
||||||
TString16 reg = cur->curr().get(MOV_REG);
|
if (counter) return TRUE;
|
||||||
if (reg.empty()) return FALSE;
|
|
||||||
}
|
TCursor* cur = current_cursor();
|
||||||
else if (file == LF_RMOVIVA)
|
if (file == LF_MOV)
|
||||||
{
|
{
|
||||||
TRectype pcon(LF_PCON);
|
TString16 reg = cur->curr().get(MOV_REG);
|
||||||
int gruppo = cur->curr(LF_RMOVIVA).get_int(RMI_GRUPPO);
|
if (reg.empty()) return FALSE;
|
||||||
int conto = cur->curr(LF_RMOVIVA).get_int(RMI_CONTO);
|
}
|
||||||
long sottoconto = cur->curr(LF_RMOVIVA).get_long(RMI_SOTTOCONTO);
|
else if (file == LF_RMOVIVA)
|
||||||
long numreg = cur->curr(LF_RMOVIVA).get_long(RMI_NUMREG);
|
{
|
||||||
int nrigimp = cur->curr(LF_RMOVIVA).get_int("RIGAIMP");
|
TRectype pcon(LF_PCON);
|
||||||
|
int gruppo = cur->curr(LF_RMOVIVA).get_int(RMI_GRUPPO);
|
||||||
TBill tc (gruppo,conto,0L);
|
int conto = cur->curr(LF_RMOVIVA).get_int(RMI_CONTO);
|
||||||
tc.read(pcon);
|
long sottoconto = cur->curr(LF_RMOVIVA).get_long(RMI_SOTTOCONTO);
|
||||||
if (!pcon.empty())
|
long numreg = cur->curr(LF_RMOVIVA).get_long(RMI_NUMREG);
|
||||||
if (pcon.get_char("TMCF") != '\0')
|
int nrigimp = cur->curr(LF_RMOVIVA).get_int("RIGAIMP");
|
||||||
return FALSE;
|
|
||||||
|
TBill tc (gruppo,conto,0L);
|
||||||
tc.set(gruppo,conto,sottoconto);
|
tc.read(pcon);
|
||||||
tc.read(pcon);
|
if (!pcon.empty())
|
||||||
if (!pcon.empty())
|
if (pcon.get_char("TMCF") != '\0')
|
||||||
{
|
return FALSE;
|
||||||
if (tc.sospeso())
|
|
||||||
{
|
tc.set(gruppo,conto,sottoconto);
|
||||||
set_row(1, "@4g%7ld@23g%3d@31g%3d@37g%3d@45g%6ld ** Conto sospeso **",
|
tc.read(pcon);
|
||||||
numreg, nrigimp, gruppo, conto, sottoconto);
|
if (!pcon.empty())
|
||||||
return TRUE;
|
{
|
||||||
}
|
if (tc.sospeso())
|
||||||
TString16 reg = cur->curr().get(MOV_REG);
|
{
|
||||||
int annoiva = cur->curr().get_int(MOV_ANNOIVA);
|
set_row(1, "@4g%7ld@23g%3d@31g%3d@37g%3d@45g%6ld ** Conto sospeso **",
|
||||||
if (look_reg(reg, annoiva) == 1) //cerca il tipo del registro
|
numreg, nrigimp, gruppo, conto, sottoconto);
|
||||||
{
|
return TRUE;
|
||||||
int t = tc.tipo_cr();
|
}
|
||||||
if (t == 2 || t == 3 || t == 8)
|
int t = tc.tipo_cr();
|
||||||
{
|
TString16 reg = cur->curr().get(MOV_REG);
|
||||||
_rel->lfile(LF_RMOVIVA).put(RMI_TIPOCR, 4);
|
int annoiva = cur->curr().get_int(MOV_ANNOIVA);
|
||||||
_rel->lfile(LF_RMOVIVA).rewrite();
|
const int tipo = look_reg(reg, annoiva); //cerca il tipo del registro
|
||||||
}
|
//aggiorno sul movimento iva il tipo costo/ricavo
|
||||||
}
|
//con quello letto dal piano conti
|
||||||
}
|
_rel->lfile(LF_RMOVIVA).put(RMI_TIPOCR, t);
|
||||||
else
|
if (tipo == 1 && (t == 2 || t == 3))
|
||||||
{
|
_rel->lfile(LF_RMOVIVA).put(RMI_TIPOCR, 4);
|
||||||
set_row(1, "@4g%7ld@23g%3d@31g%3d@37g%3d@45g%6ld ** Conto inesistente **",
|
_rel->lfile(LF_RMOVIVA).rewrite();
|
||||||
numreg, nrigimp, gruppo, conto, sottoconto);
|
}
|
||||||
return TRUE;
|
else
|
||||||
}
|
{
|
||||||
return FALSE;
|
set_row(1, "@4g%7ld@23g%3d@31g%3d@37g%3d@45g%6ld ** Conto inesistente **",
|
||||||
}
|
numreg, nrigimp, gruppo, conto, sottoconto);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
return FALSE;
|
||||||
void TAgg_tconto::setta_intestazione()
|
}
|
||||||
{
|
return TRUE;
|
||||||
int soh = 1;
|
}
|
||||||
TString sep(132);
|
|
||||||
TString ragsoc(50);
|
void TAgg_tconto::setta_intestazione()
|
||||||
|
{
|
||||||
TLocalisamfile nditte(LF_NDITTE);
|
int soh = 1;
|
||||||
nditte.zero();
|
TString sep(132);
|
||||||
nditte.put(NDT_CODDITTA, get_firm());
|
TString ragsoc(50);
|
||||||
if (nditte.read() == NOERR)
|
|
||||||
ragsoc = nditte.get(NDT_RAGSOC);
|
TLocalisamfile nditte(LF_NDITTE);
|
||||||
|
nditte.zero();
|
||||||
reset_header();
|
nditte.put(NDT_CODDITTA, get_firm());
|
||||||
|
if (nditte.read() == NOERR)
|
||||||
sep << "Ditta " << get_firm();
|
ragsoc = nditte.get(NDT_RAGSOC);
|
||||||
sep << " " << ragsoc;
|
|
||||||
|
reset_header();
|
||||||
sep.left_just(132);
|
|
||||||
|
sep << "Ditta " << get_firm();
|
||||||
set_header (soh++, (const char*) sep);
|
sep << " " << ragsoc;
|
||||||
|
|
||||||
sep = "";
|
sep.left_just(132);
|
||||||
sep << "Data @< Pag. @#";
|
|
||||||
|
set_header (soh++, (const char*) sep);
|
||||||
sep.right_just(127);
|
|
||||||
|
sep = "";
|
||||||
sep.overwrite ("AGGIORNAMENTO TIPO CONTO SU MOVIMENTI IVA - Lista errori");
|
sep << "Data @< Pag. @#";
|
||||||
set_header (soh++, (const char*)sep);
|
|
||||||
sep.fill('-');
|
sep.right_just(127);
|
||||||
set_header (soh++, (const char *) sep);
|
|
||||||
set_header (soh++, "Numero Registrazione Riga Gruppo Conto Sottoconto");
|
sep.overwrite ("AGGIORNAMENTO TIPO CONTO SU MOVIMENTI IVA - Lista errori");
|
||||||
set_header (soh++, (const char *) sep);
|
set_header (soh++, (const char*)sep);
|
||||||
set_header (soh, "");
|
sep.fill('-');
|
||||||
}
|
set_header (soh++, (const char *) sep);
|
||||||
|
set_header (soh++, "Numero Registrazione Riga Gruppo Conto Sottoconto");
|
||||||
|
set_header (soh++, (const char *) sep);
|
||||||
|
set_header (soh, "");
|
||||||
|
}
|
||||||
|
55
cg/cg1302.h
55
cg/cg1302.h
@ -1,27 +1,28 @@
|
|||||||
#include <printapp.h>
|
#include <printapp.h>
|
||||||
#include <mask.h>
|
#include <mask.h>
|
||||||
#include <tabutil.h>
|
#include <tabutil.h>
|
||||||
#include <utility.h>
|
#include <utility.h>
|
||||||
#include <progind.h>
|
#include <progind.h>
|
||||||
#include <urldefid.h>
|
#include <urldefid.h>
|
||||||
#include <prefix.h>
|
#include <prefix.h>
|
||||||
|
|
||||||
class TAgg_tconto : public TPrintapp
|
class TAgg_tconto : public TPrintapp
|
||||||
{
|
{
|
||||||
TLocalisamfile* _pcon,* _nditte;
|
TLocalisamfile* _pcon,* _nditte;
|
||||||
TTable* _tabreg;
|
TTable* _tabreg;
|
||||||
TRelation* _rel;
|
TRelation* _rel;
|
||||||
TCursor* _cur;
|
TCursor* _cur;
|
||||||
|
|
||||||
public:
|
public:
|
||||||
virtual bool user_create();
|
virtual bool user_create();
|
||||||
virtual bool user_destroy();
|
virtual bool user_destroy();
|
||||||
virtual bool set_print(int i);
|
virtual bool set_print(int i);
|
||||||
virtual bool preprocess_page(int, int);
|
virtual bool preprocess_page(int, int);
|
||||||
|
virtual void postclose_print();
|
||||||
void setta_intestazione();
|
|
||||||
const int look_reg(const char*, int);
|
void setta_intestazione();
|
||||||
|
const int look_reg(const char*, int);
|
||||||
TAgg_tconto() {};
|
|
||||||
virtual ~TAgg_tconto() {};
|
TAgg_tconto() {};
|
||||||
};
|
virtual ~TAgg_tconto() {};
|
||||||
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user