Patch level :4.0 /10.0
Files correlati : Ricompilazione Demo : [ ] Commento :real calc_conai_qta(int type) const; metodo aggiunto alla TRiga_documento git-svn-id: svn://10.65.10.50/trunk@16216 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									b06248e0e7
								
							
						
					
					
						commit
						adbf06d2d0
					
				@ -536,6 +536,8 @@ public:
 | 
				
			|||||||
	real quantita() const;
 | 
						real quantita() const;
 | 
				
			||||||
	real qtaevasa() const;
 | 
						real qtaevasa() const;
 | 
				
			||||||
	real qtaresidua() const;
 | 
						real qtaresidua() const;
 | 
				
			||||||
 | 
					  real calc_conai_qta(int type) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	real valore(bool totale, int ndec) const;
 | 
						real valore(bool totale, int ndec) const;
 | 
				
			||||||
	const TString & codice_costo() const;
 | 
						const TString & codice_costo() const;
 | 
				
			||||||
	const TString & codice_commessa() const;
 | 
						const TString & codice_commessa() const;
 | 
				
			||||||
 | 
				
			|||||||
@ -770,6 +770,38 @@ real TRiga_documento::qtaresidua() const
 | 
				
			|||||||
  return ZERO;
 | 
					  return ZERO;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					real TRiga_documento::calc_conai_qta(int type) const
 | 
				
			||||||
 | 
					{                                     
 | 
				
			||||||
 | 
					  const char* const __conai_art_names[] = {"CONACC", "CONALL", "CONCAR", "CONPLA", "CONLEG", "CONVET"};
 | 
				
			||||||
 | 
						real row_qta;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (is_merce())
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
						  const bool has_formula = ((TTipo_riga_documento &)tipo()).has_formula(__conai_art_names[type]);
 | 
				
			||||||
 | 
						  TArticolo_giacenza* art = articolo();
 | 
				
			||||||
 | 
						  if (art != NULL)
 | 
				
			||||||
 | 
						  {
 | 
				
			||||||
 | 
							  const TString4 um = get(RDOC_UMQTA);
 | 
				
			||||||
 | 
							  row_qta = art->convert_to_um(get_real(RDOC_QTA), NULL, um);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							  if (has_formula)
 | 
				
			||||||
 | 
								  row_qta *= get_real(__conai_art_names[type]);
 | 
				
			||||||
 | 
							  else
 | 
				
			||||||
 | 
								  row_qta *= art->get_real(__conai_art_names[type]);
 | 
				
			||||||
 | 
						  }
 | 
				
			||||||
 | 
					    else
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      if (has_formula)
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					        row_qta = get_real(RDOC_QTA);
 | 
				
			||||||
 | 
					        row_qta *= get_real(__conai_art_names[type]);
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  } 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return row_qta;
 | 
				
			||||||
 | 
					}   
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool TRiga_documento::is_evasa() const
 | 
					bool TRiga_documento::is_evasa() const
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  return qtaresidua().is_zero();
 | 
					  return qtaresidua().is_zero();
 | 
				
			||||||
 | 
				
			|||||||
@ -2419,7 +2419,6 @@ void TDocumento::update_spese_aut(TString_array & spese_aut, bool preserve_old,
 | 
				
			|||||||
                                   
 | 
					                                   
 | 
				
			||||||
real TDocumento::calc_conai_qta(int type)
 | 
					real TDocumento::calc_conai_qta(int type)
 | 
				
			||||||
{                                      
 | 
					{                                      
 | 
				
			||||||
  const char* const __conai_art_names[] = {"CONACC", "CONALL", "CONCAR", "CONPLA", "CONLEG", "CONVET"};
 | 
					 | 
				
			||||||
	real qta;
 | 
						real qta;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	for (int i = physical_rows(); i > 0; i--)     
 | 
						for (int i = physical_rows(); i > 0; i--)     
 | 
				
			||||||
@ -2427,28 +2426,8 @@ real TDocumento::calc_conai_qta(int type)
 | 
				
			|||||||
		const TRiga_documento& r = row(i);
 | 
							const TRiga_documento& r = row(i);
 | 
				
			||||||
    if (r.is_merce())
 | 
					    if (r.is_merce())
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
  	  const bool has_formula = ((TTipo_riga_documento &)r.tipo()).has_formula(__conai_art_names[type]);
 | 
					      const real row_qta = r.calc_conai_qta(type);
 | 
				
			||||||
		  TArticolo_giacenza* art = r.articolo();
 | 
					 | 
				
			||||||
      real row_qta;
 | 
					 | 
				
			||||||
		  if (art != NULL)
 | 
					 | 
				
			||||||
		  {
 | 
					 | 
				
			||||||
			  const TString4 um = r.get(RDOC_UMQTA);
 | 
					 | 
				
			||||||
			  row_qta = art->convert_to_um(r.get_real(RDOC_QTA), NULL, um);
 | 
					 | 
				
			||||||
 | 
					
 | 
				
			||||||
			  if (has_formula)
 | 
					 | 
				
			||||||
				  row_qta *= r.get_real(__conai_art_names[type]);
 | 
					 | 
				
			||||||
			  else
 | 
					 | 
				
			||||||
				  row_qta *= art->get_real(__conai_art_names[type]);
 | 
					 | 
				
			||||||
		  }
 | 
					 | 
				
			||||||
      else
 | 
					 | 
				
			||||||
      {
 | 
					 | 
				
			||||||
        if (has_formula)
 | 
					 | 
				
			||||||
        {
 | 
					 | 
				
			||||||
          row_qta = r.get_real(RDOC_QTA);
 | 
					 | 
				
			||||||
          row_qta *= r.get_real(__conai_art_names[type]);
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					 | 
				
			||||||
 		  if (row_qta > ZERO) 
 | 
					 | 
				
			||||||
			qta += row_qta;
 | 
								qta += row_qta;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
	}  
 | 
						}  
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user