Patch level : 10.0 NO PATCH
Files correlati : ps0610 Ricompilazione Demo : [ ] Commento : Correzioni dopo prove git-svn-id: svn://10.65.10.50/branches/R_10_00@21255 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									94827f4e23
								
							
						
					
					
						commit
						c9c3634de3
					
				@ -1,6 +1,11 @@
 | 
			
		||||
#include <applicat.h>
 | 
			
		||||
 | 
			
		||||
#include "../ve/velib.h"
 | 
			
		||||
 | 
			
		||||
#include "../mg/anamag.h"
 | 
			
		||||
#include "../ve/rcondv.h"
 | 
			
		||||
 | 
			
		||||
#include "cfven.h"
 | 
			
		||||
#include "doc.h"
 | 
			
		||||
#include "rdoc.h"
 | 
			
		||||
 | 
			
		||||
@ -95,8 +100,9 @@ TDoc_key::TDoc_key(const int anno, const TString& codnum, const long ndoc, const
 | 
			
		||||
//classe TOrdf_cache
 | 
			
		||||
class TOrdf_cache : public TCache
 | 
			
		||||
{
 | 
			
		||||
  TString4 _codnum, _tipodoc;
 | 
			
		||||
  TString4 _codnum, _tipodoc, _stato;
 | 
			
		||||
  int      _anno;
 | 
			
		||||
  TDate    _data;
 | 
			
		||||
 | 
			
		||||
protected:
 | 
			
		||||
	virtual void discarding(const THash_object* obj);
 | 
			
		||||
@ -105,7 +111,7 @@ protected:
 | 
			
		||||
public:
 | 
			
		||||
  TDocumento& doc(const TDoc_key& kdoc);
 | 
			
		||||
  TDocumento& doc(const long      codcf);
 | 
			
		||||
  TOrdf_cache();
 | 
			
		||||
  TOrdf_cache(const char* from_tipodoc, const TDate& datatdoc);
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//DISCARDING: salva un documento sul disco prima di eliminarlo dalla cache
 | 
			
		||||
@ -127,8 +133,12 @@ TObject* TOrdf_cache::key2obj(const char* key)
 | 
			
		||||
 | 
			
		||||
    doc = new TDocumento('D', _anno, _codnum, 0);
 | 
			
		||||
    doc->put(DOC_TIPODOC, _tipodoc);
 | 
			
		||||
    doc->put(DOC_TIPOCF, 'F');
 | 
			
		||||
    doc->put(DOC_CODCF,  codcf);
 | 
			
		||||
    doc->put(DOC_STATO,   _stato);
 | 
			
		||||
    doc->put(DOC_TIPOCF,  'F');
 | 
			
		||||
    doc->put(DOC_CODCF,   codcf);
 | 
			
		||||
    doc->put(DOC_DATADOC, _data);
 | 
			
		||||
 | 
			
		||||
    doc->cli2doc();
 | 
			
		||||
  }
 | 
			
		||||
  else
 | 
			
		||||
  {
 | 
			
		||||
@ -160,14 +170,23 @@ TDocumento& TOrdf_cache::doc(const long codcf)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//metodo costruttore di una cache di 20 elementi
 | 
			
		||||
TOrdf_cache::TOrdf_cache() : TCache(20) 
 | 
			
		||||
TOrdf_cache::TOrdf_cache(const char* from_tipodoc, const TDate& datadoc) : TCache(20) 
 | 
			
		||||
{
 | 
			
		||||
  _codnum  = "ORDF";
 | 
			
		||||
  _tipodoc = "ORDF";
 | 
			
		||||
 | 
			
		||||
  const TDate oggi(TODAY);
 | 
			
		||||
  _anno = oggi.year();
 | 
			
		||||
 | 
			
		||||
  TToken_string key;
 | 
			
		||||
  key.add("TIP");
 | 
			
		||||
  key.add(from_tipodoc);
 | 
			
		||||
  TString80 cod_elab = cache().get(LF_TABCOM, key, "S3"); cod_elab.mid(5,12);
 | 
			
		||||
  
 | 
			
		||||
  key.cut(0);
 | 
			
		||||
  key.add("ELD");
 | 
			
		||||
  key.add(cod_elab);
 | 
			
		||||
  const TRectype& eld = cache().get(LF_TABCOM, key);
 | 
			
		||||
  _codnum  = eld.get("S6");
 | 
			
		||||
  _tipodoc = eld.get("S8");
 | 
			
		||||
  _stato   = eld.get("S9");
 | 
			
		||||
  
 | 
			
		||||
  _anno = datadoc.year();
 | 
			
		||||
  _data = datadoc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
                                                    ////////////////////////////////////
 | 
			
		||||
@ -186,6 +205,8 @@ protected:
 | 
			
		||||
 | 
			
		||||
  virtual void main_loop();
 | 
			
		||||
 | 
			
		||||
  const real cerca_prezzo(const char* codart, const long codcf);
 | 
			
		||||
 | 
			
		||||
  const bool cerca_orf(TDoc_key& dadoc, const long daidriga, const long for1, const long for2, TDoc_key& ordf1, TDoc_key& ordf2);
 | 
			
		||||
 
 | 
			
		||||
  void ordini_fornitore(const TDocumento& ordc, const int nriga, TDocumento& ordf);
 | 
			
		||||
@ -199,6 +220,39 @@ public:
 | 
			
		||||
  bool load_ini(bool check);  
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
//CERCA_PREZZO: cerco il prezzo di un articolo per un dato fornitore
 | 
			
		||||
const real TCrea_ordini_srm_app::cerca_prezzo(const char* codart, const long codcf)
 | 
			
		||||
{
 | 
			
		||||
  TToken_string key;
 | 
			
		||||
 | 
			
		||||
  //gestione CFVEN
 | 
			
		||||
  key.add('F');    //tipocf
 | 
			
		||||
  key.add(codcf);  //codcf
 | 
			
		||||
  const TRectype& cfven = cache().get(LF_CFVEN, key);
 | 
			
		||||
  const TString8 codlist = cfven.get(CFV_CODLIST);
 | 
			
		||||
  const TString8 catven  = cfven.get(CFV_CATVEN);
 | 
			
		||||
 | 
			
		||||
  key.cut(0);
 | 
			
		||||
  //gestione RCONDV
 | 
			
		||||
  key.add('L');     //tipo
 | 
			
		||||
  key.add(catven);  //categoria di vendita
 | 
			
		||||
  key.add("");      //tipocf
 | 
			
		||||
  key.add("");      //codcf
 | 
			
		||||
  key.add(codlist); //codice listino
 | 
			
		||||
  key.add('A');     //<A>rticolo
 | 
			
		||||
  key.add(codart);  //codice articolo
 | 
			
		||||
 | 
			
		||||
  real prezzo(cache().get(LF_RCONDV, key, RCONDV_PREZZO));
 | 
			
		||||
 | 
			
		||||
  if(prezzo == ZERO)
 | 
			
		||||
  {
 | 
			
		||||
    const TRectype& anamag = cache().get(LF_ANAMAG, codart);
 | 
			
		||||
    prezzo = anamag.get_real(ANAMAG_ULTCOS1);
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  return prezzo;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
//CERCA_ORF: cerco se esistono degli ordini fornitori che arrivano dall'ordine cliente in esame
 | 
			
		||||
const bool TCrea_ordini_srm_app::cerca_orf(TDoc_key& dadoc, const long daidriga, const long for1, const long for2, TDoc_key& ordf1, TDoc_key& ordf2)
 | 
			
		||||
{
 | 
			
		||||
@ -337,19 +391,19 @@ void TCrea_ordini_srm_app::elabora_ordini_cliente()
 | 
			
		||||
{              
 | 
			
		||||
  TConfig ini(_ini_name, "33");
 | 
			
		||||
  TString4 para;  para.format("%d", LF_DOC);
 | 
			
		||||
  const char     provv  = ini.get_char(DOC_PROVV, para);
 | 
			
		||||
	const int      anno   = ini.get_int(DOC_ANNO, para);
 | 
			
		||||
  const TString& codnum = ini.get(DOC_CODNUM, para);
 | 
			
		||||
  const long     ndoc   = ini.get_long(DOC_NDOC, para);
 | 
			
		||||
  const char     provv   = ini.get_char(DOC_PROVV, para);
 | 
			
		||||
	const int      anno    = ini.get_int(DOC_ANNO, para);
 | 
			
		||||
  const TString& codnum  = ini.get(DOC_CODNUM, para);
 | 
			
		||||
  const long     ndoc    = ini.get_long(DOC_NDOC, para);
 | 
			
		||||
 | 
			
		||||
  TDoc_key dadoc(anno, codnum, ndoc, provv);
 | 
			
		||||
  TDoc_key ordf1;
 | 
			
		||||
  TDoc_key ordf2;
 | 
			
		||||
 | 
			
		||||
  TOrdf_cache ca;
 | 
			
		||||
 | 
			
		||||
  TDocumento ordc(provv, anno, codnum, ndoc);
 | 
			
		||||
 | 
			
		||||
  TOrdf_cache ca(ordc.get(DOC_TIPODOC), ordc.get_date(DOC_DATADOC));
 | 
			
		||||
 | 
			
		||||
  //scorro le righe documento, fermandomi quando la set_paragraph fallisce
 | 
			
		||||
  //dal momento che non so a priori quante sono le righe del documento
 | 
			
		||||
  for(int i = 1; i <= ordc.rows(); i++)
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user