e stampa con filtro sulle causali git-svn-id: svn://10.65.10.50/trunk@4717 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			110 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			110 lines
		
	
	
		
			3.3 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
#include <applicat.h>
 | 
						|
#include <config.h>
 | 
						|
#include <mask.h>   
 | 
						|
#include <printer.h>
 | 
						|
#include <relation.h>
 | 
						|
#include <tabutil.h>
 | 
						|
#include <urldefid.h>
 | 
						|
#include <utility.h>
 | 
						|
#include <form.h>
 | 
						|
#include <printapp.h>
 | 
						|
 | 
						|
#include "mglib.h"
 | 
						|
#include "mg4100.h"
 | 
						|
 | 
						|
class TStampa_listamov : public TApplication
 | 
						|
{
 | 
						|
  TArray _files;
 | 
						|
  TMask * _mask;
 | 
						|
  TForm * _form; 
 | 
						|
 | 
						|
  int _codicees;
 | 
						|
  bool _raggmag;
 | 
						|
  TString _daart,_aart,_damag,_amag;
 | 
						|
  TDate _dadata,_adata;
 | 
						|
protected:
 | 
						|
  virtual bool create();
 | 
						|
  virtual bool destroy();
 | 
						|
};
 | 
						|
 | 
						|
bool TStampa_listamov::create()
 | 
						|
{
 | 
						|
  _files.add(new TLocalisamfile(LF_MOVMAG));
 | 
						|
  _files.add(new TLocalisamfile(LF_RMOVMAG));
 | 
						|
  _files.add(new TLocalisamfile(LF_ANAMAG));
 | 
						|
  _files.add(new TLocalisamfile(LF_UMART));
 | 
						|
  _files.add(new TLocalisamfile(LF_TAB));
 | 
						|
 | 
						|
  TRectype darec(LF_RMOVMAG),arec(LF_RMOVMAG);
 | 
						|
  _mask = new TMask("mg4100");
 | 
						|
  while (_mask->run() == K_ENTER) {
 | 
						|
    _form = new TForm("mg4100", "");
 | 
						|
    TSorted_cursor& cur = (TSorted_cursor& )*_form->cursor();
 | 
						|
  
 | 
						|
    TString sortexp;
 | 
						|
    TString filter;
 | 
						|
 | 
						|
    filter << '(' << LF_MOVMAG << "->ANNOES==\""<< _mask->get(F_ANNOES) << "\")";
 | 
						|
    if (_mask->get(F_CAU1).not_empty())
 | 
						|
    {
 | 
						|
      filter << "&&((CAUS==\"" << _mask->get(F_CAU1) << "\")";
 | 
						|
      filter << "||(" << LF_MOVMAG << "->CODCAUS==\"" << _mask->get(F_CAU1)<< "\")";
 | 
						|
      if (_mask->get(F_CAU2).not_empty())
 | 
						|
        filter << "||(CAUS==\"" << _mask->get(F_CAU2) << "\")"
 | 
						|
          << "||(" << LF_MOVMAG << "->CODCAUS==\"" << _mask->get(F_CAU2)<< "\")";
 | 
						|
      if (_mask->get(F_CAU3).not_empty())
 | 
						|
        filter << "||(CAUS==\"" << _mask->get(F_CAU3)<< "\")"
 | 
						|
          << "||(" << LF_MOVMAG << "->CODCAUS==\"" << _mask->get(F_CAU3)<< "\")";
 | 
						|
      if (_mask->get(F_CAU4).not_empty())
 | 
						|
        filter << "||(CAUS==\"" << _mask->get(F_CAU4)<< "\")"
 | 
						|
          << "||(" << LF_MOVMAG << "->CODCAUS==\"" << _mask->get(F_CAU4)<< "\")";
 | 
						|
      if (_mask->get(F_CAU5).not_empty())
 | 
						|
        filter << "||(CAUS==\"" << _mask->get(F_CAU5)<< "\")"
 | 
						|
          << "||(" << LF_MOVMAG << "->CODCAUS==\"" << _mask->get(F_CAU5)<< "\")";
 | 
						|
      if (_mask->get(F_CAU6).not_empty())
 | 
						|
        filter << "||(CAUS==\"" << _mask->get(F_CAU6)<< "\")"
 | 
						|
          << "||(" << LF_MOVMAG << "->CODCAUS==\"" << _mask->get(F_CAU6)<< "\")";
 | 
						|
      filter << ")";
 | 
						|
    }
 | 
						|
    darec.zero(' ');
 | 
						|
    arec.zero(' ');
 | 
						|
    if (_mask->get(F_ORDINE)=="N")
 | 
						|
    {
 | 
						|
      sortexp="NUMREG|CODART|NRIG";
 | 
						|
      // trova il record iniziale E finale
 | 
						|
      darec.put("NUMREG",_mask->get(F_DANUM));
 | 
						|
      arec.put("NUMREG",_mask->get(F_ANUM));
 | 
						|
      _form->find_field('B',odd_page,"HEADER_DATA").hide();
 | 
						|
    } else {
 | 
						|
      sortexp.cut(0) << LF_MOVMAG << "->DATAREG|NUMREG|CODART|NRIG";
 | 
						|
      // trova il record iniziale E finale
 | 
						|
      if (_mask->get(F_DADATA).not_empty()) 
 | 
						|
        filter << "&&( DATACOMP>=" << '"' << _mask->get(F_DADATA) << '"';
 | 
						|
      if (_mask->get(F_ADATA).not_empty()) 
 | 
						|
        filter << "&&( DATACOMP<=" << '"' << _mask->get(F_ADATA) << "\")";
 | 
						|
      _form->find_field('B',odd_page,"HEADER_DATA").show();
 | 
						|
    }
 | 
						|
 | 
						|
    cur.change_order(sortexp);
 | 
						|
    cur.setfilter(filter,TRUE);
 | 
						|
    cur.setregion(darec,arec);    
 | 
						|
 | 
						|
    _form->print();
 | 
						|
    delete _form;
 | 
						|
  } // while true  
 | 
						|
  return FALSE;
 | 
						|
}
 | 
						|
bool TStampa_listamov::destroy()
 | 
						|
{
 | 
						|
  delete _mask;
 | 
						|
  return TRUE;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
int mg4100(int argc, char* argv[])
 | 
						|
{
 | 
						|
  TStampa_listamov a;// derivata da Application e con uso di form
 | 
						|
  a.run(argc,argv,"Stampa lista movimenti");
 | 
						|
  return 0;
 | 
						|
}
 |