Corretto il programma di aggiornamento codici attivita su progressivi

IVA: la tabella PLA (progressivi liq. ann.) non era gestita in modo
corretto.


git-svn-id: svn://10.65.10.50/trunk@3444 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
angelo 1996-08-26 08:36:58 +00:00
parent bfbd4f6293
commit 3c943886d3

View File

@ -1,6 +1,7 @@
//***************************************************** //*****************************************************
//* Aggiornamento codice attivita' su progressivi IVA * //* Aggiornamento codice attivita' su progressivi IVA *
//***************************************************** //*****************************************************
#include <prefix.h>
#include <mov.h> #include <mov.h>
#include "cg1300.h" #include "cg1300.h"
#include "cg1304.h" #include "cg1304.h"
@ -52,7 +53,7 @@ bool TAgg_codatt::menu(MENU_TAG m)
aggiorna_att("POM"); aggiorna_att("POM");
aggiorna_att("PAM"); aggiorna_att("PAM");
aggiorna_att("PPA"); aggiorna_att("PPA");
aggiorna_att("PLA"); aggiorna_att("%PLA");
aggiorna_att("PLM"); aggiorna_att("PLM");
} }
else else
@ -123,9 +124,15 @@ void TAgg_codatt::cancella_rec()
} }
} }
TTable pla("PLA"); TTable pla("%PLA");
TRecfield r_ditta(pla.curr(),"CODTAB",0,4);
const long firm = prefix().get_codditta();
for (pla.first(); !pla.eof(); pla.next()) for (pla.first(); !pla.eof(); pla.next())
{
if (firm != (long)r_ditta)
continue;
pla.remove(); pla.remove();
}
/*** /***
TTable rmb("RMB"); TTable rmb("RMB");
for (rmb.first(); !rmb.eof(); rmb.next()) for (rmb.first(); !rmb.eof(); rmb.next())
@ -135,18 +142,27 @@ void TAgg_codatt::cancella_rec()
void TAgg_codatt::aggiorna_att(const char* nome) void TAgg_codatt::aggiorna_att(const char* nome)
{ {
const bool is_pla = nome == "%PLA";
const long firm = prefix().get_codditta();
TTable tab(nome); TTable tab(nome);
tab.setkey(1); tab.setkey(1);
tab.zero(); tab.zero();
TString16 chiave; TString16 chiave;
TString16 old_att(_da); old_att.right_just(5,'0'); TString16 old_att(_da); old_att.right_just(5,'0');
TString16 new_att(_a); new_att.right_just(5,'0'); TString16 new_att(_a); new_att.right_just(5,'0');
if (is_pla) chiave << firm;
chiave << _anno << old_att; chiave << _anno << old_att;
tab.put("CODTAB", chiave); tab.put("CODTAB", chiave);
TRectype curr (tab.curr()); TRectype curr (tab.curr());
TRecfield r_ditta(tab.curr(),"CODTAB",0,4);
tab.read(_isgteq); tab.read(_isgteq);
for (; !tab.eof(); tab.next()) for (; !tab.eof(); tab.next())
{ {
if (is_pla)
{
if (firm != (long)r_ditta) break;
}
else
if (tab.curr() != curr) break; if (tab.curr() != curr) break;
const TString80 codtab = tab.get("CODTAB"); const TString80 codtab = tab.get("CODTAB");
@ -155,8 +171,13 @@ void TAgg_codatt::aggiorna_att(const char* nome)
{ {
TRectype vecchio (tab.curr()); TRectype vecchio (tab.curr());
TRectype nuovo (tab.curr()); TRectype nuovo (tab.curr());
const TString80 cc = codtab.sub(9); TString80 cc;
if (is_pla)
cc = codtab.sub(13);
else
cc = codtab.sub(9);
TString80 cod; TString80 cod;
if (is_pla) cod << firm;
cod << _anno << new_att << cc; cod << _anno << new_att << cc;
nuovo.put("CODTAB", cod); nuovo.put("CODTAB", cod);
tab.write(nuovo); tab.write(nuovo);