
if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'StageId' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 1,1,0,N'2014/1/1 0:00:00',0,N'StageId',N'服务阶段',N'select',0,1,0,1,1,N'0',N'Customer',1,N'基本信息',N'<select style="width: 120px;" ms-each-s=''stage'' ms-duplex-text=''customerEntity.StageId''><option ms-value="s.Id" ms-text=''s.Data''></option></select>',N'{{customerEntity.StageDisplay}}')
end


if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'SourceId' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 2,1,0,N'2014/1/1 0:00:00',0,N'SourceId',N'客户来源',N'select',0,2,0,1,1,N'0',N'Customer',1,N'基本信息',N'<select style="width: 120px;" ms-each-ss=''source'' ms-duplex-text=''customerEntity.SourceId''><option ms-value="ss.Id" ms-text=''ss.Data''></option></select>',N'{{customerEntity.SourceDisplay}}')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'Industry' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 30,1,0,N'2014/1/1 0:00:00',0,N'Industry',N'主营行业',N'input',0,2,0,1,1,N'0',N'Customer',1,N'基本信息',N'<select style="width: 120px;" ms-each-indu=''industry'' ms-duplex-text=''customerEntity.IndustryId''><option ms-value="indu.Id" ms-text=''indu.Data''></option></select>',N'{{customerEntity.IndustryDisplay}}')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'Profession' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 40,1,0,N'2014/1/1 0:00:00',0,N'Profession',N'主营业务',N'input',0,2,0,1,1,N'0',N'Customer',1,N'基本信息',N'<input ms-duplex=''customerEntity.Profession'' type="text" />',N'{{customerEntity.Profession}}')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'Area' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 3,1,0,N'2014/1/1 0:00:00',0,N'Area',N'所在地区',N'input',0,1,1,1,1,N'Customer',1,N'联系方式',N'<select ms-each-c=''country'' ms-duplex-text=''customerEntity.CompanyCountryId''><option ms-value="c.Id" ms-text=''c.Data''></option></select><select ms-each-p=''province'' ms-duplex-text=''customerEntity.CompanyProvinceId''><option ms-value="p.Id" ms-text=''p.Data''></option></select><select ms-each-cc=''city'' ms-duplex-text=''customerEntity.CompanyCityId''><option ms-value="cc.Id" ms-text=''cc.Data''></option></select><select ms-each-a=''area'' ms-duplex-text=''customerEntity.CompanyAreaId''><option ms-value="a.Id" ms-text=''a.Data''></option></select>',N'{{customerEntity.CompanyCountryDisplay}}-{{customerEntity.CompanyProvinceDisplay}}-{{customerEntity.CompanyCityDisplay}}-{{customerEntity.CompanyAreaDisplay}}')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'CompanyAddress' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 4,1,0,N'2014/1/1 0:00:00',0,N'CompanyAddress',N'详细地址',N'input',0,2,0,1,1,N'Customer',1,N'联系方式',N'<input ms-duplex=''customerEntity.CompanyAddress'' type="text" style="width: 250px;" /><button class="myfbt" type="button" ms-click=''markInMap''><i class="imark"></i>{{lang.MapCallout}}</button>',N'{{customerEntity.CompanyAddress}}&nbsp;&nbsp;<img ms-if="customerEntity.Lng" src="/Content/Themes/base/Images/ico/dadiandituico.jpg" style="padding-top: 2px;cursor:pointer;" title="点击查看地图" ms-click="detailMap"><img ms-if="!customerEntity.Lng" src="/Content/Themes/base/Images/ico/dadiandituicohui.jpg" style="padding-top: 2px" title="地图未标注">')
end


if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'CompanyPostCode' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 5,1,0,N'2014/1/1 0:00:00',0,N'CompanyPostCode',N'邮编',N'input',0,3,0,1,1,N'Customer',1,N'联系方式',N'<input ms-duplex=''customerEntity.CompanyPostCode'' type="text" />',N'{{customerEntity.CompanyPostCode}}')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'FullName' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 6,1,0,N'2014/1/1 0:00:00',0,N'FullName',N'执照全称',N'input',0,1,1,1,1,N'Customer',1,N'扩展信息',N'<input ms-duplex=''customerEntity.FullName'' type="text" style="width: 500px;" />',N'{{customerEntity.FullName}}&nbsp;&nbsp;&nbsp;<span class="red" ms-if="customerEntity.FullNameChangeDate" ms-text="customerEntity.FullNameChangeDate"></span>')
end


if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'Scale' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 7,1,0,N'2014/1/1 0:00:00',0,N'Scale',N'人员规模',N'select',0,2,0,1,1,N'0',N'Customer',1,N'基本信息',N'<select ms-each-sc=''scale'' style="width: 120px;" ms-duplex-text=''customerEntity.ScaleId''><option ms-value="sc.Id" ms-text=''sc.Data''></option></select>',N'{{customerEntity.ScaleDisplay}}')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'RegFund' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 8,1,0,N'2014/1/1 0:00:00',0,N'RegFund',N'注册资金',N'input',0,2,0,1,1,N'0',N'Customer',1,N'基本信息',N'<div class="input-append"><input ms-duplex=''customerEntity.RegFund'' type="text" class="span18"><span class="add-on">万</span></div>',N'{{customerEntity.RegFund}}万')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'IsBlackList' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 9,1,0,N'2014/1/1 0:00:00',0,N'IsBlackList',N'列入黑名单',N'input',0,2,0,1,1,N'0',N'Customer',1,N'基本信息',N'<label for="IsBlackList1"><input type="radio" id=''IsBlackList1'' ms-duplex-text=''customerEntity.IsBlackList'' value="false" checked="checked">&nbsp;否&nbsp;&nbsp;</label><label for="IsBlackList2"><input type="radio" id=''IsBlackList2'' ms-duplex-text=''customerEntity.IsBlackList'' value="true">&nbsp;是&nbsp;&nbsp;</label>',N'')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'Value' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 10,1,0,N'2014/1/1 0:00:00',0,N'Value',N'价值评估',N'input',0,2,0,1,1,N'0',N'Customer',1,N'基本信息',N'<div style="width: 125px;" ms-widget=''raty,valueRaty,valueRatyOpts''></div>',N'<div style="width: 125px; display: inline;" ms-widget=''raty,valueRaty,valueRatyOpts'' readonly="readonly"></div>')
end



if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'IsHot' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 11,1,0,N'2014/1/1 0:00:00',0,N'IsHot',N'热点客户',N'input',0,2,0,1,1,N'0',N'Customer',1,N'基本信息',N'<label for="IsHot1"><input type="radio" id=''IsHot1'' ms-duplex-text=''customerEntity.IsHot'' value="true">&nbsp;是&nbsp;&nbsp;</label><label for="IsHot2"><input type="radio" id=''IsHot2'' ms-duplex-text=''customerEntity.IsHot'' value="false" checked="checked">&nbsp;否&nbsp;&nbsp;</label>',N'{{customerEntity.IsHot?''是'':''否''}}')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'Credit' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 12,1,0,N'2014/1/1 0:00:00',0,N'Credit',N'信用等级',N'input',0,2,0,1,1,N'0',N'Customer',1,N'基本信息',N'<div style="width: 125px;" ms-widget=''raty,creditRaty,creditRatyOpts''></div>',N'<div style="width: 125px; display: inline;" ms-widget=''raty,creditRaty,creditRatyOpts'' readonly="readonly"></div>')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'Temperature' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 13,1,0,N'2014/1/1 0:00:00',0,N'Temperature',N'热度',N'input',0,2,0,1,1,N'0',N'Customer',1,N'基本信息',N'<div style="width: 125px;" ms-widget=''processbar,hotprocessbar,hotOpts''></div>',N'<div style="width: 125px;display: inline;" ms-widget=''processbar,hotprocessbar,hotOpts'' readonly="readonly"></div>')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'RelationId' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 14,1,0,N'2014/1/1 0:00:00',0,N'RelationId',N'关系等级',N'input',0,2,0,1,1,N'0',N'Customer',1,N'基本信息',N'<select ms-duplex-text=''customerEntity.RelationId'' ms-each-r=''relation'' style="width: 120px;"><option ms-value="r.Id" ms-text=''r.Data''></option></select>',N'<span color="#F96400">{{customerEntity.RelationDisplay}}</span>')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'ServerLabel' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 15,1,0,N'2014/1/1 0:00:00',0,N'ServerLabel',N'服务标签',N'input',0,13,1,1,1,N'0',N'Customer',1,N'基本信息',N'<div ms-each-server="serviceLabel"><input type="checkbox" ms-duplex-radio="server.checked" ms-attr-id="''server''+$index"><label ms-attr-for="''server''+$index">&nbsp;{{server.Data}}&nbsp;&nbsp;</label></div>',N'{{customerEntity.ServerLabelDisplay}}')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'CompanyTel1' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 16,1,0,N'2014/1/1 0:00:00',0,N'CompanyTel1',N'手机/电话1',N'input',1,2,0,1,1,N'0',N'Customer',1,N'联系方式',N'<input ms-duplex="customerEntity.CompanyTel1" type="text" ms-change="checkCustomerTel(customerEntity.Id,customerEntity.CompanyTel1)">',N'{{customerEntity.CompanyTel1|mobileFormat|html}}')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'Tel400' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 17,1,0,N'2014/1/1 0:00:00',0,N'Tel400',N'400电话',N'input',0,2,0,1,1,N'0',N'Customer',1,N'联系方式',N'<input ms-duplex=''customerEntity.Tel400'' type="text">',N'{{customerEntity.Tel400}}')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'CompanyTel2' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 18,1,0,N'2014/1/1 0:00:00',0,N'CompanyTel2',N'联系电话2',N'input',0,2,0,1,1,N'0',N'Customer',1,N'联系方式',N'<input ms-duplex="customerEntity.CompanyTel2" type="text" ms-change="checkCustomerTel(customerEntity.Id,customerEntity.CompanyTel2)">',N'{{customerEntity.CompanyTel2|mobileFormat|html}}')
end


if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'Fax' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 19,1,0,N'2014/1/1 0:00:00',0,N'Fax',N'传真',N'input',0,2,0,1,1,N'0',N'Customer',1,N'联系方式',N'<input ms-duplex=''customerEntity.Fax'' type="text">',N'{{customerEntity.Fax}}')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'Homepage' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES (20,1,0,N'2014/1/1 0:00:00',0,N'Homepage',N'主网址',N'input',0,2,0,1,1,N'0',N'Customer',1,N'联系方式',N'<input ms-duplex=''customerEntity.Homepage'' type="text" value="http://">',N'{{customerEntity.Homepage|link|html}}')
end


if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'ShopPage' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 21,1,0,N'2014/1/1 0:00:00',0,N'ShopPage',N'网店网址',N'input',0,2,0,1,1,N'0',N'Customer',1,N'联系方式',N'<input ms-duplex="customerEntity.ShopPage" type="text" value="http://">',N'{{customerEntity.ShopPage|link|html}}')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'Email' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 22,1,0,N'2014/1/1 0:00:00',0,N'Email',N'Email',N'input',0,2,0,1,1,N'0',N'Customer',1,N'联系方式',N'<input ms-duplex="customerEntity.Email" type="text" data-tipkey="Email" />',N'<a ms-href="''#/Tools/Email/''+customerEntity.Email+''/send''">{{customerEntity.Email}}</a>')
end


if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'QQ' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 23,1,0,N'2014/1/1 0:00:00',0,N'QQ',N'QQ',N'input',0,2,0,1,1,N'0',N'Customer',1,N'联系方式',N'<input ms-duplex="customerEntity.QQ" type="text" data-tipkey="QQ" />',N'{{customerEntity.QQ}}')
end
if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'Wangwang' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 24,1,0,N'2014/1/1 0:00:00',0,N'Wangwang',N'淘宝旺旺',N'input',0,2,0,1,1,N'0',N'Customer',1,N'联系方式',N'<input ms-duplex="customerEntity.Wangwang" type="text" data-tipkey="Wangwang" /',N'{{customerEntity.Wangwang}}')
end

if not exists(select top 1 Id from [settings_ExpandoFields] where Name = 'OtherContactMethod' AND [Module] = 'Customer')
begin
INSERT [settings_ExpandoFields] ([Id],[Version],[InRecycleBin],[AddTime],[AddBy],[Name],[Display],[Type],[IsRequire],[Order],[IsSignalLine],[IsSearch],[IsInner],[ValidateModa],[Module],[IsAvailable],[Tab],[Html],[ViewHtml]) VALUES ( 25,1,0,N'2014/1/1 0:00:00',0,N'OtherContactMethod',N'其它联系',N'input',0,2,0,1,1,N'0',N'Customer',1,N'联系方式',N'<input ms-duplex=''customerEntity.OtherContactMethod'' type="text" />',N'{{customerEntity.OtherContactMethod}}')
end