Patch level :2.0 partners nopatch
Files correlati :cm1.exe cm1100a.frm Ricompilazione Demo : [ ] Commento :secondo step del programma stampa scaduto per commessa del CRePA git-svn-id: svn://10.65.10.50/trunk@11676 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									a44bb05597
								
							
						
					
					
						commit
						662c95dc86
					
				
							
								
								
									
										225
									
								
								cm/cm1100.cpp
									
									
									
									
									
								
							
							
						
						
									
										225
									
								
								cm/cm1100.cpp
									
									
									
									
									
								
							@ -45,12 +45,14 @@ protected:
 | 
				
			|||||||
  virtual int compare(const TSortable& s) const;
 | 
					  virtual int compare(const TSortable& s) const;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
 | 
					  int _tipo;
 | 
				
			||||||
  long _codforn;
 | 
					  long _codforn;
 | 
				
			||||||
  TDate _datapag;
 | 
					  TDate _datapag;
 | 
				
			||||||
  TCurrency _importopagato;
 | 
					  TCurrency _importopagato;
 | 
				
			||||||
  TString _descrpagamento;
 | 
					  TString _descrpagamento;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  long _nreg;
 | 
					  long _nreg;
 | 
				
			||||||
 | 
					  TBill _conto; //gruppocontosottoconto
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TString _commessa;
 | 
					  TString _commessa;
 | 
				
			||||||
  TCurrency _importocommessa;
 | 
					  TCurrency _importocommessa;
 | 
				
			||||||
@ -61,7 +63,21 @@ int TPag_per_cms_struct::compare(const TSortable& s) const
 | 
				
			|||||||
  const TPag_per_cms_struct& pcs = (const TPag_per_cms_struct&)s;
 | 
					  const TPag_per_cms_struct& pcs = (const TPag_per_cms_struct&)s;
 | 
				
			||||||
  int cmp = _commessa.compare(pcs._commessa);
 | 
					  int cmp = _commessa.compare(pcs._commessa);
 | 
				
			||||||
  if (cmp == 0)
 | 
					  if (cmp == 0)
 | 
				
			||||||
    cmp = _nreg - pcs._nreg;
 | 
					  {
 | 
				
			||||||
 | 
					    cmp = _tipo - pcs._tipo;
 | 
				
			||||||
 | 
					    if (cmp == 0)
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					      switch (_tipo)  //caso pagamento o costo non saldacontato
 | 
				
			||||||
 | 
					      {
 | 
				
			||||||
 | 
					      case 0:
 | 
				
			||||||
 | 
					        cmp = _nreg - pcs._nreg;
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					      default:
 | 
				
			||||||
 | 
					        cmp = _conto.compare(pcs._conto);
 | 
				
			||||||
 | 
					        break;
 | 
				
			||||||
 | 
					      }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
  return cmp;
 | 
					  return cmp;
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -69,15 +85,17 @@ int TPag_per_cms_struct::compare(const TSortable& s) const
 | 
				
			|||||||
//form
 | 
					//form
 | 
				
			||||||
class TPag_per_cms_form : public TForm
 | 
					class TPag_per_cms_form : public TForm
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TArray& _pagamenti; //puntatore all'arrayone dei pagamenti
 | 
					  TArray& _righe; //puntatore all'arrayone dei pagamenti
 | 
				
			||||||
  int _curr_pag;      //pagamento corrente
 | 
					  int _curr_pag;      //pagamento corrente
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
  virtual long records() const {return _pagamenti.items();}
 | 
					  virtual long records() const {return _righe.items();}
 | 
				
			||||||
  bool validate(TForm_item &cf, TToken_string &s);
 | 
					  bool validate(TForm_item &cf, TToken_string &s);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  const TString& prev_cms() const;
 | 
					  const TString& prev_cms() const;
 | 
				
			||||||
  const TPag_per_cms_struct& curr() const { return(TPag_per_cms_struct&)_pagamenti[_curr_pag]; }
 | 
					  int prev_type () const;
 | 
				
			||||||
 | 
					  const TPag_per_cms_struct& curr() const { return(TPag_per_cms_struct&)_righe[_curr_pag]; }
 | 
				
			||||||
 | 
					  void print_title (const char * title);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  void print(const TMask& m);
 | 
					  void print(const TMask& m);
 | 
				
			||||||
@ -89,10 +107,27 @@ const TString& TPag_per_cms_form::prev_cms() const
 | 
				
			|||||||
{ 
 | 
					{ 
 | 
				
			||||||
  if (_curr_pag <= 0)
 | 
					  if (_curr_pag <= 0)
 | 
				
			||||||
    return EMPTY_STRING;
 | 
					    return EMPTY_STRING;
 | 
				
			||||||
  const TPag_per_cms_struct& prev = (const TPag_per_cms_struct&)_pagamenti[_curr_pag-1];
 | 
					  const TPag_per_cms_struct& prev = (const TPag_per_cms_struct&)_righe[_curr_pag-1];
 | 
				
			||||||
  return prev._commessa; 
 | 
					  return prev._commessa; 
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					int TPag_per_cms_form::prev_type() const
 | 
				
			||||||
 | 
					{ 
 | 
				
			||||||
 | 
					  if (_curr_pag <= 0)
 | 
				
			||||||
 | 
					    return 0;
 | 
				
			||||||
 | 
					  const TPag_per_cms_struct& prev = (const TPag_per_cms_struct&)_righe[_curr_pag-1];
 | 
				
			||||||
 | 
					  return prev._tipo; 
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TPag_per_cms_form::print_title (const char * title)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TPrint_section& last_head = section('H', last_page);
 | 
				
			||||||
 | 
					  last_head.find_field(FR_CODCMS).set(title);
 | 
				
			||||||
 | 
					  last_head.update();
 | 
				
			||||||
 | 
					  for (word i = 0; i < last_head.height(); i++)        
 | 
				
			||||||
 | 
					    printer().print(last_head.row(i));
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
 | 
					bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  if (s == "_NEXTPAG")
 | 
					  if (s == "_NEXTPAG")
 | 
				
			||||||
@ -101,6 +136,14 @@ bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
 | 
				
			|||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (s == "_TIPORIGA")
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    TString8 str;
 | 
				
			||||||
 | 
					    str << curr()._tipo;
 | 
				
			||||||
 | 
					    cf.set(str);
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (s == "_CODCMS")
 | 
					  if (s == "_CODCMS")
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    const TString& cms = curr()._commessa;
 | 
					    const TString& cms = curr()._commessa;
 | 
				
			||||||
@ -108,12 +151,13 @@ bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
      if (_curr_pag > 0)
 | 
					      if (_curr_pag > 0)
 | 
				
			||||||
        printer().formfeed();
 | 
					        printer().formfeed();
 | 
				
			||||||
      TPrint_section& last_head = section('H', last_page);
 | 
					      print_title(cms);
 | 
				
			||||||
      last_head.find_field(FR_CODCMS).set(cms);
 | 
					    }
 | 
				
			||||||
      last_head.update();
 | 
					    else
 | 
				
			||||||
      for (word i = 0; i < last_head.height(); i++)        
 | 
					    {
 | 
				
			||||||
        printer().print(last_head.row(i));
 | 
					      const int tipo = curr()._tipo;
 | 
				
			||||||
 | 
					      if (tipo > 0 && tipo != prev_type())
 | 
				
			||||||
 | 
					        print_title(tipo == 1 ? "Costi" : "Pagamenti");
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
@ -132,6 +176,30 @@ bool TPag_per_cms_form::validate(TForm_item &cf, TToken_string &s)
 | 
				
			|||||||
    return true;
 | 
					    return true;
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (s == "_GRUPPO")
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    TString8 str;
 | 
				
			||||||
 | 
					    str << curr()._conto.gruppo();
 | 
				
			||||||
 | 
					    cf.set(str);
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (s == "_CONTO")
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    TString8 str;
 | 
				
			||||||
 | 
					    str << curr()._conto.conto();
 | 
				
			||||||
 | 
					    cf.set(str);
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  if (s == "_SOTTOCONTO")
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    TString8 str;
 | 
				
			||||||
 | 
					    str << curr()._conto.sottoconto();
 | 
				
			||||||
 | 
					    cf.set(str);
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  if (s == "_DESCRPAG")
 | 
					  if (s == "_DESCRPAG")
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    cf.set(curr()._descrpagamento);
 | 
					    cf.set(curr()._descrpagamento);
 | 
				
			||||||
@ -172,7 +240,7 @@ void TPag_per_cms_form::print(const TMask& m)
 | 
				
			|||||||
  TForm::print(); //chiama la vera print dopo aver azzerato il contatore
 | 
					  TForm::print(); //chiama la vera print dopo aver azzerato il contatore
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
  
 | 
					  
 | 
				
			||||||
TPag_per_cms_form::TPag_per_cms_form(TArray& pag) :TForm ("cm1100a"), _pagamenti(pag)
 | 
					TPag_per_cms_form::TPag_per_cms_form(TArray& pag) :TForm ("cm1100a"), _righe(pag)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
} 
 | 
					} 
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@ -189,7 +257,9 @@ class TPag_per_cms : public TSkeleton_application
 | 
				
			|||||||
  TPag_per_cms_mask* _mask;
 | 
					  TPag_per_cms_mask* _mask;
 | 
				
			||||||
  TPag_per_cms_form* _form;
 | 
					  TPag_per_cms_form* _form;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  TArray _pagamenti;
 | 
					  TArray _righe;  //array delle righe da stampare in tutti i casi
 | 
				
			||||||
 | 
					  TAssoc_array _costi,_pagamenti; //array che contengono i conti
 | 
				
			||||||
 | 
					  TAssoc_array _righecosti,_righepagamenti; //array delle righe da stampare in caso di costi e/o pagamenti
 | 
				
			||||||
  TString8 _campodata;
 | 
					  TString8 _campodata;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
protected:
 | 
					protected:
 | 
				
			||||||
@ -201,8 +271,14 @@ protected:
 | 
				
			|||||||
  long find_movimento(const TRectype& riga_pag) const;
 | 
					  long find_movimento(const TRectype& riga_pag) const;
 | 
				
			||||||
  void find_commesse(const long nreg, const TRectype& riga_pag);
 | 
					  void find_commesse(const long nreg, const TRectype& riga_pag);
 | 
				
			||||||
  void find_commesse_cg(const long nreg);
 | 
					  void find_commesse_cg(const long nreg);
 | 
				
			||||||
 | 
					  void lettura_conti(const char * paragrafo, TAssoc_array& assoc);
 | 
				
			||||||
  static bool part_callback(const TRelation& rel, void* pJolly);
 | 
					  static bool part_callback(const TRelation& rel, void* pJolly);
 | 
				
			||||||
  static bool mov_callback(const TRelation& rel, void* pJolly);
 | 
					  static bool mov_callback(const TRelation& rel, void* pJolly);
 | 
				
			||||||
 | 
					  bool cerca_conto(const TBill& bill, const TAssoc_array& assoc) const;
 | 
				
			||||||
 | 
					  bool cerca_costo(const TBill& bill) const;
 | 
				
			||||||
 | 
					  bool cerca_pagamento(const TBill& bill) const;
 | 
				
			||||||
 | 
					  void add_importo(TAssoc_array& assoc, const TRectype& rmov) const;
 | 
				
			||||||
 | 
					  void crea_righe_stampa(TAssoc_array& assoc, const int tipo);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
public:
 | 
					public:
 | 
				
			||||||
  void scan_pags();
 | 
					  void scan_pags();
 | 
				
			||||||
@ -303,6 +379,7 @@ void TPag_per_cms::find_commesse(const long nreg, const TRectype& riga_pag)
 | 
				
			|||||||
    {
 | 
					    {
 | 
				
			||||||
      const real& impcms = *(real*)imp;
 | 
					      const real& impcms = *(real*)imp;
 | 
				
			||||||
      TPag_per_cms_struct* ppcs = new TPag_per_cms_struct;
 | 
					      TPag_per_cms_struct* ppcs = new TPag_per_cms_struct;
 | 
				
			||||||
 | 
					      ppcs->_tipo = 0; //movimenti da saldaconto
 | 
				
			||||||
      ppcs->_codforn = riga_pag.get_long(PART_SOTTOCONTO);
 | 
					      ppcs->_codforn = riga_pag.get_long(PART_SOTTOCONTO);
 | 
				
			||||||
      ppcs->_datapag = riga_pag.get_date(_campodata);
 | 
					      ppcs->_datapag = riga_pag.get_date(_campodata);
 | 
				
			||||||
      ppcs->_importopagato.set_num(impcms * percentuale);   //pagamento nella partita
 | 
					      ppcs->_importopagato.set_num(impcms * percentuale);   //pagamento nella partita
 | 
				
			||||||
@ -313,44 +390,100 @@ void TPag_per_cms::find_commesse(const long nreg, const TRectype& riga_pag)
 | 
				
			|||||||
      ppcs->_commessa = k;
 | 
					      ppcs->_commessa = k;
 | 
				
			||||||
      ppcs->_importocommessa.set_num(impcms); //importo da pagare scritto sulla fattura
 | 
					      ppcs->_importocommessa.set_num(impcms); //importo da pagare scritto sulla fattura
 | 
				
			||||||
      
 | 
					      
 | 
				
			||||||
      _pagamenti.add(ppcs); //aggiunge il pagamento all'array dei pagamenti
 | 
					      _righe.add(ppcs); //aggiunge il pagamento all'array dei pagamenti
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TPag_per_cms::add_importo(TAssoc_array& assoc, const TRectype& rmov) const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TBill conto(rmov);
 | 
				
			||||||
 | 
					  TToken_string chiave;
 | 
				
			||||||
 | 
					  conto.add_to(chiave, 0);
 | 
				
			||||||
 | 
					  chiave.add(rmov.get(RMV_CODCMS));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  TImporto* importo = (TImporto*)assoc.objptr(chiave);
 | 
				
			||||||
 | 
					  if (importo == NULL)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    importo = new TImporto;
 | 
				
			||||||
 | 
					    assoc.add(chiave,importo);
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
 | 
					//incremento l'importo del conto commessa con l'importo movimento (iportocontocms += importormov)
 | 
				
			||||||
 | 
					  const char sezione = rmov.get_char(RMV_SEZIONE);
 | 
				
			||||||
 | 
					  const real valore = rmov.get_real(RMV_IMPORTO);
 | 
				
			||||||
 | 
					  const TImporto imp(sezione, valore);
 | 
				
			||||||
 | 
					  *importo += imp;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TPag_per_cms::find_commesse_cg(const long nreg)
 | 
					void TPag_per_cms::find_commesse_cg(const long nreg)
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  TMovimentoPN pn;
 | 
					  TMovimentoPN pn;
 | 
				
			||||||
  pn.curr().put(MOV_NUMREG, nreg);
 | 
					  pn.curr().put(MOV_NUMREG, nreg);
 | 
				
			||||||
  if (pn.read() == NOERR)
 | 
					  if (pn.read() == NOERR)
 | 
				
			||||||
  {
 | 
					  {
 | 
				
			||||||
    TAssoc_array commesse;
 | 
					 | 
				
			||||||
    for (int i = 0; i < pn.cg_items(); i++)
 | 
					    for (int i = 0; i < pn.cg_items(); i++)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      const TRectype& rmov = pn.cg(i);
 | 
					      const TRectype& rmov = pn.cg(i);
 | 
				
			||||||
      if (rmov.get_char(RMV_TIPOC) == 'F')
 | 
					      const TString& codcms = rmov.get(RMV_CODCMS);
 | 
				
			||||||
 | 
					      if (cms_in_range(codcms))
 | 
				
			||||||
      {
 | 
					      {
 | 
				
			||||||
        const TString& codcms = rmov.get(RMI_CODCMS);
 | 
					        const TBill conto(rmov);
 | 
				
			||||||
        if (cms_in_range(codcms))
 | 
					        if (cerca_costo(conto))
 | 
				
			||||||
        {
 | 
					          add_importo(_righecosti, rmov);
 | 
				
			||||||
          real* imp = (real*)commesse.objptr(codcms);
 | 
					        else if (cerca_pagamento(conto))
 | 
				
			||||||
          if (imp == NULL)
 | 
					          add_importo(_righepagamenti, rmov);
 | 
				
			||||||
          {
 | 
					 | 
				
			||||||
            imp = new real;
 | 
					 | 
				
			||||||
            commesse.add(codcms, imp);
 | 
					 | 
				
			||||||
          }
 | 
					 | 
				
			||||||
          real importo = rmov.get_real(RMV_IMPORTO);
 | 
					 | 
				
			||||||
          *imp += importo;
 | 
					 | 
				
			||||||
        }
 | 
					 | 
				
			||||||
      }
 | 
					      }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool TPag_per_cms::cerca_conto(const TBill& bill, const TAssoc_array& assoc) const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TToken_string key(15,'.');
 | 
				
			||||||
 | 
					  key.add(bill.gruppo());
 | 
				
			||||||
 | 
					  if (assoc.is_key(key))
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  key.add(bill.conto());
 | 
				
			||||||
 | 
					  if (assoc.is_key(key))
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  key.add(bill.sottoconto());
 | 
				
			||||||
 | 
					  if (assoc.is_key(key))
 | 
				
			||||||
 | 
					    return true;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  return false;
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool TPag_per_cms::cerca_costo(const TBill& bill) const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  return cerca_conto(bill, _costi);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					bool TPag_per_cms::cerca_pagamento(const TBill& bill) const
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  return cerca_conto(bill, _pagamenti);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TPag_per_cms::lettura_conti(const char* paragrafo, TAssoc_array& assoc)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TConfig conti("cm1100a.ini",paragrafo); //paragrafo da scandire nell ini
 | 
				
			||||||
 | 
					  TAssoc_array& vars = conti.list_variables();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  FOR_EACH_ASSOC_STRING(vars, h, k, val)  //riempie l'assoc con i soli valori del paragrafo dell'ini
 | 
				
			||||||
 | 
					    assoc.add(val);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
bool TPag_per_cms::create()
 | 
					bool TPag_per_cms::create()
 | 
				
			||||||
{
 | 
					{
 | 
				
			||||||
  _mask = new TPag_per_cms_mask;
 | 
					  _mask = new TPag_per_cms_mask;
 | 
				
			||||||
  _form = new TPag_per_cms_form(_pagamenti);
 | 
					  _form = new TPag_per_cms_form(_righe);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  lettura_conti("Costi", _costi); //caricamento dei conti dei costi
 | 
				
			||||||
 | 
					  lettura_conti("Pagamenti", _pagamenti); // "" pagamenti
 | 
				
			||||||
 | 
					
 | 
				
			||||||
  return TSkeleton_application::create();
 | 
					  return TSkeleton_application::create();
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
@ -477,6 +610,34 @@ void TPag_per_cms::scan_movs()
 | 
				
			|||||||
  TRelation rel(LF_MOV);
 | 
					  TRelation rel(LF_MOV);
 | 
				
			||||||
  TCursor cur(&rel, filtro, 2, &darec, &arec);
 | 
					  TCursor cur(&rel, filtro, 2, &darec, &arec);
 | 
				
			||||||
  scan_cursor(cur, "Ricerca movimenti...", mov_callback, this);
 | 
					  scan_cursor(cur, "Ricerca movimenti...", mov_callback, this);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					  crea_righe_stampa(_righecosti, 1);
 | 
				
			||||||
 | 
					  crea_righe_stampa(_righepagamenti, 2);
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					void TPag_per_cms::crea_righe_stampa(TAssoc_array& assoc, const int tipo)
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					  TToken_string tok;
 | 
				
			||||||
 | 
					  FOR_EACH_ASSOC_OBJECT(assoc, h, k ,i)
 | 
				
			||||||
 | 
					  {
 | 
				
			||||||
 | 
					    tok = k;
 | 
				
			||||||
 | 
					    TImporto imp = *(TImporto*)i;
 | 
				
			||||||
 | 
					    imp.normalize(tipo==1 ? 'D' : 'A');
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    TPag_per_cms_struct* ppcs = new TPag_per_cms_struct;
 | 
				
			||||||
 | 
					    ppcs->_tipo = tipo; //movimenti di costo/pagamento
 | 
				
			||||||
 | 
					    ppcs->_codforn = 0;
 | 
				
			||||||
 | 
					//    ppcs->_datapag = riga_pag.get_date(_campodata);
 | 
				
			||||||
 | 
					    ppcs->_importopagato.set_num(imp.valore());   //pagamento nella partita
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					    ppcs->_nreg = 0;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    ppcs->_commessa = tok.get(3);
 | 
				
			||||||
 | 
					    ppcs->_conto.get(tok, 0);
 | 
				
			||||||
 | 
					    ppcs->_descrpagamento = ppcs->_conto.descrizione();
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    _righe.add(ppcs); //aggiunge il pagamento all'array dei pagamenti e lo spedisce in stampa
 | 
				
			||||||
 | 
					  }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
void TPag_per_cms::main_loop()
 | 
					void TPag_per_cms::main_loop()
 | 
				
			||||||
@ -491,13 +652,13 @@ void TPag_per_cms::main_loop()
 | 
				
			|||||||
    default:break;
 | 
					    default:break;
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    _pagamenti.destroy(); //azzera l'arrayone dei pagamenti
 | 
					    _righe.destroy(); //azzera l'arrayone dei pagamenti
 | 
				
			||||||
    scan_pags();
 | 
					    scan_pags();
 | 
				
			||||||
    scan_movs();
 | 
					    scan_movs();
 | 
				
			||||||
     
 | 
					     
 | 
				
			||||||
    if (_pagamenti.items() > 0)
 | 
					    if (_righe.items() > 0)
 | 
				
			||||||
    {
 | 
					    {
 | 
				
			||||||
      _pagamenti.sort();
 | 
					      _righe.sort();
 | 
				
			||||||
      _form->print(*_mask);
 | 
					      _form->print(*_mask);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
  }
 | 
					  }
 | 
				
			||||||
 | 
				
			|||||||
@ -5,5 +5,6 @@
 | 
				
			|||||||
#define FR_DACDC      13
 | 
					#define FR_DACDC      13
 | 
				
			||||||
#define FR_ACDC       14
 | 
					#define FR_ACDC       14
 | 
				
			||||||
#define FR_CODCMS     15
 | 
					#define FR_CODCMS     15
 | 
				
			||||||
 | 
					#define FR_TIPORIGA   16
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -100,12 +100,12 @@ END
 | 
				
			|||||||
END // section header odd
 | 
					END // section header odd
 | 
				
			||||||
 | 
					
 | 
				
			||||||
// riga con solo il codice commessa ed una riga vuota
 | 
					// riga con solo il codice commessa ed una riga vuota
 | 
				
			||||||
SECTION HEADER LAST 2
 | 
					SECTION HEADER LAST 3
 | 
				
			||||||
 | 
					
 | 
				
			||||||
STRINGA FR_CODCMS
 | 
					STRINGA FR_CODCMS
 | 
				
			||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
  KEY "codice commessa"
 | 
					  KEY "codice commessa"
 | 
				
			||||||
  PROMPT 1 1 "@b"
 | 
					  PROMPT 1 2 "@b"
 | 
				
			||||||
END
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
END //section header last
 | 
					END //section header last
 | 
				
			||||||
@ -113,6 +113,24 @@ END //section header last
 | 
				
			|||||||
// riga di stampa (utilizzata per ogni gruppo/conto/sottoconto e per tutti i totali)
 | 
					// riga di stampa (utilizzata per ogni gruppo/conto/sottoconto e per tutti i totali)
 | 
				
			||||||
SECTION BODY ODD 1
 | 
					SECTION BODY ODD 1
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					STRINGA -1
 | 
				
			||||||
 | 
					BEGIN
 | 
				
			||||||
 | 
					  KEY "tipo riga"
 | 
				
			||||||
 | 
					  PROMPT 1 1 ""
 | 
				
			||||||
 | 
					  MESSAGE _TIPORIGA|COPY,FR_TIPORIGA
 | 
				
			||||||
 | 
					  FLAGS "H"
 | 
				
			||||||
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					LISTA FR_TIPORIGA
 | 
				
			||||||
 | 
					BEGIN
 | 
				
			||||||
 | 
					  KEY "lista tipo riga"
 | 
				
			||||||
 | 
					  PROMPT 1 1 ""
 | 
				
			||||||
 | 
					  ITEM "0|0" MESSAGE ENABLE,1@|DISABLE,2@
 | 
				
			||||||
 | 
					  ITEM "1|1" MESSAGE ENABLE,2@|DISABLE,1@
 | 
				
			||||||
 | 
					  ITEM "2|2" MESSAGE ENABLE,2@|DISABLE,1@
 | 
				
			||||||
 | 
					  FLAGS "H"
 | 
				
			||||||
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
STRINGA -1
 | 
					STRINGA -1
 | 
				
			||||||
BEGIN
 | 
					BEGIN
 | 
				
			||||||
  KEY "codice commessa"
 | 
					  KEY "codice commessa"
 | 
				
			||||||
@ -126,6 +144,7 @@ BEGIN
 | 
				
			|||||||
  KEY "numero registrazione"
 | 
					  KEY "numero registrazione"
 | 
				
			||||||
  PROMPT 1 1 ""
 | 
					  PROMPT 1 1 ""
 | 
				
			||||||
  MESSAGE _NREG
 | 
					  MESSAGE _NREG
 | 
				
			||||||
 | 
					  GROUP 1
 | 
				
			||||||
END
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
DATA -1
 | 
					DATA -1
 | 
				
			||||||
@ -133,6 +152,31 @@ BEGIN
 | 
				
			|||||||
  KEY "data pagamento"
 | 
					  KEY "data pagamento"
 | 
				
			||||||
  PROMPT 10 1 ""
 | 
					  PROMPT 10 1 ""
 | 
				
			||||||
  MESSAGE _DATAPAG
 | 
					  MESSAGE _DATAPAG
 | 
				
			||||||
 | 
					  GROUP 1
 | 
				
			||||||
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NUMERO -1 3
 | 
				
			||||||
 | 
					BEGIN
 | 
				
			||||||
 | 
					  KEY "gruppo"
 | 
				
			||||||
 | 
					  PROMPT 3 1 ""
 | 
				
			||||||
 | 
					  MESSAGE _GRUPPO
 | 
				
			||||||
 | 
					  GROUP 2
 | 
				
			||||||
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NUMERO -1 3
 | 
				
			||||||
 | 
					BEGIN
 | 
				
			||||||
 | 
					  KEY "conto"
 | 
				
			||||||
 | 
					  PROMPT 7 1 ""
 | 
				
			||||||
 | 
					  MESSAGE _CONTO
 | 
				
			||||||
 | 
					  GROUP 2
 | 
				
			||||||
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					NUMERO -1 6
 | 
				
			||||||
 | 
					BEGIN
 | 
				
			||||||
 | 
					  KEY "sottoconto"
 | 
				
			||||||
 | 
					  PROMPT 11 1 ""
 | 
				
			||||||
 | 
					  MESSAGE _SOTTOCONTO
 | 
				
			||||||
 | 
					  GROUP 2
 | 
				
			||||||
END
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
STRINGA -1 45
 | 
					STRINGA -1 45
 | 
				
			||||||
@ -147,6 +191,7 @@ BEGIN
 | 
				
			|||||||
  KEY "codice fornitore"
 | 
					  KEY "codice fornitore"
 | 
				
			||||||
  PROMPT 69 1 ""
 | 
					  PROMPT 69 1 ""
 | 
				
			||||||
  MESSAGE _CODFORN
 | 
					  MESSAGE _CODFORN
 | 
				
			||||||
 | 
					  GROUP 1
 | 
				
			||||||
END
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VALUTA -1 15
 | 
					VALUTA -1 15
 | 
				
			||||||
@ -154,6 +199,7 @@ BEGIN
 | 
				
			|||||||
  KEY "totale fattura"
 | 
					  KEY "totale fattura"
 | 
				
			||||||
  PROMPT 77 1 ""
 | 
					  PROMPT 77 1 ""
 | 
				
			||||||
  MESSAGE _TOTDOC
 | 
					  MESSAGE _TOTDOC
 | 
				
			||||||
 | 
					  GROUP 1
 | 
				
			||||||
END
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
VALUTA -1 15
 | 
					VALUTA -1 15
 | 
				
			||||||
@ -173,7 +219,7 @@ END
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
END // section body
 | 
					END // section body
 | 
				
			||||||
 | 
					
 | 
				
			||||||
SECTION FOOTER ODD 3
 | 
					SECTION FOOTER ODD 1
 | 
				
			||||||
END
 | 
					END
 | 
				
			||||||
 | 
					
 | 
				
			||||||
END // form
 | 
					END // form
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user