1999-07-16 14:59:11 +00:00
|
|
|
|
#include "dblib.h"
|
1999-04-06 15:34:39 +00:00
|
|
|
|
#include "dbcv09.h"
|
1999-07-16 14:59:11 +00:00
|
|
|
|
#include "dbcv00a.h"
|
|
|
|
|
#include <relation.h>
|
|
|
|
|
#include "..\mg\anamag.h"
|
|
|
|
|
|
|
|
|
|
void delete_files(const char *wild)
|
|
|
|
|
{
|
|
|
|
|
TString_array transactions;
|
|
|
|
|
list_files(wild, transactions);
|
|
|
|
|
FOR_EACH_ARRAY_ROW(transactions, row, name)
|
|
|
|
|
remove(*name);
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// ******************************************
|
1999-07-16 14:59:11 +00:00
|
|
|
|
bool force_write(TLocalisamfile & f)
|
|
|
|
|
{
|
|
|
|
|
int err=f.write();
|
|
|
|
|
if (err != NOERR) // fallisce se c'e' gia'
|
|
|
|
|
err=f.rewrite();
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// ******************************************
|
1999-07-16 14:59:11 +00:00
|
|
|
|
long method2location(int method)
|
|
|
|
|
{
|
|
|
|
|
switch (method)
|
|
|
|
|
{
|
|
|
|
|
case 0: return 0;
|
|
|
|
|
case 1: return 1530;
|
|
|
|
|
case 2: return 59;
|
|
|
|
|
case 3: return 2008;
|
|
|
|
|
case 4: return 63;
|
|
|
|
|
case 5: return 872;
|
|
|
|
|
case 6: return 66;
|
|
|
|
|
case 7: return 1700;
|
|
|
|
|
case 8: return 115;
|
|
|
|
|
case 9: return 935;
|
|
|
|
|
case 10: return 911;
|
|
|
|
|
case 11: return 1812;
|
|
|
|
|
case 12: return 230;
|
|
|
|
|
case 13: return 433;
|
|
|
|
|
case 14: return 272;
|
|
|
|
|
case 15: return 1382;
|
|
|
|
|
case 16: return 467;
|
|
|
|
|
case 17: return 1352;
|
|
|
|
|
case 18: return 233;
|
|
|
|
|
case 19: return 498;
|
|
|
|
|
case 20: return 651;
|
|
|
|
|
case 21: return 511;
|
|
|
|
|
case 22: return 519;
|
|
|
|
|
case 23: return 2017;
|
|
|
|
|
case 24: return 798;
|
|
|
|
|
case 25: return 582;
|
|
|
|
|
case 26: return 618;
|
|
|
|
|
case 27: return 1190;
|
|
|
|
|
case 28: return 1360;
|
|
|
|
|
case 29: return 1727;
|
|
|
|
|
case 30: return 2081;
|
|
|
|
|
case 31: return 1330;
|
|
|
|
|
case 32: return 565;
|
|
|
|
|
case 33: return 2079;
|
|
|
|
|
case 34: return 2194;
|
|
|
|
|
case 35: return 229;
|
|
|
|
|
case 36: return 2280;
|
|
|
|
|
case 37: return 60;
|
|
|
|
|
case 38: return 50037;
|
|
|
|
|
case 39: return 1154;
|
|
|
|
|
case 40: return 2153;
|
|
|
|
|
case 41: return 1569; // M&M srl
|
|
|
|
|
case 42: return 1569;
|
|
|
|
|
case 43: return 2237;
|
|
|
|
|
case 44: return 2668; // rotolito
|
|
|
|
|
case 45: return -3; // sconfezionamento
|
|
|
|
|
}
|
|
|
|
|
return -99; // terzista generico
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
int location2method(long location)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
|
|
|
|
switch (location)
|
|
|
|
|
{
|
|
|
|
|
case 0: return 0;
|
|
|
|
|
case 1530: return 1;
|
|
|
|
|
case 59: return 2;
|
|
|
|
|
case 2008: return 3;
|
|
|
|
|
case 63: return 4;
|
|
|
|
|
case 872: return 5;
|
|
|
|
|
case 66: return 6;
|
|
|
|
|
case 1700: return 7;
|
|
|
|
|
case 115: return 8;
|
|
|
|
|
case 935: return 9;
|
|
|
|
|
case 911: return 10;
|
|
|
|
|
case 1812: return 11;
|
|
|
|
|
case 230: return 12;
|
|
|
|
|
case 433: return 13;
|
|
|
|
|
case 272: return 14;
|
|
|
|
|
case 1382: return 15;
|
|
|
|
|
case 467: return 16;
|
|
|
|
|
case 1352: return 17;
|
|
|
|
|
case 233: return 18;
|
|
|
|
|
case 498: return 19;
|
|
|
|
|
case 651: return 20;
|
|
|
|
|
case 511: return 21;
|
|
|
|
|
case 519: return 22;
|
|
|
|
|
case 2017: return 23;
|
|
|
|
|
case 798: return 24;
|
|
|
|
|
case 582: return 25;
|
|
|
|
|
case 618: return 26;
|
|
|
|
|
case 1190: return 27;
|
|
|
|
|
case 1360: return 28;
|
|
|
|
|
case 1727: return 29;
|
|
|
|
|
case 2081: return 30;
|
|
|
|
|
case 1330: return 31;
|
|
|
|
|
case 565: return 32;
|
|
|
|
|
case 2079: return 33;
|
|
|
|
|
case 2194: return 34;
|
|
|
|
|
case 229: return 35;
|
|
|
|
|
case 2280: return 36;
|
|
|
|
|
case 60: return 37;
|
|
|
|
|
case 50037: return 38;
|
|
|
|
|
case 1154: return 39;
|
|
|
|
|
case 2153: return 40;
|
|
|
|
|
case -1: return 41; // M&M srl
|
|
|
|
|
case 1569: return 42;
|
|
|
|
|
case 2237: return 43;
|
1999-07-16 14:59:11 +00:00
|
|
|
|
case 2668: return 44; // ??
|
1999-04-06 15:34:39 +00:00
|
|
|
|
case -3: return 45; // sconfezionamento
|
1999-07-16 14:59:11 +00:00
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
return 99; // terzista generico
|
|
|
|
|
}
|
|
|
|
|
|
1999-07-16 14:59:11 +00:00
|
|
|
|
void delete_boms(bool lavsexcl,bool onlylavs)
|
|
|
|
|
{
|
|
|
|
|
TWait_cursor hourglass;
|
|
|
|
|
TIndwin info(60,"Cancellazione distinte...",FALSE,FALSE);
|
|
|
|
|
TLocalisamfile dist(LF_DIST);
|
|
|
|
|
TLocalisamfile rdist(LF_RDIST);
|
|
|
|
|
// distinte
|
|
|
|
|
for (long i=dist.items(); i>0; i--)
|
|
|
|
|
{
|
|
|
|
|
dist.readat(i);
|
|
|
|
|
const bool is_lav=!cache().get("LAV",dist.get("CODDIST")).empty();
|
|
|
|
|
if (lavsexcl==!is_lav || onlylavs==is_lav)
|
|
|
|
|
{
|
|
|
|
|
// non e' una lavorazione
|
|
|
|
|
dist.remove();
|
|
|
|
|
}
|
|
|
|
|
if ((i%TICK)==0)
|
|
|
|
|
do_events();
|
|
|
|
|
}
|
|
|
|
|
// righe distinte
|
|
|
|
|
for (i=rdist.items(); i>0; i--)
|
|
|
|
|
{
|
|
|
|
|
rdist.readat(i);
|
|
|
|
|
const bool is_lav=!(rdist.get("TIPO")!="L");
|
|
|
|
|
if (lavsexcl==!is_lav || onlylavs==is_lav)
|
|
|
|
|
{
|
|
|
|
|
// non e' una lavorazione
|
|
|
|
|
rdist.remove();
|
|
|
|
|
}
|
|
|
|
|
if ((i%TICK)==0)
|
|
|
|
|
do_events();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
const char * descr_method(int method)
|
|
|
|
|
{
|
|
|
|
|
switch (method)
|
|
|
|
|
{
|
|
|
|
|
case 1: return ("Areosol lab. Italia");
|
1999-07-16 14:59:11 +00:00
|
|
|
|
case 2: return ("Areosol service Italia");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
case 3: return ("Bertoncini");
|
|
|
|
|
case 4: return ("Bregaglio");
|
|
|
|
|
case 5: return ("CABL service");
|
|
|
|
|
case 6: return ("CIP4");
|
|
|
|
|
case 7: return ("Stabilimenti Cover di PD/PR");
|
|
|
|
|
case 8: return ("Deskin");
|
|
|
|
|
case 9: return ("Farmol Safca");
|
|
|
|
|
case 10: return ("FATAI Nyl");
|
|
|
|
|
case 11: return ("Hydra Farm.");
|
|
|
|
|
case 12: return ("IMAPACK");
|
|
|
|
|
case 13: return ("Interchem Italia");
|
|
|
|
|
case 14: return ("Ivers Lee Italia");
|
|
|
|
|
case 15: return ("Liquichim");
|
|
|
|
|
case 16: return ("Manilab");
|
|
|
|
|
case 17: return ("MP");
|
|
|
|
|
case 18: return ("Niada");
|
|
|
|
|
case 19: return ("Noviplast");
|
|
|
|
|
case 20: return ("OCE");
|
|
|
|
|
case 21: return ("Pantapack");
|
|
|
|
|
case 22: return ("PimepackDue");
|
|
|
|
|
case 23: return ("Pernici Cereira");
|
|
|
|
|
case 24: return ("Re.Le.Vi.");
|
|
|
|
|
case 25: return ("Synthesis");
|
|
|
|
|
case 26: return ("Treccificio BS");
|
|
|
|
|
case 27: return ("Tosvar Areosol");
|
|
|
|
|
case 28: return ("Unifill");
|
|
|
|
|
case 29: return ("Unispray");
|
|
|
|
|
case 30: return ("Artical");
|
|
|
|
|
case 31: return ("La cosmografica");
|
|
|
|
|
case 32: return ("Chizzoni");
|
|
|
|
|
case 33: return ("E.Bonetto Lito");
|
|
|
|
|
case 34: return ("CT Service srl");
|
|
|
|
|
case 35: return ("M&M sas");
|
|
|
|
|
case 36: return ("Brelil");
|
|
|
|
|
case 37: return ("Akronimex");
|
|
|
|
|
case 38: return ("Globol UK");
|
1999-07-16 14:59:11 +00:00
|
|
|
|
case 39: return ("Lito Sestese");
|
1999-04-06 15:34:39 +00:00
|
|
|
|
case 40: return ("Serialfa");
|
|
|
|
|
case 41: return ("M&M"); // M&M srl
|
|
|
|
|
case 42: return ("M&M srl");
|
|
|
|
|
case 43: return ("ERREDI ser. srl");
|
|
|
|
|
case 44: return ("Rotolito"); // rotolito
|
|
|
|
|
}
|
|
|
|
|
return "-- Unknown --";
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void num_mag2main_imp(int magno, TString & codimp)
|
|
|
|
|
{
|
|
|
|
|
switch (magno)
|
|
|
|
|
{
|
1999-07-16 14:59:11 +00:00
|
|
|
|
case 91: // magazzino terzisti (suddiviso in locazioni)
|
|
|
|
|
case 93: // magazzino terzisti (suddiviso in locazioni)
|
|
|
|
|
case 25: // magazzino DI FATTURAZIONE
|
|
|
|
|
case 26: // magazzino interno
|
1999-04-06 15:34:39 +00:00
|
|
|
|
codimp="SE";
|
|
|
|
|
break;
|
1999-07-16 14:59:11 +00:00
|
|
|
|
case 92: // magazzino terzisti (suddiviso in locazioni)
|
|
|
|
|
case 27: // magazzino DI FATTURAZIONE
|
|
|
|
|
case 28: // magazzino interno
|
1999-04-06 15:34:39 +00:00
|
|
|
|
codimp="TS";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
codimp="XX";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void complete_gmc(TString & gmc,const char *iclas)
|
|
|
|
|
{
|
|
|
|
|
TString des;
|
|
|
|
|
TString16 subgmc(iclas);
|
|
|
|
|
char type;
|
|
|
|
|
if (subgmc=="AM") {
|
|
|
|
|
type = 'H';
|
|
|
|
|
des="Ambipur";
|
|
|
|
|
} else if (subgmc=="IN") {
|
|
|
|
|
type = 'H';
|
|
|
|
|
des="Ambipur";
|
|
|
|
|
} else if (subgmc=="KM") {
|
|
|
|
|
type = 'H';
|
|
|
|
|
des="Kiwi Mobili";
|
|
|
|
|
} else if (subgmc=="KS") {
|
|
|
|
|
type = 'H';
|
|
|
|
|
des="Kiwi Shoecare";
|
|
|
|
|
} else if (subgmc=="OS") {
|
|
|
|
|
type = 'H';
|
|
|
|
|
des="Shoe care generico";
|
|
|
|
|
} else if (subgmc=="PV") {
|
|
|
|
|
type = 'H';
|
|
|
|
|
des="Pulizia vetri";
|
|
|
|
|
} else if (subgmc=="HA") {
|
|
|
|
|
type = 'H';
|
|
|
|
|
des="House care generico";
|
|
|
|
|
} else if (subgmc=="OC") {
|
|
|
|
|
type = 'O';
|
|
|
|
|
des="Oral care generico";
|
|
|
|
|
} else if (subgmc=="SB") {
|
|
|
|
|
type = 'O';
|
|
|
|
|
des="Oral care Smithcline Beecham";
|
|
|
|
|
} else if (subgmc=="AV") {
|
|
|
|
|
type = 'P';
|
|
|
|
|
des="Acqua Velva";
|
|
|
|
|
} else if (subgmc=="BA") {
|
|
|
|
|
type = 'P';
|
|
|
|
|
des="Badedas";
|
|
|
|
|
} else if (subgmc=="BR") {
|
|
|
|
|
type = 'P';
|
|
|
|
|
des="Brylcreem";
|
|
|
|
|
} else if (subgmc=="DE") {
|
|
|
|
|
type = 'P';
|
|
|
|
|
des="Depilzero ";
|
|
|
|
|
} else if (subgmc=="FB") {
|
|
|
|
|
type = 'P';
|
|
|
|
|
des="Fissan Baby";
|
|
|
|
|
} else if (subgmc=="FO") {
|
|
|
|
|
type = 'P';
|
|
|
|
|
des="Fissan body generico";
|
|
|
|
|
} else if (subgmc=="GL") {
|
|
|
|
|
type = 'P';
|
|
|
|
|
des="Glysolid";
|
|
|
|
|
} else if (subgmc=="GP") {
|
|
|
|
|
type = 'P';
|
|
|
|
|
des="General purpose personal case";
|
|
|
|
|
} else if (subgmc=="OB") {
|
|
|
|
|
type = 'P';
|
|
|
|
|
des="Personal care generico";
|
|
|
|
|
} else if (subgmc=="QU") {
|
|
|
|
|
type = 'P';
|
|
|
|
|
des="Quickies";
|
|
|
|
|
} else if (subgmc=="SA") {
|
|
|
|
|
type = 'P';
|
|
|
|
|
des="Savane";
|
|
|
|
|
} else if (subgmc=="SO") {
|
|
|
|
|
type = 'P';
|
|
|
|
|
des="Super soap";
|
|
|
|
|
} else if (subgmc=="SX") {
|
|
|
|
|
type = 'P';
|
|
|
|
|
des="Sanex";
|
|
|
|
|
} else if (subgmc=="WI") {
|
|
|
|
|
type = 'P';
|
|
|
|
|
des="Williams";
|
|
|
|
|
} else
|
|
|
|
|
return;
|
|
|
|
|
gmc << type << 'C';
|
|
|
|
|
if (cache().get("GMC",gmc).empty())
|
|
|
|
|
{
|
|
|
|
|
cache().discard("GMC",gmc);
|
|
|
|
|
TTable ttt("GMC");
|
|
|
|
|
ttt.put("CODTAB",gmc);
|
|
|
|
|
ttt.put("S0",type=='H' ? "House care" : (type=='P' ? "Personal care" :"Oral care"));
|
|
|
|
|
ttt.write();
|
|
|
|
|
}
|
|
|
|
|
gmc << subgmc;
|
|
|
|
|
if (cache().get("GMC",gmc).empty())
|
|
|
|
|
{
|
|
|
|
|
cache().discard("GMC",gmc);
|
|
|
|
|
TTable ttt("GMC");
|
|
|
|
|
ttt.put("CODTAB",gmc);
|
|
|
|
|
ttt.put("S0",des);
|
|
|
|
|
ttt.write();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
const char * check_clasdog(long stdo)
|
|
|
|
|
{
|
|
|
|
|
static TString cld;
|
|
|
|
|
if (stdo)
|
|
|
|
|
{
|
|
|
|
|
cld.format("%010ld",stdo);
|
|
|
|
|
if (cache().get("%CLD",cld).empty())
|
|
|
|
|
{
|
|
|
|
|
cache().discard("%CLD",cld);
|
|
|
|
|
TTable ttt("%CLD");
|
|
|
|
|
ttt.put("CODTAB",cld);
|
|
|
|
|
ttt.put("S0","???");
|
|
|
|
|
ttt.write();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
cld.cut(0);
|
|
|
|
|
return cld;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void codimp2codmagdep(TString &codimp,int terzista, TString &codmag)
|
|
|
|
|
{
|
|
|
|
|
if (terzista>0)
|
|
|
|
|
{
|
1999-07-16 14:59:11 +00:00
|
|
|
|
codimp = "XT";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
codmag = codimp;
|
|
|
|
|
} else {
|
|
|
|
|
codmag = codimp;
|
|
|
|
|
codmag << 1;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void num_mag2cod_imp(int magno, TString & codimp)
|
|
|
|
|
{
|
|
|
|
|
switch (magno)
|
|
|
|
|
{
|
|
|
|
|
case 91:
|
|
|
|
|
case 93:
|
|
|
|
|
codimp="SE3";
|
|
|
|
|
break;
|
1999-07-16 14:59:11 +00:00
|
|
|
|
case 25:
|
1999-04-06 15:34:39 +00:00
|
|
|
|
case 26:
|
|
|
|
|
codimp="SE";
|
|
|
|
|
break;
|
|
|
|
|
case 92:
|
|
|
|
|
codimp="TS3";
|
|
|
|
|
break;
|
1999-07-16 14:59:11 +00:00
|
|
|
|
case 27:
|
1999-04-06 15:34:39 +00:00
|
|
|
|
case 28:
|
|
|
|
|
codimp="TS";
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
codimp="XX";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-07-16 14:59:11 +00:00
|
|
|
|
int cod_mag2num_mag(const TString & codmag)
|
|
|
|
|
{
|
|
|
|
|
if (codmag=="SE3")
|
|
|
|
|
return 91;
|
|
|
|
|
if (codmag=="SE1")
|
|
|
|
|
return 26;
|
|
|
|
|
if (codmag=="TS3")
|
|
|
|
|
return 92;
|
|
|
|
|
if (codmag=="TS1")
|
|
|
|
|
return 28;
|
|
|
|
|
if (!codmag.blank())
|
|
|
|
|
error_box("Che cazzo di magazzino <20> %s?", (const char *)codmag);
|
|
|
|
|
return -1;
|
|
|
|
|
}
|
|
|
|
|
void set_workcenter_code(TString & stdwrkc, const char * codimp, long wrkc, int bomm)
|
|
|
|
|
{
|
|
|
|
|
int type=int (wrkc/100);
|
|
|
|
|
if ( type == 1010 || (bomm != 0 && bomm != 99)) // non e' una linea di confezionamento di Segrate o terzista
|
|
|
|
|
{
|
|
|
|
|
int lineno;
|
|
|
|
|
if (type == 1010 )
|
|
|
|
|
{
|
|
|
|
|
lineno=int (wrkc - type*100);
|
|
|
|
|
stdwrkc = codimp;
|
|
|
|
|
} else {
|
|
|
|
|
lineno= 100;
|
|
|
|
|
stdwrkc="X";
|
|
|
|
|
}
|
|
|
|
|
switch (lineno)
|
|
|
|
|
{
|
|
|
|
|
// centri di lavoro interni all'impianto
|
|
|
|
|
case 1:
|
|
|
|
|
case 2:
|
|
|
|
|
case 4:
|
|
|
|
|
case 5:
|
|
|
|
|
case 6:
|
|
|
|
|
case 7:
|
|
|
|
|
case 8:
|
|
|
|
|
case 9:
|
|
|
|
|
case 10:
|
|
|
|
|
case 14:
|
|
|
|
|
stdwrkc << format("%03d", lineno);
|
|
|
|
|
break;
|
|
|
|
|
case 15:
|
|
|
|
|
stdwrkc << "999";
|
|
|
|
|
break;
|
|
|
|
|
// centri di lavoro dei terzisti
|
|
|
|
|
case 100:
|
|
|
|
|
stdwrkc << format("%02d", bomm);
|
|
|
|
|
stdwrkc << codimp;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
stdwrkc="";
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
void add_stdlabors(const char * item, long wrkc, int bomm)
|
|
|
|
|
{
|
|
|
|
|
int type=int (wrkc/100);
|
|
|
|
|
if ( type == 1010 || (bomm != 0 && bomm != 99)) // non e' una linea di confezionamento di Segrate o terzista
|
|
|
|
|
{
|
1999-07-16 14:59:11 +00:00
|
|
|
|
// ************
|
|
|
|
|
// lav su SEGRATE
|
|
|
|
|
TString8 postcode("SE");
|
|
|
|
|
if (bomm != 0 )
|
|
|
|
|
postcode.format("X%02d%s", bomm, "SE");
|
|
|
|
|
TString tmpcode(item);
|
|
|
|
|
tmpcode << "__" << postcode;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
TLocalisamfile rdist(LF_RDIST);
|
1999-07-16 14:59:11 +00:00
|
|
|
|
rdist.put("CODDIST",tmpcode);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
rdist.read(_isgteq);
|
|
|
|
|
int nrig=0;
|
|
|
|
|
while (!rdist.eof() && rdist.get("CODDIST")==item)
|
|
|
|
|
{
|
|
|
|
|
if (rdist.get("TIPO")=="L") break;
|
|
|
|
|
rdist.next();
|
|
|
|
|
nrig++;
|
|
|
|
|
}
|
|
|
|
|
if (rdist.eof() || rdist.get("CODDIST")!=item)
|
|
|
|
|
{
|
|
|
|
|
// nessuna lavorazione precedentemente inserita
|
|
|
|
|
int lineno;
|
1999-07-16 14:59:11 +00:00
|
|
|
|
if (bomm != 0 )
|
1999-04-06 15:34:39 +00:00
|
|
|
|
lineno= 100;
|
1999-07-16 14:59:11 +00:00
|
|
|
|
else
|
|
|
|
|
lineno=int (wrkc - type*100);
|
1999-04-06 15:34:39 +00:00
|
|
|
|
int pzxca;
|
|
|
|
|
switch (lineno)
|
|
|
|
|
{
|
|
|
|
|
case 1:
|
1999-07-16 14:59:11 +00:00
|
|
|
|
tmpcode="SE_ALCOL1";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
pzxca=12;
|
|
|
|
|
break;
|
|
|
|
|
case 2:
|
1999-07-16 14:59:11 +00:00
|
|
|
|
tmpcode="SE_DOCCIA";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
pzxca=12;
|
|
|
|
|
break;
|
|
|
|
|
case 4:
|
1999-07-16 14:59:11 +00:00
|
|
|
|
tmpcode="SE_GLYSOL";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
pzxca=12;
|
|
|
|
|
break;
|
|
|
|
|
case 5:
|
1999-07-16 14:59:11 +00:00
|
|
|
|
tmpcode="SE_BRYLCR";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
pzxca=12;
|
|
|
|
|
break;
|
|
|
|
|
case 6:
|
1999-07-16 14:59:11 +00:00
|
|
|
|
tmpcode="SE_BAGNOS";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
pzxca=12;
|
|
|
|
|
break;
|
|
|
|
|
case 7:
|
1999-07-16 14:59:11 +00:00
|
|
|
|
tmpcode="SE_SAPONE";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
pzxca=12;
|
|
|
|
|
break;
|
|
|
|
|
case 8:
|
1999-07-16 14:59:11 +00:00
|
|
|
|
tmpcode="SE_SAPRIC";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
pzxca=12;
|
|
|
|
|
break;
|
|
|
|
|
case 9:
|
1999-07-16 14:59:11 +00:00
|
|
|
|
tmpcode="SE_DENTIF";
|
|
|
|
|
pzxca=24;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
break;
|
|
|
|
|
case 10:
|
1999-07-16 14:59:11 +00:00
|
|
|
|
tmpcode="SE_PENTO";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
pzxca=12;
|
|
|
|
|
break;
|
|
|
|
|
case 14:
|
1999-07-16 14:59:11 +00:00
|
|
|
|
tmpcode="SE_ALC.EDT";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
pzxca=12;
|
|
|
|
|
break;
|
1999-07-16 14:59:11 +00:00
|
|
|
|
case 15:
|
|
|
|
|
tmpcode="SE_MANGEN";
|
|
|
|
|
pzxca=0;
|
|
|
|
|
break;
|
1999-04-06 15:34:39 +00:00
|
|
|
|
// lavorazioni terzisti
|
|
|
|
|
case 100:
|
1999-07-16 14:59:11 +00:00
|
|
|
|
tmpcode="SE_RICONF";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
pzxca=12;
|
|
|
|
|
break;
|
|
|
|
|
default:
|
|
|
|
|
error_box("Linea sconosciuta per l'articolo %s:%d",item,lineno);
|
|
|
|
|
lineno=0;
|
|
|
|
|
}
|
|
|
|
|
TString16 um=cache().get(LF_DIST,item).get("UM");
|
|
|
|
|
if (lineno && !um.empty())
|
|
|
|
|
{
|
|
|
|
|
TToken_string key(item);
|
|
|
|
|
key.add("1",1);
|
|
|
|
|
if (cache().get(LF_UMART,key).get("UM")=="CA")
|
1999-07-16 14:59:11 +00:00
|
|
|
|
{
|
|
|
|
|
if (pzxca)
|
|
|
|
|
tmpcode<< "_X" << pzxca;
|
|
|
|
|
}
|
|
|
|
|
else if (cache().get(LF_UMART,key).get("UM")=="PZ")
|
|
|
|
|
tmpcode<< "_SL";
|
1999-04-06 15:34:39 +00:00
|
|
|
|
real fc;
|
|
|
|
|
if (cache().get(LF_UMART,key).get("UM")==um)
|
|
|
|
|
{
|
|
|
|
|
fc=cache().get(LF_UMART,key).get_real("FC");
|
|
|
|
|
} else {
|
|
|
|
|
key.add("2",1);
|
|
|
|
|
fc=cache().get(LF_UMART,key).get_real("FC");
|
|
|
|
|
}
|
1999-07-16 14:59:11 +00:00
|
|
|
|
if (cache().get("LAV",tmpcode).empty())
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1999-07-16 14:59:11 +00:00
|
|
|
|
if (noyes_box("Impossibile trovare la lavorazione %s per l'articolo %s. Inserimento automatico?", (const char *)tmpcode, item))
|
|
|
|
|
{
|
|
|
|
|
cache().discard("LAV",tmpcode);
|
|
|
|
|
TTable ttt("LAV");
|
|
|
|
|
ttt.put("CODTAB",tmpcode);
|
|
|
|
|
ttt.put("S0","???");
|
|
|
|
|
ttt.put("S6",cache().get(LF_UMART,key).get("UM"));
|
|
|
|
|
ttt.write();
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
1999-07-16 14:59:11 +00:00
|
|
|
|
rdist.put("CODDIST",item);
|
|
|
|
|
rdist.put("NRIG",nrig+1);
|
|
|
|
|
rdist.put("TIPO","L");
|
|
|
|
|
rdist.put("CODCOMP",tmpcode);
|
|
|
|
|
rdist.put("UM",um);
|
|
|
|
|
rdist.put("EXPR",fc.string());
|
|
|
|
|
rdist.write();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1999-07-16 14:59:11 +00:00
|
|
|
|
bool sposta_lavs()
|
|
|
|
|
{
|
|
|
|
|
TIndwin iw(80, "Spostamento lavorazioni sulle varianti fantasma di impianto",FALSE,FALSE);
|
|
|
|
|
int err;
|
|
|
|
|
int nrig,oldnrig;
|
|
|
|
|
long distno=1L;
|
|
|
|
|
TString cod="";
|
|
|
|
|
TLocalisamfile rdist(LF_RDIST);
|
|
|
|
|
err = rdist.read(_isfirst);
|
|
|
|
|
bool some_moved=FALSE;
|
|
|
|
|
while (err == NOERR)
|
|
|
|
|
{
|
|
|
|
|
cod = rdist.get("CODDIST");
|
|
|
|
|
if ((distno%TICK)==1)
|
|
|
|
|
{
|
|
|
|
|
iw.set_text(format("Riga distinta n. %ld", distno));
|
|
|
|
|
do_events();
|
|
|
|
|
}
|
|
|
|
|
distno++;
|
|
|
|
|
oldnrig=rdist.get_int("NRIG");
|
|
|
|
|
if (*rdist.get("TIPO") == 'L' && cod.find("__")<=0)
|
|
|
|
|
{
|
|
|
|
|
// lavorazione
|
|
|
|
|
TString newcod(cod);
|
|
|
|
|
TString codlav(rdist.get("CODCOMP"));
|
|
|
|
|
TString4 codimp(codlav.left(2));
|
|
|
|
|
newcod << "__";
|
|
|
|
|
if (codimp == "L_")
|
|
|
|
|
{
|
|
|
|
|
newcod << "SE";
|
|
|
|
|
codlav = codlav.sub(1);
|
|
|
|
|
codlav.insert("SE");
|
|
|
|
|
rdist.put("CODCOMP", codlav);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
newcod << codimp;
|
|
|
|
|
rdist.put("CODDIST", newcod);
|
|
|
|
|
rdist.put("NRIG", 100+oldnrig);
|
|
|
|
|
rdist.write();
|
|
|
|
|
rdist.put("CODDIST", cod);
|
|
|
|
|
rdist.put("NRIG", oldnrig);
|
|
|
|
|
rdist.remove();
|
|
|
|
|
some_moved=TRUE;
|
|
|
|
|
}
|
|
|
|
|
rdist.put("NRIG",oldnrig+1);
|
|
|
|
|
err = rdist.read(_isgteq);
|
|
|
|
|
nrig++;
|
|
|
|
|
}
|
|
|
|
|
return some_moved;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool build2levmsp()
|
|
|
|
|
{
|
|
|
|
|
if (!noyes_box("La presenza di varianti non di stabilimento identifichera' una distinta NON master. Confermi?"))
|
|
|
|
|
return FALSE;
|
|
|
|
|
|
|
|
|
|
TIndwin iw(80, "Creazione articoli MASTER per MSP a 2 livelli",FALSE,FALSE);
|
|
|
|
|
int err;
|
|
|
|
|
bool oldmaster,master;
|
|
|
|
|
long artdist=1L, numdist=1L;
|
|
|
|
|
TString8 variante;
|
|
|
|
|
TString cod="";
|
|
|
|
|
TString distinta="",codvariant="";
|
|
|
|
|
TLocalisamfile dist(LF_DIST),dist2(LF_DIST);
|
|
|
|
|
err = dist.read(_isfirst);
|
|
|
|
|
while (err == NOERR)
|
|
|
|
|
{
|
|
|
|
|
cod = dist.get("CODDIST");
|
|
|
|
|
if ((numdist%TICK)==1)
|
|
|
|
|
{
|
|
|
|
|
iw.set_text(format("Distinta articolo n. %ld/%ld", artdist,numdist));
|
|
|
|
|
do_events();
|
|
|
|
|
}
|
|
|
|
|
numdist++;
|
|
|
|
|
int var=cod.find("__");
|
|
|
|
|
if (var <=0) // non variante
|
|
|
|
|
{
|
|
|
|
|
distinta=cod;
|
|
|
|
|
|
|
|
|
|
oldmaster=cache().get(LF_DIST,distinta).get_bool("MASTER");
|
|
|
|
|
if (cache().get(LF_ANAMAG,distinta).get("GRMERC")[0]=='B')
|
|
|
|
|
master=FALSE;
|
|
|
|
|
else
|
|
|
|
|
master=TRUE;
|
|
|
|
|
|
|
|
|
|
codvariant=distinta;
|
|
|
|
|
codvariant << "__";
|
|
|
|
|
var = codvariant.len();
|
|
|
|
|
dist2.put("CODDIST",codvariant);
|
|
|
|
|
err = dist2.read(_isgteq);
|
|
|
|
|
while (master && err == NOERR)
|
|
|
|
|
{
|
|
|
|
|
cod = dist2.get("CODDIST");
|
|
|
|
|
if (cod.left(var)!=codvariant)
|
|
|
|
|
break;
|
|
|
|
|
if (cod[var+2]>'\0') // variante non di stabilimento
|
|
|
|
|
master=FALSE;
|
|
|
|
|
|
|
|
|
|
err = dist2.next();
|
|
|
|
|
}
|
|
|
|
|
if (master!=oldmaster)
|
|
|
|
|
{
|
|
|
|
|
dist2.put("CODDIST",distinta);
|
|
|
|
|
dist2.read();
|
|
|
|
|
dist2.put("MASTER",master);
|
|
|
|
|
dist2.rewrite();
|
|
|
|
|
}
|
|
|
|
|
cache().discard(LF_DIST,distinta);
|
|
|
|
|
}
|
|
|
|
|
err = dist.next();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
bool rinumera_dist()
|
|
|
|
|
{
|
|
|
|
|
TIndwin iw(80, "Rinumerazione progr. righe distinte ...",FALSE,FALSE);
|
|
|
|
|
bool some_done=FALSE;
|
|
|
|
|
int err;
|
|
|
|
|
int nrig,oldnrig;
|
|
|
|
|
long distno=1L;
|
|
|
|
|
TString cod="";
|
|
|
|
|
TLocalisamfile rdist(LF_RDIST);
|
|
|
|
|
err = rdist.read(_isfirst);
|
|
|
|
|
while (err == NOERR)
|
|
|
|
|
{
|
|
|
|
|
if (cod != rdist.get("CODDIST"))
|
|
|
|
|
{
|
|
|
|
|
if ((distno%TICK)==1)
|
|
|
|
|
{
|
|
|
|
|
iw.set_text(format("Rinumerazione distinta n. %ld", distno));
|
|
|
|
|
do_events();
|
|
|
|
|
}
|
|
|
|
|
cod = rdist.get("CODDIST");
|
|
|
|
|
nrig=1;
|
|
|
|
|
distno++;
|
|
|
|
|
}
|
|
|
|
|
oldnrig=rdist.get_int("NRIG");
|
|
|
|
|
if (oldnrig != nrig)
|
|
|
|
|
{
|
|
|
|
|
rdist.put("NRIG",nrig);
|
|
|
|
|
err = rdist.write();
|
|
|
|
|
rdist.put("NRIG",oldnrig);
|
|
|
|
|
err = rdist.remove();
|
|
|
|
|
some_done=TRUE;
|
|
|
|
|
rdist.put("NRIG",oldnrig+1);
|
|
|
|
|
err = rdist.read(_isgteq);
|
|
|
|
|
} else
|
|
|
|
|
err = rdist.next();
|
|
|
|
|
nrig++;
|
|
|
|
|
}
|
|
|
|
|
return some_done;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool rinumera_ums()
|
|
|
|
|
{
|
|
|
|
|
TIndwin iw(80, "Rinumerazione unita' di misura ...",FALSE,FALSE);
|
|
|
|
|
bool some_done=FALSE;
|
|
|
|
|
int err;
|
|
|
|
|
int nrig,oldnrig=0L;
|
|
|
|
|
long distno=1L;
|
|
|
|
|
TString cod="";
|
|
|
|
|
TLocalisamfile umart(LF_UMART);
|
|
|
|
|
err = umart.read(_isfirst);
|
|
|
|
|
while (err == NOERR)
|
|
|
|
|
{
|
|
|
|
|
oldnrig=umart.get_int("NRIGA");
|
|
|
|
|
if (cod != umart.get("CODART"))
|
|
|
|
|
{
|
|
|
|
|
if ((distno%TICK)==1)
|
|
|
|
|
{
|
|
|
|
|
iw.set_text(format("Rinumerazione UMS: riga %ld", distno));
|
|
|
|
|
do_events();
|
|
|
|
|
}
|
|
|
|
|
cod = umart.get("CODART");
|
|
|
|
|
nrig=1;
|
|
|
|
|
}
|
|
|
|
|
if (oldnrig != nrig)
|
|
|
|
|
{
|
|
|
|
|
umart.put("NRIGA",nrig);
|
|
|
|
|
err = umart.write();
|
|
|
|
|
umart.put("NRIGA",oldnrig);
|
|
|
|
|
err = umart.remove();
|
|
|
|
|
some_done=TRUE;
|
|
|
|
|
}
|
|
|
|
|
umart.put("NRIGA",oldnrig+1);
|
|
|
|
|
err = umart.read(_isgteq);
|
|
|
|
|
nrig++;
|
|
|
|
|
}
|
|
|
|
|
return some_done;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// Imposta la formula delle varianti sui finiti e semilavorati
|
|
|
|
|
void setformulavar()
|
|
|
|
|
{
|
|
|
|
|
TIndwin iw(80, "Impostazione formula delle varianti ...",FALSE,FALSE);
|
|
|
|
|
int err;
|
|
|
|
|
long distno=1L;
|
|
|
|
|
TLocalisamfile dist(LF_DIST);
|
|
|
|
|
err = dist.read(_isfirst);
|
|
|
|
|
TString varvar;
|
|
|
|
|
TString cod(' ',20);
|
|
|
|
|
while (err == NOERR)
|
|
|
|
|
{
|
|
|
|
|
if ((distno%TICK)==1)
|
|
|
|
|
{
|
|
|
|
|
iw.set_text(format("Impostazione formula distinta n. %ld", distno));
|
|
|
|
|
do_events();
|
|
|
|
|
}
|
|
|
|
|
cod=dist.get("CODDIST");
|
|
|
|
|
if (cod.find("__")<0)
|
|
|
|
|
{
|
|
|
|
|
const TRectype &ana=cache().get(LF_ANAMAG,cod);
|
|
|
|
|
if (!ana.empty())
|
|
|
|
|
{
|
|
|
|
|
varvar="VARIANTE=_DISTINTA+\"__\"+";
|
|
|
|
|
// se non e' un fantasma lo definisce come variante (distinta contenente una riga di tipo variabile)
|
|
|
|
|
// se e' un finito, anche varianti di sconfezionamento
|
|
|
|
|
if (ana.get(ANAMAG_GRMERC)[0]=='F')
|
|
|
|
|
//varvar << "IF(_IMPIANTO==\"XT\",_LINEA,IF(_LINEA?=\"??9??\",_LINEA,_IMPIANTO))" ;
|
|
|
|
|
varvar << "IF((_IMPIANTO==\"XT\")||(_LINEA?=\"??9??\"),_LINEA,_IMPIANTO)" ;
|
|
|
|
|
else
|
|
|
|
|
varvar << "IF(_IMPIANTO==\"XT\",_LINEA,_IMPIANTO)" ;
|
|
|
|
|
if (varvar != dist.get("PARAMETRI"))
|
|
|
|
|
{
|
|
|
|
|
dist.put("PARAMETRI",varvar);
|
|
|
|
|
dist.rewrite();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
err = dist.read(_isnext);
|
|
|
|
|
distno++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void round_date(TDate& date, const int bucket_size, bool up)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
// Riporta la data al primo lunedi prima dell'inizio
|
|
|
|
|
const int wday = date.wday();
|
|
|
|
|
if (wday > 1) date -= wday-1;
|
|
|
|
|
|
1999-07-16 14:59:11 +00:00
|
|
|
|
//TDate begin("01-01-1999");
|
|
|
|
|
TDate begin(TODAY);
|
|
|
|
|
begin.set_day(1);
|
|
|
|
|
const int wday2 = begin.wday();
|
|
|
|
|
if (wday2 > 1)
|
|
|
|
|
begin -= wday2-1; // primo lunedi' considerato
|
|
|
|
|
|
|
|
|
|
int bucks=int((date-begin) / bucket_size);
|
|
|
|
|
|
|
|
|
|
date=begin;
|
|
|
|
|
date+=bucket_size*bucks;
|
|
|
|
|
|
1999-04-06 15:34:39 +00:00
|
|
|
|
if (up) // Arrotonda alla fine del bucket
|
|
|
|
|
date += (bucket_size - 1);
|
|
|
|
|
else // Arrotonda all'inizio del bucket
|
|
|
|
|
date = date ;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
1999-07-16 14:59:11 +00:00
|
|
|
|
bool check_mag_locations(const TString &path,const TFilename &source)
|
|
|
|
|
{
|
|
|
|
|
TImport_file movmag(path,source);
|
|
|
|
|
movmag.first();
|
|
|
|
|
long l;
|
|
|
|
|
do {
|
|
|
|
|
l= movmag.get_long("TLOCT");
|
|
|
|
|
if (location2method(l)==99)
|
|
|
|
|
if (yesno_box("Locazione %ld sconosciuta. Interrompo?",l))
|
|
|
|
|
return FALSE;
|
|
|
|
|
} while (!movmag.next());
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool bonifica_vendite(TMask &m, const TString & codimp)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1999-07-16 14:59:11 +00:00
|
|
|
|
TString8 codnum=codimp;
|
|
|
|
|
codnum<< "MM";
|
|
|
|
|
TRelation *r= new TRelation(LF_DOC);
|
|
|
|
|
r->add(LF_RIGHEDOC,"CODNUM==CODNUM|ANNO==ANNO|PROVV==PROVV|NDOC==NDOC");
|
|
|
|
|
TCursor c(r);
|
|
|
|
|
TRectype frec(LF_DOC);
|
|
|
|
|
frec.put("CODNUM",codnum);
|
|
|
|
|
frec.put("PROVV","D");
|
|
|
|
|
frec.put("ANNO" ,"1999");
|
|
|
|
|
c.setregion(frec,frec);
|
|
|
|
|
c.freeze();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1999-07-16 14:59:11 +00:00
|
|
|
|
const long items=c.items();
|
|
|
|
|
TProgind info(items,"Eliminazione causali di riga dalle bolle di vendita...",FALSE,TRUE);
|
|
|
|
|
for (long i= 0; i< items ; i++)
|
1999-04-06 15:34:39 +00:00
|
|
|
|
{
|
1999-07-16 14:59:11 +00:00
|
|
|
|
c=i;
|
|
|
|
|
info.addstatus(1);
|
|
|
|
|
TRelation *r =c.relation();
|
|
|
|
|
TLocalisamfile & teste = c.relation()->lfile(LF_DOC);
|
|
|
|
|
TLocalisamfile & righe = c.relation()->lfile(LF_RIGHEDOC);
|
|
|
|
|
if (teste.get("CAUSMAG")=="VNENT")
|
|
|
|
|
{
|
|
|
|
|
bool ok = r->is_first_match(LF_RIGHEDOC);
|
|
|
|
|
while (ok)
|
|
|
|
|
{
|
|
|
|
|
real q=righe.get("QTA");
|
|
|
|
|
if (righe.get("CAUSMAG")=="SCAR")
|
|
|
|
|
q=-q;
|
|
|
|
|
|
|
|
|
|
righe.put("CAUSMAG"," ");
|
|
|
|
|
righe.put("QTA",q);
|
|
|
|
|
righe .rewrite();
|
|
|
|
|
ok = r->next_match(LF_RIGHEDOC);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return TRUE;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// **************************************
|
|
|
|
|
|
|
|
|
|
TImport_file::TImport_file(const char *path, const char * name)
|
|
|
|
|
{
|
|
|
|
|
TFilename fname(path);
|
|
|
|
|
fname.add(name);
|
|
|
|
|
_f = new TExternisamfile(fname, TRUE, TRUE);
|
|
|
|
|
_f->setkey(1);
|
|
|
|
|
}
|
|
|
|
|
void TImport_file::zero(const char filler)
|
|
|
|
|
{
|
|
|
|
|
_f->zero(filler);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TImport_file::put(const char *field, const char * val)
|
|
|
|
|
{
|
|
|
|
|
_f->put(field,val);
|
|
|
|
|
}
|
|
|
|
|
TString & TImport_file::get(const char *field)
|
|
|
|
|
{
|
|
|
|
|
_sbuffer = _f->get(field);
|
|
|
|
|
return _sbuffer.trim();
|
|
|
|
|
}
|
|
|
|
|
TString & TImport_file::get_codice(const char *field)
|
|
|
|
|
{
|
|
|
|
|
_sbuffer = _f->get(field);
|
|
|
|
|
_sbuffer.trim();
|
|
|
|
|
|
|
|
|
|
return _sbuffer;
|
|
|
|
|
}
|
|
|
|
|
const real & TImport_file::get_real(const char *field)
|
|
|
|
|
{
|
|
|
|
|
get(field).replace(',','.');
|
|
|
|
|
_rbuffer=real(_sbuffer);
|
|
|
|
|
return _rbuffer;
|
|
|
|
|
}
|
|
|
|
|
const long TImport_file::get_long(const char *field)
|
|
|
|
|
{
|
|
|
|
|
const long l= _f->get_long(field);
|
|
|
|
|
return l;
|
|
|
|
|
}
|
|
|
|
|
const TDate & TImport_file::get_date(const char *field)
|
|
|
|
|
{
|
|
|
|
|
_dbuffer=_f->get_long(field);
|
|
|
|
|
return _dbuffer;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
bool TImport_file::first()
|
|
|
|
|
{
|
|
|
|
|
return _f->first();
|
|
|
|
|
}
|
|
|
|
|
bool TImport_file::prev()
|
|
|
|
|
{
|
|
|
|
|
return _f->prev();
|
|
|
|
|
}
|
|
|
|
|
bool TImport_file::next()
|
|
|
|
|
{
|
|
|
|
|
return _f->next();
|
|
|
|
|
}
|
|
|
|
|
bool TImport_file::eof()
|
|
|
|
|
{
|
|
|
|
|
return _f->eof();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
long TImport_file::items()
|
|
|
|
|
{
|
|
|
|
|
return _f->items();
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
|
|
|
|
|
1999-07-16 14:59:11 +00:00
|
|
|
|
int TImport_file::read()
|
|
|
|
|
{
|
|
|
|
|
int err = _f->read(_isgteq);
|
|
|
|
|
return err;
|
|
|
|
|
}
|
|
|
|
|
int TImport_file::write()
|
|
|
|
|
{
|
|
|
|
|
return _f->write();
|
|
|
|
|
}
|
|
|
|
|
void TImport_file::zap(bool pack)
|
|
|
|
|
{
|
|
|
|
|
int err;
|
|
|
|
|
_f->first();
|
|
|
|
|
for (;!_f->eof(); _f->next())
|
|
|
|
|
{
|
|
|
|
|
err=_f->remove();
|
|
|
|
|
}
|
|
|
|
|
/* for (long i=_f->items(); i>0; i--)
|
|
|
|
|
{
|
|
|
|
|
_f->readat(i);
|
|
|
|
|
err=_f->remove();
|
|
|
|
|
}
|
|
|
|
|
if (pack)
|
|
|
|
|
_f->pack();*/
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// **************************************
|
|
|
|
|
void TSupport_file::zap()
|
|
|
|
|
{
|
|
|
|
|
int err;
|
|
|
|
|
for (long i=_f->items(); i>0; i--)
|
|
|
|
|
{
|
|
|
|
|
_f->readat(i);
|
|
|
|
|
err=_f->remove();
|
1999-04-06 15:34:39 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
1999-07-16 14:59:11 +00:00
|
|
|
|
int TSupport_file::read(TRectype & r)
|
|
|
|
|
{
|
|
|
|
|
CHECK(r.num() == _f->num(),"TIpo record inconsistente");
|
|
|
|
|
TString k(r.build_key(1));
|
|
|
|
|
r = _cache->get(k);
|
|
|
|
|
if (r.empty())
|
|
|
|
|
return _iskeynotfound;
|
|
|
|
|
return NOERR;
|
|
|
|
|
}
|
|
|
|
|
int TSupport_file::write()
|
|
|
|
|
{
|
|
|
|
|
TString k(_f->curr().build_key(1));
|
|
|
|
|
_cache->discard(k);
|
|
|
|
|
return _f->write();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
void TSupport_file::put(const char * field, const char * value)
|
|
|
|
|
{
|
|
|
|
|
_f->put(field,value);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
TSupport_file::TSupport_file (int logicnum,const char * radix)
|
|
|
|
|
{
|
|
|
|
|
_f = new TIsamtempfile(logicnum,radix,FALSE,FALSE);
|
|
|
|
|
_cache= new TRecord_cache(_f);
|
|
|
|
|
}
|
|
|
|
|
TSupport_file::~TSupport_file()
|
|
|
|
|
{
|
|
|
|
|
delete _f;
|
|
|
|
|
delete _cache;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// **************************************
|
|
|
|
|
TTimed_skipbox:: TTimed_skipbox(const char * message,int seconds,int x,int y)
|
|
|
|
|
: TTimed_breakbox(message,seconds,x,y)
|
|
|
|
|
{
|
|
|
|
|
hide(DLG_OK);
|
|
|
|
|
hide(DLG_CANCEL);
|
|
|
|
|
add_button(DLG_CANCEL, 0, "~Ignora", -22, -1, 12, 2,"",0);
|
|
|
|
|
add_button(DLG_OK, 0, "Im~porta", -12, -1, 12, 2,"",0);
|
|
|
|
|
}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|
1999-07-16 14:59:11 +00:00
|
|
|
|
TTimed_skipbox::~TTimed_skipbox()
|
|
|
|
|
{}
|
1999-04-06 15:34:39 +00:00
|
|
|
|
|