Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/branches/R_10_00@21966 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
luca 2011-04-18 10:10:12 +00:00
parent 1093d0f3b0
commit fbe6a5c729
6 changed files with 50 additions and 15 deletions

View File

@ -5,6 +5,8 @@
#include <recset.h>
#include <tabutil.h>
#include "halib.h"
#include "hatbatt.h"
#include "hatbcau.h"
#include "hatbcel.h"
@ -52,21 +54,13 @@ bool THA_table_app::get_next_key(TToken_string& key)
const TString& codart = curr_mask().get(F_CODART);
if (codart.full())
{
TString query;
query << "USE &ATT";
query << "\nFROM CODTAB=#CODTAB";
query << "\nTO CODTAB=#CODTAB";
TISAM_recordset recset(query);
recset.set_var("#CODTAB", codart);
long last_prog = 0;
if (recset.move_last())
last_prog = recset.get("CODTAB[6,12]").as_int();
const TString& codtab = get_next_att_key(codart);
//riempie la token_string con i dati richiesti
key.add(F_CODART);
key.add(codart);
key.add(F_PROGRESSIVO);
key.add(last_prog + 1);
key.add(codtab.mid(5));
}
return true;
}

View File

@ -9,6 +9,7 @@
#include <rdoc.h>
#include <../ve/velib.h>
#include "halib.h"
#include "ha3800a.h"
//////////////////////////////////////////////
@ -159,7 +160,7 @@ void TInserimento_storico::elabora(const TMask& mask)
//..per quanto riguarda il progressivo)
if (err != NOERR)
{
codtab.format("%-5s%07d", (const char*)codart, 1);
codtab = get_next_att_key(codart);
tab_att.put("CODTAB", codtab);
}
//comunque deve scrivere il cliente e la data perchè è un'apertura quindi la macchina è assegnata..

View File

@ -129,6 +129,7 @@ BEGIN
DISPLAY "Cliente" I0
COPY OUTPUT F_PROGRESSIVO
CHECKTYPE SEARCH
FIELD S1
END
@ -442,12 +443,13 @@ ENDPAGE
ENDMASK
/*
Mappa campi sul file TABMOD:
----------------------------
Mappa campi sul file TABMOD (tabella &HIS):
-------------------------------------------
CODTAB[1,5] = codart (A)
CODTAB[6,12] = progressivo (N z)
CODTAB[13,17] = numero riga (N z)
S0 = descrizione
S1[1,10] = cpdice cespite (A)
S3[1,5] = codart collegato
S4[1,4] = anno doc. apertura (N)
S4[5,8] = numerazione doc. apertura (A)
@ -458,7 +460,7 @@ S5[9,15] = numero doc. chiusura (N)
S6[1,2] = umqta
S7[1,1] = tipo
S7[2,4] = codmag
I0 = codice cliente (N)
I0 = codice cliente
R0 = quantita
R1 = importo
D0 = data intervento

View File

@ -494,3 +494,27 @@ void hd_key2conto(const TString& key, int& gr, int& co, long& so)
co = atoi(key.mid(3,2));
so = atoi(key.mid(5,3));
}
const TString& get_next_att_key(const TString& codart)
{
if (codart.full())
{
CHECKS(codart.len() <= 5, "Ma che cavolo di codice articolo mi stai passando Willis?", (const char*)codart);
TString query;
query << "USE &ATT";
query << "\nFROM CODTAB=#CODTAB";
query << "\nTO CODTAB=#CODTAB";
TISAM_recordset recset(query);
recset.set_var("#CODTAB", codart);
long last_prog = 0;
if (recset.move_last())
last_prog = recset.get("CODTAB[6,12]").as_int();
TString& codtab = get_tmp_string();
codtab.format("%-5s%07d", (const char*)codart, last_prog + 1);
return codtab;
}
return EMPTY_STRING;
}

View File

@ -236,3 +236,4 @@ const TDate upload_format_date6(const TString& str_data);
long hd_key2cli(const TString& key);
long hd_key2forn(const TString& key);
void hd_key2conto(const TString& key, int& gr, int& co, long& so);
const TString& get_next_att_key(const TString& codart);

View File

@ -162,4 +162,17 @@ END
ENDPAGE
ENDMASK
ENDMASK
/*
Mappa campi sul file TABMOD (tabella &ATT):
-------------------------------------------
CODTAB[1,5] = codart (A)
CODTAB[6,12] = progressivo (N z)
S0[1,5] = codart per matricola (A)
S0[6,20] = matricola (A)
S1[1,10] = codice cespite (A)
I0 = codice cliente
D0 = data assegnamento
D1 = data fabbricazione
*/