#if !defined(AFX_PRDINSTDLG_H__F43AF29D_EB14_4927_A4A9_03E4ADBFE979__INCLUDED_)
#define AFX_PRDINSTDLG_H__F43AF29D_EB14_4927_A4A9_03E4ADBFE979__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
// PrdInstDlg.h : header file
//
#include "resource.h"
#include <apl_gui.h>

#include "aplCharactView.h"
#include "aplApprovalView.h"
#include "aplDocsView.h"
#include "aplAccessView.h"
#include "afxdtctl.h"
#include "afxwin.h"

/////////////////////////////////////////////////////////////////////////////
// CPrdInstDlg dialog

class CPrdInstDlg : public CaplResizableDialog
{
// Construction
public:
	CPrdInstDlg(CWnd* pParent = NULL);   // standard constructor

// Dialog Data
	//{{AFX_DATA(CPrdInstDlg)
	enum { IDD = IDD_PRD_INST };
	CComboBox	m_states_ctrl;
	CaplButton	m_rel_prop_btn;
	CButton	m_sel_context_btn;
	CEdit	m_rel_context;
	CStatic	m_st_5;
	CEdit	m_rel_descr_ctrl;
	CEdit	m_rel_name_ctrl;
	CEdit	m_rel_id_ctrl;
	CStatic	m_st_4;
	CStatic	m_st_3;
	CStatic	m_st_2;
	CStatic	m_st_1;
	CButton	m_st_0;
	CDateTimeCtrl	m_time_rem_ctrl;
	CDateTimeCtrl	m_time_inst_ctrl;
	CButton	m_date_has_removed_ctrl;
	CDateTimeCtrl	m_date_rem_ctrl;
	CDateTimeCtrl	m_date_inst_ctrl;
	CComboBox	m_lot_ctrl;
	CEdit	m_descr_ctrl;
	CEdit	m_sn_ctrl;
	CEdit	m_id_ctrl;
	CaplButton	m_pdf_del_btn;
	CaplButton	m_pdf_browse_btn;
	CaplButton	m_cancel_btn;
	CaplButton	m_ok_btn;
	CEdit	m_prd_id_ctrl;
	CString	m_id;
	CString	m_sn;
	CString	m_prd_id;
	CString	m_descr;
	CString	m_rel_descr;
	CString	m_rel_id;
	CString	m_rel_name;
	CaplTabCtrl	m_Tab;
	CaplButton	m_bPropsProps;
	CaplButton	m_bPropsDel;
	CaplButton	m_bPropsAdd;
	//}}AFX_DATA

	CaplAPI *m_api;
	
	CaplInstance *m_pdf, *m_inst, *m_base_inst, *m_lot,*m_inst_rel, *m_par_inst, *m_customer;
	bool bTestPdfInLot;

	CString			m_csAccessString;

	BOOL			SetAnchors(void);
	void			SetSize(int cy);
	BOOL			InitViews(void);
	void			ChangeViewBtnsState(BOOL bDis,BOOL bHide);
	void			GetAccessString(void);

// Overrides
	// ClassWizard generated virtual function overrides
	//{{AFX_VIRTUAL(CPrdInstDlg)
	protected:
	virtual void DoDataExchange(CDataExchange* pDX);    // DDX/DDV support
	//}}AFX_VIRTUAL

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

	bool m_context_changed;
	aplExtent m_rel_contexts;

	// Generated message map functions
	//{{AFX_MSG(CPrdInstDlg)
	afx_msg void OnPdfBrowse();
	afx_msg void OnPdfDel();
	virtual BOOL OnInitDialog();
	virtual void OnOK();
	afx_msg void OnHasRemoved();
	afx_msg void OnSelContext();
	afx_msg void OnRelProperty();
	afx_msg void OnSelchangeTab1(NMHDR* pNMHDR, LRESULT* pResult);
	afx_msg void OnBPropsAdd();
	afx_msg void OnBPropsDel();
	afx_msg void OnBPropsProps();
	//}}AFX_MSG
	DECLARE_MESSAGE_MAP()
	
	void UpdateLotInfo();
public:
	CDateTimeCtrl m_date_manuf_ctrl;
	CDateTimeCtrl m_date_shipment_ctrl;
	CEdit m_customer_ctrl;
	CaplButton m_customer_sel_btn;
	CaplButton m_customer_del_btn;
	afx_msg void OnBnClickedDelCustomer();
	afx_msg void OnBnClickedSelCustomer();
	CStatic m_st_date_shipment_ctrl;
};

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

#endif // !defined(AFX_PRDINSTDLG_H__F43AF29D_EB14_4927_A4A9_03E4ADBFE979__INCLUDED_)
