金蝶K3清空数据库财务+物流+生产+质量管理模块历史单据数据
2018-07-14 23:50:01
金蝶K3清空数据库财务+物流+生产+质量管理模块历史单据数据的语句,请谨慎使用。
TRUNCATE TABLE DRP_CarryingInvoiceTRUNCATE TABLE ICExpenses
TRUNCATE TABLE ICItemReplace
TRUNCATE TABLE ICitemScrap
TRUNCATE TABLE ICJobPay
TRUNCATE TABLE ICMO
TRUNCATE TABLE ICMORpt
TRUNCATE TABLE ICMrpResult
TRUNCATE TABLE ICOperShift
TRUNCATE TABLE ICPlanAdjPrice
TRUNCATE TABLE ICPurchase
TRUNCATE TABLE ICQCBill
TRUNCATE TABLE ICSale
TRUNCATE TABLE ICSaleQcbill
TRUNCATE TABLE ICSTJGBill
TRUNCATE TABLE ICStockBill
TRUNCATE TABLE ICTaskDispBill
TRUNCATE TABLE POInStock
TRUNCATE TABLE POOrder
TRUNCATE TABLE POrequest
TRUNCATE TABLE PORFQ
TRUNCATE TABLE POStockBill
TRUNCATE TABLE PPBOM
TRUNCATE TABLE PPOrder
TRUNCATE TABLE QMIcmoCkRequest
TRUNCATE TABLE QMINQCReq
TRUNCATE TABLE QMOtCkRequest
TRUNCATE TABLE QMQCBill
TRUNCATE TABLE QMSaleCkRequest
TRUNCATE TABLE SEOrder
TRUNCATE TABLE SEOutStock
TRUNCATE TABLE SHProcRptMain
TRUNCATE TABLE SHWorkBill
TRUNCATE TABLE t_Voucher
TRUNCATE TABLE ZPStockBill
TRUNCATE TABLE DRP_CarryingInvoiceEntry
TRUNCATE TABLE ICExpensesEntry
TRUNCATE TABLE ICItemReplaceEntry
TRUNCATE TABLE ICitemScrapEntry
TRUNCATE TABLE ICJobPayEntry
TRUNCATE TABLE ICMORptEntry
TRUNCATE TABLE ICPlanAdjPriEntry
TRUNCATE TABLE ICPurchaseEntry
TRUNCATE TABLE ICQCBillEntry
TRUNCATE TABLE ICSaleEntry
TRUNCATE TABLE ICSaleQcbillEntry
TRUNCATE TABLE ICSTJGBillEntry
TRUNCATE TABLE ICStockBillEntry
TRUNCATE TABLE ICTaskDispBillEntry
TRUNCATE TABLE POInStockEntry
TRUNCATE TABLE POOrderEntry
TRUNCATE TABLE POrequestEntry
TRUNCATE TABLE PORFQEntry
TRUNCATE TABLE POStockBillEntry
TRUNCATE TABLE PPBOMEntry
TRUNCATE TABLE PPOrderEntry
TRUNCATE TABLE QMIcmoCkRequestEntry
TRUNCATE TABLE QMINQCReqEntry
TRUNCATE TABLE QMOtCkRequestEntry
TRUNCATE TABLE QMQCBillEntry
TRUNCATE TABLE QMSaleCkRequestEntry
TRUNCATE TABLE SEOrderEntry
TRUNCATE TABLE SEOutStockEntry
TRUNCATE TABLE SHProcRpt
TRUNCATE TABLE SHWorkBillEntry
TRUNCATE TABLE t_VoucherEntry
TRUNCATE TABLE ZPStockBillEntry
--删除余额表
--财务部份
delete from t_balance where FYear+FPeriod*0.01<2007.03
delete from t_QuantityBalance where FYear+FPeriod*0.01<2007.03
delete from t_ProfitAndLoss where FYear+FPeriod*0.01<2007.03
--应收应付部份
TRUNCATE TABLE t_RP_ARPBill
TRUNCATE TABLE t_RP_ARPBillEntry
TRUNCATE TABLE t_rp_ARBillOfSH
TRUNCATE TABLE t_rp_ARBillOfSh_ICItem
delete from t_RP_Contact where FYear+FPeriod*0.01<2007.03
delete from t_RP_ContactBal where FYear+FPeriod*0.01<2007.03
TRUNCATE TABLE t_RP_NewReceiveBill
update t_RP_SystemProfile set FValue=2007 where FCategory='ARP' and FKey='FAPUseYear'
update t_RP_SystemProfile set FValue=3 where FCategory='ARP' and FKey='FAPUsePeriod'
update t_RP_SystemProfile set FValue=2007 where FCategory='ARP' and FKey='FARUseYear'
update t_RP_SystemProfile set FValue=3 where FCategory='ARP' and FKey='FARUsePeriod'
--物流
delete from ICBal where FYear+FPeriod*0.01<2007.03
delete from ICInvBal where FYear+FPeriod*0.01<2007.03
TRUNCATE TABLE ICInventory
TRUNCATE TABLE ICInvInitial
update t_RP_SystemProfile set FValue=2007 where FCategory='GL' and FKey='StartYear'
update t_RP_SystemProfile set FValue=3 where FCategory='GL' and FKey='StartPeriod'
update t_RP_SystemProfile set FValue=2007 where FCategory='IC' and FKey='StartYear'
update t_RP_SystemProfile set FValue=3 where FCategory='IC' and FKey='StartPeriod'
-----删除财务总帐/应收/应付累计
update t_Balance
set FYtdDebitFor=0
update t_Balance
set FYtdcreditFor=0
update t_Balance
set FYtdDebit=0
update t_Balance
set FYtdcredit=0
update t_QuantityBalance
set FDebitqty=0
update t_QuantityBalance
set Fcreditqty=0
update t_QuantityBalance
set FYtdDebitqty=0
update t_QuantityBalance
set FYtdcreditqty=0
update t_ProfitAndLoss
set FYtdAmountFor=0
update t_ProfitAndLoss
set FYtdAmount=0
update t_RP_ContactBal
set FYtdDebitFor=0
update t_RP_ContactBal
set FYtdcreditFor=0
update t_RP_ContactBal
set FYtdDebit=0
update t_RP_ContactBal
set FYtdcredit=0
-----更改应收应付本年累计=本期合计
update t_RP_ContactBal
set FYtdDebitFor=FDebitFor
update t_RP_ContactBal
set FYtdDebit=FDebit
update t_RP_ContactBal
set FYtdCreditFor=FCreditFor
update t_RP_ContactBal
set FYtdCredit=FCredit