Patch level : 120
Files correlati : ci1 Ricompilazione Demo : [ ] Commento : Cambiato nome da "Stampa Documenti" in "Stampa Riepiloghi" git-svn-id: svn://10.65.10.50/trunk@13177 c028cbd2-c16b-5b4b-a496-9718f37d4682
This commit is contained in:
		
							parent
							
								
									ec3e3658a5
								
							
						
					
					
						commit
						19f9fcc28d
					
				@ -12,22 +12,22 @@
 | 
			
		||||
#include "../include/rdoc.h"
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// TMask_rdoc
 | 
			
		||||
// TRiepiloghi_mask
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
class TMask_rdoc : public TAutomask
 | 
			
		||||
class TRiepiloghi_mask : public TAutomask
 | 
			
		||||
{
 | 
			
		||||
protected:
 | 
			
		||||
  virtual bool on_field_event(TOperable_field& o, TField_event e, long jolly);
 | 
			
		||||
 | 
			
		||||
  int create_sheet_fields(int lf, int& y, short& dlg, bool required);
 | 
			
		||||
  int create_sheet_fields(int lf, int& y, short& dlg, bool required = false);
 | 
			
		||||
  void create_sheet();
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  TMask_rdoc();
 | 
			
		||||
  TRiepiloghi_mask();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
int TMask_rdoc::create_sheet_fields(int lf, int& y, short& dlg, bool required)
 | 
			
		||||
int TRiepiloghi_mask::create_sheet_fields(int lf, int& y, short& dlg, bool required)
 | 
			
		||||
{
 | 
			
		||||
	TSheet_field& sf = sfield(F_COMMESSE);
 | 
			
		||||
  TMask& sm = sf.sheet_mask();
 | 
			
		||||
@ -37,18 +37,6 @@ int TMask_rdoc::create_sheet_fields(int lf, int& y, short& dlg, bool required)
 | 
			
		||||
  for (int i = 0; i < h; i++)
 | 
			
		||||
  {
 | 
			
		||||
    TEdit_field& fld = sm.efield(dlg+i);
 | 
			
		||||
    int logic = lf;
 | 
			
		||||
    if (logic == LF_FASI)
 | 
			
		||||
    {
 | 
			
		||||
      const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI);
 | 
			
		||||
      if (fasinfo.parent() != 0)
 | 
			
		||||
      {
 | 
			
		||||
        const TMultilevel_code_info& parinfo = ca_multilevel_code_info(fasinfo.parent());
 | 
			
		||||
        if (i < parinfo.levels())
 | 
			
		||||
          logic = fasinfo.parent();
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    fld.check_type(required ? CHECK_REQUIRED : CHECK_NORMAL);
 | 
			
		||||
 | 
			
		||||
    TEdit_field& dfld = sm.efield(dlg+50+i);
 | 
			
		||||
@ -61,7 +49,7 @@ int TMask_rdoc::create_sheet_fields(int lf, int& y, short& dlg, bool required)
 | 
			
		||||
  return h;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TMask_rdoc::create_sheet()
 | 
			
		||||
void TRiepiloghi_mask::create_sheet()
 | 
			
		||||
{
 | 
			
		||||
	TSheet_field& sf = sfield(F_COMMESSE);
 | 
			
		||||
  TMask& sm = sf.sheet_mask();
 | 
			
		||||
@ -70,7 +58,6 @@ void TMask_rdoc::create_sheet()
 | 
			
		||||
  const TMultilevel_code_info& fasinfo = ca_multilevel_code_info(LF_FASI);
 | 
			
		||||
 | 
			
		||||
  TConfig_anal ini;
 | 
			
		||||
  const bool fsc_req = ini.get_bool("FscRequired");
 | 
			
		||||
 | 
			
		||||
  int y = 1;
 | 
			
		||||
  short dlg = S_CDC1 + 100; // id del primo campo da generare
 | 
			
		||||
@ -81,27 +68,26 @@ void TMask_rdoc::create_sheet()
 | 
			
		||||
    if (level == "CDC")                                  // Crea centro di costo 
 | 
			
		||||
    {
 | 
			
		||||
      if (fasinfo.parent() == LF_CDC)
 | 
			
		||||
        create_sheet_fields(LF_FASI, y, dlg, fsc_req);
 | 
			
		||||
        create_sheet_fields(LF_FASI, y, dlg);
 | 
			
		||||
      else
 | 
			
		||||
      {
 | 
			
		||||
        const bool cdc_req = ini.get_bool("CdcRequired");
 | 
			
		||||
        create_sheet_fields(LF_CDC, y, dlg, cdc_req);
 | 
			
		||||
        create_sheet_fields(LF_CDC, y, dlg);
 | 
			
		||||
      }
 | 
			
		||||
    } else
 | 
			
		||||
    if (level == "CMS")                                   // Crea commessa
 | 
			
		||||
    {
 | 
			
		||||
      if (fasinfo.parent() == LF_COMMESSE)
 | 
			
		||||
        create_sheet_fields(LF_FASI, y, dlg, fsc_req);
 | 
			
		||||
        create_sheet_fields(LF_FASI, y, dlg);
 | 
			
		||||
      else
 | 
			
		||||
      {
 | 
			
		||||
        const bool cms_req = ini.get_bool("CmsRequired");
 | 
			
		||||
        create_sheet_fields(LF_COMMESSE, y, dlg, cms_req);
 | 
			
		||||
        create_sheet_fields(LF_COMMESSE, y, dlg);
 | 
			
		||||
      }
 | 
			
		||||
    }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  if (fasinfo.levels() > 0 && fasinfo.parent() <= 0)
 | 
			
		||||
    create_sheet_fields(LF_FASI, y, dlg, fsc_req);
 | 
			
		||||
    create_sheet_fields(LF_FASI, y, dlg);
 | 
			
		||||
 | 
			
		||||
	for (short id = S_CDC12; id >= S_CDC1; id--)
 | 
			
		||||
  {
 | 
			
		||||
@ -121,21 +107,21 @@ void TMask_rdoc::create_sheet()
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TMask_rdoc::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
			
		||||
bool TRiepiloghi_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
			
		||||
{
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
TMask_rdoc::TMask_rdoc() :  TAutomask("ci1200") 
 | 
			
		||||
TRiepiloghi_mask::TRiepiloghi_mask() :  TAutomask("ci1200") 
 | 
			
		||||
{ 
 | 
			
		||||
  create_sheet();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// TRecordset_rdoc
 | 
			
		||||
// TRiepiloghi_recordset
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
class TRecordset_rdoc : public TDocument_recordset
 | 
			
		||||
class TRiepiloghi_recordset : public TDocument_recordset
 | 
			
		||||
{
 | 
			
		||||
  TDate _da_data, _a_data;
 | 
			
		||||
  long _da_clifo, _a_clifo;
 | 
			
		||||
@ -150,13 +136,13 @@ protected:
 | 
			
		||||
  virtual void set_custom_filter(TCursor& cur) const;
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  void set_filter(const TMask_rdoc& msk, int cms_row);
 | 
			
		||||
  TRecordset_rdoc(const TString& sql) : TDocument_recordset(sql) { }
 | 
			
		||||
  void set_filter(const TRiepiloghi_mask& msk, int cms_row);
 | 
			
		||||
  TRiepiloghi_recordset(const TString& sql) : TDocument_recordset(sql) { }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static const TRecordset_rdoc* myself = NULL;
 | 
			
		||||
static const TRiepiloghi_recordset* myself = NULL;
 | 
			
		||||
 | 
			
		||||
bool TRecordset_rdoc::valid_record(const TRelation& rel) const
 | 
			
		||||
bool TRiepiloghi_recordset::valid_record(const TRelation& rel) const
 | 
			
		||||
{
 | 
			
		||||
  const TRectype& doc = rel.curr(LF_DOC);
 | 
			
		||||
  
 | 
			
		||||
@ -173,7 +159,7 @@ bool TRecordset_rdoc::valid_record(const TRelation& rel) const
 | 
			
		||||
  if (codart < _da_codart || (_a_codart.not_empty() && codart.compare(_a_codart, _a_codart.len()) > 0))
 | 
			
		||||
    return false;
 | 
			
		||||
 | 
			
		||||
  if (_tipidoc.items() > 0)
 | 
			
		||||
  if (!_tipidoc.empty())
 | 
			
		||||
  {
 | 
			
		||||
    const TString4 codnum = doc.get(DOC_CODNUM);
 | 
			
		||||
    const TString4 tipodoc = doc.get(DOC_TIPODOC);
 | 
			
		||||
@ -214,18 +200,18 @@ bool TRecordset_rdoc::valid_record(const TRelation& rel) const
 | 
			
		||||
  return true;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
bool TRecordset_rdoc::rdoc_filter(const TRelation* rel)
 | 
			
		||||
bool TRiepiloghi_recordset::rdoc_filter(const TRelation* rel)
 | 
			
		||||
{
 | 
			
		||||
  return myself->valid_record(*rel);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TRecordset_rdoc::set_custom_filter(TCursor& cur) const
 | 
			
		||||
void TRiepiloghi_recordset::set_custom_filter(TCursor& cur) const
 | 
			
		||||
{
 | 
			
		||||
  myself = this;
 | 
			
		||||
  cur.set_filterfunction(rdoc_filter, true);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TRecordset_rdoc::set_filter(const TMask_rdoc& msk, int cms_row)
 | 
			
		||||
void TRiepiloghi_recordset::set_filter(const TRiepiloghi_mask& msk, int cms_row)
 | 
			
		||||
{
 | 
			
		||||
  _codcosto = _codcms = _codfas = "";
 | 
			
		||||
  if (cms_row >= 0)
 | 
			
		||||
@ -264,48 +250,48 @@ void TRecordset_rdoc::set_filter(const TMask_rdoc& msk, int cms_row)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// TReport_rdoc
 | 
			
		||||
// TRiepiloghi_report
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
class TReport_rdoc : public TReport
 | 
			
		||||
class TRiepiloghi_report : public TReport
 | 
			
		||||
{
 | 
			
		||||
protected:
 | 
			
		||||
  virtual bool set_recordset(const TString& sql);
 | 
			
		||||
 | 
			
		||||
public:
 | 
			
		||||
  void set_filter(const TMask_rdoc& msk, int cms_row);
 | 
			
		||||
  TReport_rdoc() { }
 | 
			
		||||
  void set_filter(const TRiepiloghi_mask& msk, int cms_row);
 | 
			
		||||
  TRiepiloghi_report() { }
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
bool TReport_rdoc::set_recordset(const TString& sql)
 | 
			
		||||
bool TRiepiloghi_report::set_recordset(const TString& sql)
 | 
			
		||||
{
 | 
			
		||||
  TRecordset_rdoc* rs = new TRecordset_rdoc(sql);
 | 
			
		||||
  TRiepiloghi_recordset* rs = new TRiepiloghi_recordset(sql);
 | 
			
		||||
  return TReport::set_recordset(rs);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void TReport_rdoc::set_filter(const TMask_rdoc& msk, int cms_row)
 | 
			
		||||
void TRiepiloghi_report::set_filter(const TRiepiloghi_mask& msk, int cms_row)
 | 
			
		||||
{
 | 
			
		||||
  TRecordset_rdoc* rs = (TRecordset_rdoc*)recordset();
 | 
			
		||||
  TRiepiloghi_recordset* rs = (TRiepiloghi_recordset*)recordset();
 | 
			
		||||
  rs->set_filter(msk, cms_row);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
// TStampa_rdoc
 | 
			
		||||
// TRiepiloghi_app
 | 
			
		||||
///////////////////////////////////////////////////////////
 | 
			
		||||
 | 
			
		||||
class TStampa_rdoc : public TSkeleton_application
 | 
			
		||||
class TRiepiloghi_app : public TSkeleton_application
 | 
			
		||||
{
 | 
			
		||||
protected:
 | 
			
		||||
  virtual void main_loop();
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void TStampa_rdoc::main_loop()
 | 
			
		||||
void TRiepiloghi_app::main_loop()
 | 
			
		||||
{
 | 
			
		||||
  TMask_rdoc m;
 | 
			
		||||
  TRiepiloghi_mask m;
 | 
			
		||||
  while (m.run() != K_QUIT)
 | 
			
		||||
  {
 | 
			
		||||
    TReport_book book;
 | 
			
		||||
    TReport_rdoc rep;
 | 
			
		||||
    TRiepiloghi_report rep;
 | 
			
		||||
    const TString& repname = m.get(F_REPORT);
 | 
			
		||||
    rep.load(repname);
 | 
			
		||||
 | 
			
		||||
@ -324,7 +310,7 @@ void TStampa_rdoc::main_loop()
 | 
			
		||||
 | 
			
		||||
int ci1200(int argc, char* argv[])
 | 
			
		||||
{
 | 
			
		||||
  TStampa_rdoc sd;
 | 
			
		||||
  sd.run(argc, argv, "Stampa documenti");
 | 
			
		||||
  TRiepiloghi_app sd;
 | 
			
		||||
  sd.run(argc, argv, "Stampa riepiloghi");
 | 
			
		||||
  return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@ -20,7 +20,7 @@ END
 | 
			
		||||
 | 
			
		||||
ENDPAGE
 | 
			
		||||
 | 
			
		||||
PAGE "Documenti" 0 0 0 -3
 | 
			
		||||
PAGE "Riepiloghi" 0 0 0 -3
 | 
			
		||||
 | 
			
		||||
STRING F_REPORT 32
 | 
			
		||||
BEGIN
 | 
			
		||||
 | 
			
		||||
@ -1,10 +1,11 @@
 | 
			
		||||
[CIMENU_001]
 | 
			
		||||
Caption = "Contabilita' Industriale"
 | 
			
		||||
Picture = <cg01>
 | 
			
		||||
Picture = <ve01>
 | 
			
		||||
Module  = 8
 | 
			
		||||
Flags   = "F"
 | 
			
		||||
Item_01 = "Configurazione modulo", [CIMENU_002]
 | 
			
		||||
Item_02 = "Immissione documenti", "ci0 -3", "F"
 | 
			
		||||
Item_03 = "Stampa riepiloghi", "ci1 -1", "F"
 | 
			
		||||
 | 
			
		||||
[CIMENU_002]
 | 
			
		||||
Caption = "Parametri Contabilita' Industriale"
 | 
			
		||||
 | 
			
		||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user