Files correlati : Ricompilazione Demo : [ ] Commento : Riportata la versione 3.1 patch 766 git-svn-id: svn://10.65.10.50/trunk@14628 c028cbd2-c16b-5b4b-a496-9718f37d4682
		
			
				
	
	
		
			587 lines
		
	
	
		
			19 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
			
		
		
	
	
			587 lines
		
	
	
		
			19 KiB
		
	
	
	
		
			C++
		
	
	
		
			Executable File
		
	
	
	
	
#define WIN32_LEAN_AND_MEAN
 | 
						|
#include <windows.h>
 | 
						|
 | 
						|
#include <applicat.h>
 | 
						|
#include <automask.h>
 | 
						|
#include <execp.h>
 | 
						|
#include <progind.h>
 | 
						|
#include <recset.h>
 | 
						|
#include <relation.h>
 | 
						|
#include <reprint.h>
 | 
						|
 | 
						|
#include "pf0001.h"
 | 
						|
#include "pf0001100.h"
 | 
						|
#include "../mg/rmovmag.h"
 | 
						|
#include "../mg/codcorr.h"
 | 
						|
 | 
						|
typedef const char* LPCTSTR;
 | 
						|
typedef char* LPTSTR;
 | 
						|
#define VERIFY(s) if (!(s)) return false;
 | 
						|
 | 
						|
typedef int (_stdcall *pfnB_Bar2d_Maxi)(int x, int y, int cl, int cc, long int pc,
 | 
						|
								 LPCTSTR data);
 | 
						|
typedef int (_stdcall *pfnB_Bar2d_PDF417)(int x, int y, int w, int v, int s, int c,
 | 
						|
									int px,	int py, int r, int l, int t, int o,
 | 
						|
									LPCTSTR data);
 | 
						|
typedef int (_stdcall *pfnB_Bar2d_PDF417_N)(int x, int y, int w, int h, int s, int c,
 | 
						|
				int hrx, int hry, int hrm, int f, int mw, int bh, int r, int l,
 | 
						|
				int t, LPCTSTR data);
 | 
						|
typedef void (_stdcall *pfnB_ClosePrn)(void);
 | 
						|
typedef int (_stdcall *pfnB_CreatePrn)(int selection, LPCTSTR filename);
 | 
						|
typedef int (_stdcall *pfnB_Del_Form)(char formname[10]);
 | 
						|
typedef int (_stdcall *pfnB_Del_Pcx)(char pcxname[10]);
 | 
						|
typedef int (_stdcall *pfnB_Draw_Box)(int x, int y, int thickness, int hor_dots, 
 | 
						|
							   int ver_dots);
 | 
						|
typedef int (_stdcall *pfnB_Draw_Line)(char mode, int x, int y, int hor_dots, 
 | 
						|
								int ver_dots);
 | 
						|
typedef int (_stdcall *pfnB_Error_Reporting)(char option);
 | 
						|
typedef char* (_stdcall *pfnB_Get_DLL_Version)(int nShowMessage);
 | 
						|
typedef int (_stdcall *pfnB_Get_DLL_VersionA)(int nShowMessage);
 | 
						|
typedef int (_stdcall *pfnB_Get_Graphic_ColorBMP)(int x, int y, LPCTSTR filename);
 | 
						|
typedef int (_stdcall *pfnB_Get_Pcx)(int x, int y, LPCTSTR filename);
 | 
						|
typedef int (_stdcall *pfnB_Initial_Setting)(int Type, LPCTSTR Source);
 | 
						|
typedef int (_stdcall *pfnB_Load_Pcx)(int x, int y, char pcxname[10]);
 | 
						|
typedef int (_stdcall *pfnB_Open_ChineseFont)(char* path);
 | 
						|
typedef int (_stdcall *pfnB_Print_Form)(int labset, int copies, char form_out[10], 
 | 
						|
								 LPTSTR var);
 | 
						|
typedef int (_stdcall *pfnB_Print_MCopy)(int labset, int copies);
 | 
						|
typedef int (_stdcall *pfnB_Print_Out)(int labset);
 | 
						|
typedef int (_stdcall *pfnB_Prn_Barcode)(int x, int y, int ori, char type[4], int narrow, 
 | 
						|
								  int width, int height, char human, LPCTSTR data);
 | 
						|
typedef void (_stdcall *pfnB_Prn_Configuration)(void);
 | 
						|
typedef int (_stdcall *pfnB_Prn_Text)(int x,int y,int ori,int font,int hor_factor, 
 | 
						|
							   int ver_factor,char mode,LPCTSTR data);
 | 
						|
typedef int (_stdcall *pfnB_Prn_Text_Chinese)(int x, int y, int fonttype, 
 | 
						|
									   LPCTSTR id_name, LPCTSTR data);
 | 
						|
typedef int (_stdcall *pfnB_Prn_Text_TrueType)(int x, int y, int FSize, LPCTSTR FType, 
 | 
						|
										int Fspin, int FWeight, int FItalic,
 | 
						|
										int FUnline, int FStrikeOut,
 | 
						|
										LPCTSTR id_name, LPCTSTR data);
 | 
						|
typedef int (_stdcall *pfnB_Prn_Text_TrueType_W)(int x, int y, int FHeight, int FWidth, 
 | 
						|
										  LPCTSTR FType, int Fspin, int FWeight,
 | 
						|
										  int FItalic, int FUnline, int FStrikeOut,
 | 
						|
										  LPCTSTR id_name, LPCTSTR data);
 | 
						|
typedef int (_stdcall *pfnB_Select_Option)(int object);
 | 
						|
typedef int (_stdcall *pfnB_Select_Symbol)(int num_bit, int symbol, int country);
 | 
						|
typedef int (_stdcall *pfnB_Set_Backfeed)(char option);
 | 
						|
typedef int (_stdcall *pfnB_Set_BMPSave)(int nSave, char* pstrBMPFName);
 | 
						|
typedef int (_stdcall *pfnB_Set_Darkness)(int darkness);
 | 
						|
typedef int (_stdcall *pfnB_Set_DebugDialog)(int nEnable);
 | 
						|
typedef int (_stdcall *pfnB_Set_Direction)(char direction);
 | 
						|
typedef int (_stdcall *pfnB_Set_Form)(LPCTSTR formfile);
 | 
						|
typedef int (_stdcall *pfnB_Set_Labgap)(int lablength, int gaplength);
 | 
						|
typedef int (_stdcall *pfnB_Set_Labwidth)(int labwidth);
 | 
						|
typedef int (_stdcall *pfnB_Set_Originpoint)(int hor, int ver);
 | 
						|
typedef int (_stdcall *pfnB_Set_Prncomport)(int baud, char parity, int data, int stop);
 | 
						|
typedef int (_stdcall *pfnB_Set_Prncomport_PC)(int nBaudRate, int nByteSize, int nParity,
 | 
						|
										int nStopBits, int nDsr, int nCts, int nXonXoff);
 | 
						|
typedef int (_stdcall *pfnB_Set_Speed)(int speed);
 | 
						|
typedef int (_stdcall *pfnB_Set_ProcessDlg)(int nShow);
 | 
						|
typedef int (_stdcall *pfnB_GetUSBBufferLen)(void);
 | 
						|
typedef int (_stdcall *pfnB_EnumUSB)(char *buf);
 | 
						|
typedef int (_stdcall *pfnB_CreateUSBPort)(int nPort);
 | 
						|
typedef int (_stdcall *pfnB_Set_ErrorReport)(int nEnable);
 | 
						|
typedef int (_stdcall *pfnB_ResetPrinter)(void);
 | 
						|
 | 
						|
pfnB_Bar2d_Maxi				B_Bar2d_Maxi			= NULL;
 | 
						|
pfnB_Bar2d_PDF417			B_Bar2d_PDF417			= NULL;
 | 
						|
pfnB_Bar2d_PDF417_N			B_Bar2d_PDF417_N		= NULL;
 | 
						|
pfnB_ClosePrn				B_ClosePrn				= NULL;
 | 
						|
pfnB_CreatePrn				B_CreatePrn				= NULL;
 | 
						|
pfnB_Del_Form				B_Del_Form				= NULL;
 | 
						|
pfnB_Del_Pcx				B_Del_Pcx				= NULL;
 | 
						|
pfnB_Draw_Box				B_Draw_Box				= NULL; 
 | 
						|
pfnB_Draw_Line				B_Draw_Line				= NULL;
 | 
						|
pfnB_Error_Reporting		B_Error_Reporting		= NULL;
 | 
						|
pfnB_Get_DLL_Version		B_Get_DLL_Version		= NULL;
 | 
						|
pfnB_Get_DLL_VersionA		B_Get_DLL_VersionA		= NULL;
 | 
						|
pfnB_Get_Graphic_ColorBMP	B_Get_Graphic_ColorBMP	= NULL;
 | 
						|
pfnB_Get_Pcx				B_Get_Pcx				= NULL;
 | 
						|
pfnB_Initial_Setting		B_Initial_Setting		= NULL;
 | 
						|
pfnB_Load_Pcx				B_Load_Pcx				= NULL;
 | 
						|
pfnB_Open_ChineseFont		B_Open_ChineseFont		= NULL;
 | 
						|
pfnB_Print_Form				B_Print_Form			= NULL;
 | 
						|
pfnB_Print_MCopy			B_Print_MCopy			= NULL;
 | 
						|
pfnB_Print_Out				B_Print_Out				= NULL;
 | 
						|
pfnB_Prn_Barcode			B_Prn_Barcode			= NULL;
 | 
						|
pfnB_Prn_Configuration		B_Prn_Configuration		= NULL;
 | 
						|
pfnB_Prn_Text				B_Prn_Text				= NULL;
 | 
						|
pfnB_Prn_Text_Chinese		B_Prn_Text_Chinese		= NULL;
 | 
						|
pfnB_Prn_Text_TrueType		B_Prn_Text_TrueType		= NULL;
 | 
						|
pfnB_Prn_Text_TrueType_W	B_Prn_Text_TrueType_W	= NULL;
 | 
						|
pfnB_Select_Option			B_Select_Option			= NULL;
 | 
						|
pfnB_Select_Symbol			B_Select_Symbol			= NULL;
 | 
						|
pfnB_Set_Backfeed			B_Set_Backfeed			= NULL;
 | 
						|
pfnB_Set_BMPSave			B_Set_BMPSave			= NULL;
 | 
						|
pfnB_Set_Darkness			B_Set_Darkness			= NULL;
 | 
						|
pfnB_Set_DebugDialog		B_Set_DebugDialog		= NULL;
 | 
						|
pfnB_Set_Direction			B_Set_Direction			= NULL;
 | 
						|
pfnB_Set_Form				B_Set_Form				= NULL;
 | 
						|
pfnB_Set_Labgap				B_Set_Labgap			= NULL;
 | 
						|
pfnB_Set_Labwidth			B_Set_Labwidth			= NULL;
 | 
						|
pfnB_Set_Originpoint		B_Set_Originpoint		= NULL;
 | 
						|
pfnB_Set_Prncomport			B_Set_Prncomport		= NULL;
 | 
						|
pfnB_Set_Prncomport_PC		B_Set_Prncomport_PC		= NULL;
 | 
						|
pfnB_Set_Speed				B_Set_Speed				= NULL;
 | 
						|
pfnB_Set_ProcessDlg			B_Set_ProcessDlg		= NULL;
 | 
						|
pfnB_GetUSBBufferLen		B_GetUSBBufferLen		= NULL;
 | 
						|
pfnB_EnumUSB				B_EnumUSB				= NULL;
 | 
						|
pfnB_CreateUSBPort			B_CreateUSBPort			= NULL;
 | 
						|
pfnB_Set_ErrorReport		B_Set_ErrorReport		= NULL;
 | 
						|
pfnB_ResetPrinter			B_ResetPrinter			= NULL;
 | 
						|
 | 
						|
////////////////////////////////////////////////////////
 | 
						|
//	MASCHERA
 | 
						|
////////////////////////////////////////////////////////
 | 
						|
class TStampa_etich_art_mask : public TAutomask
 | 
						|
{
 | 
						|
protected:
 | 
						|
  bool on_field_event(TOperable_field& o, TField_event e, long jolly);
 | 
						|
 | 
						|
public:
 | 
						|
  TStampa_etich_art_mask();
 | 
						|
  virtual ~TStampa_etich_art_mask() {}
 | 
						|
};
 | 
						|
 | 
						|
 | 
						|
bool TStampa_etich_art_mask::on_field_event(TOperable_field& o, TField_event e, long jolly)
 | 
						|
{ 
 | 
						|
  bool ok = true;
 | 
						|
/*  switch (o.dlg())
 | 
						|
  {
 | 
						|
  case :
 | 
						|
    {
 | 
						|
 | 
						|
    }
 | 
						|
    break;
 | 
						|
  default: break;
 | 
						|
  }*/
 | 
						|
  return ok;
 | 
						|
}
 | 
						|
 | 
						|
 | 
						|
TStampa_etich_art_mask::TStampa_etich_art_mask()
 | 
						|
								:TAutomask("pf0001100")
 | 
						|
{}
 | 
						|
 | 
						|
 | 
						|
///////////////////////////////////////////////////////////////
 | 
						|
//	RECORDSET
 | 
						|
///////////////////////////////////////////////////////////////
 | 
						|
 | 
						|
class TStampa_etich_art_recordset : public TISAM_recordset
 | 
						|
{
 | 
						|
	int _ncopie;
 | 
						|
	TRecnotype _current_row;
 | 
						|
 | 
						|
public:
 | 
						|
  virtual bool move_to(TRecnotype pos);
 | 
						|
  virtual TRecnotype items() const;
 | 
						|
  virtual TRecnotype current_row() const;
 | 
						|
	void set_filter(const TStampa_etich_art_mask& msk);
 | 
						|
 | 
						|
  TStampa_etich_art_recordset(const TString& sql) : TISAM_recordset(sql), _ncopie(1), _current_row(0L) { }
 | 
						|
};
 | 
						|
 | 
						|
//metodo per caricare i valori nel recordset dalla maschera...fighissimo!!
 | 
						|
void TStampa_etich_art_recordset::set_filter(const TStampa_etich_art_mask& msk)
 | 
						|
{
 | 
						|
		TVariant var;
 | 
						|
 | 
						|
		var = msk.get(F_DACODART);
 | 
						|
		set_var("#DACODART", var);
 | 
						|
		var = msk.get(F_ACODART);
 | 
						|
		set_var("#ACODART", var);
 | 
						|
		_ncopie = msk.get_int(F_QTA);
 | 
						|
		var = msk.get(F_LIST);
 | 
						|
		set_var("#LIST", var);
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
TRecnotype TStampa_etich_art_recordset::items() const
 | 
						|
{
 | 
						|
	return _ncopie * TISAM_recordset::items();
 | 
						|
}
 | 
						|
 | 
						|
TRecnotype TStampa_etich_art_recordset::current_row() const
 | 
						|
{
 | 
						|
	return _current_row;
 | 
						|
}
 | 
						|
 | 
						|
bool TStampa_etich_art_recordset::move_to(TRecnotype pos)
 | 
						|
{
 | 
						|
	_current_row = pos;
 | 
						|
	const bool valid = _current_row < items();
 | 
						|
 | 
						|
	if (_ncopie > 1)
 | 
						|
	{
 | 
						|
		if (pos >= items())
 | 
						|
			return false;
 | 
						|
		pos /= _ncopie;
 | 
						|
	}
 | 
						|
	if (valid)
 | 
						|
		TISAM_recordset::move_to(pos);
 | 
						|
	else
 | 
						|
	_current_row = 0L;
 | 
						|
	return valid;
 | 
						|
}
 | 
						|
 | 
						|
//////////
 | 
						|
 | 
						|
class TStampa_etich_mov_recordset : public TISAM_recordset
 | 
						|
{
 | 
						|
	TPointer_array _index;
 | 
						|
	TRecnotype _current_row;
 | 
						|
 | 
						|
public:
 | 
						|
  virtual bool move_to(TRecnotype pos);
 | 
						|
  virtual TRecnotype items() const;
 | 
						|
  virtual TRecnotype current_row() const;
 | 
						|
	void set_filter(const TStampa_etich_art_mask& msk);
 | 
						|
	TPointer_array & index() { return _index; }
 | 
						|
  virtual void requery();
 | 
						|
 | 
						|
 | 
						|
  TStampa_etich_mov_recordset(const TString& sql) : TISAM_recordset(sql), _current_row(0L) { }
 | 
						|
};
 | 
						|
 | 
						|
//metodo per caricare i valori nel recordset dalla maschera...fighissimo!!
 | 
						|
void TStampa_etich_mov_recordset::set_filter(const TStampa_etich_art_mask& msk)
 | 
						|
{
 | 
						|
		TVariant var;
 | 
						|
 | 
						|
		var = msk.get(F_DACODART);
 | 
						|
		set_var("#DACODART", var);
 | 
						|
		var = msk.get(F_ACODART);
 | 
						|
		set_var("#ACODART", var);
 | 
						|
		var = msk.get(F_DADATA);
 | 
						|
		set_var("#DADATA", var);
 | 
						|
		var = msk.get(F_ADATA);
 | 
						|
		set_var("#ADATA", var);
 | 
						|
		var = msk.get(F_CAUS);
 | 
						|
		set_var("#CAUS", var);
 | 
						|
		var = msk.get(F_LIST);
 | 
						|
		set_var("#LIST", var);
 | 
						|
		TCursor * c = cursor();
 | 
						|
		requery();
 | 
						|
}
 | 
						|
 | 
						|
TRecnotype TStampa_etich_mov_recordset::items() const
 | 
						|
{
 | 
						|
	return _index.items();
 | 
						|
}
 | 
						|
 | 
						|
TRecnotype TStampa_etich_mov_recordset::current_row() const
 | 
						|
{
 | 
						|
	return _current_row;
 | 
						|
}
 | 
						|
 | 
						|
bool TStampa_etich_mov_recordset::move_to(TRecnotype pos)
 | 
						|
{
 | 
						|
	_current_row = pos;
 | 
						|
	const bool valid = _current_row < items();
 | 
						|
 | 
						|
	if (valid)
 | 
						|
		TISAM_recordset::move_to(_index.get_long(pos) - 1);
 | 
						|
	else
 | 
						|
		_current_row = 0L;
 | 
						|
	return valid;
 | 
						|
}
 | 
						|
 | 
						|
bool build_index(const TRelation& rel, void* pJolly)
 | 
						|
{
 | 
						|
	TStampa_etich_mov_recordset * r = (TStampa_etich_mov_recordset *) pJolly;
 | 
						|
	int ncopie = atoi(rel.curr().get(RMOVMAG_QUANT));
 | 
						|
	const TRecnotype pos = r->cursor()->pos();
 | 
						|
 | 
						|
	if (ncopie > 0)
 | 
						|
		for ( int i = 0; i < ncopie; i++)
 | 
						|
			r->index().insert_long(pos + 1);
 | 
						|
	return true;
 | 
						|
}
 | 
						|
 | 
						|
void TStampa_etich_mov_recordset::requery()
 | 
						|
{
 | 
						|
	if (valid_cursor())
 | 
						|
	{
 | 
						|
		TCursor * c = cursor();
 | 
						|
 | 
						|
		_index.destroy();
 | 
						|
		c->scan(build_index, this);
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
////////////////////////////////////////////////////////
 | 
						|
//	REPORT
 | 
						|
////////////////////////////////////////////////////////
 | 
						|
class TStampa_etich_art_rep : public TReport
 | 
						|
{
 | 
						|
protected:
 | 
						|
	virtual bool get_usr_val(const TString& name, TVariant& var) const;
 | 
						|
  virtual bool set_recordset(const TString& query);
 | 
						|
 | 
						|
public:
 | 
						|
	void set_filter(const TStampa_etich_art_mask& msk);
 | 
						|
};
 | 
						|
 | 
						|
//metodo per il calcolo dei campi da calcolare (ma va'!) nel report
 | 
						|
bool TStampa_etich_art_rep::get_usr_val(const TString& name, TVariant& var) const
 | 
						|
{
 | 
						|
	return TReport::get_usr_val(name, var);
 | 
						|
}
 | 
						|
 | 
						|
bool TStampa_etich_art_rep::set_recordset(const TString& query)
 | 
						|
{
 | 
						|
  return TReport::set_recordset(new TStampa_etich_art_recordset(query));
 | 
						|
}
 | 
						|
 | 
						|
void TStampa_etich_art_rep::set_filter(const TStampa_etich_art_mask& msk)
 | 
						|
{
 | 
						|
	((TStampa_etich_art_recordset *)recordset())->set_filter(msk);
 | 
						|
}
 | 
						|
 | 
						|
////////////////////////////////////////////////////////
 | 
						|
 | 
						|
class TStampa_etich_mov_rep : public TReport
 | 
						|
{
 | 
						|
protected:
 | 
						|
	virtual bool get_usr_val(const TString& name, TVariant& var) const;
 | 
						|
  virtual bool set_recordset(const TString& query);
 | 
						|
 | 
						|
public:
 | 
						|
	void set_filter(const TStampa_etich_art_mask& msk);
 | 
						|
};
 | 
						|
 | 
						|
//metodo per il calcolo dei campi da calcolare (ma va'!) nel report
 | 
						|
bool TStampa_etich_mov_rep::get_usr_val(const TString& name, TVariant& var) const
 | 
						|
{
 | 
						|
	return TReport::get_usr_val(name, var);
 | 
						|
}
 | 
						|
 | 
						|
bool TStampa_etich_mov_rep::set_recordset(const TString& query)
 | 
						|
{
 | 
						|
  return TReport::set_recordset(new TStampa_etich_mov_recordset(query));
 | 
						|
}
 | 
						|
 | 
						|
void TStampa_etich_mov_rep::set_filter(const TStampa_etich_art_mask& msk)
 | 
						|
{
 | 
						|
	((TStampa_etich_mov_recordset *)recordset())->set_filter(msk);
 | 
						|
}
 | 
						|
 | 
						|
////////////////////////////////////////////////////////
 | 
						|
//	book
 | 
						|
////////////////////////////////////////////////////////
 | 
						|
 | 
						|
class TEtich_book : public TReport_book
 | 
						|
{
 | 
						|
public:
 | 
						|
  void print_labels(int width, int height, int ncopie) const;
 | 
						|
};
 | 
						|
 | 
						|
void TEtich_book::print_labels(int width, int height, int ncopie) const
 | 
						|
{
 | 
						|
	B_CreatePrn(1, NULL);
 | 
						|
	B_Select_Option(2);
 | 
						|
	B_Set_Darkness(8);
 | 
						|
	B_Set_Labgap(275,16);
 | 
						|
	B_Set_Labwidth(450);
 | 
						|
 | 
						|
  TString str(1024);
 | 
						|
 | 
						|
  char* buffer = str.get_buffer();
 | 
						|
 | 
						|
  ifstream ifs(file());
 | 
						|
 | 
						|
  TString_array page;
 | 
						|
  int row, col, wid, hei;
 | 
						|
	TString fontname(80);
 | 
						|
	int size;
 | 
						|
  int prog = 0;
 | 
						|
	int quant = 1;
 | 
						|
	XVT_FONT_STYLE_MASK style;
 | 
						|
 | 
						|
  const TPoint res = page_res();
 | 
						|
 | 
						|
  while (!ifs.eof())
 | 
						|
  {
 | 
						|
    ifs.getline(buffer, str.size());
 | 
						|
 | 
						|
		if (str.starts_with("<frame "))
 | 
						|
    {
 | 
						|
      long x, y, dx, dy;
 | 
						|
      sscanf(str, "<frame x=%ld y=%ld dx=%ld dy=%ld />", &x, &y, &dx, &dy);
 | 
						|
      row = y * 10 / 44;
 | 
						|
      col = x * 10 / 44;
 | 
						|
      wid = dx * 10 / 44;
 | 
						|
      hei = dy * 10 / 44;
 | 
						|
    } else
 | 
						|
    if (str.starts_with("</page "))
 | 
						|
    {
 | 
						|
			int copie = ncopie;
 | 
						|
 | 
						|
			if (copie == 0)
 | 
						|
				copie = quant;
 | 
						|
   	  B_Print_Out(1);
 | 
						|
    } else
 | 
						|
    if (str.starts_with("<font"))
 | 
						|
		{
 | 
						|
      sscanf(str, "<font name=%s size=%d style=%ld />", (const char *)fontname, &size, &style);
 | 
						|
			fontname.strip("\"");
 | 
						|
		}
 | 
						|
		else
 | 
						|
		if (str == "<text>")
 | 
						|
    {
 | 
						|
      TString stringona;
 | 
						|
      while (!ifs.eof())
 | 
						|
      {
 | 
						|
        ifs.getline(buffer, str.size());
 | 
						|
        if (str == "</text>")
 | 
						|
          break;
 | 
						|
        stringona << str << '\n';
 | 
						|
      }
 | 
						|
      stringona.trim();
 | 
						|
 | 
						|
			if (stringona.starts_with("Q="))
 | 
						|
				quant = atoi(stringona.mid(2));
 | 
						|
			else
 | 
						|
			{
 | 
						|
				TParagraph_string para(stringona, wid);
 | 
						|
				for (int i = 0; i < para.items(); i++)
 | 
						|
				{
 | 
						|
					const int j = row + size + 2;
 | 
						|
          TString fld = para.get();
 | 
						|
          TString fmt;
 | 
						|
          fmt.format("%d",prog++);
 | 
						|
 | 
						|
					if (fontname == "Symbol")
 | 
						|
						B_Prn_Barcode(col, j, 0, "E80", 2, 6, hei - 12, 'B', (char *) (const char *) fld);
 | 
						|
					else
 | 
						|
            B_Prn_Text_TrueType(col , j, size * 3, fontname, 1, 700, 0, 0, 0, fmt, (const char *) fld);
 | 
						|
				}
 | 
						|
			}
 | 
						|
    }
 | 
						|
	}
 | 
						|
	B_ClosePrn();
 | 
						|
 | 
						|
}
 | 
						|
 | 
						|
////////////////////////////////////////////////////////
 | 
						|
//	APPLICAZIONE
 | 
						|
////////////////////////////////////////////////////////
 | 
						|
class TStampa_etich_art : public TSkeleton_application
 | 
						|
{
 | 
						|
	HINSTANCE hlib;
 | 
						|
	int _ncopie;
 | 
						|
 | 
						|
protected:
 | 
						|
	bool loadlibrary();
 | 
						|
  void print(TReport & rep);
 | 
						|
  virtual void main_loop();
 | 
						|
	virtual const char * extra_modules() const {return "ba";}
 | 
						|
 | 
						|
};
 | 
						|
 | 
						|
bool TStampa_etich_art::loadlibrary()
 | 
						|
{            
 | 
						|
  if (!hlib)    // Check in already loaded
 | 
						|
	{
 | 
						|
		UINT fuError = SetErrorMode(SEM_NOOPENFILEERRORBOX);
 | 
						|
		hlib = LoadLibrary("winpplb.dll");
 | 
						|
		SetErrorMode(fuError);
 | 
						|
 | 
						|
		if (hlib < (HINSTANCE)HINSTANCE_ERROR)
 | 
						|
		{
 | 
						|
			DWORD err = (DWORD)hlib & 0xFFFF;
 | 
						|
			hlib = NULL;
 | 
						|
			return error_box("Errore di caricamento di winpplb.dll: %lu", err);
 | 
						|
		}  
 | 
						|
	}
 | 
						|
	VERIFY(B_Bar2d_Maxi = (pfnB_Bar2d_Maxi) ::GetProcAddress(hlib,"B_Bar2d_Maxi"));
 | 
						|
	VERIFY(B_Bar2d_PDF417 = (pfnB_Bar2d_PDF417) ::GetProcAddress(hlib,"B_Bar2d_PDF417"));
 | 
						|
	VERIFY(B_Bar2d_PDF417_N = (pfnB_Bar2d_PDF417_N) ::GetProcAddress(hlib,"B_Bar2d_PDF417_N"));
 | 
						|
	VERIFY(B_ClosePrn = (pfnB_ClosePrn) ::GetProcAddress(hlib,"B_ClosePrn"));
 | 
						|
	VERIFY(B_CreatePrn = (pfnB_CreatePrn) ::GetProcAddress(hlib,"B_CreatePrn"));
 | 
						|
	VERIFY(B_Del_Form = (pfnB_Del_Form) ::GetProcAddress(hlib,"B_Del_Form"));
 | 
						|
	VERIFY(B_Del_Pcx = (pfnB_Del_Pcx) ::GetProcAddress(hlib,"B_Del_Pcx"));
 | 
						|
	VERIFY(B_Draw_Box = (pfnB_Draw_Box) ::GetProcAddress(hlib,"B_Draw_Box"));
 | 
						|
	VERIFY(B_Draw_Line = (pfnB_Draw_Line) ::GetProcAddress(hlib,"B_Draw_Line"));
 | 
						|
	VERIFY(B_Error_Reporting = (pfnB_Error_Reporting) ::GetProcAddress(hlib,"B_Error_Reporting"));
 | 
						|
	VERIFY(B_Get_DLL_Version = (pfnB_Get_DLL_Version) ::GetProcAddress(hlib,"B_Get_DLL_Version"));
 | 
						|
	VERIFY(B_Get_DLL_VersionA = (pfnB_Get_DLL_VersionA) ::GetProcAddress(hlib,"B_Get_DLL_VersionA"));
 | 
						|
	VERIFY(B_Get_Graphic_ColorBMP = (pfnB_Get_Graphic_ColorBMP) ::GetProcAddress(hlib,"B_Get_Graphic_ColorBMP"));
 | 
						|
	VERIFY(B_Get_Pcx = (pfnB_Get_Pcx) ::GetProcAddress(hlib,"B_Get_Pcx"));
 | 
						|
	VERIFY(B_Initial_Setting = (pfnB_Initial_Setting) ::GetProcAddress(hlib,"B_Initial_Setting"));
 | 
						|
	VERIFY(B_Load_Pcx = (pfnB_Load_Pcx) ::GetProcAddress(hlib,"B_Load_Pcx"));
 | 
						|
	VERIFY(B_Open_ChineseFont = (pfnB_Open_ChineseFont) ::GetProcAddress(hlib,"B_Open_ChineseFont"));
 | 
						|
	VERIFY(B_Print_Form = (pfnB_Print_Form) ::GetProcAddress(hlib,"B_Print_Form"));
 | 
						|
	VERIFY(B_Print_MCopy = (pfnB_Print_MCopy) ::GetProcAddress(hlib,"B_Print_MCopy"));
 | 
						|
	VERIFY(B_Print_Out = (pfnB_Print_Out) ::GetProcAddress(hlib,"B_Print_Out"));
 | 
						|
	VERIFY(B_Prn_Barcode = (pfnB_Prn_Barcode) ::GetProcAddress(hlib,"B_Prn_Barcode"));
 | 
						|
	VERIFY(B_Prn_Configuration = (pfnB_Prn_Configuration) ::GetProcAddress(hlib,"B_Prn_Configuration"));
 | 
						|
	VERIFY(B_Prn_Text = (pfnB_Prn_Text) ::GetProcAddress(hlib,"B_Prn_Text"));
 | 
						|
	VERIFY(B_Prn_Text_Chinese = (pfnB_Prn_Text_Chinese) ::GetProcAddress(hlib,"B_Prn_Text_Chinese"));
 | 
						|
	VERIFY(B_Prn_Text_TrueType = (pfnB_Prn_Text_TrueType) ::GetProcAddress(hlib,"B_Prn_Text_TrueType"));
 | 
						|
	VERIFY(B_Prn_Text_TrueType_W = (pfnB_Prn_Text_TrueType_W) ::GetProcAddress(hlib,"B_Prn_Text_TrueType_W"));
 | 
						|
	VERIFY(B_Select_Option = (pfnB_Select_Option) ::GetProcAddress(hlib,"B_Select_Option"));
 | 
						|
	VERIFY(B_Select_Symbol = (pfnB_Select_Symbol) ::GetProcAddress(hlib,"B_Select_Symbol"));
 | 
						|
	VERIFY(B_Set_Backfeed = (pfnB_Set_Backfeed) ::GetProcAddress(hlib,"B_Set_Backfeed"));
 | 
						|
	VERIFY(B_Set_BMPSave = (pfnB_Set_BMPSave) ::GetProcAddress(hlib,"B_Set_BMPSave"));
 | 
						|
	VERIFY(B_Set_Darkness = (pfnB_Set_Darkness) ::GetProcAddress(hlib,"B_Set_Darkness"));
 | 
						|
	VERIFY(B_Set_DebugDialog = (pfnB_Set_DebugDialog) ::GetProcAddress(hlib,"B_Set_DebugDialog"));
 | 
						|
	VERIFY(B_Set_Direction = (pfnB_Set_Direction) ::GetProcAddress(hlib,"B_Set_Direction"));
 | 
						|
	VERIFY(B_Set_Form = (pfnB_Set_Form) ::GetProcAddress(hlib,"B_Set_Form"));
 | 
						|
	VERIFY(B_Set_Labgap = (pfnB_Set_Labgap) ::GetProcAddress(hlib,"B_Set_Labgap"));
 | 
						|
	VERIFY(B_Set_Labwidth = (pfnB_Set_Labwidth) ::GetProcAddress(hlib,"B_Set_Labwidth"));
 | 
						|
	VERIFY(B_Set_Originpoint = (pfnB_Set_Originpoint) ::GetProcAddress(hlib,"B_Set_Originpoint"));
 | 
						|
	VERIFY(B_Set_Prncomport = (pfnB_Set_Prncomport) ::GetProcAddress(hlib,"B_Set_Prncomport"));
 | 
						|
	VERIFY(B_Set_Prncomport_PC = (pfnB_Set_Prncomport_PC) ::GetProcAddress(hlib,"B_Set_Prncomport_PC"));
 | 
						|
	VERIFY(B_Set_Speed = (pfnB_Set_Speed) ::GetProcAddress(hlib,"B_Set_Speed"));
 | 
						|
	VERIFY(B_Set_ProcessDlg = (pfnB_Set_ProcessDlg) ::GetProcAddress(hlib,"B_Set_ProcessDlg"));
 | 
						|
	VERIFY(B_GetUSBBufferLen = (pfnB_GetUSBBufferLen) ::GetProcAddress(hlib,"B_GetUSBBufferLen"));
 | 
						|
	VERIFY(B_EnumUSB = (pfnB_EnumUSB) ::GetProcAddress(hlib,"B_EnumUSB"));
 | 
						|
	VERIFY(B_CreateUSBPort = (pfnB_CreateUSBPort) ::GetProcAddress(hlib,"B_CreateUSBPort"));
 | 
						|
//	VERIFY(B_Set_ErrorReport = (pfnB_Set_ErrorReport) ::GetProcAddress(hlib,"B_Set_ErrorReport"));
 | 
						|
	VERIFY(B_ResetPrinter = (pfnB_ResetPrinter) ::GetProcAddress(hlib,"B_ResetPrinter"));
 | 
						|
 | 
						|
  return true;
 | 
						|
}
 | 
						|
 | 
						|
void TStampa_etich_art::main_loop()
 | 
						|
{
 | 
						|
	hlib = NULL;
 | 
						|
	_ncopie = 0;
 | 
						|
	loadlibrary();
 | 
						|
 | 
						|
	TStampa_etich_art_mask mask;
 | 
						|
 | 
						|
  while (mask.run() == K_ENTER)
 | 
						|
  {
 | 
						|
		TEtich_book b;
 | 
						|
 | 
						|
		if (mask.get(F_TIPOST) == "A")
 | 
						|
		{
 | 
						|
			TStampa_etich_art_rep rep;
 | 
						|
 | 
						|
			rep.load("pf0001100a");
 | 
						|
			_ncopie = mask.get_int(F_QTA);
 | 
						|
			rep.set_filter(mask);
 | 
						|
			b.add(rep);
 | 
						|
		}
 | 
						|
		else
 | 
						|
		{
 | 
						|
			TStampa_etich_mov_rep rep;
 | 
						|
 | 
						|
			rep.load("pf0001100b");
 | 
						|
			rep.set_filter(mask);
 | 
						|
			b.add(rep);
 | 
						|
		}
 | 
						|
		b.print_labels(1, 2, _ncopie);
 | 
						|
	}
 | 
						|
}
 | 
						|
 | 
						|
int pf0001100(int argc, char* argv[])
 | 
						|
{
 | 
						|
  TStampa_etich_art a;
 | 
						|
  a.run(argc, argv, TR("Stampa etichette articoli"));
 | 
						|
  return 0;
 | 
						|
} |