Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : git-svn-id: svn://10.65.10.50/branches/R_10_00@21940 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
parent
06e0e98f87
commit
8c83d9664e
@ -54,17 +54,33 @@ enum TFE_type { AN, NU };
|
||||
|
||||
class TFatture_recordset : public TAS400_recordset
|
||||
{
|
||||
void add_field(const char* name, TFE_type type, int len, int pos,
|
||||
bool required = false, const char* def = NULL);
|
||||
protected:
|
||||
void add_field(const char* name, TFE_type type, int len, int pos,
|
||||
bool required = false, const char* def = NULL);
|
||||
public:
|
||||
virtual TRecnotype new_rec(const char* trc);
|
||||
TFatture_recordset();
|
||||
};
|
||||
|
||||
TRecnotype TFatture_recordset::new_rec(const char* trc)
|
||||
{
|
||||
TRecnotype rec = -1;
|
||||
if (trc && *trc > ' ')
|
||||
{
|
||||
rec = TAS400_recordset::new_rec(trc);
|
||||
TToken_string& line = row(rec);
|
||||
const int acapo = line.rfind('\n');
|
||||
if (acapo>0)
|
||||
line.cut(acapo+1);
|
||||
}
|
||||
return rec;
|
||||
}
|
||||
|
||||
void TFatture_recordset::add_field(const char* name, TFE_type type, int len, int pos,
|
||||
bool required, const char* def)
|
||||
{
|
||||
CHECKS(len > 0, "Lunghezza nulla sul campo ", name);
|
||||
CHECKS(pos > 0, "Posizione nulla sul campo ", name);
|
||||
CHECKS(pos >= 0, "Posizione non valida sul campo ", name);
|
||||
|
||||
TFieldtypes ft = _alfafld;
|
||||
switch (type)
|
||||
@ -78,14 +94,14 @@ void TFatture_recordset::add_field(const char* name, TFE_type type, int len, int
|
||||
}
|
||||
bool ok = false;
|
||||
if (def && *def)
|
||||
ok = create_field(name, pos, len, ft, required, TVariant(def));
|
||||
ok = create_field(name, pos-1, len, ft, required, TVariant(def));
|
||||
else
|
||||
ok = create_field(name, pos, len, ft, required);
|
||||
ok = create_field(name, pos-1, len, ft, required);
|
||||
CHECKS(ok, "Impossibile creare il campo ", (const char*)name);
|
||||
}
|
||||
|
||||
TFatture_recordset::TFatture_recordset()
|
||||
: TAS400_recordset("AS400(610)")
|
||||
: TAS400_recordset("AS400(612,3,0)")
|
||||
{
|
||||
// dati di configurazione
|
||||
TConfig config(CONFIG_DITTA, "ha");
|
||||
@ -135,12 +151,12 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("BGM.ID-EDI-DEST-1", AN, 35, 57, true, piva_esselunga);
|
||||
add_field("BGM.ID-EDI-DEST-2", AN, 4, 92, true, tipo_emissione);
|
||||
add_field("BGM.ID-EDI-DEST-3", AN, 14, 96);
|
||||
add_field("BGM.TIPODOC", AN, 6, 110, true);
|
||||
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.ORADOC", NU, 4, 159);
|
||||
add_field("BGM.FILLER", AN, 6, 163);
|
||||
|
||||
add_field("BGM.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
TString80 str;
|
||||
str << ditta.get(ANA_INDRES) << ", " << ditta.get(ANA_CIVRES);
|
||||
@ -166,6 +182,7 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("NAS.TELEFAX", AN, 25, 490);
|
||||
add_field("NAS.TELEX", AN, 25, 515);
|
||||
add_field("NAS.EMAIL", AN, 70, 540);
|
||||
add_field("NAS.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
str.cut(0);
|
||||
str << cliente_esselunga.get(CLI_INDCF) << ", " << cliente_esselunga.get(CLI_CIVCF);
|
||||
@ -182,17 +199,19 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("NAI.NAZIOI", AN, 3, 217, true, cliente_esselunga.get(CLI_STATOCF));
|
||||
add_field("NAI.PIVANAZI", AN, 35, 220, true, cliente_esselunga.get(CLI_PAIV));
|
||||
add_field("NAI.FILLER", AN, 51, 255);
|
||||
add_field("NAI.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
// Record FTX: divisa di pagamento
|
||||
add_field("FTX.TIPOREC", AN, 3, 1, true, "FTX");
|
||||
add_field("FTX.DIVISA", AN, 3, 4, true, "EUR");
|
||||
add_field("FTX.NOTE", AN,350, 7);
|
||||
add_field("FTX.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
// 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.RIFTERMP", AN, 3, 15, true);
|
||||
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);
|
||||
@ -205,6 +224,7 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("PAT.FACTOR", AN, 35, 158);
|
||||
add_field("PAT.CODPAG", AN, 3, 193);
|
||||
add_field("PAT.MEZZOPAG", AN, 3, 196);
|
||||
add_field("PAT.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
// *** Sezione di dettaglio fattura ***
|
||||
|
||||
@ -229,22 +249,25 @@ TFatture_recordset::TFatture_recordset()
|
||||
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.TIPOPRZ2", AN, 3, 260, true, "AAB"); // prezo lordo
|
||||
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.DIVRIGA", AN, 3, 282);
|
||||
add_field("DET.IMPORTO2", NU, 16, 285);
|
||||
add_field("DET.DIVRIGA2", AN, 3, 301);
|
||||
add_field("DET.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
// Record DES: descrizione articolo
|
||||
add_field("DES.TIPOREC", AN, 3, 1, true, "DES");
|
||||
add_field("DES.DESCR", AN,175, 3, true);
|
||||
add_field("DES.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
// Record RFN: riferimenti fatture (obbligatorio per note di credito e debito)
|
||||
add_field("RFN.TIPOREC", AN, 3, 1, true, "RFN");
|
||||
add_field("RFN.TIPORIF", AN, 3, 4, true, "IV");
|
||||
add_field("RFN.RIFACCADD", AN, 35, 7, true);
|
||||
add_field("RFN.DATARIF", AN, 8, 42, true);
|
||||
add_field("RFN.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
// Record TAX: informazioni assoggettamento iva
|
||||
add_field("TAX.TIPOREC", AN, 3, 1, true, "TAX");
|
||||
@ -253,6 +276,7 @@ TFatture_recordset::TFatture_recordset()
|
||||
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.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
// Record ALD: sconti di riga
|
||||
add_field("ALD.TIPOREC", AN, 3, 1, true, "ALD");
|
||||
@ -263,6 +287,7 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("ALD.IMPORTO", NU, 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");
|
||||
|
||||
// Record NAD: identificazione punto di consegna
|
||||
add_field("NAD.TIPOREC", AN, 3, 1, true, "NAD");
|
||||
@ -278,6 +303,7 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("NAD.DATABOLL", NU, 8, 255, true);
|
||||
add_field("NAD.NUMORD", AN, 35, 263, true);
|
||||
add_field("NAD.DATAORD", NU, 8, 298, true);
|
||||
add_field("NAD.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
// *** Sezione di sommario fattura
|
||||
|
||||
@ -285,6 +311,7 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("FTT.TIPOREC", AN, 3, 1, true, "FTT");
|
||||
add_field("FTT.TIPONOTA", AN, 3, 4);
|
||||
add_field("FTT.NOTE", AN,350, 7);
|
||||
add_field("FTT.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
// Record ALT: sconto di sommario
|
||||
add_field("ALT.TIPOREC", AN, 3, 1, true, "ALT");
|
||||
@ -294,6 +321,7 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("ALT.TIPOSCADD", AN, 6, 45);
|
||||
add_field("ALT.IMPORTO", NU, 16, 51, true);
|
||||
add_field("ALT.PERC", NU, 7, 67, true);
|
||||
add_field("ALT.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
// Record IVA: subtotali imposte
|
||||
add_field("IVA.TIPOREC", AN, 3, 1, true, "IVA");
|
||||
@ -303,6 +331,7 @@ TFatture_recordset::TFatture_recordset()
|
||||
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.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
// Record TMA: totali documento
|
||||
add_field("TMA.TIPOREC", AN, 3, 1, true, "TMA");
|
||||
@ -320,8 +349,9 @@ TFatture_recordset::TFatture_recordset()
|
||||
add_field("TMA.TOTANT2", NU, 16, 167);
|
||||
add_field("TMA.TOTPAG2", NU, 16, 183);
|
||||
add_field("TMA.DIVISA2", AN, 3, 199);
|
||||
}
|
||||
add_field("TMA.FINERECORD", AN, 2, 0, true, "\r\n");
|
||||
|
||||
}
|
||||
///////////////////////////////////////
|
||||
// TSkeleton_application
|
||||
///////////////////////////////////////
|
||||
@ -332,6 +362,9 @@ protected:
|
||||
void elabora(const TMask& mask);
|
||||
void check_date(const TDate& datafine, TDate& dataini);
|
||||
long check_cliente(const long codcf);
|
||||
void add_rec_testata(TFatture_recordset& fat, const TDocumento& doc);
|
||||
void add_rec_sommario(TFatture_recordset& fat, const TDocumento& doc);
|
||||
void add_rec_dettaglio(TFatture_recordset& fat, const TDocumento& doc, const TRiga_documento& rigadoc);
|
||||
|
||||
public:
|
||||
virtual void main_loop();
|
||||
@ -393,6 +426,36 @@ long THardy_esselunga_fat::genera_recordset(const TMask& mask, TISAM_recordset&
|
||||
return recset.items();
|
||||
}
|
||||
|
||||
void THardy_esselunga_fat::add_rec_testata(TFatture_recordset& fat, const TDocumento& doc)
|
||||
{
|
||||
fat.new_rec("BGM");
|
||||
fat.set("BGM.NUMDOC", doc.numero());
|
||||
fat.set("BGM.DATAOC", doc.data().string());
|
||||
|
||||
fat.new_rec("NAS");
|
||||
fat.new_rec("NAI");
|
||||
fat.new_rec("FTX");
|
||||
fat.new_rec("PAT");
|
||||
}
|
||||
|
||||
void THardy_esselunga_fat::add_rec_sommario(TFatture_recordset& fat, const TDocumento& doc)
|
||||
{
|
||||
fat.new_rec("FTT");
|
||||
fat.new_rec("ALT");
|
||||
fat.new_rec("IVA");
|
||||
fat.new_rec("TMA");
|
||||
}
|
||||
|
||||
void THardy_esselunga_fat::add_rec_dettaglio(TFatture_recordset& fat, const TDocumento& doc, const TRiga_documento& rigadoc)
|
||||
{
|
||||
fat.new_rec("DET");
|
||||
fat.new_rec("DES");
|
||||
fat.new_rec("RFN");
|
||||
fat.new_rec("TAX");
|
||||
fat.new_rec("ALD");
|
||||
fat.new_rec("NAD");
|
||||
}
|
||||
|
||||
void THardy_esselunga_fat::elabora(const TMask& mask)
|
||||
{
|
||||
TLog_report log;
|
||||
@ -419,16 +482,10 @@ void THardy_esselunga_fat::elabora(const TMask& mask)
|
||||
if ( codcf_esselunga > 0)
|
||||
{
|
||||
TDocumento* doc = new TDocumento(recset.cursor()->curr());
|
||||
|
||||
add_rec_testata(fatture, *doc);
|
||||
FOR_EACH_PHYSICAL_RDOC(*doc, r, rigadoc)
|
||||
{
|
||||
|
||||
const TString80& codart_esselunga = cache_ca.decode(rigadoc->get(RDOC_CODART));
|
||||
fatture.new_rec("");
|
||||
//fatture.set("CDC", TVariant(codcf_esselunga));
|
||||
//fatture.set("CODART", codart_esselunga);
|
||||
//fatture.set("NUMBOLLA", numdoc);
|
||||
} //FOR_EACH...
|
||||
add_rec_dettaglio(fatture, *doc, *rigadoc);
|
||||
add_rec_sommario(fatture, *doc);
|
||||
} // if check_cliente...
|
||||
} //for (bool ok = recset.move_first()...
|
||||
|
||||
|
@ -1,24 +1,17 @@
|
||||
#include "ha2200a.h"
|
||||
|
||||
TOOLBAR "" 0 -5 0 4
|
||||
TOOLBAR "" 0 -2 0 2
|
||||
|
||||
STRING 30 70 50
|
||||
BEGIN
|
||||
FLAGS "G"
|
||||
PROMPT 10 -5 "Profilo "
|
||||
PROMPT 10 -11 "Profilo "
|
||||
PSELECT
|
||||
END
|
||||
ENDPAGE
|
||||
|
||||
BUTTON DLG_OK 10 2
|
||||
BEGIN
|
||||
PROMPT -12 -11 ""
|
||||
END
|
||||
|
||||
BUTTON DLG_QUIT 10 2
|
||||
BEGIN
|
||||
PROMPT -22 -11 ""
|
||||
END
|
||||
|
||||
TOOLBAR "" 0 0 0 2
|
||||
#include <elabar.h>
|
||||
ENDPAGE
|
||||
|
||||
PAGE "Esselunga: generazione file Fatture" -1 -1 78 18
|
||||
@ -44,7 +37,7 @@ BEGIN
|
||||
FLAGS "D"
|
||||
END
|
||||
|
||||
GROUPBOX DLG_NULL 78 5
|
||||
GROUPBOX DLG_NULL 78 4
|
||||
BEGIN
|
||||
PROMPT 1 3 "@bParametri"
|
||||
END
|
||||
@ -70,7 +63,7 @@ BEGIN
|
||||
PROMPT 2 5 "Trasferimento definitivo"
|
||||
END
|
||||
|
||||
SPREADSHEET F_SHEETDOC 78 10
|
||||
SPREADSHEET F_SHEETDOC 78
|
||||
BEGIN
|
||||
PROMPT 1 7 "Scelta documenti"
|
||||
ITEM "Cod. num."
|
||||
|
Loading…
x
Reference in New Issue
Block a user