Patch level :
Files correlati : Ricompilazione Demo : [ ] Commento : Corretta importazione clienti/agenti Hardy git-svn-id: svn://10.65.10.50/branches/R_10_00@21171 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									7c27eeb97b
								
							
						
					
					
						commit
						f1a956c591
					
				@ -177,7 +177,7 @@ void TIni2Txt::genera_cliente_var_txt(TConfig& ini)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  const long codcf = ini.get_long(CLI_CODCF);
 | 
					  const long codcf = ini.get_long(CLI_CODCF);
 | 
				
			||||||
  //il codice terminale è il codagente legato al cliente
 | 
					  //il codice terminale è il codagente legato al cliente
 | 
				
			||||||
  clienti.set("CodiceTerminale", find_codag(codcf));
 | 
					  clienti.set("CodiceTerminale", hd_find_codag(codcf));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  clienti.set("Segno", segno);
 | 
					  clienti.set("Segno", segno);
 | 
				
			||||||
  clienti.set("CodiceCliente", codcf);
 | 
					  clienti.set("CodiceCliente", codcf);
 | 
				
			||||||
@ -229,7 +229,7 @@ void TIni2Txt::genera_cliente_var_txt(TConfig& ini)
 | 
				
			|||||||
  //------------------
 | 
					  //------------------
 | 
				
			||||||
  ini.set_paragraph("17");
 | 
					  ini.set_paragraph("17");
 | 
				
			||||||
  const TString& str_sconto = ini.get(CFV_SCONTO);
 | 
					  const TString& str_sconto = ini.get(CFV_SCONTO);
 | 
				
			||||||
  clienti.set("ScontoFineFattura", find_sconto(str_sconto));
 | 
					  clienti.set("ScontoFineFattura", hd_find_sconto(str_sconto));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
  TString4 assfis = ini.get(CFV_ASSFIS);
 | 
					  TString4 assfis = ini.get(CFV_ASSFIS);
 | 
				
			||||||
@ -291,7 +291,7 @@ void TIni2Txt::genera_riga_listino_var_txt(TConfig& ini)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    //sconto
 | 
					    //sconto
 | 
				
			||||||
    const TString& str_sconto = ini.get(RCONDV_SCONTO);
 | 
					    const TString& str_sconto = ini.get(RCONDV_SCONTO);
 | 
				
			||||||
    riga_listino.set(RCONDV_SCONTO, find_sconto(str_sconto));
 | 
					    riga_listino.set(RCONDV_SCONTO, hd_find_sconto(str_sconto));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  } //for(int r=1;;...
 | 
					  } //for(int r=1;;...
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -331,7 +331,7 @@ void TIni2Txt::genera_prodotto_var_txt(TConfig& ini)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
  //sconto
 | 
					  //sconto
 | 
				
			||||||
  const TString& str_sconto = ini.get(ANAMAG_SCONTO);
 | 
					  const TString& str_sconto = ini.get(ANAMAG_SCONTO);
 | 
				
			||||||
  prodotto.set(ANAMAG_SCONTO, find_sconto(str_sconto));
 | 
					  prodotto.set(ANAMAG_SCONTO, hd_find_sconto(str_sconto));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  //campi da umart (49) (per ora una sola riga)
 | 
					  //campi da umart (49) (per ora una sola riga)
 | 
				
			||||||
  //-------------------------------------------
 | 
					  //-------------------------------------------
 | 
				
			||||||
@ -449,18 +449,18 @@ void TIni2Txt::genera_sospeso_var_txt(TConfig& ini, TString_array& ini_paragraph
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
            //riempie il record da esportare
 | 
					            //riempie il record da esportare
 | 
				
			||||||
            const long codcf = ini.get_long(PART_SOTTOCONTO);
 | 
					            const long codcf = ini.get_long(PART_SOTTOCONTO);
 | 
				
			||||||
            const TString& codage = find_codag(codcf);
 | 
					            const TString& codage = hd_find_codag(codcf);
 | 
				
			||||||
            sospeso.set("CodiceTerminale", codage);
 | 
					            sospeso.set("CodiceTerminale", codage);
 | 
				
			||||||
            sospeso.set("Segno", segno);
 | 
					            sospeso.set("Segno", segno);
 | 
				
			||||||
            sospeso.set("CodiceCliente", codcf);
 | 
					            sospeso.set("CodiceCliente", codcf);
 | 
				
			||||||
            sospeso.set("NumeroFattura", numfatt);
 | 
					            sospeso.set("NumeroFattura", numfatt);
 | 
				
			||||||
            sospeso.set("DataFattura", format_data_6(datadoc));
 | 
					            sospeso.set("DataFattura", hd_format_date6(datadoc));
 | 
				
			||||||
            residuo *= CENTO;
 | 
					            residuo *= CENTO;
 | 
				
			||||||
            residuo.round();
 | 
					            residuo.round();
 | 
				
			||||||
            sospeso.set("ImportoResiduo", residuo);
 | 
					            sospeso.set("ImportoResiduo", residuo);
 | 
				
			||||||
            imp_rata.round();
 | 
					            imp_rata.round();
 | 
				
			||||||
            sospeso.set("ImpOriginalDoc", imp_rata);
 | 
					            sospeso.set("ImpOriginalDoc", imp_rata);
 | 
				
			||||||
            sospeso.set("DataScadenza", format_data_6(data_rata));
 | 
					            sospeso.set("DataScadenza", hd_format_date6(data_rata));
 | 
				
			||||||
            sospeso.set("TipoDocumento", "F");
 | 
					            sospeso.set("TipoDocumento", "F");
 | 
				
			||||||
          }
 | 
					          }
 | 
				
			||||||
        } //if (find_part_key(ini, ini_paragraphs, LF_SCADENZE...
 | 
					        } //if (find_part_key(ini, ini_paragraphs, LF_SCADENZE...
 | 
				
			||||||
 | 
				
			|||||||
@ -222,7 +222,7 @@ void TFile2Txt::genera_clienti_txt(const long da_codcli)
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const TString& str_sconto = archivio_clienti.get(CFV_SCONTO).as_string();
 | 
					    const TString& str_sconto = archivio_clienti.get(CFV_SCONTO).as_string();
 | 
				
			||||||
    clienti.set("ScontoFineFattura", find_sconto(str_sconto));
 | 
					    clienti.set("ScontoFineFattura", hd_find_sconto(str_sconto));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TString80 ntel = archivio_clienti.get(CLI_PTEL).as_string();
 | 
					    TString80 ntel = archivio_clienti.get(CLI_PTEL).as_string();
 | 
				
			||||||
    ntel << archivio_clienti.get(CLI_TEL).as_string();
 | 
					    ntel << archivio_clienti.get(CLI_TEL).as_string();
 | 
				
			||||||
@ -286,16 +286,16 @@ void TFile2Txt::genera_sospesi_txt()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    //e vai che riempiamo i campi
 | 
					    //e vai che riempiamo i campi
 | 
				
			||||||
    const long codcf = rec_part.get_long(PART_SOTTOCONTO);  //riprendiamo il codcf come long
 | 
					    const long codcf = rec_part.get_long(PART_SOTTOCONTO);  //riprendiamo il codcf come long
 | 
				
			||||||
    const TString& codage = find_codag(codcf);
 | 
					    const TString& codage = hd_find_codag(codcf);
 | 
				
			||||||
    sospesi.set("CodiceTerminale", codage);
 | 
					    sospesi.set("CodiceTerminale", codage);
 | 
				
			||||||
    sospesi.set("CodiceCliente", codcf);
 | 
					    sospesi.set("CodiceCliente", codcf);
 | 
				
			||||||
    const TString& ndoc = rec_part.get(PART_NUMDOC);
 | 
					    const TString& ndoc = rec_part.get(PART_NUMDOC);
 | 
				
			||||||
    sospesi.set("NumeroFattura", ndoc);
 | 
					    sospesi.set("NumeroFattura", ndoc);
 | 
				
			||||||
    const TDate datadoc = rec_part.get_date(PART_DATADOC);
 | 
					    const TDate datadoc = rec_part.get_date(PART_DATADOC);
 | 
				
			||||||
    sospesi.set("DataFattura", format_data_6(datadoc));
 | 
					    sospesi.set("DataFattura", hd_format_date6(datadoc));
 | 
				
			||||||
    sospesi.set("ImportoResiduo", residuo.valore());
 | 
					    sospesi.set("ImportoResiduo", residuo.valore());
 | 
				
			||||||
    sospesi.set("ImpOriginalDoc", doc.valore());
 | 
					    sospesi.set("ImpOriginalDoc", doc.valore());
 | 
				
			||||||
    sospesi.set("DataScadenza", format_data_6(datascad));
 | 
					    sospesi.set("DataScadenza", hd_format_date6(datascad));
 | 
				
			||||||
    TString16 cod_partita;
 | 
					    TString16 cod_partita;
 | 
				
			||||||
    cod_partita << rec_part.get_int(PART_ANNO) << "-" << rec_part.get(PART_NUMPART);
 | 
					    cod_partita << rec_part.get_int(PART_ANNO) << "-" << rec_part.get(PART_NUMPART);
 | 
				
			||||||
    sospesi.set("Partita", cod_partita);
 | 
					    sospesi.set("Partita", cod_partita);
 | 
				
			||||||
@ -345,7 +345,7 @@ void TFile2Txt::genera_righelistini_txt()
 | 
				
			|||||||
    righe_listini.set(RCONDV_PREZZO, prezzo.integer());
 | 
					    righe_listini.set(RCONDV_PREZZO, prezzo.integer());
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const TString& str_sconto = archivio_rcondv.get(RCONDV_SCONTO).as_string();
 | 
					    const TString& str_sconto = archivio_rcondv.get(RCONDV_SCONTO).as_string();
 | 
				
			||||||
    righe_listini.set(RCONDV_SCONTO, find_sconto(str_sconto));
 | 
					    righe_listini.set(RCONDV_SCONTO, hd_find_sconto(str_sconto));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TFilename output_path = genera_path("listini");
 | 
					  TFilename output_path = genera_path("listini");
 | 
				
			||||||
@ -374,19 +374,19 @@ void TFile2Txt::genera_contratti_txt()
 | 
				
			|||||||
    righe_contratti.new_rec("");
 | 
					    righe_contratti.new_rec("");
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    const long codcf = archivio_rcondv.get(CONDV_CODCF).as_int();
 | 
					    const long codcf = archivio_rcondv.get(CONDV_CODCF).as_int();
 | 
				
			||||||
    righe_contratti.set("CodiceTerminale", find_codag(codcf));
 | 
					    righe_contratti.set("CodiceTerminale", hd_find_codag(codcf));
 | 
				
			||||||
    righe_contratti.set(RCONDV_CODRIGA, archivio_rcondv.get(RCONDV_CODRIGA));
 | 
					    righe_contratti.set(RCONDV_CODRIGA, archivio_rcondv.get(RCONDV_CODRIGA));
 | 
				
			||||||
    real prezzo = archivio_rcondv.get(RCONDV_PREZZO).as_real();
 | 
					    real prezzo = archivio_rcondv.get(RCONDV_PREZZO).as_real();
 | 
				
			||||||
    prezzo *= 1000;
 | 
					    prezzo *= 1000;
 | 
				
			||||||
    prezzo.round();
 | 
					    prezzo.round();
 | 
				
			||||||
    righe_contratti.set(RCONDV_PREZZO, prezzo.integer());
 | 
					    righe_contratti.set(RCONDV_PREZZO, prezzo.integer());
 | 
				
			||||||
    const TString& str_sconto = archivio_rcondv.get(RCONDV_SCONTO).as_string();
 | 
					    const TString& str_sconto = archivio_rcondv.get(RCONDV_SCONTO).as_string();
 | 
				
			||||||
    righe_contratti.set(RCONDV_SCONTO, find_sconto(str_sconto));
 | 
					    righe_contratti.set(RCONDV_SCONTO, hd_find_sconto(str_sconto));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    TDate dataini = archivio_rcondv.get("CONDV.VALIN").as_date();
 | 
					    TDate dataini = archivio_rcondv.get("CONDV.VALIN").as_date();
 | 
				
			||||||
    righe_contratti.set(CONDV_VALIN, format_data_8(dataini));
 | 
					    righe_contratti.set(CONDV_VALIN, hd_format_date8(dataini));
 | 
				
			||||||
    TDate datafine = archivio_rcondv.get("CONDV.VALFIN").as_date();
 | 
					    TDate datafine = archivio_rcondv.get("CONDV.VALFIN").as_date();
 | 
				
			||||||
    righe_contratti.set(CONDV_VALFIN, format_data_8(datafine));
 | 
					    righe_contratti.set(CONDV_VALFIN, hd_format_date8(datafine));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TFilename output_path = genera_path("particolari");
 | 
					  TFilename output_path = genera_path("particolari");
 | 
				
			||||||
@ -453,7 +453,7 @@ void TFile2Txt::genera_prodotti_txt()
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
    prodotti.set(UMART_UM, archivio_anamag.get("UMART.UM"));
 | 
					    prodotti.set(UMART_UM, archivio_anamag.get("UMART.UM"));
 | 
				
			||||||
    const TString& str_sconto = archivio_anamag.get(ANAMAG_SCONTO).as_string();
 | 
					    const TString& str_sconto = archivio_anamag.get(ANAMAG_SCONTO).as_string();
 | 
				
			||||||
    prodotti.set(ANAMAG_SCONTO, find_sconto(str_sconto));
 | 
					    prodotti.set(ANAMAG_SCONTO, hd_find_sconto(str_sconto));
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TFilename output_path = genera_path("prodotti");
 | 
					  TFilename output_path = genera_path("prodotti");
 | 
				
			||||||
 | 
				
			|||||||
@ -863,7 +863,7 @@ bool THardy_clienti::trasferisci_clienti()
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    // costruisco la chiave 
 | 
					    // costruisco la chiave 
 | 
				
			||||||
    const TString& key = get_str("IdConto");
 | 
					    const TString& key = get_str("IdConto");
 | 
				
			||||||
    const long codcf = get_codcf(key);
 | 
					    const long codcf = hd_key2cli(key);
 | 
				
			||||||
    if (codcf > 0)
 | 
					    if (codcf > 0)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      rec.zero();
 | 
					      rec.zero();
 | 
				
			||||||
@ -872,11 +872,11 @@ bool THardy_clienti::trasferisci_clienti()
 | 
				
			|||||||
      // ricerca comune
 | 
					      // ricerca comune
 | 
				
			||||||
      const TString8 cap = get_str("IdCap");     //cap
 | 
					      const TString8 cap = get_str("IdCap");     //cap
 | 
				
			||||||
      TString80 loc = get_str("Localita");       //località
 | 
					      TString80 loc = get_str("Localita");       //località
 | 
				
			||||||
      const TString8 com = cap2comune(cap,loc);  //codice comune
 | 
					      const TString4 com = cap2comune(cap,loc);  //codice comune
 | 
				
			||||||
      const TString8 stato = get_str("IdNazione"); //stato
 | 
					      const TString4 stato = get_str("IdNazione"); //stato
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      rec.put(CLI_CAPCF, cap);   
 | 
					      rec.put(CLI_CAPCF, cap);   
 | 
				
			||||||
      if (com.full() && !com.blank())
 | 
					      if (com.full())
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        rec.put(CLI_COMCF, com);  //se riesce la CAP2COMUNE, inserisco il codice comune  
 | 
					        rec.put(CLI_COMCF, com);  //se riesce la CAP2COMUNE, inserisco il codice comune  
 | 
				
			||||||
        loc = "";
 | 
					        loc = "";
 | 
				
			||||||
@ -928,12 +928,17 @@ bool THardy_clienti::trasferisci_clienti()
 | 
				
			|||||||
bool THardy_clienti::is_piva_doppia(const long codcf)
 | 
					bool THardy_clienti::is_piva_doppia(const long codcf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TToken_string tok; tok.add("C"); tok.add(codcf);
 | 
					  TToken_string tok; tok.add("C"); tok.add(codcf);
 | 
				
			||||||
  const TString& statopaiv = cache().get(LF_CLIFO, tok, CLI_STATOPAIV);
 | 
					  const TRectype& cli = cache().get(LF_CLIFO, tok);
 | 
				
			||||||
  const TString& paiv = cache().get(LF_CLIFO, tok, CLI_PAIV);
 | 
					  const TString& statopaiv = cli.get(CLI_STATOPAIV);
 | 
				
			||||||
  TISAM_recordset clifo("USE CLIFO KEY 5\nSELECT (CODCF > 200000)&&(CODCF < 300000)\nFROM TIPOCF='C' STATOPAIV=#STATOPAIV PAIV=#PAIV\nTO TIPOCF='C' STATOPAIV=#STATOPAIV PAIV=#PAIV");
 | 
					  const TString& paiv = cli.get(CLI_PAIV);
 | 
				
			||||||
 | 
					  
 | 
				
			||||||
 | 
					  TISAM_recordset clifo("USE CLIFO KEY 5\n"
 | 
				
			||||||
 | 
					                        "SELECT (CODCF>200000)&&(CODCF<300000)\n"
 | 
				
			||||||
 | 
					                        "FROM TIPOCF='C' STATOPAIV=#STATOPAIV PAIV=#PAIV\n"
 | 
				
			||||||
 | 
					                        "TO TIPOCF='C' STATOPAIV=#STATOPAIV PAIV=#PAIV");
 | 
				
			||||||
  clifo.set_var("#STATOPAIV", TVariant(statopaiv));
 | 
					  clifo.set_var("#STATOPAIV", TVariant(statopaiv));
 | 
				
			||||||
  clifo.set_var("#PAIV", TVariant(paiv));
 | 
					  clifo.set_var("#PAIV", TVariant(paiv));
 | 
				
			||||||
  return (clifo.items() > 1);
 | 
					  return (clifo.items() > 1); // Spiegare??????????
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// restituisce il codice indirizzo di spedizione da usare per inserimento record
 | 
					// restituisce il codice indirizzo di spedizione da usare per inserimento record
 | 
				
			||||||
@ -978,23 +983,22 @@ bool THardy_clienti::trasferisci_destinazioni()
 | 
				
			|||||||
  {
 | 
					  {
 | 
				
			||||||
    // costruisco la chiave 
 | 
					    // costruisco la chiave 
 | 
				
			||||||
    const TString& key = get_str("IdConto");
 | 
					    const TString& key = get_str("IdConto");
 | 
				
			||||||
    const long codcf = get_codcf(key);
 | 
					    const long codcf = hd_key2cli(key);
 | 
				
			||||||
    rec.zero();
 | 
					    rec.zero();
 | 
				
			||||||
		rec.put(CLI_TIPOCF, "C");
 | 
							rec.put(CLI_TIPOCF, "C");
 | 
				
			||||||
		rec.put(CLI_CODCF, codcf);
 | 
							rec.put(CLI_CODCF, codcf);
 | 
				
			||||||
		bool good = clifo.read() == NOERR;
 | 
							bool good = clifo.read() == NOERR;
 | 
				
			||||||
		if (good)
 | 
							if (good)
 | 
				
			||||||
		{
 | 
							{
 | 
				
			||||||
      bool doppio = is_piva_doppia(codcf);
 | 
					      if (codcf > 200000 && codcf < 300000 && is_piva_doppia(codcf))
 | 
				
			||||||
      if (codcf > 200000 && codcf < 300000 && doppio)
 | 
					 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        // cambio dati tra clienti e destinazione
 | 
					        // cambio dati tra clienti e destinazione
 | 
				
			||||||
        
 | 
					        
 | 
				
			||||||
        // ricerca comune
 | 
					        // ricerca comune
 | 
				
			||||||
        const TString8 cap = get_str("IdCap");     //cap
 | 
					        const TString8 cap = get_str("IdCap");     //cap
 | 
				
			||||||
        TString80 loc = get_str("Localita");       //località
 | 
					        TString80 loc = get_str("Localita");       //località
 | 
				
			||||||
        const TString8 com = cap2comune(cap,loc);  //codice comune
 | 
					        const TString4 com = cap2comune(cap,loc);  //codice comune
 | 
				
			||||||
        const TString8 stato = get_str("IdNazione"); //stato
 | 
					        const TString4 stato = get_str("IdNazione"); //stato
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        rec.put(CLI_CAPCF, cap);   
 | 
					        rec.put(CLI_CAPCF, cap);   
 | 
				
			||||||
        if (com.full() && !com.blank())
 | 
					        if (com.full() && !com.blank())
 | 
				
			||||||
@ -1014,7 +1018,7 @@ bool THardy_clienti::trasferisci_destinazioni()
 | 
				
			|||||||
        if (test_write(clifo))
 | 
					        if (test_write(clifo))
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
  			  TString msg;
 | 
					  			  TString msg;
 | 
				
			||||||
	  		  msg << TR("Modificato cliente ") << " '" << key << '\'' << TR("con codice ") << codcf ;
 | 
						  		  msg << TR("Modificato cliente ") << " '" << key << '\'' << TR(" con codice ") << codcf ;
 | 
				
			||||||
		  	  log(msg);
 | 
							  	  log(msg);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
@ -1051,7 +1055,7 @@ bool THardy_clienti::trasferisci_destinazioni()
 | 
				
			|||||||
// THardy_fornitori
 | 
					// THardy_fornitori
 | 
				
			||||||
///////////////////////////////////////////////////////////
 | 
					///////////////////////////////////////////////////////////
 | 
				
			||||||
 | 
					
 | 
				
			||||||
long THardy_clienti::get_codcf(const TString& key) const 
 | 
					long THardy_fornitori::key2forn(const TString& key) const 
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  const long codcf = atol(key.mid(3,6));
 | 
					  const long codcf = atol(key.mid(3,6));
 | 
				
			||||||
  return codcf;
 | 
					  return codcf;
 | 
				
			||||||
@ -1076,7 +1080,7 @@ bool THardy_fornitori::trasferisci()
 | 
				
			|||||||
  while (++hi)
 | 
					  while (++hi)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    const TString& key = get_str("IdConto");
 | 
					    const TString& key = get_str("IdConto");
 | 
				
			||||||
    const long codcf = get_codcf(key);
 | 
					    const long codcf = key2forn(key);
 | 
				
			||||||
    if (codcf > 0)
 | 
					    if (codcf > 0)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      rec.zero();
 | 
					      rec.zero();
 | 
				
			||||||
@ -1085,11 +1089,11 @@ bool THardy_fornitori::trasferisci()
 | 
				
			|||||||
      // ricerca comune
 | 
					      // ricerca comune
 | 
				
			||||||
      const TString8 cap = get_str("IdCap");     //cap
 | 
					      const TString8 cap = get_str("IdCap");     //cap
 | 
				
			||||||
      TString80 loc = get_str("Localita");       //località
 | 
					      TString80 loc = get_str("Localita");       //località
 | 
				
			||||||
      const TString8 com = cap2comune(cap,loc);  //codice comune
 | 
					      const TString4 com = cap2comune(cap,loc);  //codice comune
 | 
				
			||||||
      const TString8 stato = get_str("IdNazione"); //stato
 | 
					      const TString4 stato = get_str("IdNazione"); //stato
 | 
				
			||||||
 | 
					
 | 
				
			||||||
      rec.put(CLI_CAPCF, cap);   
 | 
					      rec.put(CLI_CAPCF, cap);   
 | 
				
			||||||
      if (com.full() && !com.blank())
 | 
					      if (com.full())
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        rec.put(CLI_COMCF, com);  //se riesce la CAP2COMUNE, inserisco il codice comune  
 | 
					        rec.put(CLI_COMCF, com);  //se riesce la CAP2COMUNE, inserisco il codice comune  
 | 
				
			||||||
        loc = "";
 | 
					        loc = "";
 | 
				
			||||||
 | 
				
			|||||||
@ -202,14 +202,16 @@ protected:
 | 
				
			|||||||
  int get_next_key_indsped(const char tipocf, const long codcf) const;
 | 
					  int get_next_key_indsped(const char tipocf, const long codcf) const;
 | 
				
			||||||
  bool trasferisci_clienti();
 | 
					  bool trasferisci_clienti();
 | 
				
			||||||
  bool trasferisci_destinazioni();
 | 
					  bool trasferisci_destinazioni();
 | 
				
			||||||
  long get_codcf(const TString& key) const;
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual bool trasferisci();
 | 
					  virtual bool trasferisci();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
class THardy_fornitori : public THardy_clienti
 | 
					class THardy_fornitori : public THardy_transfer
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
 | 
					protected:
 | 
				
			||||||
 | 
					  long key2forn(const TString& key) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  virtual bool trasferisci();
 | 
					  virtual bool trasferisci();
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										34
									
								
								ha/halib.cpp
									
									
									
									
									
								
							
							
						
						
									
										34
									
								
								ha/halib.cpp
									
									
									
									
									
								
							@ -355,32 +355,33 @@ TEsporta_pagamenti_recordset::TEsporta_pagamenti_recordset(int rec_length)
 | 
				
			|||||||
/////////////////////////////////////////////////////////////
 | 
					/////////////////////////////////////////////////////////////
 | 
				
			||||||
//	Metodi di utility
 | 
					//	Metodi di utility
 | 
				
			||||||
/////////////////////////////////////////////////////////////
 | 
					/////////////////////////////////////////////////////////////
 | 
				
			||||||
real find_sconto(const TString& str_sconto)
 | 
					real hd_find_sconto(const TString& str_sconto)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TString goodexp;
 | 
					 | 
				
			||||||
  real val_perc;
 | 
					  real val_perc;
 | 
				
			||||||
 | 
					  if (str_sconto.full())
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    TString goodexp;
 | 
				
			||||||
    if (scontoexpr2perc(str_sconto, false, goodexp, val_perc))
 | 
					    if (scontoexpr2perc(str_sconto, false, goodexp, val_perc))
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      val_perc = CENTO - (val_perc * CENTO);
 | 
					      val_perc = CENTO - (val_perc * CENTO);
 | 
				
			||||||
      val_perc *= CENTO;
 | 
					      val_perc *= CENTO;
 | 
				
			||||||
      val_perc.round();
 | 
					      val_perc.round();
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  return val_perc;
 | 
					  return val_perc;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// Trova il codice agente Hardy (lungo 3) del cliente Campo 
 | 
				
			||||||
const TString& find_codag(const long codcf)
 | 
					const TString& hd_find_codag(long codcf)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TToken_string key_cfven;
 | 
					  TString8 key_cfven;
 | 
				
			||||||
  key_cfven.add("C");
 | 
					  key_cfven.format("C|%ld", codcf);
 | 
				
			||||||
  key_cfven.add(codcf);
 | 
					  const TString& codag = cache().get(LF_CFVEN, key_cfven, CFV_CODAG);
 | 
				
			||||||
  const TRectype& rec_cfven = cache().get(LF_CFVEN, key_cfven);
 | 
					 | 
				
			||||||
  TString8 codag = rec_cfven.get(CFV_CODAG);
 | 
					 | 
				
			||||||
  return codag.right(3);   //il loro codagente è lungo 3!!!
 | 
					  return codag.right(3);   //il loro codagente è lungo 3!!!
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
//il dio dei programmatori ci perdoni!
 | 
					//il dio dei programmatori ci perdoni!
 | 
				
			||||||
const TString& format_data_8(const TDate& data)
 | 
					const TString& hd_format_date8(const TDate& data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  const int day = data.day();
 | 
					  const int day = data.day();
 | 
				
			||||||
  const int month = data.month();
 | 
					  const int month = data.month();
 | 
				
			||||||
@ -390,7 +391,7 @@ const TString& format_data_8(const TDate& data)
 | 
				
			|||||||
  return str_data;
 | 
					  return str_data;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
const TString& format_data_6(const TDate& data)
 | 
					const TString& hd_format_date6(const TDate& data)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  const int day = data.day();
 | 
					  const int day = data.day();
 | 
				
			||||||
  const int month = data.month();
 | 
					  const int month = data.month();
 | 
				
			||||||
@ -401,22 +402,19 @@ const TString& format_data_6(const TDate& data)
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// determina codice cliente campo a partire da codice hardy in base alle regole dettatemi da Robbi
 | 
					// determina codice cliente campo a partire da codice hardy in base alle regole dettatemi da Robbi
 | 
				
			||||||
const long get_codcf(const TString& key)
 | 
					
 | 
				
			||||||
 | 
					long hd_key2cli(const TString& key)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  long codcf = 0;
 | 
					  const long cod_hardy = atol(key.mid(3,6));
 | 
				
			||||||
  const char first = key[0];
 | 
					  const char first = key[0];
 | 
				
			||||||
  long cod_hardy = atoi(key.mid(3,6));
 | 
					  long codcf = 0;
 | 
				
			||||||
  switch (first)
 | 
					  switch (first)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
  case 'H':
 | 
					  case 'H':
 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
    codcf = 130000+cod_hardy;
 | 
					    codcf = 130000+cod_hardy;
 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
  case 'P':
 | 
					  case 'P':
 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
    codcf = 140000+cod_hardy;
 | 
					    codcf = 140000+cod_hardy;
 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
    break;
 | 
					    break;
 | 
				
			||||||
  case '0':
 | 
					  case '0':
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
 | 
				
			|||||||
							
								
								
									
										13
									
								
								ha/halib.h
									
									
									
									
									
								
							
							
						
						
									
										13
									
								
								ha/halib.h
									
									
									
									
									
								
							@ -211,14 +211,11 @@ public:
 | 
				
			|||||||
  TEsporta_pagamenti_recordset(int rec_length = 27);
 | 
					  TEsporta_pagamenti_recordset(int rec_length = 27);
 | 
				
			||||||
};
 | 
					};
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
 | 
					 | 
				
			||||||
//----------------------------------------------------------
 | 
					//----------------------------------------------------------
 | 
				
			||||||
//metodi di utility
 | 
					//metodi di utility
 | 
				
			||||||
//----------------------------------------------------------
 | 
					//----------------------------------------------------------
 | 
				
			||||||
real find_sconto(const TString& str_sconto);
 | 
					real hd_find_sconto(const TString& str_sconto);
 | 
				
			||||||
const TString& find_codag(const long codcf);
 | 
					const TString& hd_find_codag(long codcf);  // Da cliente campo ad agente Hardy ("007")
 | 
				
			||||||
const TString& format_data_8(const TDate& data);
 | 
					const TString& hd_format_date8(const TDate& data);
 | 
				
			||||||
const TString& format_data_6(const TDate& data);
 | 
					const TString& hd_format_date6(const TDate& data);
 | 
				
			||||||
const long get_codcf(const TString& key);
 | 
					long hd_key2cli(const TString& key);
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user