You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
sql-tools/_新日记账.sql

168 lines
6.0 KiB

1 year ago
CREATE TABLE TBizReportDateCache#
(
CompId BIGINT,
Date VARCHAR(10),
SpId BIGINT
)
CREATE TABLE TBizReportTotal#
(
SpId BIGINT,
CompId BIGINT, --<EFBFBD><EFBFBD>˾ID
AcctDate VARCHAR(50), --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TotalCust FLOAT DEFAULT 0, --<EFBFBD>ܿ<EFBFBD><EFBFBD><EFBFBD>
TotalRegCust FLOAT DEFAULT 0, --<EFBFBD>ܵǼǿ<EFBFBD><EFBFBD><EFBFBD>
TotalNewCust FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD>
TotalIncome FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TotalIncomeAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ն<EFBFBD>
Expenses FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>֧
OtherIncome FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
OtherIncomeAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
LaborIncome FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
LaborIncomeAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RemainCash FLOAT DEFAULT 0, --ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RemainIncome FLOAT DEFAULT 0, --ʣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CurrentAccountBalance FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD>ڿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CurrentCourseBalance FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƴ̿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
BizIncome FLOAT DEFAULT 0, --Ӫҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> =
BizIncomeAct FLOAT DEFAULT 0, --Ӫҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD> =
TotalTurnover FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>Ӫҵ<EFBFBD><EFBFBD>
TotalLaborPerf FLOAT DEFAULT 0 , --<EFBFBD>Ͷ<EFBFBD>ҵ<EFBFBD><EFBFBD>
TotalLaborPerfAct FLOAT DEFAULT 0 , --<EFBFBD>Ͷ<EFBFBD>ҵ<EFBFBD><EFBFBD>ʵ<EFBFBD>ն<EFBFBD>
TotalCash FLOAT DEFAULT 0 , --<EFBFBD><EFBFBD><EFBFBD>ֽ<EFBFBD>
TotalBank FLOAT DEFAULT 0 , --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD>
TotalBankAct FLOAT DEFAULT 0 , --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>п<EFBFBD>ʵ<EFBFBD>ն<EFBFBD>
TotalUseCard FLOAT DEFAULT 0, --<EFBFBD>ܿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TotalUseCardAct FLOAT DEFAULT 0, --<EFBFBD>ܿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ն<EFBFBD>
TotalUseCourse FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TotalUsePoint FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD>ѻ<EFBFBD><EFBFBD><EFBFBD>
TotalMemArrears FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>ԱǷ<EFBFBD><EFBFBD>
TotalMemPayBack FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TotalMemPayBackAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ն<EFBFBD>
TotalDuesAmt FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD>ѽ<EFBFBD><EFBFBD><EFBFBD>
TotalDuesQty FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TotalFree FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TotalCardSaleAll FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD>еĿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TotalCardSaleAllAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD>еĿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ն<EFBFBD>
TotalCardSale FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TotalCardSaleAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ն<EFBFBD>
TotalCardRchg FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
TotalCardRchgAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵʵ<EFBFBD>ն<EFBFBD>
TotalCourseSale FLOAT DEFAULT 0,--<EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TotalCourseSaleAct FLOAT DEFAULT 0,--<EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ն<EFBFBD>
TotalCoursePackSale FLOAT DEFAULT 0,--<EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TotalCoursePackSaleAct FLOAT DEFAULT 0,--<EFBFBD><EFBFBD><EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ն<EFBFBD>
TotalCourseExch FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD><EFBFBD>
TotalCourseExchAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD>Ƴ<EFBFBD><EFBFBD>ʵ<EFBFBD>ն<EFBFBD>
TotalConsItem FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
TotalConsItemAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀʵ<EFBFBD>ն<EFBFBD>
TotalConsGoods FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѳ<EFBFBD>Ʒ
TotalConsGoodsAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ѳ<EFBFBD>Ʒʵ<EFBFBD>ն<EFBFBD>
TotalConsume FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TotalConsumeAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ն<EFBFBD>
CustUnitPrice FLOAT DEFAULT 0, --<EFBFBD>͵<EFBFBD><EFBFBD><EFBFBD>
ApptQty FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>
ApptQtyRate FLOAT DEFAULT 0,--ָ<EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD>
ApptAmt FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>ָ<EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>
ApptAmtRate FLOAT DEFAULT 0, --ҵ<EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD>
TurnQty FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
TurnQtyRate FLOAT DEFAULT 0,--<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD>
TurnAmt FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>
TurnAmtRate FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>ռ<EFBFBD><EFBFBD>
MaleQty FLOAT DEFAULT 0, --<EFBFBD>п<EFBFBD><EFBFBD><EFBFBD>
MaleQtyRate FLOAT DEFAULT 0, --<EFBFBD>пͱ<EFBFBD>
MaleAmt FLOAT DEFAULT 0, --<EFBFBD>п<EFBFBD>ҵ<EFBFBD><EFBFBD>
MaleAmtRate FLOAT DEFAULT 0, --<EFBFBD>п<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FemaleQty FLOAT DEFAULT 0, --Ů<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FemaleQtyRate FLOAT DEFAULT 0, --Ů<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
FemaleAmt FLOAT DEFAULT 0, --Ů<EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>
FemaleAmtRate FLOAT DEFAULT 0, --Ů<EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
ChildQty FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>ͯ<EFBFBD><EFBFBD>
ChildQtyRate FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>ͯ<EFBFBD><EFBFBD>
ChildAmt FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>ͯҵ<EFBFBD><EFBFBD>
ChildAmtRate FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>ͯҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
OldQty FLOAT DEFAULT 0, --<EFBFBD>Ͽ<EFBFBD><EFBFBD><EFBFBD>
OldQtyRate FLOAT DEFAULT 0, --<EFBFBD>Ͽͱ<EFBFBD>
OldAmt FLOAT DEFAULT 0, --<EFBFBD>Ͽ<EFBFBD>ҵ<EFBFBD><EFBFBD>
OldAmtRate FLOAT DEFAULT 0, --<EFBFBD>Ͽ<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
NewQty FLOAT DEFAULT 0, --<EFBFBD>¿<EFBFBD><EFBFBD><EFBFBD>
NewQtyRate FLOAT DEFAULT 0, --<EFBFBD>¿<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
NewAmt FLOAT DEFAULT 0, --<EFBFBD>¿<EFBFBD>ҵ<EFBFBD><EFBFBD>
NewAmtRate FLOAT DEFAULT 0, --<EFBFBD>¿<EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MemQty FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD>
MemQtyRate FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>Ա<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
MemAmt FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>Աҵ<EFBFBD><EFBFBD>
MemAmtRate FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>Աҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
VisitorQty FLOAT DEFAULT 0, --ɢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
VisitorQtyRate FLOAT DEFAULT 0, --ɢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
VisitorAmt FLOAT DEFAULT 0, --ɢ<EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>
VisitorAmtRate FLOAT DEFAULT 0,--ɢ<EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
PRIMARY KEY(SpId,CompId,AcctDate)
)
CREATE TABLE TBizReportPayment#
(
SpId BIGINT,
CompId BIGINT,
AcctDate VARCHAR(10),
PayTypeId BIGINT,
Total FLOAT DEFAULT 0, --<EFBFBD>ֽ<EFBFBD><EFBFBD><EFBFBD>Ӫҵ<EFBFBD><EFBFBD>
TotalAct FLOAT DEFAULT 0, --<EFBFBD>ֽ<EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>ն<EFBFBD>
Item FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>Ŀ
ItemAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>Ŀ
Goods FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>Ʒ
GoodsAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>Ʒ
CardSale FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CardSaleAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Repay FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
RepayAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CourseSale FLOAT DEFAULT 0, --<EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CourseSaleAct FLOAT DEFAULT 0, --<EFBFBD>Ƴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CoursePackSale FLOAT DEFAULT 0, --<EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CoursePackSaleAct FLOAT DEFAULT 0, --<EFBFBD>ײ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
CourseExch FLOAT DEFAULT 0, --<EFBFBD>Ƴ<EFBFBD><EFBFBD>
CourseExchAct FLOAT DEFAULT 0, --<EFBFBD>Ƴ<EFBFBD><EFBFBD>
Earnest FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
EarnestAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
OtherIncome FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
OtherIncomeAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
Expenses FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>֧
ExpensesAct FLOAT DEFAULT 0, --<EFBFBD><EFBFBD>֧
Remain FLOAT DEFAULT 0, --ʣ<EFBFBD><EFBFBD>
PRIMARY KEY (SpId,CompId,AcctDate,PayTypeId)
)
CREATE TABLE TBizReportDetail#
(
SpId BIGINT,
SortIndex INT,
BizType NVARCHAR(20),
ItemTypeNo NVARCHAR(50),
ItemTypeName NVARCHAR(50),
ItemNo NVARCHAR(50),
ItemName NVARCHAR(50),
Qty DECIMAL(18,6),
Times DECIMAL(18,6),
QtyRate DECIMAL(18,6),
Amt DECIMAL(18,6),
AmtRate DECIMAL(18,6),
ActAmt DECIMAL(18,6),
PRIMARY KEY(SpId,BizType,ItemNo)
)
SELECT * FROM TBizReportDetail#
EXEC PRptBizReport01 'Company="001"FromDate="2018-01-01"ToDate="2018-10-01"ReportStyle="1"'