Patch level : 10.0
Files correlati : mg1.exe Ricompilazione Demo : [ ] Commento : Corretto ricalcolo giacenze di magazzino (segnalazione Guimatrag) git-svn-id: svn://10.65.10.50/branches/R_10_00@22551 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									7244924ffa
								
							
						
					
					
						commit
						aade406255
					
				| @ -645,6 +645,7 @@ bool TMov_mag::update_balances(bool lock) | ||||
|       if (pi) pi->addstatus(1); | ||||
| 			const TSaldo_mag& saldo = (const TSaldo_mag&)_saldi_mag[*curr_key]; | ||||
|       const TCodice_articolo& codart = saldo.codart(); | ||||
| 
 | ||||
| 			TArticolo_giacenza& art = cached_article_balances(codart); | ||||
| 
 | ||||
| 			if (art.lock_and_prompt(lock ? _testandlock : _nolock)) | ||||
| @ -659,6 +660,7 @@ bool TMov_mag::update_balances(bool lock) | ||||
| 					magcurr.put(MAG_NRIGA, nriga); | ||||
|           sld.add_row(magcurr); | ||||
|           err = mag.write(); | ||||
|           CHECKD(err == NOERR, "Errore di write:" , err); | ||||
| 				} | ||||
| 				update_balances(magcurr, saldo); | ||||
| 				err = mag.rewrite(); | ||||
| @ -736,7 +738,8 @@ void TMov_mag::update_balances(TRectype & magrec, const TSaldo_mag & s) | ||||
|   if (caus.update_qta()) | ||||
|   { | ||||
| 		const real diff = s.quant(); | ||||
| 
 | ||||
|     if (!diff.is_zero()) | ||||
|     { | ||||
|       update_balance(magrec, MAG_GIAC, diff, caus.sgn(s_giac)); // update ..
 | ||||
|       update_balance(magrec, MAG_ACQ, diff, caus.sgn(s_acq)); // update ..
 | ||||
|       update_balance(magrec, MAG_ENT, diff, caus.sgn(s_ent)); | ||||
| @ -758,10 +761,12 @@ void TMov_mag::update_balances(TRectype & magrec, const TSaldo_mag & s) | ||||
|       update_balance(magrec, MAG_USER5, diff, caus.sgn(s_user5)); | ||||
|       update_balance(magrec, MAG_USER6, diff, caus.sgn(s_user6)); | ||||
|     } | ||||
|   } | ||||
|   if (caus.update_val()) | ||||
|   { | ||||
| 		const real diff_val = s.valore(); | ||||
| 
 | ||||
|     if (!diff_val.is_zero()) | ||||
|     { | ||||
|       update_balance(magrec, MAG_VALACQ, diff_val, caus.sgn(s_acq)); // update ..
 | ||||
|       update_balance(magrec, MAG_VALENT, diff_val, caus.sgn(s_ent)); | ||||
|       update_balance(magrec, MAG_VALVEN, diff_val, caus.sgn(s_ven)); | ||||
| @ -778,6 +783,7 @@ void TMov_mag::update_balances(TRectype & magrec, const TSaldo_mag & s) | ||||
|       update_balance(magrec, MAG_USERVAL6, diff_val, caus.sgn(s_user6)); | ||||
|     } | ||||
|   } | ||||
| } | ||||
| 
 | ||||
| // aggiorna i saldi del record corrente 
 | ||||
| // in base alla causale e alla modifica fatta (con segno + o -)
 | ||||
| @ -877,6 +883,7 @@ void TMov_mag::update_balance(TRectype & rec, const char * fieldname, const real | ||||
| { | ||||
|   if (sgn != 0) | ||||
|   { | ||||
|     CHECK(!val.is_zero(), "Null balance"); | ||||
|     if (sgn > 0) | ||||
|       rec.add(fieldname, val); | ||||
|     else | ||||
| @ -1063,6 +1070,14 @@ bool rebuild_balances(int codes, const TTipo_valorizz tipo_valorizz, | ||||
| 	  c.scan(rel_reset_clifogiac, (void*)&p, msg); | ||||
|   } | ||||
| 
 | ||||
|   // Compattamento giacenze dopo cancellazione
 | ||||
|   { | ||||
|     //prefix().close_closeable_isamfiles(); // Altrimenti segnala -69 durante la pack
 | ||||
|   	TSystemisamfile mag(LF_MAG); | ||||
|     mag.pack(true, true); | ||||
|   } | ||||
| 
 | ||||
|    | ||||
|   // ricostruisce i saldi (ciclo sui movimenti)
 | ||||
|   bool ok = true; | ||||
|   { | ||||
| @ -1078,12 +1093,5 @@ bool rebuild_balances(int codes, const TTipo_valorizz tipo_valorizz, | ||||
| 
 | ||||
| 	a.close(); | ||||
| 
 | ||||
|   if (ok) | ||||
|   { | ||||
|     prefix().close_closeable_isamfiles(); // Altrimenti segnala -69 durante la pack
 | ||||
|   	TSystemisamfile mag(LF_MAG); | ||||
|     mag.pack(true, true); | ||||
|   } | ||||
|    | ||||
|   return ok; | ||||
| } | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user