#if !defined(AFX_APPROVALDLG_H__EDD9E523_B20D_11D3_B9A6_00C026EE04F6__INCLUDED_)
#define AFX_APPROVALDLG_H__EDD9E523_B20D_11D3_B9A6_00C026EE04F6__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// ApprovalDlg.h : header file
//
//#include "MenuComboBox.h"

//#include "aplCryptProvider.h"
#include "resource.h"
#include <apl_gui.h>

#include "aplCharactView.h"
#include "aplApprovalView.h"
#include "aplDocsView.h"
#include "aplAccessView.h"
#include "ApprNoteDlg.h"
#include "AssocFiles.h"
#include "afxwin.h"


/////////////////////////////////////////////////////////////////////////////
// CApprovalDlg dialog
class CaplNetStepData;
class CaplInstance;

class CApprovalDlg : public CaplResizableDialog
{
// Construction
public:
	aplExtent del_files;
	long m_lBufferLen;
	//TCHAR *m_Buffer;
//	CListCtrl	*m_pFileList;
	bool m_bCreateNewNote;

	CApprovalDlg(CWnd* pParent = NULL);   // standard constructor
	//bool LoadFile();

	static void PrpareSignOwnerToShow(CString &owner);

// Dialog Data
	//{{AFX_DATA(CApprovalDlg)
	enum { IDD = IDD_APPROVAL };
	CButton	m_show_cert_button;
	CaplRichEditCtrl	m_rtfANote;
	CaplTabCtrl	m_tcFilesOrNote;
	CStatic	m_appr_ico;
	CEdit	m_cNote;
	CaplButton	m_cAddFile;
	CaplButton	m_cViewFile;
	CaplButton	m_cSaveFile;
	CListCtrl	m_cFileList;
	CaplButton	m_cDelFile;
	CaplButton	m_cancel_btn;
	CEdit	m_signature;
	CButton	m_check_sign_btn;
	CButton	m_sign_btn;
	CComboBox	m_system;
	CStatic	m_st_appr_name;
	CStatic	m_person;
	CaplButton	m_ok_btn;
	CComboBox	m_po_role;
	CDateTimeCtrl	m_date_ctrl;
	CDateTimeCtrl	m_time_ctrl;
	CComboBox	m_status;
	CStatic m_st_descr_ctrl;
	CEdit	m_level;
	CString	m_sNotes;
	//}}AFX_DATA
//	CMenuComboBox	m_person;

	CaplAPI *m_api;
	CString m_mode;
	bool m_bMultiItemsMode ;
	aplExtent* m_MultiItemsExtent ;
	
	CaplInstance *m_appr;
	aplExtent m_statusesToHide;

	CaplInstance *m_item;
	CString m_dt;
	CaplInstance *m_person_inst;
	CaplInstance* m_status_inst;

	CaplInstance *m_ciCert;
	CaplInstance **m_pNote;

	CString m_sRole;
	CString m_sLevel;
	CString m_sSignOwner;
	CString m_sSignCert;
	CString m_sSign;
	CString m_sHash;
	CString m_sMethid;
	CString m_sOpenKey;
	CString m_sInventory;
	CString m_sSnapShot;

	bool m_bNoCheckRepeatStatus; //Не проверять уникальность статусов
	bool m_bCheckStatusForRole; // проверять уникальность статусов для роли и сотрудника
	CString m_sFormat,m_sNumList,m_sNumListA4;

//	CString			m_csAccessString;  // Был введен, но никогда не использовался
	CStringArray	m_newFiles;
	CStringArray	m_saCreatedFiles;

	/*Для создания статуса из WF*/
	CaplInstance* m_DefRole;
	CString m_sDefStatus;
	aplExtent m_status_ext;
	
	CApprNoteDlg	m_noteDlg;


	BOOL			SetAnchors(void);
	void			CreateTabPage(UINT nID, const LPTSTR sTitle, CDialog* pDlg);
	void			ShowFileControls(int show);
	void			DeleteCeratedFiels();
	void			GetCertificateInBase();
	void			SelectPrevStatus();

	bool bCheckGrpzNormokontrolNotesFormat();

protected:
	CBitmap m_name_bmp,m_ico_bmp;

	// предотвращаем потерю модальности после диалога с бочками из aplSocketTransport
	CaplParentWndProcesser m_pwp;

// Overrides
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support

// Implementation
protected:
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	virtual void OnCancel();
	DECLARE_MESSAGE_MAP()
public:
	CComboBox m_format_ctrl;
	CEdit m_list_count_ctrl;
	CEdit m_num_list_a4_ctrl;
	afx_msg void OnSign();
	afx_msg void OnCheckSign();
	afx_msg void OnSelchangeCryptSystem();
	afx_msg void OnStApprName();
	afx_msg void OnDestroy();
	afx_msg void OnCdAddFile();
	afx_msg void OnCdDeleteFile();
	afx_msg void OnCdViewFile();
	afx_msg void OnSelchangePoRole();
	afx_msg void OnDblclkCdFileList(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnCdSaveFile();
	afx_msg void OnSelchangeTab2FilesOrNote(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnSelchangeRichedit1Anote(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnSelchangingTab2FilesOrNote(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnShowCert();
	afx_msg void OnCbnEditchangeFormat();
	afx_msg void OnCbnEditupdateFormat();
	afx_msg void OnEnChangeNumList();
	afx_msg void OnCbnSelchangeFormat();
};

//{{AFX_INSERT_LOCATION}}
// Microsoft Visual C++ will insert additional declarations immediately before the previous line.

#endif // !defined(AFX_APPROVALDLG_H__EDD9E523_B20D_11D3_B9A6_00C026EE04F6__INCLUDED_)
