cg0200.cpp Migliorata indentazione per poter mettere meglio i breakpointer
cg1300.cpp Aggiunta gestione movimenti zoppi git-svn-id: svn://10.65.10.50/trunk@6077 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									ecf3a5d118
								
							
						
					
					
						commit
						daf16c6874
					
				@ -71,7 +71,6 @@ public:
 | 
			
		||||
  virtual bool check_autorization() const 
 | 
			
		||||
  {return FALSE;}
 | 
			
		||||
  virtual TRelation* get_relation() const {return (TRelation*)_rel;}
 | 
			
		||||
  TClifo_application(){}
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline TClifo_application& app() { return (TClifo_application&)main_app(); }
 | 
			
		||||
@ -124,10 +123,10 @@ const char* TClifo_application::get_next_key()
 | 
			
		||||
HIDDEN bool no_dup_fis(TMask_field& f, KEY key)
 | 
			
		||||
{
 | 
			
		||||
  TMask& msk = f.mask() ;                                   
 | 
			
		||||
  if (msk.query_mode() || !f.to_check(key)) 
 | 
			
		||||
    return TRUE;
 | 
			
		||||
  
 | 
			
		||||
  if (msk.query_mode() || !f.to_check(key)) return TRUE;
 | 
			
		||||
  TLocalisamfile& clifo = app().get_relation()->lfile(LF_CLIFO) ;
 | 
			
		||||
 | 
			
		||||
  if ( !f.empty() && !clifo.empty() )
 | 
			
		||||
  {
 | 
			
		||||
    clifo.zero() ;
 | 
			
		||||
@ -250,7 +249,7 @@ bool TClifo_application::percip_handler(TMask_field& f, KEY key)
 | 
			
		||||
        (p.not_empty() && p != anag.get(ANA_PAIV))) 
 | 
			
		||||
      return error_box("Percipiente non corretto: codice fiscale o partita IVA diversa");
 | 
			
		||||
    
 | 
			
		||||
    const TString80 r(anag.get(ANA_RAGSOC));
 | 
			
		||||
    const TString r(anag.get(ANA_RAGSOC));
 | 
			
		||||
    if (key == K_TAB && m.get(F_RAGSOC).empty() && 
 | 
			
		||||
        yesno_box("Ragione sociale mancante: assumo %s", (const char*)r))
 | 
			
		||||
    {
 | 
			
		||||
 | 
			
		||||
@ -5,20 +5,21 @@
 | 
			
		||||
#include <mask.h>
 | 
			
		||||
#include <relation.h>
 | 
			
		||||
#include <tabutil.h>
 | 
			
		||||
#include <utility.h>
 | 
			
		||||
#include <progind.h>
 | 
			
		||||
#include <urldefid.h>
 | 
			
		||||
#include <prefix.h>   
 | 
			
		||||
 | 
			
		||||
#include <mov.h>  
 | 
			
		||||
#include <rmoviva.h>
 | 
			
		||||
 | 
			
		||||
#include "cg1.h"  
 | 
			
		||||
#include "cg1301.h"
 | 
			
		||||
#include "cg1302.h" 
 | 
			
		||||
#include "cg1303.h" 
 | 
			
		||||
#include "cg1304.h"
 | 
			
		||||
#include "cg1305.h"
 | 
			
		||||
#include "cg1306.h"
 | 
			
		||||
#include "cg1.h"  
 | 
			
		||||
#include "cg1307.h"
 | 
			
		||||
#include "cglib01.h"
 | 
			
		||||
 | 
			
		||||
class TAgg_attiv : public TApplication
 | 
			
		||||
@ -128,44 +129,47 @@ int cg1300(int argc, char* argv[])
 | 
			
		||||
    a.run(argc, argv, "Aggiornamento tipo attivita' su movimenti iva");
 | 
			
		||||
  }
 | 
			
		||||
  break;
 | 
			
		||||
  case 'I':
 | 
			
		||||
  {
 | 
			
		||||
    TAgg_opintra a;
 | 
			
		||||
    a.run(argc, argv, "Aggiornamento flag op. intracomunitarie");       
 | 
			
		||||
  }
 | 
			
		||||
  break;
 | 
			
		||||
  case 'T':
 | 
			
		||||
  {
 | 
			
		||||
    TAgg_tconto a;                      
 | 
			
		||||
    a.run(argc, argv, "Aggiornamento tipo conto");       
 | 
			
		||||
  }
 | 
			
		||||
  break;
 | 
			
		||||
  case 'P':
 | 
			
		||||
  {   
 | 
			
		||||
    TAgg_nprot a;       
 | 
			
		||||
    a.run(argc, argv,"Rinumerazione numero di protocollo");
 | 
			
		||||
  } 
 | 
			
		||||
  break;
 | 
			
		||||
  case 'C':
 | 
			
		||||
  {   
 | 
			
		||||
    TAgg_codatt a;       
 | 
			
		||||
    a.run(argc, argv,"Aggiornamento codice attivita'");
 | 
			
		||||
  } 
 | 
			
		||||
  break;
 | 
			
		||||
  case 'E':
 | 
			
		||||
  {   
 | 
			
		||||
    TAgg_codes a;       
 | 
			
		||||
    a.run(argc, argv,"Aggiornamento codice esercizio");
 | 
			
		||||
  } 
 | 
			
		||||
  break;
 | 
			
		||||
  case 'D':
 | 
			
		||||
  {   
 | 
			
		||||
    TAgg_datacomp a;       
 | 
			
		||||
    a.run(argc, argv,"Aggiornamento data competenza");
 | 
			
		||||
  } 
 | 
			
		||||
  break;
 | 
			
		||||
  case 'E':
 | 
			
		||||
  {   
 | 
			
		||||
    TAgg_codes a;       
 | 
			
		||||
    a.run(argc, argv,"Aggiornamento codice esercizio");
 | 
			
		||||
  } 
 | 
			
		||||
  break;
 | 
			
		||||
  case 'I':
 | 
			
		||||
  {
 | 
			
		||||
    TAgg_opintra a;
 | 
			
		||||
    a.run(argc, argv, "Aggiornamento flag op. intracomunitarie");       
 | 
			
		||||
  }
 | 
			
		||||
  break;
 | 
			
		||||
  case 'P':
 | 
			
		||||
  {   
 | 
			
		||||
    TAgg_nprot a;       
 | 
			
		||||
    a.run(argc, argv,"Rinumerazione numero di protocollo");
 | 
			
		||||
  } 
 | 
			
		||||
  break;
 | 
			
		||||
  case 'T':
 | 
			
		||||
  {
 | 
			
		||||
    TAgg_tconto a;                      
 | 
			
		||||
    a.run(argc, argv, "Aggiornamento tipo conto");       
 | 
			
		||||
  }
 | 
			
		||||
  break;
 | 
			
		||||
  case 'Z':
 | 
			
		||||
  elimina_zoppi(argc, argv);
 | 
			
		||||
  break;
 | 
			
		||||
  default:
 | 
			
		||||
  break;
 | 
			
		||||
  }
 | 
			
		||||
  return TRUE;
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -1,7 +1,7 @@
 | 
			
		||||
// sistema la data di competenza di tutti i movimenti
 | 
			
		||||
 | 
			
		||||
#include "cg1306.h"
 | 
			
		||||
#include "cg1300.h"
 | 
			
		||||
#include "cg1306.h"
 | 
			
		||||
 | 
			
		||||
#include <mov.h>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
							
								
								
									
										283
									
								
								cg/cg1307.cpp
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										283
									
								
								cg/cg1307.cpp
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,283 @@
 | 
			
		||||
#include <applicat.h>
 | 
			
		||||
#include <isam.h>
 | 
			
		||||
#include <prefix.h>
 | 
			
		||||
#include <progind.h>
 | 
			
		||||
#include <recarray.h>
 | 
			
		||||
#include <sheet.h>
 | 
			
		||||
#include <urldefid.h>
 | 
			
		||||
 | 
			
		||||
#include <clifo.h>                   
 | 
			
		||||
#include <mov.h>                   
 | 
			
		||||
#include <nditte.h>
 | 
			
		||||
#include <pconti.h>
 | 
			
		||||
#include <rmov.h>                   
 | 
			
		||||
#include <rmoviva.h>                   
 | 
			
		||||
 | 
			
		||||
#ifndef FOR_EACH_FILE_RECORD
 | 
			
		||||
 | 
			
		||||
#define FOR_EACH_FILE_RECORD(isamfile)    \
 | 
			
		||||
for (int _e##isamfile = isamfile.first(); \
 | 
			
		||||
     _e##isamfile == NOERR;               \
 | 
			
		||||
     _e##isamfile = isamfile.next())
 | 
			
		||||
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
const char* const APPNAME = "Righe prima nota errate";
 | 
			
		||||
 | 
			
		||||
class TElimina_zoppi : public TSkeleton_application
 | 
			
		||||
{
 | 
			
		||||
  TArray _files;
 | 
			
		||||
  TArray _decoders;
 | 
			
		||||
 | 
			
		||||
protected: 
 | 
			
		||||
  static bool test_file(int rmov, TString_array& arr);
 | 
			
		||||
  static int kill_row(long numreg, const char* codrig);
 | 
			
		||||
    
 | 
			
		||||
  static bool firm_handler(TMask_field& f, KEY k);
 | 
			
		||||
  static bool select_handler(TMask_field& f, KEY k);
 | 
			
		||||
 | 
			
		||||
protected:         
 | 
			
		||||
  void open_files(int logicnum, ...);
 | 
			
		||||
  TLocalisamfile& file(int num);
 | 
			
		||||
  const char* decode(int num, const char* key, const char* field);
 | 
			
		||||
  virtual void main_loop();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
inline TElimina_zoppi& app() { return (TElimina_zoppi&)main_app(); }
 | 
			
		||||
 | 
			
		||||
bool TElimina_zoppi::firm_handler(TMask_field& f, KEY k)
 | 
			
		||||
{          
 | 
			
		||||
  bool ok = TRUE; 
 | 
			
		||||
  if (k == K_F9)
 | 
			
		||||
  {   
 | 
			
		||||
    TArray_sheet sheet(-1, -1, 70, 20, "Scelta ditta", "Codice|Ragione Sociale@50");
 | 
			
		||||
    TToken_string row;
 | 
			
		||||
    
 | 
			
		||||
    TLocalisamfile& ditte = app().file(LF_NDITTE);
 | 
			
		||||
    FOR_EACH_FILE_RECORD(ditte)
 | 
			
		||||
    {
 | 
			
		||||
      const long cod = ditte.get_long(NDT_CODDITTA);
 | 
			
		||||
      if (prefix().exist(cod))
 | 
			
		||||
      {          
 | 
			
		||||
        row.cut(0);
 | 
			
		||||
        row.add(cod); 
 | 
			
		||||
        row.add(ditte.get(NDT_RAGSOC));
 | 
			
		||||
        
 | 
			
		||||
        const long pos = sheet.add(row);
 | 
			
		||||
        if (cod == prefix().get_codditta())
 | 
			
		||||
          sheet.select(pos);
 | 
			
		||||
      }  
 | 
			
		||||
    }  
 | 
			
		||||
    if (sheet.run() == K_ENTER)
 | 
			
		||||
    {
 | 
			
		||||
      f.set(sheet.row().get(0));
 | 
			
		||||
      k = K_TAB;
 | 
			
		||||
    }  
 | 
			
		||||
  }           
 | 
			
		||||
  if (k == K_ENTER || k == K_TAB && f.focusdirty())
 | 
			
		||||
  {
 | 
			
		||||
    long cod = atol(f.get());
 | 
			
		||||
    ok = prefix().exist(cod);
 | 
			
		||||
    if (ok)
 | 
			
		||||
      prefix().set_codditta(cod);
 | 
			
		||||
    else  
 | 
			
		||||
      f.error_box("La ditta %05ld non e' attivata per la contabilita'", cod);
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  return ok;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TElimina_zoppi::open_files(int logicnum, ...)  
 | 
			
		||||
{  
 | 
			
		||||
  va_list marker;
 | 
			
		||||
  va_start(marker, logicnum);
 | 
			
		||||
  while (logicnum > 0)
 | 
			
		||||
  {
 | 
			
		||||
    CHECKD(_files.objptr(logicnum) == NULL, "File gia' aperto: ", logicnum);
 | 
			
		||||
    _files.add(new TLocalisamfile(logicnum), logicnum);
 | 
			
		||||
    logicnum = va_arg(marker, int);
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TLocalisamfile& TElimina_zoppi::file(int num)
 | 
			
		||||
{
 | 
			
		||||
  TLocalisamfile* isam = (TLocalisamfile*)_files.objptr(num);
 | 
			
		||||
  if (isam == NULL)   
 | 
			
		||||
  {
 | 
			
		||||
    open_files(num, 0);
 | 
			
		||||
    isam = (TLocalisamfile*)_files.objptr(num);  
 | 
			
		||||
  }
 | 
			
		||||
  return *isam;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char* TElimina_zoppi::decode(int num, const char* key, const char* field)
 | 
			
		||||
{
 | 
			
		||||
  TDecoder* dec = (TDecoder*)_decoders.objptr(num);
 | 
			
		||||
  if (dec == NULL)   
 | 
			
		||||
  {
 | 
			
		||||
    dec = new TDecoder(num, field);
 | 
			
		||||
    _decoders.add(dec);
 | 
			
		||||
  }
 | 
			
		||||
  return dec->decode(key);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TElimina_zoppi::test_file(int lf_rmov, TString_array& arr)
 | 
			
		||||
{           
 | 
			
		||||
  bool ok = TRUE;                      
 | 
			
		||||
  TLocalisamfile& mov = app().file(LF_MOV);
 | 
			
		||||
  TLocalisamfile& rmov = app().file(lf_rmov);
 | 
			
		||||
 | 
			
		||||
  TString msg;
 | 
			
		||||
  msg << "Controllo righe ";
 | 
			
		||||
  if (lf_rmov == LF_RMOV)
 | 
			
		||||
    msg << "contabili";
 | 
			
		||||
  else
 | 
			
		||||
    msg << "iva";                    
 | 
			
		||||
  msg << ": 0";
 | 
			
		||||
  msg.center_just(50);
 | 
			
		||||
  
 | 
			
		||||
  TProgind pi(rmov.items(), msg, TRUE, TRUE, 50);
 | 
			
		||||
  TToken_string riga, descr;
 | 
			
		||||
 | 
			
		||||
  long reg, last_reg, found = 0;
 | 
			
		||||
  bool reg_killed = TRUE;
 | 
			
		||||
  int gruppo, conto;
 | 
			
		||||
  long sottoconto;
 | 
			
		||||
 | 
			
		||||
  FOR_EACH_FILE_RECORD(rmov)
 | 
			
		||||
  {
 | 
			
		||||
    if (pi.iscancelled())
 | 
			
		||||
    {
 | 
			
		||||
      ok = FALSE;
 | 
			
		||||
      break;
 | 
			
		||||
    }  
 | 
			
		||||
    pi.addstatus(1);
 | 
			
		||||
    
 | 
			
		||||
    reg = rmov.get_long(MOV_NUMREG);
 | 
			
		||||
    if (reg != last_reg)
 | 
			
		||||
    {
 | 
			
		||||
      mov.put(MOV_NUMREG, reg);
 | 
			
		||||
      reg_killed = mov.read() != NOERR;
 | 
			
		||||
      last_reg = reg;
 | 
			
		||||
    }  
 | 
			
		||||
    if (reg_killed)
 | 
			
		||||
    {       
 | 
			
		||||
      found++;
 | 
			
		||||
      const int colon = msg.find(':');
 | 
			
		||||
      msg.cut(colon+2);
 | 
			
		||||
      msg << found;
 | 
			
		||||
      pi.set_text(msg);
 | 
			
		||||
                    
 | 
			
		||||
      const int numrig = rmov.get_int(RMV_NUMRIG);
 | 
			
		||||
      riga.format(" |%6ld|%c%3d", reg, (lf_rmov == LF_RMOV) ? 'C' : 'I', numrig);
 | 
			
		||||
      riga.add(rmov.get(RMV_ANNOES));
 | 
			
		||||
      if (lf_rmov == LF_RMOV)
 | 
			
		||||
      {  
 | 
			
		||||
        riga.add(rmov.get_real(RMV_IMPORTO).string("."));
 | 
			
		||||
        riga << ' ' << rmov.get(RMV_SEZIONE);
 | 
			
		||||
      }
 | 
			
		||||
      else
 | 
			
		||||
      {
 | 
			
		||||
        riga.add(rmov.get_real(RMI_IMPONIBILE).string("."));
 | 
			
		||||
        riga << "  ";
 | 
			
		||||
      }  
 | 
			
		||||
      riga.add(gruppo = rmov.get_int(RMV_GRUPPO));
 | 
			
		||||
      riga.add(conto = rmov.get_int(RMV_CONTO));
 | 
			
		||||
      riga.add(sottoconto = rmov.get_long(RMV_SOTTOCONTO));
 | 
			
		||||
      
 | 
			
		||||
      if (lf_rmov == LF_RMOV)
 | 
			
		||||
        descr = rmov.get(RMV_DESCR);
 | 
			
		||||
      else
 | 
			
		||||
        descr.cut(0);
 | 
			
		||||
      if (descr.empty())  
 | 
			
		||||
      {
 | 
			
		||||
        char tipo = rmov.get_char(RMV_TIPOC);
 | 
			
		||||
        if (tipo == 'C' || tipo == 'F')
 | 
			
		||||
        {
 | 
			
		||||
          descr << tipo << '|' << sottoconto;
 | 
			
		||||
          descr = app().decode(LF_CLIFO, descr, CLI_RAGSOC);
 | 
			
		||||
        }
 | 
			
		||||
        else
 | 
			
		||||
        {
 | 
			
		||||
          descr << gruppo << '|' << conto << '|' << sottoconto;
 | 
			
		||||
          descr = app().decode(LF_PCON, descr, PCN_DESCR);
 | 
			
		||||
        }
 | 
			
		||||
      }
 | 
			
		||||
      riga.add(descr);
 | 
			
		||||
      arr.add(riga);
 | 
			
		||||
    }  
 | 
			
		||||
  }
 | 
			
		||||
  
 | 
			
		||||
  return ok;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int TElimina_zoppi::kill_row(long numreg, const char* codrig)
 | 
			
		||||
{                          
 | 
			
		||||
  const int lf_rmov = *codrig == 'I' ? LF_RMOVIVA : LF_RMOV;
 | 
			
		||||
  TLocalisamfile& rmov= app().file(lf_rmov);
 | 
			
		||||
  rmov.put(RMV_NUMREG, numreg);
 | 
			
		||||
  rmov.put(RMV_NUMRIG, codrig+1);
 | 
			
		||||
  int err = rmov.read();
 | 
			
		||||
  if (err == NOERR)
 | 
			
		||||
    err = rmov.remove();
 | 
			
		||||
  return err;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TElimina_zoppi::select_handler(TMask_field& f, KEY k)
 | 
			
		||||
{             
 | 
			
		||||
  bool ok = TRUE;
 | 
			
		||||
  if (k == K_SPACE)
 | 
			
		||||
  { 
 | 
			
		||||
    TArray_sheet sheet(-1, -1, 76, 20, APPNAME, "@1|Codice@6|Riga|Anno|Importo@20R|Grp@R|Cnt@R|Sottoc@R|Descrizione@50");
 | 
			
		||||
    TString_array& arr = sheet.rows_array();
 | 
			
		||||
    ok = test_file(LF_RMOV, arr);
 | 
			
		||||
    if (ok)
 | 
			
		||||
      ok = test_file(LF_RMOVIVA, arr);
 | 
			
		||||
    arr.sort();
 | 
			
		||||
                              
 | 
			
		||||
    if (ok && sheet.run() == K_ENTER)
 | 
			
		||||
    { 
 | 
			
		||||
      const long total = sheet.checked();
 | 
			
		||||
      if (total > 0 && 
 | 
			
		||||
          yesno_box("Confermare l'eliminazione di %ld righe di prima nota.", total))
 | 
			
		||||
      {
 | 
			
		||||
        TProgind pi(total, "Eliminazione righe...", TRUE, TRUE);
 | 
			
		||||
        FOR_EACH_ARRAY_ROW(arr, i, riga) 
 | 
			
		||||
        {
 | 
			
		||||
          if (sheet.checked(i))
 | 
			
		||||
          {          
 | 
			
		||||
            if (pi.iscancelled())
 | 
			
		||||
              break;
 | 
			
		||||
            pi.addstatus(1);
 | 
			
		||||
    
 | 
			
		||||
            long reg = riga->get_long(1);
 | 
			
		||||
            kill_row(reg, riga->get(2));
 | 
			
		||||
          }
 | 
			
		||||
        }  
 | 
			
		||||
      }
 | 
			
		||||
    }  
 | 
			
		||||
  }
 | 
			
		||||
  return ok;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TElimina_zoppi::main_loop()
 | 
			
		||||
{
 | 
			
		||||
  open_files(LF_CLIFO, LF_NDITTE, LF_PCON, 0);
 | 
			
		||||
  open_files(LF_MOV, LF_RMOV, LF_RMOVIVA, 0);
 | 
			
		||||
 | 
			
		||||
  TMask m(APPNAME, 1, 30, 5);
 | 
			
		||||
  m.add_number(DLG_USER, 0, "Codice ditta ", 1, 1, 5, "BUF");
 | 
			
		||||
  m.add_button(DLG_SELECT, 0, "", -12, -1, 10, 2);
 | 
			
		||||
  m.add_button(DLG_QUIT, 0, "", -22, -1, 10, 2);
 | 
			
		||||
  m.set_handler(DLG_USER, firm_handler);
 | 
			
		||||
  m.set_handler(DLG_SELECT, select_handler);
 | 
			
		||||
  
 | 
			
		||||
  while (m.run() != K_QUIT);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int elimina_zoppi(int argc, char* argv[])
 | 
			
		||||
{
 | 
			
		||||
  TElimina_zoppi ez;
 | 
			
		||||
  ez.run(argc, argv, APPNAME);
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										1
									
								
								cg/cg1307.h
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										1
									
								
								cg/cg1307.h
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1 @@
 | 
			
		||||
int elimina_zoppi(int argc, char* argv[]);
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user