Patch level :

Files correlati     :
Ricompilazione Demo : [ ]
Commento            :


git-svn-id: svn://10.65.10.50/branches/R_10_00@21967 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
cris 2011-04-18 13:11:46 +00:00
parent fbe6a5c729
commit 5252f0a312

View File

@ -315,7 +315,7 @@ TFatture_recordset::TFatture_recordset()
// Record ALT: sconto di sommario // Record ALT: sconto di sommario
add_field("ALT.TIPOREC", AN, 3, 1, true, "ALT"); add_field("ALT.TIPOREC", AN, 3, 1, true, "ALT");
add_field("ALT.INDSCADD", AN, 3, 4, true); add_field("ALT.INDSCADD", AN, 3, 4, true, "A");
add_field("ALT.DESCR", AN, 35, 7); add_field("ALT.DESCR", AN, 35, 7);
add_field("ALT.INDSEQ", NU, 3, 42); add_field("ALT.INDSEQ", NU, 3, 42);
add_field("ALT.TIPOSCADD", AN, 6, 45); add_field("ALT.TIPOSCADD", AN, 6, 45);
@ -362,8 +362,8 @@ protected:
void elabora(const TMask& mask); void elabora(const TMask& mask);
void check_date(const TDate& datafine, TDate& dataini); void check_date(const TDate& datafine, TDate& dataini);
long check_cliente(const long codcf); long check_cliente(const long codcf);
void add_rec_testata(TFatture_recordset& fat, const TDocumento& doc); void add_rec_testata(TFatture_recordset& fat, TDocumento& doc);
void add_rec_sommario(TFatture_recordset& fat, const 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_rec_dettaglio(TFatture_recordset& fat, const TDocumento& doc, const TRiga_documento& rigadoc);
public: public:
@ -426,26 +426,68 @@ long THardy_esselunga_fat::genera_recordset(const TMask& mask, TISAM_recordset&
return recset.items(); return recset.items();
} }
void THardy_esselunga_fat::add_rec_testata(TFatture_recordset& fat, const TDocumento& doc) void THardy_esselunga_fat::add_rec_testata(TFatture_recordset& fat, TDocumento& doc)
{ {
fat.new_rec("BGM"); fat.new_rec("BGM");
fat.set("BGM.NUMDOC", doc.numero()); fat.set("BGM.NUMDOC", doc.numero());
fat.set("BGM.DATAOC", doc.data().string()); fat.set("BGM.DATAOC", doc.data().string());
fat.new_rec("NAS"); fat.new_rec("NAS");
fat.new_rec("NAI"); fat.new_rec("NAI");
fat.new_rec("FTX"); fat.new_rec("FTX");
fat.new_rec("PAT"); fat.new_rec("PAT");
fat.set("PAT.DESCRIZ", doc.pagamento().name());
} }
void THardy_esselunga_fat::add_rec_sommario(TFatture_recordset& fat, const TDocumento& doc) void THardy_esselunga_fat::add_rec_sommario(TFatture_recordset& fat, TDocumento& doc)
{ {
fat.new_rec("FTT"); //fat.new_rec("FTT"); non ci sono note nel documento!
// se c'e' sconto scrivo il record corrispondente
real r;
TString80 s;
bool sconto = scontoexpr2perc(doc.get(DOC_SCONTOPERC), FALSE, s, r);
if ( sconto && r != ZERO)
{
fat.new_rec("ALT"); fat.new_rec("ALT");
fat.set("ALT.IMPORTO", r);
fat.set("ALT.PERC", s);
}
TAssoc_array& tabella_iva = doc.tabella_iva();
TRiepilogo_iva* ri;
for (ri = (TRiepilogo_iva*) tabella_iva.first_item(); ri != NULL; ri = (TRiepilogo_iva*) tabella_iva.succ_item())
{
fat.new_rec("IVA"); fat.new_rec("IVA");
fat.set("IVA.DESCRIZ", ri->cod_iva().descrizione());
fat.set("IVA.ALIQIVA", ri->cod_iva().percentuale());
fat.set("IVA.SIMPONIB", ri->imponibile());
fat.set("IVA.SIMPORTO", ri->imposta());
}
fat.new_rec("TMA"); fat.new_rec("TMA");
fat.set("TMA.TOTDOC1", doc.totale_doc());
fat.set("TMA.IMPOSTA1", doc.imposta());
fat.set("TMA.IMPONIB1", doc.imponibile());
fat.set("TMA.TOTRIGHE1", doc.totale_netto());
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_rec_dettaglio(TFatture_recordset& fat, const TDocumento& doc, const TRiga_documento& rigadoc)
{ {
fat.new_rec("DET"); fat.new_rec("DET");
@ -471,6 +513,7 @@ void THardy_esselunga_fat::elabora(const TMask& mask)
TProgind pi(recset.items(), TR("Elaborazione documenti in corso..."), true, true); TProgind pi(recset.items(), TR("Elaborazione documenti in corso..."), true, true);
TFatture_recordset fatture; TFatture_recordset fatture;
TCodArtEsselunga_cache cache_ca; TCodArtEsselunga_cache cache_ca;
const bool definitivo = mask.get_bool(F_DEFINITIVO);
for (bool ok = recset.move_first(); ok; ok = recset.move_next()) for (bool ok = recset.move_first(); ok; ok = recset.move_next())
{ {
if (!pi.addstatus(1)) if (!pi.addstatus(1))
@ -486,16 +529,12 @@ void THardy_esselunga_fat::elabora(const TMask& mask)
FOR_EACH_PHYSICAL_RDOC(*doc, r, rigadoc) FOR_EACH_PHYSICAL_RDOC(*doc, r, rigadoc)
add_rec_dettaglio(fatture, *doc, *rigadoc); add_rec_dettaglio(fatture, *doc, *rigadoc);
add_rec_sommario(fatture, *doc); add_rec_sommario(fatture, *doc);
if (definitivo)
doc->put("HA_FATTURE", "X");
} // if check_cliente... } // if check_cliente...
} //for (bool ok = recset.move_first()... } //for (bool ok = recset.move_first()...
fatture.save_as(file_fatture, fmt_text); fatture.save_as(file_fatture, fmt_text);
// memorizzo su campo virtuale che il doc. e' stato inviato
const bool definitivo = mask.get_bool(F_DEFINITIVO);
if (definitivo)
{
}
log.print_or_preview(); log.print_or_preview();
} }