#include "stdafx.h"
#include "aplStepManager.h"

CaplPreWMSManager::CaplPreWMSManager()
{
}

CaplPreWMSManager::~CaplPreWMSManager()
{
}

bool CaplPreWMSManager::Attach(CaplAPI *api)
{
	// стандартный attach
	if(api==0) {Detach();return false;}
	CaplStepManager::Attach(api);

	// атрибуты и сущности 
	CHECK_ZERO_ATTR(e_wms_tranzaction,              m_data->GetEntityBN(_T("apl_wms_tranzaction")));
	CHECK_ZERO_ATTR(a_wms_tranz_source,             m_data->GetAttrDefinition(e_wms_tranzaction, _T("source")));
	CHECK_ZERO_ATTR(a_wms_tranz_recipient,          m_data->GetAttrDefinition(e_wms_tranzaction, _T("recipient")));
	CHECK_ZERO_ATTR(a_wms_tranz_type,               m_data->GetAttrDefinition(e_wms_tranzaction, _T("type")));
	CHECK_ZERO_ATTR(a_wms_tranz_state,              m_data->GetAttrDefinition(e_wms_tranzaction, _T("state")));
	CHECK_ZERO_ATTR(a_wms_tranz_priority,           m_data->GetAttrDefinition(e_wms_tranzaction, _T("priority")));
	CHECK_ZERO_ATTR(a_wms_tranz_items,              m_data->GetAttrDefinition(e_wms_tranzaction, _T("items")));
	CHECK_ZERO_ATTR(a_wms_tranz_inner_moving_items, m_data->GetAttrDefinition(e_wms_tranzaction, _T("inner_moving_items")));
	CHECK_ZERO_ATTR(a_wms_tranz_last_update,        m_data->GetAttrDefinition(e_wms_tranzaction, _T("last_update")));
	CHECK_ZERO_ATTR(a_wms_tranz_parent,				m_data->GetAttrDefinition(e_wms_tranzaction, _T("parent")));
	CHECK_ZERO_ATTR(a_wms_tranz_log,				m_data->GetAttrDefinition(e_wms_tranzaction, _T("log")));
	CHECK_ZERO_ATTR(a_wms_tranz_last_edit,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("last_edit")));
	CHECK_ZERO_ATTR(a_wms_tranz_last_planed,		m_data->GetAttrDefinition(e_wms_tranzaction, _T("last_planed")));
	CHECK_ZERO_ATTR(a_wms_tranz_last_reserved,		m_data->GetAttrDefinition(e_wms_tranzaction, _T("last_reserved")));
	CHECK_ZERO_ATTR(a_wms_tranz_last_ready,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("last_ready")));
	CHECK_ZERO_ATTR(a_wms_tranz_last_accepted,		m_data->GetAttrDefinition(e_wms_tranzaction, _T("last_accepted")));
	CHECK_ZERO_ATTR(a_wms_tranz_last_distribute,	m_data->GetAttrDefinition(e_wms_tranzaction, _T("last_distribute")));
	CHECK_ZERO_ATTR(a_wms_tranz_last_complect,		m_data->GetAttrDefinition(e_wms_tranzaction, _T("last_complect")));
	CHECK_ZERO_ATTR(a_wms_tranz_last_closed,		m_data->GetAttrDefinition(e_wms_tranzaction, _T("last_closed")));
	CHECK_ZERO_ATTR(a_wms_tranz_id,					m_data->GetAttrDefinition(e_wms_tranzaction, _T("id")));
	CHECK_ZERO_ATTR(a_wms_tranz_descr,				m_data->GetAttrDefinition(e_wms_tranzaction, _T("description")));
	CHECK_ZERO_ATTR(a_wms_tranz_plan_date,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("plan_date")));
	CHECK_ZERO_ATTR(a_wms_tranz_project,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("project")));
	CHECK_ZERO_ATTR(a_wms_tranz_total_nds,				m_data->GetAttrDefinition(e_wms_tranzaction, _T("total_nds")));
	CHECK_ZERO_ATTR(a_wms_tranz_sum_with_nds,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("summa_with_nds")));
	CHECK_ZERO_ATTR(a_wms_tranz_sum_without_nds,		m_data->GetAttrDefinition(e_wms_tranzaction, _T("summa_without_nds")));
	CHECK_ZERO_ATTR(a_wms_tranz_user_nds,				m_data->GetAttrDefinition(e_wms_tranzaction, _T("user_nds")));
	CHECK_ZERO_ATTR(a_wms_tranz_user_sum_with_nds,		m_data->GetAttrDefinition(e_wms_tranzaction, _T("user_summa_with_nds")));
	CHECK_ZERO_ATTR(a_wms_tranz_user_sum_without_nds,	m_data->GetAttrDefinition(e_wms_tranzaction, _T("user_summa_without_nds")));
	CHECK_ZERO_ATTR(a_wms_tranz_demand_ref,				m_data->GetAttrDefinition(e_wms_tranzaction, _T("demand_references")));
	CHECK_ZERO_ATTR(a_wms_tranz_transporter,		m_data->GetAttrDefinition(e_wms_tranzaction, _T("transporter")));
	CHECK_ZERO_ATTR(a_wms_tranz_region,				m_data->GetAttrDefinition(e_wms_tranzaction, _T("region")));
	CHECK_ZERO_ATTR(a_wms_tranz_doc_number,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("document_number")));
	CHECK_ZERO_ATTR(a_wms_tranz_doc_target,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("document_target")));
	CHECK_ZERO_ATTR(a_wms_tranz_doc_date,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("document_date")));
	CHECK_ZERO_ATTR(a_wms_tranz_doc2_number,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("document2_number")));
	CHECK_ZERO_ATTR(a_wms_tranz_doc2_date,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("document2_date")));
	CHECK_ZERO_ATTR(a_wms_tranz_account,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("account")));


	CHECK_ZERO_ATTR(a_wms_tranz_doc3_number,		m_data->GetAttrDefinition(e_wms_tranzaction, _T("document3_number")));
	CHECK_ZERO_ATTR(a_wms_tranz_doc3_date,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("document3_date")));
	CHECK_ZERO_ATTR(a_wms_tranz_doc3_type,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("document3_type")));
	CHECK_ZERO_ATTR(a_wms_tranz_ticket_number,		m_data->GetAttrDefinition(e_wms_tranzaction, _T("ticket_number")));
	CHECK_ZERO_ATTR(a_wms_tranz_ticket_date,		m_data->GetAttrDefinition(e_wms_tranzaction, _T("ticket_date")));
	CHECK_ZERO_ATTR(a_wms_tranz_expeditor,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("expeditor")));

	CHECK_ZERO_ATTR(a_wms_tranz_purchase_schedule,			m_data->GetAttrDefinition(e_wms_tranzaction, _T("purchase_schedule")));
	CHECK_ZERO_ATTR(a_wms_tranz_purchase_stage,				m_data->GetAttrDefinition(e_wms_tranzaction, _T("purchase_stage")));
	CHECK_ZERO_ATTR(a_wms_tranz_positions_allowing_state,	m_data->GetAttrDefinition(e_wms_tranzaction, _T("positions_allowing_state")));
	CHECK_ZERO_ATTR(a_wms_tranz_note,						m_data->GetAttrDefinition(e_wms_tranzaction, _T("note")));

	CHECK_ZERO_ATTR(e_wms_tranzaction_item,			m_data->GetEntityBN(_T("apl_wms_tranzaction_item")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_tranz,			m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("tranzaction")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_parent,		m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("parent_tranzaction"))); 
	CHECK_ZERO_ATTR(a_wms_tranz_item_pdf,			m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("pdf")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_storage_recipient,		m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("storage_item_recipient")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_storage_source,		m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("storage_item_source")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_id,			m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("id")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_count_plan,    m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("count_plan")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_count_fact,    m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("count_fact")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_prd_inst,      m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("prd_inst")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_lot,			m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("lot")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_cell,			m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("cell")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_confirm,		m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("confirm")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_tot_quantity,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("total_quantity")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_one_quantity,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("one_place_quantity")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_massa,			m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("massa")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_cost,			m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("cost")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_nds,			m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("nds")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_sum_nds,		m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("sum_nds")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_sum_with_nds,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("sum_with_nds")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_sum_without_nds,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("sum_without_nds")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_package,		m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("package")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_acceptance,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("acceptance")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_release_date,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("release_date")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_is_import,		m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("is_import")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_unit,			m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("unit")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_provider_id,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("provider_id")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_remain,		m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("remain")));	
	CHECK_ZERO_ATTR(a_wms_tranz_item_dispatch,		m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("dispatch")));	
	CHECK_ZERO_ATTR(a_wms_tranz_item_card_number,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("card_number")));	

	CHECK_ZERO_ATTR(a_wms_tranz_item_supplier_cost,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("supplier_cost")));	
	CHECK_ZERO_ATTR(a_wms_tranz_item_supplier_unit,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("supplier_unit")));	
	CHECK_ZERO_ATTR(a_wms_tranz_item_supplier_count,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("supplier_count")));

	CHECK_ZERO_ATTR(a_wms_tranz_item_delivery_doc_number,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("delivery_doc_number")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_delivery_doc_date,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("delivery_doc_date")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_self_cost,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("self_cost")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_prd_instances,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("prd_instances")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_responsible,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("responsible")));
	CHECK_ZERO_ATTR(a_wms_tranz_item_description,	m_data->GetAttrDefinition(e_wms_tranzaction_item, _T("description")));
		
	CHECK_ZERO_ATTR(e_wms_storage_item,				m_data->GetEntityBN(_T("apl_wms_storage_item")));
	CHECK_ZERO_ATTR(a_wms_storage_item_available,	m_data->GetAttrDefinition(e_wms_storage_item, _T("available")));
	CHECK_ZERO_ATTR(a_wms_storage_item_ordered,		m_data->GetAttrDefinition(e_wms_storage_item, _T("ordered")));
	CHECK_ZERO_ATTR(a_wms_storage_item_reserved,	m_data->GetAttrDefinition(e_wms_storage_item, _T("reserved")));
	CHECK_ZERO_ATTR(a_wms_storage_item_pdf,			m_data->GetAttrDefinition(e_wms_storage_item, _T("pdf")));
	CHECK_ZERO_ATTR(a_wms_storage_item_last_update,	m_data->GetAttrDefinition(e_wms_storage_item, _T("last_update")));
	CHECK_ZERO_ATTR(a_wms_storage_item_org,			m_data->GetAttrDefinition(e_wms_storage_item, _T("organization")));
	CHECK_ZERO_ATTR(a_wms_storage_item_unit,			m_data->GetAttrDefinition(e_wms_storage_item, _T("unit")));
	CHECK_ZERO_ATTR(a_wms_storage_item_acc_type,		m_data->GetAttrDefinition(e_wms_storage_item, _T("accounting_type")));
	CHECK_ZERO_ATTR(a_wms_storage_item_transferred,		m_data->GetAttrDefinition(e_wms_storage_item, _T("transferred")));
	CHECK_ZERO_ATTR(a_wms_storage_item_ready,			m_data->GetAttrDefinition(e_wms_storage_item, _T("ready")));
	CHECK_ZERO_ATTR(a_wms_storage_item_order_point,		m_data->GetAttrDefinition(e_wms_storage_item, _T("order_point")));
	CHECK_ZERO_ATTR(a_wms_storage_item_last_inv_count,	m_data->GetAttrDefinition(e_wms_storage_item, _T("last_inv_count")));
	CHECK_ZERO_ATTR(a_wms_storage_item_last_inv,		m_data->GetAttrDefinition(e_wms_storage_item, _T("last_invent")));
	CHECK_ZERO_ATTR(a_wms_storage_item_last_inv_item,	m_data->GetAttrDefinition(e_wms_storage_item, _T("last_invent_item")));
	CHECK_ZERO_ATTR(a_wms_storage_item_opt_lot,			m_data->GetAttrDefinition(e_wms_storage_item, _T("optimal_lot")));
	CHECK_ZERO_ATTR(a_wms_storage_item_base_provider,	m_data->GetAttrDefinition(e_wms_storage_item, _T("base_provider")));
	CHECK_ZERO_ATTR(a_wms_storage_item_cost,			m_data->GetAttrDefinition(e_wms_storage_item, _T("cost")));
	CHECK_ZERO_ATTR(a_wms_storage_item_min_order_volume,m_data->GetAttrDefinition(e_wms_storage_item, _T("min_order_volume")));

	CHECK_ZERO_ATTR(e_wms_cell,					m_data->GetEntityBN(_T("apl_wms_cell")));
	CHECK_ZERO_ATTR(a_wms_cell_organization,	m_data->GetAttrDefinition(e_wms_cell, _T("organization")));
	CHECK_ZERO_ATTR(a_wms_cell_id,				m_data->GetAttrDefinition(e_wms_cell, _T("id")));
	CHECK_ZERO_ATTR(a_wms_cell_zone,			m_data->GetAttrDefinition(e_wms_cell, _T("zone")));
	CHECK_ZERO_ATTR(a_wms_cell_parent,			m_data->GetAttrDefinition(e_wms_cell, _T("parent")));
	CHECK_ZERO_ATTR(a_wms_cell_type,				m_data->GetAttrDefinition(e_wms_cell, _T("type")));
	CHECK_ZERO_ATTR(a_wms_cell_weight,				m_data->GetAttrDefinition(e_wms_cell, _T("weight")));
	CHECK_ZERO_ATTR(a_wms_cell_lenght_outter,		m_data->GetAttrDefinition(e_wms_cell, _T("lenght_outter")));
	CHECK_ZERO_ATTR(a_wms_cell_width_outter,		m_data->GetAttrDefinition(e_wms_cell, _T("width_outter")));
	CHECK_ZERO_ATTR(a_wms_cell_height_outter,		m_data->GetAttrDefinition(e_wms_cell, _T("height_outter")));
	CHECK_ZERO_ATTR(a_wms_cell_lenght_inner,		m_data->GetAttrDefinition(e_wms_cell, _T("lenght_inner")));
	CHECK_ZERO_ATTR(a_wms_cell_width_inner,			m_data->GetAttrDefinition(e_wms_cell, _T("width_inner")));
	CHECK_ZERO_ATTR(a_wms_cell_height_inner,		m_data->GetAttrDefinition(e_wms_cell, _T("height_inner")));
	CHECK_ZERO_ATTR(a_wms_cell_seats_number,		m_data->GetAttrDefinition(e_wms_cell, _T("seats_number")));
	CHECK_ZERO_ATTR(a_wms_cell_authorized_products,	m_data->GetAttrDefinition(e_wms_cell, _T("authorized_products")));
	CHECK_ZERO_ATTR(a_wms_cell_zoom_scheem,			m_data->GetAttrDefinition(e_wms_cell, _T("zoom_scheem")));	

	CHECK_ZERO_ATTR(e_wms_authorized_product,        m_data->GetEntityBN(_T("authorized_product")));
	CHECK_ZERO_ATTR(a_wms_ap_pdf,                    m_data->GetAttrDefinition(e_wms_authorized_product, _T("pdf")));
	CHECK_ZERO_ATTR(a_wms_ap_priority,               m_data->GetAttrDefinition(e_wms_authorized_product, _T("priority")));

	CHECK_ZERO_ATTR(e_wms_dispatch_info,			m_data->GetEntityBN(_T("apl_wms_dispatch_item")));
	CHECK_ZERO_ATTR(a_wms_dispatch_waybill_item,	m_data->GetAttrDefinition(e_wms_dispatch_info, _T("waybill_item")));
	CHECK_ZERO_ATTR(a_wms_dispatch_count,			m_data->GetAttrDefinition(e_wms_dispatch_info, _T("count")));
	
	CHECK_ZERO_ATTR(e_wms_provider_item,			m_data->GetEntityBN(_T("apl_wms_provider_item")));
	CHECK_ZERO_ATTR(a_wms_provider_item_pdf,		m_data->GetAttrDefinition(e_wms_provider_item, _T("pdf")));
	CHECK_ZERO_ATTR(a_wms_provider_item_org,		m_data->GetAttrDefinition(e_wms_provider_item, _T("organization")));
	CHECK_ZERO_ATTR(a_wms_provider_item_price,		m_data->GetAttrDefinition(e_wms_provider_item, _T("price")));
	CHECK_ZERO_ATTR(a_wms_provider_item_unit,		m_data->GetAttrDefinition(e_wms_provider_item, _T("unit")));
	CHECK_ZERO_ATTR(a_wms_provider_item_duration,	m_data->GetAttrDefinition(e_wms_provider_item, _T("duration")));
	CHECK_ZERO_ATTR(a_wms_provider_item_id,			m_data->GetAttrDefinition(e_wms_provider_item, _T("id")));
	CHECK_ZERO_ATTR(a_wms_provider_item_priority,	m_data->GetAttrDefinition(e_wms_provider_item, _T("priority")));
	CHECK_ZERO_ATTR(a_wms_provider_item_price_date,	m_data->GetAttrDefinition(e_wms_provider_item, _T("date")));
	CHECK_ZERO_ATTR(a_wms_provider_item_nds,	m_data->GetAttrDefinition(e_wms_provider_item, _T("nds")));

	CHECK_ZERO_ATTR(e_wms_inner_moving_item,				m_data->GetEntityBN(_T("apl_wms_inner_moving_item")));
	CHECK_ZERO_ATTR(a_wms_inner_moving_item_item,			m_data->GetAttrDefinition(e_wms_inner_moving_item, _T("item")));
	CHECK_ZERO_ATTR(a_wms_inner_moving_item_new_cell,		m_data->GetAttrDefinition(e_wms_inner_moving_item, _T("new_cell")));
	CHECK_ZERO_ATTR(a_wms_inner_moving_item_old_cell,		m_data->GetAttrDefinition(e_wms_inner_moving_item, _T("old_cell")));
	CHECK_ZERO_ATTR(a_wms_inner_moving_item_id,				m_data->GetAttrDefinition(e_wms_inner_moving_item, _T("id")));	

	CHECK_ZERO_ATTR(e_wms_demand_ref,                       m_data->GetEntityBN(_T("apl_wms_demand_reference")));
	CHECK_ZERO_ATTR(a_wms_demand_ref_count,                 m_data->GetAttrDefinition(e_wms_demand_ref, _T("count")));
	CHECK_ZERO_ATTR(a_wms_demand_ref_item,					m_data->GetAttrDefinition(e_wms_demand_ref, _T("demand_item")));
	CHECK_ZERO_ATTR(a_wms_demand_ref_pdf,                   m_data->GetAttrDefinition(e_wms_demand_ref, _T("pdf")));
	CHECK_ZERO_ATTR(a_wms_demand_ref_project,                   m_data->GetAttrDefinition(e_wms_demand_ref, _T("project")));

	CHECK_ZERO_ATTR(e_wms_zoom_scheem,                       m_data->GetEntityBN(_T("apl_zoom_scheem")));
	CHECK_ZERO_ATTR(a_wms_zoom_scheem_objects,				 m_data->GetAttrDefinition(e_wms_zoom_scheem, _T("objects")));
	CHECK_ZERO_ATTR(a_wms_zoom_scheem_cx,				 m_data->GetAttrDefinition(e_wms_zoom_scheem, _T("cx")));
	CHECK_ZERO_ATTR(a_wms_zoom_scheem_cy,				 m_data->GetAttrDefinition(e_wms_zoom_scheem, _T("cy")));

	CHECK_ZERO_ATTR(e_wms_zoom_scheem_object,                m_data->GetEntityBN(_T("apl_zoom_scheem_object")));
	CHECK_ZERO_ATTR(a_wms_zoom_scheem_object_cell,           m_data->GetAttrDefinition(e_wms_zoom_scheem_object, _T("cell")));
	
	CHECK_ZERO_ATTR(e_wms_zoom_scheem_rect_object,      m_data->GetEntityBN(_T("apl_zoom_scheem_rectangle_object")));
	CHECK_ZERO_ATTR(a_wms_rect_object_x,                m_data->GetAttrDefinition(e_wms_zoom_scheem_rect_object, _T("x")));
	CHECK_ZERO_ATTR(a_wms_rect_object_y,				m_data->GetAttrDefinition(e_wms_zoom_scheem_rect_object, _T("y")));
	CHECK_ZERO_ATTR(a_wms_rect_object_cx,               m_data->GetAttrDefinition(e_wms_zoom_scheem_rect_object, _T("cx")));
	CHECK_ZERO_ATTR(a_wms_rect_object_cy,               m_data->GetAttrDefinition(e_wms_zoom_scheem_rect_object, _T("cy")));

	CHECK_ZERO_ATTR(e_wms_zoom_scheem_triangle_object,      m_data->GetEntityBN(_T("apl_zoom_scheem_triangle_object")));
	CHECK_ZERO_ATTR(a_wms_triangle_object_direction,        m_data->GetAttrDefinition(e_wms_zoom_scheem_triangle_object, _T("direction")));
	CHECK_ZERO_ATTR(a_wms_triangle_object_entrance,			m_data->GetAttrDefinition(e_wms_zoom_scheem_triangle_object, _T("entrance")));

	CHECK_ZERO_ATTR(e_wms_zoom_scheem_way_object,        m_data->GetEntityBN(_T("apl_zoom_scheem_way")));
	CHECK_ZERO_ATTR(a_wms_way_object_points,			 m_data->GetAttrDefinition(e_wms_zoom_scheem_way_object, _T("points")));

	CHECK_ZERO_ATTR(e_wms_change_state_log,						m_data->GetEntityBN(_T("apl_wms_change_state_log")));
	CHECK_ZERO_ATTR(a_wms_change_state_log_tranzaction,			m_data->GetAttrDefinition(e_wms_change_state_log, _T("tranzaction")));
	CHECK_ZERO_ATTR(a_wms_change_state_log_person,				m_data->GetAttrDefinition(e_wms_change_state_log, _T("person")));
	CHECK_ZERO_ATTR(a_wms_change_state_log_person_organization,	m_data->GetAttrDefinition(e_wms_change_state_log, _T("person_organization")));
	CHECK_ZERO_ATTR(a_wms_change_state_log_date,				m_data->GetAttrDefinition(e_wms_change_state_log, _T("date")));
	CHECK_ZERO_ATTR(a_wms_change_state_log_from_state,			m_data->GetAttrDefinition(e_wms_change_state_log, _T("from_state")));
	CHECK_ZERO_ATTR(a_wms_change_state_log_to_state,			m_data->GetAttrDefinition(e_wms_change_state_log, _T("to_state")));

	return true;
}

void CaplPreWMSManager::Detach()
{
	e_wms_tranzaction = 0;
	a_wms_tranz_source = 0;
	a_wms_tranz_recipient = 0;
	a_wms_tranz_type = 0;
	a_wms_tranz_state = 0;
	a_wms_tranz_priority = 0;
	a_wms_tranz_items = 0;
	a_wms_tranz_last_update = 0;
	a_wms_tranz_parent = 0;
	a_wms_tranz_log = 0;
	a_wms_tranz_last_edit = 0;
	a_wms_tranz_last_planed = 0;
	a_wms_tranz_last_reserved = 0;
	a_wms_tranz_last_ready = 0;
	a_wms_tranz_last_distribute = 0;
	a_wms_tranz_last_accepted = 0;
	a_wms_tranz_last_closed = 0;
	a_wms_tranz_last_complect = 0;
	a_wms_tranz_id = 0;
	a_wms_tranz_descr = 0;
	a_wms_tranz_project = 0;
	a_wms_tranz_plan_date = 0;
	a_wms_tranz_total_nds = 0;
	a_wms_tranz_user_nds = 0;
	a_wms_tranz_sum_with_nds = 0;
	a_wms_tranz_user_sum_with_nds = 0;
	a_wms_tranz_sum_without_nds = 0;
	a_wms_tranz_user_sum_without_nds = 0;
	a_wms_tranz_inner_moving_items = 0;
	a_wms_tranz_demand_ref = 0;
	a_wms_tranz_transporter=0;
	a_wms_tranz_region=0;
	a_wms_tranz_doc_number=0;
	a_wms_tranz_doc_target=0;
	a_wms_tranz_doc2_number=0;
	a_wms_tranz_doc2_date=0;

	a_wms_tranz_doc3_number=0;
	a_wms_tranz_doc3_date=0;
	a_wms_tranz_doc3_type;
	a_wms_tranz_ticket_number=0;
	a_wms_tranz_ticket_date=0;
	a_wms_tranz_expeditor=0;
	a_wms_tranz_account=0;


	e_wms_tranzaction_item = 0;
	a_wms_tranz_item_tranz = 0;
	a_wms_tranz_item_parent = 0;
	a_wms_tranz_item_pdf = 0;
	a_wms_tranz_item_storage_source = 0;
	a_wms_tranz_item_storage_recipient = 0;
	a_wms_tranz_item_id = 0;
	a_wms_tranz_item_count_plan = 0;
	a_wms_tranz_item_count_fact = 0;
	a_wms_tranz_item_prd_inst = 0;
	a_wms_tranz_item_lot = 0;
	a_wms_tranz_item_cell = 0;
	a_wms_tranz_item_cost = 0;
	a_wms_tranz_item_nds = 0;
	a_wms_tranz_item_sum_nds=0;
	a_wms_tranz_item_sum_with_nds=0;
	a_wms_tranz_item_sum_without_nds=0;
	a_wms_tranz_item_confirm = 0;
	a_wms_tranz_item_tot_quantity = 0;
	a_wms_tranz_item_one_quantity = 0;
	a_wms_tranz_item_massa = 0;
	a_wms_tranz_item_package = 0;
	a_wms_tranz_item_acceptance=0;
	a_wms_tranz_item_release_date=0;
	a_wms_tranz_item_is_import=0;

	a_wms_tranz_item_unit = 0;
	a_wms_tranz_item_provider_id = 0;
	a_wms_tranz_item_remain = 0;
	a_wms_tranz_item_dispatch = 0;
	a_wms_tranz_item_card_number = 0;
	
	e_wms_storage_item = 0;
	a_wms_storage_item_pdf = 0;
	a_wms_storage_item_available = 0;
	a_wms_storage_item_ordered = 0;
	a_wms_storage_item_reserved = 0;
	a_wms_storage_item_last_update = 0;
	a_wms_storage_item_org = 0;
	a_wms_storage_item_unit = 0;
	a_wms_storage_item_acc_type = 0;
	a_wms_storage_item_transferred = 0;
	a_wms_storage_item_ready = 0;
	a_wms_storage_item_order_point = 0;
	a_wms_storage_item_last_inv_count = 0;
	a_wms_storage_item_last_inv = 0;
	a_wms_storage_item_last_inv_item = 0;
	a_wms_storage_item_opt_lot = 0;
	a_wms_storage_item_base_provider = 0;
	a_wms_storage_item_min_order_volume = 0;
	a_wms_storage_item_cost = 0;

	e_wms_cell = 0;
	a_wms_cell_organization = 0;
	a_wms_cell_id = 0;
	a_wms_cell_zone = 0;
	a_wms_cell_parent = 0;
	a_wms_cell_type = 0;
	a_wms_cell_weight = 0;
	a_wms_cell_lenght_outter = 0;
	a_wms_cell_width_outter = 0;
	a_wms_cell_height_outter = 0;
	a_wms_cell_lenght_inner = 0;
	a_wms_cell_width_inner = 0;
	a_wms_cell_height_inner = 0;
	a_wms_cell_seats_number = 0;
	a_wms_cell_authorized_products = 0;
	a_wms_cell_zoom_scheem = 0;

	e_wms_dispatch_info = 0;
	a_wms_dispatch_count = 0;
	a_wms_dispatch_waybill_item = 0;

	e_wms_provider_item = 0;
	a_wms_provider_item_pdf = 0;
	a_wms_provider_item_org = 0;
	a_wms_provider_item_price = 0;
	a_wms_provider_item_unit = 0;
	a_wms_provider_item_duration = 0;
	a_wms_provider_item_id = 0;
	a_wms_provider_item_priority = 0;
	a_wms_provider_item_price_date = 0;
	a_wms_provider_item_nds = 0;

	e_wms_inner_moving_item = 0;
	a_wms_inner_moving_item_item = 0;
	a_wms_inner_moving_item_new_cell = 0;
	a_wms_inner_moving_item_old_cell = 0;	
	a_wms_inner_moving_item_id = 0;

	e_wms_authorized_product = 0;
	a_wms_ap_pdf = 0;
	a_wms_ap_priority = 0;

	e_wms_demand_ref = 0;
	a_wms_demand_ref_count = 0;
	a_wms_demand_ref_item = 0;
	a_wms_demand_ref_pdf = 0;
	a_wms_demand_ref_project = 0;

	e_wms_zoom_scheem = 0;
	a_wms_zoom_scheem_objects = 0;
	a_wms_zoom_scheem_cy = 0;
	a_wms_zoom_scheem_cx = 0;

	e_wms_zoom_scheem_object = 0;
	a_wms_zoom_scheem_object_cell = 0;

	e_wms_zoom_scheem_rect_object = 0;
	a_wms_rect_object_x = 0;
	a_wms_rect_object_y = 0;
	a_wms_rect_object_cx = 0;
	a_wms_rect_object_cy = 0;

	e_wms_zoom_scheem_triangle_object = 0;
	a_wms_triangle_object_direction = 0;
	a_wms_triangle_object_entrance = 0;

	e_wms_zoom_scheem_way_object = 0;
	a_wms_way_object_points = 0;


	e_wms_change_state_log = 0;
	a_wms_change_state_log_tranzaction = 0;
	a_wms_change_state_log_person = 0;
	a_wms_change_state_log_person_organization=0;
	a_wms_change_state_log_date = 0;
	a_wms_change_state_log_from_state = 0;
	a_wms_change_state_log_to_state = 0;

}