用友U8 销售普通发票显示不正常,没有表头记录。用友U8 销售普通发票显示不正常,没有表头记录。
问题原因:显示销售发票的视图有错,并且数据被损坏 解决方法:执行以下语句修改: use ufdata_001_2005 go drop view salebillvouchzt go CREATE VIEW SaleBillVouchZT AS select ivtid,convert(char,convert(money,salebillvouch.ufts),2) as ufts,csource,ccrechpname,cinfotypecode,salebillvouch.cstcode, salebillvouch.crdcode, salebillvouch.cdepcode, salebillvouch.ccuscode, salebillvouch.cpaycode, saletype.cstname, customer.ccusabbname, customer.ccusaddress, customer.ccusphone, customer.ccusfax, customer.ccusbank, customer.ccusaccount,customer.ccusperson, customer.ccusoaddress, customer.ccuspaycond, salebillvouch.cpersoncode, customer.ccusotype, salebillvouch.sbvid, salebillvouch.csbvcode, salebillvouch.cvouchtype, salebillvouch.ddate, salebillvouch.csocode, salebillvouch.cdefine1, salebillvouch.cdefine2, salebillvouch.cdefine3, salebillvouch.cmaker, salebillvouch.cverifier, department.cdepname, person.cpersonname, salebillvouch.iexchrate, salebillvouch.itaxrate, salebillvouch.cbillver, salebillvouch.cmemo, paycondition.cpayname, salebillvouch.breturnflag, salebillvouch.bfirst, salebillvouch.cbustype, salebillvouch.cbcode, salebillvouch.cexch_name, salebillvouch.cinvalider, bank.cbname, bank.cbaccount, customer.ccusregcode, customer.icuscreline, customer.iarmoney, salebillvouch.cdefine4, salebillvouch.cdefine5, salebillvouch.cdefine6, salebillvouch.cdefine7, salebillvouch.cdefine8, salebillvouch.cdefine9, salebillvouch.cdefine10,salebillvouch.cdefine11,salebillvouch.cdefine12,salebillvouch.cdefine13,salebillvouch.cdefine14, salebillvouch.cdefine15,salebillvouch.cdefine16,salebillvouch.citem_class, salebillvouch.citemcode, salebillvouch.ccusname, salebillvouch.idisp, salebillvouch.cdlcode,salebillvouch.caccounter,salebillvouch.cchecker,salebillvouch.bpayment,customer.ccusdefine1,customer.ccusdefine2, customer.ccusdefine3,customer.ccusdefine4,customer.ccusdefine5,customer.ccusdefine6,customer.ccusdefine7,customer.ccusdefine8,customer.ccusdefine9, customer.ccusdefine10,customer.ccusdefine11,customer.ccusdefine12,customer.ccusdefine13,customer.ccusdefine14,customer.ccusdefine15,customer.ccusdefine16, customer.iid as cauthid,salebillvouch.csccode,shippingchoice.cscname,salebillvouch.cshipaddress FROM SaleBillVouch LEFT OUTER JOIN Bank ON SaleBillVouch.cBCode = Bank.cBCode LEFT OUTER JOIN Customer ON SaleBillVouch.cCusCode = Customer.cCusCode LEFT OUTER JOIN Department ON SaleBillVouch.cDepCode = Department.cDepCode LEFT OUTER JOIN PayCondition ON SaleBillVouch.cPayCode = PayCondition.cPayCode LEFT OUTER JOIN Person ON SaleBillVouch.cPersonCode = Person.cPersonCode LEFT OUTER JOIN SaleType ON SaleBillVouch.cSTCode = SaleType.cSTCode left join ShippingChoice on salebillvouch.csccode=ShippingChoice.csccode where cSource='销售' and dDate>=(select cvalue from accinformation where csysid='SA' and cName='dStartDate') go drop view salebillvouchzw go CREATE VIEW SaleBillVouchZW AS select warehouse.cwhname, salebillvouchs.cinvcode, inventory.cinvname,cinvaddcode, salebillvouchs.cwhcode, salebillvouchs.cfree1, salebillvouchs.cfree2,salebillvouchs.cfree3,salebillvouchs.cfree4,salebillvouchs.cfree5,salebillvouchs.cfree6,salebillvouchs.cfree7,salebillvouchs.cfree8, salebillvouchs.cfree9,salebillvouchs.cfree10, inventory.cinvstd, salebillvouchs.cunitid, unit1.ccomunitname as cinvm_unit,inventory.igrouptype,inventory.cgroupcode,case when isnull(inventory.igrouptype,0)=0 then null else unit2.ccomunitname end as cinva_unit, (case when isnull(salebillvouchs.itb, 0) = 1 then salebillvouchs.tbnum else (case when igrouptype=0 then null else salebillvouchs.inum end) end) as inum, inventory.bservice, (case when isnull(salebillvouchs.itb, 0) = 1 then salebillvouchs.tbquantity else salebillvouchs.iquantity end) as iquantity, salebillvouchs.iunitprice, salebillvouchs.imoney, salebillvouchs.itax, salebillvouchs.isum, salebillvouchs.idiscount, salebillvouchs.isbvid, salebillvouchs.sbvid, salebillvouchs.iquotedprice, salebillvouchs.ibatch, salebillvouchs.autoid, salebillvouchs.inatunitprice, salebillvouchs.inatmoney, salebillvouchs.inattax, salebillvouchs.inatsum, salebillvouchs.inatdiscount, salebillvouchs.imoneysum, salebillvouchs.iexchsum, salebillvouchs.cclue, salebillvouchs.iinvexchrate, inventory.iinvlscost, salebillvouchs.itaxunitprice, salebillvouchs.bsettleall, salebillvouchs.cbatch, inventory.binvbatch, warehouse.cwhvaluestyle, inventory.bfree1, inventory.bfree2, inventory.cinvdefine1, inventory.cinvdefine2, inventory.cinvdefine3, inventory.cinvdefine4,inventory.cinvdefine5,inventory.cinvdefine6,inventory.cinvdefine7,inventory.cinvdefine8, inventory.cinvdefine9,inventory.cinvdefine10,inventory.cinvdefine11,inventory.cinvdefine12,inventory.cinvdefine13,inventory.cinvdefine14,inventory.cinvdefine15,inventory.cinvdefine16,salebillvouchs.kl, salebillvouchs.kl2, inventory.binvtype, (case when salebillvouchs.itb=0 then '正常' else '退补' end) as itb,salebillvouchs.imassdate as imassdate,inventory.binvquality,salebillvouchs.dvdate,salebillvouchs.dmdate,case salebillvouchs.cmassunit when '0' then '' when '1' then '年' when '2' then '月' when '3' then '日' end as cmassunit, salebillvouchs.itaxrate, salebillvouchs.cdefine22, salebillvouchs.cdefine23, salebillvouchs.cdefine24, salebillvouchs.cdefine25, salebillvouchs.cdefine26, salebillvouchs.cdefine27,salebillvouchs.cdefine28,salebillvouchs.cdefine29,salebillvouchs.cdefine30,salebillvouchs.cdefine31, salebillvouchs.cdefine32,salebillvouchs.cdefine33,salebillvouchs.cdefine34,salebillvouchs.cdefine35,salebillvouchs.cdefine36,salebillvouchs.cdefine37,salebillvouchs.isosid, salebillvouchs.idlsid, salebillvouchs.citemcode, salebillvouchs.citem_class, salebillvouchs.csocode,100-salebillvouchs.kl as dkl1, 100-salebillvouchs.kl2 as dkl2, salebillvouchs.fsalecost,salebillvouchs.fsaleprice,inventory.cinvccode,salebillvouchs.citemname,salebillvouchs.citem_cname ,salebillvouchs.cmemo,ipbvsid,btrack,ccode,inventory.iid as cinvauthid,cincomesub, (case when isnull(salebillvouchs.bgsp,0)=1 then '是' else '否' end) as bgsp,inventory.ccomunitcode, salebillvouchs.ippartseqid,salebillvouchs.ippartid,salebillvouchs.ippartqty,inventory.cbarcode,salebillvouchs.ccontractid,salebillvouchs.ccontracttagcode,salebillvouchs.ccontractrowguid, case when isnull(inventory.batomodel,0)=0 then '否' else '是' end as batomodel,case when isnull(inventory.bptomodel,0)=0 then '否' else '是' end as bptomodel, case when isnull(salebillvouchs.bQANeedCheck,0)=0 then '否' else '是' end as bqaneedcheck, case when isnull(salebillvouchs.bQAUrgency,0)=0 then '否' else '是' end as bqaurgency, salebillvouchs.ccusinvcode,salebillvouchs.ccusinvname FROM SaleBillVouchs LEFT JOIN Warehouse ON SaleBillVouchs.cWhCode = Warehouse.cWhCode LEFT JOIN Inventory ON SaleBillVouchs.cInvCode = Inventory.cInvCode left join ComputationUnit as Unit1 on inventory.cComUnitCode=Unit1.cComUnitCode left join ComputationUnit as Unit2 on salebillvouchs.cunitid=Unit2.cComUnitCode go sp_dboption 'ufdata_001_2005','single user','true' go dbcc checkdb('ufdata_001_2005', REPAIR_ALLOW_DATA_LOSS) go sp_dboption 'ufdata_001_2005','single user','false'
解决方案:
问题原因:显示销售发票的视图有错,并且数据被损坏 解决方法:执行以下语句修改: use ufdata_001_2005 go drop view salebillvouchzt go CREATE VIEW SaleBillVouchZT AS select ivtid,convert(char,convert(money,salebillvouch.ufts),2) as ufts,csource,ccrechpname,cinfotypecode,salebillvouch.cstcode, salebillvouch.crdcode, salebillvouch.cdepcode, salebillvouch.ccuscode, salebillvouch.cpaycode, saletype.cstname, customer.ccusabbname, customer.ccusaddress, customer.ccusphone, customer.ccusfax, customer.ccusbank, customer.ccusaccount,customer.ccusperson, customer.ccusoaddress, customer.ccuspaycond, salebillvouch.cpersoncode, customer.ccusotype, salebillvouch.sbvid, salebillvouch.csbvcode, salebillvouch.cvouchtype, salebillvouch.ddate, salebillvouch.csocode, salebillvouch.cdefine1, salebillvouch.cdefine2, salebillvouch.cdefine3, salebillvouch.cmaker, salebillvouch.cverifier, department.cdepname, person.cpersonname, salebillvouch.iexchrate, salebillvouch.itaxrate, salebillvouch.cbillver, salebillvouch.cmemo, paycondition.cpayname, salebillvouch.breturnflag, salebillvouch.bfirst, salebillvouch.cbustype, salebillvouch.cbcode, salebillvouch.cexch_name, salebillvouch.cinvalider, bank.cbname, bank.cbaccount, customer.ccusregcode, customer.icuscreline, customer.iarmoney, salebillvouch.cdefine4, salebillvouch.cdefine5, salebillvouch.cdefine6, salebillvouch.cdefine7, salebillvouch.cdefine8, salebillvouch.cdefine9, salebillvouch.cdefine10,salebillvouch.cdefine11,salebillvouch.cdefine12,salebillvouch.cdefine13,salebillvouch.cdefine14, salebillvouch.cdefine15,salebillvouch.cdefine16,salebillvouch.citem_class, salebillvouch.citemcode, salebillvouch.ccusname, salebillvouch.idisp, salebillvouch.cdlcode,salebillvouch.caccounter,salebillvouch.cchecker,salebillvouch.bpayment,customer.ccusdefine1,customer.ccusdefine2, customer.ccusdefine3,customer.ccusdefine4,customer.ccusdefine5,customer.ccusdefine6,customer.ccusdefine7,customer.ccusdefine8,customer.ccusdefine9, customer.ccusdefine10,customer.ccusdefine11,customer.ccusdefine12,customer.ccusdefine13,customer.ccusdefine14,customer.ccusdefine15,customer.ccusdefine16, customer.iid as cauthid,salebillvouch.csccode,shippingchoice.cscname,salebillvouch.cshipaddress FROM SaleBillVouch LEFT OUTER JOIN Bank ON SaleBillVouch.cBCode = Bank.cBCode LEFT OUTER JOIN Customer ON SaleBillVouch.cCusCode = Customer.cCusCode LEFT OUTER JOIN Department ON SaleBillVouch.cDepCode = Department.cDepCode LEFT OUTER JOIN PayCondition ON SaleBillVouch.cPayCode = PayCondition.cPayCode LEFT OUTER JOIN Person ON SaleBillVouch.cPersonCode = Person.cPersonCode LEFT OUTER JOIN SaleType ON SaleBillVouch.cSTCode = SaleType.cSTCode left join ShippingChoice on salebillvouch.csccode=ShippingChoice.csccode where cSource='销售' and dDate>=(select cvalue from accinformation where csysid='SA' and cName='dStartDate') go drop view salebillvouchzw go CREATE VIEW SaleBillVouchZW AS select warehouse.cwhname, salebillvouchs.cinvcode, inventory.cinvname,cinvaddcode, salebillvouchs.cwhcode, salebillvouchs.cfree1, salebillvouchs.cfree2,salebillvouchs.cfree3,salebillvouchs.cfree4,salebillvouchs.cfree5,salebillvouchs.cfree6,salebillvouchs.cfree7,salebillvouchs.cfree8, salebillvouchs.cfree9,salebillvouchs.cfree10, inventory.cinvstd, salebillvouchs.cunitid, unit1.ccomunitname as cinvm_unit,inventory.igrouptype,inventory.cgroupcode,case when isnull(inventory.igrouptype,0)=0 then null else unit2.ccomunitname end as cinva_unit, (case when isnull(salebillvouchs.itb, 0) = 1 then salebillvouchs.tbnum else (case when igrouptype=0 then null else salebillvouchs.inum end) end) as inum, inventory.bservice, (case when isnull(salebillvouchs.itb, 0) = 1 then salebillvouchs.tbquantity else salebillvouchs.iquantity end) as iquantity, salebillvouchs.iunitprice, salebillvouchs.imoney, salebillvouchs.itax, salebillvouchs.isum, salebillvouchs.idiscount, salebillvouchs.isbvid, salebillvouchs.sbvid, salebillvouchs.iquotedprice, salebillvouchs.ibatch, salebillvouchs.autoid, salebillvouchs.inatunitprice, salebillvouchs.inatmoney, salebillvouchs.inattax, salebillvouchs.inatsum, salebillvouchs.inatdiscount, salebillvouchs.imoneysum, salebillvouchs.iexchsum, salebillvouchs.cclue, salebillvouchs.iinvexchrate, inventory.iinvlscost, salebillvouchs.itaxunitprice, salebillvouchs.bsettleall, salebillvouchs.cbatch, inventory.binvbatch, warehouse.cwhvaluestyle, inventory.bfree1, inventory.bfree2, inventory.cinvdefine1, inventory.cinvdefine2, inventory.cinvdefine3, inventory.cinvdefine4,inventory.cinvdefine5,inventory.cinvdefine6,inventory.cinvdefine7,inventory.cinvdefine8, inventory.cinvdefine9,inventory.cinvdefine10,inventory.cinvdefine11,inventory.cinvdefine12,inventory.cinvdefine13,inventory.cinvdefine14,inventory.cinvdefine15,inventory.cinvdefine16,salebillvouchs.kl, salebillvouchs.kl2, inventory.binvtype, (case when salebillvouchs.itb=0 then '正常' else '退补' end) as itb,salebillvouchs.imassdate as imassdate,inventory.binvquality,salebillvouchs.dvdate,salebillvouchs.dmdate,case salebillvouchs.cmassunit when '0' then '' when '1' then '年' when '2' then '月' when '3' then '日' end as cmassunit, salebillvouchs.itaxrate, salebillvouchs.cdefine22, salebillvouchs.cdefine23, salebillvouchs.cdefine24, salebillvouchs.cdefine25, salebillvouchs.cdefine26, salebillvouchs.cdefine27,salebillvouchs.cdefine28,salebillvouchs.cdefine29,salebillvouchs.cdefine30,salebillvouchs.cdefine31, salebillvouchs.cdefine32,salebillvouchs.cdefine33,salebillvouchs.cdefine34,salebillvouchs.cdefine35,salebillvouchs.cdefine36,salebillvouchs.cdefine37,salebillvouchs.isosid, salebillvouchs.idlsid, salebillvouchs.citemcode, salebillvouchs.citem_class, salebillvouchs.csocode,100-salebillvouchs.kl as dkl1, 100-salebillvouchs.kl2 as dkl2, salebillvouchs.fsalecost,salebillvouchs.fsaleprice,inventory.cinvccode,salebillvouchs.citemname,salebillvouchs.citem_cname ,salebillvouchs.cmemo,ipbvsid,btrack,ccode,inventory.iid as cinvauthid,cincomesub, (case when isnull(salebillvouchs.bgsp,0)=1 then '是' else '否' end) as bgsp,inventory.ccomunitcode, salebillvouchs.ippartseqid,salebillvouchs.ippartid,salebillvouchs.ippartqty,inventory.cbarcode,salebillvouchs.ccontractid,salebillvouchs.ccontracttagcode,salebillvouchs.ccontractrowguid, case when isnull(inventory.batomodel,0)=0 then '否' else '是' end as batomodel,case when isnull(inventory.bptomodel,0)=0 then '否' else '是' end as bptomodel, case when isnull(salebillvouchs.bQANeedCheck,0)=0 then '否' else '是' end as bqaneedcheck, case when isnull(salebillvouchs.bQAUrgency,0)=0 then '否' else '是' end as bqaurgency, salebillvouchs.ccusinvcode,salebillvouchs.ccusinvname FROM SaleBillVouchs LEFT JOIN Warehouse ON SaleBillVouchs.cWhCode = Warehouse.cWhCode LEFT JOIN Inventory ON SaleBillVouchs.cInvCode = Inventory.cInvCode left join ComputationUnit as Unit1 on inventory.cComUnitCode=Unit1.cComUnitCode left join ComputationUnit as Unit2 on salebillvouchs.cunitid=Unit2.cComUnitCode go sp_dboption 'ufdata_001_2005','single user','true' go dbcc checkdb('ufdata_001_2005', REPAIR_ALLOW_DATA_LOSS) go sp_dboption 'ufdata_001_2005','single user','false'