From 892e6d7eaa010f9b14301d31e6c8f6dc21873261 Mon Sep 17 00:00:00 2001 From: cris Date: Tue, 19 Apr 2011 13:31:56 +0000 Subject: [PATCH] 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 --- ha/ha2200.cpp | 162 ++++++++++++++++++++++++++++++++------------------ 1 file changed, 103 insertions(+), 59 deletions(-) diff --git a/ha/ha2200.cpp b/ha/ha2200.cpp index 2131cbbaa..ff39004c3 100755 --- a/ha/ha2200.cpp +++ b/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 (rget(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");