Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@21982 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
530bec22f8
commit
892e6d7eaa
162
ha/ha2200.cpp
162
ha/ha2200.cpp
@ -50,7 +50,7 @@ bool THardy_esselunga_fat_mask::on_field_event(TOperable_field& o, TField_event
|
||||
// Recordset per file fatture
|
||||
/////////////////////////////////////////////////////////////
|
||||
|
||||
enum TFE_type { AN, NU };
|
||||
enum TFE_type { AN, NU, NS, DA };
|
||||
|
||||
class TFatture_recordset : public TAS400_recordset
|
||||
{
|
||||
@ -58,6 +58,7 @@ protected:
|
||||
void add_field(const char* name, TFE_type type, int len, int pos,
|
||||
bool required = false, const char* def = NULL);
|
||||
public:
|
||||
bool set(const char* name, const TVariant& value);
|
||||
virtual TRecnotype new_rec(const char* trc);
|
||||
TFatture_recordset();
|
||||
};
|
||||
@ -76,6 +77,38 @@ TRecnotype TFatture_recordset::new_rec(const char* trc)
|
||||
return rec;
|
||||
}
|
||||
|
||||
bool TFatture_recordset::set(const char* name, const TVariant& value)
|
||||
{
|
||||
bool ok = false;
|
||||
if (!value.is_empty())
|
||||
{
|
||||
if (value.is_date())
|
||||
{
|
||||
const TDate date = value.as_date();
|
||||
TString8 str;
|
||||
str.format("%02d%02d%04d", date.day(), date.month(), date.year());
|
||||
ok = TAS400_recordset::set(name, TVariant(str));
|
||||
}
|
||||
else
|
||||
if (value.is_real())
|
||||
{
|
||||
real r = value.as_real()*1000;
|
||||
TString16 str = r.string(16,0,'0');
|
||||
if (r>ZERO)
|
||||
str.overwrite("+",0,1);
|
||||
else
|
||||
if (r<ZERO)
|
||||
str.overwrite("-",0,1);
|
||||
else
|
||||
str.overwrite(" ",0,1);
|
||||
ok = TAS400_recordset::set(name, TVariant(str));
|
||||
}
|
||||
else
|
||||
ok = TAS400_recordset::set(name, value);
|
||||
}
|
||||
return ok;
|
||||
}
|
||||
|
||||
void TFatture_recordset::add_field(const char* name, TFE_type type, int len, int pos,
|
||||
bool required, const char* def)
|
||||
{
|
||||
@ -86,7 +119,11 @@ void TFatture_recordset::add_field(const char* name, TFE_type type, int len, int
|
||||
switch (type)
|
||||
{
|
||||
case NU:
|
||||
ft = _longfld;
|
||||
ft = _longzerofld;
|
||||
break;
|
||||
case DA:
|
||||
CHECKS(len == 8, "Lunghezza incoerente data ", name);
|
||||
ft = _longzerofld;
|
||||
break;
|
||||
default:
|
||||
ft = _alfafld;
|
||||
@ -153,7 +190,7 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("BGM.ID-EDI-DEST-3", AN, 14, 96);
|
||||
add_field("BGM.TIPODOC", AN, 6, 110, true, "INVOIC");
|
||||
add_field("BGM.NUMDOC", AN, 35, 116, true);
|
||||
add_field("BGM.DATADOC", NU, 8, 151, true);
|
||||
add_field("BGM.DATADOC", DA, 8, 151, true);
|
||||
add_field("BGM.ORADOC", NU, 4, 159);
|
||||
add_field("BGM.FILLER", AN, 6, 163);
|
||||
add_field("BGM.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
@ -210,12 +247,12 @@ TFatture_recordset::TFatture_recordset()
|
||||
// Record PAT: condizioni di pagamento standard
|
||||
add_field("PAT.TIPOREC", AN, 3, 1, true, "PAT");
|
||||
add_field("PAT.TIPOCONDC", AN, 3, 4, true, "10E");
|
||||
add_field("PAT.DATASCAD", NU, 8, 7);
|
||||
add_field("PAT.DATASCAD", DA, 8, 7);
|
||||
add_field("PAT.RIFTERMP", AN, 3, 15, true, "5");
|
||||
add_field("PAT.RELTERMP", AN, 3, 18);
|
||||
add_field("PAT.UNTEMP", AN, 3, 21);
|
||||
add_field("PAT.NUNTEMP", NU, 3, 24);
|
||||
add_field("PAT.IMPORTO", NU, 16, 27);
|
||||
add_field("PAT.IMPORTO", NS, 16, 27);
|
||||
add_field("PAT.DIVISA", AN, 3, 43);
|
||||
add_field("PAT.PERC", NU, 7, 46);
|
||||
add_field("PAT.DESCRIZ", AN, 35, 53, true);
|
||||
@ -239,21 +276,21 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("DET.CODFORTU", AN, 35, 92);
|
||||
add_field("DET.CODDISTU", AN, 35, 127);
|
||||
add_field("DET.TIPQUANT", AN, 3, 162);
|
||||
add_field("DET.QTACONS", NU, 16, 165);
|
||||
add_field("DET.QTACONS", NS, 16, 165);
|
||||
add_field("DET.UDMQCONS", AN, 3, 181);
|
||||
add_field("DET.QTAFATT", NU, 16, 184);
|
||||
add_field("DET.QTAFATT", NS, 16, 184);
|
||||
add_field("DET.UDMQFATT", AN, 3, 200);
|
||||
add_field("DET.NRCUINTU", NU, 16, 203, true);
|
||||
add_field("DET.NRCUINTU", NS, 16, 203, true);
|
||||
add_field("DET.UDMNRCUINTU", AN, 3, 219, true, "PCE");
|
||||
add_field("DET.PRZUNI", NU, 16, 222, true);
|
||||
add_field("DET.PRZUNI", NS, 16, 222, true);
|
||||
add_field("DET.TIPORPZ", AN, 3, 238, true, "AAA"); // prezzo netto
|
||||
add_field("DET.UDMPRZUN", AN, 3, 241, true);
|
||||
add_field("DET.PRZUN2", NU, 16, 244, true);
|
||||
add_field("DET.PRZUN2", NS, 16, 244, true);
|
||||
add_field("DET.TIPOPRZ2", AN, 3, 260, true, "AAB"); // prezzo lordo
|
||||
add_field("DET.UDMPRZUN2", AN, 3, 263, true);
|
||||
add_field("DET.IMPORTO", NU, 16, 266, true);
|
||||
add_field("DET.IMPORTO", NS, 16, 266, true);
|
||||
add_field("DET.DIVRIGA", AN, 3, 282);
|
||||
add_field("DET.IMPORTO2", NU, 16, 285);
|
||||
add_field("DET.IMPORTO2", NS, 16, 285);
|
||||
add_field("DET.DIVRIGA2", AN, 3, 301);
|
||||
add_field("DET.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
@ -275,7 +312,7 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("TAX.DESCRIZ", AN, 35, 7);
|
||||
add_field("TAX.CATIMP", AN, 3, 42, true);
|
||||
add_field("TAX.ALIQIVA", NU, 7, 45, true);
|
||||
add_field("TAX.IMPORTO", NU, 16, 52, true);
|
||||
add_field("TAX.IMPORTO", NS, 16, 52, true);
|
||||
add_field("TAX.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
// Record ALD: sconti di riga
|
||||
@ -284,7 +321,7 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("ALD.DESCR", AN, 35, 7);
|
||||
add_field("ALD.INDSEQ", NU, 3, 42);
|
||||
add_field("ALD.TIPOSCADD", AN, 6, 45);
|
||||
add_field("ALD.IMPORTO", NU, 16, 51);
|
||||
add_field("ALD.IMPORTO", NS, 16, 51);
|
||||
add_field("ALD.PERC", NU, 7, 67, true);
|
||||
add_field("ALD.FLGPRZUN", AN, 3, 74);
|
||||
add_field("ALD.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
@ -300,9 +337,9 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("NAD.CAPD", AN, 9, 208, true);
|
||||
add_field("NAD.NAZIOD", AN, 3, 217, true);
|
||||
add_field("NAD.NUMBOLLA", AN, 35, 220, true);
|
||||
add_field("NAD.DATABOLL", NU, 8, 255, true);
|
||||
add_field("NAD.DATABOLL", DA, 8, 255, true);
|
||||
add_field("NAD.NUMORD", AN, 35, 263, true);
|
||||
add_field("NAD.DATAORD", NU, 8, 298, true);
|
||||
add_field("NAD.DATAORD", DA, 8, 298, true);
|
||||
add_field("NAD.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
// *** Sezione di sommario fattura
|
||||
@ -319,7 +356,7 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("ALT.DESCR", AN, 35, 7);
|
||||
add_field("ALT.INDSEQ", NU, 3, 42);
|
||||
add_field("ALT.TIPOSCADD", AN, 6, 45);
|
||||
add_field("ALT.IMPORTO", NU, 16, 51, true);
|
||||
add_field("ALT.IMPORTO", NS, 16, 51, true);
|
||||
add_field("ALT.PERC", NU, 7, 67, true);
|
||||
add_field("ALT.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
@ -329,25 +366,25 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("IVA.DESCRIZ", AN, 35, 7);
|
||||
add_field("IVA.CATIMP", AN, 3, 42, true);
|
||||
add_field("IVA.ALIQIVA", NU, 7, 45);
|
||||
add_field("IVA.SIMPONIB", NU, 16, 52, true);
|
||||
add_field("IVA.SIMPORTO", NU, 16, 68);
|
||||
add_field("IVA.SIMPONIB", NS, 16, 52, true);
|
||||
add_field("IVA.SIMPORTO", NS, 16, 68);
|
||||
add_field("IVA.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
// Record TMA: totali documento
|
||||
add_field("TMA.TIPOREC", AN, 3, 1, true, "TMA");
|
||||
add_field("TMA.TOTDOC1", NU, 16, 4, true);
|
||||
add_field("TMA.IMPOSTA1", NU, 16, 20, true);
|
||||
add_field("TMA.IMPONIB1", NU, 16, 36, true);
|
||||
add_field("TMA.TOTRIGHE1", NU, 16, 52, true);
|
||||
add_field("TMA.TOTANT1", NU, 16, 68);
|
||||
add_field("TMA.TOTPAG1", NU, 16, 84);
|
||||
add_field("TMA.TOTDOC1", NS, 16, 4, true);
|
||||
add_field("TMA.IMPOSTA1", NS, 16, 20, true);
|
||||
add_field("TMA.IMPONIB1", NS, 16, 36, true);
|
||||
add_field("TMA.TOTRIGHE1", NS, 16, 52, true);
|
||||
add_field("TMA.TOTANT1", NS, 16, 68);
|
||||
add_field("TMA.TOTPAG1", NS, 16, 84);
|
||||
add_field("TMA.DIVISA1", AN, 3, 100);
|
||||
add_field("TMA.TOTDOC2", NU, 16, 103);
|
||||
add_field("TMA.IMPOSTA2", NU, 16, 119);
|
||||
add_field("TMA.IMPONIB2", NU, 16, 135);
|
||||
add_field("TMA.TOTRIGHE2", NU, 16, 151);
|
||||
add_field("TMA.TOTANT2", NU, 16, 167);
|
||||
add_field("TMA.TOTPAG2", NU, 16, 183);
|
||||
add_field("TMA.TOTDOC2", NS, 16, 103);
|
||||
add_field("TMA.IMPOSTA2", NS, 16, 119);
|
||||
add_field("TMA.IMPONIB2", NS, 16, 135);
|
||||
add_field("TMA.TOTRIGHE2", NS, 16, 151);
|
||||
add_field("TMA.TOTANT2", NS, 16, 167);
|
||||
add_field("TMA.TOTPAG2", NS, 16, 183);
|
||||
add_field("TMA.DIVISA2", AN, 3, 199);
|
||||
add_field("TMA.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
@ -364,7 +401,7 @@ protected:
|
||||
long check_cliente(const long codcf);
|
||||
void add_rec_testata(TFatture_recordset& fat, TDocumento& doc);
|
||||
void add_rec_sommario(TFatture_recordset& fat, TDocumento& doc);
|
||||
void add_rec_dettaglio(TFatture_recordset& fat, const TDocumento& doc, const TRiga_documento& rigadoc);
|
||||
void add_recs_dettaglio(TFatture_recordset& fat, TDocumento& doc);
|
||||
|
||||
public:
|
||||
virtual void main_loop();
|
||||
@ -429,13 +466,17 @@ long THardy_esselunga_fat::genera_recordset(const TMask& mask, TISAM_recordset&
|
||||
void THardy_esselunga_fat::add_rec_testata(TFatture_recordset& fat, TDocumento& doc)
|
||||
{
|
||||
fat.new_rec("BGM");
|
||||
fat.set("BGM.NUMDOC", doc.numero());
|
||||
fat.set("BGM.DATAOC", doc.data().string());
|
||||
TString16 numdoc;
|
||||
const TString& num = doc.numerazione();
|
||||
numdoc.format("%012d",doc.numero());
|
||||
numdoc << cache().get("%NUM", num, "S7");
|
||||
numdoc.strip("/");
|
||||
numdoc = numdoc.right(12);
|
||||
fat.set("BGM.NUMDOC", numdoc);
|
||||
fat.set("BGM.DATADOC", doc.data().string());
|
||||
|
||||
fat.new_rec("NAS");
|
||||
|
||||
fat.new_rec("NAI");
|
||||
|
||||
fat.new_rec("FTX");
|
||||
|
||||
fat.new_rec("PAT");
|
||||
@ -474,28 +515,32 @@ void THardy_esselunga_fat::add_rec_sommario(TFatture_recordset& fat, TDocumento&
|
||||
fat.set("TMA.TOTANT1", "");
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
void THardy_esselunga_fat::add_rec_dettaglio(TFatture_recordset& fat, const TDocumento& doc, const TRiga_documento& rigadoc)
|
||||
void THardy_esselunga_fat::add_recs_dettaglio(TFatture_recordset& fat, TDocumento& doc)
|
||||
{
|
||||
fat.new_rec("DET");
|
||||
fat.new_rec("DES");
|
||||
fat.new_rec("RFN");
|
||||
fat.new_rec("TAX");
|
||||
fat.new_rec("ALD");
|
||||
fat.new_rec("NAD");
|
||||
TCodArtEsselunga_cache cache_ca;
|
||||
FOR_EACH_PHYSICAL_RDOC(doc, r, rigadoc)
|
||||
{
|
||||
const TString80& codart_esselunga = cache_ca.decode(rigadoc->get(RDOC_CODART));
|
||||
fat.new_rec("DET");
|
||||
fat.set("DET.NUMRIGA", real(r));
|
||||
fat.set("DET.CODEANCU", codart_esselunga);
|
||||
fat.set("DET.TIPQUANT", "L01"); // vendita (sentire da robbi)
|
||||
fat.set("DET.QTACONS", rigadoc->quantita());
|
||||
fat.set("DET.IMPORTO", rigadoc->importo(false, false));
|
||||
|
||||
fat.new_rec("DES");
|
||||
fat.set("DES.DESCRIZ", rigadoc->get(RDOC_DESCR));
|
||||
|
||||
//fat.new_rec("RFN"); // solo per note di debito e di credito (chiedere a Robbi)
|
||||
|
||||
|
||||
fat.new_rec("TAX");
|
||||
fat.set("TAX.ALIQIVA", rigadoc->iva().percentuale());
|
||||
fat.set("TAX.IMPORTO", rigadoc->imposta());
|
||||
|
||||
//fat.new_rec("ALD");
|
||||
//fat.new_rec("NAD");
|
||||
}
|
||||
}
|
||||
|
||||
void THardy_esselunga_fat::elabora(const TMask& mask)
|
||||
@ -526,8 +571,7 @@ void THardy_esselunga_fat::elabora(const TMask& mask)
|
||||
{
|
||||
TDocumento* doc = new TDocumento(recset.cursor()->curr());
|
||||
add_rec_testata(fatture, *doc);
|
||||
FOR_EACH_PHYSICAL_RDOC(*doc, r, rigadoc)
|
||||
add_rec_dettaglio(fatture, *doc, *rigadoc);
|
||||
add_recs_dettaglio(fatture, *doc);
|
||||
add_rec_sommario(fatture, *doc);
|
||||
if (definitivo)
|
||||
doc->put("HA_FATTURE", "X");
|
||||
|
Loading…
x
Reference in New Issue
Block a user