/* 向八张出入库老单据体中插入"销售合约'"这个字段FEntryCode, 销售合约是核算项目,类别是3003 */
Insert Into ICTemplateEntry(FID,FCtlIndex,FCtlOrder,FHeadCaption,FHeadCaption_CHT,FHeadCaption_EN,FCtlType,FLookUpCls,FNeedSave,FValueType,FSaveValue,FFieldName,FWidth,FEnable,FRelateOutTbl,FPrint,FMustInput,FNeedCount,FFilter,FRelationID,FAction,FDefaultCtl,FVisForBillType, FStatCount,FFormat,FMaxValue,FMinValue)
Values('A01',57,57,'销售合约','新增列57','Self-defined List57',2,3003,-1,1,1,'FEntryCode',1500,48,0,-1,-1,0,'','','',0,31,0,'','','')
Insert Into ICTemplateEntry(FID,FCtlIndex,FCtlOrder,FHeadCaption,FHeadCaption_CHT,FHeadCaption_EN,FCtlType,FLookUpCls,FNeedSave,FValueType,FSaveValue,FFieldName,FWidth,FEnable,FRelateOutTbl,FPrint,FMustInput,FNeedCount,FFilter,FRelationID,FAction,FDefaultCtl,FVisForBillType, FStatCount,FFormat,FMaxValue,FMinValue)
Values('A02',57,57,'销售合约','新增列57','Self-defined List57',2,3003,-1,1,1,'FEntryCode',1500,48,0,-1,-1,0,'','','',0,31,0,'','','')
Insert Into ICTemplateEntry(FID,FCtlIndex,FCtlOrder,FHeadCaption,FHeadCaption_CHT,FHeadCaption_EN,FCtlType,FLookUpCls,FNeedSave,FValueType,FSaveValue,FFieldName,FWidth,FEnable,FRelateOutTbl,FPrint,FMustInput,FNeedCount,FFilter,FRelationID,FAction,FDefaultCtl,FVisForBillType, FStatCount,FFormat,FMaxValue,FMinValue)
Values('A05',57,57,'销售合约','新增列57','Self-defined List57',2,3003,-1,1,1,'FEntryCode',1500,48,0,-1,-1,0,'','','',0,31,0,'','','')
Insert Into ICTemplateEntry(FID,FCtlIndex,FCtlOrder,FHeadCaption,FHeadCaption_CHT,FHeadCaption_EN,FCtlType,FLookUpCls,FNeedSave,FValueType,FSaveValue,FFieldName,FWidth,FEnable,FRelateOutTbl,FPrint,FMustInput,FNeedCount,FFilter,FRelationID,FAction,FDefaultCtl,FVisForBillType, FStatCount,FFormat,FMaxValue,FMinValue)
Values('A97',57,57,'销售合约','新增列57','Self-defined List57',2,3003,-1,1,1,'FEntryCode',1500,48,0,-1,-1,0,'','','',0,31,0,'','','')
Insert Into ICTemplateEntry(FID,FCtlIndex,FCtlOrder,FHeadCaption,FHeadCaption_CHT,FHeadCaption_EN,FCtlType,FLookUpCls,FNeedSave,FValueType,FSaveValue,FFieldName,FWidth,FEnable,FRelateOutTbl,FPrint,FMustInput,FNeedCount,FFilter,FRelationID,FAction,FDefaultCtl,FVisForBillType, FStatCount,FFormat,FMaxValue,FMinValue)
Values('B01',57,57,'销售合约','新增列57','Self-defined List57',2,3003,-1,1,1,'FEntryCode',1500,48,0,-1,-1,0,'','','',0,31,0,'','','')
Insert Into ICTemplateEntry(FID,FCtlIndex,FCtlOrder,FHeadCaption,FHeadCaption_CHT,FHeadCaption_EN,FCtlType,FLookUpCls,FNeedSave,FValueType,FSaveValue,FFieldName,FWidth,FEnable,FRelateOutTbl,FPrint,FMustInput,FNeedCount,FFilter,FRelationID,FAction,FDefaultCtl,FVisForBillType, FStatCount,FFormat,FMaxValue,FMinValue)
Values('B04',57,57,'销售合约','新增列57','Self-defined List57',2,3003,-1,1,1,'FEntryCode',1500,48,0,-1,-1,0,'','','',0,31,0,'','','')
Insert Into ICTemplateEntry(FID,FCtlIndex,FCtlOrder,FHeadCaption,FHeadCaption_CHT,FHeadCaption_EN,FCtlType,FLookUpCls,FNeedSave,FValueType,FSaveValue,FFieldName,FWidth,FEnable,FRelateOutTbl,FPrint,FMustInput,FNeedCount,FFilter,FRelationID,FAction,FDefaultCtl,FVisForBillType, FStatCount,FFormat,FMaxValue,FMinValue)
Values('B08',57,57,'销售合约','新增列57','Self-defined List57',2,3003,-1,1,1,'FEntryCode',1500,48,0,-1,-1,0,'','','',0,31,0,'','','')
Insert Into ICTemplateEntry(FID,FCtlIndex,FCtlOrder,FHeadCaption,FHeadCaption_CHT,FHeadCaption_EN,FCtlType,FLookUpCls,FNeedSave,FValueType,FSaveValue,FFieldName,FWidth,FEnable,FRelateOutTbl,FPrint,FMustInput,FNeedCount,FFilter,FRelationID,FAction,FDefaultCtl,FVisForBillType, FStatCount,FFormat,FMaxValue,FMinValue)
Values('B09',57,57,'销售合约','新增列57','Self-defined List57',2,3003,-1,1,1,'FEntryCode',1500,48,0,-1,-1,0,'','','',0,31,0,'','','')
if not exists (SELECT * FROM sysobjects t1 ,syscolumns t2 where t1.id=t2.id and t1.name='ICStockBillEntry' and t2.Name='FEntryCode')
Alter Table ICStockBillEntry Add FEntryCode Int NULL
go
DELETE FROM GLNoteCitation WHERE FCode='FEntryCode' AND FTemplateID='A01' AND FRelationID IN (1,2,3,20)
DELETE FROM GLNoteCitation WHERE FCode='FEntryCode' AND FTemplateID='A02' AND FRelationID IN (1,2,3,20)
DELETE FROM GLNoteCitation WHERE FCode='FEntryCode' AND FTemplateID='A05' AND FRelationID IN (1,2,3,20)
DELETE FROM GLNoteCitation WHERE FCode='FEntryCode' AND FTemplateID='A97' AND FRelationID IN (1,2,3,20)
DELETE FROM GLNoteCitation WHERE FCode='FEntryCode' AND FTemplateID='B01' AND FRelationID IN (1,2,3,20)
DELETE FROM GLNoteCitation WHERE FCode='FEntryCode' AND FTemplateID='B04' AND FRelationID IN (1,2,3,20)
DELETE FROM GLNoteCitation WHERE FCode='FEntryCode' AND FTemplateID='B08' AND FRelationID IN (1,2,3,20)
DELETE FROM GLNoteCitation WHERE FCode='FEntryCode' AND FTemplateID='B09' AND FRelationID IN (1,2,3,20)
Insert Into GLNoteCitation(FTemplateID,FID,FNoteTypeID,FCitationName,FInEntry,FIsMoney,FCode,FCtlIndex,FIsSum,FKeyFieldName,FExtFieldName,FTableName,FRelationID,FCitationName_CHT,FCitationName_EN)
values ('A01',160 ,19,'销售合约$',1,0 ,'FEntryCode',57,0,'FEntryCode','', '', 2,'新增列57$','Self-defined List57$')
Insert Into GLNoteCitation(FTemplateID,FID,FNoteTypeID,FCitationName,FInEntry,FIsMoney,FCode,FCtlIndex,FIsSum,FKeyFieldName,FExtFieldName,FTableName,FRelationID,FCitationName_CHT,FCitationName_EN)
values ('A02',160 ,19,'销售合约$',1,0 ,'FEntryCode',57,0,'FEntryCode','', '', 2,'新增列57$','Self-defined List57$')
Insert Into GLNoteCitation(FTemplateID,FID,FNoteTypeID,FCitationName,FInEntry,FIsMoney,FCode,FCtlIndex,FIsSum,FKeyFieldName,FExtFieldName,FTableName,FRelationID,FCitationName_CHT,FCitationName_EN)
values ('A05',160 ,19,'销售合约$',1,0 ,'FEntryCode',57,0,'FEntryCode','', '', 2,'新增列57$','Self-defined List57$')
Insert Into GLNoteCitation(FTemplateID,FID,FNoteTypeID,FCitationName,FInEntry,FIsMoney,FCode,FCtlIndex,FIsSum,FKeyFieldName,FExtFieldName,FTableName,FRelationID,FCitationName_CHT,FCitationName_EN)
values ('A97',160 ,19,'销售合约$',1,0 ,'FEntryCode',57,0,'FEntryCode','', '', 2,'新增列57$','Self-defined List57$')
Insert Into GLNoteCitation(FTemplateID,FID,FNoteTypeID,FCitationName,FInEntry,FIsMoney,FCode,FCtlIndex,FIsSum,FKeyFieldName,FExtFieldName,FTableName,FRelationID,FCitationName_CHT,FCitationName_EN)
values ('B01',160 ,19,'销售合约$',1,0 ,'FEntryCode',57,0,'FEntryCode','', '', 2,'新增列57$','Self-defined List57$')
Insert Into GLNoteCitation(FTemplateID,FID,FNoteTypeID,FCitationName,FInEntry,FIsMoney,FCode,FCtlIndex,FIsSum,FKeyFieldName,FExtFieldName,FTableName,FRelationID,FCitationName_CHT,FCitationName_EN)
values ('B04',160 ,19,'销售合约$',1,0 ,'FEntryCode',57,0,'FEntryCode','', '', 2,'新增列57$','Self-defined List57$')
Insert Into GLNoteCitation(FTemplateID,FID,FNoteTypeID,FCitationName,FInEntry,FIsMoney,FCode,FCtlIndex,FIsSum,FKeyFieldName,FExtFieldName,FTableName,FRelationID,FCitationName_CHT,FCitationName_EN)
values ('B08',160 ,19,'销售合约$',1,0 ,'FEntryCode',57,0,'FEntryCode','', '', 2,'新增列57$','Self-defined List57$')
Insert Into GLNoteCitation(FTemplateID,FID,FNoteTypeID,FCitationName,FInEntry,FIsMoney,FCode,FCtlIndex,FIsSum,FKeyFieldName,FExtFieldName,FTableName,FRelationID,FCitationName_CHT,FCitationName_EN)
values ('B09',160 ,19,'销售合约$',1,0 ,'FEntryCode',57,0,'FEntryCode','', '', 2,'新增列57$','Self-defined List57$')
Insert Into ICChatBillTitle(FInterID,FTypeID,FColCaption,FColCaption_CHT,FColCaption_EN,FMergeable,FColName,FName,FTableName,FTableAlias,FColType,FItemClassID,FReturnDataType,FCtlIndex,FStatistical,FNeedCount,FCountPriceType,FVisForQuest,FVisForOrder,FFormat)
Values(1056,58,'销售合约$','新增列57$','Self-defined List57$',0,'FEntryCode','FName','t_Item','t1056',1,3003,2,57,1,0,0,1,1,'')
insert into ICTableRelation(FTypeID,FinterID,FTableName,FTableNameAlias,FFieldName,FTableName11,FTableNameAlias11,fFieldName11,FLogic)
values(58,1056,'ICStockBillEntry','u1','FEntryCode','t_Item','t1056','FItemID','*=')
delete From ICVoucherTBill Where FBillType = 1 AND FAuditField='FEntryCode' And FItemClassID = 3003 And (FAuditName = '销售合约' OR FAuditName_CHT='新增列57' OR FAuditName_EN='Self-defined List57')
Insert into ICVoucherTBill(FBillType,FItemClassID,FAuditName,FAuditName_CHT,FAuditName_EN,FAuditField,FIsEntry) values(1,3003,'销售合约','新增列57','Self-defined List57','FEntryCode',1)
Delete FROM ICVoucherTField WHERE
FBillType=1 AND FIsUserDefine=1 AND FUserDefineField='FEntryCode'
go
IF Exists(Select t2.* From t_TableDescription t1, t_FieldDescription t2 Where t1.FTableID=t2.FTableID And t1.FTableName ='ICStockBillEntry' And t2.FFieldName ='FEntryCode')
Begin
UPDATE t2 SET FFieldType ='INTEGER'
,FDescription ='销售合约',FDescription_CHT ='新增列57',FDescription_EN ='Self-defined List57'
,FFieldNote = '销售合约',FFieldNote_CHT = '新增列57',FFieldNote_EN = 'Self-defined List57'
From t_TableDescription t1, t_FieldDescription t2
Where t1.FTableID=t2.FTableID And t1.FTableName ='ICStockBillEntry' And t2.FFieldName ='FEntryCode'
End
Else
Begin
INSERT INTO t_FieldDescription(FTableID,FFieldName,FFieldType
,FDescription,FDescription_CHT,FDescription_EN
,FFieldNote,FFieldNote_CHT,FFieldNote_EN
) Select t1.FTableID,'FEntryCode','INTEGER'
,'销售合约','新增列57','Self-defined List57'
,'销售合约','新增列57','Self-defined List57'
From t_TableDescription t1
Where t1.FTableName ='ICStockBillEntry'
End
go
Delete ICSelBills Where FID ='A01' and FFieldName='1007101' and FDstCtlField='FEntryCode' and FSelType=0
go
Delete ICSelBills Where FID ='A01' and FFieldName='FBSCBillInterID' and FDstCtlField='FEntryCode' and FSelType=0
go
Delete ICSelBills Where FID ='A01' and FFieldName='FChangeBillNo' and FDstCtlField='FEntryCode' and FSelType=0
go
Delete ICSelBills Where FID ='A01' and FFieldName='FFYBillInterID' and FDstCtlField='FEntryCode' and FSelType=0
go
Delete ICSelBills Where FID ='A01' and FFieldName='FImpInvoiceInterID' and FDstCtlField='FEntryCode' and FSelType=0
go
Delete ICSelBills Where FID ='A01' and FFieldName='FInvoiceInterID' and FDstCtlField='FEntryCode' and FSelType=0
go
Delete ICSelBills Where FID ='A01' and FFieldName='FOrderInterID' and FDstCtlField='FEntryCode' and FSelType=0
go
Delete ICSelBills Where FID ='A01' and FFieldName='FQCRBillInterID' and FDstCtlField='FEntryCode' and FSelType=0
go
Delete ICSelBills Where FID ='A01' and FFieldName='FRSCBillInterID' and FDstCtlField='FEntryCode' and FSelType=0
go
Delete ICSelBills Where FID ='A01' and FFieldName='FSCBillInterID' and FDstCtlField='FEntryCode' and FSelType=0
go