Files correlati :cg0100a.msk cg0200a.msk cg1.exe cg3.exe Ricompilazione Demo : [ ] Commento :LL700259,CM600074,CM701065,CM701066,CM600245,CM700490 git-svn-id: svn://10.65.10.50/trunk@10917 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			151 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			151 lines
		
	
	
		
			3.7 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
//****************************
 | 
						|
//* Aggiornamento Tipo Conto *
 | 
						|
//****************************
 | 
						|
#include <mask.h>
 | 
						|
#include <recarray.h> 
 | 
						|
 | 
						|
#include <mov.h>  
 | 
						|
#include <rmoviva.h>
 | 
						|
#include <nditte.h>
 | 
						|
 | 
						|
#include "cg1300.h"  
 | 
						|
#include "cg1302.h"  
 | 
						|
#include "cglib01.h"  
 | 
						|
 | 
						|
const int TAgg_tconto::look_reg (const char* cod, int anno)
 | 
						|
{
 | 
						|
  TString16 codtab;
 | 
						|
  codtab.format("%4d%-3s", anno, cod);
 | 
						|
  int tipo_reg = cache().get("REG", codtab).get_int("I0");
 | 
						|
  return tipo_reg;
 | 
						|
}
 | 
						|
 | 
						|
bool TAgg_tconto::user_create()
 | 
						|
{
 | 
						|
  _rel = new TRelation(LF_MOV);
 | 
						|
  _rel->add(LF_RMOVIVA, "NUMREG=NUMREG",1);
 | 
						|
  add_cursor(new TCursor(_rel,"",1));
 | 
						|
  
 | 
						|
  add_file (LF_MOV);
 | 
						|
  add_file (LF_RMOVIVA);
 | 
						|
  open_files(LF_PCON, LF_NDITTE, LF_TAB, 0);
 | 
						|
  
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
bool TAgg_tconto::user_destroy()
 | 
						|
{ 
 | 
						|
  delete _rel;
 | 
						|
  
 | 
						|
  return TRUE;
 | 
						|
}                                
 | 
						|
 | 
						|
bool TAgg_tconto::set_print(int)
 | 
						|
{
 | 
						|
  TMask msk("cg1300a");
 | 
						|
  
 | 
						|
  while (msk.run() == K_ENTER) 
 | 
						|
  {
 | 
						|
    setta_intestazione();
 | 
						|
    printer().footerlen(5);
 | 
						|
    return TRUE;
 | 
						|
  }
 | 
						|
  return FALSE;
 | 
						|
}
 | 
						|
 | 
						|
void TAgg_tconto::postclose_print()
 | 
						|
{
 | 
						|
  message_box(TR("Aggiornamento tipo conto completato:\nE' necessario ricalcolare la liquidazione."));
 | 
						|
}
 | 
						|
 | 
						|
bool TAgg_tconto::preprocess_page(int file,int counter)
 | 
						|
{
 | 
						|
  if (counter) return TRUE;
 | 
						|
  
 | 
						|
  TCursor* cur = current_cursor();
 | 
						|
  if (file == LF_MOV)
 | 
						|
  {
 | 
						|
    const TString& reg = cur->curr().get(MOV_REG);
 | 
						|
    if (reg.empty()) return FALSE;
 | 
						|
  } 
 | 
						|
  else if (file == LF_RMOVIVA)
 | 
						|
  { 
 | 
						|
    TRectype pcon(LF_PCON);
 | 
						|
    int gruppo = cur->curr(LF_RMOVIVA).get_int(RMI_GRUPPO);
 | 
						|
    int conto = cur->curr(LF_RMOVIVA).get_int(RMI_CONTO);
 | 
						|
    long sottoconto = cur->curr(LF_RMOVIVA).get_long(RMI_SOTTOCONTO);
 | 
						|
    long numreg = cur->curr(LF_RMOVIVA).get_long(RMI_NUMREG);
 | 
						|
    int nrigimp = cur->curr(LF_RMOVIVA).get_int("RIGAIMP");
 | 
						|
    
 | 
						|
    TBill tc (gruppo,conto,0L);
 | 
						|
    tc.read(pcon);
 | 
						|
    if (!pcon.empty())
 | 
						|
      if (pcon.get_char("TMCF") != '\0') 
 | 
						|
        return FALSE;
 | 
						|
    
 | 
						|
    tc.set(gruppo,conto,sottoconto);
 | 
						|
    tc.read(pcon);
 | 
						|
    if (!pcon.empty())
 | 
						|
    {
 | 
						|
      if (tc.sospeso())
 | 
						|
      {
 | 
						|
        set_row(1, FR("@4g%7ld@23g%3d@31g%3d@37g%3d@45g%6ld  ** Conto sospeso **"), 
 | 
						|
                numreg, nrigimp, gruppo, conto, sottoconto);
 | 
						|
        return TRUE;
 | 
						|
      }  
 | 
						|
      int t = tc.tipo_cr();  
 | 
						|
      TString16 reg = cur->curr().get(MOV_REG);
 | 
						|
      int annoiva = cur->curr().get_int(MOV_ANNOIVA);
 | 
						|
      const int tipo = look_reg(reg, annoiva); //cerca il tipo del registro
 | 
						|
      //aggiorno sul movimento iva il tipo costo/ricavo 
 | 
						|
      //con quello letto dal piano conti
 | 
						|
      _rel->lfile(LF_RMOVIVA).put(RMI_TIPOCR, t);
 | 
						|
      if (tipo == 1 && (t == 2 || t == 3))
 | 
						|
        _rel->lfile(LF_RMOVIVA).put(RMI_TIPOCR, 4); 
 | 
						|
      _rel->lfile(LF_RMOVIVA).rewrite();
 | 
						|
    }
 | 
						|
    else
 | 
						|
    {
 | 
						|
      set_row(1, FR("@4g%7ld@23g%3d@31g%3d@37g%3d@45g%6ld  ** Conto inesistente **"), 
 | 
						|
              numreg, nrigimp, gruppo, conto, sottoconto);
 | 
						|
      return TRUE;
 | 
						|
    }
 | 
						|
    return FALSE;     
 | 
						|
  }
 | 
						|
  return TRUE;
 | 
						|
}  
 | 
						|
 | 
						|
void TAgg_tconto::setta_intestazione()
 | 
						|
{
 | 
						|
  int soh = 1;       
 | 
						|
  TString sep(132);
 | 
						|
  TString ragsoc(50);
 | 
						|
  
 | 
						|
  TLocalisamfile nditte(LF_NDITTE); 
 | 
						|
  nditte.zero();
 | 
						|
  nditte.put(NDT_CODDITTA, get_firm());   
 | 
						|
  if (nditte.read() == NOERR)
 | 
						|
    ragsoc  = nditte.get(NDT_RAGSOC); 
 | 
						|
  
 | 
						|
  reset_header();
 | 
						|
  
 | 
						|
  sep << TR("Ditta  ") << get_firm();
 | 
						|
  sep << " " << ragsoc;
 | 
						|
 | 
						|
  sep.left_just(132);
 | 
						|
  
 | 
						|
  set_header (soh++, (const char*) sep);
 | 
						|
 | 
						|
  sep = "";
 | 
						|
  sep << FR("Data @> Pag.  @#");
 | 
						|
  sep.right_just(127);    
 | 
						|
  
 | 
						|
  sep.overwrite (TR("AGGIORNAMENTO TIPO CONTO SU MOVIMENTI IVA - Lista errori"));
 | 
						|
  set_header (soh++, (const char*)sep);
 | 
						|
  sep.fill('-');
 | 
						|
  set_header (soh++, (const char *) sep);      
 | 
						|
  set_header (soh++, TR("Numero Registrazione  Riga  Gruppo Conto Sottoconto")); 
 | 
						|
  set_header (soh++, (const char *) sep);
 | 
						|
  set_header (soh, "");
 | 
						|
} 
 |