From d0512bec00af0ebef8f7b1f08d780ddf5e2d0dc9 Mon Sep 17 00:00:00 2001
From: luca <luca@c028cbd2-c16b-5b4b-a496-9718f37d4682>
Date: Fri, 11 Feb 2011 10:35:08 +0000
Subject: [PATCH] Patch level         :10.0 Files correlati     :
 Ricompilazione Demo : [ ] Commento            : sistemato problema della sede
 che compare nella fase quando si creano nuove righe di allineamento al
 maturato (prg gestione budget avanzata)

git-svn-id: svn://10.65.10.50/branches/R_10_00@21630 c028cbd2-c16b-5b4b-a496-9718f37d4682
---
 ps/ps1001300.cpp | 20 +++++++++++---------
 1 file changed, 11 insertions(+), 9 deletions(-)

diff --git a/ps/ps1001300.cpp b/ps/ps1001300.cpp
index 7aed7b5b4..1a1eccc49 100755
--- a/ps/ps1001300.cpp
+++ b/ps/ps1001300.cpp
@@ -169,10 +169,7 @@ TVariazione_budget_mask::TVariazione_budget_mask() : TAutomask ("ps1001300a")
   TSheet_field& sf_righe = sfield(F_RIGHE);
   _pos_fase = sf_righe.cid2index(S_FASE);
   if (_exclude_fasi)
-  {
     sf_righe.delete_column(_pos_fase);
-    _pos_fase = -1;
-  }
 
   //setta le posizioni dei campi dello sheet
   _pos_check = sf_righe.cid2index(S_CHECK);
@@ -617,7 +614,8 @@ int TVariazione_budget_mask::modifica_movana(const long numreg, TSheet_field& sf
       if (r_numrig <= 0)
       {
         rmovana.put(RMOVANA_CODCMS, sf_righe.cell(i, _pos_cms));
-        rmovana.put(RMOVANA_CODFASE, sf_righe.cell(i, _pos_fase));
+        if (!_exclude_fasi)
+          rmovana.put(RMOVANA_CODFASE, sf_righe.cell(i, _pos_fase));
         rmovana.put(RMOVANA_CODCCOSTO, sf_righe.cell(i, _pos_cdc));
         rmovana.put(RMOVANA_CODCONTO, sf_righe.cell(i, _pos_conto));
         rmovana.put(RMOVANA_DATACOMP, sf_righe.cell(i, _pos_datacomp));
@@ -697,7 +695,7 @@ int TVariazione_budget_mask::crea_movana(TSheet_field& sf_righe, const int n)
   for (int i = first; i <= last; i++)
   {
     const real importo = sf_righe.cell(i, _pos_imp);
-    if (importo != ZERO)
+    if (!importo.is_zero())
     {
       //aggiunge la rmovana al movana
       TRectype& new_rmovana = new_movana.new_row();
@@ -707,8 +705,11 @@ int TVariazione_budget_mask::crea_movana(TSheet_field& sf_righe, const int n)
       new_rmovana.put(RMOVANA_CODCMS, get(F_CODCMS));
       const TString& cdc = sf_righe.cell(i, _pos_cdc);
       new_rmovana.put(RMOVANA_CODCCOSTO, cdc);
-      const TString& fase = sf_righe.cell(i, _pos_fase);
-      new_rmovana.put(RMOVANA_CODFASE, fase);
+      if (!_exclude_fasi)
+      {
+        const TString& fase = sf_righe.cell(i, _pos_fase);
+        new_rmovana.put(RMOVANA_CODFASE, fase);
+      }
       const TString& conto = sf_righe.cell(i, _pos_conto);
       new_rmovana.put(RMOVANA_CODCONTO, conto);
       const TString& sezione = sf_righe.cell(i, _pos_cosric);
@@ -741,7 +742,7 @@ bool TVariazione_budget_mask::save_sheet()
   //2) Aggiorna i movana con le righe di loro competenza: registra solo le righe con NUMREG !=0
   FOR_EACH_SHEET_ROW(sf_righe, r, riga)
   {
-    const long numreg = sf_righe.row(r).get_long(_pos_numreg);
+    const long numreg = riga->get_long(_pos_numreg);
     if (numreg > 0)
       r = modifica_movana(numreg, sf_righe, r);
   } //FOR_EACH_SHEET_ROW(...
@@ -936,7 +937,8 @@ TToken_string& TVariazione_budget_mask::add_rmovana(const TRectype& movana, cons
     row.add(cms, _pos_cms);
     row.add(cdc, _pos_cdc);
     row.add(conto, _pos_conto);
-    row.add(fase, _pos_fase);   
+    if (!_exclude_fasi)
+      row.add(fase, _pos_fase);   
 
     //date competenza iniziale e finale
     const TDate datacomp = movana.get_date(MOVANA_DATACOMP);