/*此为u6升级到u890的过程(自己弄的),我是用两个虚拟机对照着来做的,
一个安装U6,一个安装890,把u6的帐套分别还原到u6和890中,首先按照u6的帐套在890中新建帐套,
注意编码方案要一致,建立完后对照权限信息在890中设置权限,然后执行下列语句*/
/*供应商档案没有测试,因为客户的帐套没有用到供应商*/
/*模块启用人:数据库ufsystem中UA_Account_sub*/
/*手工设置内容:权限以及打印信息*/
/*旧帐套001导入到新帐套101中*/
delete from [UFDATA_101_2010].[dbo].[dsign]
delete from [UFDATA_101_2010].[dbo].[code]
delete from [UFDATA_101_2010].[dbo].[Customer]
delete from [UFDATA_101_2010].[dbo].[CustomerClass]
delete from [UFDATA_101_2010].[dbo].[Department]
delete from [UFDATA_101_2010].[dbo].[Person]
delete from [UFDATA_101_2010].[dbo].[fitem]
delete from [UFDATA_101_2010].[dbo].[fitemss97class]
delete from [UFDATA_101_2010].[dbo].[fitemss97]
delete from [UFDATA_101_2010].[dbo].[GL_accvouch]
delete from [UFDATA_101_2010].[dbo].[GL_accsum]
delete from [UFDATA_101_2010].[dbo].[GL_accass]
delete from [ufdata_101_2009].[dbo].[vendorClass]
delete from [ufdata_101_2009].[dbo].[vendor]
delete from [UFDATA_101_2010].[dbo].[hr_hi_person]
go
--插入凭证类别
insert into [ufdata_101_2010].[dbo].[dsign](csign,isignseq,ctext,itype,iotherused)
select csign,isignseq,ctext,itype,iotherused from [ufdata_001_2010].[dbo].[dsign]
go
--插入凭证类别
--插入会计科目
INSERT INTO [UFDATA_101_2010].[dbo].[code]([cclass], [cclass_engl], [cclassany], [cclassany_engl], [ccode], [ccode_name],
[ccode_engl], [igrade], [bproperty], [cbook_type], [cbook_type_engl], [chelp], [cexch_name], [cmeasure], [bperson], [bcus], [bsup],
[bdept], [bitem], [cass_item], [br], [be], [cgather], [bend], [bexchange], [bcash], [bbank], [bused], [bd_c], [dbegin], [dend],
[itrans], [bclose], [cother], [iotherused], [bcDefine1], [bcDefine2], [bcDefine3], [bcDefine4], [bcDefine5], [bcDefine6],
[bcDefine7], [bcDefine8], [bcDefine9], [bcDefine10], [iViewItem], [bGCJS], [bCashItem], [bcDefine11], [bcDefine12],
[bcDefine13], [bcDefine14], [bcDefine15], [bcDefine16])
SELECT [cclass], [cclass_engl], [cclassany], [cclassany_engl], [ccode], [ccode_name], [ccode_engl], [igrade], [bproperty],
[cbook_type], [cbook_type_engl], [chelp], [cexch_name], [cmeasure], [bperson], [bcus], [bsup], [bdept], [bitem], [cass_item], [br],
[be], [cgather], [bend], [bexchange], [bcash], [bbank], [bused], [bd_c], [dbegin], [dend], [itrans], [bclose], [cother],
[iotherused], [bcDefine1], [bcDefine2], [bcDefine3], [bcDefine4], [bcDefine5], [bcDefine6], [bcDefine7], [bcDefine8], [bcDefine9],
[bcDefine10], [iViewItem], [bGCJS], [bCashItem], [bcDefine11], [bcDefine12], [bcDefine13], [bcDefine14], [bcDefine15],
[bcDefine16] FROM [UFDATA_001_2010].[dbo].[code]
go
--插入会计科目
--客户分类
INSERT INTO [UFDATA_101_2010].[dbo].[CustomerClass]([cCCCode], [cCCName], [iCCGrade], [bCCEnd])
SELECT [cCCCode], [cCCName], [iCCGrade], [bCCEnd] FROM [UFDATA_001_2010].[dbo].[CustomerClass]
go
--客户分类
--客户档案
INSERT INTO [UFDATA_101_2010].[dbo].[Customer]
([cCusCode], [cCusName], [cCusAbbName], [cCCCode], [cDCCode], [cTrade], [cCusAddress], [cCusPostCode],
[cCusRegCode], [cCusBank], [cCusAccount], [dCusDevDate], [cCusLPerson], [cCusEmail], [cCusPerson],
[cCusPhone], [cCusFax], [cCusBP], [cCusHand], [cCusPPerson], [iCusDisRate], [cCusCreGrade],
[iCusCreLine], [iCusCreDate], [cCusPayCond], [cCusOAddress], [cCusOType], [cCusHeadCode],
[cCusWhCode], [cCusDepart], [iARMoney], [dLastDate], [iLastMoney], [dLRDate], [iLRMoney], [dEndDate],
[iFrequency], [cCusDefine1], [cCusDefine2], [cCusDefine3], [iCostGrade], [cCreatePerson],
[cModifyPerson], [dModifyDate], [cRelVendor], [iId], [cPriceGroup], [cOfferGrade], [iOfferRate],
[cCusDefine4], [cCusDefine5], [cCusDefine6], [cCusDefine7], [cCusDefine8], [cCusDefine9],
[cCusDefine10], [cCusDefine11], [cCusDefine12], [cCusDefine13], [cCusDefine14], [cCusDefine15],
[cCusDefine16], [cInvoiceCompany], [bCredit], [bCreditDate], [bCreditByHead],
[bLicenceDate], [dLicenceSDate], [dLicenceEDate], [iLicenceADays], [bBusinessDate], [dBusinessSDate],
[dBusinessEDate], [iBusinessADays], [bProxy], [dProxySDate], [dProxyEDate], [iProxyADays], [cMemo])
SELECT
[cCusCode], [cCusName], [cCusAbbName], [cCCCode], [cDCCode], [cTrade], [cCusAddress],[cCusPostCode],
[cCusRegCode], [cCusBank], [cCusAccount], [dCusDevDate], [cCusLPerson], [cCusEmail], [cCusPerson],
[cCusPhone], [cCusFax], [cCusBP], [cCusHand], [cCusPPerson], [iCusDisRate], [cCusCreGrade],
[iCusCreLine], [iCusCreDate], [cCusPayCond], [cCusOAddress], [cCusOType], [cCusHeadCode],
[cCusWhCode], [cCusDepart], [iARMoney], [dLastDate], [iLastMoney], [dLRDate], [iLRMoney], [dEndDate],
[iFrequency], [cCusDefine1], [cCusDefine2], [cCusDefine3], [iCostGrade], [cCreatePerson],
[cModifyPerson], [dModifyDate], [cRelVendor], [iId], [cPriceGroup], [cOfferGrade], [iOfferRate],
[cCusDefine4], [cCusDefine5], [cCusDefine6], [cCusDefine7], [cCusDefine8], [cCusDefine9],
[cCusDefine10], [cCusDefine11], [cCusDefine12], [cCusDefine13], [cCusDefine14], [cCusDefine15],
[cCusDefine16], [cInvoiceCompany], [bCredit], [bCreditDate], [bCreditByHead],
[bLicenceDate], [dLicenceSDate], [dLicenceEDate], [iLicenceADays], [bBusinessDate], [dBusinessSDate],
[dBusinessEDate], [iBusinessADays], [bProxy], [dProxySDate], [dProxyEDate], [iProxyADays], [cMemo]
FROM [UFDATA_001_2010].[dbo].[Customer]
go
--客户档案
--供应商分类
insert into [ufdata_101_2009].[dbo].[vendorclass](
cVCCode,cVCName,iVCGrade,bVCEnd)
select cVCCode,cVCName,iVCGrade,bVCEnd
form [ufdata_001_2009].[dbo].[vendorclass]
go
--供应商分类
--供应商档案
INSERT INTO [UFDATA_101_2009].[dbo].[Vendor](
[cVenCode], [cVenName], [cVenAbbName], [cVCCode], [cDCCode], [cTrade], [cVenAddress],
[cVenPostCode], [cVenRegCode], [cVenBank], [cVenAccount], [dVenDevDate], [cVenLPerson], [cVenPhone], [cVenFax], [cVenEmail],
[cVenPerson], [cVenBP], [cVenHand], [cVenPPerson], [iVenDisRate], [iVenCreGrade], [iVenCreLine], [iVenCreDate], [cVenPayCond],
[cVenIAddress], [cVenIType], [cVenHeadCode], [cVenWhCode], [cVenDepart], [iAPMoney], [dLastDate], [iLastMoney], [dLRDate], [iLRMoney],
[dEndDate], [iFrequency], [bVenTax], [cVenDefine1], [cVenDefine2], [cVenDefine3], [cCreatePerson], [cModifyPerson], [dModifyDate],
[cRelCustomer], [iId], [cBarCode], [cVenDefine4], [cVenDefine5], [cVenDefine6], [cVenDefine7], [cVenDefine8], [cVenDefine9],
[cVenDefine10], [cVenDefine11], [cVenDefine12], [cVenDefine13], [cVenDefine14], [cVenDefine15], [cVenDefine16],
[fRegistFund], [iEmployeeNum], [iGradeABC], [cMemo], [bLicenceDate], [dLicenceSDate], [dLicenceEDate], [iLicenceADays], [bBusinessDate],
[dBusinessSDate], [dBusinessEDate], [iBusinessADays], [bProxyDate], [dProxySDate], [dProxyEDate], [iProxyADays], [bPassGMP])
SELECT
[cVenCode], [cVenName], [cVenAbbName], [cVCCode], [cDCCode], [cTrade], [cVenAddress],
[cVenPostCode], [cVenRegCode], [cVenBank], [cVenAccount], [dVenDevDate], [cVenLPerson], [cVenPhone], [cVenFax], [cVenEmail],
[cVenPerson], [cVenBP], [cVenHand], [cVenPPerson], [iVenDisRate], [iVenCreGrade], [iVenCreLine], [iVenCreDate], [cVenPayCond],
[cVenIAddress], [cVenIType], [cVenHeadCode], [cVenWhCode], [cVenDepart], [iAPMoney], [dLastDate], [iLastMoney], [dLRDate], [iLRMoney],
[dEndDate], [iFrequency], [bVenTax], [cVenDefine1], [cVenDefine2], [cVenDefine3], [cCreatePerson], [cModifyPerson], [dModifyDate],
[cRelCustomer], [iId], [cBarCode], [cVenDefine4], [cVenDefine5], [cVenDefine6], [cVenDefine7], [cVenDefine8], [cVenDefine9],
[cVenDefine10], [cVenDefine11], [cVenDefine12], [cVenDefine13], [cVenDefine14], [cVenDefine15], [cVenDefine16],
[fRegistFund], [iEmployeeNum], [iGradeABC], [cMemo], [bLicenceDate], [dLicenceSDate], [dLicenceEDate], [iLicenceADays], [bBusinessDate],
[dBusinessSDate], [dBusinessEDate], [iBusinessADays], [bProxyDate], [dProxySDate], [dProxyEDate], [iProxyADays], [bPassGMP]
FROM [UFDATA_001_2009].[dbo].[Vendor]
go
--供应商档案
--部门档案
INSERT INTO [UFDATA_101_2010].[dbo].[Department]
([cDepCode], [bDepEnd], [cDepName], [iDepGrade], [cDepPerson], [cDepProp], [cDepPhone], [cDepAddress],
[cDepMemo], [iCreLine], [cCreGrade], [iCreDate], [cOfferGrade], [iOfferRate])
SELECT
[cDepCode], [bDepEnd], [cDepName], [iDepGrade], [cDepPerson], [cDepProp], [cDepPhone], [cDepAddress],
[cDepMemo], [iCreLine], [cCreGrade], [iCreDate], [cOfferGrade], [iOfferRate]
FROM [UFDATA_001_2010].[dbo].[Department]
go
INSERT INTO [UFDATA_101_2010].[dbo].[fa_Departments]
(sNum,sName,sParentNum,sNum1,bSumDepr,iLevel,iDefinetype)
select cdepcode,cdepname,'',cdepcode,1,1,1
from [UFDATA_101_2010].[dbo].[department]
go
--部门档案
--职员档案
INSERT INTO [UFDATA_101_2010].[dbo].[Person](
[cPersonCode], [cPersonName], [cDepCode], [cPersonProp], [fCreditQuantity], [iCreDate], [cCreGrade],
[iLowRate], [cOfferGrade], [iOfferRate], [cPersonEmail], [cPersonPhone])
SELECT
[cPersonCode], [cPersonName], [cDepCode], [cPersonProp], [fCreditQuantity], [iCreDate], [cCreGrade],
[iLowRate], [cOfferGrade], [iOfferRate], [cPersonEmail], [cPersonPhone]
FROM [UFDATA_001_2010].[dbo].[Person]
go
INSERT INTO [UFDATA_101_2010].[dbo].[hr_hi_person] (cPsn_Num,cPsn_Name,cDept_num,rSex,bPsnPerson,rIDType,bpsnshop,rpersontype)
select cPersonCode,cPersonName,cDepCode,'9',1,0,1,'10'
from [UFDATA_101_2010].[dbo].[person]
go
--职员档案
--项目大类
insert into [ufdata_101_2010].[dbo].[fitem](citem_class,citem_name,citem_text,crule,ctable,cclasstable)
select citem_class,citem_name,citem_text,crule,ctable,cclasstable
from [ufdata_001_2010].[dbo].[fitem]
go
--项目大类
--项目分类
insert into [ufdata_101_2010].[dbo].[fitemss97class](
cItemCcode,cItemCname,iItemCgrade,bItemCend)
select cItemCcode,cItemCname,iItemCgrade,bItemCend
from [ufdata_001_2010].[dbo].[fitemss97class]
go
--项目分类
--项目档案
insert into [ufdata_101_2010].[dbo].[fitemss97](
citemcode,citemname,bclose,citemccode,iotherused,dEndDate)
select citemcode,citemname,bclose,citemccode,iotherused,dEndDate
from [ufdata_001_2010].[dbo].[fitemss97]
go
--项目档案
--凭证
INSERT INTO [UFDATA_101_2010].[dbo].[GL_accvouch](
[iperiod], [csign], [isignseq], [ino_id], [inid], [dbill_date], [idoc], [cbill], [ccheck], [cbook], [ibook], [ccashier], [iflag],
[ctext1], [ctext2], [cdigest], [ccode], [cexch_name], [md], [mc], [md_f], [mc_f], [nfrat], [nd_s], [nc_s], [csettle], [cn_id],
[dt_date], [cdept_id], [cperson_id], [ccus_id], [csup_id], [citem_id], [citem_class], [cname], [ccode_equal], [iflagbank], [iflagPerson],
[bdelete], [coutaccset], [ioutyear], [coutsysname], [coutsysver], [doutbilldate], [ioutperiod], [coutsign], [coutno_id], [doutdate],
[coutbillsign], [coutid], [bvouchedit], [bvouchAddordele], [bvouchmoneyhold], [bvalueedit], [bcodeedit], [ccodecontrol], [bPCSedit],
[bDeptedit], [bItemedit], [bCusSupInput], [cDefine1], [cDefine2], [cDefine3], [cDefine4], [cDefine5], [cDefine6], [cDefine7], [cDefine8],
[cDefine9], [cDefine10], [cDefine11], [cDefine12], [cDefine13], [cDefine14], [cDefine15], [cDefine16], [dReceive], [cWLDZFlag],
[dWLDZTime], [bFlagOut], [iBG_OverFlag], [cBG_Auditor], [dBG_AuditTime], [cBG_AuditOpinion], [bWH_BgFlag])
SELECT
[iperiod], [csign], [isignseq], [ino_id], [inid], [dbill_date], [idoc], [cbill], [ccheck], [cbook], [ibook], [ccashier], [iflag],
[ctext1], [ctext2], [cdigest], [ccode], [cexch_name], [md], [mc], [md_f], [mc_f], [nfrat], [nd_s], [nc_s], [csettle], [cn_id],
[dt_date], [cdept_id], [cperson_id], [ccus_id], [csup_id], [citem_id], [citem_class], [cname], [ccode_equal], [iflagbank], [iflagPerson],
[bdelete], [coutaccset], [ioutyear], [coutsysname], [coutsysver], [doutbilldate], [ioutperiod], [coutsign], [coutno_id], [doutdate],
[coutbillsign], [coutid], [bvouchedit], [bvouchAddordele], [bvouchmoneyhold], [bvalueedit], [bcodeedit], [ccodecontrol], [bPCSedit],
[bDeptedit], [bItemedit], [bCusSupInput], [cDefine1], [cDefine2], [cDefine3], [cDefine4], [cDefine5], [cDefine6], [cDefine7], [cDefine8],
[cDefine9], [cDefine10], [cDefine11], [cDefine12], [cDefine13], [cDefine14], [cDefine15], [cDefine16], [dReceive], [cWLDZFlag],
[dWLDZTime], [bFlagOut], [iBG_OverFlag], [cBG_Auditor], [dBG_AuditTime], [cBG_AuditOpinion], [bWH_BgFlag]
FROM [UFDATA_001_2010].[dbo].[GL_accvouch]
go
--凭证
--凭证1
INSERT INTO [UFDATA_101_2010].[dbo].[GL_accsum](
[ccode], [cexch_name], [iperiod], [cbegind_c], [cbegind_c_engl], [mb], [md], [mc], [cendd_c], [cendd_c_engl], [me], [mb_f],
[md_f], [mc_f], [me_f], [nb_s], [nd_s], [nc_s], [ne_s])
SELECT
[ccode], [cexch_name], [iperiod], [cbegind_c], [cbegind_c_engl], [mb], [md], [mc], [cendd_c], [cendd_c_engl], [me], [mb_f],
[md_f], [mc_f], [me_f], [nb_s], [nd_s], [nc_s], [ne_s]
FROM [UFDATA_001_2010].[dbo].[GL_accsum]
go
--凭证1
--凭证2
INSERT INTO [UFDATA_101_2010].[dbo].[GL_accass](
[ccode], [cexch_name], [cdept_id], [cperson_id], [ccus_id], [csup_id], [citem_class], [citem_id], [iperiod], [cbegind_c],
[cbegind_c_engl], [mb], [md], [mc], [cendd_c], [cendd_c_engl], [me], [mb_f], [md_f], [mc_f], [me_f], [nb_s], [nd_s], [nc_s], [ne_s])
SELECT
[ccode], [cexch_name], [cdept_id], [cperson_id], [ccus_id], [csup_id], [citem_class], [citem_id], [iperiod], [cbegind_c],
[cbegind_c_engl], [mb], [md], [mc], [cendd_c], [cendd_c_engl], [me], [mb_f], [md_f], [mc_f], [me_f], [nb_s], [nd_s], [nc_s], [ne_s]
FROM [UFDATA_001_2010].[dbo].[GL_accass]
go
--凭证2
--现金流量
delete from [ufdata_101_2010].[dbo].[GL_CashTable]
go
INSERT INTO [UFDATA_101_2010].[dbo].[GL_CashTable](
[iPeriod], [iSignSeq], [iNo_id], [inid], [cCashItem], [md], [mc], [ccode], [md_f], [mc_f], [nd_s], [nc_s],[dbill_date], [csign])
select a.iperiod,a.isignseq,a.ino_id,a.inid,b.cCashItem,b.md,b.mc,a.ccode,0,0,0,0,a.dbill_date,a.csign
from [ufdata_001_2010].[dbo].[GL_accvouch] a,[ufdata_001_2010].[dbo].[GL_CashTable] b
where a.iperiod=b.iperiod and a.isignseq=b.isignseq and a.iNo_id=b.iNo_id and a.inid=b.inid
go
--现金流量