当前位置:网站首页>Expenditure budget and adjustment records and use records output use progress construction process records

Expenditure budget and adjustment records and use records output use progress construction process records

2022-06-22 01:41:00 51CTO

Requirements describe :

Budget data of funds are available 、 Expenditure adjustment records 、 Expenditure use records , The demand output view shows the progress of fund utilization .

That is, the budget amount 、 Adjusted amount 、 Use frozen amount 、 Amount used 、 Remaining available amount .

Related blueprints :

 Expenditure budget and adjustment records and use records output use progress construction process records _ Use records

Demand analysis :

  1. Basic data : project 、 Budget dimension 、 subject 、 Subject type 、 year
  2. Budget amount : Source budget data .
  3. Adjusted amount : Budget amount + Total adjustment
  4. Freezing amount : Total source usage records ( state : Under approval / frozen ).
  5. Amount used : Source usage records ( state : complete / Deduction )
  6. Remaining available amount : amount of money + Adjustment amount + Reduced amount - Freezing amount - Amount used .


Output ideas :

  1. Adjustment records may have new accounts , So budget data + Adjustment record After the weight is removed, a complete project - subject - Chronology :union.
  2. After that, the budget amount of the left splicing 、 Adjustment amount 、 Freezing amount 、 Amount used .
  3. Then calculate the adjusted amount 、 Remaining available amount .
  4. The budget dimension is... Of the total budget , The year is empty .
  5. Output result splice item type , Used to calculate total direct expenses and total indirect expenses .

Output record :

1.1 Get budget data tables and fields :uf_jfys xm,km,nf,je,bzlc, ytsmjcsyj

1.2 Get adjustment record table and fields :uf_jftzls xm,km,nf,dzje,zt

1.3 Get usage record tables and fields :uf_jfsyls xm,km,nf,je, zt

1.4 Get account information table and fields :uf_km id,kmlx

1.5 Get project information tables and fields :uf_jfsb id,yswd

2.1 Get the complete project - subject - year

Budget data :select xm,km,nf from uf_jfys

 Expenditure budget and adjustment records and use records output use progress construction process records _ data _02

Adjust the data :select xm,km,nf from uf_jftzls

 Expenditure budget and adjustment records and use records output use progress construction process records _ data _03

Splicing :select xm,km,nf from uf_jfysunion select xm,km,nf from uf_jftzls

 Expenditure budget and adjustment records and use records output use progress construction process records _ Field _04


3.1 Splicing project budget dimensions

SELECT

t1.xm,

t1.km,

t1.nf,

xm.yswd

FROM

( SELECT xm, km, nf FROM uf_jfys UNION SELECT xm, km, nf FROM uf_jftzls ) t1

LEFT JOIN uf_jfsb xm ON xm.id = t1.xm

 Expenditure budget and adjustment records and use records output use progress construction process records _ data _05

3.2 Splicing account types

SELECT

t1.xm,

t1.km,

t1.nf,

xm.yswd,

km.kmlx

FROM

( SELECT xm, km, nf FROM uf_jfys UNION SELECT xm, km, nf FROM uf_jftzls ) t1

LEFT JOIN uf_jfsb xm ON xm.id = t1.xm

LEFT JOIN uf_km km ON km.id = t1.km

 Expenditure budget and adjustment records and use records output use progress construction process records _ Use records _06


4.1 Splicing budgeting

SELECT

t1.xm,

t1.km,

t1.nf,

xm.yswd,

km.kmlx,

ys.je,

ys.bzlc,

ys.ytsmjcsyj

FROM

( SELECT xm, km, nf FROM uf_jfys UNION SELECT xm, km, nf FROM uf_jftzls ) t1

LEFT JOIN uf_jfsb xm ON xm.id = t1.xm

LEFT JOIN uf_km km ON km.id = t1.km

LEFT JOIN uf_jfys ys ON ys.xm = t1.xm

AND ys.km = t1.km

AND ys.nf = t1.nf

 Expenditure budget and adjustment records and use records output use progress construction process records _ Use records _07


5.1 Calculate the adjustment amount before splicing the adjustment amount ( Complete the adjustment amount 、 Add the amount in the approval 、 Amount to be deducted during approval )

select xm,km,nf,sum(case when zt=5 then dzje end) as wcdz,sum(case when zt>1 and zt<5 and dzje>0 then dzje end) as spdza,sum(case when zt>1 and zt<5 and dzje<0 then dzje end) as spdzb from uf_jftzls group by xm,km,nf

 Expenditure budget and adjustment records and use records output use progress construction process records _ Use records _08


5.2 Splicing adjustment amount

SELECT

t1.xm,

t1.km,

t1.nf,

xm.yswd,

km.kmlx,

ys.je,

ys.bzlc,

ys.ytsmjcsyj,

dz.wcdz,

dz.spdza,

dz.spdzb

FROM

( SELECT xm, km, nf FROM uf_jfys UNION SELECT xm, km, nf FROM uf_jftzls ) t1

LEFT JOIN uf_jfsb xm ON xm.id = t1.xm

LEFT JOIN uf_km km ON km.id = t1.km

LEFT JOIN uf_jfys ys ON ys.xm = t1.xm

AND ys.km = t1.km

AND ys.nf = t1.nf

LEFT JOIN (

SELECT

xm,

km,

nf,

sum( CASE WHEN zt = 5 THEN dzje END ) AS wcdz,

sum( CASE WHEN zt > 1 AND zt < 5 AND dzje > 0 THEN dzje END ) AS spdza,

sum( CASE WHEN zt > 1 AND zt < 5 AND dzje < 0 THEN dzje END ) AS spdzb

FROM

uf_jftzls

GROUP BY

xm,

km,

nf

) dz ON dz.xm = t1.xm

AND dz.km = t1.km

AND dz.nf = t1.nf

 Expenditure budget and adjustment records and use records output use progress construction process records _ Field _09



6.1 Splice frozen amount 、 Calculate before deducting the amount

SELECT xm, km, nf, sum( CASE WHEN zt = 5 THEN je END ) AS wcsy, sum( CASE WHEN zt > 1

AND zt < 5 THEN

je

END

) AS spdj

FROM

uf_jfsyls

GROUP BY

xm,

km,

nf

 Expenditure budget and adjustment records and use records output use progress construction process records _ data _10

6.2 Splice frozen amount 、 Deduction amount

SELECT

t1.xm,

t1.km,

t1.nf,

xm.yswd,

km.kmlx,

ys.je,

ys.bzlc,

ys.ytsmjcsyj,

dz.wcdz,

dz.spdza,

dz.spdzb,

sy.syje,

sy.spdj

FROM

( SELECT xm, km, nf FROM uf_jfys UNION SELECT xm, km, nf FROM uf_jftzls ) t1

LEFT JOIN uf_jfsb xm ON xm.id = t1.xm

LEFT JOIN uf_km km ON km.id = t1.km

LEFT JOIN uf_jfys ys ON ys.xm = t1.xm

AND ys.km = t1.km

AND ys.nf = t1.nf

LEFT JOIN (

SELECT

xm,

km,

nf,

sum( CASE WHEN zt = 5 THEN dzje END ) AS wcdz,

sum( CASE WHEN zt > 1 AND zt < 5 AND dzje > 0 THEN dzje END ) AS spdza,

sum( CASE WHEN zt > 1 AND zt < 5 AND dzje < 0 THEN dzje END ) AS spdzb

FROM

uf_jftzls

GROUP BY

xm,

km,

nf

) dz ON dz.xm = t1.xm

AND dz.km = t1.km

AND dz.nf = t1.nf

LEFT JOIN (

SELECT

xm,

km,

nf,

sum( CASE WHEN zt = 5 THEN je END ) AS syje,

sum( CASE WHEN zt > 1 AND zt < 5 THEN je END ) AS spdj

FROM

uf_jfsyls

GROUP BY

xm,

km,

nf

) sy ON sy.xm = t1.xm

AND sy.km = t1.km

AND sy.nf = t1.nf

 Expenditure budget and adjustment records and use records output use progress construction process records _ Use records _11


7.1 If it is blank, it will be calculated as 0

SELECT

t1.xm,

t1.km,

t1.nf,

xm.yswd,

km.kmlx,

isnull( ys.je, 0 ) AS je,

ys.bzlc,

ys.ytsmjcsyj,

isnull( dz.wcdz, 0 ) AS wcdz,

isnull( dz.spdza, 0 ) AS spdza,

isnull( dz.spdzb, 0 ) AS spdzb,

isnull( sy.syje, 0 ) AS syje,

isnull( sy.spdj, 0 ) AS spdj

FROM

( SELECT xm, km, nf FROM uf_jfys UNION SELECT xm, km, nf FROM uf_jftzls ) t1

LEFT JOIN uf_jfsb xm ON xm.id = t1.xm

LEFT JOIN uf_km km ON km.id = t1.km

LEFT JOIN uf_jfys ys ON ys.xm = t1.xm

AND ys.km = t1.km

AND ys.nf = t1.nf

LEFT JOIN (

SELECT

xm,

km,

nf,

sum( CASE WHEN zt = 5 THEN dzje END ) AS wcdz,

sum( CASE WHEN zt > 1 AND zt < 5 AND dzje > 0 THEN dzje END ) AS spdza,

sum( CASE WHEN zt > 1 AND zt < 5 AND dzje < 0 THEN dzje END ) AS spdzb

FROM

uf_jftzls

GROUP BY

xm,

km,

nf

) dz ON dz.xm = t1.xm

AND dz.km = t1.km

AND dz.nf = t1.nf

LEFT JOIN (

SELECT

xm,

km,

nf,

sum( CASE WHEN zt = 5 THEN je END ) AS syje,

sum( CASE WHEN zt > 1 AND zt < 5 THEN je END ) AS spdj

FROM

uf_jfsyls

GROUP BY

xm,

km,

nf

) sy ON sy.xm = t1.xm

AND sy.km = t1.km

AND sy.nf = t1.nf

 Expenditure budget and adjustment records and use records output use progress construction process records _ Use records _12

7.2 Calculate the adjusted amount and the available amount

SELECT

t1.xm,

t1.km,

t1.nf,

xm.yswd,

km.kmlx,

isnull( ys.je, 0 ) AS je,

isnull( ys.je, 0 ) + isnull( dz.wcdz, 0 ) AS dzhje,

ys.bzlc,

ys.ytsmjcsyj,

isnull( dz.wcdz, 0 ) AS wcdz,

isnull( dz.spdza, 0 ) AS spdza,

isnull( dz.spdzb, 0 ) AS spdzb,

isnull( sy.syje, 0 ) AS syje,

isnull( sy.spdj, 0 ) AS spdj,

isnull( ys.je, 0 ) + isnull( dz.wcdz, 0 ) + isnull( dz.spdza, 0 ) - isnull( sy.syje, 0 ) - isnull( sy.spdj, 0 ) AS kyje

FROM

( SELECT xm, km, nf FROM uf_jfys UNION SELECT xm, km, nf FROM uf_jftzls ) t1

LEFT JOIN uf_jfsb xm ON xm.id = t1.xm

LEFT JOIN uf_km km ON km.id = t1.km

LEFT JOIN uf_jfys ys ON ys.xm = t1.xm

AND ys.km = t1.km

AND ys.nf = t1.nf

LEFT JOIN (

SELECT

xm,

km,

nf,

sum( CASE WHEN zt = 5 THEN dzje END ) AS wcdz,

sum( CASE WHEN zt > 1 AND zt < 5 AND dzje > 0 THEN dzje END ) AS spdza,

sum( CASE WHEN zt > 1 AND zt < 5 AND dzje < 0 THEN dzje END ) AS spdzb

FROM

uf_jftzls

GROUP BY

xm,

km,

nf

) dz ON dz.xm = t1.xm

AND dz.km = t1.km

AND dz.nf = t1.nf

LEFT JOIN (

SELECT

xm,

km,

nf,

sum( CASE WHEN zt = 5 THEN je END ) AS syje,

sum( CASE WHEN zt > 1 AND zt < 5 THEN je END ) AS spdj

FROM

uf_jfsyls

GROUP BY

xm,

km,

nf

) sy ON sy.xm = t1.xm

AND sy.km = t1.km

AND sy.nf = t1.nf

 Expenditure budget and adjustment records and use records output use progress construction process records _ data _13


8.1 Create view

CREATE VIEW jfyssyjd AS

 Expenditure budget and adjustment records and use records output use progress construction process records _ data _14

8.2 Query validation

 Expenditure budget and adjustment records and use records output use progress construction process records _ Use records _15

8.3 Add a unique value field before creating a virtual table :

concat(t1.xm,'-',t1.km,'-',t1.nf) as id,

 Expenditure budget and adjustment records and use records output use progress construction process records _ Field _16

8.4 Update the view

ALTER VIEW jfyssyjd AS

 Expenditure budget and adjustment records and use records output use progress construction process records _ data _17

9.1 Create a virtual table

 Expenditure budget and adjustment records and use records output use progress construction process records _ data _18

9.2 Set fields

 Expenditure budget and adjustment records and use records output use progress construction process records _ Use records _19

9.3 Create a query list

 Expenditure budget and adjustment records and use records output use progress construction process records _ data _20

9.4 Set display field

 Expenditure budget and adjustment records and use records output use progress construction process records _ data _21

9.5 Multiple query criteria are allowed

 Expenditure budget and adjustment records and use records output use progress construction process records _ data _22

9.6 Set up statistics

 Expenditure budget and adjustment records and use records output use progress construction process records _ data _23

9.7 See the effect

 Expenditure budget and adjustment records and use records output use progress construction process records _ data _24








原网站

版权声明
本文为[51CTO]所创,转载请带上原文链接,感谢
https://yzsam.com/2022/173/202206220033505077.html