Pages
Labels
- Bisnis (1)
- CIT Scripts - Financore (5)
- Cokelat (3)
- MySQL (2)
- PHP (23)
- PT Comment Indonesia (10)
- SQL Query (2)
- SQL Server 2000 (4)
- SQL Server 2005 (4)
- Tips - Tricks Cokelat (2)
Archives
-
▼
2010
(41)
-
▼
August
(14)
- Kulit Cantik dengan Cokelat
- Serba Serbi Tentang Cokelat
- Cokelat Juga Setangguh Viagra
- Langkah Bangun Bisnis Sendiri
- Tips Mengetim Cokelat
- Agar Cokelat Tahan Lama
- Sekilas Administrasi Microsoft SQL Server 2005
- Piutang Pembiayaan Jatuh Tempo
- FPD 1-6 Survey
- COL998
- View COL998 Khusus
- View COL998
- Create Database AdventureWorksDW
- Attached Database AdventureWorksDB
-
▼
August
(14)
Link List
- Code Igniter Indonesia
- MySQL Reference Manuals
- MySQL Tutorial
- SQL Developer
- 9 Useful jQuery Calendar and Date Picker Plugins For Web Designers
- 10 Powerful AJAZ jQuery File Uploaders
- 35 Useful jQuery Plugins for Slideshows, Graphs and Text Effects
- 30 jQuery Calendar Date Picker Plugins
- jQuery
- Web Developers Notes
- SQL Copy MySQL Table
- Natural Cooking Club Indonesia
- Aneka Resep Praline - Sedap Sekejap
- Resep Cokelat
- Pastry and Bakery
- Peluang Bisnis Hotspot
- Billing Hospot
- JpGraph
- Zend Developer Zone
- MySQL Tutorials and Others
- W3 School
- Open Source Projects
CREATE procedure sp_rptFPDSurveyAll (
@v_branchid varchar(4),
@v_kodefpd varchar(1),
@v_tgl smalldatetime
)
AS
Begin
set transaction isolation level read uncommitted
begin transaction
declare @v_dateawal smalldatetime
declare @v_dateakhir smalldatetime
declare @v_bln varchar(2)
declare @v_tglakhir varchar(4)
declare @v_blnakhir varchar(2)
declare @v_thnakhir varchar(2)
declare @v_tgl_akhir smalldatetime
if @v_kodefpd = ’1′
begin
set @v_bln = datepart(mm, @v_tgl)
set @v_dateawal = convert(smalldatetime, (dateadd(month, -1, (convert(varchar, @v_bln) + ‘/1/’ + convert(varchar, year(@v_tgl))))))
set @v_dateakhir = convert(smalldatetime, @v_tgl)
end
else if @v_kodefpd = ’2′
begin
set @v_bln = datepart(mm, @v_tgl)
set @v_dateawal = convert(smalldatetime, (dateadd(month, -2, (convert(varchar, @v_bln) + ‘/1/’ + convert(varchar, year(@v_tgl))))))
set @v_dateakhir = convert(smalldatetime, @v_tgl) end
else if @v_kodefpd = ’3′
begin
set @v_bln = datepart(mm, @v_tgl)
set @v_dateawal = convert(smalldatetime, (dateadd(month, -3, (convert(varchar, @v_bln) + ‘/1/’ + convert(varchar, year(@v_tgl))))))
set @v_dateakhir = convert(smalldatetime, @v_tgl) end
else if @v_kodefpd = ’4′
begin
set @v_bln = datepart(mm, @v_tgl)
set @v_dateawal = convert(smalldatetime, (dateadd(month, -4, (convert(varchar, @v_bln) + ‘/1/’ + convert(varchar, year(@v_tgl))))))
set @v_dateakhir = convert(smalldatetime, @v_tgl) end
else if @v_kodefpd = ’5′
begin
set @v_bln = datepart(mm, @v_tgl)
set @v_dateawal = convert(smalldatetime, (dateadd(month, -5, (convert(varchar, @v_bln) + ‘/1/’ + convert(varchar, year(@v_tgl))))))
set @v_dateakhir = convert(smalldatetime, @v_tgl)
end
else if @v_kodefpd = ’6′
begin
set @v_bln = datepart(mm, @v_tgl)
set @v_dateawal = convert(smalldatetime, (dateadd(month, -6, (convert(varchar, @v_bln) + ‘/1/’ + convert(varchar, year(@v_tgl))))))
set @v_dateakhir = convert(smalldatetime, @v_tgl)
end
else
begin
set @v_bln = datepart(mm, @v_tgl)
set @v_dateawal = convert(smalldatetime, (dateadd(month, -6, (convert(varchar, @v_bln) + ‘/1/’ + convert(varchar, year(@v_tgl))))))
set @v_dateakhir = convert(smalldatetime, @v_tgl)
end
if @v_branchid = ‘-1′
select aa.branchid, aa.branchname, aa.surveyorname, sum(mapReal) as mapReal, sum(mapTgk) as mapTgk,
sum(TB) as TB
from
(select ownergroupid as branchid, dbo.f_getbranch(ownergroupid) as branchname,
suveyorname as surveyorname, count(norek+nopin) mapReal, 0 as mapTgk, 0 as TB
from vp_report5
where realizationdate between @v_dateawal and @v_dateakhir
group by ownergroupid, suveyorname
union all
select branchid, dbo.f_getbranch(branchid) as branchname, surveyorname, 0 as mapReal, count(norek+nopin) mapTgk, 0 as TB
from rptfinancore
where agingday > 0 and realisasidate between @v_dateawal and @v_dateakhir
group by branchid, surveyorname
union all
select branchid, branchname, surveyorname, 0 as mapReal, 0 as mapTgk, count(norek+nopin) TB
from rptfinancore with(nolock)
where reposesdate is not null and moveardate is not null
and realisasidate between @v_dateawal and @v_dateakhir
group by branchid, branchname, surveyorname
) aa
group by aa.branchid, aa.branchname, aa.surveyorname
else
select aa.branchid, aa.branchname, aa.surveyorname, sum(mapReal) as mapReal, sum(mapTgk) as mapTgk,
sum(TB) as TB
from
(select ownergroupid as branchid, dbo.f_getbranch(ownergroupid) as branchname,
suveyorname as surveyorname, count(norek+nopin) mapReal, 0 as mapTgk, 0 as TB
from vp_report5
where ownergroupid = @v_branchid and realizationdate between @v_dateawal and @v_dateakhir
group by ownergroupid, suveyorname
union all
select branchid, dbo.f_getbranch(branchid) as branchname, surveyorname, 0 as mapReal, count(norek+nopin) mapTgk, 0 as TB
from rptfinancore
where agingday > 0 and branchid = @v_branchid and realisasidate between @v_dateawal and @v_dateakhir
group by branchid, surveyorname
union all
select branchid, branchname, surveyorname, 0 as mapReal, 0 as mapTgk, count(norek+nopin) TB
from rptfinancore with(nolock)
where reposesdate is not null and moveardate is not null
and branchid = @v_branchid and realisasidate between @v_dateawal and @v_dateakhir
group by branchid, branchname, surveyorname
) aa
group by aa.branchid, aa.branchname, aa.surveyorname
commit transaction
end
GO
Labels: CIT Scripts - Financore