-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathnew script.sql
More file actions
557 lines (545 loc) · 35.8 KB
/
Copy pathnew script.sql
File metadata and controls
557 lines (545 loc) · 35.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
USE [master]
GO
/****** Object: Database [AccountsSystem 2] Script Date: 11/4/2023 3:48:17 PM ******/
CREATE DATABASE [AccountsSystem 2]
CONTAINMENT = NONE
ON PRIMARY
( NAME = N'AccountsSystem', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\AccountsSystem.mdf' , SIZE = 8192KB , MAXSIZE = UNLIMITED, FILEGROWTH = 65536KB )
LOG ON
( NAME = N'AccountsSystem_log', FILENAME = N'C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\DATA\AccountsSystem_log.ldf' , SIZE = 8192KB , MAXSIZE = 2048GB , FILEGROWTH = 65536KB )
WITH CATALOG_COLLATION = DATABASE_DEFAULT
GO
ALTER DATABASE [AccountsSystem 2] SET COMPATIBILITY_LEVEL = 150
GO
IF (1 = FULLTEXTSERVICEPROPERTY('IsFullTextInstalled'))
begin
EXEC [AccountsSystem 2].[dbo].[sp_fulltext_database] @action = 'enable'
end
GO
ALTER DATABASE [AccountsSystem 2] SET ANSI_NULL_DEFAULT OFF
GO
ALTER DATABASE [AccountsSystem 2] SET ANSI_NULLS OFF
GO
ALTER DATABASE [AccountsSystem 2] SET ANSI_PADDING OFF
GO
ALTER DATABASE [AccountsSystem 2] SET ANSI_WARNINGS OFF
GO
ALTER DATABASE [AccountsSystem 2] SET ARITHABORT OFF
GO
ALTER DATABASE [AccountsSystem 2] SET AUTO_CLOSE OFF
GO
ALTER DATABASE [AccountsSystem 2] SET AUTO_SHRINK OFF
GO
ALTER DATABASE [AccountsSystem 2] SET AUTO_UPDATE_STATISTICS ON
GO
ALTER DATABASE [AccountsSystem 2] SET CURSOR_CLOSE_ON_COMMIT OFF
GO
ALTER DATABASE [AccountsSystem 2] SET CURSOR_DEFAULT GLOBAL
GO
ALTER DATABASE [AccountsSystem 2] SET CONCAT_NULL_YIELDS_NULL OFF
GO
ALTER DATABASE [AccountsSystem 2] SET NUMERIC_ROUNDABORT OFF
GO
ALTER DATABASE [AccountsSystem 2] SET QUOTED_IDENTIFIER OFF
GO
ALTER DATABASE [AccountsSystem 2] SET RECURSIVE_TRIGGERS OFF
GO
ALTER DATABASE [AccountsSystem 2] SET ENABLE_BROKER
GO
ALTER DATABASE [AccountsSystem 2] SET AUTO_UPDATE_STATISTICS_ASYNC OFF
GO
ALTER DATABASE [AccountsSystem 2] SET DATE_CORRELATION_OPTIMIZATION OFF
GO
ALTER DATABASE [AccountsSystem 2] SET TRUSTWORTHY OFF
GO
ALTER DATABASE [AccountsSystem 2] SET ALLOW_SNAPSHOT_ISOLATION OFF
GO
ALTER DATABASE [AccountsSystem 2] SET PARAMETERIZATION SIMPLE
GO
ALTER DATABASE [AccountsSystem 2] SET READ_COMMITTED_SNAPSHOT OFF
GO
ALTER DATABASE [AccountsSystem 2] SET HONOR_BROKER_PRIORITY OFF
GO
ALTER DATABASE [AccountsSystem 2] SET RECOVERY FULL
GO
ALTER DATABASE [AccountsSystem 2] SET MULTI_USER
GO
ALTER DATABASE [AccountsSystem 2] SET PAGE_VERIFY CHECKSUM
GO
ALTER DATABASE [AccountsSystem 2] SET DB_CHAINING OFF
GO
ALTER DATABASE [AccountsSystem 2] SET FILESTREAM( NON_TRANSACTED_ACCESS = OFF )
GO
ALTER DATABASE [AccountsSystem 2] SET TARGET_RECOVERY_TIME = 60 SECONDS
GO
ALTER DATABASE [AccountsSystem 2] SET DELAYED_DURABILITY = DISABLED
GO
ALTER DATABASE [AccountsSystem 2] SET ACCELERATED_DATABASE_RECOVERY = OFF
GO
EXEC sys.sp_db_vardecimal_storage_format N'AccountsSystem 2', N'ON'
GO
ALTER DATABASE [AccountsSystem 2] SET QUERY_STORE = OFF
GO
USE [AccountsSystem 2]
GO
/****** Object: Table [dbo].[tbl_ChartofAccount] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_ChartofAccount](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Mid] [int] NULL,
[AccountName] [varchar](500) NULL,
[Status] [int] NULL,
CONSTRAINT [PK_tbl_ChartofAccount] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_Fixed] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_Fixed](
[Id] [int] IDENTITY(1,1) NOT NULL,
[FixedAccount] [varchar](100) NULL,
[Status] [int] NULL,
CONSTRAINT [PK_tbl_Fixed] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_GeneralLedger] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_GeneralLedger](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Date] [date] NULL,
[AccountId] [int] NULL,
[RefNo] [int] NULL,
[TypeId] [int] NULL,
[Debit] [decimal](18, 2) NULL,
[Credit] [decimal](18, 2) NULL,
[Description] [varchar](100) NULL,
[Status] [int] NULL,
CONSTRAINT [PK_tbl_GeneralLedger] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_JournalDetail] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_JournalDetail](
[Id] [int] IDENTITY(1,1) NOT NULL,
[RefId] [int] NULL,
[AccountId] [int] NULL,
[Debit] [decimal](18, 2) NULL,
[Credit] [decimal](18, 2) NULL,
[Description] [varchar](500) NULL,
[Status] [int] NULL,
CONSTRAINT [PK_tbl_JournalDetail] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_JournalMaster] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_JournalMaster](
[Id] [int] IDENTITY(1,1) NOT NULL,
[InvoiceNo] [varchar](max) NULL,
[Date] [date] NULL,
[Amount] [decimal](18, 2) NULL,
[Status] [int] NULL,
CONSTRAINT [PK_tbl_JournalMaster] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_MasterAccount] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_MasterAccount](
[Id] [int] IDENTITY(1,1) NOT NULL,
[Fid] [int] NULL,
[MasterAccount] [varchar](500) NULL,
[Status] [int] NULL,
CONSTRAINT [PK_tbl_MasterAccount] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_PaymentDetail] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_PaymentDetail](
[PDId] [int] IDENTITY(1,1) NOT NULL,
[PId] [int] NULL,
[DebitAccountId] [int] NULL,
[Amount] [decimal](18, 2) NULL,
[Description] [varchar](max) NULL,
[Status] [int] NULL,
CONSTRAINT [PK_tbl_PaymentDetail] PRIMARY KEY CLUSTERED
(
[PDId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_PaymentMaster] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_PaymentMaster](
[PId] [int] IDENTITY(1,1) NOT NULL,
[InvoiceNo] [varchar](500) NULL,
[Date] [date] NULL,
[CreditAccountId] [int] NULL,
[Amount] [decimal](18, 2) NULL,
[Description] [varchar](max) NULL,
[Status] [int] NULL,
CONSTRAINT [PK_tbl_PaymentMaster] PRIMARY KEY CLUSTERED
(
[PId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_ReceiptDetail] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_ReceiptDetail](
[RDId] [int] IDENTITY(1,1) NOT NULL,
[RId] [int] NULL,
[CreditAccountId] [int] NULL,
[Amount] [decimal](18, 2) NULL,
[Description] [varchar](max) NULL,
[Status] [int] NULL,
CONSTRAINT [PK_tbl_ReceiptDetail] PRIMARY KEY CLUSTERED
(
[RDId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_ReceiptMaster] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_ReceiptMaster](
[RId] [int] IDENTITY(1,1) NOT NULL,
[InvoiceNo] [varchar](500) NULL,
[Date] [date] NULL,
[DebitAccountId] [int] NULL,
[Amount] [decimal](18, 2) NULL,
[Description] [varchar](max) NULL,
[Status] [int] NULL,
CONSTRAINT [PK_tbl_ReceiptMaster] PRIMARY KEY CLUSTERED
(
[RId] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
GO
/****** Object: Table [dbo].[tbl_TransactionType] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TABLE [dbo].[tbl_TransactionType](
[Id] [int] IDENTITY(1,1) NOT NULL,
[TypeName] [varchar](500) NULL,
[ShortName] [varchar](50) NULL,
[Status] [int] NULL,
CONSTRAINT [PK_tbl_TransactionType] PRIMARY KEY CLUSTERED
(
[Id] ASC
)WITH (PAD_INDEX = OFF, STATISTICS_NORECOMPUTE = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS = ON, ALLOW_PAGE_LOCKS = ON, OPTIMIZE_FOR_SEQUENTIAL_KEY = OFF) ON [PRIMARY]
) ON [PRIMARY]
GO
ALTER TABLE [dbo].[tbl_ChartofAccount] WITH CHECK ADD CONSTRAINT [FK_tbl_ChartofAccount_tbl_MasterAccount] FOREIGN KEY([Mid])
REFERENCES [dbo].[tbl_MasterAccount] ([Id])
GO
ALTER TABLE [dbo].[tbl_ChartofAccount] CHECK CONSTRAINT [FK_tbl_ChartofAccount_tbl_MasterAccount]
GO
ALTER TABLE [dbo].[tbl_GeneralLedger] WITH CHECK ADD CONSTRAINT [FK_tbl_GeneralLedger_tbl_ChartofAccount] FOREIGN KEY([AccountId])
REFERENCES [dbo].[tbl_ChartofAccount] ([Id])
GO
ALTER TABLE [dbo].[tbl_GeneralLedger] CHECK CONSTRAINT [FK_tbl_GeneralLedger_tbl_ChartofAccount]
GO
ALTER TABLE [dbo].[tbl_GeneralLedger] WITH CHECK ADD CONSTRAINT [FK_tbl_GeneralLedger_tbl_TransactionType] FOREIGN KEY([TypeId])
REFERENCES [dbo].[tbl_TransactionType] ([Id])
GO
ALTER TABLE [dbo].[tbl_GeneralLedger] CHECK CONSTRAINT [FK_tbl_GeneralLedger_tbl_TransactionType]
GO
ALTER TABLE [dbo].[tbl_MasterAccount] WITH CHECK ADD CONSTRAINT [FK_tbl_MasterAccount_tbl_Fixed] FOREIGN KEY([Fid])
REFERENCES [dbo].[tbl_Fixed] ([Id])
GO
ALTER TABLE [dbo].[tbl_MasterAccount] CHECK CONSTRAINT [FK_tbl_MasterAccount_tbl_Fixed]
GO
ALTER TABLE [dbo].[tbl_ReceiptDetail] WITH CHECK ADD CONSTRAINT [FK_tbl_ReceiptDetail_tbl_ReceiptMaster] FOREIGN KEY([RId])
REFERENCES [dbo].[tbl_ReceiptMaster] ([RId])
GO
ALTER TABLE [dbo].[tbl_ReceiptDetail] CHECK CONSTRAINT [FK_tbl_ReceiptDetail_tbl_ReceiptMaster]
GO
/****** Object: StoredProcedure [dbo].[DeleteChartfAccount] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create Proc [dbo].[DeleteChartfAccount]
@Id int
as
delete from tbl_GeneralLedger where RefNo = @Id and TypeId= 1
delete from tbl_ChartofAccount where Id =@Id
GO
/****** Object: StoredProcedure [dbo].[DeleteMasterAc] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[DeleteMasterAc]
@id int
as
delete from tbl_MasterAccount
where id =@id
GO
/****** Object: StoredProcedure [dbo].[deletereceiptmaster] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[deletereceiptmaster]
@RId int
as
delete From tbl_ReceiptMaster where RId = @RId
GO
/****** Object: StoredProcedure [dbo].[GetAllChartFAccount] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create Proc [dbo].[GetAllChartFAccount]
as
select gl.RefNo,gl.Date,gl.Debit,gl.Credit,
C.AccountName,C.Id,C.Mid,
M.MasterAccount
from tbl_GeneralLedger gl
inner join tbl_ChartofAccount C on gl.RefNo = C.Id
inner join tbl_MasterAccount M on C.Mid = M.Id
where gl.TypeId=1
GO
/****** Object: StoredProcedure [dbo].[GetAllMasterAc] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[GetAllMasterAc]
as
select ma.Id,ma.Fid,ma.MasterAccount,ma.Status,f.FixedAccount from tbl_MasterAccount ma
inner join tbl_Fixed f on ma.Fid = f.id
GO
/****** Object: StoredProcedure [dbo].[GetAllreceiptmaster] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[GetAllreceiptmaster]
as
select rm.InvoiceNo,rm.Date,rm.Amount,rm.RId,rm.Description from tbl_ReceiptMaster rm
GO
/****** Object: StoredProcedure [dbo].[GetByIdChartFAccount] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create Proc [dbo].[GetByIdChartFAccount]
@id int
as
select gl.RefNo,gl.Date,gl.Debit,gl.Credit,gl.AccountId,
C.AccountName,C.Id,
M.MasterAccount
from tbl_GeneralLedger gl
inner join tbl_ChartofAccount C on gl.AccountId = C.Id
inner join tbl_MasterAccount M on C.Mid = M.Id
where RefNo=@id and TypeId=1
GO
/****** Object: StoredProcedure [dbo].[GetByIDMAsterAc] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[GetByIDMAsterAc]
@id int
as
select ma.id,ma.Fid,ma.MasterAccount,ma.Status,f.FixedAccount from tbl_MasterAccount ma
inner join tbl_Fixed f on ma.Fid = f.id
where ma.id=@id
GO
/****** Object: StoredProcedure [dbo].[GetbyIDreceiptmaster] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[GetbyIDreceiptmaster]
@RId int
as
select rm.InvoiceNo,rm.Date,rm.Amount,rm.RId,rm.Description from tbl_ReceiptMaster rm
where RId= @RId
GO
/****** Object: StoredProcedure [dbo].[GetByMasterAc] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[GetByMasterAc]
@id int
as
select ma.Id,ma.Fid,ma.MasterAccount,ma.Status,f.FixedAccount from tbl_MasterAccount ma
inner join tbl_Fixed f on ma.Fid = f.id
where ma.id =@id
GO
/****** Object: StoredProcedure [dbo].[InsertChartFAccount] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create PROC [dbo].[InsertChartFAccount]
@Mid int,
@AccountName varchar(500),
@Debit decimal(18,2),
@Credit decimal(18,2),
@Date date
as
insert into tbl_ChartofAccount (Mid,AccountName) values(@Mid,@AccountName)
Declare @Id int = Scope_Identity()
insert into tbl_GeneralLedger (Date,RefNo,Debit,Credit,TypeId) values (@Date,@Id,@Debit,@Credit,1)
Select 'OK'
GO
/****** Object: StoredProcedure [dbo].[InsertfeeVoucher] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[InsertfeeVoucher]
@RefNo int,
@InvoiceNo varchar(max),
@Date date ,
@Amount decimal(18,2),
@AccountId int,
@Debit decimal(18,2),
@Credit decimal(18,2)
as
insert into tbl_JournalMaster(InvoiceNo,Date,Amount) values(@InvoiceNo,@Date,@Amount)
Declare @Id int = Scope_Identity()
insert into tbl_JournalDetail(Debit,Credit,AccountId) values(@Debit,@Credit,@AccountId)
Declare @RefId int = Scope_Identity()
insert into tbl_GeneralLedger(RefNo,AccountId,TypeId,Debit,Credit,Date) values (@Id,@AccountId,4,@Debit,@Credit,@Date)
GO
/****** Object: StoredProcedure [dbo].[InsertMasterAc] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE proc [dbo].[InsertMasterAc]
@Fid int,
@MasterAccount varchar (500),
@Status int
as
Insert into tbl_MasterAccount
Values (@Fid,@MasterAccount,@Status)
select * from tbl_Fixed
GO
/****** Object: StoredProcedure [dbo].[insertreceiptmaster] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[insertreceiptmaster]
@InvoiceNo varchar (500) , @Date date , @Description varchar (max) , @Amount decimal (18,2)
as
insert into tbl_ReceiptMaster
(InvoiceNo , Date , Description , Amount)values(@InvoiceNo, @Date ,@Description , @Amount)
GO
/****** Object: StoredProcedure [dbo].[UpDateChartFAccount] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create Proc [dbo].[UpDateChartFAccount]
@Id int,
@Mid int,
@AccountName varchar(500),
@Debit decimal(18,2),
@Credit decimal(18,2),
@Date date
as
Update tbl_ChartofAccount
set
Mid = @Mid,
AccountName= @AccountName
where Id = @Id
update tbl_GeneralLedger
set
Debit= @Debit,
Credit= @Credit,
Date= @Date
where RefNo = @Id and TypeId = 1
GO
/****** Object: StoredProcedure [dbo].[updateMasterAc] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[updateMasterAc]
@id int,
@Fid int,
@MasterAccount varchar (500),
@Status int
as
update tbl_MasterAccount
set
Fid = @Fid,
MasterAccount = @MasterAccount,
Status = @Status
where id =@id
GO
/****** Object: StoredProcedure [dbo].[updatereceiptmaster] Script Date: 11/4/2023 3:48:18 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
create proc [dbo].[updatereceiptmaster]
@InvoiceNo varchar (500) , @Date date , @Description varchar (max) , @Amount decimal (18,2) , @RId int
as
update tbl_ReceiptMaster
set InvoiceNo =@InvoiceNo ,
Date= @Date ,
Description= @Description ,
Amount= @Amount
where
RId = @RId
GO
USE [master]
GO
ALTER DATABASE [AccountsSystem 2] SET READ_WRITE
GO