/****** Object:  StoredProcedure [dbo].[SP_TempTCPrintRecord]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_TempTCPrintRecord]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_TempTCPrintRecord]
GO
/****** Object:  StoredProcedure [dbo].[SP_TempStudentCountingReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_TempStudentCountingReport]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_TempStudentCountingReport]
GO
/****** Object:  StoredProcedure [dbo].[SP_TempAttendanceMonthly]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_TempAttendanceMonthly]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_TempAttendanceMonthly]
GO
/****** Object:  StoredProcedure [dbo].[SP_SoftwareUpdate]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SoftwareUpdate]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SoftwareUpdate]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveWordLibraryMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveWordLibraryMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveWordLibraryMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveVisitorRegister]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveVisitorRegister]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveVisitorRegister]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveUserMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveUserMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveUserMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveUnitMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveUnitMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveUnitMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTripCompetationEntry]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveTripCompetationEntry]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveTripCompetationEntry]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTimeTableMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveTimeTableMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveTimeTableMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCStatusMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveTCStatusMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveTCStatusMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCSLRMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveTCSLRMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveTCSLRMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCRemarkMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveTCRemarkMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveTCRemarkMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCPrintTypeMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveTCPrintTypeMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveTCPrintTypeMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCPrint]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveTCPrint]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveTCPrint]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCDocumentMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveTCDocumentMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveTCDocumentMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCClassPromotStatusMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveTCClassPromotStatusMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveTCClassPromotStatusMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCBehaviorMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveTCBehaviorMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveTCBehaviorMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCApplication]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveTCApplication]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveTCApplication]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTalukaMasterTemp]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveTalukaMasterTemp]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveTalukaMasterTemp]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTalukaMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveTalukaMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveTalukaMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveSubjectMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveSubjectMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveSubjectMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveSubjectDEMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveSubjectDEMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveSubjectDEMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStudInfo]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveStudInfo]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveStudInfo]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStudentPresentyCertificate]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveStudentPresentyCertificate]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveStudentPresentyCertificate]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStudentNotice]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveStudentNotice]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveStudentNotice]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStudentNirgamUtara]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveStudentNirgamUtara]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveStudentNirgamUtara]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStudentLeaveApplication]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveStudentLeaveApplication]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveStudentLeaveApplication]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStudentInfoUpdate]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveStudentInfoUpdate]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveStudentInfoUpdate]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStoreStationeryIssue]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveStoreStationeryIssue]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveStoreStationeryIssue]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStoreClassWiseStationeryItemDefine]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveStoreClassWiseStationeryItemDefine]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveStoreClassWiseStationeryItemDefine]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStateMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveStateMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveStateMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveSPAItemQtyDefine]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveSPAItemQtyDefine]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveSPAItemQtyDefine]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveSPAItemMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveSPAItemMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveSPAItemMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveSmsMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveSmsMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveSmsMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveSendSMS]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveSendSMS]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveSendSMS]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveScholarshipMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveScholarshipMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveScholarshipMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveScholarshipEntry]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveScholarshipEntry]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveScholarshipEntry]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveRenewAdmission]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveRenewAdmission]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveRenewAdmission]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveReligionMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveReligionMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveReligionMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveRelationMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveRelationMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveRelationMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SavePreTCPrint]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SavePreTCPrint]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SavePreTCPrint]
GO
/****** Object:  StoredProcedure [dbo].[SP_SavePresentyDaysMonthMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SavePresentyDaysMonthMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SavePresentyDaysMonthMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SavePageSizeMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SavePageSizeMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SavePageSizeMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveOutwardRegister]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveOutwardRegister]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveOutwardRegister]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveOtherSchoolMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveOtherSchoolMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveOtherSchoolMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveOccupationMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveOccupationMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveOccupationMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveNoticeMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveNoticeMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveNoticeMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibSupplierMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLibSupplierMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLibSupplierMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibStudentIssueReturnBook]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLibStudentIssueReturnBook]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLibStudentIssueReturnBook]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibPublisherMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLibPublisherMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLibPublisherMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibPublicationMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLibPublicationMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLibPublicationMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibEditionMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLibEditionMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLibEditionMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookTitleMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLibBookTitleMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLibBookTitleMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookTitleGroupMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLibBookTitleGroupMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLibBookTitleGroupMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookSubjectMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLibBookSubjectMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLibBookSubjectMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookStatusMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLibBookStatusMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLibBookStatusMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLibBookMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLibBookMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookLocationMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLibBookLocationMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLibBookLocationMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookLanguageMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLibBookLanguageMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLibBookLanguageMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookConsumeEntry]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLibBookConsumeEntry]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLibBookConsumeEntry]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibAuthorMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLibAuthorMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLibAuthorMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLanguageMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveLanguageMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveLanguageMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveItemMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveItemMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveItemMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveItemGroupMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveItemGroupMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveItemGroupMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveInwardRegister]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveInwardRegister]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveInwardRegister]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveHandyCapMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveHandyCapMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveHandyCapMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeTypeMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveFeeTypeMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveFeeTypeMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeTitleShortMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveFeeTitleShortMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveFeeTitleShortMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeTitleRegularMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveFeeTitleRegularMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveFeeTitleRegularMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeTitleOtherMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveFeeTitleOtherMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveFeeTitleOtherMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeTitleOtherGroupMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveFeeTitleOtherGroupMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveFeeTitleOtherGroupMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeTitleMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveFeeTitleMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveFeeTitleMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeesCollectionRegular]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveFeesCollectionRegular]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveFeesCollectionRegular]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeesCollectionOther]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveFeesCollectionOther]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveFeesCollectionOther]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeesCollection]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveFeesCollection]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveFeesCollection]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeesAlertDefine]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveFeesAlertDefine]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveFeesAlertDefine]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeDefineOther]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveFeeDefineOther]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveFeeDefineOther]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeDefine]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveFeeDefine]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveFeeDefine]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveExamMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveExamMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveExamMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveExamMarksDefine]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveExamMarksDefine]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveExamMarksDefine]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveExamAdmitCard]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveExamAdmitCard]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveExamAdmitCard]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveEmpTypeMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveEmpTypeMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveEmpTypeMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveEmpMonthlySalary]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveEmpMonthlySalary]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveEmpMonthlySalary]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveEmpMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveEmpMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveEmpMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveEmpDocumentMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveEmpDocumentMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveEmpDocumentMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveEducationMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveEducationMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveEducationMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDRHeadMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveDRHeadMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveDRHeadMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDREntry]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveDREntry]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveDREntry]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDocumentMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveDocumentMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveDocumentMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDivisionMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveDivisionMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveDivisionMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDistrictMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveDistrictMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveDistrictMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDETitleMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveDETitleMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveDETitleMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDesignationMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveDesignationMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveDesignationMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDEMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveDEMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveDEMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCRSubjectMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveCRSubjectMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveCRSubjectMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCRPSTeacherMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveCRPSTeacherMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveCRPSTeacherMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCovid19DoseMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveCovid19DoseMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveCovid19DoseMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCountryMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveCountryMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveCountryMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCityMasterTemp]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveCityMasterTemp]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveCityMasterTemp]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCityMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveCityMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveCityMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCBSCDETitleMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveCBSCDETitleMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveCBSCDETitleMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCBSCDETitleGroupMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveCBSCDETitleGroupMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveCBSCDETitleGroupMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCBSCDEMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveCBSCDEMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveCBSCDEMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCBSCDEGroupMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveCBSCDEGroupMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveCBSCDEGroupMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCasteValidationCertificate]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveCasteValidationCertificate]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveCasteValidationCertificate]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCasteMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveCasteMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveCasteMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveBusMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveBusMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveBusMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveBusFeeTitleMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveBusFeeTitleMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveBusFeeTitleMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveBusFeesCollection]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveBusFeesCollection]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveBusFeesCollection]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveBonafiedCertificate]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveBonafiedCertificate]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveBonafiedCertificate]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveBloodGroupMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveBloodGroupMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveBloodGroupMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveBankMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveBankMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveBankMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveAreaMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveAreaMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveAreaMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveAlterDaysDefineMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveAlterDaysDefineMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveAlterDaysDefineMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveAge]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveAge]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveAge]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveACVoucher]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveACVoucher]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveACVoucher]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveACTempFillAllDate]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveACTempFillAllDate]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveACTempFillAllDate]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveACTempCashBookReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveACTempCashBookReport]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveACTempCashBookReport]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveACPartyMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveACPartyMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveACPartyMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveACLedgerHeadNarrationMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveACLedgerHeadNarrationMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveACLedgerHeadNarrationMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveACLedgerHeadMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveACLedgerHeadMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveACLedgerHeadMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveACAccountRegisterMaster]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_SaveACAccountRegisterMaster]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_SaveACAccountRegisterMaster]
GO
/****** Object:  StoredProcedure [dbo].[SP_GetRecordNameFromCode]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_GetRecordNameFromCode]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_GetRecordNameFromCode]
GO
/****** Object:  StoredProcedure [dbo].[SP_GetRecordCode]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_GetRecordCode]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_GetRecordCode]
GO
/****** Object:  StoredProcedure [dbo].[SP_GetMaxTID]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_GetMaxTID]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_GetMaxTID]
GO
/****** Object:  StoredProcedure [dbo].[SP_GetMaxCodeQuery]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_GetMaxCodeQuery]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_GetMaxCodeQuery]
GO
/****** Object:  StoredProcedure [dbo].[SP_GetMaxCode]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_GetMaxCode]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_GetMaxCode]
GO
/****** Object:  StoredProcedure [dbo].[SP_GetLogin]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_GetLogin]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_GetLogin]
GO
/****** Object:  StoredProcedure [dbo].[SP_GetLanMaxCode]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_GetLanMaxCode]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_GetLanMaxCode]
GO
/****** Object:  StoredProcedure [dbo].[SP_GetFeesBalance]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_GetFeesBalance]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_GetFeesBalance]
GO
/****** Object:  StoredProcedure [dbo].[SP_GetDefaultValue]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_GetDefaultValue]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_GetDefaultValue]
GO
/****** Object:  StoredProcedure [dbo].[SP_FillRenewAdmission]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_FillRenewAdmission]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_FillRenewAdmission]
GO
/****** Object:  StoredProcedure [dbo].[SP_FillListWithCondition]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_FillListWithCondition]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_FillListWithCondition]
GO
/****** Object:  StoredProcedure [dbo].[SP_FillListStudent]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_FillListStudent]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_FillListStudent]
GO
/****** Object:  StoredProcedure [dbo].[SP_FillList1]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_FillList1]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_FillList1]
GO
/****** Object:  StoredProcedure [dbo].[SP_FillList]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_FillList]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_FillList]
GO
/****** Object:  StoredProcedure [dbo].[SP_EditRecordMainScreen]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_EditRecordMainScreen]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_EditRecordMainScreen]
GO
/****** Object:  StoredProcedure [dbo].[SP_EditRecordFees]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_EditRecordFees]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_EditRecordFees]
GO
/****** Object:  StoredProcedure [dbo].[SP_EditRecordExam]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_EditRecordExam]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_EditRecordExam]
GO
/****** Object:  StoredProcedure [dbo].[SP_EditRecordCommon]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_EditRecordCommon]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_EditRecordCommon]
GO
/****** Object:  StoredProcedure [dbo].[SP_EditRecordAdmission]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_EditRecordAdmission]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_EditRecordAdmission]
GO
/****** Object:  StoredProcedure [dbo].[SP_EditRecord1]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_EditRecord1]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_EditRecord1]
GO
/****** Object:  StoredProcedure [dbo].[SP_EditRecord]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_EditRecord]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_EditRecord]
GO
/****** Object:  StoredProcedure [dbo].[SP_DeleteMasters]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_DeleteMasters]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_DeleteMasters]
GO
/****** Object:  StoredProcedure [dbo].[SP_DatabaseBackup]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_DatabaseBackup]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_DatabaseBackup]
GO
/****** Object:  StoredProcedure [dbo].[SP_CRUDInsertUpdateDeleteRecord]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_CRUDInsertUpdateDeleteRecord]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_CRUDInsertUpdateDeleteRecord]
GO
/****** Object:  StoredProcedure [dbo].[SP_CRUDInsertMasters]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_CRUDInsertMasters]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_CRUDInsertMasters]
GO
/****** Object:  StoredProcedure [dbo].[SP_CRUDFillListReportWithSort]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_CRUDFillListReportWithSort]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_CRUDFillListReportWithSort]
GO
/****** Object:  StoredProcedure [dbo].[SP_CRUDFillListReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_CRUDFillListReport]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_CRUDFillListReport]
GO
/****** Object:  StoredProcedure [dbo].[SP_CRUDFillList]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_CRUDFillList]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_CRUDFillList]
GO
/****** Object:  StoredProcedure [dbo].[SP_CRUDDeleteMasters]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_CRUDDeleteMasters]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_CRUDDeleteMasters]
GO
/****** Object:  StoredProcedure [dbo].[SP_CRUDAlreadyExist]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_CRUDAlreadyExist]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_CRUDAlreadyExist]
GO
/****** Object:  StoredProcedure [dbo].[SP_CheckAlreadyExistNameCode1]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_CheckAlreadyExistNameCode1]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_CheckAlreadyExistNameCode1]
GO
/****** Object:  StoredProcedure [dbo].[SP_CheckAlreadyExistNameCode]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[SP_CheckAlreadyExistNameCode]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[SP_CheckAlreadyExistNameCode]
GO
/****** Object:  StoredProcedure [dbo].[DBRestore]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[DBRestore]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[DBRestore]
GO
/****** Object:  View [dbo].[VisitorRegisterReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[VisitorRegisterReport]'))
DROP VIEW [dbo].[VisitorRegisterReport]
GO
/****** Object:  View [dbo].[TripCompetationEntryReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[TripCompetationEntryReport]'))
DROP VIEW [dbo].[TripCompetationEntryReport]
GO
/****** Object:  View [dbo].[TempExamSankalitExcelReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[TempExamSankalitExcelReport]'))
DROP VIEW [dbo].[TempExamSankalitExcelReport]
GO
/****** Object:  View [dbo].[TempAllFeesReceiptReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[TempAllFeesReceiptReport]'))
DROP VIEW [dbo].[TempAllFeesReceiptReport]
GO
/****** Object:  View [dbo].[TempAllFeesReceipt]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[TempAllFeesReceipt]'))
DROP VIEW [dbo].[TempAllFeesReceipt]
GO
/****** Object:  View [dbo].[TCRecordImport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[TCRecordImport]'))
DROP VIEW [dbo].[TCRecordImport]
GO
/****** Object:  View [dbo].[TCPAllReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[TCPAllReport]'))
DROP VIEW [dbo].[TCPAllReport]
GO
/****** Object:  View [dbo].[TCApplicationReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[TCApplicationReport]'))
DROP VIEW [dbo].[TCApplicationReport]
GO
/****** Object:  View [dbo].[SubjectGroupDefineReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[SubjectGroupDefineReport]'))
DROP VIEW [dbo].[SubjectGroupDefineReport]
GO
/****** Object:  View [dbo].[StudInfoReportYearly]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[StudInfoReportYearly]'))
DROP VIEW [dbo].[StudInfoReportYearly]
GO
/****** Object:  View [dbo].[StudinfoReportExcel]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[StudinfoReportExcel]'))
DROP VIEW [dbo].[StudinfoReportExcel]
GO
/****** Object:  View [dbo].[StudInfoReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[StudInfoReport]'))
DROP VIEW [dbo].[StudInfoReport]
GO
/****** Object:  View [dbo].[StudInfoAllReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[StudInfoAllReport]'))
DROP VIEW [dbo].[StudInfoAllReport]
GO
/****** Object:  View [dbo].[StudentSubjectReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[StudentSubjectReport]'))
DROP VIEW [dbo].[StudentSubjectReport]
GO
/****** Object:  View [dbo].[StudentNoticeReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[StudentNoticeReport]'))
DROP VIEW [dbo].[StudentNoticeReport]
GO
/****** Object:  View [dbo].[StudentNirgamUttaraReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[StudentNirgamUttaraReport]'))
DROP VIEW [dbo].[StudentNirgamUttaraReport]
GO
/****** Object:  View [dbo].[StudentGoshwaraReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[StudentGoshwaraReport]'))
DROP VIEW [dbo].[StudentGoshwaraReport]
GO
/****** Object:  View [dbo].[StudentExamAdmitCard]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[StudentExamAdmitCard]'))
DROP VIEW [dbo].[StudentExamAdmitCard]
GO
/****** Object:  View [dbo].[StudentAttendanceMonthlyReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[StudentAttendanceMonthlyReport]'))
DROP VIEW [dbo].[StudentAttendanceMonthlyReport]
GO
/****** Object:  View [dbo].[SpecificRecordReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[SpecificRecordReport]'))
DROP VIEW [dbo].[SpecificRecordReport]
GO
/****** Object:  View [dbo].[SchoolLeaveReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[SchoolLeaveReport]'))
DROP VIEW [dbo].[SchoolLeaveReport]
GO
/****** Object:  View [dbo].[ScholarshipReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ScholarshipReport]'))
DROP VIEW [dbo].[ScholarshipReport]
GO
/****** Object:  View [dbo].[PreTCPrintingReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[PreTCPrintingReport]'))
DROP VIEW [dbo].[PreTCPrintingReport]
GO
/****** Object:  View [dbo].[OutwardRegisterReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[OutwardRegisterReport]'))
DROP VIEW [dbo].[OutwardRegisterReport]
GO
/****** Object:  View [dbo].[LibStudentIssueRetunBookReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[LibStudentIssueRetunBookReport]'))
DROP VIEW [dbo].[LibStudentIssueRetunBookReport]
GO
/****** Object:  View [dbo].[LibBookDetailReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[LibBookDetailReport]'))
DROP VIEW [dbo].[LibBookDetailReport]
GO
/****** Object:  View [dbo].[LibBarcodePrintReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[LibBarcodePrintReport]'))
DROP VIEW [dbo].[LibBarcodePrintReport]
GO
/****** Object:  View [dbo].[InwardRegisterReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[InwardRegisterReport]'))
DROP VIEW [dbo].[InwardRegisterReport]
GO
/****** Object:  View [dbo].[FeesTitleReceiptDetailReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesTitleReceiptDetailReport]'))
DROP VIEW [dbo].[FeesTitleReceiptDetailReport]
GO
/****** Object:  View [dbo].[FeesStudInfoReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesStudInfoReport]'))
DROP VIEW [dbo].[FeesStudInfoReport]
GO
/****** Object:  View [dbo].[FeesReceiptReportRegular]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesReceiptReportRegular]'))
DROP VIEW [dbo].[FeesReceiptReportRegular]
GO
/****** Object:  View [dbo].[FeesReceiptReportOther]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesReceiptReportOther]'))
DROP VIEW [dbo].[FeesReceiptReportOther]
GO
/****** Object:  View [dbo].[FeesReceiptReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesReceiptReport]'))
DROP VIEW [dbo].[FeesReceiptReport]
GO
/****** Object:  View [dbo].[FeesReceiptNotPaidStudentReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesReceiptNotPaidStudentReport]'))
DROP VIEW [dbo].[FeesReceiptNotPaidStudentReport]
GO
/****** Object:  View [dbo].[FeesOutstandingReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesOutstandingReport]'))
DROP VIEW [dbo].[FeesOutstandingReport]
GO
/****** Object:  View [dbo].[FeesLedgerReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesLedgerReport]'))
DROP VIEW [dbo].[FeesLedgerReport]
GO
/****** Object:  View [dbo].[FeesDefineReportRegular]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesDefineReportRegular]'))
DROP VIEW [dbo].[FeesDefineReportRegular]
GO
/****** Object:  View [dbo].[FeesDefineReportOther]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesDefineReportOther]'))
DROP VIEW [dbo].[FeesDefineReportOther]
GO
/****** Object:  View [dbo].[FeesCollectionReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesCollectionReport]'))
DROP VIEW [dbo].[FeesCollectionReport]
GO
/****** Object:  View [dbo].[FeesCollectionRegularReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesCollectionRegularReport]'))
DROP VIEW [dbo].[FeesCollectionRegularReport]
GO
/****** Object:  View [dbo].[FeesCollectionOtherReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesCollectionOtherReport]'))
DROP VIEW [dbo].[FeesCollectionOtherReport]
GO
/****** Object:  View [dbo].[FeesAlertDefineReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesAlertDefineReport]'))
DROP VIEW [dbo].[FeesAlertDefineReport]
GO
/****** Object:  View [dbo].[ExcelTCPrintingReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelTCPrintingReport]'))
DROP VIEW [dbo].[ExcelTCPrintingReport]
GO
/****** Object:  View [dbo].[ExcelStudentGeneralRegisterF1]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelStudentGeneralRegisterF1]'))
DROP VIEW [dbo].[ExcelStudentGeneralRegisterF1]
GO
/****** Object:  View [dbo].[ExcelStudentDetailReportAllYear]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelStudentDetailReportAllYear]'))
DROP VIEW [dbo].[ExcelStudentDetailReportAllYear]
GO
/****** Object:  View [dbo].[ExcelStudentDetailReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelStudentDetailReport]'))
DROP VIEW [dbo].[ExcelStudentDetailReport]
GO
/****** Object:  View [dbo].[ExcelStudentBankReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelStudentBankReport]'))
DROP VIEW [dbo].[ExcelStudentBankReport]
GO
/****** Object:  View [dbo].[ExcelScholarshipStudentReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelScholarshipStudentReport]'))
DROP VIEW [dbo].[ExcelScholarshipStudentReport]
GO
/****** Object:  View [dbo].[ExcelNewSchoolImportStudentDataReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelNewSchoolImportStudentDataReport]'))
DROP VIEW [dbo].[ExcelNewSchoolImportStudentDataReport]
GO
/****** Object:  View [dbo].[ExcelNewAdmissionReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelNewAdmissionReport]'))
DROP VIEW [dbo].[ExcelNewAdmissionReport]
GO
/****** Object:  View [dbo].[ExcelNewAdmissionEnquiryReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelNewAdmissionEnquiryReport]'))
DROP VIEW [dbo].[ExcelNewAdmissionEnquiryReport]
GO
/****** Object:  View [dbo].[ExcelNationalAchievementSurveyReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelNationalAchievementSurveyReport]'))
DROP VIEW [dbo].[ExcelNationalAchievementSurveyReport]
GO
/****** Object:  View [dbo].[ExcelMonthlySalaryDetails]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelMonthlySalaryDetails]'))
DROP VIEW [dbo].[ExcelMonthlySalaryDetails]
GO
/****** Object:  View [dbo].[ExcelEmpMonthlySalaryReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEmpMonthlySalaryReport]'))
DROP VIEW [dbo].[ExcelEmpMonthlySalaryReport]
GO
/****** Object:  View [dbo].[ExcelEmpInformationReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEmpInformationReport]'))
DROP VIEW [dbo].[ExcelEmpInformationReport]
GO
/****** Object:  View [dbo].[ExcelEITCReceivePerson]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEITCReceivePerson]'))
DROP VIEW [dbo].[ExcelEITCReceivePerson]
GO
/****** Object:  View [dbo].[ExcelEITCPrintingInfo]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEITCPrintingInfo]'))
DROP VIEW [dbo].[ExcelEITCPrintingInfo]
GO
/****** Object:  View [dbo].[ExcelEIStudentPENNo]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEIStudentPENNo]'))
DROP VIEW [dbo].[ExcelEIStudentPENNo]
GO
/****** Object:  View [dbo].[ExcelEIStudentID]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEIStudentID]'))
DROP VIEW [dbo].[ExcelEIStudentID]
GO
/****** Object:  View [dbo].[ExcelEIStudentEnglishInfo]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEIStudentEnglishInfo]'))
DROP VIEW [dbo].[ExcelEIStudentEnglishInfo]
GO
/****** Object:  View [dbo].[ExcelEIStudentAllInfo]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEIStudentAllInfo]'))
DROP VIEW [dbo].[ExcelEIStudentAllInfo]
GO
/****** Object:  View [dbo].[ExcelEISeatNo]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEISeatNo]'))
DROP VIEW [dbo].[ExcelEISeatNo]
GO
/****** Object:  View [dbo].[ExcelEISchoolFees]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEISchoolFees]'))
DROP VIEW [dbo].[ExcelEISchoolFees]
GO
/****** Object:  View [dbo].[ExcelEIScholarshipInfoUpdate]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEIScholarshipInfoUpdate]'))
DROP VIEW [dbo].[ExcelEIScholarshipInfoUpdate]
GO
/****** Object:  View [dbo].[ExcelEIRollNo]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEIRollNo]'))
DROP VIEW [dbo].[ExcelEIRollNo]
GO
/****** Object:  View [dbo].[ExcelEIRegNo]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEIRegNo]'))
DROP VIEW [dbo].[ExcelEIRegNo]
GO
/****** Object:  View [dbo].[ExcelEIOpeningBalance]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEIOpeningBalance]'))
DROP VIEW [dbo].[ExcelEIOpeningBalance]
GO
/****** Object:  View [dbo].[ExcelEINationalCode]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEINationalCode]'))
DROP VIEW [dbo].[ExcelEINationalCode]
GO
/****** Object:  View [dbo].[ExcelEIMobileNo]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEIMobileNo]'))
DROP VIEW [dbo].[ExcelEIMobileNo]
GO
/****** Object:  View [dbo].[ExcelEIHeightWeight]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEIHeightWeight]'))
DROP VIEW [dbo].[ExcelEIHeightWeight]
GO
/****** Object:  View [dbo].[ExcelEIFeeType]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEIFeeType]'))
DROP VIEW [dbo].[ExcelEIFeeType]
GO
/****** Object:  View [dbo].[ExcelEIBloodGroup]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEIBloodGroup]'))
DROP VIEW [dbo].[ExcelEIBloodGroup]
GO
/****** Object:  View [dbo].[ExcelEIAadharCardNo]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelEIAadharCardNo]'))
DROP VIEW [dbo].[ExcelEIAadharCardNo]
GO
/****** Object:  View [dbo].[ExcelBoardFormStudentReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExcelBoardFormStudentReport]'))
DROP VIEW [dbo].[ExcelBoardFormStudentReport]
GO
/****** Object:  View [dbo].[ExamTermDEntryCBSC]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamTermDEntryCBSC]'))
DROP VIEW [dbo].[ExamTermDEntryCBSC]
GO
/****** Object:  View [dbo].[ExamTermDEntry]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamTermDEntry]'))
DROP VIEW [dbo].[ExamTermDEntry]
GO
/****** Object:  View [dbo].[ExamSubjectMarksRegisterSubjectWise]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamSubjectMarksRegisterSubjectWise]'))
DROP VIEW [dbo].[ExamSubjectMarksRegisterSubjectWise]
GO
/****** Object:  View [dbo].[ExamOptionalSubjectStudentReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamOptionalSubjectStudentReport]'))
DROP VIEW [dbo].[ExamOptionalSubjectStudentReport]
GO
/****** Object:  View [dbo].[ExamMarksDefineReportPrint]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamMarksDefineReportPrint]'))
DROP VIEW [dbo].[ExamMarksDefineReportPrint]
GO
/****** Object:  View [dbo].[ExamMarkMemoTermSummaryCovid19]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamMarkMemoTermSummaryCovid19]'))
DROP VIEW [dbo].[ExamMarkMemoTermSummaryCovid19]
GO
/****** Object:  View [dbo].[ExamMarkMemoTermSummary]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamMarkMemoTermSummary]'))
DROP VIEW [dbo].[ExamMarkMemoTermSummary]
GO
/****** Object:  View [dbo].[ExamMarkMemoAnnualDetail]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamMarkMemoAnnualDetail]'))
DROP VIEW [dbo].[ExamMarkMemoAnnualDetail]
GO
/****** Object:  View [dbo].[ExamClassSubjectDefineReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamClassSubjectDefineReport]'))
DROP VIEW [dbo].[ExamClassSubjectDefineReport]
GO
/****** Object:  View [dbo].[Exam2SMEntry]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[Exam2SMEntry]'))
DROP VIEW [dbo].[Exam2SMEntry]
GO
/****** Object:  View [dbo].[Exam1SMEntry]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[Exam1SMEntry]'))
DROP VIEW [dbo].[Exam1SMEntry]
GO
/****** Object:  View [dbo].[EmpMonthlySalarySummaryReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[EmpMonthlySalarySummaryReport]'))
DROP VIEW [dbo].[EmpMonthlySalarySummaryReport]
GO
/****** Object:  View [dbo].[EmpMonthlySalaryReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[EmpMonthlySalaryReport]'))
DROP VIEW [dbo].[EmpMonthlySalaryReport]
GO
/****** Object:  View [dbo].[EmpInfoReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[EmpInfoReport]'))
DROP VIEW [dbo].[EmpInfoReport]
GO
/****** Object:  View [dbo].[EmpClassDivisionReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[EmpClassDivisionReport]'))
DROP VIEW [dbo].[EmpClassDivisionReport]
GO
/****** Object:  View [dbo].[EmpAnnualSalarySummaryReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[EmpAnnualSalarySummaryReport]'))
DROP VIEW [dbo].[EmpAnnualSalarySummaryReport]
GO
/****** Object:  View [dbo].[DRReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[DRReport]'))
DROP VIEW [dbo].[DRReport]
GO
/****** Object:  View [dbo].[DESubjectReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[DESubjectReport]'))
DROP VIEW [dbo].[DESubjectReport]
GO
/****** Object:  View [dbo].[DEReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[DEReport]'))
DROP VIEW [dbo].[DEReport]
GO
/****** Object:  View [dbo].[CRGovSchemeReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[CRGovSchemeReport]'))
DROP VIEW [dbo].[CRGovSchemeReport]
GO
/****** Object:  View [dbo].[CRExamResultReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[CRExamResultReport]'))
DROP VIEW [dbo].[CRExamResultReport]
GO
/****** Object:  View [dbo].[CRDEDetailReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[CRDEDetailReport]'))
DROP VIEW [dbo].[CRDEDetailReport]
GO
/****** Object:  View [dbo].[CasteValidationCertificateReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[CasteValidationCertificateReport]'))
DROP VIEW [dbo].[CasteValidationCertificateReport]
GO
/****** Object:  View [dbo].[BusReceiptReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[BusReceiptReport]'))
DROP VIEW [dbo].[BusReceiptReport]
GO
/****** Object:  View [dbo].[BusFeesDefineReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[BusFeesDefineReport]'))
DROP VIEW [dbo].[BusFeesDefineReport]
GO
/****** Object:  View [dbo].[BusFeesCollectionReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[BusFeesCollectionReport]'))
DROP VIEW [dbo].[BusFeesCollectionReport]
GO
/****** Object:  View [dbo].[BanafideCertificateReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[BanafideCertificateReport]'))
DROP VIEW [dbo].[BanafideCertificateReport]
GO
/****** Object:  View [dbo].[ACVoucherReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ACVoucherReport]'))
DROP VIEW [dbo].[ACVoucherReport]
GO
/****** Object:  View [dbo].[ACLedgerHeadIndexReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ACLedgerHeadIndexReport]'))
DROP VIEW [dbo].[ACLedgerHeadIndexReport]
GO
/****** Object:  View [dbo].[2-ErrorStudInfo]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[2-ErrorStudInfo]'))
DROP VIEW [dbo].[2-ErrorStudInfo]
GO
/****** Object:  View [dbo].[1-ErrorStudInfoAll]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[1-ErrorStudInfoAll]'))
DROP VIEW [dbo].[1-ErrorStudInfoAll]
GO
/****** Object:  View [dbo].[StudentPresentyCertificateReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[StudentPresentyCertificateReport]'))
DROP VIEW [dbo].[StudentPresentyCertificateReport]
GO
/****** Object:  View [dbo].[FeesDefineReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesDefineReport]'))
DROP VIEW [dbo].[FeesDefineReport]
GO
/****** Object:  View [dbo].[FeesDefineTitleCodeReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[FeesDefineTitleCodeReport]'))
DROP VIEW [dbo].[FeesDefineTitleCodeReport]
GO
/****** Object:  View [dbo].[SiblingStudentReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[SiblingStudentReport]'))
DROP VIEW [dbo].[SiblingStudentReport]
GO
/****** Object:  View [dbo].[TempSiblingStudent]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[TempSiblingStudent]'))
DROP VIEW [dbo].[TempSiblingStudent]
GO
/****** Object:  View [dbo].[ExamMarkMemoAnnual]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamMarkMemoAnnual]'))
DROP VIEW [dbo].[ExamMarkMemoAnnual]
GO
/****** Object:  View [dbo].[ExamMarkMemoAnnualHorizontal]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamMarkMemoAnnualHorizontal]'))
DROP VIEW [dbo].[ExamMarkMemoAnnualHorizontal]
GO
/****** Object:  View [dbo].[ExamMarkMemoTerm]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamMarkMemoTerm]'))
DROP VIEW [dbo].[ExamMarkMemoTerm]
GO
/****** Object:  View [dbo].[ExamPresentyReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamPresentyReport]'))
DROP VIEW [dbo].[ExamPresentyReport]
GO
/****** Object:  View [dbo].[ExamMarkMemoTermCovid19]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamMarkMemoTermCovid19]'))
DROP VIEW [dbo].[ExamMarkMemoTermCovid19]
GO
/****** Object:  View [dbo].[ExamMarksDefineReport]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamMarksDefineReport]'))
DROP VIEW [dbo].[ExamMarksDefineReport]
GO
/****** Object:  View [dbo].[ExamTermDEntryCBSCFTST]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamTermDEntryCBSCFTST]'))
DROP VIEW [dbo].[ExamTermDEntryCBSCFTST]
GO
/****** Object:  View [dbo].[ExamTermDEntryCBSCST]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamTermDEntryCBSCST]'))
DROP VIEW [dbo].[ExamTermDEntryCBSCST]
GO
/****** Object:  View [dbo].[ExamTermDEntryCBSCFT]    Script Date: 13-08-2025 16:35:04 ******/
IF  EXISTS (SELECT * FROM sys.views WHERE object_id = OBJECT_ID(N'[dbo].[ExamTermDEntryCBSCFT]'))
DROP VIEW [dbo].[ExamTermDEntryCBSCFT]
GO
/****** Object:  View [dbo].[ExamTermDEntryCBSCFT]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamTermDEntryCBSCFT]
AS
SELECT        dbo.StudentExamTermDEntryCBSC.RegID, dbo.StudentExamTermDEntryCBSC.ExamCode, dbo.CBSCDEGroupMaster.CBSCDEGroupCode, dbo.CBSCDEGroupMaster.SrNo AS CBSCDEGroupSrNo, 
                         dbo.CBSCDEGroupMaster.CBSCDEGroupName, dbo.CBSCDETitleGroupMaster.CBSCDETitleGroupCode, dbo.CBSCDETitleGroupMaster.SrNo AS CBSCDETitleGroupSrNo, dbo.CBSCDETitleGroupMaster.CBSCDETitleGroupName, 
                         dbo.CBSCDETitleMaster.CBSCDETitleCode, dbo.CBSCDETitleMaster.SrNo AS CBSCDETitleSrNo, dbo.CBSCDETitleMaster.CBSCDETitleName, dbo.CBSCDEMaster.CBSCDECode, dbo.CBSCDEMaster.SrNo AS CBSCDESrNo, 
                         dbo.CBSCDEMaster.CBSCDEName, dbo.GradeMaster.GradeName AS GradeNameFT, dbo.MainClassMaster.MainClassName AS MainClass, dbo.StudInfo.AyCode, dbo.MediumMaster.MediumName AS Medium, 
                         dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div
FROM            dbo.StudentExamTermDEntryCBSC INNER JOIN
                         dbo.CBSCDEMaster ON dbo.StudentExamTermDEntryCBSC.CBSCDECode = dbo.CBSCDEMaster.CBSCDECode INNER JOIN
                         dbo.CBSCDETitleMaster ON dbo.CBSCDEMaster.CBSCDETitleCode = dbo.CBSCDETitleMaster.CBSCDETitleCode INNER JOIN
                         dbo.CBSCDETitleGroupMaster ON dbo.CBSCDETitleMaster.CBSCDETitleGroupCode = dbo.CBSCDETitleGroupMaster.CBSCDETitleGroupCode INNER JOIN
                         dbo.CBSCDEGroupMaster ON dbo.CBSCDETitleGroupMaster.CBSCDEGroupCode = dbo.CBSCDEGroupMaster.CBSCDEGroupCode INNER JOIN
                         dbo.GradeMaster ON dbo.CBSCDEMaster.GradeCode = dbo.GradeMaster.GradeCode INNER JOIN
                         dbo.StudInfo ON dbo.StudentExamTermDEntryCBSC.RegID = dbo.StudInfo.RegID INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode
WHERE        (dbo.StudentExamTermDEntryCBSC.ExamCode = 1)
GO
/****** Object:  View [dbo].[ExamTermDEntryCBSCST]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamTermDEntryCBSCST]
AS
SELECT        dbo.StudentExamTermDEntryCBSC.RegID, dbo.StudentExamTermDEntryCBSC.ExamCode, dbo.CBSCDEGroupMaster.CBSCDEGroupCode, dbo.CBSCDEGroupMaster.SrNo AS CBSCDEGroupSrNo, 
                         dbo.CBSCDEGroupMaster.CBSCDEGroupName, dbo.CBSCDETitleGroupMaster.CBSCDETitleGroupCode, dbo.CBSCDETitleGroupMaster.SrNo AS CBSCDETitleGroupSrNo, dbo.CBSCDETitleGroupMaster.CBSCDETitleGroupName, 
                         dbo.CBSCDETitleMaster.CBSCDETitleCode, dbo.CBSCDETitleMaster.SrNo AS CBSCDETitleSrNo, dbo.CBSCDETitleMaster.CBSCDETitleName, dbo.CBSCDEMaster.CBSCDECode, dbo.CBSCDEMaster.SrNo AS CBSCDESrNo, 
                         dbo.CBSCDEMaster.CBSCDEName, dbo.GradeMaster.GradeName AS GradeNameST, dbo.StudInfo.AyCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, 
                         dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div
FROM            dbo.StudentExamTermDEntryCBSC INNER JOIN
                         dbo.CBSCDEMaster ON dbo.StudentExamTermDEntryCBSC.CBSCDECode = dbo.CBSCDEMaster.CBSCDECode INNER JOIN
                         dbo.CBSCDETitleMaster ON dbo.CBSCDEMaster.CBSCDETitleCode = dbo.CBSCDETitleMaster.CBSCDETitleCode INNER JOIN
                         dbo.CBSCDETitleGroupMaster ON dbo.CBSCDETitleMaster.CBSCDETitleGroupCode = dbo.CBSCDETitleGroupMaster.CBSCDETitleGroupCode INNER JOIN
                         dbo.CBSCDEGroupMaster ON dbo.CBSCDETitleGroupMaster.CBSCDEGroupCode = dbo.CBSCDEGroupMaster.CBSCDEGroupCode INNER JOIN
                         dbo.GradeMaster ON dbo.CBSCDEMaster.GradeCode = dbo.GradeMaster.GradeCode INNER JOIN
                         dbo.StudInfo ON dbo.StudentExamTermDEntryCBSC.RegID = dbo.StudInfo.RegID INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode
WHERE        (dbo.StudentExamTermDEntryCBSC.ExamCode = 2)
GO
/****** Object:  View [dbo].[ExamTermDEntryCBSCFTST]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamTermDEntryCBSCFTST]
AS
SELECT        dbo.CBSCDEGroupMaster.CBSCDEGroupCode, dbo.CBSCDEGroupMaster.SrNo AS CBSCDEGroupSrNo, dbo.CBSCDEGroupMaster.CBSCDEGroupName, dbo.StudInfo.RegID, dbo.ExamTermDEntryCBSCFT.CBSCDESrNo, 
                         dbo.ExamTermDEntryCBSCFT.GradeNameFT, dbo.ExamTermDEntryCBSCST.GradeNameST, dbo.ExamTermDEntryCBSCFT.CBSCDETitleGroupCode, dbo.ExamTermDEntryCBSCFT.CBSCDETitleGroupSrNo, 
                         dbo.ExamTermDEntryCBSCFT.CBSCDETitleGroupName, dbo.ExamTermDEntryCBSCFT.CBSCDETitleCode, dbo.ExamTermDEntryCBSCFT.CBSCDETitleSrNo, dbo.ExamTermDEntryCBSCFT.CBSCDETitleName, 
                         dbo.ExamTermDEntryCBSCFT.CBSCDECode, dbo.ExamTermDEntryCBSCFT.CBSCDEName, dbo.StudInfo.RegNo, dbo.StudInfo.RollNo, 
                         CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END AS StudentName, 
                         CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END AS Student, 
                         dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.AyCode
FROM            dbo.ExamTermDEntryCBSCFT INNER JOIN
                         dbo.StudInfo ON dbo.ExamTermDEntryCBSCFT.RegID = dbo.StudInfo.RegID INNER JOIN
                         dbo.ExamTermDEntryCBSCST ON dbo.StudInfo.RegID = dbo.ExamTermDEntryCBSCST.RegID AND dbo.ExamTermDEntryCBSCFT.RegID = dbo.ExamTermDEntryCBSCST.RegID AND 
                         dbo.ExamTermDEntryCBSCFT.CBSCDETitleCode = dbo.ExamTermDEntryCBSCST.CBSCDETitleCode INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode CROSS JOIN
                         dbo.CBSCDEGroupMaster
GO
/****** Object:  View [dbo].[ExamMarksDefineReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamMarksDefineReport]
AS
SELECT        dbo.ExamMarksDefine.TID, dbo.ExamMarksDefine.ClassCode, dbo.ExamGroupDetail.ExamCode, dbo.ExamMarksDefine.SrNo, dbo.ExamMarksDefine.SubjectCode, dbo.ExamMarksDefine.ST1Marks1, 
                         dbo.ExamMarksDefine.ST1Marks2, dbo.ExamMarksDefine.ST1Marks3, dbo.ExamMarksDefine.ST1Marks4, dbo.ExamMarksDefine.ST1Marks5, dbo.ExamMarksDefine.ST1Marks6, dbo.ExamMarksDefine.ST1Marks7, 
                         dbo.ExamMarksDefine.ST1MarksTotal, dbo.ExamMarksDefine.ST2MarksTotal, dbo.ExamMarksDefine.ST3MarksTotal, dbo.ClassMaster.ClassName, dbo.ExamGroupDetail.DivisionCode, 
                         dbo.ExamMarksDefine.ExamMarksTypeCode, dbo.ExamMarksDefine.MinMarks, dbo.ExamMarksDefine.MaxMarks, dbo.ExamGroupMaster.ExamTypeCode
FROM            dbo.ExamMaster INNER JOIN
                         dbo.ExamGroupDetail ON dbo.ExamMaster.ExamCode = dbo.ExamGroupDetail.ExamCode INNER JOIN
                         dbo.ExamMarksDefine ON dbo.ExamGroupDetail.ExamGroupcode = dbo.ExamMarksDefine.ExamGroupcode INNER JOIN
                         dbo.ClassMaster ON dbo.ExamMarksDefine.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.ExamGroupMaster ON dbo.ExamMarksDefine.ExamGroupcode = dbo.ExamGroupMaster.ExamGroupCode
GO
/****** Object:  View [dbo].[ExamMarkMemoTermCovid19]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamMarkMemoTermCovid19]
AS
SELECT     TOP (100) PERCENT dbo.StudInfo.RegID, dbo.StudInfo.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfo.AyCode, dbo.StudInfo.StudentID, dbo.StudInfo.AadharNo, 
                      dbo.StudInfo.Dob, dbo.StudInfo.DobInWord, dbo.StudInfo.MotherName, dbo.StudInfo.Age30Sept, dbo.StudInfo.PermanentAddress, dbo.StudInfo.LocalAddress, dbo.StudInfo.MobileNo1, 
                      dbo.StudInfo.MobileNo2, dbo.StudInfo.BloodGroup, dbo.StudInfo.FatherName, dbo.EducationMaster.EducationName AS FEducation, dbo.OccupationMaster.OccupationName AS FOccupation, 
                      dbo.StudInfo.CloseFlag, dbo.StudInfo.TSuspendedFlag, dbo.StudInfo.AdmissionType, dbo.StudInfo.MediumCode, dbo.StudInfo.ClassCode, dbo.GenderMaster.GenderName, dbo.StudInfo.Photpath, 
                      dbo.StudInfo.RollNo, CityMaster_1.CityName AS PerCity, CityMaster_2.CityName AS LocCity, LanguageMaster_1.LanguageName AS LanguageKnown, dbo.StudInfo.PSResult, dbo.StudInfo.PSRegNo, 
                      EducationMaster_1.EducationName AS MEducation, OccupationMaster_1.OccupationName AS MOccupation, dbo.StudInfo.EntryFrom, dbo.StudInfo.Remark, dbo.StudInfo.StudDisplayFlag, 
                      dbo.StudInfo.MarksFeedFlag, dbo.StudInfo.WeightFT, dbo.StudInfo.WeightST, dbo.StudInfo.HeightFT, dbo.StudInfo.HeightST, dbo.StudInfo.SeatNo, dbo.StudInfo.AdmiSchoolType, 
                      dbo.StudInfo.ReligionCode, dbo.StudInfo.CategoryCode, dbo.StudInfo.Nationality, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.ExamMaster.ExamName, 
                      dbo.SubjectMaster.SubjectName, dbo.ExamMarksDefineReport.ST1Marks1 AS ST1MD1, dbo.ExamMarksDefineReport.ST1Marks2 AS ST1MD2, dbo.ExamMarksDefineReport.ST1Marks3 AS ST1MD3, 
                      dbo.ExamMarksDefineReport.ST1Marks4 AS ST1MD4, dbo.ExamMarksDefineReport.ST1Marks5 AS ST1MD5, dbo.ExamMarksDefineReport.ST1Marks6 AS ST1MD6, 
                      dbo.ExamMarksDefineReport.ST1Marks7 AS ST1MD7, dbo.ExamMarksDefineReport.ST1MarksTotal AS ST1MD, dbo.ExamMarksDefineReport.ST2MarksTotal AS ST2MD, 
                      dbo.ExamMarksDefineReport.ST3MarksTotal AS ST3MD, dbo.ExamMarksDefineReport.SrNo, dbo.ExamMarksDefineReport.ExamCode
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.EducationMaster ON dbo.StudInfo.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                      dbo.OccupationMaster ON dbo.StudInfo.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                      dbo.CategoryMaster ON dbo.StudInfo.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                      dbo.CityMaster AS CityMaster_1 ON dbo.StudInfo.PerCitycode = CityMaster_1.CityCode INNER JOIN
                      dbo.CityMaster AS CityMaster_2 ON dbo.StudInfo.LocCitycode = CityMaster_2.CityCode INNER JOIN
                      dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfo.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
                      dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfo.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                      dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfo.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
                      dbo.ExamMarksDefineReport ON dbo.StudInfo.ClassCode = dbo.ExamMarksDefineReport.ClassCode AND dbo.StudInfo.DivisionCode = dbo.ExamMarksDefineReport.DivisionCode INNER JOIN
                      dbo.ExamMaster ON dbo.ExamMarksDefineReport.ExamCode = dbo.ExamMaster.ExamCode INNER JOIN
                      dbo.SubjectMaster ON dbo.ExamMarksDefineReport.SubjectCode = dbo.SubjectMaster.SubjectCode
ORDER BY dbo.StudInfo.RegID DESC
GO
/****** Object:  View [dbo].[ExamPresentyReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamPresentyReport]
AS
SELECT     dbo.StudInfo.RegID, dbo.StudInfo.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.GenderMaster.GenderShort, dbo.PresentyDaysMonthMaster.SchoolStartDate, 
                      dbo.PresentyDaysMonthMaster.Jun, dbo.PresentyDaysMonthMaster.Jully, dbo.PresentyDaysMonthMaster.Aug, dbo.PresentyDaysMonthMaster.Sept, dbo.PresentyDaysMonthMaster.Oct, 
                      dbo.PresentyDaysMonthMaster.Nov, dbo.PresentyDaysMonthMaster.Dec, dbo.PresentyDaysMonthMaster.Jan, dbo.PresentyDaysMonthMaster.Feb, dbo.PresentyDaysMonthMaster.Mar, 
                      dbo.PresentyDaysMonthMaster.Apr, dbo.PresentyDaysMonthMaster.May, dbo.PresentyDaysMonthMaster.FTTotal, dbo.PresentyDaysMonthMaster.STTotal, dbo.PresentyDaysMonthMaster.Total, 
                      dbo.StudentPresentyEntry.Jun AS PJun, dbo.StudentPresentyEntry.Jully AS PJully, dbo.StudentPresentyEntry.Aug AS PAug, dbo.StudentPresentyEntry.Sept AS PSept, 
                      dbo.StudentPresentyEntry.Oct AS POct, dbo.StudentPresentyEntry.Nov AS PNov, dbo.StudentPresentyEntry.Dec AS PDec, dbo.StudentPresentyEntry.Jan AS PJan, 
                      dbo.StudentPresentyEntry.Feb AS PFeb, dbo.StudentPresentyEntry.Mar AS PMar, dbo.StudentPresentyEntry.Apr AS PApr, dbo.StudentPresentyEntry.May AS PMay, 
                      dbo.StudentPresentyEntry.FTTotal AS PFTTotal, dbo.StudentPresentyEntry.STTotal AS PSTTotal, dbo.StudentPresentyEntry.Total AS PTotal, dbo.GenderMaster.GenderName, dbo.StudInfo.AyCode, 
                      dbo.StudInfo.RollNo
FROM         dbo.StudInfo INNER JOIN
                      dbo.PresentyDaysMonthMaster ON dbo.StudInfo.ClassCode = dbo.PresentyDaysMonthMaster.ClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfo.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode LEFT OUTER JOIN
                      dbo.StudentPresentyEntry ON dbo.StudInfo.RegID = dbo.StudentPresentyEntry.RegID
GO
/****** Object:  View [dbo].[ExamMarkMemoTerm]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamMarkMemoTerm]
AS
SELECT        TOP (100) PERCENT dbo.StudInfo.RegID, dbo.StudInfo.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                         dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                         CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END AS StudentName, 
                         CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END AS Student, 
                         dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfo.AyCode, dbo.StudInfo.StudentID, dbo.StudInfo.AadharNo, dbo.StudInfo.Dob, dbo.StudInfo.DobInWord, 
                         dbo.StudInfo.MotherName, dbo.StudInfo.Age30Sept, dbo.StudInfo.PermanentAddress, dbo.StudInfo.LocalAddress, dbo.StudInfo.MobileNo1, dbo.StudInfo.MobileNo2, dbo.StudInfo.BloodGroup, dbo.StudInfo.FatherName, 
                         dbo.EducationMaster.EducationName AS FEducation, dbo.OccupationMaster.OccupationName AS FOccupation, dbo.StudInfo.CloseFlag, dbo.StudInfo.TSuspendedFlag, dbo.StudInfo.AdmissionType, dbo.StudInfo.MediumCode, 
                         dbo.StudInfo.ClassCode, dbo.GenderMaster.GenderName, dbo.StudInfo.Photpath, dbo.StudInfo.RollNo, CityMaster_1.CityName AS PerCity, CityMaster_2.CityName AS LocCity, 
                         LanguageMaster_1.LanguageName AS LanguageKnown, dbo.StudInfo.PSResult, dbo.StudInfo.PSRegNo, EducationMaster_1.EducationName AS MEducation, OccupationMaster_1.OccupationName AS MOccupation, 
                         dbo.StudInfo.EntryFrom, dbo.StudInfo.Remark, dbo.StudInfo.StudDisplayFlag, dbo.StudInfo.MarksFeedFlag, dbo.StudInfo.WeightFT, dbo.StudInfo.WeightST, dbo.StudInfo.HeightFT, dbo.StudInfo.HeightST, dbo.StudInfo.SeatNo, 
                         dbo.StudInfo.AdmiSchoolType, dbo.StudInfo.ReligionCode, dbo.StudInfo.CategoryCode, dbo.StudInfo.Nationality, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.StudentExamMarksEntry.ExamCode, 
                         dbo.ExamMaster.ExamName, dbo.StudentExamMarksEntry.SubjectCode, dbo.SubjectMaster.SubjectName, dbo.StudentExamMarksEntry.ST1Marks1F, dbo.StudentExamMarksEntry.ST1Marks2F, 
                         dbo.StudentExamMarksEntry.ST1Marks3F, dbo.StudentExamMarksEntry.ST1Marks4F, dbo.StudentExamMarksEntry.ST1Marks5F, dbo.StudentExamMarksEntry.ST1Marks6F, dbo.StudentExamMarksEntry.ST1Marks7F, 
                         dbo.StudentExamMarksEntry.ST1MarksTotalF, dbo.StudentExamMarksEntry.ST2MarksTotalF, dbo.StudentExamMarksEntry.ST3MarksTotalF, dbo.StudentExamMarksEntry.MaxMarksTotalF, 
                         dbo.StudentExamMarksEntry.MarksTotalF, dbo.StudentExamMarksEntry.MarksAddInTotalFlag, dbo.StudentExamMarksEntry.SubPer, dbo.StudentExamMarksEntry.SubGrade, dbo.StudentExamMarksEntry.GradeRemark, 
                         dbo.StudentExamMarksEntry.SubjectDE, dbo.StudentExamMarksEntry.ST1Marks1, dbo.StudentExamMarksEntry.ST1Marks2, dbo.StudentExamMarksEntry.ST1Marks3, dbo.StudentExamMarksEntry.ST1Marks4, 
                         dbo.StudentExamMarksEntry.ST1Marks5, dbo.StudentExamMarksEntry.ST1Marks6, dbo.StudentExamMarksEntry.ST1Marks7, dbo.StudentExamMarksEntry.ST1MarksTotal, dbo.StudentExamMarksEntry.ST2MarksTotal, 
                         dbo.StudentExamMarksEntry.ST3MarksTotal, dbo.StudentExamMarksEntry.MaxMarksTotal, dbo.StudentExamMarksEntry.MarksTotal, dbo.StudentExamMarksSummary.Marks AS GMarks, 
                         dbo.StudentExamMarksSummary.MaxMarks AS GMaxMarks, dbo.StudentExamMarksSummary.Per AS GPer, dbo.StudentExamMarksSummary.Grade AS GGrade, 
                         dbo.StudentExamMarksSummary.GradeRemark AS GGradeRemark, dbo.StudentExamMarksSummary.Rank, dbo.ExamMarksDefineReport.ST1Marks1 AS ST1MD1, dbo.ExamMarksDefineReport.ST1Marks2 AS ST1MD2, 
                         dbo.ExamMarksDefineReport.ST1Marks3 AS ST1MD3, dbo.ExamMarksDefineReport.ST1Marks4 AS ST1MD4, dbo.ExamMarksDefineReport.ST1Marks5 AS ST1MD5, dbo.ExamMarksDefineReport.ST1Marks6 AS ST1MD6, 
                         dbo.ExamMarksDefineReport.ST1Marks7 AS ST1MD7, dbo.ExamMarksDefineReport.ST1MarksTotal AS ST1MD, dbo.ExamMarksDefineReport.ST2MarksTotal AS ST2MD, dbo.ExamMarksDefineReport.ST3MarksTotal AS ST3MD, 
                         dbo.ExamMarksDefineReport.SrNo, dbo.StudInfo.DeleteFlag, dbo.StudInfo.NationalCode, dbo.ExamMarksDefineReport.MinMarks, dbo.ExamMarksDefineReport.MaxMarks, dbo.CityMaster.CityName AS BirthPlace, 
                         dbo.ExamPresentyReport.SchoolStartDate, dbo.ExamPresentyReport.Jun, dbo.ExamPresentyReport.Jully, dbo.ExamPresentyReport.Aug, dbo.ExamPresentyReport.Sept, dbo.ExamPresentyReport.Oct, 
                         dbo.ExamPresentyReport.Nov, dbo.ExamPresentyReport.Dec, dbo.ExamPresentyReport.Jan, dbo.ExamPresentyReport.Feb, dbo.ExamPresentyReport.Mar, dbo.ExamPresentyReport.Apr, dbo.ExamPresentyReport.May, 
                         dbo.ExamPresentyReport.FTTotal, dbo.ExamPresentyReport.STTotal, dbo.ExamPresentyReport.Total, dbo.ExamPresentyReport.PJun, dbo.ExamPresentyReport.PJully, dbo.ExamPresentyReport.PAug, 
                         dbo.ExamPresentyReport.PSept, dbo.ExamPresentyReport.POct, dbo.ExamPresentyReport.PNov, dbo.ExamPresentyReport.PDec, dbo.ExamPresentyReport.PJan, dbo.ExamPresentyReport.PFeb, 
                         dbo.ExamPresentyReport.PMar, dbo.ExamPresentyReport.PApr, dbo.ExamPresentyReport.PMay, dbo.ExamPresentyReport.PFTTotal, dbo.ExamPresentyReport.PSTTotal, dbo.ExamPresentyReport.PTotal, 
                         dbo.MainClassMaster.SanlagntaNo, dbo.SubjectMaster.SubjectCodeBoard
FROM            dbo.GenderMaster INNER JOIN
                         dbo.StudInfo INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.EducationMaster ON dbo.StudInfo.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                         dbo.OccupationMaster ON dbo.StudInfo.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                         dbo.CategoryMaster ON dbo.StudInfo.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                         dbo.CityMaster AS CityMaster_1 ON dbo.StudInfo.PerCitycode = CityMaster_1.CityCode INNER JOIN
                         dbo.CityMaster AS CityMaster_2 ON dbo.StudInfo.LocCitycode = CityMaster_2.CityCode INNER JOIN
                         dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfo.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
                         dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfo.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                         dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfo.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
                         dbo.StudentExamMarksEntry ON dbo.StudInfo.RegID = dbo.StudentExamMarksEntry.RegID INNER JOIN
                         dbo.ExamMaster ON dbo.StudentExamMarksEntry.ExamCode = dbo.ExamMaster.ExamCode INNER JOIN
                         dbo.SubjectMaster ON dbo.StudentExamMarksEntry.SubjectCode = dbo.SubjectMaster.SubjectCode INNER JOIN
                         dbo.StudentExamMarksSummary ON dbo.StudInfo.RegID = dbo.StudentExamMarksSummary.RegID AND dbo.StudentExamMarksEntry.ExamCode = dbo.StudentExamMarksSummary.ExamCode INNER JOIN
                         dbo.ExamMarksDefineReport ON dbo.StudentExamMarksEntry.ExamCode = dbo.ExamMarksDefineReport.ExamCode AND dbo.StudentExamMarksEntry.SubjectCode = dbo.ExamMarksDefineReport.SubjectCode AND 
                         dbo.StudInfo.ClassCode = dbo.ExamMarksDefineReport.ClassCode AND dbo.StudInfo.DivisionCode = dbo.ExamMarksDefineReport.DivisionCode INNER JOIN
                         dbo.CityMaster ON dbo.StudInfo.BirthPlaceCode = dbo.CityMaster.CityCode LEFT OUTER JOIN
                         dbo.ExamPresentyReport ON dbo.StudInfo.MainClassCode = dbo.ExamPresentyReport.MainClassCode AND dbo.StudInfo.RegID = dbo.ExamPresentyReport.RegID
GROUP BY dbo.StudInfo.RegID, dbo.StudInfo.MainClassCode, dbo.MainClassMaster.MainClassName, dbo.MediumMaster.MediumName, dbo.ClassMaster.ClassName, dbo.DivisionMaster.DivisionName, dbo.StudInfo.RegNo, 
                         dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfo.AyCode, dbo.StudInfo.StudentID, dbo.StudInfo.AadharNo, dbo.StudInfo.Dob, dbo.StudInfo.DobInWord, 
                         dbo.StudInfo.MotherName, dbo.StudInfo.Age30Sept, dbo.StudInfo.PermanentAddress, dbo.StudInfo.LocalAddress, dbo.StudInfo.MobileNo1, dbo.StudInfo.MobileNo2, dbo.StudInfo.BloodGroup, dbo.StudInfo.FatherName, 
                         dbo.EducationMaster.EducationName, dbo.OccupationMaster.OccupationName, dbo.StudInfo.CloseFlag, dbo.StudInfo.TSuspendedFlag, dbo.StudInfo.AdmissionType, dbo.StudInfo.MediumCode, dbo.StudInfo.ClassCode, 
                         dbo.GenderMaster.GenderName, dbo.StudInfo.Photpath, dbo.StudInfo.RollNo, CityMaster_1.CityName, CityMaster_2.CityName, LanguageMaster_1.LanguageName, dbo.StudInfo.PSResult, dbo.StudInfo.PSRegNo, 
                         EducationMaster_1.EducationName, OccupationMaster_1.OccupationName, dbo.StudInfo.EntryFrom, dbo.StudInfo.Remark, dbo.StudInfo.StudDisplayFlag, dbo.StudInfo.MarksFeedFlag, dbo.StudInfo.WeightFT, 
                         dbo.StudInfo.WeightST, dbo.StudInfo.HeightFT, dbo.StudInfo.HeightST, dbo.StudInfo.SeatNo, dbo.StudInfo.AdmiSchoolType, dbo.StudInfo.ReligionCode, dbo.StudInfo.CategoryCode, dbo.StudInfo.Nationality, 
                         dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.StudentExamMarksEntry.ExamCode, dbo.ExamMaster.ExamName, dbo.StudentExamMarksEntry.SubjectCode, dbo.SubjectMaster.SubjectName, 
                         dbo.StudentExamMarksEntry.ST1Marks1F, dbo.StudentExamMarksEntry.ST1Marks2F, dbo.StudentExamMarksEntry.ST1Marks3F, dbo.StudentExamMarksEntry.ST1Marks4F, dbo.StudentExamMarksEntry.ST1Marks5F, 
                         dbo.StudentExamMarksEntry.ST1Marks6F, dbo.StudentExamMarksEntry.ST1Marks7F, dbo.StudentExamMarksEntry.ST1MarksTotalF, dbo.StudentExamMarksEntry.ST2MarksTotalF, 
                         dbo.StudentExamMarksEntry.ST3MarksTotalF, dbo.StudentExamMarksEntry.MaxMarksTotalF, dbo.StudentExamMarksEntry.MarksTotalF, dbo.StudentExamMarksEntry.MarksAddInTotalFlag, dbo.StudentExamMarksEntry.SubPer,
                          dbo.StudentExamMarksEntry.SubGrade, dbo.StudentExamMarksEntry.GradeRemark, dbo.StudentExamMarksEntry.SubjectDE, dbo.StudentExamMarksEntry.ST1Marks1, dbo.StudentExamMarksEntry.ST1Marks2, 
                         dbo.StudentExamMarksEntry.ST1Marks3, dbo.StudentExamMarksEntry.ST1Marks4, dbo.StudentExamMarksEntry.ST1Marks5, dbo.StudentExamMarksEntry.ST1Marks6, dbo.StudentExamMarksEntry.ST1Marks7, 
                         dbo.StudentExamMarksEntry.ST1MarksTotal, dbo.StudentExamMarksEntry.ST2MarksTotal, dbo.StudentExamMarksEntry.ST3MarksTotal, dbo.StudentExamMarksEntry.MaxMarksTotal, dbo.StudentExamMarksEntry.MarksTotal, 
                         dbo.StudentExamMarksSummary.Marks, dbo.StudentExamMarksSummary.MaxMarks, dbo.StudentExamMarksSummary.Per, dbo.StudentExamMarksSummary.Grade, dbo.StudentExamMarksSummary.GradeRemark, 
                         dbo.StudentExamMarksSummary.Rank, dbo.ExamMarksDefineReport.ST1Marks1, dbo.ExamMarksDefineReport.ST1Marks2, dbo.ExamMarksDefineReport.ST1Marks3, dbo.ExamMarksDefineReport.ST1Marks4, 
                         dbo.ExamMarksDefineReport.ST1Marks5, dbo.ExamMarksDefineReport.ST1Marks6, dbo.ExamMarksDefineReport.ST1Marks7, dbo.ExamMarksDefineReport.ST1MarksTotal, dbo.ExamMarksDefineReport.ST2MarksTotal, 
                         dbo.ExamMarksDefineReport.ST3MarksTotal, dbo.ExamMarksDefineReport.SrNo, dbo.StudInfo.DeleteFlag, dbo.StudInfo.NationalCode, dbo.ExamMarksDefineReport.MinMarks, dbo.ExamMarksDefineReport.MaxMarks, 
                         dbo.CityMaster.CityName, dbo.ExamPresentyReport.SchoolStartDate, dbo.ExamPresentyReport.Jun, dbo.ExamPresentyReport.Jully, dbo.ExamPresentyReport.Aug, dbo.ExamPresentyReport.Sept, dbo.ExamPresentyReport.Oct, 
                         dbo.ExamPresentyReport.Nov, dbo.ExamPresentyReport.Dec, dbo.ExamPresentyReport.Jan, dbo.ExamPresentyReport.Feb, dbo.ExamPresentyReport.Mar, dbo.ExamPresentyReport.Apr, dbo.ExamPresentyReport.May, 
                         dbo.ExamPresentyReport.FTTotal, dbo.ExamPresentyReport.STTotal, dbo.ExamPresentyReport.Total, dbo.ExamPresentyReport.PJun, dbo.ExamPresentyReport.PJully, dbo.ExamPresentyReport.PAug, 
                         dbo.ExamPresentyReport.PSept, dbo.ExamPresentyReport.POct, dbo.ExamPresentyReport.PNov, dbo.ExamPresentyReport.PDec, dbo.ExamPresentyReport.PJan, dbo.ExamPresentyReport.PFeb, 
                         dbo.ExamPresentyReport.PMar, dbo.ExamPresentyReport.PApr, dbo.ExamPresentyReport.PMay, dbo.ExamPresentyReport.PFTTotal, dbo.ExamPresentyReport.PSTTotal, dbo.ExamPresentyReport.PTotal, 
                         dbo.MainClassMaster.SanlagntaNo, dbo.SubjectMaster.SubjectCodeBoard
HAVING        (dbo.StudInfo.DeleteFlag = N'N')
ORDER BY dbo.StudInfo.RegID DESC
GO
/****** Object:  View [dbo].[ExamMarkMemoAnnualHorizontal]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamMarkMemoAnnualHorizontal]
AS
SELECT     TOP (100) PERCENT dbo.StudInfo.RegID, dbo.StudInfo.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfo.AyCode, dbo.StudInfo.AdmittionDate, dbo.StudInfo.StudentID, 
                      dbo.StudInfo.AadharNo, dbo.StudInfo.Dob, dbo.StudInfo.MotherName, dbo.StudInfo.LocalAddress, dbo.StudInfo.FatherName, dbo.EducationMaster.EducationName AS FEducation, 
                      dbo.OccupationMaster.OccupationName AS FOccupation, dbo.StudInfo.CloseFlag, dbo.StudInfo.TSuspendedFlag, dbo.StudInfo.AdmissionType, dbo.StudInfo.MediumCode, dbo.StudInfo.ClassCode, 
                      dbo.GenderMaster.GenderName, dbo.StudInfo.Photpath, dbo.StudInfo.RollNo, CityMaster_2.CityName AS LocCity, EducationMaster_1.EducationName AS MEducation, 
                      OccupationMaster_1.OccupationName AS MOccupation, dbo.StudInfo.EntryFrom, dbo.StudInfo.StudDisplayFlag, dbo.StudInfo.MarksFeedFlag, dbo.StudInfo.WeightFT, dbo.StudInfo.WeightST, 
                      dbo.StudInfo.HeightFT, dbo.StudInfo.HeightST, dbo.StudInfo.SeatNo, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.StudInfo.BloodGroup, 
                      dbo.ExamPresentyReport.SchoolStartDate, dbo.ExamPresentyReport.Jun, dbo.ExamPresentyReport.Jully, dbo.ExamPresentyReport.Aug, dbo.ExamPresentyReport.Sept, 
                      dbo.ExamPresentyReport.Oct, dbo.ExamPresentyReport.Nov, dbo.ExamPresentyReport.Dec, dbo.ExamPresentyReport.Jan, dbo.ExamPresentyReport.Feb, dbo.ExamPresentyReport.Mar, 
                      dbo.ExamPresentyReport.Apr, dbo.ExamPresentyReport.May, dbo.ExamPresentyReport.FTTotal, dbo.ExamPresentyReport.STTotal, dbo.ExamPresentyReport.Total, dbo.ExamPresentyReport.PJun, 
                      dbo.ExamPresentyReport.PJully, dbo.ExamPresentyReport.PAug, dbo.ExamPresentyReport.PSept, dbo.ExamPresentyReport.POct, dbo.ExamPresentyReport.PNov, dbo.ExamPresentyReport.PDec, 
                      dbo.ExamPresentyReport.PJan, dbo.ExamPresentyReport.PFeb, dbo.ExamPresentyReport.PMar, dbo.ExamPresentyReport.PApr, dbo.ExamPresentyReport.PMay, 
                      dbo.ExamPresentyReport.PFTTotal, dbo.ExamPresentyReport.PSTTotal, dbo.ExamPresentyReport.PTotal, dbo.TempExamAnnualMMHorizontal.SN1, dbo.TempExamAnnualMMHorizontal.S1MD1, 
                      dbo.TempExamAnnualMMHorizontal.S1MD2, dbo.TempExamAnnualMMHorizontal.S1MD3, dbo.TempExamAnnualMMHorizontal.S1M1, dbo.TempExamAnnualMMHorizontal.S1M2, 
                      dbo.TempExamAnnualMMHorizontal.S1M3, dbo.TempExamAnnualMMHorizontal.S1MDT, dbo.TempExamAnnualMMHorizontal.S1MT, dbo.TempExamAnnualMMHorizontal.S1Per, 
                      dbo.TempExamAnnualMMHorizontal.S1Grade, dbo.TempExamAnnualMMHorizontal.SN2, dbo.TempExamAnnualMMHorizontal.S2MD1, dbo.TempExamAnnualMMHorizontal.S2MD2, 
                      dbo.TempExamAnnualMMHorizontal.S2MD3, dbo.TempExamAnnualMMHorizontal.S2M1, dbo.TempExamAnnualMMHorizontal.S2M2, dbo.TempExamAnnualMMHorizontal.S2M3, 
                      dbo.TempExamAnnualMMHorizontal.S2MDT, dbo.TempExamAnnualMMHorizontal.S2MT, dbo.TempExamAnnualMMHorizontal.S2Per, dbo.TempExamAnnualMMHorizontal.S2Grade, 
                      dbo.TempExamAnnualMMHorizontal.SN3, dbo.TempExamAnnualMMHorizontal.S3MD1, dbo.TempExamAnnualMMHorizontal.S3MD2, dbo.TempExamAnnualMMHorizontal.S3MD3, 
                      dbo.TempExamAnnualMMHorizontal.S3M1, dbo.TempExamAnnualMMHorizontal.S3M2, dbo.TempExamAnnualMMHorizontal.S3M3, dbo.TempExamAnnualMMHorizontal.S3MDT, 
                      dbo.TempExamAnnualMMHorizontal.S3MT, dbo.TempExamAnnualMMHorizontal.S3Per, dbo.TempExamAnnualMMHorizontal.S3Grade, dbo.TempExamAnnualMMHorizontal.SN4, 
                      dbo.TempExamAnnualMMHorizontal.S4MD1, dbo.TempExamAnnualMMHorizontal.S4MD2, dbo.TempExamAnnualMMHorizontal.S4MD3, dbo.TempExamAnnualMMHorizontal.S4M1, 
                      dbo.TempExamAnnualMMHorizontal.S4M2, dbo.TempExamAnnualMMHorizontal.S4M3, dbo.TempExamAnnualMMHorizontal.S4MDT, dbo.TempExamAnnualMMHorizontal.S4MT, 
                      dbo.TempExamAnnualMMHorizontal.S4Per, dbo.TempExamAnnualMMHorizontal.S4Grade, dbo.TempExamAnnualMMHorizontal.SN5, dbo.TempExamAnnualMMHorizontal.S5MD1, 
                      dbo.TempExamAnnualMMHorizontal.S5MD2, dbo.TempExamAnnualMMHorizontal.S5MD3, dbo.TempExamAnnualMMHorizontal.S5M1, dbo.TempExamAnnualMMHorizontal.S5M2, 
                      dbo.TempExamAnnualMMHorizontal.S5M3, dbo.TempExamAnnualMMHorizontal.S5MDT, dbo.TempExamAnnualMMHorizontal.S5MT, dbo.TempExamAnnualMMHorizontal.S5Per, 
                      dbo.TempExamAnnualMMHorizontal.S5Grade, dbo.TempExamAnnualMMHorizontal.SN6, dbo.TempExamAnnualMMHorizontal.S6MD1, dbo.TempExamAnnualMMHorizontal.S6MD2, 
                      dbo.TempExamAnnualMMHorizontal.S6MD3, dbo.TempExamAnnualMMHorizontal.S6M1, dbo.TempExamAnnualMMHorizontal.S6M2, dbo.TempExamAnnualMMHorizontal.S6M3, 
                      dbo.TempExamAnnualMMHorizontal.S6MDT, dbo.TempExamAnnualMMHorizontal.S6MT, dbo.TempExamAnnualMMHorizontal.S6Per, dbo.TempExamAnnualMMHorizontal.S6Grade, 
                      dbo.TempExamAnnualMMHorizontal.SN7, dbo.TempExamAnnualMMHorizontal.S7MD1, dbo.TempExamAnnualMMHorizontal.S7MD2, dbo.TempExamAnnualMMHorizontal.S7MD3, 
                      dbo.TempExamAnnualMMHorizontal.S7M1, dbo.TempExamAnnualMMHorizontal.S7M2, dbo.TempExamAnnualMMHorizontal.S7M3, dbo.TempExamAnnualMMHorizontal.S7MDT, 
                      dbo.TempExamAnnualMMHorizontal.S7MT, dbo.TempExamAnnualMMHorizontal.S7Per, dbo.TempExamAnnualMMHorizontal.S7Grade, dbo.TempExamAnnualMMHorizontal.SN8, 
                      dbo.TempExamAnnualMMHorizontal.S8MD1, dbo.TempExamAnnualMMHorizontal.S8MD2, dbo.TempExamAnnualMMHorizontal.S8MD3, dbo.TempExamAnnualMMHorizontal.S8M1, 
                      dbo.TempExamAnnualMMHorizontal.S8M2, dbo.TempExamAnnualMMHorizontal.S8M3, dbo.TempExamAnnualMMHorizontal.S8MDT, dbo.TempExamAnnualMMHorizontal.S8MT, 
                      dbo.TempExamAnnualMMHorizontal.S8Per, dbo.TempExamAnnualMMHorizontal.S8Grade, dbo.TempExamAnnualMMHorizontal.SN9, dbo.TempExamAnnualMMHorizontal.S9MD1, 
                      dbo.TempExamAnnualMMHorizontal.S9MD2, dbo.TempExamAnnualMMHorizontal.S9MD3, dbo.TempExamAnnualMMHorizontal.S9M1, dbo.TempExamAnnualMMHorizontal.S9M2, 
                      dbo.TempExamAnnualMMHorizontal.S9M3, dbo.TempExamAnnualMMHorizontal.S9MDT, dbo.TempExamAnnualMMHorizontal.S9MT, dbo.TempExamAnnualMMHorizontal.S9Per, 
                      dbo.TempExamAnnualMMHorizontal.S9Grade, dbo.TempExamAnnualMMHorizontal.SN10, dbo.TempExamAnnualMMHorizontal.S10MD1, dbo.TempExamAnnualMMHorizontal.S10MD2, 
                      dbo.TempExamAnnualMMHorizontal.S10MD3, dbo.TempExamAnnualMMHorizontal.S10M1, dbo.TempExamAnnualMMHorizontal.S10M2, dbo.TempExamAnnualMMHorizontal.S10M3, 
                      dbo.TempExamAnnualMMHorizontal.S10MDT, dbo.TempExamAnnualMMHorizontal.S10MT, dbo.TempExamAnnualMMHorizontal.S10Per, dbo.TempExamAnnualMMHorizontal.S10Grade, 
                      dbo.TempExamAnnualMMHorizontal.SN11, dbo.TempExamAnnualMMHorizontal.S11MD1, dbo.TempExamAnnualMMHorizontal.S11MD2, dbo.TempExamAnnualMMHorizontal.S11MD3, 
                      dbo.TempExamAnnualMMHorizontal.S11M1, dbo.TempExamAnnualMMHorizontal.S11M2, dbo.TempExamAnnualMMHorizontal.S11M3, dbo.TempExamAnnualMMHorizontal.S11MDT, 
                      dbo.TempExamAnnualMMHorizontal.S11MT, dbo.TempExamAnnualMMHorizontal.S11Per, dbo.TempExamAnnualMMHorizontal.S11Grade, dbo.TempExamAnnualMMHorizontal.SN12, 
                      dbo.TempExamAnnualMMHorizontal.S12MD1, dbo.TempExamAnnualMMHorizontal.S12MD2, dbo.TempExamAnnualMMHorizontal.S12MD3, dbo.TempExamAnnualMMHorizontal.S12M1, 
                      dbo.TempExamAnnualMMHorizontal.S12M2, dbo.TempExamAnnualMMHorizontal.S12M3, dbo.TempExamAnnualMMHorizontal.S12MDT, dbo.TempExamAnnualMMHorizontal.S12MT, 
                      dbo.TempExamAnnualMMHorizontal.S12Per, dbo.TempExamAnnualMMHorizontal.S12Grade, dbo.TempExamAnnualMMHorizontal.SN13, dbo.TempExamAnnualMMHorizontal.S13MD1, 
                      dbo.TempExamAnnualMMHorizontal.S13MD2, dbo.TempExamAnnualMMHorizontal.S13MD3, dbo.TempExamAnnualMMHorizontal.S13M1, dbo.TempExamAnnualMMHorizontal.S13M2, 
                      dbo.TempExamAnnualMMHorizontal.S13M3, dbo.TempExamAnnualMMHorizontal.S13MDT, dbo.TempExamAnnualMMHorizontal.S13MT, dbo.TempExamAnnualMMHorizontal.S13Per, 
                      dbo.TempExamAnnualMMHorizontal.S13Grade, dbo.TempExamAnnualMMHorizontal.SN14, dbo.TempExamAnnualMMHorizontal.S14MD1, dbo.TempExamAnnualMMHorizontal.S14MD2, 
                      dbo.TempExamAnnualMMHorizontal.S14MD3, dbo.TempExamAnnualMMHorizontal.S14M1, dbo.TempExamAnnualMMHorizontal.S14M2, dbo.TempExamAnnualMMHorizontal.S14M3, 
                      dbo.TempExamAnnualMMHorizontal.S14MDT, dbo.TempExamAnnualMMHorizontal.S14MT, dbo.TempExamAnnualMMHorizontal.S14Per, dbo.TempExamAnnualMMHorizontal.S14Grade, 
                      dbo.TempExamAnnualMMHorizontal.SN15, dbo.TempExamAnnualMMHorizontal.S15MD1, dbo.TempExamAnnualMMHorizontal.S15MD2, dbo.TempExamAnnualMMHorizontal.S15MD3, 
                      dbo.TempExamAnnualMMHorizontal.S15M1, dbo.TempExamAnnualMMHorizontal.S15M2, dbo.TempExamAnnualMMHorizontal.S15M3, dbo.TempExamAnnualMMHorizontal.S15MDT, 
                      dbo.TempExamAnnualMMHorizontal.S15MT, dbo.TempExamAnnualMMHorizontal.S15Per, dbo.TempExamAnnualMMHorizontal.S15Grade, dbo.TempExamAnnualMMHorizontal.SN16, 
                      dbo.TempExamAnnualMMHorizontal.S16MD1, dbo.TempExamAnnualMMHorizontal.S16MD2, dbo.TempExamAnnualMMHorizontal.S16MD3, dbo.TempExamAnnualMMHorizontal.S16M1, 
                      dbo.TempExamAnnualMMHorizontal.S16M2, dbo.TempExamAnnualMMHorizontal.S16M3, dbo.TempExamAnnualMMHorizontal.S16MDT, dbo.TempExamAnnualMMHorizontal.S16MT, 
                      dbo.TempExamAnnualMMHorizontal.S16Per, dbo.TempExamAnnualMMHorizontal.S16Grade, dbo.TempExamAnnualMMHorizontal.SN17, dbo.TempExamAnnualMMHorizontal.S17MD1, 
                      dbo.TempExamAnnualMMHorizontal.S17MD2, dbo.TempExamAnnualMMHorizontal.S17MD3, dbo.TempExamAnnualMMHorizontal.S17M1, dbo.TempExamAnnualMMHorizontal.S17M2, 
                      dbo.TempExamAnnualMMHorizontal.S17M3, dbo.TempExamAnnualMMHorizontal.S17MDT, dbo.TempExamAnnualMMHorizontal.S17MT, dbo.TempExamAnnualMMHorizontal.S17Per, 
                      dbo.TempExamAnnualMMHorizontal.S17Grade, dbo.TempExamAnnualMMHorizontal.SN18, dbo.TempExamAnnualMMHorizontal.S18MD1, dbo.TempExamAnnualMMHorizontal.S18MD2, 
                      dbo.TempExamAnnualMMHorizontal.S18MD3, dbo.TempExamAnnualMMHorizontal.S18M1, dbo.TempExamAnnualMMHorizontal.S18M2, dbo.TempExamAnnualMMHorizontal.S18M3, 
                      dbo.TempExamAnnualMMHorizontal.S18MDT, dbo.TempExamAnnualMMHorizontal.S18MT, dbo.TempExamAnnualMMHorizontal.S18Per, dbo.TempExamAnnualMMHorizontal.S18Grade, 
                      dbo.TempExamAnnualMMHorizontal.GMDT, dbo.TempExamAnnualMMHorizontal.GMT, dbo.TempExamAnnualMMHorizontal.GPer, dbo.TempExamAnnualMMHorizontal.GGrade, 
                      dbo.TempExamAnnualMMHorizontal.GGradeRemark, dbo.TempExamAnnualMMHorizontal.Rank, dbo.StudInfo.DeleteFlag, dbo.StudInfo.FirstnameE, dbo.StudInfo.MiddleNameE, 
                      dbo.StudInfo.LastNameE, 
                      CASE dbo.StudInfo.LastNameE WHEN '-' THEN dbo.StudInfo.FirstnameE + ' ' + dbo.StudInfo.MiddleNameE ELSE dbo.StudInfo.FirstnameE + ' ' + dbo.StudInfo.MiddleNameE + ' ' + dbo.StudInfo.LastNameE
                       END AS StudentNameE, dbo.StudInfo.MotherNameE, dbo.StudInfo.MobileNo1, dbo.StudInfo.MobileNo2
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.EducationMaster ON dbo.StudInfo.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                      dbo.OccupationMaster ON dbo.StudInfo.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                      dbo.CityMaster AS CityMaster_2 ON dbo.StudInfo.LocCitycode = CityMaster_2.CityCode INNER JOIN
                      dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfo.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                      dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfo.MCccupationCode = OccupationMaster_1.OccupationCode LEFT OUTER JOIN
                      dbo.TempExamAnnualMMHorizontal ON dbo.StudInfo.RegID = dbo.TempExamAnnualMMHorizontal.RegID LEFT OUTER JOIN
                      dbo.ExamPresentyReport ON dbo.StudInfo.RegID = dbo.ExamPresentyReport.RegID
WHERE     (dbo.StudInfo.DeleteFlag = N'N')
ORDER BY dbo.StudInfo.RegID DESC
GO
/****** Object:  View [dbo].[ExamMarkMemoAnnual]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamMarkMemoAnnual]
AS
SELECT        TOP (100) PERCENT dbo.StudInfo.RegID, dbo.StudInfo.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                         dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                         CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END AS StudentName, 
                         CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END AS Student, 
                         dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfo.AyCode, dbo.StudInfo.AdmittionDate, dbo.StudInfo.StudentID, dbo.StudInfo.AadharNo, dbo.StudInfo.Dob, 
                         dbo.StudInfo.MotherName, dbo.StudInfo.LocalAddress, dbo.StudInfo.FatherName, dbo.EducationMaster.EducationName AS FEducation, dbo.OccupationMaster.OccupationName AS FOccupation, dbo.StudInfo.CloseFlag, 
                         dbo.StudInfo.TSuspendedFlag, dbo.StudInfo.AdmissionType, dbo.StudInfo.MediumCode, dbo.StudInfo.ClassCode, dbo.GenderMaster.GenderName, dbo.StudInfo.Photpath, dbo.StudInfo.RollNo, CityMaster_2.CityName AS LocCity, 
                         EducationMaster_1.EducationName AS MEducation, OccupationMaster_1.OccupationName AS MOccupation, dbo.StudInfo.EntryFrom, dbo.StudInfo.StudDisplayFlag, dbo.StudInfo.MarksFeedFlag, dbo.StudInfo.WeightFT, 
                         dbo.StudInfo.WeightST, dbo.StudInfo.HeightFT, dbo.StudInfo.HeightST, dbo.StudInfo.SeatNo, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.StudInfo.BloodGroup, 
                         dbo.StudentExamAnnualMMSummary.E1GMaxMarksTotal, dbo.StudentExamAnnualMMSummary.E1GMarksTotal, dbo.StudentExamAnnualMMSummary.E1GPer, dbo.StudentExamAnnualMMSummary.E1GGrade, 
                         dbo.StudentExamAnnualMMSummary.E1GradeRemark, dbo.StudentExamAnnualMMSummary.E1Rank, dbo.StudentExamAnnualMMSummary.E2GMaxMarksTotal, dbo.StudentExamAnnualMMSummary.E2GMarksTotal, 
                         dbo.StudentExamAnnualMMSummary.E2GPer, dbo.StudentExamAnnualMMSummary.E2GGrade, dbo.StudentExamAnnualMMSummary.E2GGradeRemark, dbo.StudentExamAnnualMMSummary.E2Rank, 
                         dbo.StudentExamAnnualMMSummary.GMaxMarksTotal, dbo.StudentExamAnnualMMSummary.GMarksTotal, dbo.StudentExamAnnualMMSummary.GPer, dbo.StudentExamAnnualMMSummary.GGrade, 
                         dbo.StudentExamAnnualMMSummary.GGradeRemark, dbo.StudentExamAnnualMMSummary.GRank, dbo.ExamPresentyReport.SchoolStartDate, dbo.ExamPresentyReport.Jun, dbo.ExamPresentyReport.Jully, 
                         dbo.ExamPresentyReport.Aug, dbo.ExamPresentyReport.Sept, dbo.ExamPresentyReport.Oct, dbo.ExamPresentyReport.Nov, dbo.ExamPresentyReport.Dec, dbo.ExamPresentyReport.Jan, dbo.ExamPresentyReport.Feb, 
                         dbo.ExamPresentyReport.Mar, dbo.ExamPresentyReport.Apr, dbo.ExamPresentyReport.May, dbo.ExamPresentyReport.FTTotal, dbo.ExamPresentyReport.STTotal, dbo.ExamPresentyReport.Total, 
                         dbo.ExamPresentyReport.PJun, dbo.ExamPresentyReport.PJully, dbo.ExamPresentyReport.PAug, dbo.ExamPresentyReport.PSept, dbo.ExamPresentyReport.POct, dbo.ExamPresentyReport.PNov, 
                         dbo.ExamPresentyReport.PDec, dbo.ExamPresentyReport.PJan, dbo.ExamPresentyReport.PFeb, dbo.ExamPresentyReport.PMar, dbo.ExamPresentyReport.PApr, dbo.ExamPresentyReport.PMay, 
                         dbo.ExamPresentyReport.PFTTotal, dbo.ExamPresentyReport.PSTTotal, dbo.ExamPresentyReport.PTotal, dbo.StudInfo.CategoryCode, dbo.CategoryMaster.CategoryName, 
                         dbo.StudentExamAnnualMMSummary.FTSTMaxMarksTotal, dbo.StudentExamAnnualMMSummary.FTSTMarksTotal, dbo.StudentExamAnnualMMSummary.FTSTPer, dbo.StudentExamAnnualMMSummary.FTSTGrade, 
                         dbo.StudentExamAnnualMMSummary.FTSTGradeRemark, dbo.StudentExamAnnualMMSummary.FTSTRank, dbo.StudInfo.DeleteFlag, dbo.StudInfo.NationalCode
FROM            dbo.GenderMaster INNER JOIN
                         dbo.StudInfo INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.EducationMaster ON dbo.StudInfo.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                         dbo.OccupationMaster ON dbo.StudInfo.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                         dbo.CityMaster AS CityMaster_2 ON dbo.StudInfo.LocCitycode = CityMaster_2.CityCode INNER JOIN
                         dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfo.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                         dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfo.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
                         dbo.CategoryMaster ON dbo.StudInfo.CategoryCode = dbo.CategoryMaster.CategoryCode LEFT OUTER JOIN
                         dbo.StudentExamAnnualMMSummary ON dbo.StudInfo.RegID = dbo.StudentExamAnnualMMSummary.RegID LEFT OUTER JOIN
                         dbo.ExamPresentyReport ON dbo.StudInfo.RegID = dbo.ExamPresentyReport.RegID
WHERE        (dbo.StudInfo.DeleteFlag = N'N')
ORDER BY dbo.StudInfo.RegID DESC
GO
/****** Object:  View [dbo].[TempSiblingStudent]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[TempSiblingStudent]
AS
SELECT     TOP (100) PERCENT MiddleName, LastName, MotherName, MotherName + N' ' + MiddleName + N' ' + LastName AS StudentDetail, COUNT(MotherName + ' ' + MiddleName + ' ' + LastName) 
                      AS StudentDetailCount, RegNo, RollNo
FROM         dbo.StudInfo
GROUP BY MiddleName, LastName, MotherName, MotherName + N' ' + MiddleName + N' ' + LastName, RegNo, RollNo
HAVING      (COUNT(MotherName + ' ' + MiddleName + ' ' + LastName) > 1)
GO
/****** Object:  View [dbo].[SiblingStudentReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[SiblingStudentReport]
AS
SELECT     TOP (100) PERCENT dbo.StudInfo.RegID, dbo.StudInfo.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfo.AyCode, dbo.StudInfo.AdmittionDate, dbo.StudInfo.StudentID, 
                      dbo.StudInfo.AadharNo, dbo.StudInfo.Dob, dbo.StudInfo.DobInWord, dbo.CityMaster.CityName AS BirthPlace, dbo.TalukaMaster.TalukaName, dbo.DistrictMaster.DistrictName, 
                      dbo.StateMaster.StateName, dbo.CountryMaster.CountryName, dbo.CasteMaster.CasteName, dbo.StudInfo.SubCast, dbo.ReligionMaster.ReligionName, 
                      dbo.LanguageMaster.LanguageName AS MotherTounge, dbo.OtherSchoolMaster.OtherSchoolName AS PrevSchool, ClassMaster_2.ClassName AS PSClass, ClassMaster_3.ClassName AS ClassAT, 
                      DivisionMaster_1.DivisionName AS DivAT, dbo.StudInfo.MotherName, dbo.StudInfo.Age30Sept, dbo.StudInfo.PermanentAddress, dbo.StudInfo.LocalAddress, dbo.StudInfo.MobileNo1, 
                      dbo.StudInfo.MobileNo2, dbo.StudInfo.BloodGroup, dbo.StudInfo.PSTCNo, dbo.StudInfo.PSLeaveDate, dbo.StudInfo.FatherName, dbo.EducationMaster.EducationName AS FEducation, 
                      dbo.OccupationMaster.OccupationName AS FOccupation, dbo.StudInfo.FAnnualIncome, dbo.RelationMaster.RelationName, dbo.StudInfo.FormNo, dbo.CategoryMaster.CategoryName, 
                      dbo.StudInfo.CloseFlag, dbo.StudInfo.TSuspendedFlag, dbo.StudInfo.TSupendedDate, dbo.StudInfo.AdmissionType, dbo.StudInfo.MediumCode, dbo.StudInfo.ClassCode, 
                      dbo.GenderMaster.GenderName, dbo.StudInfo.Photpath, dbo.StudInfo.RollNo, dbo.FeeTypeMaster.FeeTypeName, CityMaster_1.CityName AS PerCity, CityMaster_2.CityName AS LocCity, 
                      dbo.AreaMaster.AreaName, LanguageMaster_1.LanguageName AS LanguageKnown, dbo.OtherSchoolMaster.Address AS PSAddress, dbo.OtherSchoolMaster.UDIESNo AS PSUDIESNo, 
                      dbo.StudInfo.PSResult, dbo.StudInfo.PSRegNo, dbo.TCSLRMaster.TCSLRName AS PSLeaveReason, EducationMaster_1.EducationName AS MEducation, 
                      OccupationMaster_1.OccupationName AS MOccupation, dbo.StudInfo.GaurdianName, dbo.BankMaster.BankName, dbo.BankMaster.IFSCCode, dbo.StudInfo.BankAcNo, 
                      dbo.StudInfo.BankAPersonName, dbo.StudInfo.PersonalIdentMark, dbo.StudInfo.EntryFrom, dbo.StudInfo.Remark, dbo.StudInfo.StudDisplayFlag, dbo.StudInfo.FeesPaidFlag, 
                      dbo.StudInfo.MarksFeedFlag, dbo.StudInfo.HandyCapStatus, dbo.HandyCapMaster.HandyCapName, dbo.StudInfo.BPLCardStatus, dbo.StudInfo.PPECompleteStatus, dbo.StudInfo.WeightFT, 
                      dbo.StudInfo.WeightST, dbo.StudInfo.HeightFT, dbo.StudInfo.HeightST, dbo.StudInfo.SeatNo, dbo.StudInfo.AdmiSchoolType, dbo.StudInfo.ReligionCode, dbo.StudInfo.CategoryCode, 
                      dbo.TempSiblingStudent.StudentDetail
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                      dbo.CityMaster ON dbo.StudInfo.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                      dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                      dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                      dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                      dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfo.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.ReligionMaster ON dbo.StudInfo.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.LanguageMaster ON dbo.StudInfo.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                      dbo.OtherSchoolMaster ON dbo.StudInfo.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfo.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfo.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                      dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfo.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.EducationMaster ON dbo.StudInfo.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                      dbo.OccupationMaster ON dbo.StudInfo.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                      dbo.RelationMaster ON dbo.StudInfo.RelationCode = dbo.RelationMaster.RelationCode INNER JOIN
                      dbo.CategoryMaster ON dbo.StudInfo.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfo.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.CityMaster AS CityMaster_1 ON dbo.StudInfo.PerCitycode = CityMaster_1.CityCode INNER JOIN
                      dbo.CityMaster AS CityMaster_2 ON dbo.StudInfo.LocCitycode = CityMaster_2.CityCode INNER JOIN
                      dbo.AreaMaster ON dbo.StudInfo.AreaCode = dbo.AreaMaster.AreaCode INNER JOIN
                      dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfo.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
                      dbo.TCSLRMaster ON dbo.StudInfo.PSLeaveReasonCode = dbo.TCSLRMaster.TCSLRCode INNER JOIN
                      dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfo.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                      dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfo.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
                      dbo.BankMaster ON dbo.StudInfo.BankCode = dbo.BankMaster.BankCode INNER JOIN
                      dbo.HandyCapMaster ON dbo.StudInfo.HandyCapCode = dbo.HandyCapMaster.HandyCapCode INNER JOIN
                      dbo.TempSiblingStudent ON dbo.StudInfo.MiddleName = dbo.TempSiblingStudent.MiddleName AND dbo.StudInfo.LastName = dbo.TempSiblingStudent.LastName AND 
                      dbo.StudInfo.MotherName = dbo.TempSiblingStudent.MotherName
ORDER BY dbo.StudInfo.RegID DESC
GO
/****** Object:  View [dbo].[FeesDefineTitleCodeReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesDefineTitleCodeReport]
AS
SELECT DISTINCT FeeTitleCode, ClassCode
FROM         dbo.FeesDefine AS FeesDefine_1
WHERE     (FeesAmount > 0)
GO
/****** Object:  View [dbo].[FeesDefineReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesDefineReport]
AS
SELECT     TOP (100) PERCENT dbo.FeesDefine.FDTID, dbo.MediumMaster.MediumName, dbo.FeesDefine.ClassCode, dbo.ClassMaster.ClassName, dbo.FeeTypeMaster.FeeTypeName, dbo.FeesDefine.SrNo, 
                      dbo.FeeTitleMaster.FeeTitleName, dbo.FeeInstallementMaster.FeeInstallementName, dbo.FeesDefine.FeesAmount, dbo.MainClassMaster.MainClassName, 
                      dbo.MainClassMaster.MainClassGroupCode, dbo.MainClassGroupMaster.MainClassGroupName, dbo.MainClassGroupMaster.MainClassGroupNameShort, dbo.FeesDefine.AyCode, 
                      dbo.AyMaster.AyName, dbo.AyMaster.FeesOutstandingMaintainFlag, dbo.FeesDefine.FeeTitleCode
FROM         dbo.FeesDefine INNER JOIN
                      dbo.ClassMaster ON dbo.FeesDefine.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.MediumMaster ON dbo.FeesDefine.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.FeesDefine.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.FeeTitleMaster ON dbo.FeesDefine.FeeTitleCode = dbo.FeeTitleMaster.FeeTitleCode INNER JOIN
                      dbo.FeeInstallementMaster ON dbo.FeesDefine.FeeInstallementCode = dbo.FeeInstallementMaster.FeeInstallementCode INNER JOIN
                      dbo.MainClassMaster ON dbo.ClassMaster.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.MainClassGroupMaster ON dbo.MainClassMaster.MainClassGroupCode = dbo.MainClassGroupMaster.MainClassGroupCode INNER JOIN
                      dbo.AyMaster ON dbo.FeesDefine.AyCode = dbo.AyMaster.AyCode INNER JOIN
                      dbo.FeesDefineTitleCodeReport ON dbo.FeesDefine.ClassCode = dbo.FeesDefineTitleCodeReport.ClassCode AND dbo.FeesDefine.FeeTitleCode = dbo.FeesDefineTitleCodeReport.FeeTitleCode
GO
/****** Object:  View [dbo].[StudentPresentyCertificateReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[StudentPresentyCertificateReport]
AS
SELECT TOP (100) PERCENT dbo.StudInfoAll.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, dbo.ClassMaster.ClassName AS Class, 
                  dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName END AS StudentName, 
                  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student, 
                  dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegID, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.StudentPresentyCertificate.RecordNo, dbo.StudentPresentyCertificate.TDate, 
                  dbo.GenderMaster.GenderName, dbo.ExamPresentyReport.SchoolStartDate, dbo.ExamPresentyReport.Jun, dbo.ExamPresentyReport.Jully, dbo.ExamPresentyReport.Aug, dbo.ExamPresentyReport.Sept, dbo.ExamPresentyReport.Oct, 
                  dbo.ExamPresentyReport.Nov, dbo.ExamPresentyReport.Dec, dbo.ExamPresentyReport.Jan, dbo.ExamPresentyReport.Feb, dbo.ExamPresentyReport.Mar, dbo.ExamPresentyReport.Apr, dbo.ExamPresentyReport.May, 
                  dbo.ExamPresentyReport.FTTotal, dbo.ExamPresentyReport.STTotal, dbo.ExamPresentyReport.Total, dbo.ExamPresentyReport.PJun, dbo.ExamPresentyReport.PJully, dbo.ExamPresentyReport.PAug, dbo.ExamPresentyReport.PSept, 
                  dbo.ExamPresentyReport.POct, dbo.ExamPresentyReport.PNov, dbo.ExamPresentyReport.PDec, dbo.ExamPresentyReport.PJan, dbo.ExamPresentyReport.PFeb, dbo.ExamPresentyReport.PMar, dbo.ExamPresentyReport.PApr, 
                  dbo.ExamPresentyReport.PMay, dbo.ExamPresentyReport.PFTTotal, dbo.ExamPresentyReport.PSTTotal, dbo.ExamPresentyReport.PTotal, dbo.StudInfoAll.Photpath, dbo.StudInfoAll.StudentID, dbo.StudInfoAll.AadharNo, 
                  dbo.StudInfoAll.RollNo, dbo.StudInfoAll.ApaarID, dbo.StudInfoAll.NationalCode
FROM     dbo.GenderMaster INNER JOIN
                  dbo.StudInfoAll INNER JOIN
                  dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                  dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                  dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                  dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                  dbo.StudentPresentyCertificate ON dbo.StudInfoAll.RegID = dbo.StudentPresentyCertificate.RegID LEFT OUTER JOIN
                  dbo.ExamPresentyReport ON dbo.StudentPresentyCertificate.RegID = dbo.ExamPresentyReport.RegID
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[1-ErrorStudInfoAll]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[1-ErrorStudInfoAll]
AS
SELECT     dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassCode, dbo.HandyCapMaster.HandyCapCode, dbo.ClassMaster.ClassCode, dbo.MediumMaster.MediumCode, 
                      dbo.FeeTypeMaster.FeeTypeCode, dbo.CityMaster.CityCode AS PerCityCode, dbo.DivisionMaster.DivisionCode, CityMaster_1.CityCode AS LocCityCode, dbo.GenderMaster.GenderCode, 
                      dbo.AreaMaster.AreaCode, CityMaster_2.CityCode AS BirthPlaceCode, dbo.TalukaMaster.Talukacode, dbo.DistrictMaster.DistrictCode, dbo.CasteMaster.CasteCode, 
                      dbo.ReligionMaster.ReligionCode, LanguageMaster_1.LanguageCode, dbo.RelationMaster.RelationCode, dbo.LanguageMaster.LanguageCode AS MotherToungCode, 
                      dbo.OtherSchoolMaster.OtherSchoolCode, dbo.CategoryMaster.CategoryCode, ClassMaster_1.ClassCode AS PSClassCode, ClassMaster_2.ClassCode AS ClassCodeAT, 
                      EducationMaster_1.EducationCode AS MEductionCode, dbo.TCSLRMaster.TCSLRCode, dbo.EducationMaster.EducationCode AS FEducationCode, 
                      OccupationMaster_1.OccupationCode AS MOccupationCode, dbo.OccupationMaster.OccupationCode AS FOccupationCode, dbo.BankMaster.BankCode, 
                      DivisionMaster_1.DivisionCode AS DivisionCodeAT, dbo.FeeTypeConcessionMaster.FeeTypeConcessionCode, dbo.AyMaster.AyCode, dbo.StudInfoAll.DeleteFlag, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
                       END AS StudentName, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.RollNo, dbo.GenderMaster.GenderShort
FROM         dbo.AyMaster RIGHT OUTER JOIN
                      dbo.StudInfoAll ON dbo.AyMaster.AyCode = dbo.StudInfoAll.AyCode LEFT OUTER JOIN
                      dbo.FeeTypeConcessionMaster ON dbo.StudInfoAll.FeeTypeConcessionCode = dbo.FeeTypeConcessionMaster.FeeTypeConcessionCode LEFT OUTER JOIN
                      dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfoAll.DivisionCodeAT = DivisionMaster_1.DivisionCode LEFT OUTER JOIN
                      dbo.BankMaster ON dbo.StudInfoAll.BankCode = dbo.BankMaster.BankCode LEFT OUTER JOIN
                      dbo.OccupationMaster ON dbo.StudInfoAll.FOccupationCode = dbo.OccupationMaster.OccupationCode LEFT OUTER JOIN
                      dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfoAll.MCccupationCode = OccupationMaster_1.OccupationCode LEFT OUTER JOIN
                      dbo.EducationMaster ON dbo.StudInfoAll.FEducationCode = dbo.EducationMaster.EducationCode LEFT OUTER JOIN
                      dbo.TCSLRMaster ON dbo.StudInfoAll.PSLeaveReasonCode = dbo.TCSLRMaster.TCSLRCode LEFT OUTER JOIN
                      dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfoAll.MEducationCode = EducationMaster_1.EducationCode LEFT OUTER JOIN
                      dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfoAll.ClassCodeAT = ClassMaster_2.ClassCode LEFT OUTER JOIN
                      dbo.ClassMaster AS ClassMaster_1 ON dbo.StudInfoAll.PSClassCode = ClassMaster_1.ClassCode LEFT OUTER JOIN
                      dbo.CategoryMaster ON dbo.StudInfoAll.CategoryCode = dbo.CategoryMaster.CategoryCode LEFT OUTER JOIN
                      dbo.OtherSchoolMaster ON dbo.StudInfoAll.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode LEFT OUTER JOIN
                      dbo.LanguageMaster ON dbo.StudInfoAll.MotherTongueCode = dbo.LanguageMaster.LanguageCode LEFT OUTER JOIN
                      dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfoAll.LanguageKnownCode = LanguageMaster_1.LanguageCode LEFT OUTER JOIN
                      dbo.RelationMaster ON dbo.StudInfoAll.RelationCode = dbo.RelationMaster.RelationCode LEFT OUTER JOIN
                      dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode LEFT OUTER JOIN
                      dbo.TalukaMaster LEFT OUTER JOIN
                      dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode LEFT OUTER JOIN
                      dbo.CityMaster AS CityMaster_2 ON dbo.TalukaMaster.Talukacode = CityMaster_2.TalukaCode ON dbo.StudInfoAll.BirthPlaceCode = CityMaster_2.CityCode LEFT OUTER JOIN
                      dbo.AreaMaster ON dbo.StudInfoAll.AreaCode = dbo.AreaMaster.AreaCode LEFT OUTER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode LEFT OUTER JOIN
                      dbo.CityMaster AS CityMaster_1 ON dbo.StudInfoAll.LocCitycode = CityMaster_1.CityCode LEFT OUTER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode LEFT OUTER JOIN
                      dbo.CityMaster ON dbo.StudInfoAll.PerCitycode = dbo.CityMaster.CityCode LEFT OUTER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfoAll.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode LEFT OUTER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode LEFT OUTER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode LEFT OUTER JOIN
                      dbo.HandyCapMaster ON dbo.StudInfoAll.HandyCapCode = dbo.HandyCapMaster.HandyCapCode LEFT OUTER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode LEFT OUTER JOIN
                      dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode
WHERE     (dbo.HandyCapMaster.HandyCapCode IS NULL) OR
                      (dbo.ClassMaster.ClassCode IS NULL) OR
                      (dbo.MediumMaster.MediumCode IS NULL) OR
                      (dbo.FeeTypeMaster.FeeTypeCode IS NULL) OR
                      (dbo.CityMaster.CityCode IS NULL) OR
                      (dbo.DivisionMaster.DivisionCode IS NULL) OR
                      (CityMaster_1.CityCode IS NULL) OR
                      (dbo.GenderMaster.GenderCode IS NULL) OR
                      (dbo.AreaMaster.AreaCode IS NULL) OR
                      (CityMaster_2.CityCode IS NULL) OR
                      (dbo.TalukaMaster.Talukacode IS NULL) OR
                      (dbo.DistrictMaster.DistrictCode IS NULL) OR
                      (dbo.CasteMaster.CasteCode IS NULL) OR
                      (dbo.ReligionMaster.ReligionCode IS NULL) OR
                      (LanguageMaster_1.LanguageCode IS NULL) OR
                      (dbo.RelationMaster.RelationCode IS NULL) OR
                      (dbo.LanguageMaster.LanguageCode IS NULL) OR
                      (dbo.OtherSchoolMaster.OtherSchoolCode IS NULL) OR
                      (dbo.CategoryMaster.CategoryCode IS NULL) OR
                      (ClassMaster_1.ClassCode IS NULL) OR
                      (ClassMaster_2.ClassCode IS NULL) OR
                      (EducationMaster_1.EducationCode IS NULL) OR
                      (dbo.TCSLRMaster.TCSLRCode IS NULL) OR
                      (dbo.EducationMaster.EducationCode IS NULL) OR
                      (OccupationMaster_1.OccupationCode IS NULL) OR
                      (dbo.OccupationMaster.OccupationCode IS NULL) OR
                      (dbo.BankMaster.BankCode IS NULL) OR
                      (DivisionMaster_1.DivisionCode IS NULL) OR
                      (dbo.FeeTypeConcessionMaster.FeeTypeConcessionCode IS NULL) OR
                      (dbo.AyMaster.AyCode IS NULL) OR
                      (dbo.StudInfoAll.DeleteFlag IS NULL)
GO
/****** Object:  View [dbo].[2-ErrorStudInfo]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[2-ErrorStudInfo]
AS
SELECT     dbo.StudInfo.RegID, dbo.MainClassMaster.MainClassCode, dbo.HandyCapMaster.HandyCapCode, dbo.ClassMaster.ClassCode, dbo.MediumMaster.MediumCode, 
                      dbo.FeeTypeMaster.FeeTypeCode, dbo.CityMaster.CityCode AS PerCityCode, dbo.DivisionMaster.DivisionCode, CityMaster_1.CityCode AS LocCityCode, dbo.GenderMaster.GenderCode, 
                      dbo.AreaMaster.AreaCode, CityMaster_2.CityCode AS BirthPlaceCode, dbo.TalukaMaster.Talukacode, dbo.DistrictMaster.DistrictCode, dbo.CasteMaster.CasteCode, 
                      dbo.ReligionMaster.ReligionCode, LanguageMaster_1.LanguageCode, dbo.RelationMaster.RelationCode, dbo.LanguageMaster.LanguageCode AS MotherToungCode, 
                      dbo.OtherSchoolMaster.OtherSchoolCode, dbo.CategoryMaster.CategoryCode, ClassMaster_1.ClassCode AS PSClassCode, ClassMaster_2.ClassCode AS ClassCodeAT, 
                      EducationMaster_1.EducationCode AS MEductionCode, dbo.TCSLRMaster.TCSLRCode, dbo.EducationMaster.EducationCode AS FEducationCode, 
                      OccupationMaster_1.OccupationCode AS MOccupationCode, dbo.OccupationMaster.OccupationCode AS FOccupationCode, dbo.BankMaster.BankCode, 
                      DivisionMaster_1.DivisionCode AS DivisionCodeAT, dbo.FeeTypeConcessionMaster.FeeTypeConcessionCode, dbo.AyMaster.AyCode, dbo.StudInfo.DeleteFlag, dbo.StudInfo.RegNo, 
                      dbo.StudInfo.RollNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.GenderMaster.GenderShort
FROM         dbo.AyMaster RIGHT OUTER JOIN
                      dbo.StudInfo ON dbo.AyMaster.AyCode = dbo.StudInfo.AyCode LEFT OUTER JOIN
                      dbo.FeeTypeConcessionMaster ON dbo.StudInfo.FeeTypeConcessionCode = dbo.FeeTypeConcessionMaster.FeeTypeConcessionCode LEFT OUTER JOIN
                      dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfo.DivisionCodeAT = DivisionMaster_1.DivisionCode LEFT OUTER JOIN
                      dbo.BankMaster ON dbo.StudInfo.BankCode = dbo.BankMaster.BankCode LEFT OUTER JOIN
                      dbo.OccupationMaster ON dbo.StudInfo.FOccupationCode = dbo.OccupationMaster.OccupationCode LEFT OUTER JOIN
                      dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfo.MCccupationCode = OccupationMaster_1.OccupationCode LEFT OUTER JOIN
                      dbo.EducationMaster ON dbo.StudInfo.FEducationCode = dbo.EducationMaster.EducationCode LEFT OUTER JOIN
                      dbo.TCSLRMaster ON dbo.StudInfo.PSLeaveReasonCode = dbo.TCSLRMaster.TCSLRCode LEFT OUTER JOIN
                      dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfo.MEducationCode = EducationMaster_1.EducationCode LEFT OUTER JOIN
                      dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfo.ClassCodeAT = ClassMaster_2.ClassCode LEFT OUTER JOIN
                      dbo.ClassMaster AS ClassMaster_1 ON dbo.StudInfo.PSClassCode = ClassMaster_1.ClassCode LEFT OUTER JOIN
                      dbo.CategoryMaster ON dbo.StudInfo.CategoryCode = dbo.CategoryMaster.CategoryCode LEFT OUTER JOIN
                      dbo.OtherSchoolMaster ON dbo.StudInfo.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode LEFT OUTER JOIN
                      dbo.LanguageMaster ON dbo.StudInfo.MotherTongueCode = dbo.LanguageMaster.LanguageCode LEFT OUTER JOIN
                      dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfo.LanguageKnownCode = LanguageMaster_1.LanguageCode LEFT OUTER JOIN
                      dbo.RelationMaster ON dbo.StudInfo.RelationCode = dbo.RelationMaster.RelationCode LEFT OUTER JOIN
                      dbo.ReligionMaster ON dbo.StudInfo.ReligionCode = dbo.ReligionMaster.ReligionCode LEFT OUTER JOIN
                      dbo.TalukaMaster LEFT OUTER JOIN
                      dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode LEFT OUTER JOIN
                      dbo.CityMaster AS CityMaster_2 ON dbo.TalukaMaster.Talukacode = CityMaster_2.TalukaCode ON dbo.StudInfo.BirthPlaceCode = CityMaster_2.CityCode LEFT OUTER JOIN
                      dbo.AreaMaster ON dbo.StudInfo.AreaCode = dbo.AreaMaster.AreaCode LEFT OUTER JOIN
                      dbo.GenderMaster ON dbo.StudInfo.GenderCode = dbo.GenderMaster.GenderCode LEFT OUTER JOIN
                      dbo.CityMaster AS CityMaster_1 ON dbo.StudInfo.LocCitycode = CityMaster_1.CityCode LEFT OUTER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode LEFT OUTER JOIN
                      dbo.CityMaster ON dbo.StudInfo.PerCitycode = dbo.CityMaster.CityCode LEFT OUTER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfo.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode LEFT OUTER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode LEFT OUTER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode LEFT OUTER JOIN
                      dbo.HandyCapMaster ON dbo.StudInfo.HandyCapCode = dbo.HandyCapMaster.HandyCapCode LEFT OUTER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode LEFT OUTER JOIN
                      dbo.CasteMaster ON dbo.StudInfo.CastCode = dbo.CasteMaster.CasteCode
WHERE     (dbo.HandyCapMaster.HandyCapCode IS NULL) OR
                      (dbo.ClassMaster.ClassCode IS NULL) OR
                      (dbo.MediumMaster.MediumCode IS NULL) OR
                      (dbo.FeeTypeMaster.FeeTypeCode IS NULL) OR
                      (dbo.CityMaster.CityCode IS NULL) OR
                      (dbo.DivisionMaster.DivisionCode IS NULL) OR
                      (CityMaster_1.CityCode IS NULL) OR
                      (dbo.GenderMaster.GenderCode IS NULL) OR
                      (dbo.AreaMaster.AreaCode IS NULL) OR
                      (CityMaster_2.CityCode IS NULL) OR
                      (dbo.TalukaMaster.Talukacode IS NULL) OR
                      (dbo.DistrictMaster.DistrictCode IS NULL) OR
                      (dbo.CasteMaster.CasteCode IS NULL) OR
                      (dbo.ReligionMaster.ReligionCode IS NULL) OR
                      (LanguageMaster_1.LanguageCode IS NULL) OR
                      (dbo.RelationMaster.RelationCode IS NULL) OR
                      (dbo.LanguageMaster.LanguageCode IS NULL) OR
                      (dbo.OtherSchoolMaster.OtherSchoolCode IS NULL) OR
                      (dbo.CategoryMaster.CategoryCode IS NULL) OR
                      (ClassMaster_1.ClassCode IS NULL) OR
                      (ClassMaster_2.ClassCode IS NULL) OR
                      (EducationMaster_1.EducationCode IS NULL) OR
                      (dbo.TCSLRMaster.TCSLRCode IS NULL) OR
                      (dbo.EducationMaster.EducationCode IS NULL) OR
                      (OccupationMaster_1.OccupationCode IS NULL) OR
                      (dbo.OccupationMaster.OccupationCode IS NULL) OR
                      (dbo.BankMaster.BankCode IS NULL) OR
                      (DivisionMaster_1.DivisionCode IS NULL) OR
                      (dbo.FeeTypeConcessionMaster.FeeTypeConcessionCode IS NULL) OR
                      (dbo.AyMaster.AyCode IS NULL) OR
                      (dbo.StudInfo.DeleteFlag IS NULL)
GO
/****** Object:  View [dbo].[ACLedgerHeadIndexReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ACLedgerHeadIndexReport]
AS
SELECT LedgerHeadCode, SrNo, LedgerHead, LedgerTypeCode, DeleteFlag
FROM     dbo.ACLedgerHeadMaster
GO
/****** Object:  View [dbo].[ACVoucherReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ACVoucherReport]
AS
SELECT   dbo.ACVoucher.TID, dbo.ACVoucher.AccountRegisterCode, dbo.ACAccountRegisterMaster.AccountRegister, dbo.ACVoucher.VType, dbo.ACVoucher.VCode, dbo.ACVoucher.VDate, 
                         dbo.ACVoucher.VFlag, dbo.ACVoucher.VNo, dbo.ACPartyMaster.PartyName, dbo.ACPartyMaster.PanNo AS SupplierPanNo, dbo.ACPartyMaster.Address, dbo.ACPartyMaster.MobNo, 
                         dbo.ACVoucher.PaymentTypeCode, dbo.PaymentTypeMaster.PaymentTypeName, dbo.ACVoucher.ChequeDate, dbo.ACVoucher.Amount, dbo.ACVoucher.PartyTID, 
                         dbo.ACVoucher.LedgerHeadBankCode, ACLedgerHeadMaster_1.LedgerHead AS LedgerHeadBank, dbo.ACVoucher.LedgerHeadNarrationBank, 
                         ACLedgerHeadMaster_1.LedgerTypeCode AS LedgerTypeCodeBank, dbo.ACVoucherDetail.SrNo, dbo.ACVoucherDetail.LedgerHeadCode, dbo.ACLedgerHeadMaster.LedgerHead, 
                         dbo.ACVoucherDetail.LedgerHeadNarration, dbo.ACLedgerHeadMaster.LedgerTypeCode, dbo.ACVoucherDetail.Amount AS AmountDetail, 
                         ACLedgerHeadMaster_1.SrNo AS LHSequenceNo, dbo.ACLedgerHeadMaster.SrNo AS LGSequenceNoBank, CONVERT(varchar, dbo.ACVoucher.VDate, 106) AS VDateStr, 
                         dbo.ACVoucher.FyCode, dbo.ACLedgerTypeMaster.BankFlag, dbo.ACVoucher.MainClassCode, dbo.MainClassMaster.TitleName, dbo.MainClassMaster.OrgName, 
                         dbo.MainClassMaster.Address1, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LogoImage, dbo.MainClassMaster.LetterHeadPath, dbo.MainClassMaster.LetterHeadImage
FROM         dbo.ACVoucher INNER JOIN
                         dbo.ACVoucherDetail ON dbo.ACVoucher.TID = dbo.ACVoucherDetail.TID INNER JOIN
                         dbo.ACAccountRegisterMaster ON dbo.ACVoucher.AccountRegisterCode = dbo.ACAccountRegisterMaster.AccountRegisterCode INNER JOIN
                         dbo.PaymentTypeMaster ON dbo.ACVoucher.PaymentTypeCode = dbo.PaymentTypeMaster.PaymentTypeCode INNER JOIN
                         dbo.ACLedgerHeadMaster ON dbo.ACVoucherDetail.LedgerHeadCode = dbo.ACLedgerHeadMaster.LedgerHeadCode INNER JOIN
                         dbo.ACLedgerHeadMaster AS ACLedgerHeadMaster_1 ON dbo.ACVoucher.LedgerHeadBankCode = ACLedgerHeadMaster_1.LedgerHeadCode INNER JOIN
                         dbo.ACPartyMaster ON dbo.ACVoucher.PartyTID = dbo.ACPartyMaster.TID INNER JOIN
                         dbo.ACLedgerTypeMaster ON dbo.ACLedgerHeadMaster.LedgerTypeCode = dbo.ACLedgerTypeMaster.LedgerTypeCode INNER JOIN
                         dbo.MainClassMaster ON dbo.ACVoucher.MainClassCode = dbo.MainClassMaster.MainClassCode
GO
/****** Object:  View [dbo].[BanafideCertificateReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[BanafideCertificateReport]
AS
SELECT        TOP (100) PERCENT dbo.StudInfoAll.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, dbo.ClassMaster.ClassName AS Class, 
                         dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                         CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName END AS StudentName,
                          CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student, 
                         dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegID, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.BonafiedCertificate.RecordNo, dbo.BonafiedCertificate.TDate, dbo.GenderMaster.GenderName,
                          dbo.BonafiedCertificate.EducationStatus, dbo.BonafiedCertificate.Ayear, dbo.BonafiedCertificate.Purpose, dbo.StudInfoAll.RollNo, dbo.StudInfoAll.NationalCode
FROM            dbo.GenderMaster INNER JOIN
                         dbo.StudInfoAll INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.BonafiedCertificate ON dbo.StudInfoAll.RegID = dbo.BonafiedCertificate.RegID
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[BusFeesCollectionReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[BusFeesCollectionReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
                       END AS StudentName, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegID, dbo.BusFeesCollection.ReceiptTID, dbo.BusFeesCollection.ReceiptNo, dbo.BusFeesCollection.ReceiptDate, 
                      dbo.BusFeesCollection.TotalFeesAmount, dbo.BusFeesCollection.TotalDiscountAmt, dbo.BusFeesCollection.CancelReceiptAmt, dbo.BusFeesCollection.Remark, 
                      dbo.BusFeesCollection.CancelReceiptFlag, dbo.BusFeesCollection.PaymentTypeCode, dbo.PaymentTypeMaster.PaymentTypeName, dbo.BusFeesCollection.BankName, 
                      dbo.BusFeesCollection.ChequeNo, dbo.BusFeesCollection.ChequeDate, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.FeeTypeMaster.FeeTypeCode, 
                      dbo.FeeTypeMaster.FeeTypeName, dbo.BusFeesCollection.DeleteFlag, dbo.StudInfoAll.RollNo, dbo.UserMaster.UserName
FROM         dbo.DivisionMaster INNER JOIN
                      dbo.MainClassMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.StudInfoYearly ON dbo.StudInfoAll.RegID = dbo.StudInfoYearly.RegID INNER JOIN
                      dbo.PaymentTypeMaster INNER JOIN
                      dbo.BusFeesCollection ON dbo.PaymentTypeMaster.PaymentTypeCode = dbo.BusFeesCollection.PaymentTypeCode ON dbo.StudInfoYearly.RegID = dbo.BusFeesCollection.RegID AND 
                      dbo.StudInfoYearly.AyCode = dbo.BusFeesCollection.AyCode ON dbo.MainClassMaster.MainClassCode = dbo.StudInfoYearly.MainClassCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoYearly.MediumCode = dbo.MediumMaster.MediumCode ON dbo.DivisionMaster.DivisionCode = dbo.StudInfoYearly.DivisionCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoYearly.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfoYearly.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.UserMaster ON dbo.BusFeesCollection.UserCode = dbo.UserMaster.UserCode
WHERE     (dbo.BusFeesCollection.DeleteFlag = N'N')
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[BusFeesDefineReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[BusFeesDefineReport]
AS
SELECT DISTINCT 
                      TOP (100) PERCENT dbo.StudInfoYearly.RegID, dbo.StudInfoYearly.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfoYearly.AyCode, dbo.StudInfo.AdmittionDate, 
                      dbo.StudInfo.StudentID, dbo.StudInfo.AadharNo, dbo.StudInfo.PermanentAddress, dbo.StudInfo.LocalAddress, dbo.StudInfo.MobileNo1, dbo.StudInfo.MobileNo2, dbo.StudInfo.CloseFlag, 
                      dbo.StudInfo.TSuspendedFlag, dbo.StudInfo.TSupendedDate, dbo.StudInfoYearly.AdmissionType, dbo.StudInfoYearly.MediumCode, dbo.StudInfoYearly.ClassCode, dbo.GenderMaster.GenderName, 
                      dbo.StudInfo.Photpath, dbo.StudInfo.RollNo, dbo.FeeTypeMaster.FeeTypeName, dbo.StudInfo.EntryFrom, dbo.StudInfo.StudDisplayFlag, dbo.StudInfo.FeesPaidFlag, dbo.StudInfo.MarksFeedFlag, 
                      dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.StudInfoYearly.DivisionCode, dbo.BusFeesDefine.BusCode, dbo.BusMaster.BusName
FROM         dbo.BusMaster INNER JOIN
                      dbo.BusFeesDefine ON dbo.BusMaster.BusCode = dbo.BusFeesDefine.BusCode INNER JOIN
                      dbo.ClassMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfo.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.StudInfoYearly ON dbo.StudInfo.RegID = dbo.StudInfoYearly.RegID INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoYearly.MediumCode = dbo.MediumMaster.MediumCode ON dbo.ClassMaster.ClassCode = dbo.StudInfoYearly.ClassCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfoYearly.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoYearly.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.BusFeesDefine.RegID = dbo.StudInfoYearly.RegID AND 
                      dbo.BusFeesDefine.AyCode = dbo.StudInfoYearly.AyCode INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoYearly.MainClassCode = dbo.MainClassMaster.MainClassCode
ORDER BY dbo.StudInfoYearly.RegID DESC
GO
/****** Object:  View [dbo].[BusReceiptReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[BusReceiptReport]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
                       END AS StudentName, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegID, dbo.BusFeesCollection.ReceiptTID, dbo.BusFeesCollection.ReceiptNo, dbo.BusFeesCollection.ReceiptDate, 
                      dbo.BusFeesCollection.TotalFeesAmount, dbo.BusFeesCollection.TotalDiscountAmt, dbo.BusFeesCollection.CancelReceiptAmt, dbo.BusFeesCollection.Remark, 
                      dbo.BusFeesCollection.CancelReceiptFlag, dbo.BusFeesCollection.PaymentTypeCode, dbo.PaymentTypeMaster.PaymentTypeName, dbo.BusFeesCollection.BankName, 
                      dbo.BusFeesCollection.ChequeNo, dbo.BusFeesCollection.ChequeDate, dbo.BusFeesCollectionDetail.SrNo, dbo.BusFeesCollectionDetail.BusFeeTitleCode, 
                      dbo.BusFeeTitleMaster.BusFeeTitleName, dbo.BusFeesCollectionDetail.FeesAmount, dbo.BusFeesCollectionDetail.DiscountAmount, dbo.MainClassMaster.LogoPath, 
                      dbo.MainClassMaster.LetterHeadPath, dbo.BusFeesCollection.BusCode, dbo.BusMaster.BusName, dbo.FeeTypeMaster.FeeTypeCode, dbo.FeeTypeMaster.FeeTypeName, 
                      dbo.StudInfoAll.AreaCode, dbo.AreaMaster.AreaName, dbo.BusFeesCollection.FyCode, dbo.FyMaster.FyName, dbo.StudInfoYearly.AyCode, dbo.AyMaster.AyName, dbo.BusFeesCollection.UserCode, 
                      dbo.UserMaster.UserName, dbo.BusFeesCollection.DeleteFlag, dbo.StudInfoAll.RollNo
FROM         dbo.AreaMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode ON dbo.AreaMaster.AreaCode = dbo.StudInfoAll.AreaCode INNER JOIN
                      dbo.StudInfoYearly ON dbo.StudInfoAll.RegID = dbo.StudInfoYearly.RegID INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoYearly.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoYearly.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoYearly.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoYearly.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.BusFeeTitleMaster INNER JOIN
                      dbo.PaymentTypeMaster INNER JOIN
                      dbo.BusFeesCollection ON dbo.PaymentTypeMaster.PaymentTypeCode = dbo.BusFeesCollection.PaymentTypeCode INNER JOIN
                      dbo.BusFeesCollectionDetail ON dbo.BusFeesCollection.ReceiptTID = dbo.BusFeesCollectionDetail.ReceiptTID ON 
                      dbo.BusFeeTitleMaster.BusFeeTitleCode = dbo.BusFeesCollectionDetail.BusFeeTitleCode INNER JOIN
                      dbo.BusMaster ON dbo.BusFeesCollection.BusCode = dbo.BusMaster.BusCode ON dbo.StudInfoYearly.RegID = dbo.BusFeesCollection.RegID AND 
                      dbo.StudInfoYearly.AyCode = dbo.BusFeesCollection.AyCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfoYearly.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.FyMaster ON dbo.BusFeesCollection.FyCode = dbo.FyMaster.FyCode INNER JOIN
                      dbo.AyMaster ON dbo.StudInfoYearly.AyCode = dbo.AyMaster.AyCode INNER JOIN
                      dbo.UserMaster ON dbo.BusFeesCollection.UserCode = dbo.UserMaster.UserCode
WHERE     (dbo.BusFeesCollection.DeleteFlag = N'N')
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[CasteValidationCertificateReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[CasteValidationCertificateReport]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
                       END AS StudentName, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegID, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.CasteValidationCertificate.RecordNo, 
                      dbo.CasteValidationCertificate.TDate, dbo.GenderMaster.GenderName, dbo.CasteValidationCertificate.District, dbo.CategoryMaster.CategoryName, dbo.StudInfoAll.RollNo
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.CasteValidationCertificate ON dbo.StudInfoAll.RegID = dbo.CasteValidationCertificate.RegID INNER JOIN
                      dbo.CategoryMaster ON dbo.StudInfoAll.CategoryCode = dbo.CategoryMaster.CategoryCode
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[CRDEDetailReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[CRDEDetailReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                      dbo.MediumMaster.MediumName AS Medium, dbo.GenderMaster.GenderName AS Gender, dbo.GenderMaster.GenderShort, 
                      CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
                       CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.ClassCode, dbo.CRDEClassExamMaster.SrNo, dbo.CRDEClassExamMaster.ExamCode, 
                      dbo.CRDEClassExamMaster.ClassExamTitle, dbo.CRDEDetail.DETitle1, dbo.CRDEDetail.DETitle2, dbo.CRDEDetail.DETitle3, dbo.CRDEDetail.DETitle4, dbo.CRDEDetail.ClassTeacherName, 
                      dbo.CRDEDetail.PrincipleName, dbo.StudInfoAll.RollNo
FROM         dbo.StudInfoAll INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.CRDEDetail ON dbo.StudInfoAll.RegID = dbo.CRDEDetail.RegID INNER JOIN
                      dbo.CRDEClassExamMaster ON dbo.CRDEDetail.ClassCode = dbo.CRDEClassExamMaster.ClassCode AND dbo.CRDEDetail.ExamCode = dbo.CRDEClassExamMaster.ExamCode
ORDER BY dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegNo
GO
/****** Object:  View [dbo].[CRExamResultReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[CRExamResultReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                      dbo.MediumMaster.MediumName AS Medium, dbo.GenderMaster.GenderName AS Gender, dbo.GenderMaster.GenderShort, 
                      CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
                       CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.ClassCode, dbo.CRResultDetail.CRSubjectCode, dbo.CRSubjectMaster.SrNo, 
                      dbo.CRSubjectMaster.CRSubjectName, dbo.CRResultDetail.Class1FT, dbo.CRResultDetail.Class1ST, dbo.CRResultDetail.Class2FT, dbo.CRResultDetail.Class2ST, dbo.CRResultDetail.Class3FT, 
                      dbo.CRResultDetail.Class3ST, dbo.CRResultDetail.Class4FT, dbo.CRResultDetail.Class4ST, dbo.CRResultDetail.Class5FT, dbo.CRResultDetail.Class5ST, dbo.CRResultDetail.Class6FT, 
                      dbo.CRResultDetail.Class6ST, dbo.CRResultDetail.Class7FT, dbo.CRResultDetail.Class7ST, dbo.CRResultDetail.Class8FT, dbo.CRResultDetail.Class8ST, dbo.StudInfoAll.RollNo
FROM         dbo.StudInfoAll INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.CRResultDetail ON dbo.StudInfoAll.RegID = dbo.CRResultDetail.RegID INNER JOIN
                      dbo.CRSubjectMaster ON dbo.CRResultDetail.CRSubjectCode = dbo.CRSubjectMaster.CRSubjectCode
ORDER BY dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegNo
GO
/****** Object:  View [dbo].[CRGovSchemeReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[CRGovSchemeReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                      dbo.MediumMaster.MediumName AS Medium, dbo.GenderMaster.GenderName AS Gender, dbo.GenderMaster.GenderShort, 
                      CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
                       CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.ClassCode, dbo.CRGovSchemeMaster.SrNo, dbo.CRGovSchemeDetail.CRGovSchemeCode, 
                      dbo.CRGovSchemeMaster.CRGovSchemeName, dbo.CRGovSchemeDetail.Class1, dbo.CRGovSchemeDetail.Class2, dbo.CRGovSchemeDetail.Class3, dbo.CRGovSchemeDetail.Class4, 
                      dbo.CRGovSchemeDetail.Class5, dbo.CRGovSchemeDetail.Class6, dbo.CRGovSchemeDetail.Class7, dbo.CRGovSchemeDetail.Class8, dbo.StudInfoAll.RollNo
FROM         dbo.StudInfoAll INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.CRGovSchemeDetail ON dbo.StudInfoAll.RegID = dbo.CRGovSchemeDetail.RegID INNER JOIN
                      dbo.CRGovSchemeMaster ON dbo.CRGovSchemeDetail.CRGovSchemeCode = dbo.CRGovSchemeMaster.CRGovSchemeCode
ORDER BY dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegNo
GO
/****** Object:  View [dbo].[DEReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[DEReport]
AS
SELECT     dbo.DETitleMaster.DETitleCode, dbo.DETitleMaster.DETitleName, dbo.DEMaster.DECode, dbo.DEMaster.SrNo, dbo.DEMaster.DEName, dbo.DEMaster.DeleteFlag
FROM         dbo.DETitleMaster INNER JOIN
                      dbo.DEMaster ON dbo.DETitleMaster.DETitleCode = dbo.DEMaster.DETitleCode
GO
/****** Object:  View [dbo].[DESubjectReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[DESubjectReport]
AS
SELECT     dbo.SubDEClassGroupMaster.SubDEClassGCode, dbo.SubDEClassGroupMaster.SubDEClassGName, dbo.SubjectDEMaster.SubjectDECode, dbo.SubjectDEMaster.SubjectCode, 
                      dbo.SubjectMaster.SubjectName, dbo.SubjectDEMaster.SrNo, dbo.SubjectDEMaster.SubjectDEName
FROM         dbo.SubjectDEMaster INNER JOIN
                      dbo.SubjectMaster ON dbo.SubjectDEMaster.SubjectCode = dbo.SubjectMaster.SubjectCode INNER JOIN
                      dbo.SubDEClassGroupMaster ON dbo.SubjectDEMaster.SubDEClassGCode = dbo.SubDEClassGroupMaster.SubDEClassGCode
GO
/****** Object:  View [dbo].[DRReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[DRReport]
AS
SELECT     TOP (100) PERCENT dbo.DREntry.TID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.DREntry.ReceiptNo, dbo.DREntry.ReceiptDate, dbo.DRHeadMaster.DRHeadName, 
                      dbo.DREntry.DonorName, dbo.DREntry.Address, dbo.DREntry.Amount, dbo.DREntry.Remark, dbo.DREntry.AyCode, dbo.DREntry.RegID, dbo.DREntry.MainClassCode
FROM         dbo.DREntry INNER JOIN
                      dbo.DRHeadMaster ON dbo.DREntry.DRHeadCode = dbo.DRHeadMaster.DRHeadCode INNER JOIN
                      dbo.MainClassMaster ON dbo.DREntry.MainClassCode = dbo.MainClassMaster.MainClassCode
ORDER BY dbo.DREntry.ReceiptNo DESC
GO
/****** Object:  View [dbo].[EmpAnnualSalarySummaryReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[EmpAnnualSalarySummaryReport]
AS
SELECT     TOP (100) PERCENT dbo.EmpMonthlySalaryDetail.EmpTID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.EmpTypeMaster.EmpTypeName AS EmpType, 
                      dbo.EmpMaster.Firstname + ' ' + dbo.EmpMaster.MiddleName + ' ' + dbo.EmpMaster.LastName AS EmployeeName, 
                      dbo.EmpMaster.FirstnameEN + ' ' + dbo.EmpMaster.MiddleNameEN + ' ' + dbo.EmpMaster.LastNameEN AS EmployeeNameEN, dbo.EmpSalaryMaster.PayMatrix, dbo.EmpMaster.ScaleOfPay, 
                      dbo.DesignationMaster.DesignationName, dbo.EmpMaster.AdharCardNo, dbo.EmpMaster.ShalarthID, dbo.EmpMaster.PanNo, SUM(dbo.EmpMonthlySalaryDetail.PayMatrix) AS SumPayMatrix, 
                      SUM(dbo.EmpMonthlySalaryDetail.DA) AS SumDA, SUM(dbo.EmpMonthlySalaryDetail.HRA) AS SumHRA, SUM(dbo.EmpMonthlySalaryDetail.CLA) AS SumCLA, SUM(dbo.EmpMonthlySalaryDetail.TA) 
                      AS SumTA, SUM(dbo.EmpMonthlySalaryDetail.DAArr) AS SumDAArr, SUM(dbo.EmpMonthlySalaryDetail.OtherAdd) AS SumOtherAdd, SUM(dbo.EmpMonthlySalaryDetail.TotalAdd) AS SumTotalAdd, 
                      SUM(dbo.EmpMonthlySalaryDetail.RecoveryAdjusted) AS SumRecAdj, SUM(dbo.EmpMonthlySalaryDetail.NetClaim) AS SumNetClaim, SUM(dbo.EmpMonthlySalaryDetail.GPFRegular) 
                      AS SumGPFRegular, SUM(dbo.EmpMonthlySalaryDetail.GPFLoan) AS SumGPFLoan, SUM(dbo.EmpMonthlySalaryDetail.DCPSRegular) AS SumDCPSRegular, 
                      SUM(dbo.EmpMonthlySalaryDetail.DCPSDelayed) AS SumDCPSDelayed, SUM(dbo.EmpMonthlySalaryDetail.PT) AS SumPT, SUM(dbo.EmpMonthlySalaryDetail.AccidintalPolicy) 
                      AS SumAccidintalPolicy, SUM(dbo.EmpMonthlySalaryDetail.RevStamp) AS SumRevStamp, SUM(dbo.EmpMonthlySalaryDetail.IncomeTax) AS SumIncomeTax, SUM(dbo.EmpMonthlySalaryDetail.LIC) 
                      AS SumLIC, SUM(dbo.EmpMonthlySalaryDetail.GLIC) AS SumGLIC, SUM(dbo.EmpMonthlySalaryDetail.Society) AS SumSociety, SUM(dbo.EmpMonthlySalaryDetail.BankLoan) AS SumBankLoan, 
                      SUM(dbo.EmpMonthlySalaryDetail.OtherDed) AS SumOtherDed, SUM(dbo.EmpMonthlySalaryDetail.TotalDed) AS SumTotalDed, SUM(dbo.EmpMonthlySalaryDetail.NetClaimFinal) 
                      AS SumNetClaimFinal, SUM(dbo.EmpMonthlySalaryDetail.TotalDedOnline) AS SumTotalDedOnline, SUM(dbo.EmpMonthlySalaryDetail.NetPayable) AS SumNetPayable, 
                      SUM(dbo.EmpMonthlySalaryDetail.RD) AS SumRD, SUM(dbo.EmpMonthlySalaryDetail.BankLoan1) AS SumBankLoan1, SUM(dbo.EmpMonthlySalaryDetail.BankLoan2) AS SumBankLoan2, 
                      SUM(dbo.EmpMonthlySalaryDetail.BankLoan + dbo.EmpMonthlySalaryDetail.BankLoan1 + dbo.EmpMonthlySalaryDetail.BankLoan2) AS SumBankLoanTotal, 
                      dbo.EmpITReturnAmount.HouseRentReceived, dbo.EmpITReturnAmount.OtherTaxableIncome, dbo.EmpITReturnAmount.HouseRentPaid, dbo.EmpITReturnAmount.HouseLoanPrincipal, 
                      dbo.EmpITReturnAmount.HouseLoanInterest, dbo.EmpITReturnAmount.MunicipalTaxPaid, dbo.EmpITReturnAmount.LICExternal, dbo.EmpITReturnAmount.MatualFund, 
                      dbo.EmpITReturnAmount.TutionFees, dbo.EmpITReturnAmount.EduLoanIntrest, dbo.EmpITReturnAmount.Donation80G, dbo.EmpITReturnAmount.Insurance, 
                      dbo.EmpITReturnAmount.MediClaimPolicy, dbo.EmpITReturnAmount.OtherDeduction, dbo.MainClassMaster.HMNameTDS, dbo.MainClassMaster.HMFatherNameTDS, 
                      dbo.MainClassMaster.HMPinNoTDS, dbo.EmpMonthlySalary.FyCode, SUM(dbo.EmpMonthlySalaryDetail.NPSEmpRAllow) AS SumNPSEmpRAllow, 
                      SUM(dbo.EmpMonthlySalaryDetail.NPSEmpRContri) AS SumNPSEmpRContri, SUM(dbo.EmpMonthlySalaryDetail.NPSEmpContri) AS SumNPSEmpContri
FROM         dbo.EmpMaster INNER JOIN
                      dbo.MainClassMaster ON dbo.EmpMaster.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.EmpMonthlySalaryDetail ON dbo.EmpMaster.TID = dbo.EmpMonthlySalaryDetail.EmpTID INNER JOIN
                      dbo.EmpTypeMaster ON dbo.EmpMaster.EmpTypeCode = dbo.EmpTypeMaster.EmpTypeCode INNER JOIN
                      dbo.DesignationMaster ON dbo.EmpMaster.DesignationCode = dbo.DesignationMaster.DesignationCode INNER JOIN
                      dbo.EmpSalaryMaster ON dbo.EmpMaster.TID = dbo.EmpSalaryMaster.TID INNER JOIN
                      dbo.EmpMonthlySalary ON dbo.EmpMonthlySalaryDetail.TID = dbo.EmpMonthlySalary.TID LEFT OUTER JOIN
                      dbo.EmpITReturnAmount ON dbo.EmpMaster.TID = dbo.EmpITReturnAmount.TID
GROUP BY dbo.MainClassMaster.MainClassName, dbo.EmpTypeMaster.EmpTypeName, dbo.EmpMaster.ScaleOfPay, dbo.DesignationMaster.DesignationName, dbo.EmpMaster.AdharCardNo, 
                      dbo.EmpMaster.ShalarthID, dbo.EmpMaster.PanNo, dbo.EmpSalaryMaster.PayMatrix, dbo.EmpMaster.Firstname + ' ' + dbo.EmpMaster.MiddleName + ' ' + dbo.EmpMaster.LastName, 
                      dbo.EmpMaster.FirstnameEN + ' ' + dbo.EmpMaster.MiddleNameEN + ' ' + dbo.EmpMaster.LastNameEN, dbo.EmpMonthlySalaryDetail.EmpTID, dbo.EmpITReturnAmount.HouseRentReceived, 
                      dbo.EmpITReturnAmount.OtherTaxableIncome, dbo.EmpITReturnAmount.HouseRentPaid, dbo.EmpITReturnAmount.HouseLoanPrincipal, dbo.EmpITReturnAmount.HouseLoanInterest, 
                      dbo.EmpITReturnAmount.MunicipalTaxPaid, dbo.EmpITReturnAmount.LICExternal, dbo.EmpITReturnAmount.MatualFund, dbo.EmpITReturnAmount.TutionFees, 
                      dbo.EmpITReturnAmount.EduLoanIntrest, dbo.EmpITReturnAmount.Donation80G, dbo.EmpITReturnAmount.Insurance, dbo.EmpITReturnAmount.MediClaimPolicy, 
                      dbo.EmpITReturnAmount.OtherDeduction, dbo.MainClassMaster.HMNameTDS, dbo.MainClassMaster.HMFatherNameTDS, dbo.MainClassMaster.HMPinNoTDS, dbo.EmpMonthlySalary.FyCode
GO
/****** Object:  View [dbo].[EmpClassDivisionReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[EmpClassDivisionReport]
AS
SELECT     dbo.EmpMaster.TID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.EmpMaster.RecordNo, dbo.EmpMaster.SrNo, dbo.EmpMaster.Firstname, dbo.EmpMaster.MiddleName, 
                      dbo.EmpMaster.LastName, dbo.EmpMaster.ClassTeacherShortName, dbo.EmpMaster.DeleteFlag, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, 
                      dbo.EmpClassDivisionDefine.ClassCode, dbo.EmpClassDivisionDefine.DivisionCode
FROM         dbo.EmpMaster INNER JOIN
                      dbo.MainClassMaster ON dbo.EmpMaster.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.DivisionMaster INNER JOIN
                      dbo.EmpClassDivisionDefine ON dbo.DivisionMaster.DivisionCode = dbo.EmpClassDivisionDefine.DivisionCode INNER JOIN
                      dbo.ClassMaster ON dbo.EmpClassDivisionDefine.ClassCode = dbo.ClassMaster.ClassCode ON dbo.EmpMaster.TID = dbo.EmpClassDivisionDefine.EmpTID
WHERE     (dbo.EmpMaster.DeleteFlag = 0)
GO
/****** Object:  View [dbo].[EmpInfoReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[EmpInfoReport]
AS
SELECT     dbo.EmpMaster.TID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.EmpMaster.RecordNo, dbo.EmpTypeMaster.EmpTypeName, dbo.EmpMaster.SrNo, dbo.EmpMaster.ScaleOfPay, 
                      dbo.EmpMaster.Firstname, dbo.EmpMaster.MiddleName, dbo.EmpMaster.LastName, dbo.EmpMaster.FirstnameEN, dbo.EmpMaster.MiddleNameEN, dbo.EmpMaster.LastNameEN, 
                      dbo.EmpMaster.PermanentAddress, dbo.CityMaster.CityName AS PerCity, dbo.EmpMaster.LocalAddress, CityMaster_1.CityName AS LocCity, dbo.EmpMaster.MobileNo1, 
                      dbo.EmpMaster.MobileNo2, dbo.EmpMaster.BloodGroup, dbo.CasteMaster.CasteName, dbo.CategoryMaster.CategoryName, CityMaster_2.CityName AS BirthPlace, dbo.EmpMaster.Dob, 
                      dbo.EmpMaster.TeachingSubject, dbo.EmpMaster.TeachingClass, dbo.EmpMaster.PassingYear, dbo.EmpMaster.VMANoandDate, dbo.EmpMaster.DoWS, dbo.DesignationMaster.DesignationName, 
                      dbo.BankMaster.BankName, dbo.EmpMaster.BranchName, dbo.BankMaster.IFSCCode, dbo.EmpMaster.BankAcNo, dbo.EmpMaster.Photpath, dbo.EmpMaster.AdharCardNo, 
                      dbo.EmpMaster.ShalarthID, dbo.EmpMaster.GPFOrDCPSNo, dbo.EmpMaster.PanNo, dbo.EmpMaster.LICNo, dbo.EmpMaster.SQualification, dbo.EmpMaster.BQualification, 
                      dbo.ReligionMaster.ReligionName, dbo.EmpMaster.ClassTeacherShortName, dbo.GenderMaster.GenderName, dbo.EmpMaster.DeleteFlag, dbo.EmpMaster.JoiningDate, 
                      dbo.EmpMaster.AddressITR, dbo.EmpMaster.CityITR, dbo.EmpMaster.PinNoITR, dbo.EmpMaster.BankNameITR, dbo.EmpMaster.BankBranchITR, dbo.EmpMaster.IFSCCodeITR, 
                      dbo.EmpMaster.BankAcNoITR, dbo.EmpMaster.EmailIDITR, dbo.EmpMaster.MobileNoITR, dbo.EmpMaster.ITRPassword, dbo.EmpMaster.AadharLinkStatus, dbo.MainClassMaster.TitleNameEN, 
                      dbo.MainClassMaster.OrgNameEN, dbo.MainClassMaster.AddressEN AS SchoolAddressEN, dbo.MainClassMaster.MobileNo AS HMMobileNo, dbo.MainClassMaster.SchoolNameTAN, 
                      dbo.MainClassMaster.SchoolEmailTDS, dbo.MainClassMaster.SchoolPinNoTDS, dbo.MainClassMaster.SchoolPanNoTDS, dbo.MainClassMaster.SchoolTDSPassword, 
                      dbo.MainClassMaster.HMNameTDS, dbo.MainClassMaster.HMFatherNameTDS, dbo.MainClassMaster.HMAddressTDS, dbo.MainClassMaster.HMPinNoTDS, dbo.MainClassMaster.HMPanNoTDS, 
                      dbo.MainClassMaster.HMEmailIDTDS, dbo.MainClassMaster.SchoolTinNo, dbo.MainClassMaster.BankName AS SchoolBank, dbo.MainClassMaster.BranchName AS SchoolBankBranch, 
                      dbo.MainClassMaster.IFSCCode AS SchoolIFSCCode, dbo.MainClassMaster.BankAcNo AS SchoolBankAcNo, dbo.EmpMaster.MainClassCode
FROM         dbo.CityMaster INNER JOIN
                      dbo.EmpMaster INNER JOIN
                      dbo.EmpTypeMaster ON dbo.EmpMaster.EmpTypeCode = dbo.EmpTypeMaster.EmpTypeCode INNER JOIN
                      dbo.DesignationMaster ON dbo.EmpMaster.DesignationCode = dbo.DesignationMaster.DesignationCode INNER JOIN
                      dbo.MainClassMaster ON dbo.EmpMaster.MainClassCode = dbo.MainClassMaster.MainClassCode ON dbo.CityMaster.CityCode = dbo.EmpMaster.PerCitycode INNER JOIN
                      dbo.CityMaster AS CityMaster_1 ON dbo.EmpMaster.LocCitycode = CityMaster_1.CityCode INNER JOIN
                      dbo.CasteMaster ON dbo.EmpMaster.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.CategoryMaster ON dbo.EmpMaster.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                      dbo.CityMaster AS CityMaster_2 ON dbo.EmpMaster.BirthPlaceCode = CityMaster_2.CityCode INNER JOIN
                      dbo.BankMaster ON dbo.EmpMaster.BankCode = dbo.BankMaster.BankCode INNER JOIN
                      dbo.ReligionMaster ON dbo.EmpMaster.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.GenderMaster ON dbo.EmpMaster.GenderCode = dbo.GenderMaster.GenderCode
GO
/****** Object:  View [dbo].[EmpMonthlySalaryReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[EmpMonthlySalaryReport]
AS
SELECT     TOP (100) PERCENT dbo.EmpMonthlySalary.TID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.EmpMonthlySalary.RecordNo, dbo.EmpTypeMaster.EmpTypeName AS EmpType, 
                      dbo.EmpMonthlySalary.TMDate, dbo.EmpMonthlySalary.ReportName, dbo.EmpMonthlySalary.CDTTitle1, dbo.EmpMonthlySalary.CDTTitle1Count, dbo.EmpMonthlySalary.CDTTitle2, 
                      dbo.EmpMonthlySalary.CDTTitle2Count, dbo.EmpMonthlySalary.CDTTitle3, dbo.EmpMonthlySalary.CDTTitle3Count, dbo.EmpMonthlySalary.CDTTitle4, dbo.EmpMonthlySalary.CDTTitle4Count, 
                      dbo.EmpMonthlySalary.RecoveryAdjusted, dbo.EmpMonthlySalary.RefundOfBalance, dbo.EmpMonthlySalary.Remark, dbo.EmpMonthlySalaryDetail.EmpTID, dbo.EmpMonthlySalaryDetail.SrNo, 
                      dbo.EmpMaster.Firstname + ' ' + dbo.EmpMaster.MiddleName + ' ' + dbo.EmpMaster.LastName AS EmployeeName, 
                      dbo.EmpMaster.FirstnameEN + ' ' + dbo.EmpMaster.MiddleNameEN + ' ' + dbo.EmpMaster.LastNameEN AS EmployeeNameEN, dbo.EmpMonthlySalaryDetail.PayMatrix, 
                      dbo.EmpMonthlySalaryDetail.DAPer, dbo.EmpMonthlySalaryDetail.DA, dbo.EmpMonthlySalaryDetail.HRAPer, dbo.EmpMonthlySalaryDetail.HRA + dbo.EmpMonthlySalaryDetail.HRADiff AS HRA, 
                      dbo.EmpMonthlySalaryDetail.CLA, dbo.EmpMonthlySalaryDetail.TA, dbo.EmpMonthlySalaryDetail.DAArr, dbo.EmpMonthlySalaryDetail.OtherAdd, dbo.EmpMonthlySalaryDetail.TotalAdd, 
                      dbo.EmpMonthlySalaryDetail.RecoveryAdjusted AS RecAdj, dbo.EmpMonthlySalaryDetail.NetClaim, dbo.EmpMonthlySalaryDetail.GPFRegular, dbo.EmpMonthlySalaryDetail.GPFLoan, 
                      dbo.EmpMonthlySalaryDetail.DCPSRegular, dbo.EmpMonthlySalaryDetail.DCPSDelayed, dbo.EmpMonthlySalaryDetail.PT, dbo.EmpMonthlySalaryDetail.AccidintalPolicy, 
                      dbo.EmpMonthlySalaryDetail.RevStamp, dbo.EmpMonthlySalaryDetail.IncomeTax, dbo.EmpMonthlySalaryDetail.LIC, dbo.EmpMonthlySalaryDetail.GLIC, dbo.EmpMonthlySalaryDetail.Society, 
                      dbo.EmpMonthlySalaryDetail.BankLoan, dbo.EmpMonthlySalaryDetail.OtherDed, dbo.EmpMonthlySalaryDetail.TotalDed, dbo.EmpMonthlySalaryDetail.NetClaimFinal, 
                      dbo.EmpMonthlySalaryDetail.Remak AS DetailRemark, dbo.EmpMaster.MobileNo1, dbo.EmpMaster.MobileNo2, dbo.GenderMaster.GenderName, dbo.GenderMaster.GenderShort, 
                      dbo.EmpMaster.Dob, dbo.EmpMaster.SQualification, dbo.EmpMaster.BQualification, dbo.EmpMaster.PassingYear, dbo.EmpMaster.DoWS, dbo.DesignationMaster.DesignationName, 
                      dbo.BankMaster.BankName, dbo.EmpMaster.BranchName, dbo.BankMaster.IFSCCode, dbo.EmpMaster.BankAcNo, dbo.EmpMaster.Photpath, dbo.EmpMaster.AdharCardNo, 
                      dbo.EmpMaster.ShalarthID, dbo.EmpMaster.GPFOrDCPSNo, dbo.EmpMaster.PanNo, dbo.EmpMaster.LICNo, dbo.CategoryMaster.CategoryName, dbo.ReligionMaster.ReligionName, 
                      dbo.CasteMaster.CasteName, dbo.CityMaster.CityName AS BirthPlace, dbo.EmpMaster.ScaleOfPay, dbo.EmpMaster.PermanentAddress, dbo.EmpMaster.LocalAddress, 
                      CityMaster_1.CityName AS PerCity, CityMaster_2.CityName AS LocCity, dbo.EmpMaster.JoiningDate, dbo.EmpMaster.Firstname, dbo.EmpMaster.MiddleName, dbo.EmpMaster.LastName, 
                      dbo.EmpMaster.FirstnameEN, dbo.EmpMaster.MiddleNameEN, dbo.EmpMaster.LastNameEN, dbo.EmpMaster.VMANoandDate, dbo.EmpMonthlySalaryDetail.TotalDedOnline, 
                      dbo.EmpMonthlySalaryDetail.NetPayable, dbo.EmpMonthlySalaryDetail.RD, dbo.EmpMonthlySalaryDetail.BankLoan1, dbo.EmpMonthlySalaryDetail.BankLoan2, 
                      dbo.EmpMonthlySalaryDetail.BankLoan + dbo.EmpMonthlySalaryDetail.BankLoan1 + dbo.EmpMonthlySalaryDetail.BankLoan2 AS BankLoanTotal, dbo.MainClassMaster.LogoPath, 
                      dbo.MainClassMaster.LetterHeadPath, dbo.EmpMaster.AddressITR, dbo.EmpMaster.CityITR, dbo.EmpMaster.PinNoITR, dbo.EmpMaster.BankNameITR, dbo.EmpMaster.BankBranchITR, 
                      dbo.EmpMaster.IFSCCodeITR, dbo.EmpMaster.BankAcNoITR, dbo.EmpMaster.EmailIDITR, dbo.EmpMaster.MobileNoITR, dbo.EmpMaster.ITRPassword, dbo.EmpMaster.AadharLinkStatus, 
                      dbo.EmpITReturnAmount.HouseRentReceived, dbo.EmpITReturnAmount.OtherTaxableIncome, dbo.EmpITReturnAmount.HouseRentPaid, dbo.EmpITReturnAmount.HouseLoanPrincipal, 
                      dbo.EmpITReturnAmount.HouseLoanInterest, dbo.EmpITReturnAmount.MunicipalTaxPaid, dbo.EmpITReturnAmount.LICExternal, dbo.EmpITReturnAmount.MatualFund, 
                      dbo.EmpITReturnAmount.TutionFees, dbo.EmpITReturnAmount.EduLoanIntrest, dbo.EmpITReturnAmount.Donation80G, dbo.EmpITReturnAmount.Insurance, 
                      dbo.EmpITReturnAmount.MediClaimPolicy, dbo.EmpITReturnAmount.OtherDeduction, dbo.EmpMaster.BankCode2, BankMaster_1.BankName AS BankName2, BankMaster_1.IFSCCode AS IFSCCode2,
                       dbo.EmpMaster.BranchName2, dbo.EmpMaster.BankAcNo2, dbo.EmpMaster.BankCode3, BankMaster_2.BankName AS BankName3, BankMaster_2.IFSCCode AS IFSCCode3, 
                      dbo.EmpMaster.BranchName3, dbo.EmpMaster.BankAcNo3, dbo.EmpMaster.BankCodeRD, BankMaster_3.BankName AS BankNameRD, BankMaster_3.IFSCCode AS IFSCCodeRD, 
                      dbo.EmpMaster.BranchNameRD, dbo.EmpMaster.BankAcNoRD, dbo.EmpMaster.BankCodeSociety, BankMaster_4.BankName AS BankNameSociety, BankMaster_4.IFSCCode AS IFSCCodeSociety, 
                      dbo.EmpMaster.BranchNameSociety, dbo.EmpMaster.BankAcNoSociety, dbo.EmpMonthlySalary.FyCode, dbo.EmpMonthlySalary.GrossAmount, dbo.EmpMonthlySalary.NetPayableAmount, 
                      dbo.EmpMonthlySalaryDetail.NPSEmpRAllow, dbo.EmpMonthlySalaryDetail.NPSEmpRContri, dbo.EmpMonthlySalaryDetail.NPSEmpContri, dbo.MainClassMaster.SchoolTinNo, 
                      dbo.MainClassMaster.SchoolCode, dbo.MainClassMaster.UDiesNo, dbo.MainClassMaster.SchoolCityEng, dbo.EmpMonthlySalaryDetail.Society1, dbo.EmpMonthlySalaryDetail.Society2, 
                      dbo.EmpMonthlySalaryDetail.Society3
FROM         dbo.EmpMonthlySalaryDetail INNER JOIN
                      dbo.EmpMaster ON dbo.EmpMonthlySalaryDetail.EmpTID = dbo.EmpMaster.TID INNER JOIN
                      dbo.EmpMonthlySalary ON dbo.EmpMonthlySalaryDetail.TID = dbo.EmpMonthlySalary.TID INNER JOIN
                      dbo.MainClassMaster ON dbo.EmpMonthlySalary.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.EmpTypeMaster ON dbo.EmpMonthlySalary.EmpTypeCode = dbo.EmpTypeMaster.EmpTypeCode INNER JOIN
                      dbo.GenderMaster ON dbo.EmpMaster.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.DesignationMaster ON dbo.EmpMaster.DesignationCode = dbo.DesignationMaster.DesignationCode INNER JOIN
                      dbo.BankMaster ON dbo.EmpMaster.BankCode = dbo.BankMaster.BankCode INNER JOIN
                      dbo.ReligionMaster ON dbo.EmpMaster.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.CategoryMaster ON dbo.EmpMaster.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                      dbo.CasteMaster ON dbo.EmpMaster.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.CityMaster ON dbo.EmpMaster.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                      dbo.CityMaster AS CityMaster_1 ON dbo.EmpMaster.PerCitycode = CityMaster_1.CityCode INNER JOIN
                      dbo.CityMaster AS CityMaster_2 ON dbo.EmpMaster.LocCitycode = CityMaster_2.CityCode INNER JOIN
                      dbo.BankMaster AS BankMaster_1 ON dbo.EmpMaster.BankCode2 = BankMaster_1.BankCode INNER JOIN
                      dbo.BankMaster AS BankMaster_2 ON dbo.EmpMaster.BankCode3 = BankMaster_2.BankCode INNER JOIN
                      dbo.BankMaster AS BankMaster_3 ON dbo.EmpMaster.BankCodeRD = BankMaster_3.BankCode INNER JOIN
                      dbo.BankMaster AS BankMaster_4 ON dbo.EmpMaster.BankCodeSociety = BankMaster_4.BankCode LEFT OUTER JOIN
                      dbo.EmpITReturnAmount ON dbo.EmpMaster.TID = dbo.EmpITReturnAmount.TID
ORDER BY dbo.EmpMonthlySalaryDetail.SrNo
GO
/****** Object:  View [dbo].[EmpMonthlySalarySummaryReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[EmpMonthlySalarySummaryReport]
AS
SELECT     TOP (100) PERCENT dbo.EmpMonthlySalary.TID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.EmpMonthlySalary.RecordNo, dbo.EmpTypeMaster.EmpTypeName AS EmpType, 
                      dbo.EmpMonthlySalary.TMDate, dbo.EmpMonthlySalary.ReportName, dbo.EmpMonthlySalary.CDTTitle1, dbo.EmpMonthlySalary.CDTTitle1Count, dbo.EmpMonthlySalary.CDTTitle2, 
                      dbo.EmpMonthlySalary.CDTTitle2Count, dbo.EmpMonthlySalary.CDTTitle3, dbo.EmpMonthlySalary.CDTTitle3Count, dbo.EmpMonthlySalary.CDTTitle4, dbo.EmpMonthlySalary.CDTTitle4Count, 
                      dbo.EmpMonthlySalary.RecoveryAdjusted, dbo.EmpMonthlySalary.RefundOfBalance, dbo.EmpMonthlySalary.Remark, SUM(dbo.EmpMonthlySalaryDetail.PayMatrix) AS SumPayMatrix, 
                      SUM(dbo.EmpMonthlySalaryDetail.DA) AS SumDA, SUM(dbo.EmpMonthlySalaryDetail.HRA + dbo.EmpMonthlySalaryDetail.HRADiff) AS SumHRA, SUM(dbo.EmpMonthlySalaryDetail.CLA) AS SumCLA, 
                      SUM(dbo.EmpMonthlySalaryDetail.TA) AS SumTA, SUM(dbo.EmpMonthlySalaryDetail.DAArr) AS SumDAArr, SUM(dbo.EmpMonthlySalaryDetail.OtherAdd) AS SumOtherAdd, 
                      SUM(dbo.EmpMonthlySalaryDetail.TotalAdd) AS SumTotalAdd, SUM(dbo.EmpMonthlySalaryDetail.RecoveryAdjusted) AS SumRecAdj, SUM(dbo.EmpMonthlySalaryDetail.NetClaim) AS SumNetClaim, 
                      SUM(dbo.EmpMonthlySalaryDetail.GPFRegular) AS SumGPFRegular, SUM(dbo.EmpMonthlySalaryDetail.GPFLoan) AS SumGPFLoan, SUM(dbo.EmpMonthlySalaryDetail.DCPSRegular) 
                      AS SumDCPSRegular, SUM(dbo.EmpMonthlySalaryDetail.DCPSDelayed) AS SumDCPSDelayed, SUM(dbo.EmpMonthlySalaryDetail.PT) AS SumPT, 
                      SUM(dbo.EmpMonthlySalaryDetail.AccidintalPolicy) AS SumAccidintalPolicy, SUM(dbo.EmpMonthlySalaryDetail.RevStamp) AS SumRevStamp, SUM(dbo.EmpMonthlySalaryDetail.IncomeTax) 
                      AS SumIncomeTax, SUM(dbo.EmpMonthlySalaryDetail.LIC) AS SumLIC, SUM(dbo.EmpMonthlySalaryDetail.GLIC) AS SumGLIC, SUM(dbo.EmpMonthlySalaryDetail.Society) AS SumSociety, 
                      SUM(dbo.EmpMonthlySalaryDetail.BankLoan) AS SumBankLoan, SUM(dbo.EmpMonthlySalaryDetail.OtherDed) AS SumOtherDed, SUM(dbo.EmpMonthlySalaryDetail.TotalDed) AS SumTotalDed, 
                      SUM(dbo.EmpMonthlySalaryDetail.NetClaimFinal) AS SumNetClaimFinal, SUM(dbo.EmpMonthlySalaryDetail.TotalDedOnline) AS SumTotalDedOnline, SUM(dbo.EmpMonthlySalaryDetail.NetPayable) 
                      AS SumNetPayable, SUM(dbo.EmpMonthlySalaryDetail.RD) AS SumRD, SUM(dbo.EmpMonthlySalaryDetail.BankLoan1) AS SumBankLoan1, SUM(dbo.EmpMonthlySalaryDetail.BankLoan2) 
                      AS SumBankLoan2, SUM(dbo.EmpMonthlySalaryDetail.BankLoan + dbo.EmpMonthlySalaryDetail.BankLoan1 + dbo.EmpMonthlySalaryDetail.BankLoan2) AS SumBankLoanTotal, 
                      dbo.EmpMonthlySalary.GrossAmount, dbo.EmpMonthlySalary.NetPayableAmount, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, 
                      SUM(dbo.EmpMonthlySalaryDetail.NPSEmpRAllow) AS SumNPSEmpRAllow, SUM(dbo.EmpMonthlySalaryDetail.NPSEmpRContri) AS SumNPSEmpRContri, 
                      SUM(dbo.EmpMonthlySalaryDetail.NPSEmpContri) AS SumNPSEmpContri, dbo.MainClassMaster.SchoolTinNo, dbo.MainClassMaster.SchoolCode, dbo.MainClassMaster.UDiesNo, 
                      dbo.MainClassMaster.SchoolCityEng, SUM(dbo.EmpMonthlySalaryDetail.Society1) AS SumSociety1, SUM(dbo.EmpMonthlySalaryDetail.Society2) AS SumSociety2, 
                      SUM(dbo.EmpMonthlySalaryDetail.Society3) AS SumSociety3
FROM         dbo.EmpMonthlySalaryDetail INNER JOIN
                      dbo.EmpMonthlySalary ON dbo.EmpMonthlySalaryDetail.TID = dbo.EmpMonthlySalary.TID INNER JOIN
                      dbo.MainClassMaster ON dbo.EmpMonthlySalary.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.EmpTypeMaster ON dbo.EmpMonthlySalary.EmpTypeCode = dbo.EmpTypeMaster.EmpTypeCode
GROUP BY dbo.EmpMonthlySalary.TID, dbo.MainClassMaster.MainClassName, dbo.EmpMonthlySalary.RecordNo, dbo.EmpTypeMaster.EmpTypeName, dbo.EmpMonthlySalary.TMDate, 
                      dbo.EmpMonthlySalary.ReportName, dbo.EmpMonthlySalary.CDTTitle1, dbo.EmpMonthlySalary.CDTTitle1Count, dbo.EmpMonthlySalary.CDTTitle2, dbo.EmpMonthlySalary.CDTTitle2Count, 
                      dbo.EmpMonthlySalary.CDTTitle3, dbo.EmpMonthlySalary.CDTTitle3Count, dbo.EmpMonthlySalary.CDTTitle4, dbo.EmpMonthlySalary.CDTTitle4Count, dbo.EmpMonthlySalary.RecoveryAdjusted, 
                      dbo.EmpMonthlySalary.RefundOfBalance, dbo.EmpMonthlySalary.Remark, dbo.EmpMonthlySalary.GrossAmount, dbo.EmpMonthlySalary.NetPayableAmount, dbo.MainClassMaster.LogoPath, 
                      dbo.MainClassMaster.LetterHeadPath, dbo.MainClassMaster.SchoolTinNo, dbo.MainClassMaster.SchoolCode, dbo.MainClassMaster.UDiesNo, dbo.MainClassMaster.SchoolCityEng
GO
/****** Object:  View [dbo].[Exam1SMEntry]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[Exam1SMEntry]
AS
SELECT     RegID, ExamCode, SubjectCode, ST2MarksTotalF, ST3MarksTotalF, MaxMarksTotalF, MarksTotalF, MarksAddInTotalFlag, SubPer, SubGrade, SubjectDE
FROM         dbo.StudentExamMarksEntry
WHERE     (ExamCode = 1)
GO
/****** Object:  View [dbo].[Exam2SMEntry]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[Exam2SMEntry]
AS
SELECT     RegID, ExamCode, SubjectCode, ST2MarksTotalF, ST3MarksTotalF, MaxMarksTotalF, MarksTotalF, MarksAddInTotalFlag, SubPer, SubGrade, SubjectDE
FROM         dbo.StudentExamMarksEntry
WHERE     (ExamCode = 2)
GO
/****** Object:  View [dbo].[ExamClassSubjectDefineReport]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamClassSubjectDefineReport]
AS
SELECT DISTINCT ClassCode, SrNo, SubjectCode, ExamMarksTypeCode, MinMarks, MaxMarks
FROM         dbo.ExamMarksDefine
GO
/****** Object:  View [dbo].[ExamMarkMemoAnnualDetail]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamMarkMemoAnnualDetail]
AS
SELECT dbo.StudentExamAnnualMMDetail.RegID, dbo.StudentExamAnnualMMDetail.SubjectCode, dbo.SubjectMaster.SubjectName, dbo.SubjectMaster.SubjectNameShort, dbo.StudentExamAnnualMMDetail.SrNo, 
                  dbo.StudentExamAnnualMMDetail.ExamMarksTypeCode, dbo.StudentExamAnnualMMDetail.E1ST1MD1, dbo.StudentExamAnnualMMDetail.E1ST1MD2, dbo.StudentExamAnnualMMDetail.E1ST1MD3, 
                  dbo.StudentExamAnnualMMDetail.E1ST1MT1, dbo.StudentExamAnnualMMDetail.E1ST1MT2, dbo.StudentExamAnnualMMDetail.E1ST1MT3, dbo.StudentExamAnnualMMDetail.E1MaxMarksTotal, 
                  dbo.StudentExamAnnualMMDetail.E1MarksTotal, dbo.StudentExamAnnualMMDetail.E1SubPer, dbo.StudentExamAnnualMMDetail.E1SubGrade, dbo.StudentExamAnnualMMDetail.E1GradeRemark, 
                  dbo.StudentExamAnnualMMDetail.E2ST1MD1, dbo.StudentExamAnnualMMDetail.E2ST1MD2, dbo.StudentExamAnnualMMDetail.E2ST1MD3, dbo.StudentExamAnnualMMDetail.E2ST1MT1, dbo.StudentExamAnnualMMDetail.E2ST1MT2, 
                  dbo.StudentExamAnnualMMDetail.E2ST1MT3, dbo.StudentExamAnnualMMDetail.E2MaxMarksTotal, dbo.StudentExamAnnualMMDetail.E2MarksTotal, dbo.StudentExamAnnualMMDetail.E2SubPer, 
                  dbo.StudentExamAnnualMMDetail.E2SubGrade, dbo.StudentExamAnnualMMDetail.E2GradeRemark, dbo.StudentExamAnnualMMDetail.E3MaxMarksTotal, dbo.StudentExamAnnualMMDetail.E3MarksTotal, 
                  dbo.StudentExamAnnualMMDetail.E4MaxMarksTotal, dbo.StudentExamAnnualMMDetail.E4MarksTotal, dbo.StudentExamAnnualMMDetail.E5MaxMarksTotal, dbo.StudentExamAnnualMMDetail.E5MarksTotal, 
                  dbo.StudentExamAnnualMMDetail.E6MaxMarksTotal, dbo.StudentExamAnnualMMDetail.E6MarksTotal, dbo.StudentExamAnnualMMDetail.SubGMaxMarksTotal, dbo.StudentExamAnnualMMDetail.SubGMarksTotal, 
                  dbo.StudentExamAnnualMMDetail.SubGPer, dbo.StudentExamAnnualMMDetail.SubGGrade, dbo.StudentExamAnnualMMDetail.SubGGradeRemark, dbo.StudInfo.EntryFrom, dbo.StudInfo.CloseFlag, dbo.StudInfo.StudDisplayFlag, 
                  dbo.StudInfo.AyCode, dbo.ClassMaster.ClassName AS Class, dbo.MediumMaster.MediumName AS Medium, dbo.MainClassMaster.MainClassName AS MainClass, dbo.DivisionMaster.DivisionName AS Div, dbo.GenderMaster.GenderName, 
                  dbo.GenderMaster.GenderShort, dbo.StudInfo.RegNo, 
                  CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END AS StudentName, 
                  CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END AS Student, dbo.StudInfo.Firstname, 
                  dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.StudentExamAnnualMMDetail.MarksAddInTotalFlag, dbo.StudInfo.MarksFeedFlag, dbo.StudentExamAnnualMMDetail.E3SubGrade, dbo.StudentExamAnnualMMDetail.E4SubGrade, 
                  dbo.StudentExamAnnualMMDetail.E5SubGrade, dbo.StudentExamAnnualMMDetail.E6SubGrade, dbo.StudentExamAnnualMMDetail.FTSubMaxMarksTotal, dbo.StudentExamAnnualMMDetail.FTSubMarksTotal, 
                  dbo.StudentExamAnnualMMDetail.FTSubPer, dbo.StudentExamAnnualMMDetail.FTSubGrade, dbo.StudentExamAnnualMMDetail.FTSubGradeRemark, dbo.StudentExamAnnualMMDetail.STSubMaxMarksTotal, 
                  dbo.StudentExamAnnualMMDetail.STSubMarksTotal, dbo.StudentExamAnnualMMDetail.STSubPer, dbo.StudentExamAnnualMMDetail.STSubGrade, dbo.StudentExamAnnualMMDetail.STSubGradeRemark, 
                  dbo.StudentExamAnnualMMDetail.FTSTSubGMaxMarksTotal, dbo.StudentExamAnnualMMDetail.FTSTSubGMarksTotal, dbo.StudentExamAnnualMMDetail.FTSTSubGPer, dbo.StudentExamAnnualMMDetail.FTSTSubGGrade, 
                  dbo.StudentExamAnnualMMDetail.FTSTSubGGradeRemark, dbo.StudentExamAnnualMMDetail.E1ST1Marks1F, dbo.StudentExamAnnualMMDetail.E1ST1Marks2F, dbo.StudentExamAnnualMMDetail.E1ST1Marks3F, 
                  dbo.StudentExamAnnualMMDetail.E1ST1Marks4F, dbo.StudentExamAnnualMMDetail.E1ST1Marks5F, dbo.StudentExamAnnualMMDetail.E1ST1Marks6F, dbo.StudentExamAnnualMMDetail.E1ST1Marks7F, 
                  dbo.StudentExamAnnualMMDetail.E2ST1Marks1F, dbo.StudentExamAnnualMMDetail.E2ST1Marks2F, dbo.StudentExamAnnualMMDetail.E2ST1Marks3F, dbo.StudentExamAnnualMMDetail.E2ST1Marks4F, 
                  dbo.StudentExamAnnualMMDetail.E2ST1Marks5F, dbo.StudentExamAnnualMMDetail.E2ST1Marks6F, dbo.StudentExamAnnualMMDetail.E2ST1Marks7F, dbo.StudentExamAnnualMMDetail.E1ST1Marks1, 
                  dbo.StudentExamAnnualMMDetail.E1ST1Marks2, dbo.StudentExamAnnualMMDetail.E1ST1Marks3, dbo.StudentExamAnnualMMDetail.E1ST1Marks4, dbo.StudentExamAnnualMMDetail.E1ST1Marks5, 
                  dbo.StudentExamAnnualMMDetail.E1ST1Marks6, dbo.StudentExamAnnualMMDetail.E1ST1Marks7, dbo.StudentExamAnnualMMDetail.E2ST1Marks1, dbo.StudentExamAnnualMMDetail.E2ST1Marks2, 
                  dbo.StudentExamAnnualMMDetail.E2ST1Marks3, dbo.StudentExamAnnualMMDetail.E2ST1Marks4, dbo.StudentExamAnnualMMDetail.E2ST1Marks5, dbo.StudentExamAnnualMMDetail.E2ST1Marks6, 
                  dbo.StudentExamAnnualMMDetail.E2ST1Marks7, dbo.StudentExamAnnualMMDetail.E1ST1MarksD1, dbo.StudentExamAnnualMMDetail.E1ST1MarksD2, dbo.StudentExamAnnualMMDetail.E1ST1MarksD3, 
                  dbo.StudentExamAnnualMMDetail.E1ST1MarksD4, dbo.StudentExamAnnualMMDetail.E1ST1MarksD5, dbo.StudentExamAnnualMMDetail.E1ST1MarksD6, dbo.StudentExamAnnualMMDetail.E1ST1MarksD7, 
                  dbo.StudentExamAnnualMMDetail.E2ST1MarksD1, dbo.StudentExamAnnualMMDetail.E2ST1MarksD2, dbo.StudentExamAnnualMMDetail.E2ST1MarksD3, dbo.StudentExamAnnualMMDetail.E2ST1MarksD4, 
                  dbo.StudentExamAnnualMMDetail.E2ST1MarksD5, dbo.StudentExamAnnualMMDetail.E2ST1MarksD6, dbo.StudentExamAnnualMMDetail.E2ST1MarksD7, dbo.SubjectMaster.SubjectCodeBoard, dbo.StudInfo.DeleteFlag, 
                  dbo.StudInfo.RollNo, dbo.StudentExamAnnualMMDetail.ExamTypeCode, dbo.StudentExamAnnualMMSummary.E1GMaxMarksTotal, dbo.StudentExamAnnualMMSummary.E1GMarksTotal, dbo.StudentExamAnnualMMSummary.E1GPer, 
                  dbo.StudentExamAnnualMMSummary.E1GGrade, dbo.StudentExamAnnualMMSummary.E1GradeRemark AS E1GradeRemarkGrand, dbo.StudentExamAnnualMMSummary.E1Rank, 
                  dbo.StudentExamAnnualMMSummary.E2GMaxMarksTotal, dbo.StudentExamAnnualMMSummary.E2GMarksTotal, dbo.StudentExamAnnualMMSummary.E2GPer, dbo.StudentExamAnnualMMSummary.E2GGrade, 
                  dbo.StudentExamAnnualMMSummary.E2GGradeRemark, dbo.StudentExamAnnualMMSummary.E2Rank, dbo.StudentExamAnnualMMSummary.GMaxMarksTotal, dbo.StudentExamAnnualMMSummary.GMarksTotal, 
                  dbo.StudentExamAnnualMMSummary.GPer, dbo.StudentExamAnnualMMSummary.GGrade, dbo.StudentExamAnnualMMSummary.GGradeRemark, dbo.StudentExamAnnualMMSummary.GRank, 
                  dbo.StudentExamAnnualMMSummary.FTSTMaxMarksTotal, dbo.StudentExamAnnualMMSummary.FTSTMarksTotal, dbo.StudentExamAnnualMMSummary.FTSTPer, dbo.StudentExamAnnualMMSummary.FTSTGrade, 
                  dbo.StudentExamAnnualMMSummary.FTSTGradeRemark, dbo.StudentExamAnnualMMSummary.FTSTRank, dbo.StudentExamAnnualMMSummary.E3GMaxMarksTotal, dbo.StudentExamAnnualMMSummary.E3GMarksTotal, 
                  dbo.StudentExamAnnualMMSummary.E3GPer, dbo.StudentExamAnnualMMSummary.E3GGrade, dbo.StudentExamAnnualMMSummary.E3GradeRemark, dbo.StudentExamAnnualMMSummary.E3Rank, 
                  dbo.StudentExamAnnualMMSummary.E4GMaxMarksTotal, dbo.StudentExamAnnualMMSummary.E4GMarksTotal, dbo.StudentExamAnnualMMSummary.E4GPer, dbo.StudentExamAnnualMMSummary.E4GGrade, 
                  dbo.StudentExamAnnualMMSummary.E4GradeRemark, dbo.StudentExamAnnualMMSummary.E4Rank, dbo.StudentExamAnnualMMSummary.E5GMaxMarksTotal, dbo.StudentExamAnnualMMSummary.E5GMarksTotal, 
                  dbo.StudentExamAnnualMMSummary.E5GPer, dbo.StudentExamAnnualMMSummary.E5GGrade, dbo.StudentExamAnnualMMSummary.E5GradeRemark, dbo.StudentExamAnnualMMSummary.E5Rank, 
                  dbo.StudentExamAnnualMMSummary.E6GMaxMarksTotal, dbo.StudentExamAnnualMMSummary.E6GMarksTotal, dbo.StudentExamAnnualMMSummary.E6GPer, dbo.StudentExamAnnualMMSummary.E6GGrade, 
                  dbo.StudentExamAnnualMMSummary.E6GradeRemark, dbo.StudentExamAnnualMMSummary.E6Rank
FROM     dbo.StudentExamAnnualMMDetail INNER JOIN
                  dbo.SubjectMaster ON dbo.StudentExamAnnualMMDetail.SubjectCode = dbo.SubjectMaster.SubjectCode INNER JOIN
                  dbo.StudInfo ON dbo.StudentExamAnnualMMDetail.RegID = dbo.StudInfo.RegID INNER JOIN
                  dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                  dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                  dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                  dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                  dbo.GenderMaster ON dbo.StudInfo.GenderCode = dbo.GenderMaster.GenderCode LEFT OUTER JOIN
                  dbo.StudentExamAnnualMMSummary ON dbo.StudentExamAnnualMMDetail.RegID = dbo.StudentExamAnnualMMSummary.RegID
WHERE  (dbo.StudInfo.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExamMarkMemoTermSummary]    Script Date: 13-08-2025 16:35:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamMarkMemoTermSummary]
AS
SELECT        TOP (100) PERCENT dbo.StudInfo.RegID, dbo.StudInfo.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                         dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                         CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END AS StudentName, 
                         CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END AS Student, 
                         dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfo.AyCode, dbo.StudInfo.StudentID, dbo.StudInfo.AadharNo, dbo.StudInfo.Dob, dbo.StudInfo.MotherName, 
                         dbo.StudInfo.PermanentAddress, dbo.StudInfo.LocalAddress, dbo.StudInfo.MobileNo1, dbo.StudInfo.MobileNo2, dbo.StudInfo.CloseFlag, dbo.StudInfo.TSuspendedFlag, dbo.StudInfo.AdmissionType, dbo.StudInfo.MediumCode, 
                         dbo.StudInfo.ClassCode, dbo.GenderMaster.GenderName, dbo.StudInfo.Photpath, dbo.StudInfo.RollNo, dbo.StudInfo.EntryFrom, dbo.StudInfo.StudDisplayFlag, dbo.StudInfo.FeesPaidFlag, dbo.StudInfo.MarksFeedFlag, 
                         dbo.StudInfo.WeightFT, dbo.StudInfo.WeightST, dbo.StudInfo.HeightFT, dbo.StudInfo.HeightST, dbo.StudInfo.SeatNo, dbo.StudInfo.AdmiSchoolType, dbo.StudInfo.Nationality, dbo.MainClassMaster.LogoPath, 
                         dbo.MainClassMaster.LetterHeadPath, dbo.StudentExamMarksSummary.ExamCode, dbo.ExamMaster.ExamName, dbo.StudentExamMarksSummary.Marks AS GMarks, 
                         dbo.StudentExamMarksSummary.MaxMarks AS GMaxMarks, dbo.StudentExamMarksSummary.Per AS GPer, dbo.StudentExamMarksSummary.Grade AS GGrade, 
                         dbo.StudentExamMarksSummary.GradeRemark AS GGradeRemark, dbo.StudentExamMarksSummary.Rank, dbo.StudInfo.FatherName, dbo.StudInfo.CategoryCode, dbo.CategoryMaster.CategoryName, dbo.StudInfo.DobInWord, 
                         dbo.StudInfo.GaurdianName, dbo.EducationMaster.EducationName AS FEducation, EducationMaster_1.EducationName AS MEducation, dbo.StudInfo.NationalCode
FROM            dbo.GenderMaster INNER JOIN
                         dbo.StudInfo INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.StudentExamMarksSummary ON dbo.StudInfo.RegID = dbo.StudentExamMarksSummary.RegID INNER JOIN
                         dbo.ExamMaster ON dbo.StudentExamMarksSummary.ExamCode = dbo.ExamMaster.ExamCode INNER JOIN
                         dbo.CategoryMaster ON dbo.StudInfo.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                         dbo.EducationMaster ON dbo.StudInfo.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                         dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfo.MEducationCode = EducationMaster_1.EducationCode
ORDER BY dbo.StudInfo.RegID DESC
GO
/****** Object:  View [dbo].[ExamMarkMemoTermSummaryCovid19]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamMarkMemoTermSummaryCovid19]
AS
SELECT     TOP (100) PERCENT dbo.StudInfo.RegID, dbo.StudInfo.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfo.AyCode, dbo.StudInfo.StudentID, dbo.StudInfo.AadharNo, 
                      dbo.StudInfo.Dob, dbo.StudInfo.MotherName, dbo.StudInfo.PermanentAddress, dbo.StudInfo.LocalAddress, dbo.StudInfo.MobileNo1, dbo.StudInfo.MobileNo2, dbo.StudInfo.CloseFlag, 
                      dbo.StudInfo.TSuspendedFlag, dbo.StudInfo.AdmissionType, dbo.StudInfo.MediumCode, dbo.StudInfo.ClassCode, dbo.GenderMaster.GenderName, dbo.StudInfo.Photpath, dbo.StudInfo.RollNo, 
                      dbo.StudInfo.EntryFrom, dbo.StudInfo.StudDisplayFlag, dbo.StudInfo.FeesPaidFlag, dbo.StudInfo.MarksFeedFlag, dbo.StudInfo.WeightFT, dbo.StudInfo.WeightST, dbo.StudInfo.HeightFT, 
                      dbo.StudInfo.HeightST, dbo.StudInfo.SeatNo, dbo.StudInfo.AdmiSchoolType, dbo.StudInfo.Nationality, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, 
                      dbo.StudentExamMarksSummary.ExamCode, dbo.ExamMaster.ExamName, dbo.StudentExamMarksSummary.Marks AS GMarks, dbo.StudentExamMarksSummary.MaxMarks AS GMaxMarks, 
                      dbo.StudentExamMarksSummary.Per AS GPer, dbo.StudentExamMarksSummary.Grade AS GGrade, dbo.StudentExamMarksSummary.GradeRemark AS GGradeRemark, 
                      dbo.StudentExamMarksSummary.Rank, dbo.StudInfo.FatherName, dbo.StudInfo.CategoryCode, dbo.CategoryMaster.CategoryName, dbo.StudInfo.DobInWord, 
                      dbo.EducationMaster.EducationName AS FEducation, EducationMaster_1.EducationName AS MEducation, dbo.StudInfo.GaurdianName
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.StudentExamMarksSummary ON dbo.StudInfo.RegID = dbo.StudentExamMarksSummary.RegID INNER JOIN
                      dbo.ExamMaster ON dbo.StudentExamMarksSummary.ExamCode = dbo.ExamMaster.ExamCode INNER JOIN
                      dbo.CategoryMaster ON dbo.StudInfo.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                      dbo.EducationMaster ON dbo.StudInfo.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                      dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfo.MEducationCode = EducationMaster_1.EducationCode
ORDER BY dbo.StudInfo.RegID DESC
GO
/****** Object:  View [dbo].[ExamMarksDefineReportPrint]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamMarksDefineReportPrint]
AS
SELECT        dbo.ExamMarksDefine.TID, dbo.ExamMarksDefine.ClassCode, dbo.ExamMarksDefine.SrNo, dbo.ExamMarksDefine.SubjectCode, dbo.ExamMarksDefine.ST1Marks1, dbo.ExamMarksDefine.ST1Marks2, 
                         dbo.ExamMarksDefine.ST1Marks3, dbo.ExamMarksDefine.ST1Marks4, dbo.ExamMarksDefine.ST1Marks5, dbo.ExamMarksDefine.ST1Marks6, dbo.ExamMarksDefine.ST1Marks7, dbo.ExamMarksDefine.ST1MarksTotal, 
                         dbo.ExamMarksDefine.ST2MarksTotal, dbo.ExamMarksDefine.ST3MarksTotal, dbo.ClassMaster.ClassName, dbo.ExamMarksDefine.ExamMarksTypeCode, dbo.ExamGroupMaster.ExamGroupName, 
                         dbo.ExamMarksDefine.ExamGroupcode, dbo.ExamMarksDefine.MarksAddInTotalFlag, dbo.ExamMarksTypeMaster.ExamMarksTypeName, dbo.SubjectMaster.SubjectName, dbo.ClassMaster.MaxSubDEntry, 
                         dbo.ClassMaster.MaxTermDEntry, dbo.ExamMarksDefine.MaxMarks, dbo.ExamMarksDefine.DivideMarks, dbo.MainClassMaster.MainClassCode, dbo.MainClassMaster.MainClassName, dbo.ExamMarksDefine.MinMarks
FROM            dbo.ExamMarksDefine INNER JOIN
                         dbo.ClassMaster ON dbo.ExamMarksDefine.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.ExamGroupMaster ON dbo.ExamMarksDefine.ExamGroupcode = dbo.ExamGroupMaster.ExamGroupCode INNER JOIN
                         dbo.ExamMarksTypeMaster ON dbo.ExamMarksDefine.ExamMarksTypeCode = dbo.ExamMarksTypeMaster.ExamMarksTypeCode INNER JOIN
                         dbo.SubjectMaster ON dbo.ExamMarksDefine.SubjectCode = dbo.SubjectMaster.SubjectCode INNER JOIN
                         dbo.MainClassMaster ON dbo.ClassMaster.MainClassCode = dbo.MainClassMaster.MainClassCode
GO
/****** Object:  View [dbo].[ExamOptionalSubjectStudentReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamOptionalSubjectStudentReport]
AS
SELECT     dbo.SubjectMaster.SubjectName, dbo.SubjectMaster.SubjectNameShort, dbo.StudInfo.EntryFrom, dbo.StudInfo.CloseFlag, dbo.StudInfo.StudDisplayFlag, dbo.StudInfo.AyCode, 
                      dbo.ClassMaster.ClassName AS Class, dbo.MediumMaster.MediumName AS Medium, dbo.MainClassMaster.MainClassName AS MainClass, dbo.DivisionMaster.DivisionName AS Div, 
                      dbo.GenderMaster.GenderName, dbo.GenderMaster.GenderShort, dbo.StudInfo.RegNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.StudInfo.MarksFeedFlag, dbo.OptionalSubjectGroupMaster.OptionalSubjectGroupCode, 
                      dbo.OptionalSubjectGroupMaster.OptionalSubjectGroupName, dbo.StudInfo.RollNo
FROM         dbo.OptionalSubjectGroupDetail INNER JOIN
                      dbo.OptionalSubjectGroupMaster ON dbo.OptionalSubjectGroupDetail.OptionalSubjectGroupCode = dbo.OptionalSubjectGroupMaster.OptionalSubjectGroupCode INNER JOIN
                      dbo.MediumMaster INNER JOIN
                      dbo.StudInfo ON dbo.MediumMaster.MediumCode = dbo.StudInfo.MediumCode INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfo.GenderCode = dbo.GenderMaster.GenderCode ON dbo.OptionalSubjectGroupMaster.ClassCode = dbo.StudInfo.ClassCode INNER JOIN
                      dbo.SubjectMaster ON dbo.OptionalSubjectGroupDetail.SubjectCode = dbo.SubjectMaster.SubjectCode INNER JOIN
                      dbo.StudOptionalSubjectDefine ON dbo.StudInfo.RegID = dbo.StudOptionalSubjectDefine.RegID AND 
                      dbo.OptionalSubjectGroupMaster.OptionalSubjectGroupCode = dbo.StudOptionalSubjectDefine.OptionalSubjectGroupCode
GO
/****** Object:  View [dbo].[ExamSubjectMarksRegisterSubjectWise]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamSubjectMarksRegisterSubjectWise]
AS
SELECT     TOP (100) PERCENT dbo.StudInfo.RegID, dbo.StudInfo.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfo.AyCode, dbo.StudInfo.AdmittionDate, dbo.StudInfo.StudentID, 
                      dbo.StudInfo.AadharNo, dbo.StudInfo.Dob, dbo.StudInfo.MotherName, dbo.StudInfo.LocalAddress, dbo.StudInfo.FatherName, dbo.StudInfo.CloseFlag, dbo.StudInfo.TSuspendedFlag, 
                      dbo.StudInfo.AdmissionType, dbo.StudInfo.MediumCode, dbo.StudInfo.ClassCode, dbo.GenderMaster.GenderName, dbo.StudInfo.Photpath, dbo.StudInfo.RollNo, dbo.StudInfo.EntryFrom, 
                      dbo.StudInfo.StudDisplayFlag, dbo.StudInfo.MarksFeedFlag, dbo.StudInfo.WeightFT, dbo.StudInfo.WeightST, dbo.StudInfo.HeightFT, dbo.StudInfo.HeightST, dbo.StudInfo.SeatNo, 
                      dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.StudInfo.BloodGroup, dbo.StudInfo.CategoryCode, dbo.TempSubjectMarksRegisterBlank.ExamName, 
                      dbo.TempSubjectMarksRegisterBlank.SubjectName, dbo.TempSubjectMarksRegisterBlank.SubjectCode, dbo.TempSubjectMarksRegisterBlank.ExamCode, 
                      dbo.TempSubjectMarksRegisterBlank.ST1Marks1, dbo.TempSubjectMarksRegisterBlank.ST1Marks2, dbo.TempSubjectMarksRegisterBlank.ST1Marks3, 
                      dbo.TempSubjectMarksRegisterBlank.ST1Marks4, dbo.TempSubjectMarksRegisterBlank.ST1Marks5, dbo.TempSubjectMarksRegisterBlank.ST1Marks6, 
                      dbo.TempSubjectMarksRegisterBlank.ST1Marks7, dbo.TempSubjectMarksRegisterBlank.ST1MarksTotal, dbo.TempSubjectMarksRegisterBlank.ST2MarksTotal, 
                      dbo.TempSubjectMarksRegisterBlank.ST3MarksTotal
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode CROSS JOIN
                      dbo.TempSubjectMarksRegisterBlank
ORDER BY dbo.StudInfo.RegID DESC
GO
/****** Object:  View [dbo].[ExamTermDEntry]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamTermDEntry]
AS
SELECT        dbo.StudentExamTermDEntry.RegID, dbo.StudentExamTermDEntry.ExamCode, dbo.StudentExamTermDEntry.DETitleCode, dbo.DETitleMaster.DETitleName, dbo.StudentExamTermDEntry.DECode, dbo.DEMaster.DEName, 
                         dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.AyCode
FROM            dbo.StudentExamTermDEntry INNER JOIN
                         dbo.DETitleMaster ON dbo.StudentExamTermDEntry.DETitleCode = dbo.DETitleMaster.DETitleCode INNER JOIN
                         dbo.DEMaster ON dbo.StudentExamTermDEntry.DECode = dbo.DEMaster.DECode INNER JOIN
                         dbo.StudInfo ON dbo.StudentExamTermDEntry.RegID = dbo.StudInfo.RegID INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode
GO
/****** Object:  View [dbo].[ExamTermDEntryCBSC]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExamTermDEntryCBSC]
AS
SELECT        dbo.StudentExamTermDEntryCBSC.RegID, dbo.StudentExamTermDEntryCBSC.ExamCode, dbo.CBSCDEGroupMaster.CBSCDEGroupCode, dbo.CBSCDEGroupMaster.SrNo AS CBSCDEGroupSrNo, 
                         dbo.CBSCDEGroupMaster.CBSCDEGroupName, dbo.CBSCDETitleGroupMaster.CBSCDETitleGroupCode, dbo.CBSCDETitleGroupMaster.SrNo AS CBSCDETitleGroupSrNo, dbo.CBSCDETitleGroupMaster.CBSCDETitleGroupName, 
                         dbo.CBSCDETitleMaster.CBSCDETitleCode, dbo.CBSCDETitleMaster.SrNo AS CBSCDETitleSrNo, dbo.CBSCDETitleMaster.CBSCDETitleName, dbo.CBSCDEMaster.CBSCDECode, dbo.CBSCDEMaster.SrNo AS CBSCDESrNo, 
                         dbo.CBSCDEMaster.CBSCDEName, dbo.GradeMaster.GradeName, dbo.CBSCDETitleGroupMaster.DeleteFlag, dbo.StudInfo.AyCode, dbo.MainClassMaster.MainClassName AS MainClass, 
                         dbo.MediumMaster.MediumName AS Medium, dbo.DivisionMaster.DivisionName AS Div, dbo.ClassMaster.ClassName AS Class
FROM            dbo.StudentExamTermDEntryCBSC INNER JOIN
                         dbo.CBSCDEMaster ON dbo.StudentExamTermDEntryCBSC.CBSCDECode = dbo.CBSCDEMaster.CBSCDECode INNER JOIN
                         dbo.CBSCDETitleMaster ON dbo.CBSCDEMaster.CBSCDETitleCode = dbo.CBSCDETitleMaster.CBSCDETitleCode INNER JOIN
                         dbo.CBSCDETitleGroupMaster ON dbo.CBSCDETitleMaster.CBSCDETitleGroupCode = dbo.CBSCDETitleGroupMaster.CBSCDETitleGroupCode INNER JOIN
                         dbo.CBSCDEGroupMaster ON dbo.CBSCDETitleGroupMaster.CBSCDEGroupCode = dbo.CBSCDEGroupMaster.CBSCDEGroupCode INNER JOIN
                         dbo.GradeMaster ON dbo.CBSCDEMaster.GradeCode = dbo.GradeMaster.GradeCode INNER JOIN
                         dbo.StudInfo ON dbo.StudentExamTermDEntryCBSC.RegID = dbo.StudInfo.RegID INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode
WHERE        (dbo.CBSCDETitleGroupMaster.DeleteFlag = 0)
GO
/****** Object:  View [dbo].[ExcelBoardFormStudentReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelBoardFormStudentReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.StudentID, 
                      CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
                       CASE StudInfoAll.LastNameE WHEN '-' THEN StudInfoAll.FirstnameE + ' ' + StudInfoAll.MiddleNameE ELSE StudInfoAll.FirstnameE + ' ' + StudInfoAll.MiddleNameE + ' ' + StudInfoAll.LastNameE END AS
                       StudentNameE, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.StudInfoAll.MotherName, dbo.StudInfoAll.MotherNameE, dbo.StudInfoAll.LocalAddress, dbo.StudInfoAll.MobileNo1, dbo.StudInfoAll.MobileNo2, 
                      dbo.CityMaster.CityName AS BirthPlace, dbo.StudInfoAll.Dob, dbo.StudInfoAll.DobInWord, dbo.StudInfoAll.AadharNo, dbo.GenderMaster.GenderName AS Gender, dbo.ReligionMaster.ReligionName, 
                      dbo.CasteMaster.CasteName, CategoryMaster_1.CategoryName, dbo.HandyCapMaster.HandyCapName, dbo.BankMaster.BankName, dbo.StudInfoAll.Branch, dbo.StudInfoAll.BankAcNo, 
                      dbo.BankMaster.IFSCCode, dbo.StudInfoAll.BankAPersonName, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.EntryFrom, 
                      dbo.StudInfoAll.AdmissionType, dbo.StudInfoAll.GenderCode, dbo.StudInfoAll.ClassCode, dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo
FROM         dbo.MainClassMaster INNER JOIN
                      dbo.CategoryMaster AS CategoryMaster_1 INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.BankMaster ON dbo.StudInfoAll.BankCode = dbo.BankMaster.BankCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode ON CategoryMaster_1.CategoryCode = dbo.StudInfoAll.CategoryCode INNER JOIN
                      dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode ON dbo.MainClassMaster.MainClassCode = dbo.StudInfoAll.MainClassCode INNER JOIN
                      dbo.CityMaster ON dbo.StudInfoAll.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                      dbo.HandyCapMaster ON dbo.StudInfoAll.HandyCapCode = dbo.HandyCapMaster.HandyCapCode
WHERE     (dbo.StudInfoAll.DeleteFlag = N'N')
ORDER BY dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegNo
GO
/****** Object:  View [dbo].[ExcelEIAadharCardNo]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEIAadharCardNo]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.AadharNo, 
                      dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AdmissionType, dbo.GenderMaster.GenderName AS Gender, 
                      dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode
WHERE     (dbo.StudInfoAll.CloseFlag = N'N') AND (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEIBloodGroup]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEIBloodGroup]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.BloodGroup, 
                      dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, dbo.GenderMaster.GenderName AS Gender, dbo.StudInfoAll.DeleteFlag, 
                      dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfoAll.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode
WHERE     (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEIFeeType]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEIFeeType]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.FeeTypeMaster.FeeTypeName, 
                      dbo.StudInfoAll.AdmissionType, dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, dbo.GenderMaster.GenderName AS Gender, 
                      dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfoAll.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode
WHERE     (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEIHeightWeight]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEIHeightWeight]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.WeightFT, 
                      dbo.StudInfoAll.WeightST, dbo.StudInfoAll.HeightFT, dbo.StudInfoAll.HeightST, dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, 
                      dbo.StudInfoAll.AdmissionType, dbo.GenderMaster.GenderName AS Gender, dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode
WHERE     (dbo.StudInfoAll.CloseFlag = N'N') AND (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEIMobileNo]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEIMobileNo]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.MobileNo1, 
                      dbo.StudInfoAll.MobileNo2, dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AdmissionType, 
                      dbo.GenderMaster.GenderName AS Gender, dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode
WHERE     (dbo.StudInfoAll.CloseFlag = N'N') AND (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEINationalCode]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEINationalCode]
AS
SELECT TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, 
                  dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.NationalCode AS PENNo, dbo.StudInfoAll.ApaarID, dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, 
                  dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AdmissionType, dbo.GenderMaster.GenderName AS Gender, dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student
FROM     dbo.GenderMaster INNER JOIN
                  dbo.StudInfoAll INNER JOIN
                  dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                  dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                  dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                  dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode
WHERE  (dbo.StudInfoAll.CloseFlag = N'N') AND (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEIOpeningBalance]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEIOpeningBalance]
AS
SELECT TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, 
                  dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoYearly.OpeningBalance, dbo.StudInfoAll.AdmissionType, dbo.StudInfoAll.EntryFrom, 
                  dbo.GenderMaster.GenderShort, dbo.StudInfoYearly.AyCode, dbo.StudInfoAll.CloseFlag, dbo.GenderMaster.GenderName AS Gender, dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student
FROM     dbo.FeeTypeMaster INNER JOIN
                  dbo.StudInfoAll INNER JOIN
                  dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                  dbo.StudInfoYearly ON dbo.StudInfoAll.RegID = dbo.StudInfoYearly.RegID AND dbo.StudInfoAll.MainClassCode = dbo.StudInfoYearly.MainClassCode INNER JOIN
                  dbo.MainClassMaster ON dbo.StudInfoYearly.MainClassCode = dbo.MainClassMaster.MainClassCode ON dbo.FeeTypeMaster.FeeTypeCode = dbo.StudInfoYearly.FeeTypeCode INNER JOIN
                  dbo.ClassMaster ON dbo.StudInfoYearly.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                  dbo.DivisionMaster ON dbo.StudInfoYearly.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                  dbo.MediumMaster ON dbo.StudInfoYearly.MediumCode = dbo.MediumMaster.MediumCode
WHERE  (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEIRegNo]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEIRegNo]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.RegNo AS NewRegNo, 
                      dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AdmissionType, dbo.GenderMaster.GenderName AS Gender, 
                      dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode
WHERE     (dbo.StudInfoAll.CloseFlag = N'N') AND (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEIRollNo]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEIRollNo]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.RollNo, 
                      dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AdmissionType, dbo.GenderMaster.GenderName AS Gender, 
                      dbo.StudInfoAll.DeleteFlag, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode
WHERE     (dbo.StudInfoAll.CloseFlag = N'N') AND (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
ORDER BY dbo.StudInfoAll.RollNo
GO
/****** Object:  View [dbo].[ExcelEIScholarshipInfoUpdate]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEIScholarshipInfoUpdate]
AS
SELECT TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, 
                  dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.AdmissionType, dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, 
                  dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.FirstnameE, dbo.StudInfoAll.MiddleNameE, dbo.StudInfoAll.LastNameE, dbo.StudInfoAll.MotherName, dbo.StudInfoAll.MotherNameE, dbo.CasteMaster.CasteName, 
                  dbo.CasteMaster.CasteNameEN, dbo.OccupationMaster.OccupationName AS FOccupation, dbo.OccupationMaster.OccupationNameEN AS FOccupationEN, dbo.CategoryMaster.CategoryName, dbo.BankMaster.BankName, 
                  dbo.StudInfoAll.BankAcNo, dbo.BankMaster.IFSCCode, dbo.GenderMaster.GenderName AS Gender, dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student
FROM     dbo.GenderMaster INNER JOIN
                  dbo.StudInfoAll INNER JOIN
                  dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                  dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                  dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                  dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                  dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                  dbo.OccupationMaster ON dbo.StudInfoAll.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                  dbo.CategoryMaster ON dbo.StudInfoAll.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                  dbo.BankMaster ON dbo.StudInfoAll.BankCode = dbo.BankMaster.BankCode
WHERE  (dbo.StudInfoAll.CloseFlag = N'N') AND (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEISchoolFees]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEISchoolFees]
AS
SELECT TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, 
                  dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoYearly.SchoolFees, dbo.StudInfoYearly.DiscountFees, dbo.StudInfoYearly.FinalFees, dbo.StudInfoAll.AdmissionType, 
                  dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfoYearly.AyCode, dbo.StudInfoAll.CloseFlag, dbo.GenderMaster.GenderName AS Gender, dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student
FROM     dbo.FeeTypeMaster INNER JOIN
                  dbo.StudInfoAll INNER JOIN
                  dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                  dbo.StudInfoYearly ON dbo.StudInfoAll.RegID = dbo.StudInfoYearly.RegID AND dbo.StudInfoAll.MainClassCode = dbo.StudInfoYearly.MainClassCode INNER JOIN
                  dbo.MainClassMaster ON dbo.StudInfoYearly.MainClassCode = dbo.MainClassMaster.MainClassCode ON dbo.FeeTypeMaster.FeeTypeCode = dbo.StudInfoYearly.FeeTypeCode INNER JOIN
                  dbo.ClassMaster ON dbo.StudInfoYearly.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                  dbo.DivisionMaster ON dbo.StudInfoYearly.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                  dbo.MediumMaster ON dbo.StudInfoYearly.MediumCode = dbo.MediumMaster.MediumCode
WHERE  (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEISeatNo]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEISeatNo]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.SeatNo, 
                      dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AdmissionType, dbo.GenderMaster.GenderName AS Gender, 
                      dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode
WHERE     (dbo.StudInfoAll.CloseFlag = N'N') AND (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEIStudentAllInfo]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEIStudentAllInfo]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.PermanentAddress, 
                      CityMaster_1.CityName AS PerCity, dbo.StudInfoAll.LocalAddress, CityMaster_2.CityName AS LocCity, dbo.AreaMaster.AreaName, dbo.StudInfoAll.MobileNo1, dbo.StudInfoAll.MobileNo2, 
                      dbo.StudInfoAll.FatherName, dbo.EducationMaster.EducationName AS FEducation, dbo.OccupationMaster.OccupationName AS FOccupation, dbo.StudInfoAll.FAnnualIncome, 
                      dbo.StudInfoAll.MotherName, EducationMaster_1.EducationName AS MEducation, OccupationMaster_1.OccupationName AS MOccupation, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.CloseFlag, 
                      dbo.StudInfoAll.AdmissionType, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderName AS Gender, dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.CityMaster ON dbo.StudInfoAll.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                      dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                      dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                      dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                      dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.LanguageMaster ON dbo.StudInfoAll.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                      dbo.OtherSchoolMaster ON dbo.StudInfoAll.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfoAll.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfoAll.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                      dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfoAll.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.EducationMaster ON dbo.StudInfoAll.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                      dbo.OccupationMaster ON dbo.StudInfoAll.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                      dbo.RelationMaster ON dbo.StudInfoAll.RelationCode = dbo.RelationMaster.RelationCode INNER JOIN
                      dbo.CategoryMaster ON dbo.StudInfoAll.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfoAll.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.CityMaster AS CityMaster_1 ON dbo.StudInfoAll.PerCitycode = CityMaster_1.CityCode INNER JOIN
                      dbo.CityMaster AS CityMaster_2 ON dbo.StudInfoAll.LocCitycode = CityMaster_2.CityCode INNER JOIN
                      dbo.AreaMaster ON dbo.StudInfoAll.AreaCode = dbo.AreaMaster.AreaCode INNER JOIN
                      dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfoAll.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
                      dbo.TCSLRMaster ON dbo.StudInfoAll.PSLeaveReasonCode = dbo.TCSLRMaster.TCSLRCode INNER JOIN
                      dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfoAll.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                      dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfoAll.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
                      dbo.BankMaster ON dbo.StudInfoAll.BankCode = dbo.BankMaster.BankCode
WHERE     (dbo.StudInfoAll.CloseFlag = N'N') AND (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEIStudentEnglishInfo]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEIStudentEnglishInfo]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.MotherName, 
                      dbo.StudInfoAll.FirstnameE, dbo.StudInfoAll.MiddleNameE, dbo.StudInfoAll.LastNameE, dbo.StudInfoAll.MotherNameE, dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, 
                      dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AdmissionType, dbo.GenderMaster.GenderName AS Gender, dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode
WHERE     (dbo.StudInfoAll.CloseFlag = N'N') AND (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEIStudentID]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEIStudentID]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.StudentID, 
                      dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AdmissionType, dbo.GenderMaster.GenderName AS Gender, 
                      dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode
WHERE     (dbo.StudInfoAll.CloseFlag = N'N') AND (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEIStudentPENNo]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEIStudentPENNo]
AS
SELECT        TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                         dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.ApaarID, dbo.StudInfoAll.StudentNameAadhar, 
                         dbo.StudInfoAll.AadharVerifiedFlag, dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AdmissionType, dbo.GenderMaster.GenderName AS Gender, 
                         dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                         CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student
FROM            dbo.GenderMaster INNER JOIN
                         dbo.StudInfoAll INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode
WHERE        (dbo.StudInfoAll.CloseFlag = N'N') AND (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEITCPrintingInfo]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEITCPrintingInfo]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.MotherName, 
                      dbo.StudInfoAll.StudentID, dbo.StudInfoAll.AadharNo, dbo.CityMaster.CityName AS BirthPlace, dbo.TalukaMaster.TalukaName, dbo.DistrictMaster.DistrictName, dbo.CasteMaster.CasteName, 
                      dbo.StudInfoAll.SubCast, dbo.CategoryMaster.CategoryName, dbo.ReligionMaster.ReligionName, dbo.LanguageMaster.LanguageName AS MotherTounge, 
                      dbo.OtherSchoolMaster.OtherSchoolName AS PrevSchool, ClassMaster_2.ClassName AS PSClass, dbo.OtherSchoolMaster.UDIESNo AS PSUDIESNo, ClassMaster_3.ClassName AS AdmiTimeClass, 
                      DivisionMaster_1.DivisionName AS AdmiTimeDiv, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AdmissionType, dbo.StudInfoAll.EntryFrom, 
                      dbo.GenderMaster.GenderName AS Gender, dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.CityMaster ON dbo.StudInfoAll.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                      dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                      dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.LanguageMaster ON dbo.StudInfoAll.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                      dbo.OtherSchoolMaster ON dbo.StudInfoAll.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfoAll.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfoAll.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                      dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfoAll.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.CategoryMaster ON dbo.StudInfoAll.CategoryCode = dbo.CategoryMaster.CategoryCode
WHERE     (dbo.StudInfoAll.EntryFrom = N'A') AND (dbo.StudInfoAll.CloseFlag = N'N') AND (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEITCReceivePerson]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEITCReceivePerson]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.TCPrintAll.TCCode, dbo.TCPrintAll.TCNo, 
                      dbo.TCPrintAll.TCRPersonName, dbo.TCPrintAll.TCRPersonRelation, dbo.StudInfoAll.AyCode, dbo.GenderMaster.GenderName AS Gender, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.DeleteFlag, 
                      dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.TCPrintAll ON dbo.StudInfoAll.RegID = dbo.TCPrintAll.RegID
WHERE     (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelEmpInformationReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEmpInformationReport]
AS
SELECT        TOP (100) PERCENT dbo.EmpMaster.TID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.EmpMaster.RecordNo, dbo.EmpTypeMaster.EmpTypeName AS EmpType, dbo.EmpMaster.SrNo, dbo.EmpMaster.ScaleOfPay, 
                         dbo.EmpMaster.Firstname, dbo.EmpMaster.MiddleName, dbo.EmpMaster.LastName, dbo.EmpMaster.FirstnameEN, dbo.EmpMaster.MiddleNameEN, dbo.EmpMaster.LastNameEN, dbo.EmpMaster.PermanentAddress, 
                         dbo.CityMaster.CityName AS PerCity, dbo.EmpMaster.LocalAddress, CityMaster_1.CityName AS LocCity, dbo.EmpMaster.MobileNo1, dbo.EmpMaster.MobileNo2, dbo.EmpMaster.BloodGroup, dbo.CasteMaster.CasteName, 
                         dbo.CategoryMaster.CategoryName, CityMaster_2.CityName AS BirthPlace, dbo.EmpMaster.Dob, dbo.EmpMaster.TeachingSubject, dbo.EmpMaster.TeachingClass, dbo.EmpMaster.PassingYear, dbo.EmpMaster.VMANoandDate, 
                         dbo.EmpMaster.DoWS, dbo.DesignationMaster.DesignationName, dbo.BankMaster.BankName, dbo.EmpMaster.BranchName, dbo.BankMaster.IFSCCode, dbo.EmpMaster.BankAcNo, dbo.EmpMaster.AdharCardNo, 
                         dbo.EmpMaster.ShalarthID, dbo.EmpMaster.GPFOrDCPSNo, dbo.EmpMaster.PanNo, dbo.EmpMaster.LICNo, dbo.EmpMaster.SQualification, dbo.EmpMaster.BQualification, dbo.ReligionMaster.ReligionName, 
                         dbo.GenderMaster.GenderName, dbo.EmpMaster.JoiningDate
FROM            dbo.CityMaster INNER JOIN
                         dbo.EmpMaster INNER JOIN
                         dbo.EmpTypeMaster ON dbo.EmpMaster.EmpTypeCode = dbo.EmpTypeMaster.EmpTypeCode INNER JOIN
                         dbo.DesignationMaster ON dbo.EmpMaster.DesignationCode = dbo.DesignationMaster.DesignationCode INNER JOIN
                         dbo.MainClassMaster ON dbo.EmpMaster.MainClassCode = dbo.MainClassMaster.MainClassCode ON dbo.CityMaster.CityCode = dbo.EmpMaster.PerCitycode INNER JOIN
                         dbo.CityMaster AS CityMaster_1 ON dbo.EmpMaster.LocCitycode = CityMaster_1.CityCode INNER JOIN
                         dbo.CasteMaster ON dbo.EmpMaster.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                         dbo.CategoryMaster ON dbo.EmpMaster.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                         dbo.CityMaster AS CityMaster_2 ON dbo.EmpMaster.BirthPlaceCode = CityMaster_2.CityCode INNER JOIN
                         dbo.BankMaster ON dbo.EmpMaster.BankCode = dbo.BankMaster.BankCode INNER JOIN
                         dbo.ReligionMaster ON dbo.EmpMaster.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                         dbo.GenderMaster ON dbo.EmpMaster.GenderCode = dbo.GenderMaster.GenderCode
WHERE        (dbo.EmpMaster.DeleteFlag = 0)
GO
/****** Object:  View [dbo].[ExcelEmpMonthlySalaryReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelEmpMonthlySalaryReport]
AS
SELECT TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.EmpTypeMaster.EmpTypeName AS EmpType, dbo.EmpMonthlySalaryDetail.SrNo, dbo.EmpMonthlySalary.TMDate, dbo.EmpMonthlySalary.ReportName, 
                  dbo.EmpMaster.Firstname + ' ' + dbo.EmpMaster.MiddleName + ' ' + dbo.EmpMaster.LastName AS EmployeeName, 
                  dbo.EmpMaster.FirstnameEN + ' ' + dbo.EmpMaster.MiddleNameEN + ' ' + dbo.EmpMaster.LastNameEN AS EmployeeNameEN, dbo.EmpMonthlySalaryDetail.PayMatrix, dbo.EmpMonthlySalaryDetail.DA, 
                  dbo.EmpMonthlySalaryDetail.NPSEmpRAllow, dbo.EmpMonthlySalaryDetail.HRA + dbo.EmpMonthlySalaryDetail.HRADiff AS HRA, dbo.EmpMonthlySalaryDetail.CLA, dbo.EmpMonthlySalaryDetail.TA, dbo.EmpMonthlySalaryDetail.DAArr, 
                  dbo.EmpMonthlySalaryDetail.OtherAdd, dbo.EmpMonthlySalaryDetail.TotalAdd, dbo.EmpMonthlySalaryDetail.RecoveryAdjusted AS RecAdj, dbo.EmpMonthlySalaryDetail.NetClaim AS GrossClaim, 
                  dbo.EmpMonthlySalaryDetail.GPFRegular, dbo.EmpMonthlySalaryDetail.GPFLoan, dbo.EmpMonthlySalaryDetail.NPSEmpRContri, dbo.EmpMonthlySalaryDetail.NPSEmpContri, dbo.EmpMonthlySalaryDetail.DCPSRegular, 
                  dbo.EmpMonthlySalaryDetail.DCPSDelayed, dbo.EmpMonthlySalaryDetail.PT, dbo.EmpMonthlySalaryDetail.AccidintalPolicy, dbo.EmpMonthlySalaryDetail.RevStamp, dbo.EmpMonthlySalaryDetail.IncomeTax, 
                  dbo.EmpMonthlySalaryDetail.RD, dbo.EmpMonthlySalaryDetail.LIC, dbo.EmpMonthlySalaryDetail.GLIC, dbo.EmpMonthlySalaryDetail.Society, dbo.EmpMonthlySalaryDetail.BankLoan, dbo.EmpMonthlySalaryDetail.OtherDed, 
                  dbo.EmpMonthlySalaryDetail.BankLoan + dbo.EmpMonthlySalaryDetail.BankLoan1 + dbo.EmpMonthlySalaryDetail.BankLoan2 AS BankLoanTotal, dbo.EmpMonthlySalaryDetail.TotalDed, dbo.EmpMonthlySalaryDetail.NetClaimFinal, 
                  dbo.EmpMonthlySalary.FyCode, dbo.EmpMonthlySalaryDetail.PayMatrixArr
FROM     dbo.EmpMonthlySalaryDetail INNER JOIN
                  dbo.EmpMaster ON dbo.EmpMonthlySalaryDetail.EmpTID = dbo.EmpMaster.TID INNER JOIN
                  dbo.EmpMonthlySalary ON dbo.EmpMonthlySalaryDetail.TID = dbo.EmpMonthlySalary.TID INNER JOIN
                  dbo.EmpTypeMaster ON dbo.EmpMonthlySalary.EmpTypeCode = dbo.EmpTypeMaster.EmpTypeCode INNER JOIN
                  dbo.MainClassMaster ON dbo.EmpMonthlySalary.MainClassCode = dbo.MainClassMaster.MainClassCode
ORDER BY dbo.EmpMonthlySalaryDetail.SrNo, dbo.EmpMonthlySalary.TMDate
GO
/****** Object:  View [dbo].[ExcelMonthlySalaryDetails]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelMonthlySalaryDetails]
AS
SELECT TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.EmpTypeMaster.EmpTypeName AS EmpType, dbo.EmpMonthlySalary.TMDate, dbo.EmpMonthlySalary.ReportName, SUM(dbo.EmpMonthlySalaryDetail.DA) 
                  AS DA, SUM(dbo.EmpMonthlySalaryDetail.NPSEmpRAllow) AS NPSEmpRAllow, SUM(dbo.EmpMonthlySalaryDetail.HRA + dbo.EmpMonthlySalaryDetail.HRADiff) AS HRA, SUM(dbo.EmpMonthlySalaryDetail.CLA) AS CLA, 
                  SUM(dbo.EmpMonthlySalaryDetail.TA) AS TA, SUM(dbo.EmpMonthlySalaryDetail.DAArr) AS DAArr, SUM(dbo.EmpMonthlySalaryDetail.OtherAdd) AS OtherAdd, SUM(dbo.EmpMonthlySalaryDetail.TotalAdd) AS TotalAdd, 
                  SUM(dbo.EmpMonthlySalaryDetail.RecoveryAdjusted) AS RecoveryAdjusted, SUM(dbo.EmpMonthlySalaryDetail.NetClaim) AS NetClaim, SUM(dbo.EmpMonthlySalaryDetail.GPFRegular) AS GPFRegular, 
                  SUM(dbo.EmpMonthlySalaryDetail.GPFLoan) AS GPFLoan, SUM(dbo.EmpMonthlySalaryDetail.DCPSRegular) AS DCPSRegular, SUM(dbo.EmpMonthlySalaryDetail.DCPSDelayed) AS DCPSDelayed, SUM(dbo.EmpMonthlySalaryDetail.PT) 
                  AS PT, SUM(dbo.EmpMonthlySalaryDetail.AccidintalPolicy) AS AccidintalPolicy, SUM(dbo.EmpMonthlySalaryDetail.RevStamp) AS RevStamp, SUM(dbo.EmpMonthlySalaryDetail.NPSEmpRContri) AS NPSEmpRContri, 
                  SUM(dbo.EmpMonthlySalaryDetail.NPSEmpContri) AS NPSEmpContri, SUM(dbo.EmpMonthlySalaryDetail.IncomeTax) AS IncomeTax, SUM(dbo.EmpMonthlySalaryDetail.RD) AS RD, SUM(dbo.EmpMonthlySalaryDetail.LIC) AS LIC, 
                  SUM(dbo.EmpMonthlySalaryDetail.GLIC) AS GLIC, SUM(dbo.EmpMonthlySalaryDetail.Society1) AS Society1, SUM(dbo.EmpMonthlySalaryDetail.Society2) AS Society2, SUM(dbo.EmpMonthlySalaryDetail.Society3) AS Society3, 
                  SUM(dbo.EmpMonthlySalaryDetail.Society) AS Society, SUM(dbo.EmpMonthlySalaryDetail.BankLoan) AS BankLoan, SUM(dbo.EmpMonthlySalaryDetail.BankLoan1) AS BankLoan1, SUM(dbo.EmpMonthlySalaryDetail.BankLoan2) 
                  AS BankLoan2, SUM(dbo.EmpMonthlySalaryDetail.OtherDed) AS OtherDed, SUM(dbo.EmpMonthlySalaryDetail.TotalDedOnline) AS TotalDedOnline, SUM(dbo.EmpMonthlySalaryDetail.NetPayable) AS NetPayable, 
                  SUM(dbo.EmpMonthlySalaryDetail.TotalDed) AS TotalDed, SUM(dbo.EmpMonthlySalaryDetail.NetClaimFinal) AS NetClaimFinal, dbo.EmpMonthlySalary.GrossAmount, dbo.EmpMonthlySalary.NetPayableAmount, 
                  dbo.EmpMonthlySalary.FyCode, SUM(dbo.EmpMonthlySalaryDetail.PayMatrixArr) AS PayMatrixArr
FROM     dbo.EmpMonthlySalaryDetail INNER JOIN
                  dbo.EmpMonthlySalary ON dbo.EmpMonthlySalaryDetail.TID = dbo.EmpMonthlySalary.TID INNER JOIN
                  dbo.MainClassMaster ON dbo.EmpMonthlySalary.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                  dbo.EmpTypeMaster ON dbo.EmpMonthlySalary.EmpTypeCode = dbo.EmpTypeMaster.EmpTypeCode
WHERE  (dbo.EmpMonthlySalaryDetail.PayMatrix > 0)
GROUP BY dbo.MainClassMaster.MainClassName, dbo.EmpTypeMaster.EmpTypeName, dbo.EmpMonthlySalary.TMDate, dbo.EmpMonthlySalary.ReportName, dbo.EmpMonthlySalary.GrossAmount, dbo.EmpMonthlySalary.NetPayableAmount, 
                  dbo.EmpMonthlySalary.FyCode
ORDER BY dbo.EmpMonthlySalary.TMDate
GO
/****** Object:  View [dbo].[ExcelNationalAchievementSurveyReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelNationalAchievementSurveyReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, dbo.GenderMaster.GenderShort, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.StudInfo.AadharNo, dbo.GenderMaster.GenderName AS Gender, CONVERT(varchar, dbo.StudInfo.Dob, 106) AS DOB, dbo.CategoryMaster.CategoryName, 
                      dbo.HandyCapMaster.HandyCapName, '-' AS Remark, dbo.StudInfo.EntryFrom, dbo.StudInfo.AyCode, dbo.StudInfo.CloseFlag, dbo.StudInfo.AdmissionType, dbo.StudInfo.ClassCode, 
                      dbo.StudInfo.DeleteFlag, dbo.StudInfo.RollNo
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                      dbo.CityMaster ON dbo.StudInfo.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                      dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                      dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                      dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                      dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.CategoryMaster ON dbo.StudInfo.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                      dbo.HandyCapMaster ON dbo.StudInfo.HandyCapCode = dbo.HandyCapMaster.HandyCapCode
WHERE     (dbo.StudInfo.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelNewAdmissionEnquiryReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelNewAdmissionEnquiryReport]
AS
SELECT        TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, CONVERT(varchar, 
                         dbo.StudInfo.AdmittionDate, 106) AS EnquiryDate, dbo.StudInfo.RegNo, dbo.StudInfo.RollNo, dbo.StudInfo.StudentID, dbo.StudInfo.AadharNo, 
                         CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END AS StudentName, 
                         CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END AS Student, 
                         dbo.GenderMaster.GenderName AS Gender, dbo.StudInfo.MotherName, dbo.ReligionMaster.ReligionName, dbo.CasteMaster.CasteName, dbo.CategoryMaster.CategoryName, CONVERT(varchar, dbo.StudInfo.Dob, 106) AS DOB, 
                         dbo.OtherSchoolMaster.OtherSchoolName AS PrevSchool, dbo.EducationMaster.EducationName AS FEducation, dbo.OccupationMaster.OccupationName AS FOccupation, EducationMaster_1.EducationName AS MEducation, 
                         OccupationMaster_1.OccupationName AS MOccupation, dbo.CityMaster.CityName AS BirthPlace, dbo.TalukaMaster.TalukaName, dbo.DistrictMaster.DistrictName, dbo.StateMaster.StateName, dbo.StudInfo.FAnnualIncome, 
                         dbo.StudInfo.LocalAddress, dbo.StudInfo.MobileNo1, dbo.StudInfo.MobileNo2, dbo.GenderMaster.GenderShort, dbo.StudInfo.AyCode, dbo.StudInfo.EntryFrom, dbo.StudInfo.CloseFlag, dbo.StudInfo.AdmissionType, 
                         dbo.StudInfo.ClassCode, dbo.StudInfo.DeleteFlag
FROM            dbo.GenderMaster INNER JOIN
                         dbo.StudInfo INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                         dbo.CityMaster ON dbo.StudInfo.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                         dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                         dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                         dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                         dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                         dbo.CasteMaster ON dbo.StudInfo.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                         dbo.ReligionMaster ON dbo.StudInfo.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                         dbo.LanguageMaster ON dbo.StudInfo.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                         dbo.OtherSchoolMaster ON dbo.StudInfo.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                         dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfo.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                         dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfo.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                         dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfo.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.EducationMaster ON dbo.StudInfo.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                         dbo.OccupationMaster ON dbo.StudInfo.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                         dbo.RelationMaster ON dbo.StudInfo.RelationCode = dbo.RelationMaster.RelationCode INNER JOIN
                         dbo.CategoryMaster ON dbo.StudInfo.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                         dbo.FeeTypeMaster ON dbo.StudInfo.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                         dbo.CityMaster AS CityMaster_1 ON dbo.StudInfo.PerCitycode = CityMaster_1.CityCode INNER JOIN
                         dbo.CityMaster AS CityMaster_2 ON dbo.StudInfo.LocCitycode = CityMaster_2.CityCode INNER JOIN
                         dbo.AreaMaster ON dbo.StudInfo.AreaCode = dbo.AreaMaster.AreaCode INNER JOIN
                         dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfo.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
                         dbo.TCSLRMaster ON dbo.StudInfo.PSLeaveReasonCode = dbo.TCSLRMaster.TCSLRCode INNER JOIN
                         dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfo.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                         dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfo.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
                         dbo.BankMaster ON dbo.StudInfo.BankCode = dbo.BankMaster.BankCode
WHERE        (dbo.StudInfo.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelNewAdmissionReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelNewAdmissionReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, dbo.StudInfo.StudentID, dbo.StudInfo.AadharNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.GenderMaster.GenderName AS Gender, dbo.StudInfo.MotherName, dbo.ReligionMaster.ReligionName, dbo.CasteMaster.CasteName, dbo.CategoryMaster.CategoryName, 
                      dbo.CityMaster.CityName AS BirthPlace, CONVERT(varchar, dbo.StudInfo.Dob, 106) AS DOB, dbo.OtherSchoolMaster.OtherSchoolName AS PrevSchool, 
                      dbo.OtherSchoolMaster.UDIESNo AS PSUDIESNo, dbo.StudInfo.LocalAddress, dbo.StudInfo.MobileNo1, CONVERT(varchar, dbo.StudInfo.AdmittionDate, 106) AS AdmiDate, dbo.StudInfo.MobileNo2, 
                      dbo.GenderMaster.GenderShort, dbo.StudInfo.EntryFrom, dbo.StudInfo.AyCode, dbo.StudInfo.CloseFlag, dbo.StudInfo.AdmissionType, dbo.StudInfo.ClassCode, dbo.StudInfo.DeleteFlag, 
                      dbo.StudInfo.RollNo
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                      dbo.CityMaster ON dbo.StudInfo.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                      dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                      dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                      dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                      dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfo.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.ReligionMaster ON dbo.StudInfo.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.LanguageMaster ON dbo.StudInfo.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                      dbo.OtherSchoolMaster ON dbo.StudInfo.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfo.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfo.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                      dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfo.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.EducationMaster ON dbo.StudInfo.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                      dbo.OccupationMaster ON dbo.StudInfo.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                      dbo.RelationMaster ON dbo.StudInfo.RelationCode = dbo.RelationMaster.RelationCode INNER JOIN
                      dbo.CategoryMaster ON dbo.StudInfo.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfo.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.CityMaster AS CityMaster_1 ON dbo.StudInfo.PerCitycode = CityMaster_1.CityCode INNER JOIN
                      dbo.CityMaster AS CityMaster_2 ON dbo.StudInfo.LocCitycode = CityMaster_2.CityCode INNER JOIN
                      dbo.AreaMaster ON dbo.StudInfo.AreaCode = dbo.AreaMaster.AreaCode INNER JOIN
                      dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfo.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
                      dbo.TCSLRMaster ON dbo.StudInfo.PSLeaveReasonCode = dbo.TCSLRMaster.TCSLRCode INNER JOIN
                      dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfo.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                      dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfo.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
                      dbo.BankMaster ON dbo.StudInfo.BankCode = dbo.BankMaster.BankCode
WHERE     (dbo.StudInfo.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelNewSchoolImportStudentDataReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelNewSchoolImportStudentDataReport]
AS
SELECT dbo.StudInfoAll.RegID, dbo.StudInfoAll.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.MediumCode, dbo.MediumMaster.MediumName, dbo.StudInfoAll.AyCode, 
                  dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.StudDisplayFlag, dbo.StudInfoAll.EntryFrom, dbo.StudInfoAll.FeesPaidFlag, dbo.StudInfoAll.MarksFeedFlag, dbo.StudInfoAll.AdmissionType, CONVERT(varchar, dbo.StudInfoAll.AdmittionDate, 
                  106) AS AdmittionDate, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.ClassCode, dbo.ClassMaster.ClassName AS Class, dbo.StudInfoAll.DivisionCode, 
                  dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.GenderCode, dbo.GenderMaster.GenderName AS Gender, dbo.StudInfoAll.StudentID, dbo.StudInfoAll.AadharNo, dbo.StudInfoAll.Photpath, dbo.StudInfoAll.RollNo, 
                  dbo.StudInfoAll.FormNo, dbo.StudInfoAll.FeeTypeCode, dbo.FeeTypeMaster.FeeTypeName, dbo.StudInfoAll.PermanentAddress, dbo.StudInfoAll.PerCitycode, dbo.CityMaster.CityName AS PerCityName, dbo.StudInfoAll.LocalAddress, 
                  dbo.StudInfoAll.LocCitycode, CityMaster_1.CityName AS LocCityName, dbo.StudInfoAll.AreaCode, dbo.AreaMaster.AreaName, dbo.StudInfoAll.MobileNo1, dbo.StudInfoAll.MobileNo2, dbo.StudInfoAll.Dob, dbo.StudInfoAll.BirthPlaceCode, 
                  CityMaster_2.CityName AS BirthPlaceCity, CityMaster_2.TalukaCode, dbo.TalukaMaster.TalukaName, dbo.TalukaMaster.DistrictCode, dbo.DistrictMaster.DistrictName, dbo.StudInfoAll.BloodGroup, dbo.StudInfoAll.CastCode, 
                  dbo.CasteMaster.CasteName, dbo.CasteMaster.CasteNameEN, dbo.StudInfoAll.SubCast, dbo.StudInfoAll.ReligionCode, dbo.ReligionMaster.ReligionName, dbo.StudInfoAll.MotherTongueCode, 
                  dbo.LanguageMaster.LanguageName AS MotherTongue, dbo.StudInfoAll.LanguageKnownCode, LanguageMaster_1.LanguageName AS LanguageKnown, dbo.StudInfoAll.CategoryCode, dbo.CategoryMaster.CategoryName, 
                  dbo.StudInfoAll.PSCode, dbo.OtherSchoolMaster.OtherSchoolName AS PreviousSchoolName, dbo.OtherSchoolMaster.UDIESNo, dbo.StudInfoAll.PSClassCode, ClassMaster_1.ClassName AS PSClassName, dbo.StudInfoAll.PSResult, 
                  dbo.StudInfoAll.PSRegNo, dbo.StudInfoAll.PSTCNo, dbo.StudInfoAll.PSLeaveReasonCode, dbo.TCSLRMaster.TCSLRName, dbo.StudInfoAll.FatherName, dbo.StudInfoAll.FEducationCode, 
                  dbo.EducationMaster.EducationName AS FEducationName, dbo.StudInfoAll.FOccupationCode, dbo.OccupationMaster.OccupationName AS FOccupationName, dbo.OccupationMaster.OccupationNameEN AS FOccupationNameEN, 
                  dbo.StudInfoAll.FAnnualIncome, dbo.StudInfoAll.MotherName, dbo.StudInfoAll.MEducationCode, EducationMaster_1.EducationName AS MEducationName, dbo.StudInfoAll.MCccupationCode, 
                  OccupationMaster_1.OccupationName AS MOccupationName, OccupationMaster_1.OccupationNameEN AS MOccupationNameEN, dbo.StudInfoAll.GaurdianName, dbo.StudInfoAll.RelationCode, dbo.RelationMaster.RelationName, 
                  dbo.StudInfoAll.ClassCodeAT, ClassMaster_2.ClassName AS ClassNameAT, dbo.StudInfoAll.DivisionCodeAT, DivisionMaster_1.DivisionName AS DivisionNameAT, dbo.StudInfoAll.BankCode, dbo.BankMaster.BankName, 
                  dbo.BankMaster.IFSCCode, dbo.StudInfoAll.BankAcNo, dbo.StudInfoAll.BankAPersonName, dbo.StudInfoAll.PersonalIdentMark, dbo.StudInfoAll.Age30Sept, dbo.StudInfoAll.Remark, dbo.StudInfoAll.UserCode, dbo.StudInfoAll.MargeFlag, 
                  dbo.StudInfoAll.OpeningBalance, dbo.StudInfoAll.HandyCapStatus, dbo.StudInfoAll.HandyCapCode, dbo.HandyCapMaster.HandyCapName, dbo.StudInfoAll.BPLCardStatus, dbo.StudInfoAll.PPECompleteStatus, dbo.StudInfoAll.WeightFT, 
                  dbo.StudInfoAll.WeightST, dbo.StudInfoAll.HeightFT, dbo.StudInfoAll.HeightST, dbo.StudInfoAll.SeatNo, dbo.StudInfoAll.Nationality, dbo.StudInfoAll.FirstnameE, dbo.StudInfoAll.MiddleNameE, dbo.StudInfoAll.LastNameE, 
                  dbo.StudInfoAll.AdmiSchoolType, dbo.StudInfoAll.MotherNameE, dbo.StudInfoAll.WeekPointDetail, dbo.StudInfoAll.LearningStopResion, dbo.StudInfoAll.PrePrimarySchoolName, dbo.StudInfoAll.GovermentOffer, 
                  dbo.StudInfoAll.AadharLinkBankStatus, dbo.StudInfoAll.HostelStayFlag, dbo.StudInfoAll.FAadharCardNo, dbo.StudInfoAll.FPanCard, dbo.StudInfoAll.MAnnualIncome, dbo.StudInfoAll.MAadharCardNo, dbo.StudInfoAll.MPanCard, 
                  dbo.StudInfoAll.WhatsAppMobileNo, dbo.StudInfoAll.EmailID, dbo.StudInfoAll.FacebookID, dbo.StudInfoAll.InstragramID, dbo.StudInfoAll.TwitterID, dbo.StudInfoAll.TelegramID, dbo.StudInfoAll.Branch, 
                  dbo.StudInfoAll.MotherFatherAreAlive, dbo.StudInfoAll.EWSCertificateStatus, dbo.StudInfoAll.HandyCapPercentage, dbo.StudInfoAll.BPLCardNo, 
                  CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, 
                  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student, 
                  dbo.GenderMaster.GenderShort, dbo.StudInfoAll.NationalCode, dbo.StudInfoAll.ApaarID, dbo.StudInfoAll.StudentNameAadhar, dbo.StudInfoAll.AadharVerifiedFlag
FROM     dbo.StudInfoAll INNER JOIN
                  dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                  dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                  dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                  dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                  dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                  dbo.FeeTypeMaster ON dbo.StudInfoAll.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                  dbo.CityMaster ON dbo.StudInfoAll.PerCitycode = dbo.CityMaster.CityCode INNER JOIN
                  dbo.CityMaster AS CityMaster_1 ON dbo.StudInfoAll.LocCitycode = CityMaster_1.CityCode INNER JOIN
                  dbo.AreaMaster ON dbo.StudInfoAll.AreaCode = dbo.AreaMaster.AreaCode INNER JOIN
                  dbo.CityMaster AS CityMaster_2 ON dbo.StudInfoAll.BirthPlaceCode = CityMaster_2.CityCode INNER JOIN
                  dbo.TalukaMaster ON CityMaster_2.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                  dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                  dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                  dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                  dbo.LanguageMaster ON dbo.StudInfoAll.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                  dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfoAll.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
                  dbo.CategoryMaster ON dbo.StudInfoAll.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                  dbo.RelationMaster ON dbo.StudInfoAll.RelationCode = dbo.RelationMaster.RelationCode INNER JOIN
                  dbo.OtherSchoolMaster ON dbo.StudInfoAll.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                  dbo.ClassMaster AS ClassMaster_1 ON dbo.StudInfoAll.PSClassCode = ClassMaster_1.ClassCode INNER JOIN
                  dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfoAll.ClassCodeAT = ClassMaster_2.ClassCode INNER JOIN
                  dbo.TCSLRMaster ON dbo.StudInfoAll.PSLeaveReasonCode = dbo.TCSLRMaster.TCSLRCode INNER JOIN
                  dbo.EducationMaster ON dbo.StudInfoAll.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                  dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfoAll.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                  dbo.OccupationMaster ON dbo.StudInfoAll.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                  dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfoAll.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
                  dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfoAll.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                  dbo.BankMaster ON dbo.StudInfoAll.BankCode = dbo.BankMaster.BankCode INNER JOIN
                  dbo.HandyCapMaster ON dbo.StudInfoAll.HandyCapCode = dbo.HandyCapMaster.HandyCapCode
GO
/****** Object:  View [dbo].[ExcelScholarshipStudentReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelScholarshipStudentReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.StudInfoAll.RegNo, 
                      CASE StudInfoAll.LastNameE WHEN '-' THEN StudInfoAll.FirstnameE + ' ' + StudInfoAll.MiddleNameE ELSE StudInfoAll.FirstnameE + ' ' + StudInfoAll.MiddleNameE + ' ' + StudInfoAll.LastNameE END AS
                       StudentNameE, CONVERT(varchar, dbo.StudInfoAll.AdmittionDate, 106) AS AdmittionDate, dbo.CasteMaster.CasteNameEN AS CasteEN, dbo.ClassMaster.ClassNameEN AS ClassEN, 
                      dbo.StudInfoAll.AadharNo, dbo.BankMaster.BankName, dbo.StudInfoAll.Branch, dbo.BankMaster.IFSCCode, dbo.StudInfoAll.BankAcNo, dbo.StudInfoAll.BankAPersonName, 
                      dbo.DivisionMaster.DivisionNameEN AS DivEN, CategoryMaster_1.CategoryNameEN AS CategoryEN, dbo.OccupationMaster.OccupationNameEN AS OccupationEN, 
                      dbo.StudInfoAll.AadharLinkBankStatus AS AadharLink, dbo.StudInfoAll.HostelStayFlag, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.EntryFrom, 
                      dbo.StudInfoAll.AdmissionType, dbo.StudInfoAll.GenderCode, dbo.StudInfoAll.ClassCode, dbo.StudInfoAll.CategoryCode, dbo.StudInfoAll.FOccupationCode, dbo.StudInfoAll.ReligionCode, 
                      dbo.ReligionMaster.ReligionName, dbo.GenderMaster.GenderName AS Gender, dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
                       END AS StudentName, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.MainClassMaster INNER JOIN
                      dbo.CategoryMaster AS CategoryMaster_1 INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.OccupationMaster ON dbo.StudInfoAll.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                      dbo.BankMaster ON dbo.StudInfoAll.BankCode = dbo.BankMaster.BankCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode ON CategoryMaster_1.CategoryCode = dbo.StudInfoAll.CategoryCode INNER JOIN
                      dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode ON dbo.MainClassMaster.MainClassCode = dbo.StudInfoAll.MainClassCode
WHERE     (dbo.StudInfoAll.DeleteFlag = N'N')
ORDER BY dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegNo
GO
/****** Object:  View [dbo].[ExcelStudentBankReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelStudentBankReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.OrgName, dbo.MainClassMaster.UDiesNo, dbo.MainClassMaster.CityName, dbo.MainClassMaster.CityName AS Cluster, 
                      dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.StudInfoAll.RegNo, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, 
                      CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
                       CASE StudInfoAll.LastNameE WHEN '-' THEN StudInfoAll.FirstnameE + ' ' + StudInfoAll.MiddleNameE ELSE StudInfoAll.FirstnameE + ' ' + StudInfoAll.MiddleNameE + ' ' + StudInfoAll.LastNameE END AS
                       StudentNameE, dbo.BankMaster.BankName, dbo.StudInfoAll.Branch, dbo.StudInfoAll.BankAcNo, dbo.BankMaster.IFSCCode, dbo.StudInfoAll.BankAPersonName, dbo.StudInfoAll.AadharNo, 
                      dbo.StudInfoAll.FAadharCardNo, dbo.CasteMaster.CasteName, dbo.ReligionMaster.ReligionName, CategoryMaster_1.CategoryName, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.CloseFlag, 
                      dbo.StudInfoAll.AyCode, dbo.StudInfoAll.EntryFrom, dbo.StudInfoAll.AdmissionType, dbo.StudInfoAll.GenderCode, dbo.StudInfoAll.ClassCode, dbo.GenderMaster.GenderName AS Gender, 
                      dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.MainClassMaster INNER JOIN
                      dbo.CategoryMaster AS CategoryMaster_1 INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.OccupationMaster ON dbo.StudInfoAll.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                      dbo.BankMaster ON dbo.StudInfoAll.BankCode = dbo.BankMaster.BankCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode ON CategoryMaster_1.CategoryCode = dbo.StudInfoAll.CategoryCode INNER JOIN
                      dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode ON dbo.MainClassMaster.MainClassCode = dbo.StudInfoAll.MainClassCode
WHERE     (dbo.StudInfoAll.DeleteFlag = N'N')
ORDER BY dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegNo
GO
/****** Object:  View [dbo].[ExcelStudentDetailReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelStudentDetailReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, dbo.StudInfo.StudentID, dbo.StudInfo.AadharNo, dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, 
                      dbo.GenderMaster.GenderName AS Gender, dbo.StudInfo.MotherName, dbo.ReligionMaster.ReligionName, dbo.CasteMaster.CasteName, dbo.CategoryMaster.CategoryName, CONVERT(varchar, 
                      dbo.StudInfo.AdmittionDate, 105) AS AdmiDate, CONVERT(varchar, dbo.StudInfo.Dob, 105) AS DOB, dbo.CityMaster.CityName AS BirthPlace, dbo.StudInfo.LocalAddress, dbo.StudInfo.MobileNo1, 
                      dbo.StudInfo.MobileNo2, dbo.OtherSchoolMaster.OtherSchoolName AS PrevSchool, ClassMaster_2.ClassName AS PrevSchoolClass, dbo.EducationMaster.EducationName AS FEducation, 
                      dbo.OccupationMaster.OccupationName AS FOccupation, dbo.StudInfo.FAnnualIncome, EducationMaster_1.EducationName AS MEducation, OccupationMaster_1.OccupationName AS MOccupation, 
                      dbo.BankMaster.BankName, dbo.StudInfo.Branch, dbo.StudInfo.BankAcNo, dbo.StudInfo.BankAPersonName, dbo.StudInfo.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfo.AyCode, 
                      dbo.StudInfo.CloseFlag, dbo.FeeTypeMaster.FeeTypeName, dbo.StudInfo.AdmissionType, dbo.StudInfo.ClassCode, dbo.StudInfo.DeleteFlag, dbo.StudInfo.RollNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                      dbo.CityMaster ON dbo.StudInfo.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                      dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                      dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                      dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                      dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfo.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.ReligionMaster ON dbo.StudInfo.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.LanguageMaster ON dbo.StudInfo.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                      dbo.OtherSchoolMaster ON dbo.StudInfo.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfo.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfo.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                      dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfo.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.EducationMaster ON dbo.StudInfo.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                      dbo.OccupationMaster ON dbo.StudInfo.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                      dbo.RelationMaster ON dbo.StudInfo.RelationCode = dbo.RelationMaster.RelationCode INNER JOIN
                      dbo.CategoryMaster ON dbo.StudInfo.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfo.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.CityMaster AS CityMaster_1 ON dbo.StudInfo.PerCitycode = CityMaster_1.CityCode INNER JOIN
                      dbo.CityMaster AS CityMaster_2 ON dbo.StudInfo.LocCitycode = CityMaster_2.CityCode INNER JOIN
                      dbo.AreaMaster ON dbo.StudInfo.AreaCode = dbo.AreaMaster.AreaCode INNER JOIN
                      dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfo.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
                      dbo.TCSLRMaster ON dbo.StudInfo.PSLeaveReasonCode = dbo.TCSLRMaster.TCSLRCode INNER JOIN
                      dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfo.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                      dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfo.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
                      dbo.BankMaster ON dbo.StudInfo.BankCode = dbo.BankMaster.BankCode
WHERE     (dbo.StudInfo.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelStudentDetailReportAllYear]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelStudentDetailReportAllYear]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.StudInfoAll.RegNo, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, 
                      dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.StudentID, dbo.StudInfoAll.AadharNo, 
                      dbo.GenderMaster.GenderName AS Gender, dbo.StudInfoAll.MotherName, dbo.ReligionMaster.ReligionName, dbo.CasteMaster.CasteName, dbo.CategoryMaster.CategoryName, CONVERT(varchar, 
                      dbo.StudInfoAll.AdmittionDate, 105) AS AdmiDate, CONVERT(varchar, dbo.StudInfoAll.Dob, 105) AS DOB, dbo.CityMaster.CityName AS BirthPlace, dbo.StudInfoAll.LocalAddress, 
                      dbo.StudInfoAll.MobileNo1, dbo.StudInfoAll.MobileNo2, dbo.OtherSchoolMaster.OtherSchoolName AS PrevSchool, ClassMaster_2.ClassName AS PrevSchoolClass, 
                      dbo.EducationMaster.EducationName AS FEducation, dbo.OccupationMaster.OccupationName AS FOccupation, dbo.StudInfoAll.FAnnualIncome, EducationMaster_1.EducationName AS MEducation, 
                      OccupationMaster_1.OccupationName AS MOccupation, dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, 
                      dbo.FeeTypeMaster.FeeTypeName, dbo.StudInfoAll.AdmissionType, dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.RollNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
                       END AS StudentName, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.CityMaster ON dbo.StudInfoAll.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                      dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                      dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                      dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                      dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.LanguageMaster ON dbo.StudInfoAll.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                      dbo.OtherSchoolMaster ON dbo.StudInfoAll.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfoAll.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfoAll.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                      dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfoAll.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.EducationMaster ON dbo.StudInfoAll.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                      dbo.OccupationMaster ON dbo.StudInfoAll.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                      dbo.RelationMaster ON dbo.StudInfoAll.RelationCode = dbo.RelationMaster.RelationCode INNER JOIN
                      dbo.CategoryMaster ON dbo.StudInfoAll.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfoAll.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.CityMaster AS CityMaster_1 ON dbo.StudInfoAll.PerCitycode = CityMaster_1.CityCode INNER JOIN
                      dbo.CityMaster AS CityMaster_2 ON dbo.StudInfoAll.LocCitycode = CityMaster_2.CityCode INNER JOIN
                      dbo.AreaMaster ON dbo.StudInfoAll.AreaCode = dbo.AreaMaster.AreaCode INNER JOIN
                      dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfoAll.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
                      dbo.TCSLRMaster ON dbo.StudInfoAll.PSLeaveReasonCode = dbo.TCSLRMaster.TCSLRCode INNER JOIN
                      dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfoAll.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                      dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfoAll.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
                      dbo.BankMaster ON dbo.StudInfoAll.BankCode = dbo.BankMaster.BankCode
WHERE     (dbo.StudInfoAll.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[ExcelStudentGeneralRegisterF1]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelStudentGeneralRegisterF1]
AS
SELECT        TOP (100) PERCENT dbo.StudInfoAll.RegNo, dbo.StudInfoAll.AadharNo, dbo.StudInfoAll.StudentID, 
                         CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName END AS StudentName,
                          dbo.StudInfoAll.MotherName, dbo.StudInfoAll.Nationality, dbo.LanguageMaster.LanguageName AS MotherTongue, dbo.ReligionMaster.ReligionName, dbo.CasteMaster.CasteName, dbo.StudInfoAll.SubCast, 
                         dbo.CityMaster.CityName AS BirthPlace, dbo.TalukaMaster.TalukaName, dbo.DistrictMaster.DistrictName, dbo.StateMaster.StateName, dbo.CountryMaster.CountryName, CONVERT(varchar, dbo.StudInfoAll.Dob, 105) AS DOB, 
                         dbo.StudInfoAll.DobInWord, dbo.OtherSchoolMaster.OtherSchoolName AS PrevSchool, ClassMaster_2.ClassName AS PrevSchoolClass, CONVERT(varchar, dbo.StudInfoAll.AdmittionDate, 105) AS AdmiDate, 
                         dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.GenderMaster.GenderName AS Gender, dbo.MainClassMaster.MainClassName AS MainClass, 
                         dbo.MediumMaster.MediumName AS Medium, dbo.StudInfoAll.EntryFrom, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.AdmittionDate
FROM            dbo.GenderMaster INNER JOIN
                         dbo.StudInfoAll INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                         dbo.CityMaster ON dbo.StudInfoAll.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                         dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                         dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                         dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                         dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                         dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                         dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                         dbo.LanguageMaster ON dbo.StudInfoAll.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                         dbo.OtherSchoolMaster ON dbo.StudInfoAll.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                         dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfoAll.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                         dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfoAll.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                         dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfoAll.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.EducationMaster ON dbo.StudInfoAll.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                         dbo.OccupationMaster ON dbo.StudInfoAll.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                         dbo.RelationMaster ON dbo.StudInfoAll.RelationCode = dbo.RelationMaster.RelationCode INNER JOIN
                         dbo.CategoryMaster ON dbo.StudInfoAll.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                         dbo.FeeTypeMaster ON dbo.StudInfoAll.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                         dbo.CityMaster AS CityMaster_1 ON dbo.StudInfoAll.PerCitycode = CityMaster_1.CityCode INNER JOIN
                         dbo.CityMaster AS CityMaster_2 ON dbo.StudInfoAll.LocCitycode = CityMaster_2.CityCode INNER JOIN
                         dbo.AreaMaster ON dbo.StudInfoAll.AreaCode = dbo.AreaMaster.AreaCode INNER JOIN
                         dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfoAll.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
                         dbo.TCSLRMaster ON dbo.StudInfoAll.PSLeaveReasonCode = dbo.TCSLRMaster.TCSLRCode INNER JOIN
                         dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfoAll.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                         dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfoAll.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
                         dbo.BankMaster ON dbo.StudInfoAll.BankCode = dbo.BankMaster.BankCode
GO
/****** Object:  View [dbo].[ExcelTCPrintingReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ExcelTCPrintingReport]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.TCPrintAll.TCCode, dbo.TCPrintAll.TCNo, dbo.TCPrintAll.TCDate, dbo.StudInfoAll.RegNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
                       END AS StudentName, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.MotherName, 
                      dbo.StudInfoAll.AdmittionDate, dbo.StudInfoAll.StudentID, dbo.StudInfoAll.AadharNo, dbo.StudInfoAll.Dob, dbo.StudInfoAll.DobInWord, dbo.CityMaster.CityName AS BirthPlace, 
                      dbo.TalukaMaster.TalukaName, dbo.DistrictMaster.DistrictName, dbo.StateMaster.StateName, dbo.CountryMaster.CountryName, dbo.CasteMaster.CasteName, dbo.StudInfoAll.SubCast, 
                      dbo.ReligionMaster.ReligionName, dbo.LanguageMaster.LanguageName AS MotherTounge, dbo.OtherSchoolMaster.OtherSchoolName AS PrevSchool, ClassMaster_2.ClassName AS PSClass, 
                      ClassMaster_3.ClassName AS ClassAT, DivisionMaster_1.DivisionName AS DivAT, dbo.TCPrintAll.ReportDate, dbo.StudInfoAll.Nationality, dbo.TCPrintAll.TCStatus, dbo.TCPrintAll.TCBehavior, 
                      ClassMaster_1.ClassName AS TeachingClass, ClassMaster_1.ClassNameInWord AS TeachingClassInWord, dbo.TCPrintAll.TeachingYear, dbo.TCPrintAll.TeachingYearText, 
                      dbo.TCPrintAll.TeachingYearInWord, dbo.TCPrintAll.NextClassPromote, dbo.TCPrintAll.SeatNo, dbo.TCPrintAll.SLeaveReason, dbo.TCPrintAll.TCRemark, dbo.StudInfoAll.AyCode, 
                      dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.EntryFrom, dbo.StudInfoAll.AdmissionType, dbo.GenderMaster.GenderShort, dbo.GenderMaster.GenderName AS Gender, dbo.TCPrintAll.DeleteFlag, 
                      dbo.StudInfoAll.RollNo
FROM         dbo.ClassMaster AS ClassMaster_1 INNER JOIN
                      dbo.TCPrintAll ON ClassMaster_1.ClassCode = dbo.TCPrintAll.TeachingClassCode INNER JOIN
                      dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.CityMaster ON dbo.StudInfoAll.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                      dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                      dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                      dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                      dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.LanguageMaster ON dbo.StudInfoAll.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                      dbo.OtherSchoolMaster ON dbo.StudInfoAll.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfoAll.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfoAll.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                      dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfoAll.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode ON dbo.TCPrintAll.RegID = dbo.StudInfoAll.RegID
WHERE     (dbo.TCPrintAll.DeleteFlag = N'N')
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[FeesAlertDefineReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesAlertDefineReport]
AS
SELECT     TOP (100) PERCENT dbo.StudInfo.RegID, dbo.StudInfo.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.StudInfo.AyCode, dbo.StudInfo.CloseFlag, dbo.FeeTypeMaster.FeeTypeName, dbo.StudInfo.EntryFrom, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, 
                      dbo.FeesAlertDefine.AlertDate, dbo.FeesAlertDefine.Remark, dbo.AyMaster.AyName, dbo.AyMaster.FeesOutstandingMaintainFlag, dbo.StudInfo.RollNo
FROM         dbo.StudInfo INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfo.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.FeesAlertDefine ON dbo.StudInfo.RegID = dbo.FeesAlertDefine.RegID INNER JOIN
                      dbo.AyMaster ON dbo.StudInfo.AyCode = dbo.AyMaster.AyCode
ORDER BY dbo.StudInfo.RegID DESC
GO
/****** Object:  View [dbo].[FeesCollectionOtherReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesCollectionOtherReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.ClassMaster.ClassCode, dbo.ClassMaster.ClassName AS Class, dbo.FeesCollectionOther.ReceiptTID, 
                      dbo.FeesCollectionOther.ReceiptNo, dbo.FeesCollectionOther.ReceiptDate, dbo.FeesCollectionOther.TotalFeesAmount, dbo.FeesCollectionOther.CancelReceiptAmt, dbo.FeesCollectionOther.Remark, 
                      dbo.FeesCollectionOther.CancelReceiptFlag, dbo.FeesCollectionOther.PaymentTypeCode, dbo.PaymentTypeMaster.PaymentTypeName, dbo.FeesCollectionOther.BankName, 
                      dbo.FeesCollectionOther.ChequeNo, dbo.FeesCollectionOther.ChequeDate, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.FeesCollectionOther.StudentName, 
                      dbo.FeesCollectionOther.RegNo, dbo.MainClassMaster.MainClassGroupCode, dbo.MainClassGroupMaster.MainClassGroupName, dbo.MainClassGroupMaster.MainClassGroupNameShort, 
                      dbo.FeesCollectionOther.AyCode, dbo.AyMaster.AyName, dbo.FeesCollectionOther.UserCode, dbo.UserMaster.UserName, dbo.FeesCollectionOther.FyCode, dbo.FyMaster.FyName, 
                      dbo.UserMaster.FeesCounterName, dbo.FeesCollectionOther.DeleteFlag
FROM         dbo.ClassMaster INNER JOIN
                      dbo.MainClassMaster INNER JOIN
                      dbo.PaymentTypeMaster INNER JOIN
                      dbo.FeesCollectionOther ON dbo.PaymentTypeMaster.PaymentTypeCode = dbo.FeesCollectionOther.PaymentTypeCode ON 
                      dbo.MainClassMaster.MainClassCode = dbo.FeesCollectionOther.MainClassCode ON dbo.ClassMaster.ClassCode = dbo.FeesCollectionOther.ClassCode INNER JOIN
                      dbo.MainClassGroupMaster ON dbo.MainClassMaster.MainClassGroupCode = dbo.MainClassGroupMaster.MainClassGroupCode INNER JOIN
                      dbo.AyMaster ON dbo.FeesCollectionOther.AyCode = dbo.AyMaster.AyCode INNER JOIN
                      dbo.UserMaster ON dbo.FeesCollectionOther.UserCode = dbo.UserMaster.UserCode INNER JOIN
                      dbo.FyMaster ON dbo.FeesCollectionOther.FyCode = dbo.FyMaster.FyCode
WHERE     (dbo.FeesCollectionOther.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[FeesCollectionRegularReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesCollectionRegularReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
                       END AS StudentName, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegID, dbo.FeesCollectionRegular.ReceiptTID, dbo.FeesCollectionRegular.ReceiptNo, dbo.FeesCollectionRegular.ReceiptDate, 
                      dbo.FeesCollectionRegular.TotalFeesAmount, dbo.FeesCollectionRegular.TotalDiscountAmt, dbo.FeesCollectionRegular.CancelReceiptAmt, dbo.FeesCollectionRegular.Remark, 
                      dbo.FeesCollectionRegular.CancelReceiptFlag, dbo.FeesCollectionRegular.PaymentTypeCode, dbo.PaymentTypeMaster.PaymentTypeName, dbo.FeesCollectionRegular.BankName, 
                      dbo.FeesCollectionRegular.ChequeNo, dbo.FeesCollectionRegular.ChequeDate, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.FeeTypeMaster.FeeTypeCode, 
                      dbo.FeeTypeMaster.FeeTypeName, dbo.MainClassMaster.MainClassGroupCode, dbo.MainClassGroupMaster.MainClassGroupName, dbo.MainClassGroupMaster.MainClassGroupNameShort, 
                      dbo.StudInfoYearly.AyCode, dbo.AyMaster.AyName, dbo.FeesCollectionRegular.UserCode, dbo.UserMaster.UserName, dbo.FeesCollectionRegular.FyCode, dbo.FyMaster.FyName, 
                      dbo.UserMaster.FeesCounterName, dbo.FeesCollectionRegular.DeleteFlag, dbo.StudInfoAll.RollNo
FROM         dbo.DivisionMaster INNER JOIN
                      dbo.StudInfoYearly INNER JOIN
                      dbo.FeeTypeMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode ON dbo.FeeTypeMaster.FeeTypeCode = dbo.StudInfoAll.FeeTypeCode ON 
                      dbo.StudInfoYearly.RegID = dbo.StudInfoAll.RegID INNER JOIN
                      dbo.PaymentTypeMaster INNER JOIN
                      dbo.FeesCollectionRegular ON dbo.PaymentTypeMaster.PaymentTypeCode = dbo.FeesCollectionRegular.PaymentTypeCode ON dbo.StudInfoYearly.RegID = dbo.FeesCollectionRegular.RegID AND 
                      dbo.StudInfoYearly.AyCode = dbo.FeesCollectionRegular.AyCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoYearly.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.MainClassGroupMaster INNER JOIN
                      dbo.MainClassMaster ON dbo.MainClassGroupMaster.MainClassGroupCode = dbo.MainClassMaster.MainClassGroupCode ON 
                      dbo.StudInfoYearly.MainClassCode = dbo.MainClassMaster.MainClassCode ON dbo.DivisionMaster.DivisionCode = dbo.StudInfoYearly.DivisionCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoYearly.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.AyMaster ON dbo.StudInfoYearly.AyCode = dbo.AyMaster.AyCode INNER JOIN
                      dbo.UserMaster ON dbo.FeesCollectionRegular.UserCode = dbo.UserMaster.UserCode INNER JOIN
                      dbo.FyMaster ON dbo.FeesCollectionRegular.FyCode = dbo.FyMaster.FyCode
WHERE     (dbo.FeesCollectionRegular.DeleteFlag = N'N')
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[FeesCollectionReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesCollectionReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
                       END AS StudentName, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegID, dbo.FeesCollection.ReceiptTID, dbo.FeesCollection.ReceiptNo, dbo.FeesCollection.ReceiptDate, 
                      dbo.FeesCollection.TotalFeesAmount, dbo.FeesCollection.TotalDiscountAmt, dbo.FeesCollection.CancelReceiptAmt, dbo.FeesCollection.Remark, dbo.FeesCollection.CancelReceiptFlag, 
                      dbo.FeesCollection.PaymentTypeCode, dbo.PaymentTypeMaster.PaymentTypeName, dbo.FeesCollection.BankName, dbo.FeesCollection.ChequeNo, dbo.FeesCollection.ChequeDate, 
                      dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.FeeTypeMaster.FeeTypeCode, dbo.FeeTypeMaster.FeeTypeName, dbo.StudInfoAll.SubjectDetails, 
                      dbo.MainClassGroupMaster.MainClassGroupName, dbo.MainClassGroupMaster.MainClassGroupNameShort, dbo.MainClassMaster.MainClassGroupCode, dbo.StudInfoYearly.AyCode, 
                      dbo.AyMaster.AyName, dbo.FeesCollection.UserCode, dbo.UserMaster.UserName, dbo.FeesCollection.FyCode, dbo.FyMaster.FyName, dbo.UserMaster.FeesCounterName, 
                      dbo.FeesCollection.DeleteFlag, dbo.StudInfoAll.RollNo
FROM         dbo.ClassMaster INNER JOIN
                      dbo.StudInfoYearly INNER JOIN
                      dbo.FeeTypeMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode ON dbo.FeeTypeMaster.FeeTypeCode = dbo.StudInfoAll.FeeTypeCode ON 
                      dbo.StudInfoYearly.RegID = dbo.StudInfoAll.RegID INNER JOIN
                      dbo.PaymentTypeMaster INNER JOIN
                      dbo.FeesCollection ON dbo.PaymentTypeMaster.PaymentTypeCode = dbo.FeesCollection.PaymentTypeCode ON dbo.StudInfoYearly.RegID = dbo.FeesCollection.RegID AND 
                      dbo.StudInfoYearly.AyCode = dbo.FeesCollection.AyCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoYearly.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoYearly.MediumCode = dbo.MediumMaster.MediumCode ON dbo.ClassMaster.ClassCode = dbo.StudInfoYearly.ClassCode INNER JOIN
                      dbo.MainClassGroupMaster INNER JOIN
                      dbo.MainClassMaster ON dbo.MainClassGroupMaster.MainClassGroupCode = dbo.MainClassMaster.MainClassGroupCode ON 
                      dbo.StudInfoYearly.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.AyMaster ON dbo.StudInfoYearly.AyCode = dbo.AyMaster.AyCode INNER JOIN
                      dbo.UserMaster ON dbo.FeesCollection.UserCode = dbo.UserMaster.UserCode INNER JOIN
                      dbo.FyMaster ON dbo.FeesCollection.FyCode = dbo.FyMaster.FyCode
WHERE     (dbo.FeesCollection.DeleteFlag = N'N')
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[FeesDefineReportOther]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesDefineReportOther]
AS
SELECT     dbo.FeesDefineOther.FDTID, dbo.FeesDefineOther.ClassCode, dbo.ClassMaster.ClassName, dbo.MainClassMaster.MainClassCode, dbo.MainClassMaster.MainClassName, 
                      dbo.FeesDefineOther.FeeTitleOtherGroupCode, dbo.FeeTitleOtherGroupMaster.FeeTitleOtherGroupName, dbo.FeesDefineOther.SrNo, dbo.FeesDefineOther.FeeTitleOtherCode, 
                      dbo.FeeTitleOtherMaster.FeeTitleOtherName, dbo.FeesDefineOther.FeesAmount, dbo.FeesDefineOther.AyCode, dbo.AyMaster.AyName
FROM         dbo.FeesDefineOther INNER JOIN
                      dbo.ClassMaster ON dbo.FeesDefineOther.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.FeeTitleOtherMaster ON dbo.FeesDefineOther.FeeTitleOtherCode = dbo.FeeTitleOtherMaster.FeeTitleOtherCode INNER JOIN
                      dbo.AyMaster ON dbo.FeesDefineOther.AyCode = dbo.AyMaster.AyCode INNER JOIN
                      dbo.FeeTitleOtherGroupMaster ON dbo.FeesDefineOther.FeeTitleOtherGroupCode = dbo.FeeTitleOtherGroupMaster.FeeTitleOtherGroupCode INNER JOIN
                      dbo.MainClassMaster ON dbo.ClassMaster.MainClassCode = dbo.MainClassMaster.MainClassCode
GO
/****** Object:  View [dbo].[FeesDefineReportRegular]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesDefineReportRegular]
AS
SELECT DISTINCT 
                      TOP (100) PERCENT dbo.StudInfo.RegID, dbo.StudInfo.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfo.AyCode, dbo.StudInfo.AdmittionDate, dbo.StudInfo.StudentID, 
                      dbo.StudInfo.AadharNo, dbo.StudInfo.PermanentAddress, dbo.StudInfo.LocalAddress, dbo.StudInfo.MobileNo1, dbo.StudInfo.MobileNo2, dbo.StudInfo.CloseFlag, dbo.StudInfo.TSuspendedFlag, 
                      dbo.StudInfo.TSupendedDate, dbo.StudInfo.AdmissionType, dbo.StudInfo.MediumCode, dbo.StudInfo.ClassCode, dbo.GenderMaster.GenderName, dbo.StudInfo.Photpath, dbo.StudInfo.RollNo, 
                      dbo.FeeTypeMaster.FeeTypeName, dbo.StudInfo.EntryFrom, dbo.StudInfo.StudDisplayFlag, dbo.StudInfo.FeesPaidFlag, dbo.StudInfo.MarksFeedFlag, dbo.MainClassMaster.LogoPath, 
                      dbo.MainClassMaster.LetterHeadPath, dbo.StudInfo.DivisionCode, dbo.AyMaster.AyName
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfo.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.FeesDefineRegular ON dbo.StudInfo.RegID = dbo.FeesDefineRegular.RegID INNER JOIN
                      dbo.AyMaster ON dbo.StudInfo.AyCode = dbo.AyMaster.AyCode
ORDER BY dbo.StudInfo.RegID DESC
GO
/****** Object:  View [dbo].[FeesLedgerReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesLedgerReport]
AS
SELECT dbo.TempAllFeesLedger.MainClassCode, dbo.TempAllFeesLedger.RegNo, dbo.TempAllFeesLedger.ClassCode, dbo.TempAllFeesLedger.StudentName, dbo.TempAllFeesLedger.Div, dbo.TempAllFeesLedger.FeeType, 
                  dbo.TempAllFeesLedger.ReceiptNo, dbo.TempAllFeesLedger.ReceiptDate, dbo.TempAllFeesLedger.TotalFeesAmount, dbo.TempAllFeesLedger.TotalDiscount, dbo.TempAllFeesLedger.PaymentTypeCode, dbo.TempAllFeesLedger.RegID, 
                  dbo.TempAllFeesLedger.AyCode, dbo.TempAllFeesLedger.YearlyFeesDefine, dbo.TempAllFeesLedger.YearlyFeesBalance, dbo.TempAllFeesLedger.AllFeesBalance, dbo.ClassMaster.ClassName, 
                  dbo.PaymentTypeMaster.PaymentTypeName, dbo.AyMaster.AyName, dbo.TempAllFeesLedger.YearlyFeesPaid, dbo.TempAllFeesLedger.SchoolFees, dbo.TempAllFeesLedger.DiscountFees
FROM     dbo.TempAllFeesLedger INNER JOIN
                  dbo.ClassMaster ON dbo.TempAllFeesLedger.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                  dbo.PaymentTypeMaster ON dbo.TempAllFeesLedger.PaymentTypeCode = dbo.PaymentTypeMaster.PaymentTypeCode INNER JOIN
                  dbo.AyMaster ON dbo.TempAllFeesLedger.AyCode = dbo.AyMaster.AyCode
GO
/****** Object:  View [dbo].[FeesOutstandingReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesOutstandingReport]
AS
SELECT TOP (100) PERCENT dbo.MainClassMaster.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, dbo.ClassMaster.ClassName AS Class, 
                  dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName END AS StudentName, 
                  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student, 
                  dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegID, dbo.TempMonthlyFeesCollection.OpeningBalance, dbo.TempMonthlyFeesCollection.TotalFeesAmount, dbo.TempMonthlyFeesCollection.TotalPaidAmount, 
                  dbo.TempMonthlyFeesCollection.TotalDiscountAmt, dbo.TempMonthlyFeesCollection.TotalAdjustAmt, dbo.TempMonthlyFeesCollection.M1, dbo.TempMonthlyFeesCollection.M2, dbo.TempMonthlyFeesCollection.M3, 
                  dbo.TempMonthlyFeesCollection.M4, dbo.TempMonthlyFeesCollection.M5, dbo.TempMonthlyFeesCollection.M6, dbo.TempMonthlyFeesCollection.M7, dbo.TempMonthlyFeesCollection.M8, dbo.TempMonthlyFeesCollection.M9, 
                  dbo.TempMonthlyFeesCollection.M10, dbo.TempMonthlyFeesCollection.M11, dbo.TempMonthlyFeesCollection.M12, dbo.TempMonthlyFeesCollection.TotalBalance, dbo.TempMonthlyFeesCollection.TotalBalanceCD, 
                  dbo.FeeTypeMaster.FeeTypeName, dbo.StudInfoAll.Photpath, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.TempMonthlyFeesCollection.M13, dbo.TempMonthlyFeesCollection.M14, 
                  dbo.TempMonthlyFeesCollection.M15, dbo.TempMonthlyFeesCollection.M16, dbo.TempMonthlyFeesCollection.M17, dbo.TempMonthlyFeesCollection.M18, dbo.TempMonthlyFeesCollection.M19, dbo.TempMonthlyFeesCollection.M20, 
                  dbo.TempMonthlyFeesCollection.M21, dbo.TempMonthlyFeesCollection.M22, dbo.TempMonthlyFeesCollection.M23, dbo.TempMonthlyFeesCollection.M24, dbo.StudInfoAll.MobileNo1, dbo.StudInfoAll.MobileNo2, 
                  dbo.TempMonthlyFeesCollection.AlertDate, dbo.TempMonthlyFeesCollection.Remark, dbo.TempMonthlyFeesCollection.ReceiptNo, dbo.TempMonthlyFeesCollection.ClassName AS ClassTemp, 
                  dbo.TempMonthlyFeesCollection.Division AS DivTemp, dbo.TempMonthlyFeesCollection.M25, dbo.TempMonthlyFeesCollection.M26, dbo.TempMonthlyFeesCollection.M27, dbo.TempMonthlyFeesCollection.M28, 
                  dbo.TempMonthlyFeesCollection.M29, dbo.TempMonthlyFeesCollection.M30, dbo.TempMonthlyFeesCollection.M31, dbo.TempMonthlyFeesCollection.M32, dbo.TempMonthlyFeesCollection.M33, dbo.TempMonthlyFeesCollection.M34, 
                  dbo.TempMonthlyFeesCollection.M35, dbo.TempMonthlyFeesCollection.M36, dbo.TempMonthlyFeesCollection.M37, dbo.TempMonthlyFeesCollection.M38, dbo.TempMonthlyFeesCollection.M39, dbo.TempMonthlyFeesCollection.M40, 
                  dbo.TempMonthlyFeesCollection.M41, dbo.TempMonthlyFeesCollection.M42, dbo.TempMonthlyFeesCollection.M43, dbo.TempMonthlyFeesCollection.M44, dbo.TempMonthlyFeesCollection.M45, dbo.TempMonthlyFeesCollection.M46, 
                  dbo.TempMonthlyFeesCollection.M47, dbo.TempMonthlyFeesCollection.M48, dbo.TempMonthlyFeesCollection.M49, dbo.TempMonthlyFeesCollection.M50, dbo.TempMonthlyFeesCollection.StudentName AS StudentTemp, 
                  dbo.TempMonthlyFeesCollection.MainClass AS MainClassTemp, dbo.MainClassMaster.MainClassGroupCode, dbo.MainClassGroupMaster.MainClassGroupName, dbo.MainClassGroupMaster.MainClassGroupNameShort, 
                  dbo.StudInfoAll.AdmittionDate, dbo.StudInfoAll.StudentID, dbo.StudInfoAll.RollNo, dbo.StudInfoAll.Dob, dbo.CasteMaster.CasteName, dbo.CategoryMaster.CategoryName, dbo.StudInfoYearly.AyCode, dbo.AyMaster.AyName, 
                  dbo.StudInfoAll.DeleteFlag, dbo.TempMonthlyFeesCollection.TotalBalanceAllYear, dbo.TempMonthlyFeesCollection.OpeningBalancePaid, dbo.TempMonthlyFeesCollection.SchoolFees, 
                  dbo.TempMonthlyFeesCollection.DiscountFees
FROM     dbo.FeeTypeMaster INNER JOIN
                  dbo.StudInfoYearly INNER JOIN
                  dbo.StudInfoAll INNER JOIN
                  dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                  dbo.CategoryMaster ON dbo.StudInfoAll.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                  dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode ON dbo.StudInfoYearly.RegID = dbo.StudInfoAll.RegID INNER JOIN
                  dbo.DivisionMaster ON dbo.StudInfoYearly.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.FeeTypeMaster.FeeTypeCode = dbo.StudInfoYearly.FeeTypeCode INNER JOIN
                  dbo.MainClassGroupMaster INNER JOIN
                  dbo.MainClassMaster ON dbo.MainClassGroupMaster.MainClassGroupCode = dbo.MainClassMaster.MainClassGroupCode ON dbo.StudInfoYearly.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                  dbo.TempMonthlyFeesCollection ON dbo.StudInfoYearly.RegID = dbo.TempMonthlyFeesCollection.RegID AND dbo.StudInfoYearly.AyCode = dbo.TempMonthlyFeesCollection.AyCode INNER JOIN
                  dbo.ClassMaster ON dbo.StudInfoYearly.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                  dbo.MediumMaster ON dbo.StudInfoYearly.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                  dbo.AyMaster ON dbo.StudInfoYearly.AyCode = dbo.AyMaster.AyCode
WHERE  (dbo.StudInfoAll.DeleteFlag = N'N')
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[FeesReceiptNotPaidStudentReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesReceiptNotPaidStudentReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
                       END AS StudentName, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegID, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.FeeTypeMaster.FeeTypeCode, 
                      dbo.FeeTypeMaster.FeeTypeName, dbo.StudInfoAll.StudentID, dbo.StudInfoAll.SubjectDetails, dbo.MainClassMaster.MainClassGroupCode, dbo.MainClassGroupMaster.MainClassGroupName, 
                      dbo.MainClassGroupMaster.MainClassGroupNameShort, dbo.CategoryMaster.CategoryName, dbo.StudInfoYearly.AyCode, dbo.AyMaster.AyName, dbo.StudInfoAll.Firstname, 
                      dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.RollNo, dbo.FeesCollection.ReceiptTID, dbo.GenderMaster.GenderName
FROM         dbo.FeeTypeMaster INNER JOIN
                      dbo.CategoryMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.MainClassGroupMaster ON dbo.MainClassMaster.MainClassGroupCode = dbo.MainClassGroupMaster.MainClassGroupCode ON 
                      dbo.CategoryMaster.CategoryCode = dbo.StudInfoAll.CategoryCode INNER JOIN
                      dbo.StudInfoYearly ON dbo.StudInfoAll.RegID = dbo.StudInfoYearly.RegID ON dbo.FeeTypeMaster.FeeTypeCode = dbo.StudInfoYearly.FeeTypeCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoYearly.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoYearly.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoYearly.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.AyMaster ON dbo.StudInfoYearly.AyCode = dbo.AyMaster.AyCode LEFT OUTER JOIN
                      dbo.FeesCollection ON dbo.StudInfoYearly.AyCode = dbo.FeesCollection.AyCode AND dbo.StudInfoYearly.RegID = dbo.FeesCollection.RegID
WHERE     (dbo.FeesCollection.ReceiptTID IS NULL)
GO
/****** Object:  View [dbo].[FeesReceiptReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesReceiptReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
                       END AS StudentName, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegID, dbo.FeesCollection.ReceiptTID, dbo.FeesCollection.ReceiptNo, dbo.FeesCollection.ReceiptDate, 
                      dbo.FeesCollection.TotalFeesAmount, dbo.FeesCollection.TotalDiscountAmt, dbo.FeesCollection.CancelReceiptAmt, dbo.FeesCollection.Remark, dbo.FeesCollection.CancelReceiptFlag, 
                      dbo.FeesCollection.PaymentTypeCode, dbo.PaymentTypeMaster.PaymentTypeName, dbo.FeesCollection.BankName, dbo.FeesCollection.ChequeNo, dbo.FeesCollection.ChequeDate, 
                      dbo.FeesCollectionDetail.SrNo, dbo.FeesCollectionDetail.FeeTitleCode, dbo.FeeTitleMaster.FeeTitleName, dbo.FeesCollectionDetail.FeesAmount, dbo.FeesCollectionDetail.DiscountAmount, 
                      dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.FeeTypeMaster.FeeTypeCode, dbo.FeeTypeMaster.FeeTypeName, dbo.StudInfoAll.StudentID, 
                      dbo.StudInfoAll.SubjectDetails, dbo.MainClassMaster.MainClassGroupCode, dbo.MainClassGroupMaster.MainClassGroupName, dbo.MainClassGroupMaster.MainClassGroupNameShort, 
                      dbo.CategoryMaster.CategoryName, dbo.FeesReportTypeMaster.FeesReportTypeCode, dbo.FeesReportTypeMaster.FeesReportTypeName, dbo.StudInfoYearly.AyCode, dbo.AyMaster.AyName, 
                      dbo.FeesCollection.UserCode, dbo.UserMaster.UserName, dbo.FeesCollection.FyCode, dbo.FyMaster.FyName, dbo.UserMaster.FeesCounterName, dbo.FeesCollection.DeleteFlag, 
                      dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.RollNo
FROM         dbo.PaymentTypeMaster INNER JOIN
                      dbo.FeesCollection ON dbo.PaymentTypeMaster.PaymentTypeCode = dbo.FeesCollection.PaymentTypeCode INNER JOIN
                      dbo.CategoryMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.MainClassGroupMaster ON dbo.MainClassMaster.MainClassGroupCode = dbo.MainClassGroupMaster.MainClassGroupCode ON 
                      dbo.CategoryMaster.CategoryCode = dbo.StudInfoAll.CategoryCode INNER JOIN
                      dbo.StudInfoYearly ON dbo.StudInfoAll.RegID = dbo.StudInfoYearly.RegID ON dbo.FeesCollection.RegID = dbo.StudInfoYearly.RegID AND 
                      dbo.FeesCollection.AyCode = dbo.StudInfoYearly.AyCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfoYearly.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoYearly.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoYearly.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoYearly.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.AyMaster ON dbo.StudInfoYearly.AyCode = dbo.AyMaster.AyCode INNER JOIN
                      dbo.UserMaster ON dbo.FeesCollection.UserCode = dbo.UserMaster.UserCode INNER JOIN
                      dbo.FyMaster ON dbo.FeesCollection.FyCode = dbo.FyMaster.FyCode LEFT OUTER JOIN
                      dbo.FeesCollectionDetail ON dbo.FeesCollection.ReceiptTID = dbo.FeesCollectionDetail.ReceiptTID LEFT OUTER JOIN
                      dbo.FeeTitleMaster ON dbo.FeesCollectionDetail.FeeTitleCode = dbo.FeeTitleMaster.FeeTitleCode CROSS JOIN
                      dbo.FeesReportTypeMaster
WHERE     (dbo.FeesCollection.DeleteFlag = N'N')
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[FeesReceiptReportOther]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesReceiptReportOther]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.ClassMaster.ClassCode, dbo.ClassMaster.ClassName AS Class, dbo.FeesCollectionOther.RegNo, 
                      dbo.FeesCollectionOther.StudentName, dbo.FeesCollectionOther.ReceiptTID, dbo.FeesCollectionOther.ReceiptNo, dbo.FeesCollectionOther.ReceiptDate, dbo.FeesCollectionOther.TotalFeesAmount, 
                      dbo.FeesCollectionOther.CancelReceiptAmt, dbo.FeesCollectionOther.Remark, dbo.FeesCollectionOther.CancelReceiptFlag, dbo.FeesCollectionOther.PaymentTypeCode, 
                      dbo.PaymentTypeMaster.PaymentTypeName, dbo.FeesCollectionOther.BankName, dbo.FeesCollectionOther.ChequeNo, dbo.FeesCollectionOther.ChequeDate, dbo.FeesCollectionOtherDetail.SrNo, 
                      dbo.FeesCollectionOtherDetail.FeeTitleOtherCode, dbo.FeeTitleOtherMaster.FeeTitleOtherName, dbo.FeesCollectionOtherDetail.FeesAmount, dbo.MainClassMaster.LogoPath, 
                      dbo.MainClassMaster.LetterHeadPath, dbo.FeesCollectionOther.FeeTitleOtherGroupCode, dbo.FeeTitleOtherGroupMaster.FeeTitleOtherGroupName, dbo.FeesCollectionOther.MainClassCode, 
                      dbo.MainClassMaster.MainClassGroupCode, dbo.MainClassGroupMaster.MainClassGroupName, dbo.MainClassGroupMaster.MainClassGroupNameShort, 
                      dbo.FeesReportTypeMaster.FeesReportTypeCode, dbo.FeesReportTypeMaster.FeesReportTypeName, dbo.FeesCollectionOther.UserCode, dbo.UserMaster.UserName, 
                      dbo.FeesCollectionOther.FyCode, dbo.FyMaster.FyName, dbo.FeesCollectionOther.AyCode, dbo.AyMaster.AyName, dbo.UserMaster.FeesCounterName, dbo.FeesCollectionOther.DeleteFlag
FROM         dbo.MainClassMaster INNER JOIN
                      dbo.PaymentTypeMaster INNER JOIN
                      dbo.FeesCollectionOther ON dbo.PaymentTypeMaster.PaymentTypeCode = dbo.FeesCollectionOther.PaymentTypeCode INNER JOIN
                      dbo.FeesCollectionOtherDetail ON dbo.FeesCollectionOther.ReceiptTID = dbo.FeesCollectionOtherDetail.ReceiptTID INNER JOIN
                      dbo.FeeTitleOtherMaster ON dbo.FeesCollectionOtherDetail.FeeTitleOtherCode = dbo.FeeTitleOtherMaster.FeeTitleOtherCode INNER JOIN
                      dbo.ClassMaster ON dbo.FeesCollectionOther.ClassCode = dbo.ClassMaster.ClassCode ON dbo.MainClassMaster.MainClassCode = dbo.FeesCollectionOther.MainClassCode INNER JOIN
                      dbo.FeeTitleOtherGroupMaster ON dbo.FeesCollectionOther.FeeTitleOtherGroupCode = dbo.FeeTitleOtherGroupMaster.FeeTitleOtherGroupCode INNER JOIN
                      dbo.MainClassGroupMaster ON dbo.MainClassMaster.MainClassGroupCode = dbo.MainClassGroupMaster.MainClassGroupCode INNER JOIN
                      dbo.UserMaster ON dbo.FeesCollectionOther.UserCode = dbo.UserMaster.UserCode INNER JOIN
                      dbo.FyMaster ON dbo.FeesCollectionOther.FyCode = dbo.FyMaster.FyCode INNER JOIN
                      dbo.AyMaster ON dbo.FeesCollectionOther.AyCode = dbo.AyMaster.AyCode CROSS JOIN
                      dbo.FeesReportTypeMaster
WHERE     (dbo.FeesCollectionOther.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[FeesReceiptReportRegular]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesReceiptReportRegular]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoYearly.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
                       END AS StudentName, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.GenderMaster.GenderShort, dbo.StudInfoYearly.RegID, dbo.FeesCollectionRegular.ReceiptTID, dbo.FeesCollectionRegular.ReceiptNo, dbo.FeesCollectionRegular.ReceiptDate, 
                      dbo.FeesCollectionRegular.TotalFeesAmount, dbo.FeesCollectionRegular.TotalDiscountAmt, dbo.FeesCollectionRegular.CancelReceiptAmt, dbo.FeesCollectionRegular.Remark, 
                      dbo.FeesCollectionRegular.CancelReceiptFlag, dbo.FeesCollectionRegular.PaymentTypeCode, dbo.PaymentTypeMaster.PaymentTypeName, dbo.FeesCollectionRegular.BankName, 
                      dbo.FeesCollectionRegular.ChequeNo, dbo.FeesCollectionRegular.ChequeDate, dbo.FeesCollectionRegularDetail.SrNo, dbo.FeesCollectionRegularDetail.FeeTitleRegularCode, 
                      dbo.FeeTitleRegularMaster.FeeTitleRegularName, dbo.FeesCollectionRegularDetail.FeesAmount, dbo.FeesCollectionRegularDetail.DiscountAmount, dbo.MainClassMaster.LogoPath, 
                      dbo.MainClassMaster.LetterHeadPath, dbo.FeeTypeMaster.FeeTypeCode, dbo.FeeTypeMaster.FeeTypeName, dbo.StudInfoAll.StudentID, dbo.StudInfoAll.SubjectDetails, 
                      dbo.MainClassMaster.MainClassGroupCode, dbo.MainClassGroupMaster.MainClassGroupName, dbo.MainClassGroupMaster.MainClassGroupNameShort, dbo.StudInfoYearly.AyCode, 
                      dbo.AyMaster.AyName, dbo.FeesCollectionRegular.UserCode, dbo.UserMaster.UserName, dbo.UserMaster.FeesCounterName, dbo.FeesCollectionRegular.DeleteFlag, dbo.StudInfoAll.RollNo
FROM         dbo.MainClassGroupMaster INNER JOIN
                      dbo.MainClassMaster ON dbo.MainClassGroupMaster.MainClassGroupCode = dbo.MainClassMaster.MainClassGroupCode INNER JOIN
                      dbo.FeeTypeMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.StudInfoYearly ON dbo.StudInfoAll.RegID = dbo.StudInfoYearly.RegID ON dbo.FeeTypeMaster.FeeTypeCode = dbo.StudInfoYearly.FeeTypeCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoYearly.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoYearly.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoYearly.MediumCode = dbo.MediumMaster.MediumCode ON dbo.MainClassMaster.MainClassCode = dbo.StudInfoYearly.MainClassCode INNER JOIN
                      dbo.FeesCollectionRegularDetail INNER JOIN
                      dbo.PaymentTypeMaster INNER JOIN
                      dbo.FeesCollectionRegular ON dbo.PaymentTypeMaster.PaymentTypeCode = dbo.FeesCollectionRegular.PaymentTypeCode ON 
                      dbo.FeesCollectionRegularDetail.ReceiptTID = dbo.FeesCollectionRegular.ReceiptTID INNER JOIN
                      dbo.FeeTitleRegularMaster ON dbo.FeesCollectionRegularDetail.FeeTitleRegularCode = dbo.FeeTitleRegularMaster.FeeTitleRegularCode ON 
                      dbo.StudInfoYearly.RegID = dbo.FeesCollectionRegular.RegID AND dbo.StudInfoYearly.AyCode = dbo.FeesCollectionRegular.AyCode INNER JOIN
                      dbo.AyMaster ON dbo.StudInfoYearly.AyCode = dbo.AyMaster.AyCode INNER JOIN
                      dbo.UserMaster ON dbo.FeesCollectionRegular.UserCode = dbo.UserMaster.UserCode
WHERE     (dbo.FeesCollectionRegular.DeleteFlag = N'N')
ORDER BY dbo.StudInfoYearly.RegID DESC
GO
/****** Object:  View [dbo].[FeesStudInfoReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesStudInfoReport]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
                       END AS StudentName, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfoYearly.AyCode, dbo.StudInfoAll.AdmittionDate, 
                      dbo.StudInfoAll.StudentID, dbo.StudInfoAll.AadharNo, dbo.StudInfoAll.Dob, dbo.StudInfoAll.DobInWord, dbo.CasteMaster.CasteName, dbo.StudInfoAll.SubCast, dbo.ReligionMaster.ReligionName, 
                      dbo.StudInfoAll.MotherName, dbo.StudInfoAll.Age30Sept, dbo.StudInfoAll.PermanentAddress, dbo.StudInfoAll.LocalAddress, dbo.StudInfoAll.MobileNo1, dbo.StudInfoAll.MobileNo2, 
                      dbo.StudInfoAll.BloodGroup, dbo.StudInfoAll.PSTCNo, dbo.StudInfoAll.PSLeaveDate, dbo.StudInfoAll.FatherName, dbo.StudInfoAll.FAnnualIncome, dbo.StudInfoAll.FormNo, 
                      dbo.CategoryMaster.CategoryName, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.TSuspendedFlag, dbo.StudInfoAll.TSupendedDate, dbo.StudInfoAll.AdmissionType, dbo.StudInfoYearly.MediumCode, 
                      dbo.StudInfoYearly.ClassCode, dbo.GenderMaster.GenderName, dbo.StudInfoAll.Photpath, dbo.StudInfoAll.RollNo, dbo.FeeTypeMaster.FeeTypeName, dbo.StudInfoAll.PSResult, 
                      dbo.StudInfoAll.PSRegNo, dbo.StudInfoAll.GaurdianName, dbo.StudInfoAll.BankAcNo, dbo.StudInfoAll.BankAPersonName, dbo.StudInfoAll.PersonalIdentMark, dbo.StudInfoAll.EntryFrom, 
                      dbo.StudInfoAll.Remark, dbo.StudInfoAll.StudDisplayFlag, dbo.StudInfoAll.HandyCapStatus, dbo.StudInfoAll.BPLCardStatus, dbo.StudInfoAll.Nationality, dbo.StudInfoAll.ReligionCode, 
                      dbo.StudInfoAll.PPECompleteStatus, dbo.StudInfoAll.WeightFT, dbo.StudInfoAll.WeightST, dbo.StudInfoAll.HeightFT, dbo.StudInfoAll.HeightST, dbo.StudInfoAll.SeatNo, dbo.StudInfoAll.FirstnameE, 
                      dbo.StudInfoAll.MiddleNameE, dbo.StudInfoAll.LastNameE, dbo.StudInfoAll.AdmiSchoolType, dbo.StudInfoAll.MotherNameE, dbo.StudInfoAll.WeekPointDetail, dbo.StudInfoAll.LearningStopResion, 
                      dbo.StudInfoAll.PrePrimarySchoolName, dbo.StudInfoAll.GovermentOffer, dbo.StudInfoAll.AadharLinkBankStatus, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, 
                      dbo.StudInfoAll.HostelStayFlag, dbo.StudInfoAll.MarksFeedFlag, dbo.StudInfoAll.FAadharCardNo, dbo.StudInfoAll.FPanCard, dbo.StudInfoAll.MAnnualIncome, dbo.StudInfoAll.MAadharCardNo, 
                      dbo.StudInfoAll.MPanCard, dbo.StudInfoAll.WhatsAppMobileNo, dbo.StudInfoAll.EmailID, dbo.StudInfoAll.FacebookID, dbo.StudInfoAll.InstragramID, dbo.StudInfoAll.TelegramID, 
                      dbo.StudInfoAll.TwitterID, dbo.StudInfoAll.Branch, dbo.StudInfoAll.MotherFatherAreAlive, dbo.StudInfoAll.EWSCertificateStatus, dbo.StudInfoAll.HandyCapPercentage, dbo.StudInfoAll.BPLCardNo, 
                      dbo.TempAllFeesCollection.ReceiptNo, dbo.TempAllFeesCollection.ReceiptDate, dbo.AyMaster.AyName
FROM         dbo.StudInfoYearly INNER JOIN
                      dbo.CategoryMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode ON dbo.CategoryMaster.CategoryCode = dbo.StudInfoAll.CategoryCode ON 
                      dbo.StudInfoYearly.RegID = dbo.StudInfoAll.RegID INNER JOIN
                      dbo.TempAllFeesCollection ON dbo.StudInfoYearly.RegID = dbo.TempAllFeesCollection.RegID INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoYearly.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoYearly.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoYearly.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoYearly.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfoYearly.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.AyMaster ON dbo.StudInfoYearly.AyCode = dbo.AyMaster.AyCode
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[FeesTitleReceiptDetailReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[FeesTitleReceiptDetailReport]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoAll.RegNo, dbo.TempMonthlyFeesCollection.StudentName, dbo.TempMonthlyFeesCollection.MainClass, dbo.TempMonthlyFeesCollection.RegID, 
                      dbo.TempMonthlyFeesCollection.AlertDate, dbo.TempMonthlyFeesCollection.Remark, dbo.TempMonthlyFeesCollection.ReceiptNo, dbo.TempMonthlyFeesCollection.ClassName, 
                      dbo.TempMonthlyFeesCollection.Division, dbo.TempMonthlyFeesCollection.UserName, dbo.TempMonthlyFeesCollection.FeesCounterName, 
                      dbo.TempMonthlyFeesCollection.FeeTitleOtherMainGroupName, dbo.TempMonthlyFeesCollection.FeeCategoryName, dbo.TempMonthlyFeesCollection.MainClassGroupName, 
                      dbo.TempMonthlyFeesCollection.OpeningBalance, dbo.TempMonthlyFeesCollection.TotalFeesAmount, dbo.TempMonthlyFeesCollection.TotalPaidAmount, 
                      dbo.TempMonthlyFeesCollection.TotalDiscountAmt, dbo.TempMonthlyFeesCollection.TotalAdjustAmt, dbo.TempMonthlyFeesCollection.TotalBalance, 
                      dbo.TempMonthlyFeesCollection.TotalBalanceCD, dbo.TempMonthlyFeesCollection.M1, dbo.TempMonthlyFeesCollection.M2, dbo.TempMonthlyFeesCollection.M3, 
                      dbo.TempMonthlyFeesCollection.M4, dbo.TempMonthlyFeesCollection.M5, dbo.TempMonthlyFeesCollection.M6, dbo.TempMonthlyFeesCollection.M7, dbo.TempMonthlyFeesCollection.M8, 
                      dbo.TempMonthlyFeesCollection.M9, dbo.TempMonthlyFeesCollection.M10, dbo.TempMonthlyFeesCollection.M11, dbo.TempMonthlyFeesCollection.M12, dbo.TempMonthlyFeesCollection.M13, 
                      dbo.TempMonthlyFeesCollection.M14, dbo.TempMonthlyFeesCollection.M15, dbo.TempMonthlyFeesCollection.M16, dbo.TempMonthlyFeesCollection.M17, dbo.TempMonthlyFeesCollection.M18, 
                      dbo.TempMonthlyFeesCollection.M19, dbo.TempMonthlyFeesCollection.M20, dbo.TempMonthlyFeesCollection.M21, dbo.TempMonthlyFeesCollection.M22, dbo.TempMonthlyFeesCollection.M23, 
                      dbo.TempMonthlyFeesCollection.M24, dbo.TempMonthlyFeesCollection.M25, dbo.TempMonthlyFeesCollection.M26, dbo.TempMonthlyFeesCollection.M27, dbo.TempMonthlyFeesCollection.M28, 
                      dbo.TempMonthlyFeesCollection.M29, dbo.TempMonthlyFeesCollection.M30, dbo.TempMonthlyFeesCollection.M31, dbo.TempMonthlyFeesCollection.M32, dbo.TempMonthlyFeesCollection.M33, 
                      dbo.TempMonthlyFeesCollection.M34, dbo.TempMonthlyFeesCollection.M35, dbo.TempMonthlyFeesCollection.M36, dbo.TempMonthlyFeesCollection.M37, dbo.TempMonthlyFeesCollection.M38, 
                      dbo.TempMonthlyFeesCollection.M39, dbo.TempMonthlyFeesCollection.M40, dbo.TempMonthlyFeesCollection.M41, dbo.TempMonthlyFeesCollection.M42, dbo.TempMonthlyFeesCollection.M43, 
                      dbo.TempMonthlyFeesCollection.M44, dbo.TempMonthlyFeesCollection.M45, dbo.TempMonthlyFeesCollection.M46, dbo.TempMonthlyFeesCollection.M47, dbo.TempMonthlyFeesCollection.M48, 
                      dbo.TempMonthlyFeesCollection.M49, dbo.TempMonthlyFeesCollection.M50, dbo.TempMonthlyFeesCollection.M51, dbo.TempMonthlyFeesCollection.M52, dbo.TempMonthlyFeesCollection.M53, 
                      dbo.TempMonthlyFeesCollection.M54, dbo.TempMonthlyFeesCollection.M55, dbo.TempMonthlyFeesCollection.M56, dbo.TempMonthlyFeesCollection.M57, dbo.TempMonthlyFeesCollection.M58, 
                      dbo.TempMonthlyFeesCollection.M59, dbo.TempMonthlyFeesCollection.M60, dbo.TempMonthlyFeesCollection.M61, dbo.TempMonthlyFeesCollection.M62, dbo.TempMonthlyFeesCollection.M63, 
                      dbo.TempMonthlyFeesCollection.M64, dbo.TempMonthlyFeesCollection.M65, dbo.TempMonthlyFeesCollection.M66, dbo.TempMonthlyFeesCollection.M67, dbo.TempMonthlyFeesCollection.M68, 
                      dbo.TempMonthlyFeesCollection.M69, dbo.TempMonthlyFeesCollection.M70, dbo.TempMonthlyFeesCollection.M71, dbo.TempMonthlyFeesCollection.M72, dbo.TempMonthlyFeesCollection.M73, 
                      dbo.TempMonthlyFeesCollection.M74, dbo.TempMonthlyFeesCollection.M75, dbo.MainClassMaster.MainClassGroupCode, dbo.TempMonthlyFeesCollection.ReceiptTID
FROM         dbo.TempMonthlyFeesCollection INNER JOIN
                      dbo.MainClassMaster ON dbo.TempMonthlyFeesCollection.MainClass = dbo.MainClassMaster.MainClassName LEFT OUTER JOIN
                      dbo.StudInfoAll ON dbo.TempMonthlyFeesCollection.RegID = dbo.StudInfoAll.RegID
GO
/****** Object:  View [dbo].[InwardRegisterReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[InwardRegisterReport]
AS
SELECT     TOP (100) PERCENT dbo.InwardRegister.TID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.InwardRegister.RecordNo, dbo.InwardRegister.IRDate, dbo.InwardRegister.FileNo, 
                      dbo.InwardRegister.LetterNo, dbo.InwardRegister.FromWhomReceived, dbo.InwardRegister.Subject, dbo.InwardRegister.ToWhomIssued, dbo.InwardRegister.Remark, 
                      dbo.InwardRegister.Attachment1Path, dbo.InwardRegister.FyCode
FROM         dbo.InwardRegister INNER JOIN
                      dbo.MainClassMaster ON dbo.InwardRegister.MainClassCode = dbo.MainClassMaster.MainClassCode
GO
/****** Object:  View [dbo].[LibBarcodePrintReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[LibBarcodePrintReport]
AS
SELECT     dbo.TempLibBarcodePrint.BookID, dbo.TempLibBarcodePrint.PrintQty, dbo.LibBookTitleMaster.LibBookTitleName, dbo.LibBookMaster.AccessionNo, dbo.LibAuthorMaster.LibAuthorName
FROM         dbo.TempLibBarcodePrint INNER JOIN
                      dbo.LibBookMaster ON dbo.TempLibBarcodePrint.BookID = dbo.LibBookMaster.BookTID INNER JOIN
                      dbo.LibBookTitleMaster ON dbo.LibBookMaster.BookTitleCode = dbo.LibBookTitleMaster.LibBookTitleCode INNER JOIN
                      dbo.LibAuthorMaster ON dbo.LibBookMaster.AuthorCode = dbo.LibAuthorMaster.LibAuthorCode
GO
/****** Object:  View [dbo].[LibBookDetailReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[LibBookDetailReport]
AS
SELECT     dbo.LibBookMaster.BookTID, dbo.LibBookMaster.BillNo, dbo.LibBookMaster.BillDate, dbo.LibBookMaster.LibSupplierCode, dbo.LibSupplierMaster.LibSupplierName, 
                      dbo.LibBookMaster.AuthorCode, dbo.LibAuthorMaster.LibAuthorName, dbo.LibBookMaster.AccessionNo, dbo.LibBookMaster.BookSubTitle, dbo.LibEditionMaster.LibEditionCode, 
                      dbo.LibEditionMaster.LibEditionName, dbo.LibPublicationMaster.LibPublicationCode, dbo.LibPublicationMaster.LibPublicationName, dbo.LibPublisherMaster.LibPublisherCode, 
                      dbo.LibPublisherMaster.LibPublisherName, dbo.LibBookMaster.PublicationYear, dbo.LibBookMaster.TotalPages, dbo.LibBookMaster.NoOfQty, dbo.LibBookMaster.BookPrice, 
                      dbo.LibBookLocationMaster.LibBookLocationCode, dbo.LibBookLocationMaster.LibBookLocationName, dbo.LibBookSubjectMaster.LibBookSubjectCode, 
                      dbo.LibBookSubjectMaster.LibBookSubjectName, dbo.LibBookLanguageMaster.LibBookLanguageCode, dbo.LibBookLanguageMaster.LibBookLanguageName, 
                      dbo.LibBookStatusMaster.LibBookStatusCode, dbo.LibBookStatusMaster.LibBookStatusName, dbo.LibBookTitleMaster.LibBookTitleName AS BookTitle, 
                      dbo.LibBookTitleGroupMaster.LibBookTitleGroupName, dbo.LibBookMaster.Remark
FROM         dbo.LibBookMaster INNER JOIN
                      dbo.LibSupplierMaster ON dbo.LibBookMaster.LibSupplierCode = dbo.LibSupplierMaster.LibSupplierCode INNER JOIN
                      dbo.LibAuthorMaster ON dbo.LibBookMaster.AuthorCode = dbo.LibAuthorMaster.LibAuthorCode INNER JOIN
                      dbo.LibEditionMaster ON dbo.LibBookMaster.EditionCode = dbo.LibEditionMaster.LibEditionCode INNER JOIN
                      dbo.LibPublicationMaster ON dbo.LibBookMaster.LibPublicationCode = dbo.LibPublicationMaster.LibPublicationCode INNER JOIN
                      dbo.LibPublisherMaster ON dbo.LibBookMaster.LibPublisherCode = dbo.LibPublisherMaster.LibPublisherCode INNER JOIN
                      dbo.LibBookSubjectMaster ON dbo.LibBookMaster.LibBookSubjectCode = dbo.LibBookSubjectMaster.LibBookSubjectCode INNER JOIN
                      dbo.LibBookLocationMaster ON dbo.LibBookMaster.LibBookLocationCode = dbo.LibBookLocationMaster.LibBookLocationCode INNER JOIN
                      dbo.LibBookLanguageMaster ON dbo.LibBookMaster.LibBookLanguageCode = dbo.LibBookLanguageMaster.LibBookLanguageCode INNER JOIN
                      dbo.LibBookStatusMaster ON dbo.LibBookMaster.LibStatusCode = dbo.LibBookStatusMaster.LibBookStatusCode INNER JOIN
                      dbo.LibBookTitleMaster ON dbo.LibBookMaster.BookTitleCode = dbo.LibBookTitleMaster.LibBookTitleCode INNER JOIN
                      dbo.LibBookTitleGroupMaster ON dbo.LibBookMaster.BookTitleGroupCode = dbo.LibBookTitleGroupMaster.LibBookTitleGroupCode
GO
/****** Object:  View [dbo].[LibStudentIssueRetunBookReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[LibStudentIssueRetunBookReport]
AS
SELECT DISTINCT 
                      TOP (100) PERCENT dbo.LibStudentIssueReturnBook.TID, dbo.StudInfoAll.RegID, dbo.StudInfoAll.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.StudInfoAll.RegNo, 
                      CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
                       CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.LibStudentIssueReturnBook.BookTID, dbo.LibBookTitleMaster.LibBookTitleName AS BookTitle, dbo.LibBookMaster.BillNo, dbo.LibBookMaster.BillDate, 
                      dbo.LibBookMaster.AccessionNo, dbo.LibStudentIssueReturnBook.IssueDate, dbo.LibStudentIssueReturnBook.ReturnDate, dbo.LibStudentIssueReturnBook.NoofDays, 
                      dbo.LibStudentIssueReturnBook.DueAmt, dbo.LibStudentIssueReturnBook.Remark, dbo.ClassMaster.ClassCode, dbo.ClassMaster.ClassName, dbo.LibBookMaster.NoOfQty, 
                      dbo.StudInfoAll.RollNo
FROM         dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.LibStudentIssueReturnBook ON dbo.StudInfoAll.RegID = dbo.LibStudentIssueReturnBook.RegID INNER JOIN
                      dbo.LibBookMaster ON dbo.LibStudentIssueReturnBook.BookTID = dbo.LibBookMaster.BookTID INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.LibBookTitleMaster ON dbo.LibBookMaster.BookTitleCode = dbo.LibBookTitleMaster.LibBookTitleCode
ORDER BY dbo.LibStudentIssueReturnBook.IssueDate DESC
GO
/****** Object:  View [dbo].[OutwardRegisterReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[OutwardRegisterReport]
AS
SELECT     TOP (100) PERCENT dbo.OutwardRegister.TID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.OutwardRegister.RecordNo, dbo.OutwardRegister.ORDate, 
                      dbo.OutwardRegister.Enclosures, dbo.OutwardRegister.Address, dbo.OutwardRegister.Subject, dbo.OutwardRegister.FileNo, dbo.OutwardRegister.ORRDate, dbo.OutwardRegister.ExpensesAmt, 
                      dbo.OutwardRegister.Remark, dbo.OutwardRegister.Attachment1Path, dbo.OutwardRegister.FyCode
FROM         dbo.OutwardRegister INNER JOIN
                      dbo.MainClassMaster ON dbo.OutwardRegister.MainClassCode = dbo.MainClassMaster.MainClassCode
GO
/****** Object:  View [dbo].[PreTCPrintingReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[PreTCPrintingReport]
AS
SELECT        TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.StudInfoAll.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, 
                         dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                         CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName END AS StudentName,
                          CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student, 
                         dbo.StudInfoAll.MotherName, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.AdmittionDate, dbo.StudInfoAll.StudentID, dbo.StudInfoAll.AadharNo, dbo.StudInfoAll.Dob, dbo.StudInfoAll.DobInWord, 
                         dbo.CityMaster.CityName AS BirthPlace, dbo.TalukaMaster.TalukaName, dbo.DistrictMaster.DistrictName, dbo.StateMaster.StateName, dbo.CountryMaster.CountryName, dbo.CasteMaster.CasteName, dbo.StudInfoAll.SubCast, 
                         dbo.ReligionMaster.ReligionName, dbo.LanguageMaster.LanguageName AS MotherTounge, dbo.OtherSchoolMaster.OtherSchoolName AS PrevSchool, ClassMaster_2.ClassName AS PSClass, 
                         ClassMaster_3.ClassName AS ClassAT, DivisionMaster_1.DivisionName AS DivAT, dbo.StudInfoAll.Nationality, dbo.PreTCPrint.TCStatus, dbo.PreTCPrint.TCBehavior, ClassMaster_1.ClassName AS TClass, 
                         dbo.ClassMaster.ClassNameInWord AS TClassInWord, dbo.PreTCPrint.TeachingYear, YEAR(dbo.PreTCPrint.TeachingYear) AS Tyear, dbo.PreTCPrint.TeachingYearText, dbo.PreTCPrint.TeachingYearInWord, 
                         dbo.PreTCPrint.NextClassPromote AS Promote, dbo.PreTCPrint.SLeaveReason, dbo.PreTCPrint.TCRemark, dbo.StudInfoAll.SeatNo, dbo.FeeTypeMaster.FeeTypeName, dbo.StudInfoAll.RollNo, dbo.StudInfoAll.CloseFlag, 
                         dbo.StudInfoAll.EntryFrom
FROM            dbo.GenderMaster INNER JOIN
                         dbo.StudInfoAll INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                         dbo.CityMaster ON dbo.StudInfoAll.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                         dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                         dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                         dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                         dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                         dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                         dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                         dbo.LanguageMaster ON dbo.StudInfoAll.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                         dbo.OtherSchoolMaster ON dbo.StudInfoAll.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                         dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfoAll.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                         dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfoAll.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                         dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfoAll.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.ClassMaster AS ClassMaster_1 INNER JOIN
                         dbo.PreTCPrint ON ClassMaster_1.ClassCode = dbo.PreTCPrint.TeachingClassCode ON dbo.StudInfoAll.RegID = dbo.PreTCPrint.RegID INNER JOIN
                         dbo.FeeTypeMaster ON dbo.StudInfoAll.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode
WHERE        (dbo.StudInfoAll.CloseFlag = N'N') AND (dbo.StudInfoAll.EntryFrom = N'A')
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[ScholarshipReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[ScholarshipReport]
AS
SELECT     TOP (100) PERCENT dbo.ScholarshipEntry.TID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.ScholarshipMaster.ScholarshipName, 
                      dbo.CategoryMaster.CategoryNameEN AS SECategory, dbo.ScholarshipEntry.ReportName, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                      dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassNameEN AS ClassEN, dbo.DivisionMaster.DivisionNameEN AS DivEN, dbo.ReligionMaster.ReligionName AS Religion, 
                      CategoryMaster_1.CategoryNameEN AS CategoryEN, dbo.GenderMaster.GenderName AS Gender, dbo.GenderMaster.GenderShort, 
                      CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
                       CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, 
                      CASE StudInfoAll.LastNameE WHEN '-' THEN StudInfoAll.FirstnameE + ' ' + StudInfoAll.MiddleNameE ELSE StudInfoAll.FirstnameE + ' ' + StudInfoAll.MiddleNameE + ' ' + StudInfoAll.LastNameE END AS
                       StudentNameE, dbo.StudInfoAll.AadharNo, dbo.CasteMaster.CasteName AS Caste, dbo.CasteMaster.CasteNameEN AS CasteEN, dbo.OccupationMaster.OccupationName AS Occupation, 
                      dbo.OccupationMaster.OccupationNameEN AS OccupationEN, dbo.BankMaster.BankName, dbo.BankMaster.IFSCCode, dbo.StudInfoAll.BankAcNo, 
                      dbo.StudInfoAll.AadharLinkBankStatus AS AadharLink, dbo.ScholarshipEntryDetail.Amount, dbo.ScholarshipEntryDetail.Amount1, dbo.ScholarshipEntryDetail.Amount2, dbo.StudInfoAll.CloseFlag, 
                      dbo.StudInfoAll.AyCode, dbo.StudInfoAll.EntryFrom, dbo.StudInfoAll.AdmissionType, dbo.StudInfoAll.HostelStayFlag, dbo.StudInfoAll.ClassCode, dbo.StudInfoAll.RollNo
FROM         dbo.StudInfoAll INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.ScholarshipEntryDetail ON dbo.StudInfoAll.RegID = dbo.ScholarshipEntryDetail.RegID INNER JOIN
                      dbo.OccupationMaster ON dbo.StudInfoAll.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                      dbo.BankMaster ON dbo.StudInfoAll.BankCode = dbo.BankMaster.BankCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.ScholarshipEntry ON dbo.ScholarshipEntryDetail.TID = dbo.ScholarshipEntry.TID INNER JOIN
                      dbo.MainClassMaster ON dbo.ScholarshipEntry.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ScholarshipMaster ON dbo.ScholarshipEntry.ScholarshipCode = dbo.ScholarshipMaster.ScholarshipCode INNER JOIN
                      dbo.CategoryMaster ON dbo.ScholarshipEntry.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                      dbo.CategoryMaster AS CategoryMaster_1 ON dbo.StudInfoAll.CategoryCode = CategoryMaster_1.CategoryCode INNER JOIN
                      dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode
ORDER BY dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegNo
GO
/****** Object:  View [dbo].[SchoolLeaveReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[SchoolLeaveReport]
AS
SELECT        TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.StudInfoAll.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, 
                         dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                         CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName END AS StudentName,
                          CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student, 
                         dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.MotherName, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.AdmittionDate, dbo.StudInfoAll.StudentID, 
                         dbo.StudInfoAll.AadharNo, dbo.StudInfoAll.Dob, dbo.StudInfoAll.DobInWord, dbo.CityMaster.CityName AS BirthPlace, dbo.TalukaMaster.TalukaName, dbo.DistrictMaster.DistrictName, dbo.StateMaster.StateName, 
                         dbo.CountryMaster.CountryName, dbo.CasteMaster.CasteName, dbo.StudInfoAll.SubCast, dbo.ReligionMaster.ReligionName, dbo.LanguageMaster.LanguageName AS MotherTounge, 
                         dbo.OtherSchoolMaster.OtherSchoolName AS PrevSchool, ClassMaster_2.ClassName AS PSClass, ClassMaster_3.ClassName AS ClassAT, DivisionMaster_1.DivisionName AS DivAT, dbo.TCPrintAll.TCID, 
                         dbo.TCPrintAll.TCCode, dbo.TCPrintAll.TCNo, dbo.TCPrintAll.TCDate, dbo.TCPrintAll.ReportDate, dbo.StudInfoAll.Nationality, dbo.TCPrintAll.TCStatus, dbo.TCPrintAll.TCBehavior, ClassMaster_1.ClassName AS TeachingClass, 
                         ClassMaster_1.ClassNameInWord AS TeachingClassInWord, dbo.TCPrintAll.TeachingYear, dbo.TCPrintAll.TeachingYearText, dbo.TCPrintAll.TeachingYearInWord, dbo.TCPrintAll.NextClassPromote, dbo.StudInfoAll.SeatNo, 
                         dbo.TCPrintAll.SLeaveReason, dbo.TCPrintAll.TCRemark, dbo.StudInfoAll.TSuspendedFlag, dbo.StudInfoAll.TSupendedDate, dbo.StudInfoAll.Remark AS RemarkAdmission, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.EntryFrom, 
                         dbo.GenderMaster.GenderName, dbo.TCPrintAll.TCRPersonName, dbo.TCPrintAll.TCRPersonRelation, dbo.StudInfoAll.Photpath, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.StudInfoAll.MobileNo1, 
                         dbo.StudInfoAll.FatherName, dbo.StudInfoAll.LocalAddress, dbo.StudInfoAll.PermanentAddress, dbo.StudInfoAll.FirstnameE, dbo.StudInfoAll.MiddleNameE, dbo.StudInfoAll.LastNameE, dbo.StudInfoAll.MotherNameE, 
                         CASE StudInfoAll.LastNameE WHEN '-' THEN StudInfoAll.FirstnameE + ' ' + StudInfoAll.MiddleNameE ELSE StudInfoAll.FirstnameE + ' ' + StudInfoAll.MiddleNameE + ' ' + StudInfoAll.LastNameE END AS StudentNameE, 
                         DivisionMaster_1.DivisionNameEN, dbo.CasteMaster.CasteNameEN, dbo.ClassMaster.ClassNameEN, dbo.CategoryMaster.CategoryName, dbo.StudInfoAll.RollNo, dbo.StudInfoAll.SubjectGroupCode, 
                         dbo.SubjectGroupMaster.SubjectGroupName, dbo.StudInfoAll.SubjectDetails, dbo.StudInfoAll.DeleteFlag, dbo.TCPrintAll.M1, dbo.TCPrintAll.M2, dbo.TCPrintAll.M3, dbo.TCPrintAll.M4, dbo.TCPrintAll.M5, dbo.TCPrintAll.M6, 
                         dbo.TCPrintAll.M7, dbo.TCPrintAll.M8, dbo.TCPrintAll.Examination, dbo.TCPrintAll.ExamYear, dbo.TCPrintAll.ExamResult, dbo.TCPrintAll.SubjectDegreeCource, dbo.TCPrintAll.Specilization, dbo.TCPrintAll.ContinuedClass, 
                         dbo.StudInfoAll.NationalCode, dbo.StudInfoAll.ApaarID, dbo.StudInfoAll.StudentNameAadhar, dbo.StudInfoAll.AadharVerifiedFlag
FROM            dbo.CategoryMaster INNER JOIN
                         dbo.GenderMaster INNER JOIN
                         dbo.StudInfoAll INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                         dbo.CityMaster ON dbo.StudInfoAll.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                         dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                         dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                         dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                         dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                         dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                         dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                         dbo.LanguageMaster ON dbo.StudInfoAll.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                         dbo.OtherSchoolMaster ON dbo.StudInfoAll.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                         dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfoAll.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                         dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfoAll.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                         dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfoAll.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode ON dbo.CategoryMaster.CategoryCode = dbo.StudInfoAll.CategoryCode LEFT OUTER JOIN
                         dbo.SubjectGroupMaster ON dbo.StudInfoAll.SubjectGroupCode = dbo.SubjectGroupMaster.SubjectGroupCode LEFT OUTER JOIN
                         dbo.ClassMaster AS ClassMaster_1 RIGHT OUTER JOIN
                         dbo.TCPrintAll ON ClassMaster_1.ClassCode = dbo.TCPrintAll.TeachingClassCode ON dbo.StudInfoAll.RegID = dbo.TCPrintAll.RegID
WHERE        (dbo.StudInfoAll.DeleteFlag = N'N')
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[SpecificRecordReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[SpecificRecordReport]
AS
SELECT     TOP (100) PERCENT dbo.StudInfo.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.OccupationMaster.OccupationName AS FOccupation, dbo.StudInfo.CloseFlag, dbo.StudInfo.AdmissionType, dbo.ReligionMaster.ReligionName, dbo.CategoryMaster.CategoryName, 
                      dbo.CasteMaster.CasteName, dbo.StudInfo.SubCast, dbo.TempSpecificRecord.SpecificRecord, dbo.GenderMaster.GenderName, dbo.StudInfo.EntryFrom, dbo.GenderMaster.GenderShort, 
                      dbo.StudInfo.AyCode, dbo.StudInfo.StudDisplayFlag, dbo.StudInfo.Dob, dbo.StudInfo.RollNo
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.OccupationMaster ON dbo.StudInfo.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                      dbo.CategoryMaster ON dbo.StudInfo.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                      dbo.ReligionMaster ON dbo.StudInfo.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfo.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.TempSpecificRecord ON dbo.StudInfo.RegID = dbo.TempSpecificRecord.RegID
WHERE     (dbo.StudInfo.CloseFlag = N'N') AND (dbo.StudInfo.EntryFrom = N'A')
GO
/****** Object:  View [dbo].[StudentAttendanceMonthlyReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[StudentAttendanceMonthlyReport]
AS
SELECT     TOP (100) PERCENT dbo.StudInfo.RegID, dbo.StudInfo.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfo.AyCode, dbo.StudInfo.AdmittionDate, dbo.StudInfo.StudentID, 
                      dbo.StudInfo.Dob, dbo.CasteMaster.CasteName, dbo.StudInfo.CloseFlag, dbo.StudInfo.TSuspendedFlag, dbo.StudInfo.TSupendedDate, dbo.StudInfo.AdmissionType, dbo.StudInfo.MediumCode, 
                      dbo.StudInfo.ClassCode, dbo.GenderMaster.GenderName, dbo.StudInfo.RollNo, dbo.StudInfo.EntryFrom, dbo.StudInfo.StudDisplayFlag, dbo.StudInfo.FeesPaidFlag, dbo.StudInfo.MarksFeedFlag, 
                      dbo.TempAttendanceMonthly.A1, dbo.StudInfo.AadharNo, dbo.TempAttendanceMonthly.A2, dbo.TempAttendanceMonthly.A3, dbo.TempAttendanceMonthly.A4, dbo.TempAttendanceMonthly.A5, 
                      dbo.TempAttendanceMonthly.A6, dbo.TempAttendanceMonthly.A7, dbo.TempAttendanceMonthly.A8, dbo.TempAttendanceMonthly.A9, dbo.TempAttendanceMonthly.A10, 
                      dbo.TempAttendanceMonthly.A11, dbo.TempAttendanceMonthly.A12, dbo.TempAttendanceMonthly.A13, dbo.TempAttendanceMonthly.A14, dbo.TempAttendanceMonthly.A15, 
                      dbo.TempAttendanceMonthly.A16, dbo.TempAttendanceMonthly.A17, dbo.TempAttendanceMonthly.A18, dbo.TempAttendanceMonthly.A19, dbo.TempAttendanceMonthly.A20, 
                      dbo.TempAttendanceMonthly.A21, dbo.TempAttendanceMonthly.A22, dbo.TempAttendanceMonthly.A23, dbo.TempAttendanceMonthly.A24, dbo.TempAttendanceMonthly.A25, 
                      dbo.TempAttendanceMonthly.A26, dbo.TempAttendanceMonthly.A27, dbo.TempAttendanceMonthly.A28, dbo.TempAttendanceMonthly.A29, dbo.TempAttendanceMonthly.A30, 
                      dbo.TempAttendanceMonthly.A31, dbo.TempAttendanceMonthly.TotalWD, dbo.TempAttendanceMonthly.TotalPD, dbo.TempAttendanceMonthly.TotalPA, dbo.StudInfo.DeleteFlag
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfo.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.TempAttendanceMonthly ON dbo.StudInfo.RegID = dbo.TempAttendanceMonthly.RegID
WHERE     (dbo.StudInfo.DeleteFlag = N'N')
ORDER BY dbo.StudInfo.RegID DESC
GO
/****** Object:  View [dbo].[StudentExamAdmitCard]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[StudentExamAdmitCard]
AS
SELECT        TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, dbo.MediumMaster.MediumName AS Medium, 
                         dbo.ClassMaster.ClassNameEN AS ClassEN, dbo.DivisionMaster.DivisionNameEN AS DivEN, dbo.GenderMaster.GenderName AS Gender, dbo.GenderMaster.GenderShort, 
                         CASE StudInfo.LastName WHEN '-' THEN StudInfo.Firstname + ' ' + StudInfo.MiddleName ELSE StudInfo.Firstname + ' ' + StudInfo.MiddleName + ' ' + StudInfo.LastName END AS StudentName, 
                         CASE StudInfo.LastNameE WHEN '-' THEN StudInfo.FirstnameE + ' ' + StudInfo.MiddleNameE ELSE StudInfo.FirstnameE + ' ' + StudInfo.MiddleNameE + ' ' + StudInfo.LastNameE END AS StudentNameE, 
                         CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END AS Student, 
                         dbo.StudInfo.AadharNo, dbo.StudInfo.BankAcNo, dbo.StudInfo.AadharLinkBankStatus AS AadharLink, dbo.StudInfo.CloseFlag, dbo.StudInfo.AyCode, dbo.StudInfo.EntryFrom, dbo.StudInfo.AdmissionType, 
                         dbo.StudInfo.HostelStayFlag, dbo.StudInfo.ClassCode, dbo.ExamAdmitCard.SrNo, dbo.SubjectMaster.SubjectName, dbo.ExamAdmitCard.ExamDate, dbo.ExamMaster.ExamName, dbo.ExamAdmitCard.FromTime, 
                         dbo.ExamAdmitCard.ToTime, dbo.ExamAdmitCard.Note, dbo.ExamAdmitCard.Syllabus, dbo.StudInfo.RollNo, dbo.StudInfo.StudentID, dbo.StudInfo.NationalCode
FROM            dbo.MainClassMaster INNER JOIN
                         dbo.StudInfo INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                         dbo.GenderMaster ON dbo.StudInfo.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode ON dbo.MainClassMaster.MainClassCode = dbo.StudInfo.MainClassCode INNER JOIN
                         dbo.ExamAdmitCard ON dbo.ClassMaster.ClassCode = dbo.ExamAdmitCard.ClassCode AND dbo.DivisionMaster.DivisionCode = dbo.ExamAdmitCard.DivisionCode INNER JOIN
                         dbo.ExamMaster ON dbo.ExamAdmitCard.ExamCode = dbo.ExamMaster.ExamCode INNER JOIN
                         dbo.SubjectMaster ON dbo.ExamAdmitCard.SubjectCode = dbo.SubjectMaster.SubjectCode
ORDER BY dbo.GenderMaster.GenderShort, dbo.StudInfo.RegNo
GO
/****** Object:  View [dbo].[StudentGoshwaraReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[StudentGoshwaraReport]
AS
SELECT     dbo.StudentGoshwara.TDate, dbo.StudentGoshwara.ClassCode, dbo.StudentGoshwara.DivisionCode, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, 
                      dbo.MainClassMaster.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.StudentGoshwara.PreviousStudent, dbo.StudentGoshwara.NewAdmission, 
                      dbo.StudentGoshwara.TCIssueStudent, dbo.StudentGoshwara.Total1, dbo.StudentGoshwara.PresentBoys, dbo.StudentGoshwara.PresentGirls, dbo.StudentGoshwara.PresentTotal, 
                      dbo.StudentGoshwara.AbsentBoys, dbo.StudentGoshwara.AbsentGirls, dbo.StudentGoshwara.AbsentTotal, dbo.StudentGoshwara.TotalBoys, dbo.StudentGoshwara.TotalGirls, 
                      dbo.StudentGoshwara.Total2, dbo.StudentGoshwara.Percentage, dbo.ClassMaster.MainClassSubCode
FROM         dbo.StudentGoshwara INNER JOIN
                      dbo.ClassMaster ON dbo.StudentGoshwara.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.MainClassMaster ON dbo.ClassMaster.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudentGoshwara.DivisionCode = dbo.DivisionMaster.DivisionCode
GO
/****** Object:  View [dbo].[StudentNirgamUttaraReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[StudentNirgamUttaraReport]
AS
SELECT        TOP (100) PERCENT dbo.StudInfoAll.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, dbo.ClassMaster.ClassName AS Class, 
                         dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                         CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName END AS StudentName,
                          CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student, 
                         dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegID, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.StudentNirgamUtara.RecordNo, dbo.StudentNirgamUtara.TDate, 
                         dbo.GenderMaster.GenderName, dbo.StudInfoAll.RollNo, dbo.StudInfoAll.NationalCode
FROM            dbo.GenderMaster INNER JOIN
                         dbo.StudInfoAll INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.StudentNirgamUtara ON dbo.StudInfoAll.RegID = dbo.StudentNirgamUtara.RegID
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[StudentNoticeReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[StudentNoticeReport]
AS
SELECT     TOP (100) PERCENT dbo.StudentNotice.TID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.StudentNotice.RecordNo, dbo.StudentNotice.TDate, dbo.StudentNotice.RegID, 
                      dbo.ClassMaster.ClassName AS Class, dbo.StudInfoAll.RegNo, 
                      CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
                       CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.StudentNotice.ParentsReply, dbo.StudentNotice.CompleteNoticeFlag, dbo.StudentNotice.AyCode, dbo.StudentNoticeDetail.Srno, dbo.StudentNoticeDetail.NoticeName, 
                      dbo.StudInfoAll.FatherName, dbo.StudInfoAll.LocalAddress, dbo.StudInfoAll.PermanentAddress, dbo.StudInfoAll.MobileNo1, dbo.StudInfoAll.MobileNo2, dbo.DivisionMaster.DivisionName, 
                      dbo.MediumMaster.MediumName, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.StudInfoAll.ClassCode, dbo.StudInfoAll.RollNo
FROM         dbo.StudInfoAll INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.StudentNotice ON dbo.StudInfoAll.RegID = dbo.StudentNotice.RegID INNER JOIN
                      dbo.MainClassMaster ON dbo.StudentNotice.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.StudentNoticeDetail ON dbo.StudentNotice.TID = dbo.StudentNoticeDetail.TID INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode
ORDER BY dbo.StudentNotice.RecordNo DESC
GO
/****** Object:  View [dbo].[StudentSubjectReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[StudentSubjectReport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                      dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassNameEN AS ClassEN, dbo.DivisionMaster.DivisionNameEN AS DivEN, dbo.GenderMaster.GenderName AS Gender, 
                      dbo.GenderMaster.GenderShort, 
                      CASE StudInfo.LastName WHEN '-' THEN StudInfo.Firstname + ' ' + StudInfo.MiddleName ELSE StudInfo.Firstname + ' ' + StudInfo.MiddleName + ' ' + StudInfo.LastName END AS StudentName, 
                      CASE StudInfo.LastNameE WHEN '-' THEN StudInfo.FirstnameE + ' ' + StudInfo.MiddleNameE ELSE StudInfo.FirstnameE + ' ' + StudInfo.MiddleNameE + ' ' + StudInfo.LastNameE END AS StudentNameE,
                       CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.StudInfo.AadharNo, dbo.StudInfo.BankAcNo, dbo.StudInfo.AadharLinkBankStatus AS AadharLink, dbo.StudInfo.CloseFlag, dbo.StudInfo.AyCode, dbo.StudInfo.EntryFrom, 
                      dbo.StudInfo.AdmissionType, dbo.StudInfo.HostelStayFlag, dbo.StudInfo.ClassCode, dbo.SubjectGroupMaster.SubjectGroupName, dbo.SubjectMaster.SubjectName, 
                      dbo.SubjectMaster.SubjectNameShort, dbo.SubjectMaster.SubjectCodeBoard, dbo.SubjectMaster.SubjectCode, dbo.StudentSubjectDetails.SubjectGroupCode, dbo.StudInfo.RollNo
FROM         dbo.SubjectGroupMaster INNER JOIN
                      dbo.SubjectMaster INNER JOIN
                      dbo.StudentSubjectDetails INNER JOIN
                      dbo.MainClassMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfo.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode ON dbo.MainClassMaster.MainClassCode = dbo.StudInfo.MainClassCode ON 
                      dbo.StudentSubjectDetails.RegID = dbo.StudInfo.RegID ON dbo.SubjectMaster.SubjectCode = dbo.StudentSubjectDetails.SubjectCode ON 
                      dbo.SubjectGroupMaster.SubjectGroupCode = dbo.StudentSubjectDetails.SubjectGroupCode
ORDER BY dbo.GenderMaster.GenderShort, dbo.StudInfo.RegNo
GO
/****** Object:  View [dbo].[StudInfoAllReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[StudInfoAllReport]
AS
SELECT        TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.StudInfoAll.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                         dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                         CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName END AS StudentName,
                          CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student, 
                         dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.AdmittionDate, dbo.StudInfoAll.StudentID, dbo.StudInfoAll.AadharNo, 
                         dbo.StudInfoAll.Dob, dbo.StudInfoAll.DobInWord, dbo.CityMaster.CityName AS BirthPlace, dbo.TalukaMaster.TalukaName, dbo.DistrictMaster.DistrictName, dbo.StateMaster.StateName, dbo.CountryMaster.CountryName, 
                         dbo.CasteMaster.CasteName, dbo.StudInfoAll.SubCast, dbo.ReligionMaster.ReligionName, dbo.LanguageMaster.LanguageName AS MotherTounge, dbo.OtherSchoolMaster.OtherSchoolName AS PrevSchool, 
                         ClassMaster_2.ClassName AS PSClass, ClassMaster_3.ClassName AS ClassAT, DivisionMaster_1.DivisionName AS DivAT, dbo.StudInfoAll.MotherName, dbo.StudInfoAll.Age30Sept, dbo.StudInfoAll.PermanentAddress, 
                         dbo.StudInfoAll.LocalAddress, dbo.StudInfoAll.MobileNo1, dbo.StudInfoAll.MobileNo2, dbo.StudInfoAll.BloodGroup, dbo.StudInfoAll.PSTCNo, dbo.StudInfoAll.PSLeaveDate, dbo.StudInfoAll.FatherName, 
                         dbo.EducationMaster.EducationName AS FEducation, dbo.OccupationMaster.OccupationName AS FOccupation, dbo.StudInfoAll.FAnnualIncome, dbo.RelationMaster.RelationName, dbo.StudInfoAll.FormNo, 
                         dbo.CategoryMaster.CategoryName, dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.TSuspendedFlag, dbo.StudInfoAll.TSupendedDate, dbo.StudInfoAll.AdmissionType, dbo.StudInfoAll.MediumCode, dbo.StudInfoAll.ClassCode, 
                         dbo.GenderMaster.GenderName, dbo.StudInfoAll.Photpath, dbo.StudInfoAll.RollNo, dbo.FeeTypeMaster.FeeTypeName, CityMaster_1.CityName AS PerCity, CityMaster_2.CityName AS LocCity, dbo.AreaMaster.AreaName, 
                         LanguageMaster_1.LanguageName AS LanguageKnown, dbo.OtherSchoolMaster.Address AS PSAddress, dbo.OtherSchoolMaster.UDIESNo AS PSUDIESNo, dbo.StudInfoAll.PSResult, dbo.StudInfoAll.PSRegNo, 
                         dbo.TCSLRMaster.TCSLRName AS PSLeaveReason, EducationMaster_1.EducationName AS MEducation, OccupationMaster_1.OccupationName AS MOccupation, dbo.StudInfoAll.GaurdianName, dbo.BankMaster.BankName, 
                         dbo.BankMaster.IFSCCode, dbo.StudInfoAll.BankAcNo, dbo.StudInfoAll.BankAPersonName, dbo.StudInfoAll.PersonalIdentMark, dbo.StudInfoAll.EntryFrom, dbo.StudInfoAll.Remark, dbo.StudInfoAll.StudDisplayFlag, 
                         dbo.StudInfoAll.HandyCapStatus, dbo.StudInfoAll.BPLCardStatus, dbo.StudInfoAll.Nationality, dbo.StudInfoAll.ReligionCode, dbo.HandyCapMaster.HandyCapName, dbo.StudInfoAll.PPECompleteStatus, dbo.StudInfoAll.WeightFT, 
                         dbo.StudInfoAll.WeightST, dbo.StudInfoAll.HeightFT, dbo.StudInfoAll.HeightST, dbo.StudInfoAll.SeatNo, dbo.StudInfoAll.FirstnameE, dbo.StudInfoAll.MiddleNameE, dbo.StudInfoAll.LastNameE, dbo.StudInfoAll.AdmiSchoolType, 
                         dbo.StudInfoAll.MotherNameE, dbo.StudInfoAll.WeekPointDetail, dbo.StudInfoAll.LearningStopResion, dbo.StudInfoAll.PrePrimarySchoolName, dbo.StudInfoAll.GovermentOffer, dbo.StudInfoAll.AadharLinkBankStatus, 
                         dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.StudInfoAll.HostelStayFlag, dbo.StudInfoAll.MarksFeedFlag, dbo.StudInfoAll.FAadharCardNo, dbo.StudInfoAll.FPanCard, 
                         dbo.StudInfoAll.MAnnualIncome, dbo.StudInfoAll.MAadharCardNo, dbo.StudInfoAll.MPanCard, dbo.StudInfoAll.WhatsAppMobileNo, dbo.StudInfoAll.EmailID, dbo.StudInfoAll.FacebookID, dbo.StudInfoAll.InstragramID, 
                         dbo.StudInfoAll.TelegramID, dbo.StudInfoAll.TwitterID, dbo.StudInfoAll.Branch, dbo.StudInfoAll.MotherFatherAreAlive, dbo.StudInfoAll.EWSCertificateStatus, dbo.StudInfoAll.HandyCapPercentage, dbo.StudInfoAll.BPLCardNo, 
                         dbo.StudInfoAll.SubjectGroupCode, dbo.SubjectGroupMaster.SubjectGroupName, dbo.StudInfoAll.SubjectDetails, dbo.StudInfoAll.FeeTypeConcessionCode, dbo.FeeTypeConcessionMaster.FeeTypeConcessionName, 
                         dbo.StudInfoAll.DeleteFlag, dbo.StudInfoAll.NationalCode, dbo.StudInfoAll.ApaarID, dbo.StudInfoAll.StudentNameAadhar, dbo.StudInfoAll.AadharVerifiedFlag
FROM            dbo.GenderMaster INNER JOIN
                         dbo.StudInfoAll INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                         dbo.CityMaster ON dbo.StudInfoAll.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                         dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                         dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                         dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                         dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                         dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                         dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                         dbo.LanguageMaster ON dbo.StudInfoAll.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                         dbo.OtherSchoolMaster ON dbo.StudInfoAll.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                         dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfoAll.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                         dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfoAll.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                         dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfoAll.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.EducationMaster ON dbo.StudInfoAll.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                         dbo.OccupationMaster ON dbo.StudInfoAll.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                         dbo.RelationMaster ON dbo.StudInfoAll.RelationCode = dbo.RelationMaster.RelationCode INNER JOIN
                         dbo.CategoryMaster ON dbo.StudInfoAll.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                         dbo.FeeTypeMaster ON dbo.StudInfoAll.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                         dbo.CityMaster AS CityMaster_1 ON dbo.StudInfoAll.PerCitycode = CityMaster_1.CityCode INNER JOIN
                         dbo.CityMaster AS CityMaster_2 ON dbo.StudInfoAll.LocCitycode = CityMaster_2.CityCode INNER JOIN
                         dbo.AreaMaster ON dbo.StudInfoAll.AreaCode = dbo.AreaMaster.AreaCode INNER JOIN
                         dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfoAll.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
                         dbo.TCSLRMaster ON dbo.StudInfoAll.PSLeaveReasonCode = dbo.TCSLRMaster.TCSLRCode INNER JOIN
                         dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfoAll.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                         dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfoAll.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
                         dbo.BankMaster ON dbo.StudInfoAll.BankCode = dbo.BankMaster.BankCode INNER JOIN
                         dbo.HandyCapMaster ON dbo.StudInfoAll.HandyCapCode = dbo.HandyCapMaster.HandyCapCode INNER JOIN
                         dbo.FeeTypeConcessionMaster ON dbo.StudInfoAll.FeeTypeConcessionCode = dbo.FeeTypeConcessionMaster.FeeTypeConcessionCode LEFT OUTER JOIN
                         dbo.SubjectGroupMaster ON dbo.StudInfoAll.SubjectGroupCode = dbo.SubjectGroupMaster.SubjectGroupCode
WHERE        (dbo.StudInfoAll.DeleteFlag = N'N')
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[StudInfoReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[StudInfoReport]
AS
SELECT        TOP (100) PERCENT dbo.StudInfo.RegID, dbo.StudInfo.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                         dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                         CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END AS StudentName, 
                         CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END AS Student, 
                         dbo.StudInfo.Firstname, dbo.StudInfo.MiddleName, dbo.StudInfo.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfo.AyCode, dbo.StudInfo.AdmittionDate, dbo.StudInfo.StudentID, dbo.StudInfo.AadharNo, dbo.StudInfo.Dob, 
                         dbo.StudInfo.DobInWord, dbo.CityMaster.CityName AS BirthPlace, dbo.TalukaMaster.TalukaName, dbo.DistrictMaster.DistrictName, dbo.StateMaster.StateName, dbo.CountryMaster.CountryName, dbo.CasteMaster.CasteName, 
                         dbo.StudInfo.SubCast, dbo.ReligionMaster.ReligionName, dbo.LanguageMaster.LanguageName AS MotherTounge, dbo.OtherSchoolMaster.OtherSchoolName AS PrevSchool, ClassMaster_2.ClassName AS PSClass, 
                         ClassMaster_3.ClassName AS ClassAT, DivisionMaster_1.DivisionName AS DivAT, dbo.StudInfo.MotherName, dbo.StudInfo.Age30Sept, dbo.StudInfo.PermanentAddress, dbo.StudInfo.LocalAddress, dbo.StudInfo.MobileNo1, 
                         dbo.StudInfo.MobileNo2, dbo.StudInfo.BloodGroup, dbo.StudInfo.PSTCNo, dbo.StudInfo.PSLeaveDate, dbo.StudInfo.FatherName, dbo.EducationMaster.EducationName AS FEducation, 
                         dbo.OccupationMaster.OccupationName AS FOccupation, dbo.StudInfo.FAnnualIncome, dbo.RelationMaster.RelationName, dbo.StudInfo.FormNo, dbo.CategoryMaster.CategoryName, dbo.StudInfo.CloseFlag, 
                         dbo.StudInfo.TSuspendedFlag, dbo.StudInfo.TSupendedDate, dbo.StudInfo.AdmissionType, dbo.StudInfo.MediumCode, dbo.StudInfo.ClassCode, dbo.GenderMaster.GenderName, dbo.StudInfo.Photpath, dbo.StudInfo.RollNo, 
                         dbo.FeeTypeMaster.FeeTypeName, CityMaster_1.CityName AS PerCity, CityMaster_2.CityName AS LocCity, dbo.AreaMaster.AreaName, LanguageMaster_1.LanguageName AS LanguageKnown, 
                         dbo.OtherSchoolMaster.Address AS PSAddress, dbo.OtherSchoolMaster.UDIESNo AS PSUDIESNo, dbo.StudInfo.PSResult, dbo.StudInfo.PSRegNo, dbo.TCSLRMaster.TCSLRName AS PSLeaveReason, 
                         EducationMaster_1.EducationName AS MEducation, OccupationMaster_1.OccupationName AS MOccupation, dbo.StudInfo.GaurdianName, dbo.BankMaster.BankName, dbo.BankMaster.IFSCCode, dbo.StudInfo.BankAcNo, 
                         dbo.StudInfo.BankAPersonName, dbo.StudInfo.PersonalIdentMark, dbo.StudInfo.EntryFrom, dbo.StudInfo.Remark, dbo.StudInfo.StudDisplayFlag, dbo.StudInfo.FeesPaidFlag, dbo.StudInfo.MarksFeedFlag, 
                         dbo.StudInfo.HandyCapStatus, dbo.HandyCapMaster.HandyCapName, dbo.StudInfo.BPLCardStatus, dbo.StudInfo.PPECompleteStatus, dbo.StudInfo.WeightFT, dbo.StudInfo.WeightST, dbo.StudInfo.HeightFT, 
                         dbo.StudInfo.HeightST, dbo.StudInfo.SeatNo, dbo.StudInfo.AdmiSchoolType, dbo.StudInfo.ReligionCode, dbo.StudInfo.CategoryCode, dbo.StudInfo.Nationality, dbo.StudInfo.FirstnameE, dbo.StudInfo.MiddleNameE, 
                         dbo.StudInfo.LastNameE, dbo.StudInfo.MotherNameE, dbo.StudInfo.WeekPointDetail, dbo.StudInfo.LearningStopResion, dbo.StudInfo.PrePrimarySchoolName, dbo.StudInfo.GovermentOffer, dbo.StudInfo.AadharLinkBankStatus, 
                         dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.StudInfo.HostelStayFlag, dbo.StudInfo.DivisionCode, dbo.StudInfo.FAadharCardNo, dbo.StudInfo.FPanCard, dbo.StudInfo.MAnnualIncome, 
                         dbo.StudInfo.MAadharCardNo, dbo.StudInfo.MPanCard, dbo.StudInfo.WhatsAppMobileNo, dbo.StudInfo.EmailID, dbo.StudInfo.FacebookID, dbo.StudInfo.InstragramID, dbo.StudInfo.TwitterID, dbo.StudInfo.TelegramID, 
                         dbo.StudInfo.Branch, dbo.StudInfo.MotherFatherAreAlive, dbo.StudInfo.EWSCertificateStatus, dbo.StudInfo.HandyCapPercentage, dbo.StudInfo.BPLCardNo, dbo.StudInfo.ScholarshipEligibleStatus, dbo.StudInfo.ScholarshipCode, 
                         dbo.ScholarshipMaster.ScholarshipName, dbo.StudInfo.ScholarshipFormFeedStatus, dbo.StudInfo.Covid19Dose1Code, dbo.Covid19DoseMaster.Covid19DoseName AS Covid19Dose1, dbo.StudInfo.Covid19Dose1Date, 
                         dbo.StudInfo.Covid19Dose2Code, Covid19DoseMaster_1.Covid19DoseName AS Covid19Dose2, dbo.StudInfo.Covid19Dose2Date, dbo.StudInfo.Covid19BoosterDoseCode, 
                         Covid19DoseMaster_2.Covid19DoseName AS Covid19BoosterDose, dbo.StudInfo.Covid19BoosterDoseDate, dbo.StudInfo.SubjectGroupCode, dbo.SubjectGroupMaster.SubjectGroupName, dbo.StudInfo.SubjectDetails, 
                         dbo.StudInfo.FeeTypeConcessionCode, dbo.FeeTypeConcessionMaster.FeeTypeConcessionName, dbo.StudInfo.DeleteFlag, dbo.StudInfo.NationalCode, dbo.StudInfo.ApaarID, dbo.StudInfo.StudentNameAadhar, 
                         dbo.StudInfo.AadharVerifiedFlag
FROM            dbo.GenderMaster INNER JOIN
                         dbo.StudInfo INNER JOIN
                         dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                         dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                         dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                         dbo.CityMaster ON dbo.StudInfo.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                         dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                         dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                         dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                         dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                         dbo.CasteMaster ON dbo.StudInfo.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                         dbo.ReligionMaster ON dbo.StudInfo.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                         dbo.LanguageMaster ON dbo.StudInfo.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                         dbo.OtherSchoolMaster ON dbo.StudInfo.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                         dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfo.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                         dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfo.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                         dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfo.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                         dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                         dbo.EducationMaster ON dbo.StudInfo.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                         dbo.OccupationMaster ON dbo.StudInfo.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                         dbo.RelationMaster ON dbo.StudInfo.RelationCode = dbo.RelationMaster.RelationCode INNER JOIN
                         dbo.CategoryMaster ON dbo.StudInfo.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                         dbo.FeeTypeMaster ON dbo.StudInfo.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                         dbo.CityMaster AS CityMaster_1 ON dbo.StudInfo.PerCitycode = CityMaster_1.CityCode INNER JOIN
                         dbo.CityMaster AS CityMaster_2 ON dbo.StudInfo.LocCitycode = CityMaster_2.CityCode INNER JOIN
                         dbo.AreaMaster ON dbo.StudInfo.AreaCode = dbo.AreaMaster.AreaCode INNER JOIN
                         dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfo.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
                         dbo.TCSLRMaster ON dbo.StudInfo.PSLeaveReasonCode = dbo.TCSLRMaster.TCSLRCode INNER JOIN
                         dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfo.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                         dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfo.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
                         dbo.BankMaster ON dbo.StudInfo.BankCode = dbo.BankMaster.BankCode INNER JOIN
                         dbo.HandyCapMaster ON dbo.StudInfo.HandyCapCode = dbo.HandyCapMaster.HandyCapCode INNER JOIN
                         dbo.FeeTypeConcessionMaster ON dbo.StudInfo.FeeTypeConcessionCode = dbo.FeeTypeConcessionMaster.FeeTypeConcessionCode LEFT OUTER JOIN
                         dbo.SubjectGroupMaster ON dbo.StudInfo.SubjectGroupCode = dbo.SubjectGroupMaster.SubjectGroupCode LEFT OUTER JOIN
                         dbo.Covid19DoseMaster AS Covid19DoseMaster_2 ON dbo.StudInfo.Covid19BoosterDoseCode = Covid19DoseMaster_2.Covid19DoseCode LEFT OUTER JOIN
                         dbo.Covid19DoseMaster AS Covid19DoseMaster_1 ON dbo.StudInfo.Covid19Dose2Code = Covid19DoseMaster_1.Covid19DoseCode LEFT OUTER JOIN
                         dbo.Covid19DoseMaster ON dbo.StudInfo.Covid19Dose1Code = dbo.Covid19DoseMaster.Covid19DoseCode LEFT OUTER JOIN
                         dbo.ScholarshipMaster ON dbo.StudInfo.ScholarshipCode = dbo.ScholarshipMaster.ScholarshipCode
WHERE        (dbo.StudInfo.DeleteFlag = N'N')
ORDER BY dbo.StudInfo.RegID DESC
GO
/****** Object:  View [dbo].[StudinfoReportExcel]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[StudinfoReportExcel]
AS
SELECT     TOP (100) PERCENT dbo.StudInfo.RollNo, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassName AS Class, 
                      dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfo.RegNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.GenderMaster.GenderName AS Gender, dbo.GenderMaster.GenderShort, CONVERT(varchar, dbo.StudInfo.AdmittionDate, 106) AS AdmiDate, dbo.StudInfo.StudentID, 
                      dbo.StudInfo.AadharNo, CONVERT(varchar, dbo.StudInfo.Dob, 106) AS DOB, dbo.CityMaster.CityName AS BirthPlace, dbo.TalukaMaster.TalukaName, dbo.DistrictMaster.DistrictName, 
                      dbo.StateMaster.StateName, dbo.CountryMaster.CountryName, dbo.ReligionMaster.ReligionName, dbo.CasteMaster.CasteName, dbo.StudInfo.SubCast, dbo.CategoryMaster.CategoryName, 
                      dbo.StudInfo.PermanentAddress, CityMaster_1.CityName AS PerCity, dbo.StudInfo.LocalAddress, CityMaster_2.CityName AS LocCity, dbo.AreaMaster.AreaName, dbo.StudInfo.MobileNo1, 
                      dbo.StudInfo.MobileNo2, dbo.FeeTypeMaster.FeeTypeName AS FeeType, dbo.StudInfo.BloodGroup, dbo.LanguageMaster.LanguageName AS MotherTounge, 
                      LanguageMaster_1.LanguageName AS LanguageKnown, dbo.OtherSchoolMaster.OtherSchoolName AS PrevSchool, ClassMaster_2.ClassName AS PSClass, 
                      dbo.OtherSchoolMaster.UDIESNo AS PSUDIESNo, ClassMaster_3.ClassName AS AdmissionTimeClass, DivisionMaster_1.DivisionName AS AdmissionTimeDiv, dbo.StudInfo.FatherName, 
                      dbo.EducationMaster.EducationName AS FEducation, dbo.OccupationMaster.OccupationName AS FOccupation, dbo.StudInfo.FAnnualIncome, dbo.StudInfo.MotherName, 
                      EducationMaster_1.EducationName AS MEducation, OccupationMaster_1.OccupationName AS MOccupation, dbo.StudInfo.EntryFrom, dbo.StudInfo.AyCode, dbo.StudInfo.CloseFlag, 
                      dbo.StudInfo.AdmissionType, dbo.StudInfo.Age30Sept, dbo.StudInfo.DeleteFlag
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                      dbo.CityMaster ON dbo.StudInfo.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                      dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                      dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                      dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                      dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                      dbo.CasteMaster ON dbo.StudInfo.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                      dbo.ReligionMaster ON dbo.StudInfo.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                      dbo.LanguageMaster ON dbo.StudInfo.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                      dbo.OtherSchoolMaster ON dbo.StudInfo.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfo.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                      dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfo.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                      dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfo.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.EducationMaster ON dbo.StudInfo.FEducationCode = dbo.EducationMaster.EducationCode INNER JOIN
                      dbo.OccupationMaster ON dbo.StudInfo.FOccupationCode = dbo.OccupationMaster.OccupationCode INNER JOIN
                      dbo.RelationMaster ON dbo.StudInfo.RelationCode = dbo.RelationMaster.RelationCode INNER JOIN
                      dbo.CategoryMaster ON dbo.StudInfo.CategoryCode = dbo.CategoryMaster.CategoryCode INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfo.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.CityMaster AS CityMaster_1 ON dbo.StudInfo.PerCitycode = CityMaster_1.CityCode INNER JOIN
                      dbo.CityMaster AS CityMaster_2 ON dbo.StudInfo.LocCitycode = CityMaster_2.CityCode INNER JOIN
                      dbo.AreaMaster ON dbo.StudInfo.AreaCode = dbo.AreaMaster.AreaCode INNER JOIN
                      dbo.LanguageMaster AS LanguageMaster_1 ON dbo.StudInfo.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
                      dbo.TCSLRMaster ON dbo.StudInfo.PSLeaveReasonCode = dbo.TCSLRMaster.TCSLRCode INNER JOIN
                      dbo.EducationMaster AS EducationMaster_1 ON dbo.StudInfo.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
                      dbo.OccupationMaster AS OccupationMaster_1 ON dbo.StudInfo.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
                      dbo.BankMaster ON dbo.StudInfo.BankCode = dbo.BankMaster.BankCode
WHERE     (dbo.StudInfo.DeleteFlag = N'N')
GO
/****** Object:  View [dbo].[StudInfoReportYearly]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[StudInfoReportYearly]
AS
SELECT     TOP (100) PERCENT dbo.StudInfoYearly.RegID, dbo.StudInfoYearly.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, 
                      dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
                       END AS StudentName, 
                      CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.GenderMaster.GenderShort, dbo.StudInfoYearly.AyCode, dbo.StudInfoAll.AdmittionDate, 
                      dbo.StudInfoAll.StudentID, dbo.StudInfoAll.AadharNo, dbo.StudInfoAll.Dob, dbo.StudInfoAll.DobInWord, dbo.StudInfoAll.SubCast, dbo.StudInfoAll.MotherName, dbo.StudInfoAll.Age30Sept, 
                      dbo.StudInfoAll.PermanentAddress, dbo.StudInfoAll.LocalAddress, dbo.StudInfoAll.MobileNo1, dbo.StudInfoAll.MobileNo2, dbo.StudInfoAll.FatherName, dbo.StudInfoAll.FAnnualIncome, 
                      dbo.StudInfoAll.CloseFlag, dbo.StudInfoAll.TSuspendedFlag, dbo.StudInfoAll.TSupendedDate, dbo.StudInfoAll.AdmissionType, dbo.StudInfoYearly.MediumCode, dbo.StudInfoYearly.ClassCode, 
                      dbo.GenderMaster.GenderName, dbo.StudInfoAll.Photpath, dbo.StudInfoAll.RollNo, dbo.FeeTypeMaster.FeeTypeName, dbo.AreaMaster.AreaName, dbo.StudInfoAll.EntryFrom, 
                      dbo.StudInfoAll.Remark, dbo.StudInfoAll.StudDisplayFlag, dbo.StudInfoYearly.FeesPaidFlag, dbo.StudInfoAll.FirstnameE, dbo.StudInfoAll.MiddleNameE, dbo.StudInfoAll.LastNameE, 
                      dbo.StudInfoAll.MotherNameE, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.StudInfoYearly.DivisionCode, dbo.AyMaster.AyName, 
                      dbo.AyMaster.FeesOutstandingMaintainFlag, dbo.StudInfoAll.DeleteFlag
FROM         dbo.StudInfoAll INNER JOIN
                      dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.AreaMaster ON dbo.StudInfoAll.AreaCode = dbo.AreaMaster.AreaCode INNER JOIN
                      dbo.StudInfoYearly ON dbo.StudInfoAll.RegID = dbo.StudInfoYearly.RegID INNER JOIN
                      dbo.FeeTypeMaster ON dbo.StudInfoYearly.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoYearly.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoYearly.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoYearly.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoYearly.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.AyMaster ON dbo.StudInfoYearly.AyCode = dbo.AyMaster.AyCode
WHERE     (dbo.StudInfoAll.DeleteFlag = N'N')
ORDER BY dbo.StudInfoYearly.RegID DESC
GO
/****** Object:  View [dbo].[SubjectGroupDefineReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[SubjectGroupDefineReport]
AS
SELECT     dbo.SubjectGroupMaster.SubjectGroupCode, dbo.SubjectGroupMaster.SubjectGroupName, dbo.ClassMaster.ClassName, dbo.SubjectGroupDetail.SubjectCode, dbo.SubjectMaster.SubjectName, 
                      dbo.SubjectMaster.SubjectNameShort, dbo.MainClassMaster.MainClassCode, dbo.MainClassMaster.MainClassName, dbo.SubjectGroupClassDetail.ClassCode
FROM         dbo.SubjectGroupClassDetail INNER JOIN
                      dbo.MainClassMaster INNER JOIN
                      dbo.ClassMaster ON dbo.MainClassMaster.MainClassCode = dbo.ClassMaster.MainClassCode ON dbo.SubjectGroupClassDetail.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.SubjectGroupDetail INNER JOIN
                      dbo.SubjectGroupMaster ON dbo.SubjectGroupDetail.SubjectGroupCode = dbo.SubjectGroupMaster.SubjectGroupCode INNER JOIN
                      dbo.SubjectMaster ON dbo.SubjectGroupDetail.SubjectCode = dbo.SubjectMaster.SubjectCode ON dbo.SubjectGroupClassDetail.SubjectGroupCode = dbo.SubjectGroupMaster.SubjectGroupCode
GO
/****** Object:  View [dbo].[TCApplicationReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[TCApplicationReport]
AS
SELECT     TOP (100) PERCENT dbo.TCApplication.TID, dbo.TCApplication.MainClassCode, dbo.TCApplication.RecordNo, dbo.TCApplication.TDate, dbo.TCApplication.StudentName, 
                      dbo.ClassMaster.ClassName, dbo.GenderMaster.GenderName, dbo.TCApplication.UserCode, dbo.TCApplication.AyCode, dbo.GenderMaster.GenderShort, 
                      dbo.OtherSchoolMaster.OtherSchoolName AS PreviousSchool, dbo.OtherSchoolMaster.UDIESNo, dbo.MainClassMaster.MobileNo, dbo.MainClassMaster.PhoneNo, 
                      dbo.MainClassMaster.HeadMaster, dbo.MainClassMaster.EmailID, dbo.MainClassMaster.SchoolMedium, dbo.OtherSchoolMaster.Address, dbo.MainClassMaster.LogoPath, 
                      dbo.MainClassMaster.LetterHeadPath
FROM         dbo.TCApplication INNER JOIN
                      dbo.ClassMaster ON dbo.TCApplication.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.GenderMaster ON dbo.TCApplication.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                      dbo.OtherSchoolMaster ON dbo.TCApplication.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                      dbo.MainClassMaster ON dbo.TCApplication.MainClassCode = dbo.MainClassMaster.MainClassCode
GO
/****** Object:  View [dbo].[TCPAllReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[TCPAllReport]
AS
SELECT TOP (100) PERCENT dbo.StudInfoAll.RegID, dbo.StudInfoAll.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.MediumMaster.MediumName AS Medium, dbo.ClassMaster.ClassCode, 
                  dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName END AS StudentName, 
                  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student, 
                  dbo.StudInfoAll.Firstname, dbo.StudInfoAll.MiddleName, dbo.StudInfoAll.LastName, dbo.StudInfoAll.MotherName, dbo.GenderMaster.GenderShort, dbo.StudInfoAll.AyCode, dbo.StudInfoAll.AdmittionDate, dbo.StudInfoAll.StudentID, 
                  dbo.StudInfoAll.AadharNo, dbo.StudInfoAll.Dob, dbo.StudInfoAll.DobInWord, dbo.CityMaster.CityName AS BirthPlace, dbo.TalukaMaster.TalukaName, dbo.DistrictMaster.DistrictName, dbo.StateMaster.StateName, 
                  dbo.CountryMaster.CountryName, dbo.CasteMaster.CasteName, dbo.StudInfoAll.SubCast, dbo.ReligionMaster.ReligionName, dbo.LanguageMaster.LanguageName AS MotherTounge, 
                  dbo.OtherSchoolMaster.OtherSchoolName AS PrevSchool, ClassMaster_2.ClassName AS PSClass, ClassMaster_3.ClassName AS ClassAT, DivisionMaster_1.DivisionName AS DivAT, dbo.TCPrintAll.TCID, dbo.TCPrintAll.TCCode, 
                  dbo.TCPrintAll.TCNo, dbo.TCPrintAll.TCDate, dbo.TCPrintAll.ReportDate, dbo.StudInfoAll.Nationality, dbo.TCPrintAll.TCStatus, dbo.TCPrintAll.TCBehavior, ClassMaster_1.ClassName AS TeachingClass, 
                  ClassMaster_1.ClassNameEN AS TeachingClassEN, ClassMaster_1.ClassNameInWord AS TeachingClassInWord, dbo.TCPrintAll.TeachingYear, dbo.TCPrintAll.TeachingYearText, dbo.TCPrintAll.TeachingYearInWord, 
                  dbo.TCPrintAll.NextClassPromote, dbo.TCPrintAll.SeatNo, dbo.TCPrintAll.SLeaveReason, dbo.TCPrintAll.TCRemark, dbo.TCPrintTypeMaster.TCReportTypeCode, dbo.TCPrintTypeMaster.TCReportTypeName, 
                  dbo.TCPrintTypeMaster.TCPrintFlag, dbo.MainClassMaster.LogoPath, dbo.MainClassMaster.LetterHeadPath, dbo.TCPrintAll.ApplicationDate, dbo.TCPrintAll.ClassAndYear, dbo.TCPrintAll.FeesAndDues, dbo.TCPrintAll.LastExamResult, 
                  dbo.TCPrintAll.ScheduleCast, dbo.TCPrintAll.FailedStatus, dbo.TCPrintAll.FeeConcession, dbo.TCPrintAll.TWorkingDay, dbo.TCPrintAll.TPrsentDay, dbo.TCPrintAll.NCCCaded, dbo.TCPrintAll.SubjectsStudied, 
                  dbo.TCPrintAll.OptionalSubject, dbo.TCPrintAll.TCRPersonName, dbo.TCPrintAll.TCRPersonRelation, dbo.TCPrintTypeMaster.LetterHeadFlag, dbo.FeeTypeMaster.FeeTypeName, dbo.StudInfoAll.FeeTypeConcessionCode, 
                  dbo.FeeTypeConcessionMaster.FeeTypeConcessionName, dbo.TCPrintAll.DeleteFlag, dbo.TCPrintAll.M1, dbo.TCPrintAll.M2, dbo.TCPrintAll.M3, dbo.TCPrintAll.M4, dbo.TCPrintAll.M5, dbo.TCPrintAll.M6, dbo.TCPrintAll.M7, dbo.TCPrintAll.M8, 
                  dbo.TCPrintAll.Examination, dbo.TCPrintAll.ExamYear, dbo.TCPrintAll.ExamResult, dbo.TCPrintAll.SubjectDegreeCource, dbo.TCPrintAll.Specilization, dbo.TCPrintAll.ContinuedClass, dbo.ClassMaster.ClassNameEN, 
                  dbo.ClassMaster.ClassNameInWord, dbo.StudInfoAll.RollNo, dbo.StudInfoAll.FatherName, dbo.StudInfoAll.NationalCode, dbo.StudInfoAll.FirstnameE, dbo.StudInfoAll.MiddleNameE, dbo.StudInfoAll.LastNameE, 
                  dbo.StudInfoAll.MotherNameE, dbo.StudInfoAll.ApaarID, dbo.StudInfoAll.StudentNameAadhar, dbo.StudInfoAll.AadharVerifiedFlag, dbo.DivisionMaster.DivisionNameEN AS DivEN, DivisionMaster_1.DivisionNameEN AS DivATEN, 
                  dbo.CategoryMaster.CategoryName, dbo.CategoryMaster.CategoryNameEN
FROM     dbo.GenderMaster INNER JOIN
                  dbo.StudInfoAll INNER JOIN
                  dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                  dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                  dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                  dbo.CityMaster ON dbo.StudInfoAll.BirthPlaceCode = dbo.CityMaster.CityCode INNER JOIN
                  dbo.TalukaMaster ON dbo.CityMaster.TalukaCode = dbo.TalukaMaster.Talukacode INNER JOIN
                  dbo.DistrictMaster ON dbo.TalukaMaster.DistrictCode = dbo.DistrictMaster.DistrictCode INNER JOIN
                  dbo.StateMaster ON dbo.DistrictMaster.StateCode = dbo.StateMaster.StateCode INNER JOIN
                  dbo.CountryMaster ON dbo.StateMaster.CountryCode = dbo.CountryMaster.CountryCode INNER JOIN
                  dbo.CasteMaster ON dbo.StudInfoAll.CastCode = dbo.CasteMaster.CasteCode INNER JOIN
                  dbo.ReligionMaster ON dbo.StudInfoAll.ReligionCode = dbo.ReligionMaster.ReligionCode INNER JOIN
                  dbo.LanguageMaster ON dbo.StudInfoAll.MotherTongueCode = dbo.LanguageMaster.LanguageCode INNER JOIN
                  dbo.OtherSchoolMaster ON dbo.StudInfoAll.PSCode = dbo.OtherSchoolMaster.OtherSchoolCode INNER JOIN
                  dbo.ClassMaster AS ClassMaster_2 ON dbo.StudInfoAll.PSClassCode = ClassMaster_2.ClassCode INNER JOIN
                  dbo.ClassMaster AS ClassMaster_3 ON dbo.StudInfoAll.ClassCodeAT = ClassMaster_3.ClassCode INNER JOIN
                  dbo.DivisionMaster AS DivisionMaster_1 ON dbo.StudInfoAll.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
                  dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                  dbo.TCPrintAll ON dbo.StudInfoAll.RegID = dbo.TCPrintAll.RegID INNER JOIN
                  dbo.ClassMaster AS ClassMaster_1 ON dbo.TCPrintAll.TeachingClassCode = ClassMaster_1.ClassCode INNER JOIN
                  dbo.TempTCPrintRecord ON dbo.TCPrintAll.TCID = dbo.TempTCPrintRecord.TCTID INNER JOIN
                  dbo.FeeTypeMaster ON dbo.StudInfoAll.FeeTypeCode = dbo.FeeTypeMaster.FeeTypeCode INNER JOIN
                  dbo.FeeTypeConcessionMaster ON dbo.StudInfoAll.FeeTypeConcessionCode = dbo.FeeTypeConcessionMaster.FeeTypeConcessionCode INNER JOIN
                  dbo.CategoryMaster ON dbo.StudInfoAll.CategoryCode = dbo.CategoryMaster.CategoryCode CROSS JOIN
                  dbo.TCPrintTypeMaster
WHERE  (dbo.TCPrintTypeMaster.TCPrintFlag = N'Y') AND (dbo.TCPrintAll.DeleteFlag = N'N')
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[TCRecordImport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[TCRecordImport]
AS
SELECT     TOP (100) PERCENT dbo.MainClassMaster.MainClassName AS MainClass, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegID, 
                      dbo.StudInfoAll.RegNo, 
                      CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
                       CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName
                       END AS Student, dbo.GenderMaster.GenderShort, dbo.TCPrintImport.TCCode, dbo.TCPrintImport.TCNo, dbo.TCPrintImport.TCDate, dbo.TCPrintImport.ApplicationDate, dbo.TCPrintImport.ReportDate, 
                      dbo.TCPrintImport.TeachingClassCode, ClassMaster_1.ClassName AS TClass, dbo.TCPrintImport.SeatNo, dbo.TCPrintImport.AyCode, dbo.TCPrintImport.Nationality, dbo.TCPrintImport.TCStatus, 
                      dbo.TCPrintImport.TCBehavior, dbo.TCPrintImport.TeachingYear, dbo.TCPrintImport.NextClassPromote AS Promote, dbo.TCPrintImport.SLeaveReason, dbo.TCPrintImport.TCRemark, 
                      dbo.TCPrintImport.ClassAndYear, dbo.TCPrintImport.FirstClassName, dbo.StudInfoAll.RollNo
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfoAll.GenderCode INNER JOIN
                      dbo.TCPrintImport ON dbo.StudInfoAll.MainClassCode = dbo.TCPrintImport.MainClassCode AND dbo.StudInfoAll.RegNo = dbo.TCPrintImport.RegNo INNER JOIN
                      dbo.ClassMaster AS ClassMaster_1 ON dbo.TCPrintImport.TeachingClassCode = ClassMaster_1.ClassCode
ORDER BY dbo.StudInfoAll.RegID DESC
GO
/****** Object:  View [dbo].[TempAllFeesReceipt]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[TempAllFeesReceipt]
AS
SELECT     TOP (100) PERCENT dbo.TempAllFeesCollection.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.TempAllFeesCollection.FeeCategoryCode, 
                      dbo.FeeCategoryMaster.FeeCategoryName, dbo.TempAllFeesCollection.RegNo, dbo.TempAllFeesCollection.ClassCode, dbo.ClassMaster.ClassName AS Class, 
                      dbo.TempAllFeesCollection.StudentName, dbo.TempAllFeesCollection.ReceiptTID, dbo.TempAllFeesCollection.ReceiptNo, dbo.TempAllFeesCollection.ReceiptDate, 
                      dbo.TempAllFeesCollection.TotalFeesAmount, dbo.TempAllFeesCollection.TotalDiscount, dbo.TempAllFeesCollection.CancelReceiptAmt, dbo.TempAllFeesCollection.Remark, 
                      dbo.TempAllFeesCollection.CancelReceiptFlag, dbo.TempAllFeesCollection.PaymentTypeCode, dbo.PaymentTypeMaster.PaymentTypeName, dbo.TempAllFeesCollection.BankName, 
                      dbo.TempAllFeesCollection.ChequeNo, dbo.TempAllFeesCollection.ChequeDate, dbo.TempAllFeesCollection.UserCode, dbo.UserMaster.UserName, dbo.TempAllFeesCollection.Div, 
                      dbo.TempAllFeesCollection.FeeType, dbo.MainClassMaster.MainClassGroupCode, dbo.MainClassGroupMaster.MainClassGroupName, dbo.MainClassGroupMaster.MainClassGroupNameShort, 
                      dbo.TempAllFeesCollection.FeeTitleOtherGroupName, dbo.TempAllFeesCollection.AyCode, dbo.AyMaster.AyName, dbo.TempAllFeesCollection.FyCode, dbo.FyMaster.FyName, 
                      dbo.UserMaster.FeesCounterName, dbo.TempAllFeesCollection.FeeTitleOtherMainGroupName
FROM         dbo.PaymentTypeMaster INNER JOIN
                      dbo.MainClassMaster INNER JOIN
                      dbo.TempAllFeesCollection ON dbo.MainClassMaster.MainClassCode = dbo.TempAllFeesCollection.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.TempAllFeesCollection.ClassCode = dbo.ClassMaster.ClassCode ON 
                      dbo.PaymentTypeMaster.PaymentTypeCode = dbo.TempAllFeesCollection.PaymentTypeCode INNER JOIN
                      dbo.FeeCategoryMaster ON dbo.TempAllFeesCollection.FeeCategoryCode = dbo.FeeCategoryMaster.FeeCategoryCode INNER JOIN
                      dbo.UserMaster ON dbo.TempAllFeesCollection.UserCode = dbo.UserMaster.UserCode INNER JOIN
                      dbo.MainClassGroupMaster ON dbo.MainClassMaster.MainClassGroupCode = dbo.MainClassGroupMaster.MainClassGroupCode INNER JOIN
                      dbo.AyMaster ON dbo.TempAllFeesCollection.AyCode = dbo.AyMaster.AyCode INNER JOIN
                      dbo.FyMaster ON dbo.TempAllFeesCollection.FyCode = dbo.FyMaster.FyCode
GO
/****** Object:  View [dbo].[TempAllFeesReceiptReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[TempAllFeesReceiptReport]
AS
SELECT     TOP (100) PERCENT dbo.TempAllFeesCollection.MainClassCode, dbo.MainClassMaster.MainClassName AS MainClass, dbo.TempAllFeesCollection.FeeCategoryCode, 
                      dbo.FeeCategoryMaster.FeeCategoryName, dbo.TempAllFeesCollection.RegNo, dbo.TempAllFeesCollection.ClassCode, dbo.ClassMaster.ClassName AS Class, 
                      dbo.TempAllFeesCollection.StudentName, dbo.TempAllFeesCollection.ReceiptTID, dbo.TempAllFeesCollection.ReceiptNo, dbo.TempAllFeesCollection.ReceiptDate, 
                      dbo.TempAllFeesCollection.TotalFeesAmount, dbo.TempAllFeesCollection.TotalDiscount, dbo.TempAllFeesCollection.CancelReceiptAmt, dbo.TempAllFeesCollection.Remark, 
                      dbo.TempAllFeesCollection.CancelReceiptFlag, dbo.TempAllFeesCollection.PaymentTypeCode, dbo.PaymentTypeMaster.PaymentTypeName, dbo.TempAllFeesCollection.BankName, 
                      dbo.TempAllFeesCollection.ChequeNo, dbo.TempAllFeesCollection.ChequeDate, dbo.TempAllFeesCollection.UserCode, dbo.UserMaster.UserName, dbo.TempAllFeesCollectionDetail.SrNo, 
                      dbo.TempAllFeesCollectionDetail.FeeTitleName, dbo.TempAllFeesCollectionDetail.FeesAmount, dbo.TempAllFeesCollectionDetail.FeesDiscount, dbo.TempAllFeesCollection.Div, 
                      dbo.TempAllFeesCollection.FeeType, dbo.MainClassMaster.MainClassGroupCode, dbo.MainClassGroupMaster.MainClassGroupName, dbo.MainClassGroupMaster.MainClassGroupNameShort, 
                      dbo.TempAllFeesCollection.FeeTitleOtherGroupName, dbo.TempAllFeesCollection.AyCode, dbo.AyMaster.AyName, dbo.TempAllFeesCollection.FyCode, dbo.FyMaster.FyName, 
                      dbo.UserMaster.FeesCounterName, dbo.TempAllFeesCollection.FeeTitleOtherMainGroupName
FROM         dbo.TempAllFeesCollectionDetail INNER JOIN
                      dbo.PaymentTypeMaster INNER JOIN
                      dbo.MainClassMaster INNER JOIN
                      dbo.TempAllFeesCollection ON dbo.MainClassMaster.MainClassCode = dbo.TempAllFeesCollection.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.TempAllFeesCollection.ClassCode = dbo.ClassMaster.ClassCode ON dbo.PaymentTypeMaster.PaymentTypeCode = dbo.TempAllFeesCollection.PaymentTypeCode ON 
                      dbo.TempAllFeesCollectionDetail.MainClassCode = dbo.TempAllFeesCollection.MainClassCode AND 
                      dbo.TempAllFeesCollectionDetail.FeeCategoryCode = dbo.TempAllFeesCollection.FeeCategoryCode AND 
                      dbo.TempAllFeesCollectionDetail.ReceiptTID = dbo.TempAllFeesCollection.ReceiptTID INNER JOIN
                      dbo.FeeCategoryMaster ON dbo.TempAllFeesCollection.FeeCategoryCode = dbo.FeeCategoryMaster.FeeCategoryCode INNER JOIN
                      dbo.UserMaster ON dbo.TempAllFeesCollection.UserCode = dbo.UserMaster.UserCode INNER JOIN
                      dbo.MainClassGroupMaster ON dbo.MainClassMaster.MainClassGroupCode = dbo.MainClassGroupMaster.MainClassGroupCode INNER JOIN
                      dbo.AyMaster ON dbo.TempAllFeesCollection.AyCode = dbo.AyMaster.AyCode INNER JOIN
                      dbo.FyMaster ON dbo.TempAllFeesCollection.FyCode = dbo.FyMaster.FyCode
GO
/****** Object:  View [dbo].[TempExamSankalitExcelReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[TempExamSankalitExcelReport]
AS
SELECT     TOP (100) PERCENT dbo.StudInfo.RegNo, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
                       AS StudentName, 
                      CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.LastName + ' ' + dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName END
                       AS Student, dbo.GenderMaster.GenderShort, dbo.TempExamAnnualMMHorizontal.SN1, dbo.TempExamAnnualMMHorizontal.S1MD1, dbo.TempExamAnnualMMHorizontal.S1MD2, 
                      dbo.TempExamAnnualMMHorizontal.S1MD3, dbo.TempExamAnnualMMHorizontal.S1M1, dbo.TempExamAnnualMMHorizontal.S1M2, dbo.TempExamAnnualMMHorizontal.S1M3, 
                      dbo.TempExamAnnualMMHorizontal.S1MDT, dbo.TempExamAnnualMMHorizontal.S1MT, dbo.TempExamAnnualMMHorizontal.S1Per, dbo.TempExamAnnualMMHorizontal.S1Grade, 
                      dbo.TempExamAnnualMMHorizontal.SN2, dbo.TempExamAnnualMMHorizontal.S2MD1, dbo.TempExamAnnualMMHorizontal.S2MD2, dbo.TempExamAnnualMMHorizontal.S2MD3, 
                      dbo.TempExamAnnualMMHorizontal.S2M1, dbo.TempExamAnnualMMHorizontal.S2M2, dbo.TempExamAnnualMMHorizontal.S2M3, dbo.TempExamAnnualMMHorizontal.S2MDT, 
                      dbo.TempExamAnnualMMHorizontal.S2MT, dbo.TempExamAnnualMMHorizontal.S2Per, dbo.TempExamAnnualMMHorizontal.S2Grade, dbo.TempExamAnnualMMHorizontal.SN3, 
                      dbo.TempExamAnnualMMHorizontal.S3MD1, dbo.TempExamAnnualMMHorizontal.S3MD2, dbo.TempExamAnnualMMHorizontal.S3MD3, dbo.TempExamAnnualMMHorizontal.S3M1, 
                      dbo.TempExamAnnualMMHorizontal.S3M2, dbo.TempExamAnnualMMHorizontal.S3M3, dbo.TempExamAnnualMMHorizontal.S3MDT, dbo.TempExamAnnualMMHorizontal.S3MT, 
                      dbo.TempExamAnnualMMHorizontal.S3Per, dbo.TempExamAnnualMMHorizontal.S3Grade, dbo.TempExamAnnualMMHorizontal.SN4, dbo.TempExamAnnualMMHorizontal.S4MD1, 
                      dbo.TempExamAnnualMMHorizontal.S4MD2, dbo.TempExamAnnualMMHorizontal.S4MD3, dbo.TempExamAnnualMMHorizontal.S4M1, dbo.TempExamAnnualMMHorizontal.S4M2, 
                      dbo.TempExamAnnualMMHorizontal.S4M3, dbo.TempExamAnnualMMHorizontal.S4MDT, dbo.TempExamAnnualMMHorizontal.S4MT, dbo.TempExamAnnualMMHorizontal.S4Per, 
                      dbo.TempExamAnnualMMHorizontal.S4Grade, dbo.TempExamAnnualMMHorizontal.SN5, dbo.TempExamAnnualMMHorizontal.S5MD1, dbo.TempExamAnnualMMHorizontal.S5MD2, 
                      dbo.TempExamAnnualMMHorizontal.S5MD3, dbo.TempExamAnnualMMHorizontal.S5M1, dbo.TempExamAnnualMMHorizontal.S5M2, dbo.TempExamAnnualMMHorizontal.S5M3, 
                      dbo.TempExamAnnualMMHorizontal.S5MDT, dbo.TempExamAnnualMMHorizontal.S5MT, dbo.TempExamAnnualMMHorizontal.S5Per, dbo.TempExamAnnualMMHorizontal.S5Grade, 
                      dbo.TempExamAnnualMMHorizontal.SN6, dbo.TempExamAnnualMMHorizontal.S6MD1, dbo.TempExamAnnualMMHorizontal.S6MD2, dbo.TempExamAnnualMMHorizontal.S6MD3, 
                      dbo.TempExamAnnualMMHorizontal.S6M1, dbo.TempExamAnnualMMHorizontal.S6M2, dbo.TempExamAnnualMMHorizontal.S6M3, dbo.TempExamAnnualMMHorizontal.S6MDT, 
                      dbo.TempExamAnnualMMHorizontal.S6MT, dbo.TempExamAnnualMMHorizontal.S6Per, dbo.TempExamAnnualMMHorizontal.S6Grade, dbo.TempExamAnnualMMHorizontal.SN7, 
                      dbo.TempExamAnnualMMHorizontal.S7MD1, dbo.TempExamAnnualMMHorizontal.S7MD2, dbo.TempExamAnnualMMHorizontal.S7MD3, dbo.TempExamAnnualMMHorizontal.S7M1, 
                      dbo.TempExamAnnualMMHorizontal.S7M2, dbo.TempExamAnnualMMHorizontal.S7M3, dbo.TempExamAnnualMMHorizontal.S7MDT, dbo.TempExamAnnualMMHorizontal.S7MT, 
                      dbo.TempExamAnnualMMHorizontal.S7Per, dbo.TempExamAnnualMMHorizontal.S7Grade, dbo.TempExamAnnualMMHorizontal.SN8, dbo.TempExamAnnualMMHorizontal.S8MD1, 
                      dbo.TempExamAnnualMMHorizontal.S8MD2, dbo.TempExamAnnualMMHorizontal.S8MD3, dbo.TempExamAnnualMMHorizontal.S8M1, dbo.TempExamAnnualMMHorizontal.S8M2, 
                      dbo.TempExamAnnualMMHorizontal.S8M3, dbo.TempExamAnnualMMHorizontal.S8MDT, dbo.TempExamAnnualMMHorizontal.S8MT, dbo.TempExamAnnualMMHorizontal.S8Per, 
                      dbo.TempExamAnnualMMHorizontal.S8Grade, dbo.TempExamAnnualMMHorizontal.SN9, dbo.TempExamAnnualMMHorizontal.S9MD1, dbo.TempExamAnnualMMHorizontal.S9MD2, 
                      dbo.TempExamAnnualMMHorizontal.S9MD3, dbo.TempExamAnnualMMHorizontal.S9M1, dbo.TempExamAnnualMMHorizontal.S9M2, dbo.TempExamAnnualMMHorizontal.S9M3, 
                      dbo.TempExamAnnualMMHorizontal.S9MDT, dbo.TempExamAnnualMMHorizontal.S9MT, dbo.TempExamAnnualMMHorizontal.S9Per, dbo.TempExamAnnualMMHorizontal.S9Grade, 
                      dbo.TempExamAnnualMMHorizontal.SN10, dbo.TempExamAnnualMMHorizontal.S10MD1, dbo.TempExamAnnualMMHorizontal.S10MD2, dbo.TempExamAnnualMMHorizontal.S10MD3, 
                      dbo.TempExamAnnualMMHorizontal.S10M1, dbo.TempExamAnnualMMHorizontal.S10M2, dbo.TempExamAnnualMMHorizontal.S10M3, dbo.TempExamAnnualMMHorizontal.S10MDT, 
                      dbo.TempExamAnnualMMHorizontal.S10MT, dbo.TempExamAnnualMMHorizontal.S10Per, dbo.TempExamAnnualMMHorizontal.S10Grade, dbo.TempExamAnnualMMHorizontal.SN11, 
                      dbo.TempExamAnnualMMHorizontal.S11MD1, dbo.TempExamAnnualMMHorizontal.S11MD2, dbo.TempExamAnnualMMHorizontal.S11MD3, dbo.TempExamAnnualMMHorizontal.S11M1, 
                      dbo.TempExamAnnualMMHorizontal.S11M2, dbo.TempExamAnnualMMHorizontal.S11M3, dbo.TempExamAnnualMMHorizontal.S11MDT, dbo.TempExamAnnualMMHorizontal.S11MT, 
                      dbo.TempExamAnnualMMHorizontal.S11Per, dbo.TempExamAnnualMMHorizontal.S11Grade, dbo.TempExamAnnualMMHorizontal.SN12, dbo.TempExamAnnualMMHorizontal.S12MD1, 
                      dbo.TempExamAnnualMMHorizontal.S12MD2, dbo.TempExamAnnualMMHorizontal.S12MD3, dbo.TempExamAnnualMMHorizontal.S12M1, dbo.TempExamAnnualMMHorizontal.S12M2, 
                      dbo.TempExamAnnualMMHorizontal.S12M3, dbo.TempExamAnnualMMHorizontal.S12MDT, dbo.TempExamAnnualMMHorizontal.S12MT, dbo.TempExamAnnualMMHorizontal.S12Per, 
                      dbo.TempExamAnnualMMHorizontal.S12Grade, dbo.TempExamAnnualMMHorizontal.SN13, dbo.TempExamAnnualMMHorizontal.S13MD1, dbo.TempExamAnnualMMHorizontal.S13MD2, 
                      dbo.TempExamAnnualMMHorizontal.S13MD3, dbo.TempExamAnnualMMHorizontal.S13M1, dbo.TempExamAnnualMMHorizontal.S13M2, dbo.TempExamAnnualMMHorizontal.S13M3, 
                      dbo.TempExamAnnualMMHorizontal.S13MDT, dbo.TempExamAnnualMMHorizontal.S13MT, dbo.TempExamAnnualMMHorizontal.S13Per, dbo.TempExamAnnualMMHorizontal.S13Grade, 
                      dbo.TempExamAnnualMMHorizontal.SN14, dbo.TempExamAnnualMMHorizontal.S14MD1, dbo.TempExamAnnualMMHorizontal.S14MD2, dbo.TempExamAnnualMMHorizontal.S14MD3, 
                      dbo.TempExamAnnualMMHorizontal.S14M1, dbo.TempExamAnnualMMHorizontal.S14M2, dbo.TempExamAnnualMMHorizontal.S14M3, dbo.TempExamAnnualMMHorizontal.S14MDT, 
                      dbo.TempExamAnnualMMHorizontal.S14MT, dbo.TempExamAnnualMMHorizontal.S14Per, dbo.TempExamAnnualMMHorizontal.S14Grade, dbo.TempExamAnnualMMHorizontal.SN15, 
                      dbo.TempExamAnnualMMHorizontal.S15MD1, dbo.TempExamAnnualMMHorizontal.S15MD2, dbo.TempExamAnnualMMHorizontal.S15MD3, dbo.TempExamAnnualMMHorizontal.S15M1, 
                      dbo.TempExamAnnualMMHorizontal.S15M2, dbo.TempExamAnnualMMHorizontal.S15M3, dbo.TempExamAnnualMMHorizontal.S15MDT, dbo.TempExamAnnualMMHorizontal.S15MT, 
                      dbo.TempExamAnnualMMHorizontal.S15Per, dbo.TempExamAnnualMMHorizontal.S15Grade, dbo.TempExamAnnualMMHorizontal.SN16, dbo.TempExamAnnualMMHorizontal.S16MD1, 
                      dbo.TempExamAnnualMMHorizontal.S16MD2, dbo.TempExamAnnualMMHorizontal.S16MD3, dbo.TempExamAnnualMMHorizontal.S16M1, dbo.TempExamAnnualMMHorizontal.S16M2, 
                      dbo.TempExamAnnualMMHorizontal.S16M3, dbo.TempExamAnnualMMHorizontal.S16MDT, dbo.TempExamAnnualMMHorizontal.S16MT, dbo.TempExamAnnualMMHorizontal.S16Per, 
                      dbo.TempExamAnnualMMHorizontal.S16Grade, dbo.TempExamAnnualMMHorizontal.SN17, dbo.TempExamAnnualMMHorizontal.S17MD1, dbo.TempExamAnnualMMHorizontal.S17MD2, 
                      dbo.TempExamAnnualMMHorizontal.S17MD3, dbo.TempExamAnnualMMHorizontal.S17M1, dbo.TempExamAnnualMMHorizontal.S17M2, dbo.TempExamAnnualMMHorizontal.S17M3, 
                      dbo.TempExamAnnualMMHorizontal.S17MDT, dbo.TempExamAnnualMMHorizontal.S17MT, dbo.TempExamAnnualMMHorizontal.S17Per, dbo.TempExamAnnualMMHorizontal.S17Grade, 
                      dbo.TempExamAnnualMMHorizontal.SN18, dbo.TempExamAnnualMMHorizontal.S18MD1, dbo.TempExamAnnualMMHorizontal.S18MD2, dbo.TempExamAnnualMMHorizontal.S18MD3, 
                      dbo.TempExamAnnualMMHorizontal.S18M1, dbo.TempExamAnnualMMHorizontal.S18M2, dbo.TempExamAnnualMMHorizontal.S18M3, dbo.TempExamAnnualMMHorizontal.S18MDT, 
                      dbo.TempExamAnnualMMHorizontal.S18MT, dbo.TempExamAnnualMMHorizontal.S18Per, dbo.TempExamAnnualMMHorizontal.S18Grade, dbo.TempExamAnnualMMHorizontal.GMDT, 
                      dbo.TempExamAnnualMMHorizontal.GMT, dbo.TempExamAnnualMMHorizontal.GPer, dbo.TempExamAnnualMMHorizontal.GGrade, dbo.TempExamAnnualMMHorizontal.GGradeRemark, 
                      dbo.TempExamAnnualMMHorizontal.Rank, dbo.StudInfo.RollNo
FROM         dbo.GenderMaster INNER JOIN
                      dbo.StudInfo INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfo.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfo.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfo.DivisionCode = dbo.DivisionMaster.DivisionCode ON dbo.GenderMaster.GenderCode = dbo.StudInfo.GenderCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfo.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.TempExamAnnualMMHorizontal ON dbo.StudInfo.RegID = dbo.TempExamAnnualMMHorizontal.RegID
ORDER BY dbo.GenderMaster.GenderShort, dbo.StudInfo.RegNo
GO
/****** Object:  View [dbo].[TripCompetationEntryReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[TripCompetationEntryReport]
AS
SELECT TOP (100) PERCENT dbo.TripCompetationEntry.TID, dbo.TripCompetationEntry.RecordNo, dbo.TripCompetationEntry.TDate, dbo.TripCompetationEntry.ReportName, dbo.TripCompetationEntryDetail.RegID, 
                  dbo.MainClassMaster.MainClassName AS MainClass, dbo.ClassMaster.ClassName AS Class, dbo.DivisionMaster.DivisionName AS Div, dbo.StudInfoAll.RegNo, 
                  CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, 
                  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.LastName + ' ' + dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName END AS Student, 
                  dbo.TripCompetationEntryDetail.Amount, dbo.GenderMaster.GenderShort, dbo.GenderMaster.GenderName AS Gender, dbo.StudInfoAll.MobileNo1, dbo.StudInfoAll.MobileNo2, dbo.MainClassMaster.LogoPath, 
                  dbo.MainClassMaster.LetterHeadPath, dbo.StudInfoAll.RollNo, dbo.StudInfoAll.Dob, dbo.StudInfoAll.AadharNo, dbo.StudInfoAll.StudentID, dbo.StudInfoAll.NationalCode, dbo.StudInfoAll.PermanentAddress, dbo.StudInfoAll.LocalAddress, 
                  dbo.AyMaster.AyName, dbo.StudInfoAll.FatherName, dbo.TripCompetationEntry.TripCity, dbo.TripCompetationEntry.TripDays, dbo.TripCompetationEntry.TripSteyDays, dbo.StudInfoAll.Age30Sept
FROM     dbo.StudInfoAll INNER JOIN
                  dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                  dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                  dbo.TripCompetationEntryDetail ON dbo.StudInfoAll.RegID = dbo.TripCompetationEntryDetail.RegID INNER JOIN
                  dbo.GenderMaster ON dbo.StudInfoAll.GenderCode = dbo.GenderMaster.GenderCode INNER JOIN
                  dbo.TripCompetationEntry ON dbo.TripCompetationEntryDetail.TID = dbo.TripCompetationEntry.TID INNER JOIN
                  dbo.MainClassMaster ON dbo.TripCompetationEntry.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                  dbo.AyMaster ON dbo.TripCompetationEntry.AyCode = dbo.AyMaster.AyCode
ORDER BY dbo.GenderMaster.GenderShort, dbo.StudInfoAll.RegNo
GO
/****** Object:  View [dbo].[VisitorRegisterReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE VIEW [dbo].[VisitorRegisterReport]
AS
SELECT     dbo.VisitorRegister.TID, dbo.VisitorRegister.MainClassCode, dbo.MainClassMaster.MainClassName, dbo.VisitorRegister.RecordNo, dbo.VisitorRegister.VisitDate, dbo.VisitorRegister.VisitorName, 
                      dbo.VisitorRegister.PersonToMeet, dbo.VisitorRegister.Purpose, dbo.VisitorRegister.InTime, dbo.VisitorRegister.OutTime, dbo.VisitorRegister.RegNo, dbo.VisitorRegister.PhotoPath, 
                      dbo.VisitorRegister.MobileNo, CONVERT(varchar(15), CAST(dbo.VisitorRegister.InTime AS TIME), 100) AS InTimeText, CONVERT(varchar(15), CAST(dbo.VisitorRegister.OutTime AS TIME), 100) 
                      AS OutTimeText
FROM         dbo.VisitorRegister INNER JOIN
                      dbo.MainClassMaster ON dbo.VisitorRegister.MainClassCode = dbo.MainClassMaster.MainClassCode
GO
/****** Object:  StoredProcedure [dbo].[DBRestore]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[DBRestore]

@name VARCHAR(MAX) = '' -- DB NAME TO Restore
AS
BEGIN

DECLARE @SQL VARCHAR(MAX)
DECLARE @NewDBName VARCHAR(MAX) -- NEW DB NAME TO RESTORE THE BACKED UP DB.
DECLARE @FileNameOrgBackup VARCHAR(MAX) -- Backup file name to restore
DECLARE @PathOrgignalBackup VARCHAR(MAX) -- Path of backup file to restore

SET @NewDBName = @name
SET @PathOrgignalBackup = 'E:\Data\FTP\'
SET @FileNameOrgBackup = @PathOrgignalBackup + @name + '.bak'
SET @SQL = ''

SET @SQL ='RESTORE DATABASE ' + @NewDBName
SET @SQL = @SQL + ' FROM DISK = ''' + @FileNameOrgBackup + ''''

EXECUTE(@SQL)
END
GO
/****** Object:  StoredProcedure [dbo].[SP_CheckAlreadyExistNameCode]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_CheckAlreadyExistNameCode]
	@RecordSelection nvarchar(255)= '-', @fieldName nvarchar(255) = '-', @fieldName1 nvarchar(255) = '-', @fieldName2 nvarchar(255) = '0', @AyCode bigint=null, @FyCode bigint=null, @UserCode bigint=null, @FeesNoGroupID bigint=null, @AdmittionDate Datetime=null
AS 

DECLARE @TempCode bigint
DECLARE @RecordCode bigint

Begin
	SET NOCOUNT ON;
	Set @RecordCode = -1;
	
	If @RecordSelection='MainClassMaster'
		BEGIN
   		   SELECT @TempCode = MainClassCode from MainClassMaster where MainClassName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='MediumMaster'
		BEGIN
   		   SELECT @TempCode = MediumCode from MediumMaster where MediumName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ClassMaster'
		BEGIN
   		   SELECT @TempCode = ClassCode from ClassMaster where ClassName = @fieldName
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='DivisionMaster'
		BEGIN
   		   SELECT @TempCode = DivisionCode from DivisionMaster where DivisionName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='GenderMaster'
		BEGIN
   		   SELECT @TempCode = GenderCode from GenderMaster where GenderName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='GenderMasterShort'
		BEGIN
   		   SELECT @TempCode = GenderCode from GenderMaster where GenderShort = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='EmpTypeMaster'
		BEGIN
   		   SELECT @TempCode = EmpTypeCode from EmpTypeMaster where EmpTypeName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='FeeTypeMaster'
		BEGIN
   		   SELECT @TempCode = FeeTypeCode from FeeTypeMaster where FeeTypeName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='FeeTypeConcessionMaster'
		BEGIN
   		   SELECT @TempCode = FeeTypeConcessionCode from FeeTypeConcessionMaster where FeeTypeConcessionName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='FeeTitleMaster'
		BEGIN
   		   SELECT @TempCode = FeeTitleCode from FeeTitleMaster where FeeTitleName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='FeeInstallementMaster'
		BEGIN
   		   SELECT @TempCode = FeeInstallementCode from FeeInstallementMaster where FeeInstallementName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ReligionMaster'
		BEGIN
   		   SELECT @TempCode = ReligionCode from ReligionMaster where ReligionName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='CRSubjectMaster'
		BEGIN
   		   SELECT @TempCode = CRSubjectCode from CRSubjectMaster where CRSubjectName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='DRHeadMaster'
		BEGIN
   		   SELECT @TempCode = DRHeadCode from DRHeadMaster where DRHeadName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='DesignationMaster'
		BEGIN
   		   SELECT @TempCode = DesignationCode from DesignationMaster where DesignationName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='SubjectMaster'
		BEGIN
   		   SELECT @TempCode = SubjectCode from SubjectMaster where SubjectName = @fieldName and DeleteFlag = 0 Order by SubjectCode
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='SubDEClassGroupMaster'
		BEGIN
   		   SELECT @TempCode = SubDEClassGCode from SubDEClassGroupMaster where SubDEClassGName = @fieldName  and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='DocumentMaster'
		BEGIN
   		   SELECT @TempCode = DocumentCode from DocumentMaster where DocumentName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='EmpDocumentMaster'
		BEGIN
   		   SELECT @TempCode = EmpDocumentCode from EmpDocumentMaster where EmpDocumentName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='TCDocumentMaster'
		BEGIN
   		   SELECT @TempCode = TCDocumentCode from TCDocumentMaster where TCDocumentName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='CategoryMaster'
		BEGIN
   		   SELECT @TempCode = CategoryCode from CategoryMaster where CategoryName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='CategoryMasterEN'
		BEGIN
   		   SELECT @TempCode = CategoryCode from CategoryMaster where CategoryNameEN = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='LanguageMaster'
		BEGIN
   		   SELECT @TempCode = LanguageCode from LanguageMaster where LanguageName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='RelationMaster'
		BEGIN
   		   SELECT @TempCode = RelationCode from RelationMaster where RelationName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='BloodGroupMaster'
		BEGIN
   		   SELECT @TempCode = BloodGroupCode from BloodGroupMaster where BloodGroupName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='CasteMaster'
		BEGIN
   		   SELECT @TempCode = CasteCode from CasteMaster where CasteName = @fieldName  and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='TalukaMaster'
		BEGIN
   		   SELECT @TempCode = TalukaCode from TalukaMaster where TalukaName = @fieldName And DistrictCode = @fieldName1
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='CityMaster'
		BEGIN
   		   SELECT @TempCode = CityCode from CityMaster where CityName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='CityMasterWithTaluka'
		BEGIN
   		   SELECT @TempCode = CityCode from CityMaster where CityName = @fieldName And TalukaCode = @fieldName1
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='TCClassPromotStatusMaster'
		BEGIN
   		   SELECT @TempCode = TCClassPromotStatusCode from TCClassPromotStatusMaster where TCClassPromotStatusName = @fieldName
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='TCSLRMaster'
		BEGIN
   		   SELECT @TempCode = TCSLRCode from TCSLRMaster where TCSLRName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='OccupationMaster'
		BEGIN
   		   SELECT @TempCode = OccupationCode from OccupationMaster where OccupationName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='EducationMaster'
		BEGIN
   		   SELECT @TempCode = EducationCode from EducationMaster where EducationName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='CountryMaster'
		BEGIN
   		   SELECT @TempCode = CountryCode from CountryMaster where CountryName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='BankMaster'
		BEGIN
   		   SELECT @TempCode = BankCode from BankMaster where BankName = @fieldName and IFSCCode= @fieldName1
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='AreaMaster'
		BEGIN
   		   SELECT @TempCode = AreaCode from AreaMaster where AreaName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='HandyCapMaster'
		BEGIN
   		   SELECT @TempCode = HandyCapCode from HandyCapMaster where HandyCapName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='OtherSchoolMaster'
		BEGIN
   		   SELECT @TempCode = OtherSchoolCode from OtherSchoolMaster where OtherSchoolName = @fieldName And UDIESNo = @fieldName1
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='DistrictMaster'
		BEGIN
   		   SELECT @TempCode = DistrictCode from DistrictMaster where DistrictName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='StateMaster'
		BEGIN
   		   SELECT @TempCode = StateCode from StateMaster where StateName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ExamMaster'
		BEGIN
   		   SELECT @TempCode = ExamCode from ExamMaster where ExamName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END	
	else If @RecordSelection='ExamGroupMaster'
		BEGIN
   		   SELECT @TempCode = ExamGroupCode from ExamGroupMaster where ExamGroupName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='ExamMarksTypeMaster'
		BEGIN
   		   SELECT @TempCode = ExamMarksTypeCode from ExamMarksTypeMaster where ExamMarksTypeName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END				
	else If @RecordSelection='ScholarshipMaster'
		BEGIN
   		   SELECT @TempCode = ScholarshipCode from ScholarshipMaster where ScholarshipName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='TCBehaviorMaster'
		BEGIN
   		   SELECT @TempCode = TCBehaviorCode from TCBehaviorMaster where TCBehaviorName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END					
	else If @RecordSelection='TCStatusMaster'
		BEGIN
   		   SELECT @TempCode = TCStatusCode from TCStatusMaster where TCStatusName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END				
	else If @RecordSelection='TCRemarkMaster'
		BEGIN
   		   SELECT @TempCode = TCRemarkCode from TCRemarkMaster where TCRemarkName = @fieldName 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END						
	else If @RecordSelection='ReportMaster'
		BEGIN
   		   SELECT @TempCode = ReportCode from ReportMaster where ReportName = @fieldName 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ReportMasterEN'
		BEGIN
   		   SELECT @TempCode = ReportCode from ReportMaster where ReportNameEN = @fieldName 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ReportMasterUser'
		BEGIN
   		   SELECT @TempCode = ReportCode from UserReportDetail where ReportNameAlias = @fieldName
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ExamTypeMaster'
		BEGIN
   		   SELECT @TempCode = ExamTypeCode from ExamTypeMaster where ExamTypeName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='GradeMaster'
		BEGIN
   		   SELECT @TempCode = GradeCode from GradeMaster where GradeName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='GradeMaster1To8'
		BEGIN
   		   SELECT @TempCode = GradeCode from GradeMaster where GradeTypeCode=4 And GradeName = @fieldName
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='CRMedicalPointMaster'
		BEGIN
   		   SELECT @TempCode = CRMedicalPointCode from CRMedicalPointMaster where CRMedicalPointName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='CRPSTeacherMaster'
		BEGIN
   		   SELECT @TempCode = CRPSTeacherCode from CRPSTeacherMaster where CRPSTeacherName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='PaymentTypeMaster'
		BEGIN
   		   SELECT @TempCode = PaymentTypeCode from PaymentTypeMaster where PaymentTypeName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='DETitleMaster'
		BEGIN
   		   SELECT @TempCode = DETitleCode from DETitleMaster where DETitleName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='LockTypeMaster'
		BEGIN
   		   SELECT @TempCode = LockTypeCode from LockTypeMaster where LockTypeName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='OptionalSubjectGroupMaster'
		BEGIN
   		   SELECT @TempCode = OptionalSubjectGroupCode from OptionalSubjectGroupMaster where OptionalSubjectGroupName = @fieldName
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='StudInfoAllRegNo'
		BEGIN
   		   SELECT @TempCode = RegNo from StudInfoAll where EntryFrom = 'A' and RegNo = @fieldName and MainClassCode = @fieldName1 and RegID <> @fieldName2
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END

		
	else If @RecordSelection='TCPrintAllTCNo'
		BEGIN
   		   SELECT @TempCode = TCNo from TCPrintAll where TCNo = @fieldName and MainClassCode = @fieldName1 and TCID <> @fieldName2
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='TCPrintAllTCNoCombine'
		BEGIN
   		   SELECT @TempCode = TCNo from TCPrintAll where TCNo = @fieldName and TCID <> @fieldName2
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='TCPrintAllTCNoYearWise'
		BEGIN
   		   SELECT @TempCode = TCNo from TCPrintAll where TCNo = @fieldName and MainClassCode = @fieldName1 and TCID <> @fieldName2 and AyCode = @AyCode
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ReportStudInfoAllRegNoRegID'
		BEGIN
   		   SELECT @TempCode = RegID from StudInfoAll where EntryFrom = 'A' and RegNo = @fieldName and MainClassCode = @fieldName1 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ReportStudInfoAllStudentNameRegID'
		BEGIN
   		   SELECT @TempCode = RegID from StudInfoAll where EntryFrom = 'A' and (CASE LastName WHEN '-' THEN Firstname + ' ' + MiddleName ELSE Firstname + ' ' + MiddleName + ' ' + LastName END) = @fieldName and MainClassCode = @fieldName1 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='EmpMaster'
		BEGIN
   		   SELECT @TempCode = TID from EmpMaster where Firstname + ' ' + MiddleName + ' ' + LastName = @fieldName
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='EmpMonthlySalaryDuplicate'
		BEGIN
   		   SELECT @TempCode = TID from EmpMonthlySalary where ReportName = @fieldName and MainClassCode = @fieldName1 and EmpTypeCode = @fieldName2
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='MainClassCountMaster'
		BEGIN
   		   SELECT @TempCode = MainClassCountCode from MainClassCountMaster where MainClassCountName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END

	else If @RecordSelection='UnitMaster'
		BEGIN
   		   SELECT @TempCode = UnitCode from UnitMaster where UnitName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		

	else If @RecordSelection='SPAClassTypeMaster'
		BEGIN
   		   SELECT @TempCode = SPAClassTypeCode from SPAClassTypeMaster where SPAClassTypeName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		

	else If @RecordSelection='SPADayMaster'
		BEGIN
   		   SELECT @TempCode = SPADayCode from SPADayMaster where SPADayName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='SPAItemMaster'
		BEGIN
   		   SELECT @TempCode = SPAItemCode from SPAItemMaster where SPAItemName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='SPAMainMenuMaster'
		BEGIN
   		   SELECT @TempCode = SPAMainMenuCode from SPAMainMenuMaster where SPAMainMenuName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='SPAMenuTypeMaster'
		BEGIN
   		   SELECT @TempCode = SPAMenuTypeCode from SPAMenuTypeMaster where SPAMenuTypeName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='LibBookTitleGroupMaster'
		BEGIN
   		   SELECT @TempCode = LibBookTitleGroupCode from LibBookTitleGroupMaster where LibBookTitleGroupName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='LibBookTitleMaster'
		BEGIN
   		   SELECT @TempCode = LibBookTitleCode from LibBookTitleMaster where LibBookTitleName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='LibAuthorMaster'
		BEGIN
   		   SELECT @TempCode = LibAuthorCode from LibAuthorMaster where LibAuthorName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='LibBookLanguageMaster'
		BEGIN
   		   SELECT @TempCode = LibBookLanguageCode from LibBookLanguageMaster where LibBookLanguageName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='LibBookLocationMaster'
		BEGIN
   		   SELECT @TempCode = LibBookLocationCode from LibBookLocationMaster where LibBookLocationName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='LibBookStatusMaster'
		BEGIN
   		   SELECT @TempCode = LibBookStatusCode from LibBookStatusMaster where LibBookStatusName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='LibBookSubjectMaster'
		BEGIN
   		   SELECT @TempCode = LibBookSubjectCode from LibBookSubjectMaster where LibBookSubjectName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='LibEditionMaster'
		BEGIN
   		   SELECT @TempCode = LibEditionCode from LibEditionMaster where LibEditionName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='LibPublisherMaster'
		BEGIN
   		   SELECT @TempCode = LibPublisherCode from LibPublisherMaster where LibPublisherName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='LibPublicationMaster'
		BEGIN
   		   SELECT @TempCode = LibPublicationCode from LibPublicationMaster where LibPublicationName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
				
	else If @RecordSelection='LibSupplierMaster'
		BEGIN
   		   SELECT @TempCode = LibSupplierCode from LibSupplierMaster where LibSupplierName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		
	else If @RecordSelection='BusMaster'
		BEGIN
   		   SELECT @TempCode = BusCode from BusMaster where BusName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END		

	else If @RecordSelection='LibBookMasterBookNo'
		BEGIN
   		   SELECT @TempCode = AccessionNo from LibBookMaster where AccessionNo = @fieldName and BookTID <> @fieldName1
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
   else If @RecordSelection='ItemGroupMaster'
		BEGIN
   		   SELECT @TempCode = ItemGroupCode from ItemGroupMaster where ItemGroupName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ItemMaster'
		BEGIN
   		   SELECT @TempCode = ItemCode from ItemMaster where ItemName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END	
	else If @RecordSelection='WordLibraryMaster'
		BEGIN
   		   SELECT @TempCode = WordLibraryCode from WordLibraryMaster where NotoSans = @fieldName
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END	
	else If @RecordSelection='CBSCDEGroupMaster'
		BEGIN
   		   SELECT @TempCode = CBSCDEGroupCode from CBSCDEGroupMaster where CBSCDEGroupName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END	
	else If @RecordSelection='CBSCDETitleGroupMaster'
		BEGIN
   		   SELECT @TempCode = CBSCDETitleGroupCode from CBSCDETitleGroupMaster where CBSCDETitleGroupName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END	
	else If @RecordSelection='CBSCDETitleMaster'
		BEGIN
   		   SELECT @TempCode = CBSCDETitleCode from CBSCDETitleMaster where CBSCDETitleName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END	
	else If @RecordSelection='CBSCDETitleAndGroupMaster'
		BEGIN
   		   SELECT @TempCode = CBSCDETitleMaster.CBSCDETitleCode FROM   CBSCDETitleMaster INNER JOIN CBSCDETitleGroupMaster ON CBSCDETitleMaster.CBSCDETitleGroupCode = CBSCDETitleGroupMaster.CBSCDETitleGroupCode where CBSCDETitleMaster.CBSCDETitleName + ' - ' + CBSCDETitleGroupMaster.CBSCDETitleGroupName = @fieldName
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END	

	else If @RecordSelection='SubjectGroupMaster'
		BEGIN
   		   SELECT @TempCode = SubjectGroupCode from SubjectGroupMaster where SubjectGroupName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='Covid19DoseMaster'
		BEGIN
   		   SELECT @TempCode = Covid19DoseCode from Covid19DoseMaster where Covid19DoseName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='BankAPersonMaster'
		BEGIN
   		   SELECT @TempCode = BankAPersonCode from BankAPersonMaster where BankAPersonName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='FeeTitleOtherMaster'
		BEGIN
   		   SELECT @TempCode = FeeTitleOtherCode from FeeTitleOtherMaster where FeeTitleOtherName = @fieldName
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='FeeTitleOtherGroupMaster'
		BEGIN
   		   SELECT @TempCode = FeeTitleOtherGroupCode from FeeTitleOtherGroupMaster where FeeTitleOtherGroupName = @fieldName
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='StudInfoAllStudentName'
		BEGIN
   		   SELECT @TempCode = RegID from StudInfoAll where EntryFrom = 'A' and (CASE LastName WHEN '-' THEN Firstname + ' ' + MiddleName ELSE Firstname + ' ' + MiddleName + ' ' + LastName END) = @fieldName and ClassCode = @fieldName1 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='StudInfoAllDuplicateAdmissionStudentName'
		BEGIN
   		   SELECT @TempCode = RegID from StudInfoAll where EntryFrom = 'A' and (CASE LastName WHEN '-' THEN Firstname + ' ' + MiddleName ELSE Firstname + ' ' + MiddleName + ' ' + LastName END) = @fieldName and ClassCode = @fieldName1 and AdmittionDate = @AdmittionDate 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='UserMaster'
		BEGIN
   		   SELECT @TempCode = UserCode from UserMaster where UserName = @fieldName
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ReportTypeMaster'
		BEGIN
   		   SELECT @TempCode = ReportTypeCode from ReportTypeMaster where ReportTypeName = @fieldName
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ReportTypeMasterEN'
		BEGIN
   		   SELECT @TempCode = ReportTypeCode from ReportTypeMaster where ReportTypeNameEN = @fieldName 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='MainClassMasterFeesNoGroupID'
		BEGIN
   		   SELECT @TempCode = FeesNoGroupID from MainClassMaster where MainClassName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='MainClassMasterBonafiedNoGroupID'
		BEGIN
   		   SELECT @TempCode = BonafiedNoGroupID from MainClassMaster where MainClassName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END	
	else If @RecordSelection='MainClassMasterTCNoGroupID'
		BEGIN
   		   SELECT @TempCode = TCNoGroupID from MainClassMaster where MainClassName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='MainClassGroupMaster'
		BEGIN
   		   SELECT @TempCode = MainClassGroupCode from MainClassGroupMaster where MainClassGroupName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END

	else If @RecordSelection='PayBillReportNameAndMainClass'
		BEGIN
   		   SELECT @TempCode = EmpMonthlySalary.TID FROM  EmpMonthlySalary INNER JOIN MainClassMaster ON EmpMonthlySalary.MainClassCode = MainClassMaster.MainClassCode INNER JOIN FyMaster ON EmpMonthlySalary.FyCode = FyMaster.FyCode where EmpMonthlySalary.MainClassCode = @fieldName1 And EmpMonthlySalary.ReportName = @fieldName And FyMaster.FyName = @fieldName2  
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END

	else If @RecordSelection='AyMaster'
		BEGIN
   		   SELECT @TempCode = AyCode from AyMaster where AyName = @fieldName and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END

	else If @RecordSelection='FyMaster'
		BEGIN
   		   SELECT @TempCode = FyCode from FyMaster where FyName = @fieldName  and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END

	else If @RecordSelection='FeeTitleOtherMainGroupMaster'
		BEGIN
   		   SELECT @TempCode = FeeTitleOtherMainGroupCode from FeeTitleOtherMainGroupMaster where FeeTitleOtherMainGroupName = @fieldName
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END

	else If @RecordSelection='FeeTitleShortMaster'
		BEGIN
   		   SELECT @TempCode = FeeTitleShortCode from FeeTitleShortMaster where FeeTitleShortName = @fieldName  and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END

	else If @RecordSelection='PageSizeMaster'
		BEGIN
   		   SELECT @TempCode = PageSizeCode from PageSizeMaster where PageSizeName = @fieldName  and DeleteFlag = 0 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END

	else If @RecordSelection='ACAccountRegisterMaster'
		BEGIN
   		   SELECT @TempCode = AccountRegisterCode from ACAccountRegisterMaster where AccountRegister = @fieldName 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ACPaymentTypeMaster'
		BEGIN
   		   SELECT @TempCode = PaymentTypeCode from ACPaymentTypeMaster where PaymentTypeName = @fieldName 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ACPartyMaster'
		BEGIN
   		   SELECT @TempCode = TID from ACPartyMaster where PartyName = @fieldName 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ACLedgerHeadNarrationMaster'
		BEGIN
   		   SELECT @TempCode = LedgerHeadNarrationCode from ACLedgerHeadNarrationMaster where LedgerHeadNarration = @fieldName And LedgerHeadCode = @fieldName1
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END

	 SELECT 'ReturnStatus' = @RecordCode;
	 return;
End
GO
/****** Object:  StoredProcedure [dbo].[SP_CheckAlreadyExistNameCode1]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_CheckAlreadyExistNameCode1]
	@RecordSelection nvarchar(255)= '-', @fieldName nvarchar(255) = '-', @fieldName1 nvarchar(255) = '-', @fieldName2 nvarchar(255) = '0', @AyCode bigint=null, @FyCode bigint=null, @UserCode bigint=null, @FeesNoGroupID bigint=null
AS 

DECLARE @TempCode bigint
DECLARE @RecordCode bigint

Begin
	SET NOCOUNT ON;
	Set @RecordCode = -1;
	
	If @RecordSelection='FeesReceiptNo'
		BEGIN
   		   SELECT @TempCode = ReceiptNo from FeesCollection where ReceiptNo = @fieldName and MainClassCode = @fieldName1 and FyCode = @FyCode and ReceiptTID <> @fieldName2
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='FeesReceiptNoUserWise'
		BEGIN
   		   SELECT @TempCode = ReceiptNo from FeesCollection where ReceiptNo = @fieldName and UserCode = @UserCode and FyCode = @FyCode and ReceiptTID <> @fieldName2
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='FeesReceiptNoFeesGroupIDWise'
		BEGIN
   		   SELECT @TempCode = ReceiptNo FROM  FeesCollection INNER JOIN MainClassMaster ON FeesCollection.MainClassCode = MainClassMaster.MainClassCode where ReceiptNo = @fieldName and MainClassMaster.FeesNoGroupID = @FeesNoGroupID and FyCode = @FyCode and ReceiptTID <> @fieldName2
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='FeesReceiptOtherNo'
		BEGIN
   		   SELECT @TempCode = ReceiptNo from FeesCollectionOther where ReceiptNo = @fieldName and MainClassCode = @fieldName1 and FyCode = @FyCode and ReceiptTID <> @fieldName2
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='FeesReceiptOtherNoUserWise'
		BEGIN
   		   SELECT @TempCode = ReceiptNo from FeesCollectionOther where ReceiptNo = @fieldName and UserCode = @UserCode and FyCode = @FyCode and ReceiptTID <> @fieldName2
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='FeesReceiptOtherNoFeesGroupIDWise'
		BEGIN
   		   SELECT @TempCode = ReceiptNo FROM  FeesCollectionOther INNER JOIN MainClassMaster ON FeesCollectionOther.MainClassCode = MainClassMaster.MainClassCode where ReceiptNo = @fieldName and MainClassMaster.FeesNoGroupID = @FeesNoGroupID and FyCode = @FyCode and ReceiptTID <> @fieldName2
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='BusReceiptNo'
		BEGIN
   		   SELECT @TempCode = ReceiptNo from BusFeesCollection where ReceiptNo = @fieldName and MainClassCode = @fieldName1 and FyCode = @FyCode and ReceiptTID <> @fieldName2
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='BusReceiptNoUserWise'
		BEGIN
   		   SELECT @TempCode = ReceiptNo from BusFeesCollection where ReceiptNo = @fieldName and UserCode = @UserCode and FyCode = @FyCode and ReceiptTID <> @fieldName2
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='BusReceiptNoFeesGroupIDWise'
		BEGIN
   		   SELECT @TempCode = ReceiptNo FROM  BusFeesCollection INNER JOIN MainClassMaster ON BusFeesCollection.MainClassCode = MainClassMaster.MainClassCode where ReceiptNo = @fieldName and MainClassMaster.FeesNoGroupID = @FeesNoGroupID and FyCode = @FyCode and ReceiptTID <> @fieldName2
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ACLedgerTypeMaster'
		BEGIN
   		   SELECT @TempCode = LedgerTypeCode from ACLedgerTypeMaster where LedgerType = @fieldName
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END
	else If @RecordSelection='ACLedgerHeadMaster'
		BEGIN
   		   SELECT @TempCode = LedgerHeadCode from ACLedgerHeadMaster where LedgerHead = @fieldName 
		   IF @TempCode IS Not NULL
		      Set @RecordCode = @TempCode;
		END

	 SELECT 'ReturnStatus' = @RecordCode;
	 return;
End
GO
/****** Object:  StoredProcedure [dbo].[SP_CRUDAlreadyExist]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_CRUDAlreadyExist]
	@TableName nvarchar(120)=null, @CodeFieldName nvarchar(120)=null, @FieldNameWhere nvarchar(120)=null, @FieldValueWhere nvarchar(120)=null, @WhereCondition nvarchar(120)="-"
AS 

DECLARE @TempCode bigint
DECLARE @RecordCode bigint

Begin
	SET NOCOUNT ON;
	Set @RecordCode = -1;
	BEGIN
		if @WhereCondition = '-'
			EXECUTE ('Select '+@CodeFieldName+' as CodeValue from '+ @TableName +' Where '+ @FieldNameWhere +' = N'''+ @FieldValueWhere +'''')
		else 
			EXECUTE ('Select '+@CodeFieldName+' as CodeValue from '+ @TableName +' Where '+ @FieldNameWhere +' = N'''+ @FieldValueWhere +''' And '+ @WhereCondition +'')
	END
End
GO
/****** Object:  StoredProcedure [dbo].[SP_CRUDDeleteMasters]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_CRUDDeleteMasters]
    @TableName nvarchar(120)=null, @FieldName nvarchar(120)=null, @WhereCondition nvarchar(120)=null
AS
BEGIN
	SET NOCOUNT ON;
    exec ('Update '+ @TableName+' Set DeleteFlag = 1 where '+@FieldName+' = '+@WhereCondition)
    --exec ('Delete From '+ @TableName+' where '+@FieldName+' = '+@WhereCondition)
END
GO
/****** Object:  StoredProcedure [dbo].[SP_CRUDFillList]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_CRUDFillList]
	@SQLQuery nvarchar(Max)="-", @TableName nvarchar(120)=null, @FieldCode nvarchar(120)=null, @FieldName nvarchar(120)=null, @FieldNameOrderBy nvarchar(120)=null, @WhereCondition nvarchar(255)=null
AS 

Begin
	BEGIN
		if @SQLQuery = '-'
		   begin
			if @WhereCondition = '-'
			   EXECUTE ('Select '+@FieldCode+', '+@FieldName+' from '+ @TableName +' Order By '+ @FieldNameOrderBy +'')
			else
			   EXECUTE ('Select '+@FieldCode+', '+@FieldName+' from '+ @TableName +' Where '+ @WhereCondition +' Order By '+ @FieldNameOrderBy +'')			   
		   end
		else 
			EXECUTE (@SQLQuery)
	END
End
GO
/****** Object:  StoredProcedure [dbo].[SP_CRUDFillListReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_CRUDFillListReport]
	@TableQueryName nvarchar(120)=null, @WhereCondition nvarchar(Max)=null
AS 

Begin
	SET NOCOUNT ON;
	BEGIN
		if @WhereCondition = '-'
			EXECUTE ('Select * from '+ @TableQueryName +'')
		else 
			EXECUTE ('Select * from '+ @TableQueryName +' Where '+ @WhereCondition +'')
	END
End
GO
/****** Object:  StoredProcedure [dbo].[SP_CRUDFillListReportWithSort]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_CRUDFillListReportWithSort]
	@TableQueryName nvarchar(120)=null, @WhereCondition nvarchar(Max)=null, @SortRecord nvarchar(Max)=null
AS 

Begin
	SET NOCOUNT ON;
	BEGIN
		if @WhereCondition = '-'
			EXECUTE ('Select * from '+ @TableQueryName +' order by '+ @SortRecord +'')
		else 
			EXECUTE ('Select * from '+ @TableQueryName +' Where '+ @WhereCondition +' order by '+ @SortRecord +'')
	END
End
GO
/****** Object:  StoredProcedure [dbo].[SP_CRUDInsertMasters]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_CRUDInsertMasters]
    @TableName nvarchar(120)=null, @FieldName nvarchar(120)=null, @MaxCode bigint=null, @FieldNameAll nvarchar(Max)=null, @FieldValueAll nvarchar(Max)=null, @CurrentFlag nvarchar(1)=null
AS
DECLARE @ReturnValue bit
DECLARE @TempCode bigint
DECLARE @sql AS NVARCHAR(MAX)
BEGIN
	SET NOCOUNT ON;
	If @CurrentFlag = 'A'
	Begin
		EXEC @TempCode = SP_GetMaxTID @TableName , @FieldName;
		Set @MaxCode = @TempCode
		Set @TempCode = NULL
	End

	BEGIN TRANSACTION
	exec ('Delete from '+@TableName+' where '+@FieldName+'='+@MaxCode+'')

	Set @sql = 'INSERT INTO '+@TableName+' ('+@FieldNameAll+') VALUES ('+ CAST(@MaxCode as nvarchar) +','+ @FieldValueAll +')'
	EXEC sp_executesql @sql
	
	COMMIT TRANSACTION

	SELECT 'ReturnStatus' = @MaxCode  
	RETURN;  -- Record Successfully Saved

END
GO
/****** Object:  StoredProcedure [dbo].[SP_CRUDInsertUpdateDeleteRecord]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_CRUDInsertUpdateDeleteRecord]
    @Query nvarchar(Max)=null
AS
BEGIN
	SET NOCOUNT ON;
    exec (@Query)
END
GO
/****** Object:  StoredProcedure [dbo].[SP_DatabaseBackup]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

                        CREATE PROCEDURE [dbo].[SP_DatabaseBackup]
                        (
                        @BackupPath nvarchar(1000)=null
                        )
                      AS
                        Begin
                        BACKUP DATABASE [ORGSchool24-25] to DISK = @BackupPath
	                    SELECT 'ReturnStatus' = 0;
                        End
                    
GO
/****** Object:  StoredProcedure [dbo].[SP_DeleteMasters]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_DeleteMasters]
    @TableName nvarchar(120)=null, @FieldName nvarchar(120)=null, @WhereCondition nvarchar(120)=null
AS
BEGIN
	SET NOCOUNT ON;
    exec ('Update '+ @TableName+' Set DeleteFlag = 1 where '+@FieldName+' = '+@WhereCondition)
    --exec ('Delete From '+ @TableName+' where '+@FieldName+' = '+@WhereCondition)
END
GO
/****** Object:  StoredProcedure [dbo].[SP_EditRecord]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_EditRecord]
	@RecordSelection nvarchar(120)=null, @FieldCode bigint=null, @AyCode bigint=null, @WhereCondition nvarchar(Max)=Null
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	If @RecordSelection='StudInfo'
	 BEGIN
		SELECT     StudInfo.RegID, MainClassMaster.MainClassName AS MainClass, StudInfo.RegNo, MediumMaster.MediumName AS Medium, CONVERT(varchar, StudInfo.AdmittionDate, 103) AS AdmiDate,  CASE StudInfo.LastName WHEN '-' THEN StudInfo.Firstname + ' ' + StudInfo.MiddleName ELSE StudInfo.Firstname + ' ' + StudInfo.MiddleName + ' ' + StudInfo.LastName END AS StudentName,  ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, GenderMaster.GenderName AS Gender, CONVERT(varchar, StudInfo.Dob, 103) AS DOB, CasteMaster.CasteName AS Caste,  CategoryMaster.CategoryName AS Category, StudInfo.EntryFrom,  CASE StudInfo.LastNameE WHEN '-' THEN StudInfo.FirstnameE + ' ' + StudInfo.MiddleNameE ELSE StudInfo.FirstnameE + ' ' + StudInfo.MiddleNameE + ' ' + StudInfo.LastNameE END AS StudentNameE, StudInfo.CloseFlag AS TCFlag, StudInfo.AyCode, AyMaster.AyName FROM  StudInfo INNER JOIN MainClassMaster ON StudInfo.MainClassCode = MainClassMaster.MainClassCode INNER JOIN ClassMaster ON StudInfo.ClassCode = ClassMaster.ClassCode INNER JOIN MediumMaster ON StudInfo.MediumCode = MediumMaster.MediumCode INNER JOIN DivisionMaster ON StudInfo.DivisionCode = DivisionMaster.DivisionCode INNER JOIN GenderMaster ON StudInfo.GenderCode = GenderMaster.GenderCode INNER JOIN CategoryMaster ON StudInfo.CategoryCode = CategoryMaster.CategoryCode INNER JOIN CasteMaster ON StudInfo.CastCode = CasteMaster.CasteCode INNER JOIN AyMaster ON StudInfo.AyCode = AyMaster.AyCode 
		OPTION (RECOMPILE)
	 END
	 
 
	Else If @RecordSelection='StudInfoEdit'
	 BEGIN
			SELECT     StudInfo.RegID, StudInfo.MainClassCode, MainClassMaster.MainClassName, StudInfo.RegNo, StudInfo.MediumCode, MediumMaster.MediumName, StudInfo.AyCode, StudInfo.CloseFlag, 
								  StudInfo.StudDisplayFlag, StudInfo.EntryFrom, StudInfo.FeesPaidFlag, StudInfo.MarksFeedFlag, StudInfo.TSuspendedFlag, StudInfo.TSupendedDate, StudInfo.AdmissionType, CONVERT(varchar, 
								  StudInfo.AdmittionDate, 106) AS AdmittionDate, StudInfo.Firstname, StudInfo.MiddleName, StudInfo.LastName, StudInfo.ClassCode, ClassMaster.ClassName, StudInfo.DivisionCode, 
								  DivisionMaster.DivisionName, StudInfo.GenderCode, GenderMaster.GenderName, StudInfo.StudentID, StudInfo.AadharNo, StudInfo.Photpath, StudInfo.RollNo, StudInfo.FormNo, 
								  StudInfo.FeeTypeCode, FeeTypeMaster.FeeTypeName, StudInfo.PermanentAddress, StudInfo.PerCitycode, CityMaster.CityName AS PerCityName, StudInfo.LocalAddress, StudInfo.LocCitycode, 
								  CityMaster_1.CityName AS LocCityName, StudInfo.AreaCode, AreaMaster.AreaName, StudInfo.MobileNo1, StudInfo.MobileNo2, StudInfo.Dob, StudInfo.BirthPlaceCode, 
								  CityMaster_2.CityName AS BirthPlaceCity, CityMaster_2.TalukaCode, TalukaMaster.TalukaName, TalukaMaster.DistrictCode, DistrictMaster.DistrictName, StudInfo.BloodGroup, StudInfo.CastCode, 
								  CasteMaster.CasteName, CasteMaster.CasteNameEN, StudInfo.SubCast, StudInfo.ReligionCode, ReligionMaster.ReligionName, StudInfo.MotherTongueCode, 
								  LanguageMaster.LanguageName AS MotherTongue, StudInfo.LanguageKnownCode, LanguageMaster_1.LanguageName AS LanguageKnown, StudInfo.CategoryCode, CategoryMaster.CategoryName, 
								  StudInfo.PSCode, OtherSchoolMaster.OtherSchoolName AS PreviousSchoolName, OtherSchoolMaster.UDIESNo, StudInfo.PSClassCode, ClassMaster_1.ClassName AS PSClassName, 
								  StudInfo.PSResult, StudInfo.PSRegNo, StudInfo.PSTCNo, StudInfo.PSLeaveDate, StudInfo.PSLeaveReasonCode, TCSLRMaster.TCSLRName, StudInfo.FatherName, StudInfo.FEducationCode, 
								  EducationMaster.EducationName AS FEducationName, StudInfo.FOccupationCode, OccupationMaster.OccupationName AS FOccupationName, 
								  OccupationMaster.OccupationNameEN AS FOccupationNameEN, StudInfo.FAnnualIncome, StudInfo.MotherName, StudInfo.MEducationCode, EducationMaster_1.EducationName AS MEducationName, 
								  StudInfo.MCccupationCode, OccupationMaster_1.OccupationName AS MOccupationName, OccupationMaster_1.OccupationNameEN AS MOccupationNameEN, StudInfo.GaurdianName, 
								  StudInfo.RelationCode, RelationMaster.RelationName, StudInfo.ClassCodeAT, ClassMaster_2.ClassName AS ClassNameAT, StudInfo.DivisionCodeAT, 
								  DivisionMaster_1.DivisionName AS DivisionNameAT, StudInfo.BankCode, BankMaster.BankName, BankMaster.IFSCCode, StudInfo.BankAcNo, StudInfo.BankAPersonName, 
								  StudInfo.PersonalIdentMark, StudInfo.Age30Sept, StudInfo.Remark, StudInfo.UserCode, StudInfo.MargeFlag, StudInfo.OpeningBalance, StudInfo.HandyCapStatus, StudInfo.HandyCapCode, 
								  HandyCapMaster.HandyCapName, StudInfo.BPLCardStatus, StudInfo.PPECompleteStatus, StudInfo.WeightFT, StudInfo.WeightST, StudInfo.HeightFT, StudInfo.HeightST, StudInfo.SeatNo, 
								  StudInfo.Nationality, StudInfo.FirstnameE, StudInfo.MiddleNameE, StudInfo.LastNameE, StudInfo.AdmiSchoolType, StudInfo.MotherNameE, StudInfo.WeekPointDetail, StudInfo.LearningStopResion, 
								  StudInfo.PrePrimarySchoolName, StudInfo.GovermentOffer, StudInfo.AadharLinkBankStatus, StudInfo.HostelStayFlag, StudInfo.FAadharCardNo, StudInfo.FPanCard, StudInfo.MAnnualIncome, 
								  StudInfo.MAadharCardNo, StudInfo.MPanCard, StudInfo.WhatsAppMobileNo, StudInfo.EmailID, StudInfo.FacebookID, StudInfo.InstragramID, StudInfo.TwitterID, StudInfo.TelegramID, StudInfo.Branch, 
								  StudInfo.MotherFatherAreAlive, StudInfo.EWSCertificateStatus, StudInfo.HandyCapPercentage, StudInfo.BPLCardNo, 
								  CASE StudInfo.LastName WHEN '-' THEN StudInfo.Firstname + ' ' + StudInfo.MiddleName ELSE StudInfo.Firstname + ' ' + StudInfo.MiddleName + ' ' + StudInfo.LastName END AS StudentName, 
								  StudInfo.SubjectGroupCode, StudInfo.SubjectDetails, ClassMaster.MinSubject, ClassMaster.MaxStudentPerDiv, StudInfo.FeeTypeConcessionCode, 
								  FeeTypeConcessionMaster.FeeTypeConcessionName, AyMaster.AyName, StudInfo.NationalCode
			FROM         StudInfo INNER JOIN
								  MainClassMaster ON StudInfo.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
								  ClassMaster ON StudInfo.ClassCode = ClassMaster.ClassCode INNER JOIN
								  MediumMaster ON StudInfo.MediumCode = MediumMaster.MediumCode INNER JOIN
								  DivisionMaster ON StudInfo.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
								  GenderMaster ON StudInfo.GenderCode = GenderMaster.GenderCode INNER JOIN
								  FeeTypeMaster ON StudInfo.FeeTypeCode = FeeTypeMaster.FeeTypeCode INNER JOIN
								  CityMaster ON StudInfo.PerCitycode = CityMaster.CityCode INNER JOIN
								  CityMaster AS CityMaster_1 ON StudInfo.LocCitycode = CityMaster_1.CityCode INNER JOIN
								  AreaMaster ON StudInfo.AreaCode = AreaMaster.AreaCode INNER JOIN
								  CityMaster AS CityMaster_2 ON StudInfo.BirthPlaceCode = CityMaster_2.CityCode INNER JOIN
								  TalukaMaster ON CityMaster_2.TalukaCode = TalukaMaster.Talukacode INNER JOIN
								  DistrictMaster ON TalukaMaster.DistrictCode = DistrictMaster.DistrictCode INNER JOIN
								  CasteMaster ON StudInfo.CastCode = CasteMaster.CasteCode INNER JOIN
								  ReligionMaster ON StudInfo.ReligionCode = ReligionMaster.ReligionCode INNER JOIN
								  LanguageMaster ON StudInfo.MotherTongueCode = LanguageMaster.LanguageCode INNER JOIN
								  LanguageMaster AS LanguageMaster_1 ON StudInfo.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
								  CategoryMaster ON StudInfo.CategoryCode = CategoryMaster.CategoryCode INNER JOIN
								  RelationMaster ON StudInfo.RelationCode = RelationMaster.RelationCode INNER JOIN
								  OtherSchoolMaster ON StudInfo.PSCode = OtherSchoolMaster.OtherSchoolCode INNER JOIN
								  ClassMaster AS ClassMaster_1 ON StudInfo.PSClassCode = ClassMaster_1.ClassCode INNER JOIN
								  ClassMaster AS ClassMaster_2 ON StudInfo.ClassCodeAT = ClassMaster_2.ClassCode INNER JOIN
								  TCSLRMaster ON StudInfo.PSLeaveReasonCode = TCSLRMaster.TCSLRCode INNER JOIN
								  EducationMaster ON StudInfo.FEducationCode = EducationMaster.EducationCode INNER JOIN
								  EducationMaster AS EducationMaster_1 ON StudInfo.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
								  OccupationMaster ON StudInfo.FOccupationCode = OccupationMaster.OccupationCode INNER JOIN
								  OccupationMaster AS OccupationMaster_1 ON StudInfo.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
								  DivisionMaster AS DivisionMaster_1 ON StudInfo.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
								  BankMaster ON StudInfo.BankCode = BankMaster.BankCode INNER JOIN
								  HandyCapMaster ON StudInfo.HandyCapCode = HandyCapMaster.HandyCapCode INNER JOIN
								  FeeTypeConcessionMaster ON StudInfo.FeeTypeConcessionCode = FeeTypeConcessionMaster.FeeTypeConcessionCode INNER JOIN
								  AyMaster ON StudInfo.AyCode = AyMaster.AyCode
		WHERE     (StudInfo.RegID = @FieldCode)
		OPTION (RECOMPILE)
	END

	Else If @RecordSelection='StudInfoAll'
	 BEGIN
		SELECT     StudInfoAll.RegID, MainClassMaster.MainClassName AS MainClass, StudInfoAll.RegNo, MediumMaster.MediumName AS Medium, CONVERT(varchar, StudInfoAll.AdmittionDate, 103) AS AdmiDate,  CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, GenderMaster.GenderName AS Gender, CONVERT(varchar, StudInfoAll.Dob, 103) AS DOB,  CasteMaster.CasteName AS Caste, CategoryMaster.CategoryName AS Category, StudInfoAll.EntryFrom,  CASE StudInfoAll.LastNameE WHEN '-' THEN StudInfoAll.FirstnameE + ' ' + StudInfoAll.MiddleNameE ELSE StudInfoAll.FirstnameE + ' ' + StudInfoAll.MiddleNameE + ' ' + StudInfoAll.LastNameE END AS StudentNameE, StudInfoAll.CloseFlag AS TCFlag, StudInfoAll.AyCode, AyMaster.AyName FROM         StudInfoAll INNER JOIN MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN MediumMaster ON StudInfoAll.MediumCode = MediumMaster.MediumCode INNER JOIN DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN CategoryMaster ON StudInfoAll.CategoryCode = CategoryMaster.CategoryCode INNER JOIN GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode INNER JOIN CasteMaster ON StudInfoAll.CastCode = CasteMaster.CasteCode INNER JOIN AyMaster ON StudInfoAll.AyCode = AyMaster.AyCode
		OPTION (RECOMPILE)
	 END

	 
	Else If @RecordSelection='StudInfoAllEdit'
	 BEGIN
			SELECT     StudInfoAll.RegID, StudInfoAll.MainClassCode, MainClassMaster.MainClassName, StudInfoAll.RegNo, StudInfoAll.MediumCode, MediumMaster.MediumName, StudInfoAll.AyCode, 
								  StudInfoAll.CloseFlag, StudInfoAll.StudDisplayFlag, StudInfoAll.EntryFrom, StudInfoAll.FeesPaidFlag, StudInfoAll.MarksFeedFlag, StudInfoAll.TSuspendedFlag, StudInfoAll.TSupendedDate, 
								  StudInfoAll.AdmissionType, CONVERT(varchar, StudInfoAll.AdmittionDate, 106) AS AdmittionDate, StudInfoAll.Firstname, StudInfoAll.MiddleName, StudInfoAll.LastName, StudInfoAll.ClassCode, 
								  ClassMaster.ClassName, StudInfoAll.DivisionCode, DivisionMaster.DivisionName, StudInfoAll.GenderCode, GenderMaster.GenderName, StudInfoAll.StudentID, StudInfoAll.AadharNo, 
								  StudInfoAll.Photpath, StudInfoAll.RollNo, StudInfoAll.FormNo, StudInfoAll.FeeTypeCode, FeeTypeMaster.FeeTypeName, StudInfoAll.PermanentAddress, StudInfoAll.PerCitycode, 
								  CityMaster.CityName AS PerCityName, StudInfoAll.LocalAddress, StudInfoAll.LocCitycode, CityMaster_1.CityName AS LocCityName, StudInfoAll.AreaCode, AreaMaster.AreaName, 
								  StudInfoAll.MobileNo1, StudInfoAll.MobileNo2, StudInfoAll.Dob, StudInfoAll.BirthPlaceCode, CityMaster_2.CityName AS BirthPlaceCity, CityMaster_2.TalukaCode, TalukaMaster.TalukaName, 
								  TalukaMaster.DistrictCode, DistrictMaster.DistrictName, StudInfoAll.BloodGroup, StudInfoAll.CastCode, CasteMaster.CasteName, CasteMaster.CasteNameEN, StudInfoAll.SubCast, 
								  StudInfoAll.ReligionCode, ReligionMaster.ReligionName, StudInfoAll.MotherTongueCode, LanguageMaster.LanguageName AS MotherTongue, StudInfoAll.LanguageKnownCode, 
								  LanguageMaster_1.LanguageName AS LanguageKnown, StudInfoAll.CategoryCode, CategoryMaster.CategoryName, StudInfoAll.PSCode, 
								  OtherSchoolMaster.OtherSchoolName AS PreviousSchoolName, OtherSchoolMaster.UDIESNo, StudInfoAll.PSClassCode, ClassMaster_1.ClassName AS PSClassName, StudInfoAll.PSResult, 
								  StudInfoAll.PSRegNo, StudInfoAll.PSTCNo, StudInfoAll.PSLeaveDate, StudInfoAll.PSLeaveReasonCode, TCSLRMaster.TCSLRName, StudInfoAll.FatherName, StudInfoAll.FEducationCode, 
								  EducationMaster.EducationName AS FEducationName, StudInfoAll.FOccupationCode, OccupationMaster.OccupationName AS FOccupationName, 
								  OccupationMaster.OccupationNameEN AS FOccupationNameEN, StudInfoAll.FAnnualIncome, StudInfoAll.MotherName, StudInfoAll.MEducationCode, 
								  EducationMaster_1.EducationName AS MEducationName, StudInfoAll.MCccupationCode, OccupationMaster_1.OccupationName AS MOccupationName, 
								  OccupationMaster_1.OccupationNameEN AS MOccupationNameEN, StudInfoAll.GaurdianName, StudInfoAll.RelationCode, RelationMaster.RelationName, StudInfoAll.ClassCodeAT, 
								  ClassMaster_2.ClassName AS ClassNameAT, StudInfoAll.DivisionCodeAT, DivisionMaster_1.DivisionName AS DivisionNameAT, StudInfoAll.BankCode, BankMaster.BankName, 
								  BankMaster.IFSCCode, StudInfoAll.BankAcNo, StudInfoAll.BankAPersonName, StudInfoAll.PersonalIdentMark, StudInfoAll.Age30Sept, StudInfoAll.Remark, StudInfoAll.UserCode, StudInfoAll.MargeFlag,
								   StudInfoAll.OpeningBalance, StudInfoAll.HandyCapStatus, StudInfoAll.HandyCapCode, HandyCapMaster.HandyCapName, StudInfoAll.BPLCardStatus, StudInfoAll.PPECompleteStatus, 
								  StudInfoAll.WeightFT, StudInfoAll.WeightST, StudInfoAll.HeightFT, StudInfoAll.HeightST, StudInfoAll.SeatNo, StudInfoAll.Nationality, StudInfoAll.FirstnameE, StudInfoAll.MiddleNameE, 
								  StudInfoAll.LastNameE, StudInfoAll.AdmiSchoolType, StudInfoAll.MotherNameE, StudInfoAll.WeekPointDetail, StudInfoAll.LearningStopResion, StudInfoAll.PrePrimarySchoolName, 
								  StudInfoAll.GovermentOffer, StudInfoAll.AadharLinkBankStatus, StudInfoAll.HostelStayFlag, StudInfoAll.FAadharCardNo, StudInfoAll.FPanCard, StudInfoAll.MAnnualIncome, 
								  StudInfoAll.MAadharCardNo, StudInfoAll.MPanCard, StudInfoAll.WhatsAppMobileNo, StudInfoAll.EmailID, StudInfoAll.FacebookID, StudInfoAll.InstragramID, StudInfoAll.TwitterID, 
								  StudInfoAll.TelegramID, StudInfoAll.Branch, StudInfoAll.MotherFatherAreAlive, StudInfoAll.EWSCertificateStatus, StudInfoAll.HandyCapPercentage, StudInfoAll.BPLCardNo, 
								  CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
								   StudInfoAll.SubjectGroupCode, StudInfoAll.SubjectDetails, ClassMaster.MinSubject, ClassMaster.MaxStudentPerDiv, StudInfoAll.FeeTypeConcessionCode, 
								  FeeTypeConcessionMaster.FeeTypeConcessionName, AyMaster.AyName, StudInfoAll.NationalCode
			FROM         StudInfoAll INNER JOIN
								  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
								  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
								  MediumMaster ON StudInfoAll.MediumCode = MediumMaster.MediumCode INNER JOIN
								  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
								  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode INNER JOIN
								  FeeTypeMaster ON StudInfoAll.FeeTypeCode = FeeTypeMaster.FeeTypeCode INNER JOIN
								  CityMaster ON StudInfoAll.PerCitycode = CityMaster.CityCode INNER JOIN
								  CityMaster AS CityMaster_1 ON StudInfoAll.LocCitycode = CityMaster_1.CityCode INNER JOIN
								  AreaMaster ON StudInfoAll.AreaCode = AreaMaster.AreaCode INNER JOIN
								  CityMaster AS CityMaster_2 ON StudInfoAll.BirthPlaceCode = CityMaster_2.CityCode INNER JOIN
								  TalukaMaster ON CityMaster_2.TalukaCode = TalukaMaster.Talukacode INNER JOIN
								  DistrictMaster ON TalukaMaster.DistrictCode = DistrictMaster.DistrictCode INNER JOIN
								  CasteMaster ON StudInfoAll.CastCode = CasteMaster.CasteCode INNER JOIN
								  ReligionMaster ON StudInfoAll.ReligionCode = ReligionMaster.ReligionCode INNER JOIN
								  LanguageMaster ON StudInfoAll.MotherTongueCode = LanguageMaster.LanguageCode INNER JOIN
								  LanguageMaster AS LanguageMaster_1 ON StudInfoAll.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
								  CategoryMaster ON StudInfoAll.CategoryCode = CategoryMaster.CategoryCode INNER JOIN
								  RelationMaster ON StudInfoAll.RelationCode = RelationMaster.RelationCode INNER JOIN
								  OtherSchoolMaster ON StudInfoAll.PSCode = OtherSchoolMaster.OtherSchoolCode INNER JOIN
								  ClassMaster AS ClassMaster_1 ON StudInfoAll.PSClassCode = ClassMaster_1.ClassCode INNER JOIN
								  ClassMaster AS ClassMaster_2 ON StudInfoAll.ClassCodeAT = ClassMaster_2.ClassCode INNER JOIN
								  TCSLRMaster ON StudInfoAll.PSLeaveReasonCode = TCSLRMaster.TCSLRCode INNER JOIN
								  EducationMaster ON StudInfoAll.FEducationCode = EducationMaster.EducationCode INNER JOIN
								  EducationMaster AS EducationMaster_1 ON StudInfoAll.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
								  OccupationMaster ON StudInfoAll.FOccupationCode = OccupationMaster.OccupationCode INNER JOIN
								  OccupationMaster AS OccupationMaster_1 ON StudInfoAll.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
								  DivisionMaster AS DivisionMaster_1 ON StudInfoAll.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
								  BankMaster ON StudInfoAll.BankCode = BankMaster.BankCode INNER JOIN
								  HandyCapMaster ON StudInfoAll.HandyCapCode = HandyCapMaster.HandyCapCode INNER JOIN
								  FeeTypeConcessionMaster ON StudInfoAll.FeeTypeConcessionCode = FeeTypeConcessionMaster.FeeTypeConcessionCode INNER JOIN
								  AyMaster ON StudInfoAll.AyCode = AyMaster.AyCode
		WHERE     (StudInfoAll.RegID = @FieldCode)
		OPTION (RECOMPILE)
	
	END

	Else If @RecordSelection='CityMaster'																		
	BEGIN																	
		SELECT     CityMaster.CityCode, CityMaster.CityName, CityMaster.TalukaCode, TalukaMaster.TalukaName, CityMaster.DeleteFlag, TalukaMaster.DistrictCode, DistrictMaster.DistrictName, 
							  DistrictMaster.StateCode, StateMaster.StateName
		FROM         CityMaster INNER JOIN
							  TalukaMaster ON CityMaster.TalukaCode = TalukaMaster.Talukacode INNER JOIN
							  DistrictMaster ON TalukaMaster.DistrictCode = DistrictMaster.DistrictCode INNER JOIN
							  StateMaster ON DistrictMaster.StateCode = StateMaster.StateCode
		ORDER BY CityMaster.CityCode
		OPTION (RECOMPILE)
	END																	

	Else If @RecordSelection='SaveSendSMS'																		
	BEGIN																	
		SELECT     TID, CONVERT(varchar, TDate, 106) as TDate, Type,MobileNo, Message,UserCode
		FROM         SaveSendSMS
		ORDER BY TID DESC
		OPTION (RECOMPILE)
	END																	
	 
	 Else If @RecordSelection='SMSMaster'
	 BEGIN
		SELECT     SMSCode, SMSName, DeleteFlag FROM         SMSMaster ORDER BY SMSCode
		OPTION (RECOMPILE)
	 END

	Else If @RecordSelection='EducationMaster'
	 BEGIN
		SELECT  EducationCode, EducationName, DeleteFlag FROM    EducationMaster ORDER BY EducationCode
		OPTION (RECOMPILE)
	 END	
	 
	 Else If @RecordSelection='OccupationMaster'
	 BEGIN
		SELECT  OccupationCode, OccupationName, OccupationNameEN, DeleteFlag FROM    OccupationMaster ORDER BY OccupationCode
		OPTION (RECOMPILE)
	 END	
	 
	 Else If @RecordSelection='ScholarshipMaster'
	 BEGIN
		SELECT  ScholarshipCode, ScholarshipName, DeleteFlag FROM    ScholarshipMaster ORDER BY ScholarshipCode
		OPTION (RECOMPILE)
	 END	

	 Else If @RecordSelection='NoticeMaster'
	 BEGIN
		SELECT  NoticeCode, NoticeName, DeleteFlag FROM    NoticeMaster ORDER BY NoticeCode
		OPTION (RECOMPILE)
	 END	
	 
	 Else If @RecordSelection='DivisionMaster'
	 BEGIN
		SELECT  DivisionCode, DivisionName, DivisionNameEN, DeleteFlag FROM    DivisionMaster ORDER BY DivisionCode
	 END	
	 
	 Else If @RecordSelection='ExamMaster'
	 BEGIN
		SELECT  ExamCode, ExamName, DeleteFlag FROM    ExamMaster ORDER BY ExamCode
	 END	
	 
	 Else If @RecordSelection='FeeTypeMaster'
	 BEGIN
		SELECT  FeeTypeCode, FeeTypeName, FeeTypeFullName , DeleteFlag FROM    FeeTypeMaster ORDER BY FeeTypeCode
	 END	

	 Else If @RecordSelection='FeeTitleMaster'
	 BEGIN
				SELECT     FeeTitleMaster.FeeTitleCode, FeeTitleMaster.SrNo, FeeTitleMaster.FeeTitleName, FeeTitleShortMaster.FeeTitleShortName, FeeTitleMaster.FeeTitleShortCode, 
							  FeeTitleMaster.FeesCertificateDisplayFlag AS FeesCertificateEffect, FeeTitleMaster.DeleteFlag
		FROM         FeeTitleMaster INNER JOIN
							  FeeTitleShortMaster ON FeeTitleMaster.FeeTitleShortCode = FeeTitleShortMaster.FeeTitleShortCode
		ORDER BY FeeTitleMaster.FeeTitleCode
	 END	
	 
	 Else If @RecordSelection='TCSLRMaster'
	 BEGIN
		SELECT  TCSLRCode, TCSLRName, DeleteFlag FROM    TCSLRMaster ORDER BY TCSLRCode
	 END	
	 
	 Else If @RecordSelection='TCStatusMaster'
	 BEGIN
		SELECT  TCStatusCode, TCStatusName, DeleteFlag FROM    TCStatusMaster ORDER BY TCStatusCode
	 END	
	 
	 Else If @RecordSelection='TCRemarkMaster'
	 BEGIN
		SELECT  TCRemarkCode, TCRemarkName, DeleteFlag FROM    TCRemarkMaster ORDER BY TCRemarkCode
	 END	
	 
	   Else If @RecordSelection='TCBehaviorMaster'
	 BEGIN
		SELECT  TCBehaviorCode, TCBehaviorName, DeleteFlag FROM    TCBehaviorMaster ORDER BY TCBehaviorCode
	 END	
	 
	 	 Else If @RecordSelection='CasteMaster'
	 BEGIN
		SELECT     CasteMaster.CasteCode, CasteMaster.CasteName, CasteMaster.CasteNameEN, CasteMaster.CategoryCode, CategoryMaster.CategoryName, CasteMaster.DeleteFlag
		FROM         CasteMaster INNER JOIN
							  CategoryMaster ON CasteMaster.CategoryCode = CategoryMaster.CategoryCode
		ORDER BY CasteMaster.CasteCode
	 END	
	 
	  Else If @RecordSelection='DEMaster'
	 BEGIN
		SELECT     DEMaster.DECode, DETitleMaster.DETitleName, DEMaster.SrNo, DEMaster.DEName, DEMaster.DeleteFlag
		FROM         DEMaster INNER JOIN
							  DETitleMaster ON DEMaster.DETitleCode = DETitleMaster.DETitleCode
		ORDER BY DEMaster.SrNo
	 END	
	 
	 Else If @RecordSelection='AreaMaster'
	 BEGIN
		SELECT  AreaCode, AreaName, KM, DeleteFlag FROM AreaMaster ORDER BY AreaCode
	 END
	 
	Else If @RecordSelection='DistrictMaster'
	 BEGIN
		SELECT  DistrictMaster.DistrictCode, DistrictMaster.DistrictName, DistrictMaster.StateCode, StateMaster.StateName, DistrictMaster.DeleteFlag
		FROM    StateMaster INNER JOIN
					DistrictMaster ON StateMaster.StateCode = DistrictMaster.StateCode
		ORDER BY DistrictMaster.DistrictCode
	 END	

	Else If @RecordSelection='StateMaster'
	 BEGIN
		SELECT StateMaster.StateCode, StateMaster.StateName, StateMaster.CountryCode, CountryMaster.CountryName, StateMaster.DeleteFlag
		FROM StateMaster INNER JOIN
                      CountryMaster ON StateMaster.CountryCode = CountryMaster.CountryCode
		ORDER BY StateMaster.StateCode
	 END	

	Else If @RecordSelection='BankMaster'
	 BEGIN
		SELECT BankCode, BankName, IFSCCode, DeleteFlag FROM BankMaster ORDER BY BankMaster.BankCode
	 END
	 
	 Else If @RecordSelection='OtherSchoolMaster'
	 BEGIN
		SELECT OtherSchoolCode, OtherSchoolName, Address, UDIESNo, DeleteFlag FROM OtherSchoolMaster ORDER BY OtherSchoolMaster.OtherSchoolCode
	 END

	 Else If @RecordSelection='ReligionMaster'
	 BEGIN
		SELECT ReligionCode, ReligionName, MinorityFlag, DeleteFlag FROM ReligionMaster ORDER BY ReligionMaster.ReligionCode
	 END

	 Else If @RecordSelection='DRHeadMaster'
	 BEGIN
		SELECT DRHeadCode, DRHeadName, DeleteFlag FROM DRHeadMaster ORDER BY DRHeadMaster.DRHeadCode
	 END

	 Else If @RecordSelection='DocumentMaster'
	 BEGIN
		SELECT DocumentCode, DocumentName, DeleteFlag FROM DocumentMaster ORDER BY DocumentMaster.DocumentCode
	 END

	 Else If @RecordSelection='EmpDocumentMaster'
	 BEGIN
		SELECT EmpDocumentCode, EmpDocumentName, DeleteFlag FROM EmpDocumentMaster ORDER BY EmpDocumentMaster.EmpDocumentCode
	 END

	 Else If @RecordSelection='TCDocumentMaster'
	 BEGIN
		SELECT TCDocumentCode, TCDocumentName, DeleteFlag FROM TCDocumentMaster ORDER BY TCDocumentMaster.TCDocumentCode
	 END

	 Else If @RecordSelection='DesignationMaster'
	 BEGIN
		SELECT DesignationCode, DesignationName, DeleteFlag FROM DesignationMaster ORDER BY DesignationMaster.DesignationCode
	 END

	 Else If @RecordSelection='SubjectMaster'
	 BEGIN
		SELECT SubjectCode, SubjectName, SubjectNameShort, SubjectCodeBoard, DeleteFlag FROM SubjectMaster ORDER BY SubjectMaster.SubjectCode
	 END

	 Else If @RecordSelection='DETitleMaster'
	 BEGIN
		SELECT DETitleCode, DETitleName, DeleteFlag FROM DETitleMaster ORDER BY DETitleMaster.DETitleCode asc
	 END

	 Else If @RecordSelection='HandyCapMaster'
	 BEGIN
		SELECT HandyCapCode, HandyCapName, DeleteFlag FROM HandyCapMaster ORDER BY HandyCapMaster.HandyCapCode
	 END

	 Else If @RecordSelection='LanguageMaster'
	 BEGIN
		SELECT LanguageCode, LanguageName, DeleteFlag FROM LanguageMaster ORDER BY LanguageMaster.LanguageCode
	 END

	 Else If @RecordSelection='EmpTypeMaster'
	 BEGIN
			SELECT     EmpTypeCode, EmpTypeName, CDTTitle1, CDTTitle1Count, CDTTitle2, CDTTitle2Count, CDTTitle3, CDTTitle3Count, CDTTitle4, CDTTitle4Count, DeleteFlag FROM         EmpTypeMaster ORDER BY EmpTypeCode
	 END

	Else If @RecordSelection='UserMaster'
	 BEGIN
		SELECT     UserMaster.UserCode, UserMaster.UserName, UserMaster.DeleteFlag, UserMaster.Password, UserMaster.SecondPassword, UserMaster.LockTypeCode, LockTypeMaster.LockTypeName, 
							  UserMaster.DuplicateTCPassShow,UserMaster.PhotoPath, UserMaster.TCPassword, UserMaster.FeesPassword, UserMaster.AdmissionFormShortEntry, UserMaster.AdminFLag, UserMaster.FeesCounterName, UserMaster.TCPermanentDelete, UserMaster.FeesPermanentDelete, UserMaster.StudentPermanentDelete
		FROM         UserMaster INNER JOIN
							  LockTypeMaster ON UserMaster.LockTypeCode = LockTypeMaster.LockTypeCode
		ORDER BY UserMaster.UserCode
	END				

	Else If @RecordSelection='UserDetail'
	 BEGIN
		SELECT     UserCode, MenuType, MenuID
		FROM         UserDetail
		ORDER BY UserCode, MenuType, MenuID
	 END						
	
	Else If @RecordSelection='SoftwareSetting'
	 BEGIN
		SELECT SoftwareSetting.Title, SoftwareSetting.Condition From SoftwareSetting
	 END

	Else If @RecordSelection='TalukaMaster'
	 BEGIN
	    SELECT     TalukaMaster.TalukaCode, TalukaMaster.TalukaName, TalukaMaster.DistrictCode, DistrictMaster.DistrictName, TalukaMaster.DeleteFlag
		FROM         TalukaMaster INNER JOIN DistrictMaster ON TalukaMaster.DistrictCode = DistrictMaster.DistrictCode
		ORDER BY TalukaMaster.TalukaCode
	 END	 	 

	Else If @RecordSelection='PreTCPrint'
	 BEGIN
		SELECT        StudInfoAll.RegID, MainClassMaster.MainClassName AS MainClass, MediumMaster.MediumName AS Medium, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.RegNo, 
								 CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, 
								 PreTCPrint.TCStatus, PreTCPrint.TCBehavior, ClassMaster_1.ClassName AS TClass, PreTCPrint.TeachingYear, YEAR(PreTCPrint.TeachingYear) AS Tyear, PreTCPrint.NextClassPromote AS Promote, StudInfoAll.SeatNo, 
								 PreTCPrint.SLeaveReason, PreTCPrint.TCRemark, GenderMaster.GenderShort, StudInfoAll.AyCode, CONVERT(varchar, AyMaster.FromDate, 106) AS FromDate, CONVERT(varchar, AyMaster.ToDate, 106) AS ToDate, 
								 StudInfoAll.CloseFlag
		FROM            GenderMaster INNER JOIN
								 StudInfoAll INNER JOIN
								 MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
								 ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
								 DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode ON GenderMaster.GenderCode = StudInfoAll.GenderCode INNER JOIN
								 AyMaster ON StudInfoAll.AyCode = AyMaster.AyCode INNER JOIN
								 MediumMaster ON StudInfoAll.MediumCode = MediumMaster.MediumCode LEFT OUTER JOIN
								 ClassMaster AS ClassMaster_1 INNER JOIN
								 PreTCPrint ON ClassMaster_1.ClassCode = PreTCPrint.TeachingClassCode ON StudInfoAll.RegID = PreTCPrint.RegID
				WHERE     (StudInfoAll.CloseFlag = N'N') AND (StudInfoAll.EntryFrom = N'A')
				ORDER BY StudInfoAll.RegID DESC
		OPTION (RECOMPILE)
	END	 
	 
	Else If @RecordSelection='TCPrintPreTCData'
	 BEGIN
			SELECT        StudInfoAll.RegID, MainClassMaster.MainClassName AS MainClass, MediumMaster.MediumName AS Medium, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.RegNo, 
									 CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, 
									 PreTCPrint.TCStatus, PreTCPrint.TCBehavior, ClassMaster_1.ClassName AS TClass, PreTCPrint.TeachingYear, YEAR(PreTCPrint.TeachingYear) AS Tyear, PreTCPrint.NextClassPromote AS Promote, StudInfoAll.SeatNo, 
									 PreTCPrint.SLeaveReason, PreTCPrint.TCRemark, GenderMaster.GenderShort, StudInfoAll.AyCode, CONVERT(varchar, AyMaster.FromDate, 106) AS FromDate, CONVERT(varchar, AyMaster.ToDate, 106) AS ToDate, 
									 StudInfoAll.CloseFlag
			FROM            GenderMaster INNER JOIN
									 StudInfoAll INNER JOIN
									 MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
									 ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
									 DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode ON GenderMaster.GenderCode = StudInfoAll.GenderCode INNER JOIN
									 AyMaster ON StudInfoAll.AyCode = AyMaster.AyCode INNER JOIN
									 ClassMaster AS ClassMaster_1 INNER JOIN
									 PreTCPrint ON ClassMaster_1.ClassCode = PreTCPrint.TeachingClassCode ON StudInfoAll.RegID = PreTCPrint.RegID INNER JOIN
									 MediumMaster ON StudInfoAll.MediumCode = MediumMaster.MediumCode
			ORDER BY StudInfoAll.RegID DESC
		OPTION (RECOMPILE)

	 END	 
	 

	Else If @RecordSelection='TCPrint'
	 BEGIN
		SELECT     TCPrint.TCID, TCPrint.TCCode, TCPrint.TCNo, CONVERT(varchar, TCPrint.TCDate, 106) AS TCDate, StudInfoAll.RegID, MainClassMaster.MainClassName AS MainClass, MediumMaster.MediumName AS Medium,  ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.RegNo, CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName FROM         StudInfoAll INNER JOIN MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN TCPrint ON StudInfoAll.RegID = TCPrint.RegID INNER JOIN DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN MediumMaster ON StudInfoAll.MediumCode = MediumMaster.MediumCode ORDER BY TCPrint.TCID DESC
	 END		 
	 
	Else If @RecordSelection='TCPrintEdit'
	 BEGIN
		SELECT     TCPrint.TCID, TCPrint.TCCode, TCPrint.TCNo, CONVERT(varchar, TCPrint.TCDate, 106) as TCDate, CONVERT(varchar, TCPrint.ApplicationDate, 106) as ApplicationDate, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.RegID, 
							  StudInfoAll.RegNo, CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, TCPrint.TCStatus, TCPrint.TCBehavior, 
							  ClassMaster_1.ClassName AS TClass, TCPrint.TeachingYear, YEAR(TCPrint.TeachingYear) AS Tyear, TCPrint.ClassAndYear, TCPrint.NextClassPromote AS Promote, TCPrint.SeatNo, TCPrint.SLeaveReason, TCPrint.TCRemark, 
							  GenderMaster.GenderShort, CONVERT(varchar, TCPrint.ReportDate, 106) as ReportDate, TCPrint.AyCode, TCPrint.MargeFlag, UserMaster.UserName, TCPrint.TCRPersonName, TCPrint.TCRPersonRelation, TCPrint.ReportDateOTC, TCPrint.DuplicateTCPrintFlag, TCPrint.LastExamResult, TCPrint.OptionalSubject,TCPrint.SubjectsStudied,TCPrint.TWorkingDay,TCPrint.TPrsentDay,TCPrint.FeesAndDues,TCPrint.FailedStatus,
							  TCPrint.DeleteFlag, TCPrint.SyncFlag, TCPrint.M1, TCPrint.M2, TCPrint.M3, TCPrint.M4, TCPrint.M5, TCPrint.M6, TCPrint.M7, TCPrint.M8, TCPrint.Examination, TCPrint.ExamYear, TCPrint.ExamResult, TCPrint.SubjectDegreeCource,  TCPrint.Specilization, TCPrint.ContinuedClass
		FROM         GenderMaster INNER JOIN
							  StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode ON GenderMaster.GenderCode = StudInfoAll.GenderCode INNER JOIN
							  ClassMaster AS ClassMaster_1 INNER JOIN
							  TCPrint ON ClassMaster_1.ClassCode = TCPrint.TeachingClassCode ON StudInfoAll.RegID = TCPrint.RegID INNER JOIN
							  UserMaster ON TCPrint.UserCode = UserMaster.UserCode  Where TCPrint.TCID = @FieldCode
		ORDER BY StudInfoAll.RegID DESC
	 END		 

	Else If @RecordSelection='TCPrintAllMultiEdit'
	 BEGIN
		SELECT        TCPrintAll.TCID, TCPrintAll.TCCode, TCPrintAll.TCNo, CONVERT(varchar, TCPrintAll.TCDate, 106) AS TCDate, CONVERT(varchar, TCPrintAll.ApplicationDate, 106) AS ApplicationDate, 
								 MainClassMaster.MainClassName AS MainClass, MediumMaster.MediumName AS Medium, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.RegID, StudInfoAll.RegNo, 
								 CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, TCPrintAll.TCStatus, 
								 TCPrintAll.TCBehavior, ClassMaster_1.ClassName AS TClass, TCPrintAll.TeachingYear, YEAR(TCPrintAll.TeachingYear) AS Tyear, TCPrintAll.ClassAndYear, TCPrintAll.NextClassPromote AS Promote, TCPrintAll.SeatNo, 
								 TCPrintAll.SLeaveReason, TCPrintAll.TCRemark, GenderMaster.GenderShort, CONVERT(varchar, TCPrintAll.ReportDate, 106) AS ReportDate, TCPrintAll.AyCode, TCPrintAll.MargeFlag, UserMaster.UserName, 
								 TCPrintAll.TCRPersonName, TCPrintAll.TCRPersonRelation, TCPrintAll.ReportDateOTC, TCPrintAll.DuplicateTCPrintFlag, TCPrintAll.LastExamResult, TCPrintAll.OptionalSubject, TCPrintAll.SubjectsStudied, TCPrintAll.TWorkingDay,
								  TCPrintAll.TPrsentDay, TCPrintAll.FeesAndDues, TCPrintAll.FailedStatus, TCPrintAll.DeleteFlag, TCPrintAll.SyncFlag, TCPrintAll.M1, TCPrintAll.M2, TCPrintAll.M3, TCPrintAll.M4, TCPrintAll.M5, TCPrintAll.M6, TCPrintAll.M7, 
								 TCPrintAll.M8, TCPrintAll.Examination, TCPrintAll.ExamYear, TCPrintAll.ExamResult, TCPrintAll.SubjectDegreeCource, TCPrintAll.Specilization, TCPrintAll.ContinuedClass
		FROM            GenderMaster INNER JOIN
								 StudInfoAll INNER JOIN
								 MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
								 ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
								 DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode ON GenderMaster.GenderCode = StudInfoAll.GenderCode INNER JOIN
								 ClassMaster AS ClassMaster_1 INNER JOIN
								 TCPrintAll ON ClassMaster_1.ClassCode = TCPrintAll.TeachingClassCode ON StudInfoAll.RegID = TCPrintAll.RegID INNER JOIN
								 UserMaster ON TCPrintAll.UserCode = UserMaster.UserCode INNER JOIN
								 MediumMaster ON StudInfoAll.MediumCode = MediumMaster.MediumCode
		ORDER BY StudInfoAll.RegID DESC
	END		 

	Else If @RecordSelection='TCPrintAll'
	 BEGIN
		SELECT     TCPrintAll.TCID, TCPrintAll.TCCode, TCPrintAll.TCNo, CONVERT(varchar, TCPrintAll.TCDate, 106) AS TCDate, StudInfoAll.RegID, MainClassMaster.MainClassName AS MainClass, MediumMaster.MediumName AS Medium,  ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.RegNo, CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName FROM         StudInfoAll INNER JOIN MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN TCPrintAll ON StudInfoAll.RegID = TCPrintAll.RegID INNER JOIN DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN MediumMaster ON StudInfoAll.MediumCode = MediumMaster.MediumCode ORDER BY TCPrintAll.TCID DESC
	 END		 
	 
	Else If @RecordSelection='TCPrintAllEdit'
	 BEGIN
		SELECT     TCPrintAll.TCID, TCPrintAll.TCCode, TCPrintAll.TCNo, CONVERT(varchar, TCPrintAll.TCDate, 106) as TCDate, CONVERT(varchar, TCPrintAll.ApplicationDate, 106) as ApplicationDate, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.RegID, 
							  StudInfoAll.RegNo, CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, TCPrintAll.TCStatus, TCPrintAll.TCBehavior, 
							  ClassMaster_1.ClassName AS TClass, TCPrintAll.TeachingYear, YEAR(TCPrintAll.TeachingYear) AS Tyear, TCPrintAll.ClassAndYear, TCPrintAll.NextClassPromote AS Promote, TCPrintAll.SeatNo, TCPrintAll.SLeaveReason, TCPrintAll.TCRemark, 
							  GenderMaster.GenderShort, CONVERT(varchar, TCPrintAll.ReportDate, 106) as ReportDate, TCPrintAll.AyCode, TCPrintAll.MargeFlag, UserMaster.UserName, TCPrintAll.TCRPersonName, TCPrintAll.TCRPersonRelation, TCPrintAll.ReportDateOTC, TCPrintAll.DuplicateTCPrintFlag, TCPrintAll.LastExamResult, TCPrintAll.OptionalSubject,TCPrintAll.SubjectsStudied,TCPrintAll.TWorkingDay,TCPrintAll.TPrsentDay,TCPrintAll.FeesAndDues,TCPrintAll.FailedStatus,
							  TCPrintAll.DeleteFlag, TCPrintAll.SyncFlag, TCPrintAll.M1, TCPrintAll.M2, TCPrintAll.M3, TCPrintAll.M4, TCPrintAll.M5, TCPrintAll.M6, TCPrintAll.M7, TCPrintAll.M8, TCPrintAll.Examination, TCPrintAll.ExamYear, TCPrintAll.ExamResult, TCPrintAll.SubjectDegreeCource,  TCPrintAll.Specilization, TCPrintAll.ContinuedClass
		FROM         GenderMaster INNER JOIN
							  StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode ON GenderMaster.GenderCode = StudInfoAll.GenderCode INNER JOIN
							  ClassMaster AS ClassMaster_1 INNER JOIN
							  TCPrintAll ON ClassMaster_1.ClassCode = TCPrintAll.TeachingClassCode ON StudInfoAll.RegID = TCPrintAll.RegID INNER JOIN
							  UserMaster ON TCPrintAll.UserCode = UserMaster.UserCode  Where TCPrintAll.TCID = @FieldCode
		ORDER BY StudInfoAll.RegID DESC
	 END		 

	 
	Else If @RecordSelection='MainClassMaster'
	  BEGIN
		SELECT     MainClassCode, MainClassName, TitleName, OrgName, Address1, Address2, CityName, PhoneNo, MobileNo, SchoolTinNo, BankName, BranchName, BankAcNo, HeadMaster, SchoolCode, EmailID, 
							  WebSite, SchoolMedium, SMNoLine, SMNoLine1, UDiesNo, BoardName, SanlagntaNo, ClientCode, Taluka, District, SchoolSrNo, Director, Administrativefficer, TitleNameEN, OrgNameEN, 
							  AddressEN, IFSCCode, JavakKramankName, BusCompany, LogoPath, LogoImage, LetterHeadPath, LetterHeadImage, SchoolNameTAN, SchoolEmailTDS, SchoolPinNoTDS, SchoolCityEng, SchoolPanNoTDS, SchoolTDSPassword, 
							  HMNameTDS, HMFatherNameTDS, HMAddressTDS, HMPinNoTDS, HMPanNoTDS, HMEmailIDTDS, SansthaCode, SchoolAdminCode, AppSchoolCode,
							  WordsThoughtsFlag, LeaveDetailsFlag, OpinionPollFlag, BusTrackerFlag, QuizFlag, FeesFlag, FeesPaidOnlineFlag
		FROM         MainClassMaster
	END	 

	Else If @RecordSelection='TCPrintTypeMaster'
	 BEGIN
	    SELECT TCReportTypeCode, TCReportTypeName, DefaultTick, TCPrintFlag FROM TCPrintTypeMaster ORDER BY TCReportTypeCode
	 END		 
	
	Else If @RecordSelection='StudentNirgamUtara'
	 BEGIN
			SELECT     StudentNirgamUtara.TID, StudentNirgamUtara.RecordNo, CONVERT(varchar, StudentNirgamUtara.TDate, 106) AS TDate, StudInfoAll.RegID, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, 
								  DivisionMaster.DivisionName AS Div, StudInfoAll.RegNo, CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, StudInfoAll.AyCode, 
								  StudInfoAll.CloseFlag, ClassMaster_1.ClassName AS SLClass, StudentNirgamUtara.TCNo, StudentNirgamUtara.TCDate, StudentNirgamUtara.TCStatus, StudentNirgamUtara.TCBehavior, 
								  StudentNirgamUtara.SLeaveReason, StudentNirgamUtara.Description, StudentNirgamUtara.PageNo
			FROM         StudInfoAll INNER JOIN
								  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
								  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
								  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
								  StudentNirgamUtara ON StudInfoAll.RegID = StudentNirgamUtara.RegID LEFT OUTER JOIN
								  ClassMaster AS ClassMaster_1 ON StudentNirgamUtara.LeaveTimeClassCode = ClassMaster_1.ClassCode
			WHERE     (StudInfoAll.EntryFrom = N'A')
			ORDER BY StudInfoAll.RegID DESC
	END	 

	Else If @RecordSelection='StudentLeaveApplication'
	 BEGIN
		SELECT     StudentLeaveApplication.TID, StudentLeaveApplication.RecordNo, CONVERT(varchar, StudentLeaveApplication.TDate, 106) AS TDate, StudInfoAll.RegID, 
							  MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.RegNo, 
							  CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
							   StudInfoAll.AyCode, StudInfoAll.CloseFlag, StudentLeaveApplication.SLeaveReason, StudentLeaveApplication.OtherSchoolName
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  StudentLeaveApplication ON StudInfoAll.RegID = StudentLeaveApplication.RegID
		WHERE     (StudInfoAll.EntryFrom = N'A')
		ORDER BY StudInfoAll.RegID DESC
	END	 

	Else If @RecordSelection='BonafiedCertificate'
	 BEGIN
		SELECT     BonafiedCertificate.TID, BonafiedCertificate.RecordNo, CONVERT(varchar, BonafiedCertificate.TDate, 106) AS TDate, StudInfoAll.RegID, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, 
							  DivisionMaster.DivisionName AS Div, StudInfoAll.RegNo, CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, BonafiedCertificate.Ayear, BonafiedCertificate.EducationStatus, BonafiedCertificate.Purpose, StudInfoAll.AyCode, 
							  StudInfoAll.CloseFlag
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  BonafiedCertificate ON StudInfoAll.RegID = BonafiedCertificate.RegID
		ORDER BY StudInfoAll.RegID DESC
	END	 

	Else If @RecordSelection='StudentInfoUpdate'
	 BEGIN
		SELECT     StudInfo.RegID, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, StudInfo.RegNo, 
							  CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
							   AS StudentName, MediumMaster.MediumName AS Medium, DivisionMaster.DivisionName AS Div, GenderMaster.GenderShort, StudInfo.AyCode, StudInfo.CloseFlag
		FROM         GenderMaster INNER JOIN
							  StudInfo INNER JOIN
							  MainClassMaster ON StudInfo.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfo.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfo.DivisionCode = DivisionMaster.DivisionCode ON GenderMaster.GenderCode = StudInfo.GenderCode INNER JOIN
							  MediumMaster ON StudInfo.MediumCode = MediumMaster.MediumCode
		WHERE     (StudInfo.CloseFlag = 'N') AND (StudInfo.EntryFrom = 'A')	
	END	 

	Else If @RecordSelection='StudentDocument'
	 BEGIN
		SELECT RegID, DocumentCode, DocumentPath FROM StudentDocument where RegID = @FieldCode
	 END		 

	Else If @RecordSelection='EmpDocument'
	 BEGIN
		SELECT EmpID, EmpDocumentCode, EmpDocumentPath FROM EmpDocument
	 END		 

	Else If @RecordSelection='TCDocument'
	 BEGIN
		SELECT RegID, TCDocumentCode, TCDocumentPath FROM TCDocument
	 END		 

	Else If @RecordSelection='UserMainClassDetail'
	 BEGIN
		SELECT UserCode, MainClassCode FROM  UserMainClassDetail
	 END		 

	Else If @RecordSelection='UserClassDetail'
	 BEGIN
		SELECT UserCode, ClassCode FROM  UserClassDetail
	 END		 

	Else If @RecordSelection='UserDivisionDetail'
	 BEGIN
		SELECT UserCode, DivisionCode FROM  UserDivisionDetail
	 END		 

	Else If @RecordSelection='UserSubjectDetail'
	 BEGIN
		SELECT UserCode, SubjectCode FROM  UserSubjectDetail
	 END		 

	Else If @RecordSelection='FeesDefine'
	 BEGIN
		SELECT     FeesDefine.FDTID, FeesDefine.SrNo, MediumMaster.MediumName AS Medium, ClassMaster.ClassName AS Class, FeeTypeMaster.FeeTypeName AS FeeType, 
							  FeeTitleMaster.FeeTitleName AS FeeTitle, FeeInstallementMaster.FeeInstallementName AS FeeInstallement, FeesDefine.FeesAmount, FeesDefine.FeeTypeCode, FeesDefine.FeeTitleCode, 
							  FeesDefine.AyCode, AyMaster.AyName
		FROM         FeesDefine INNER JOIN
							  FeeTypeMaster ON FeesDefine.FeeTypeCode = FeeTypeMaster.FeeTypeCode INNER JOIN
							  MediumMaster ON FeesDefine.MediumCode = MediumMaster.MediumCode INNER JOIN
							  ClassMaster ON FeesDefine.ClassCode = ClassMaster.ClassCode INNER JOIN
							  FeeTitleMaster ON FeesDefine.FeeTitleCode = FeeTitleMaster.FeeTitleCode INNER JOIN
							  FeeInstallementMaster ON FeesDefine.FeeInstallementCode = FeeInstallementMaster.FeeInstallementCode INNER JOIN
							  AyMaster ON FeesDefine.AyCode = AyMaster.AyCode
		WHERE     (FeesDefine.FeeTitleCode > 0)
		ORDER BY FeesDefine.SrNo
	END		 	 
	 
	 Else If @RecordSelection='FeesCollection'
		 BEGIN
			SELECT     FeesCollection.ReceiptTID, FeesCollection.ReceiptNo, CONVERT(varchar, FeesCollection.ReceiptDate, 106) AS ReceiptDate, StudInfoAll.RegID, MainClassMaster.MainClassName AS MainClass,  ClassMaster.ClassName AS Class, StudInfoAll.RegNo,  CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, FeesCollection.TotalFeesAmount AS FeesAmount, FeesCollection.TotalDiscountAmt AS DiscountAmt, FeesCollection.CancelReceiptAmt, FeesCollection.Remark,  PaymentTypeMaster.PaymentTypeName AS PType, FeesCollection.FeeCategoryCode, FeesCollection.BankName, FeesCollection.ChequeNo, CONVERT(varchar, FeesCollection.ChequeDate, 106)  AS ChequeDate, FeesCollection.AyCode, FeesCollection.CancelReceiptFlag, FeesCollection.PrintFlag, FeeTypeMaster.FeeTypeName, StudInfoYearly.OpeningBalance, StudInfoYearly.FinalFees,  MainClassMaster.MainClassCode, AyMaster.AyName, FeesCollection.FyCode, FyMaster.FyName, FeesCollection.UserCode, UserMaster.UserName, StudInfoAll.FeesPaidFlag, MediumMaster.MediumName FROM         StudInfoYearly INNER JOIN StudInfoAll ON StudInfoYearly.RegID = StudInfoAll.RegID INNER JOIN PaymentTypeMaster INNER JOIN FeesCollection ON PaymentTypeMaster.PaymentTypeCode = FeesCollection.PaymentTypeCode ON StudInfoYearly.RegID = FeesCollection.RegID AND  StudInfoYearly.AyCode = FeesCollection.AyCode INNER JOIN FeeTypeMaster ON StudInfoYearly.FeeTypeCode = FeeTypeMaster.FeeTypeCode INNER JOIN DivisionMaster ON StudInfoYearly.DivisionCode = DivisionMaster.DivisionCode INNER JOIN ClassMaster ON StudInfoYearly.ClassCode = ClassMaster.ClassCode INNER JOIN MediumMaster ON StudInfoYearly.MediumCode = MediumMaster.MediumCode INNER JOIN MainClassMaster ON StudInfoYearly.MainClassCode = MainClassMaster.MainClassCode INNER JOIN AyMaster ON StudInfoYearly.AyCode = AyMaster.AyCode INNER JOIN FyMaster ON FeesCollection.FyCode = FyMaster.FyCode INNER JOIN UserMaster ON FeesCollection.UserCode = UserMaster.UserCode  Where FeesCollection.ReceiptTID = @FieldCode ORDER BY FeesCollection.ReceiptTID DESC
		END		 	 

	Else If @RecordSelection='FeesCollectionDetail'
	BEGIN
			SELECT     FeesDefine.SrNo, FeesDefine.FeeTitleCode, FeeTitleMaster.FeeTitleName, 0 AS TotalBalance, 0 AS CurrentBalance, 0 AS PaidAmount, 0 AS AdjOrDiscount, 
			CASE  WHEN FeesDefine.FeeTitleCode = -1 THEN StudInfoYearly.OpeningBalance  WHEN FeesDefine.FeeTitleCode = -4 THEN StudInfoYearly.FinalFees  ELSE FeesDefine.FeesAmount END AS FeesAmount, FeesDefine.FeeInstallementCode, StudInfoYearly.AdmissionType, 
								  StudInfoYearly.AyCode
			FROM         StudInfoYearly INNER JOIN
								  StudInfoAll ON StudInfoYearly.RegID = StudInfoAll.RegID INNER JOIN
								  FeeTitleMaster INNER JOIN
								  FeesDefine ON FeeTitleMaster.FeeTitleCode = FeesDefine.FeeTitleCode ON StudInfoYearly.MediumCode = FeesDefine.MediumCode AND StudInfoYearly.ClassCode = FeesDefine.ClassCode AND 
								  StudInfoYearly.FeeTypeCode = FeesDefine.FeeTypeCode AND StudInfoYearly.AyCode = FeesDefine.AyCode
                      					WHERE     (StudInfoYearly.RegID = @FieldCode and StudInfoYearly.AyCode = @AyCode)
							ORDER BY FeesDefine.SrNo
	END

	Else If @RecordSelection='InwardRegister'
	 BEGIN
		SELECT     InwardRegister.TID, MainClassMaster.MainClassName as MainClass, InwardRegister.RecordNo, CONVERT(varchar, InwardRegister.IRDate, 106) AS IRDate, InwardRegister.FileNo, InwardRegister.LetterNo, InwardRegister.FromWhomReceived, 
							  InwardRegister.Subject, InwardRegister.ToWhomIssued, InwardRegister.Remark, InwardRegister.Attachment1Path, InwardRegister.FyCode
		FROM         InwardRegister INNER JOIN
							  MainClassMaster ON InwardRegister.MainClassCode = MainClassMaster.MainClassCode Order by InwardRegister.RecordNo Desc
	END		 	 			 	 

	Else If @RecordSelection='OutwardRegister'
	 BEGIN
		SELECT     OutwardRegister.TID, MainClassMaster.MainClassName as MainClass, OutwardRegister.RecordNo, CONVERT(varchar, OutwardRegister.ORDate, 106) AS ORDate, OutwardRegister.Enclosures, OutwardRegister.Address, OutwardRegister.Subject, 
							  OutwardRegister.FileNo, OutwardRegister.ORRDate, OutwardRegister.ExpensesAmt, OutwardRegister.Remark, OutwardRegister.Attachment1Path, OutwardRegister.FyCode
		FROM         OutwardRegister INNER JOIN
							  MainClassMaster ON OutwardRegister.MainClassCode = MainClassMaster.MainClassCode
		ORDER BY OutwardRegister.RecordNo DESC
	END		 	 			 	 

	Else If @RecordSelection='TCApplication'
	 BEGIN
		SELECT     TCApplication.TID, MainClassMaster.MainClassName AS MainClass, TCApplication.RecordNo, CONVERT(varchar, TCApplication.TDate, 106) AS TDate, TCApplication.StudentName, GenderMaster.GenderName AS Gender, 
							  ClassMaster.ClassName AS Class, OtherSchoolMaster.OtherSchoolName AS PreviousSchool, OtherSchoolMaster.UDIESNo, TCApplication.AyCode
		FROM         TCApplication INNER JOIN
							  ClassMaster ON TCApplication.ClassCode = ClassMaster.ClassCode INNER JOIN
							  GenderMaster ON TCApplication.GenderCode = GenderMaster.GenderCode INNER JOIN
							  MainClassMaster ON TCApplication.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  OtherSchoolMaster ON TCApplication.PSCode = OtherSchoolMaster.OtherSchoolCode
		ORDER BY TCApplication.RecordNo DESC
	END	

	Else If @RecordSelection='StudentNotice'
	 BEGIN
		SELECT     StudentNotice.TID, MainClassMaster.MainClassName AS MainClass, StudentNotice.RecordNo, CONVERT(varchar, StudentNotice.TDate, 106) AS TDate, StudentNotice.RegID, ClassMaster.ClassName AS Class, StudInfoAll.RegNo, 
							  CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
							   StudentNotice.ParentsReply, StudentNotice.CompleteNoticeFlag, StudentNotice.AyCode
		FROM         StudInfoAll INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  StudentNotice ON StudInfoAll.RegID = StudentNotice.RegID INNER JOIN
							  MainClassMaster ON StudentNotice.MainClassCode = MainClassMaster.MainClassCode
							  ORDER BY StudentNotice.RecordNo DESC
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='StudentNoticeDetail'
	 BEGIN
		SELECT     TID, Srno, NoticeCode, NoticeName FROM  StudentNoticeDetail ORDER BY Srno
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='PresentyDaysMonthMaster'
	 BEGIN
		SELECT     ClassMaster.ClassCode, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, CONVERT(varchar, PresentyDaysMonthMaster.SchoolStartDate, 106) 
							  AS SchoolStartDate, PresentyDaysMonthMaster.Jun, PresentyDaysMonthMaster.Jully, PresentyDaysMonthMaster.Aug, PresentyDaysMonthMaster.Sept, PresentyDaysMonthMaster.Oct, 
							  PresentyDaysMonthMaster.Nov, PresentyDaysMonthMaster.Dec, PresentyDaysMonthMaster.Jan, PresentyDaysMonthMaster.Feb, PresentyDaysMonthMaster.Mar, PresentyDaysMonthMaster.Apr, 
							  PresentyDaysMonthMaster.May, PresentyDaysMonthMaster.FTTotal, PresentyDaysMonthMaster.STTotal, PresentyDaysMonthMaster.Total, ClassMaster.DeleteFlag
		FROM         ClassMaster INNER JOIN
							  MainClassMaster ON ClassMaster.MainClassCode = MainClassMaster.MainClassCode LEFT OUTER JOIN
							  PresentyDaysMonthMaster ON ClassMaster.ClassCode = PresentyDaysMonthMaster.ClassCode
		WHERE     (ClassMaster.DeleteFlag = 0)
		ORDER BY ClassMaster.ClassCode
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='ExamGroupMaster'
	 BEGIN
				SELECT     ExamGroupMaster.ExamGroupCode, ExamGroupMaster.ExamGroupName, ExamTypeMaster.ExamTypeName, ExamGroupMaster.DeleteFlag
		FROM         ExamGroupMaster INNER JOIN
							  ExamTypeMaster ON ExamGroupMaster.ExamTypeCode = ExamTypeMaster.ExamTypeCode
		ORDER BY ExamGroupMaster.ExamGroupCode
	END		 	 			 	 	 	 			 	 
	
	Else If @RecordSelection='ExamGroupDetail'
	 BEGIN
		SELECT ExamGroupcode, ExamCode, DivisionCode FROM ExamGroupDetail
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='OptionalSubjectGroupMaster'
	 BEGIN
			 SELECT     OptionalSubjectGroupMaster.OptionalSubjectGroupCode, OptionalSubjectGroupMaster.ClassCode, ClassMaster.ClassName, OptionalSubjectGroupMaster.OptionalSubjectGroupName, 
							  OptionalSubjectGroupMaster.DeleteFlag
		FROM         OptionalSubjectGroupMaster INNER JOIN
							  ClassMaster ON OptionalSubjectGroupMaster.ClassCode = ClassMaster.ClassCode
		ORDER BY OptionalSubjectGroupMaster.OptionalSubjectGroupCode
	END		 	 			 	 	 	 			 	 
	
	Else If @RecordSelection='OptionalSubjectGroupDetail'
	 BEGIN
		SELECT     OptionalSubjectGroupCode, SubjectCode FROM OptionalSubjectGroupDetail
	END		 	 			 	 	 	 			 	 


	Else If @RecordSelection='SubDEClassGroupMaster'
	 BEGIN
		SELECT  SubDEClassGCode, SubDEClassGName, DeleteFlag FROM  SubDEClassGroupMaster ORDER BY SubDEClassGCode
	 END		 	 			 	 	 	 			 	 
	
	Else If @RecordSelection='SubDEClassGroupDetail'
	 BEGIN
		SELECT SubDEClassGCode, ClassCode FROM SubDEClassGroupDetail
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='StudentFamilyDetail'
	 BEGIN
		SELECT     RegID, SrNo, FamilyName, Age, Relation, Education, Business FROM  StudentFamilyDetail WHERE (RegID = @FieldCode) ORDER BY SrNo
	 END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='StudentPSchoolDetail'
	 BEGIN
		SELECT     RegID, SrNo, PSchoolName, SchoolAddress, RegNo, FromYear, ToYear, SchoolLeaveReason FROM  StudentPSchoolDetail WHERE (RegID = @FieldCode) ORDER BY SrNo
	 END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='StudentPEducationalDetails'
	 BEGIN
		SELECT     RegID, SrNo, ExaminationName, BoardOrUniversity, SchoolOrCollege, DateOfPassing, ExamSeatNo, DegreeCertificateNo, TotalMarksOrGrade, OutOfMarks, QualifyExam FROM         StudentPEducationalDetails  WHERE (RegID = @FieldCode) ORDER BY SrNo
	 END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='ScholarshipEntry'
	 BEGIN
		SELECT     ScholarshipEntry.TID, MainClassMaster.MainClassName AS MainClass, ScholarshipEntry.RecordNo, CONVERT(varchar, ScholarshipEntry.TDate, 106) AS TDate, ScholarshipMaster.ScholarshipName, CategoryMaster.CategoryNameEN as Category, 
							  ScholarshipEntry.ReportName, ScholarshipEntry.AyCode
		FROM         ScholarshipEntry INNER JOIN
							  MainClassMaster ON ScholarshipEntry.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ScholarshipMaster ON ScholarshipEntry.ScholarshipCode = ScholarshipMaster.ScholarshipCode LEFT OUTER JOIN
							  CategoryMaster ON ScholarshipEntry.CategoryCode = CategoryMaster.CategoryCode
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='ScholarshipEntryDetail'
	 BEGIN
		SELECT     ScholarshipEntryDetail.TID, ScholarshipEntryDetail.RegID, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, 
							  StudInfoAll.RegNo, 
							  CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
							   ScholarshipEntryDetail.Amount, StudInfoAll.HostelStayFlag as HostelStay, ScholarshipEntryDetail.Amount1, ScholarshipEntryDetail.Amount2, StudInfoAll.AadharNo, CasteMaster.CasteName AS Caste, 
							  CasteMaster.CasteNameEN AS CasteEN, OccupationMaster.OccupationName AS Occupation, OccupationMaster.OccupationNameEN AS OccupationEN, BankMaster.BankName, 
							  BankMaster.IFSCCode, StudInfoAll.BankAcNo, StudInfoAll.AadharLinkBankStatus AS AadharLink
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  ScholarshipEntryDetail ON StudInfoAll.RegID = ScholarshipEntryDetail.RegID INNER JOIN
							  OccupationMaster ON StudInfoAll.FOccupationCode = OccupationMaster.OccupationCode INNER JOIN
							  BankMaster ON StudInfoAll.BankCode = BankMaster.BankCode INNER JOIN
							  CasteMaster ON StudInfoAll.CastCode = CasteMaster.CasteCode INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode
		WHERE     (ScholarshipEntryDetail.TID = @FieldCode)
		ORDER BY GenderMaster.GenderShort, StudInfoAll.RegNo
	END	 


	Else If @RecordSelection='TripCompetationEntry'
	 BEGIN
				SELECT   TripCompetationEntry.TID, MainClassMaster.MainClassName AS MainClass, TripCompetationEntry.RecordNo, CONVERT(varchar, TripCompetationEntry.TDate, 106) AS TDate, 
								 TripCompetationEntry.ReportName, TripCompetationEntry.TripCity, TripCompetationEntry.TripDays, TripCompetationEntry.TripSteyDays, TripCompetationEntry.AyCode
		FROM         TripCompetationEntry INNER JOIN
								 MainClassMaster ON TripCompetationEntry.MainClassCode = MainClassMaster.MainClassCode
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='TripCompetationEntryDetail'
	 BEGIN
		SELECT     TripCompetationEntryDetail.TID, TripCompetationEntryDetail.RegID, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, 
							  StudInfoAll.RegNo, 
							  CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
							   TripCompetationEntryDetail.Amount
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  TripCompetationEntryDetail ON StudInfoAll.RegID = TripCompetationEntryDetail.RegID INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode
		WHERE     (TripCompetationEntryDetail.TID = @FieldCode)
		ORDER BY GenderMaster.GenderShort, StudInfoAll.RegNo
	END	 

	Else If @RecordSelection='EmpMaster'
	 BEGIN
		SELECT     EmpMaster.TID, MainClassMaster.MainClassName AS MainClass, EmpMaster.RecordNo, EmpMaster.SrNo, EmpMaster.ScaleOfPay, EmpMaster.Firstname + ' ' + EmpMaster.MiddleName + ' ' + EmpMaster.LastName as EmployeeName, EmpMaster.MobileNo1, EmpMaster.DeleteFlag
		FROM         EmpMaster INNER JOIN
							  DesignationMaster ON EmpMaster.DesignationCode = DesignationMaster.DesignationCode INNER JOIN
							  MainClassMaster ON EmpMaster.MainClassCode = MainClassMaster.MainClassCode
		ORDER BY EmpMaster.SrNo	
	END	 

	Else If @RecordSelection='EmpMasterEdit'
	 BEGIN
		SELECT     EmpMaster.TID, MainClassMaster.MainClassName AS MainClass, EmpMaster.RecordNo, EmpTypeMaster.EmpTypeName, EmpMaster.SrNo, EmpMaster.ScaleOfPay, EmpMaster.Firstname, 
							  EmpMaster.MiddleName, EmpMaster.LastName, EmpMaster.FirstnameEN, EmpMaster.MiddleNameEN, EmpMaster.LastNameEN, EmpMaster.PermanentAddress, CityMaster.CityName AS PerCity, 
							  EmpMaster.LocalAddress, CityMaster_1.CityName AS LocCity, EmpMaster.MobileNo1, EmpMaster.MobileNo2, EmpMaster.BloodGroup, CasteMaster.CasteName, CategoryMaster.CategoryName, 
							  CityMaster_2.CityName AS BirthPlace, EmpMaster.Dob, EmpMaster.TeachingSubject, EmpMaster.TeachingClass, EmpMaster.PassingYear, EmpMaster.VMANoandDate, EmpMaster.DoWS, 
							  DesignationMaster.DesignationName, BankMaster.BankName, EmpMaster.BranchName, BankMaster.IFSCCode, EmpMaster.BankAcNo, EmpMaster.Photpath, EmpMaster.AdharCardNo, 
							  EmpMaster.ShalarthID, EmpMaster.GPFOrDCPSNo, EmpMaster.PanNo, EmpMaster.LICNo, EmpMaster.SQualification, EmpMaster.BQualification, ReligionMaster.ReligionName, 
							  EmpMaster.ClassTeacherShortName, GenderMaster.GenderName, EmpMaster.DeleteFlag, EmpMaster.JoiningDate, EmpMaster.AddressITR, EmpMaster.CityITR, EmpMaster.PinNoITR, 
							  EmpMaster.BankNameITR, EmpMaster.BankBranchITR, EmpMaster.IFSCCodeITR, EmpMaster.BankAcNoITR, EmpMaster.EmailIDITR, EmpMaster.MobileNoITR, EmpMaster.ITRPassword, 
							  EmpMaster.AadharLinkStatus, EmpMaster.BankCode2, BankMaster_1.BankName AS BankName2, BankMaster_1.IFSCCode AS IFSCCode2, EmpMaster.BranchName2, EmpMaster.BankAcNo2, 
							  EmpMaster.BankCode3, BankMaster_2.BankName AS BankName3, BankMaster_2.IFSCCode AS IFSCCode3, EmpMaster.BranchName3, EmpMaster.BankAcNo3, EmpMaster.BankCodeRD, 
							  BankMaster_3.BankName AS BankNameRD, BankMaster_3.IFSCCode AS IFSCCodeRD, EmpMaster.BranchNameRD, EmpMaster.BankAcNoRD, EmpMaster.BankCodeSociety, 
							  BankMaster_4.BankName AS BankNameSociety, BankMaster_4.IFSCCode AS IFSCCodeSociety, EmpMaster.BranchNameSociety, EmpMaster.BankAcNoSociety
		FROM         CityMaster INNER JOIN
							  EmpMaster INNER JOIN
							  EmpTypeMaster ON EmpMaster.EmpTypeCode = EmpTypeMaster.EmpTypeCode INNER JOIN
							  DesignationMaster ON EmpMaster.DesignationCode = DesignationMaster.DesignationCode INNER JOIN
							  MainClassMaster ON EmpMaster.MainClassCode = MainClassMaster.MainClassCode ON CityMaster.CityCode = EmpMaster.PerCitycode INNER JOIN
							  CityMaster AS CityMaster_1 ON EmpMaster.LocCitycode = CityMaster_1.CityCode INNER JOIN
							  CasteMaster ON EmpMaster.CastCode = CasteMaster.CasteCode INNER JOIN
							  CategoryMaster ON EmpMaster.CategoryCode = CategoryMaster.CategoryCode INNER JOIN
							  CityMaster AS CityMaster_2 ON EmpMaster.BirthPlaceCode = CityMaster_2.CityCode INNER JOIN
							  BankMaster ON EmpMaster.BankCode = BankMaster.BankCode INNER JOIN
							  ReligionMaster ON EmpMaster.ReligionCode = ReligionMaster.ReligionCode INNER JOIN
							  GenderMaster ON EmpMaster.GenderCode = GenderMaster.GenderCode INNER JOIN
							  BankMaster AS BankMaster_1 ON EmpMaster.BankCode2 = BankMaster_1.BankCode INNER JOIN
							  BankMaster AS BankMaster_2 ON EmpMaster.BankCode3 = BankMaster_2.BankCode INNER JOIN
							  BankMaster AS BankMaster_3 ON EmpMaster.BankCodeRD = BankMaster_3.BankCode INNER JOIN
							  BankMaster AS BankMaster_4 ON EmpMaster.BankCodeSociety = BankMaster_4.BankCode
	END	 
	Else If @RecordSelection='EmpSalaryMaster'
	 BEGIN
		SELECT     EmpMaster.TID, MainClassMaster.MainClassName AS MainClass, EmpMaster.SrNo, EmpMaster.Firstname + ' ' + EmpMaster.MiddleName + ' ' + EmpMaster.LastName AS EmployeeName, 
							  EmpSalaryMaster.PayMatrix, EmpSalaryMaster.DAPer, EmpSalaryMaster.NPSEmpRAllowPer, EmpSalaryMaster.HRAPer, EmpSalaryMaster.HRAMinimum, EmpSalaryMaster.CLA, EmpSalaryMaster.TA, EmpSalaryMaster.OtherAdd, EmpSalaryMaster.NetClaimPer, 
							  EmpSalaryMaster.GPFRegular, EmpSalaryMaster.GPFLoan, EmpSalaryMaster.DCPSRegular as DCPSPer, EmpSalaryMaster.DCPSDelayed, EmpSalaryMaster.PT, EmpSalaryMaster.AccidintalPolicy, 
							  EmpSalaryMaster.RevStamp, EmpSalaryMaster.NPSEmpContriPer, EmpSalaryMaster.IncomeTax, EmpSalaryMaster.RD, EmpSalaryMaster.LIC, EmpSalaryMaster.GLIC, EmpSalaryMaster.Society1, EmpSalaryMaster.Society2, EmpSalaryMaster.Society3, EmpSalaryMaster.Society, EmpSalaryMaster.BankLoan, EmpSalaryMaster.BankLoan1, EmpSalaryMaster.BankLoan2, EmpSalaryMaster.OtherDed, 
							  EmpTypeMaster.EmpTypeName
		FROM         EmpMaster INNER JOIN
							  MainClassMaster ON EmpMaster.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  EmpTypeMaster ON EmpMaster.EmpTypeCode = EmpTypeMaster.EmpTypeCode LEFT OUTER JOIN
							  EmpSalaryMaster ON EmpMaster.TID = EmpSalaryMaster.TID
		WHERE     (EmpMaster.DeleteFlag = 0)
		ORDER BY EmpMaster.SrNo
	END	 

	Else If @RecordSelection='EmpClassDivisionDefine'
	 BEGIN
		SELECT     EmpTID, ClassCode, DivisionCode FROM  EmpClassDivisionDefine
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='ScholarshipClassDefine'
	 BEGIN
		SELECT     ScholarshipCode, ClassCode, GenderCode, CategoryCode FROM  ScholarshipClassDefine
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='ScholarshipOccupationDefine'
	 BEGIN
		SELECT     ScholarshipCode, OccupationCode FROM  ScholarshipOccupationDefine
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='ScholarshipReligionDefine'
	 BEGIN
		SELECT     ScholarshipCode, ReligionCode FROM  ScholarshipReligionDefine
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='EmpMonthlySalary'
	BEGIN
		SELECT     EmpMonthlySalary.TID, MainClassMaster.MainClassName AS MainClass, EmpMonthlySalary.RecordNo, EmpTypeMaster.EmpTypeName, CONVERT(varchar, EmpMonthlySalary.TMDate, 106) 
							  AS TMDate, EmpMonthlySalary.ReportName, EmpMonthlySalary.RecoveryAdjusted, EmpMonthlySalary.RefundOfBalance, EmpMonthlySalary.FyCode, EmpMonthlySalary.Remark
		FROM         EmpMonthlySalary INNER JOIN
							  MainClassMaster ON EmpMonthlySalary.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  EmpTypeMaster ON EmpMonthlySalary.EmpTypeCode = EmpTypeMaster.EmpTypeCode
		ORDER BY EmpMonthlySalary.TID DESC	
	END		 	 

	Else If @RecordSelection='EmpMonthlySalaryDetail'
	BEGIN
		SELECT     EmpMonthlySalaryDetail.EmpTID, EmpMaster.SrNo, EmpMaster.Firstname + ' ' + EmpMaster.MiddleName + ' ' + EmpMaster.LastName AS EmployeeName, EmpMonthlySalaryDetail.PayMatrix, EmpMonthlySalaryDetail.PayMatrixArr,
							  EmpMonthlySalaryDetail.DAPer, EmpMonthlySalaryDetail.DA, EmpMonthlySalaryDetail.DAArr, EmpMonthlySalaryDetail.NPSEmpRAllowPer, EmpMonthlySalaryDetail.NPSEmpRAllow, EmpMonthlySalaryDetail.HRAPer, EmpMonthlySalaryDetail.HRA, EmpMonthlySalaryDetail.HRADiff, EmpMonthlySalaryDetail.CLA, EmpMonthlySalaryDetail.TA, 
							  EmpMonthlySalaryDetail.OtherAdd, EmpMonthlySalaryDetail.TotalAdd, EmpMonthlySalaryDetail.RecoveryAdjusted, EmpMonthlySalaryDetail.NetClaim, 
							  EmpMonthlySalaryDetail.GPFRegular, EmpMonthlySalaryDetail.GPFLoan, EmpMonthlySalaryDetail.DCPSPer, EmpMonthlySalaryDetail.DCPSRegular, EmpMonthlySalaryDetail.DCPSDelayed, 
							  EmpMonthlySalaryDetail.PT, EmpMonthlySalaryDetail.AccidintalPolicy, EmpMonthlySalaryDetail.RevStamp, EmpMonthlySalaryDetail.NPSEmpRContri, EmpMonthlySalaryDetail.NPSEmpContriPer, EmpMonthlySalaryDetail.NPSEmpContri, EmpMonthlySalaryDetail.IncomeTax, EmpMonthlySalaryDetail.RD, 
							  EmpMonthlySalaryDetail.LIC, EmpMonthlySalaryDetail.GLIC, EmpMonthlySalaryDetail.Society1, EmpMonthlySalaryDetail.Society2, EmpMonthlySalaryDetail.Society3, EmpMonthlySalaryDetail.Society, EmpMonthlySalaryDetail.BankLoan, EmpMonthlySalaryDetail.BankLoan1, 
							  EmpMonthlySalaryDetail.BankLoan2, EmpMonthlySalaryDetail.OtherDed, EmpMonthlySalaryDetail.TotalDedOnline, EmpMonthlySalaryDetail.NetPayable, EmpMonthlySalaryDetail.TotalDed, 
							  EmpMonthlySalaryDetail.NetClaimFinal, EmpMonthlySalaryDetail.Remak, EmpTypeMaster.EmpTypeName AS EmpType, MainClassMaster.MainClassName AS MainClass, 
							  EmpSalaryMaster.HRAMinimum
		FROM         EmpMonthlySalaryDetail INNER JOIN
							  EmpMaster ON EmpMonthlySalaryDetail.EmpTID = EmpMaster.TID INNER JOIN
							  EmpTypeMaster ON EmpMaster.EmpTypeCode = EmpTypeMaster.EmpTypeCode INNER JOIN
							  MainClassMaster ON EmpMaster.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  EmpSalaryMaster ON EmpMaster.TID = EmpSalaryMaster.TID
		WHERE     (EmpMonthlySalaryDetail.TID = @FieldCode)
		ORDER BY EmpMaster.SrNo	
	END

	Else If @RecordSelection='EmpMonthlySalaryDetailNew'
	BEGIN
		SELECT     EmpMaster.TID AS EmpTID, EmpMaster.SrNo, EmpMaster.Firstname + ' ' + EmpMaster.MiddleName + ' ' + EmpMaster.LastName AS EmployeeName, EmpSalaryMaster.PayMatrix, 0 AS PayMatrixArr, 
							  EmpSalaryMaster.DAPer, 0 as DA, 0 AS DAArr, EmpSalaryMaster.NPSEmpRAllowPer, 0 as NPSEmpRAllow, EmpSalaryMaster.HRAPer, 0 as HRA, 0 as HRADiff, EmpSalaryMaster.CLA, EmpSalaryMaster.TA, EmpSalaryMaster.OtherAdd, 0 AS TotalAdd, 0 AS RecoveryAdjusted, 0 AS NetClaim, 
							  EmpSalaryMaster.GPFRegular, EmpSalaryMaster.GPFLoan, EmpSalaryMaster.DCPSRegular as DCPSPer, 0 as DCPSRegular, EmpSalaryMaster.DCPSDelayed, EmpSalaryMaster.PT, EmpSalaryMaster.AccidintalPolicy, 
							  EmpSalaryMaster.RevStamp, 0 AS NPSEmpRContri,EmpSalaryMaster.NPSEmpContriPer, 0 AS NPSEmpContri, EmpSalaryMaster.IncomeTax, EmpSalaryMaster.RD, EmpSalaryMaster.LIC, EmpSalaryMaster.GLIC, EmpSalaryMaster.Society1, EmpSalaryMaster.Society2, EmpSalaryMaster.Society3, EmpSalaryMaster.Society, EmpSalaryMaster.BankLoan, EmpSalaryMaster.BankLoan1, EmpSalaryMaster.BankLoan2, EmpSalaryMaster.OtherDed, 
							  0 AS TotalDedOnline, 0 AS NetPayable,0 AS TotalDed, 0 AS NetClaimFinal, '-' AS Remak, EmpTypeMaster.EmpTypeName AS EmpType, MainClassMaster.MainClassName AS MainClass,EmpSalaryMaster.HRAMinimum
		FROM         EmpMaster INNER JOIN
							  MainClassMaster ON EmpMaster.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  EmpTypeMaster ON EmpMaster.EmpTypeCode = EmpTypeMaster.EmpTypeCode LEFT OUTER JOIN
							  EmpSalaryMaster ON EmpMaster.TID = EmpSalaryMaster.TID
		WHERE     (EmpMaster.DeleteFlag = 0)
		ORDER BY EmpMaster.SrNo	
	END

	 Else If @RecordSelection='DREntry'
		 BEGIN
				 SELECT     DREntry.TID, MainClassMaster.MainClassName AS MainClass, DREntry.ReceiptNo, CONVERT(varchar, DREntry.ReceiptDate, 106) AS ReceiptDate, DRHeadMaster.DRHeadName, DREntry.DonorName, DREntry.Address, DREntry.Amount, 
							  DREntry.Remark, DREntry.AyCode, DREntry.RegID
		FROM         DREntry INNER JOIN
							  DRHeadMaster ON DREntry.DRHeadCode = DRHeadMaster.DRHeadCode INNER JOIN
							  MainClassMaster ON DREntry.MainClassCode = MainClassMaster.MainClassCode
		ORDER BY DREntry.ReceiptNo DESC
	END		 	 
	
	Else If @RecordSelection='ExamMarksDefine'
	 BEGIN
		SELECT     ExamMarksDefine.TID, ClassMaster.ClassName AS Class, ExamGroupMaster.ExamGroupName AS ExamGroup, ExamMarksDefine.SrNo, SubjectMaster.SubjectName, 
							  ExamMarksTypeMaster.ExamMarksTypeName AS MarksType, ExamMarksDefine.MinMarks, ExamMarksDefine.MaxMarks, ExamMarksDefine.DivideMarks, 
							  ExamMarksDefine.MarksAddInTotalFlag
		FROM         ExamMarksDefine INNER JOIN
							  ClassMaster ON ExamMarksDefine.ClassCode = ClassMaster.ClassCode INNER JOIN
							  ExamGroupMaster ON ExamMarksDefine.ExamGroupcode = ExamGroupMaster.ExamGroupCode INNER JOIN
							  SubjectMaster ON ExamMarksDefine.SubjectCode = SubjectMaster.SubjectCode INNER JOIN
							  ExamMarksTypeMaster ON ExamMarksDefine.ExamMarksTypeCode = ExamMarksTypeMaster.ExamMarksTypeCode
		ORDER BY ExamMarksDefine.SrNo
	END		 	 

	Else If @RecordSelection='ExamMarksDefineDetail'
	 BEGIN
		SELECT     ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, ExamMarksTypeMaster.ExamMarksTypeName AS MarksType, ExamMaster.ExamName AS Exam, 
							  ExamMarksDefine.SrNo, SubjectMaster.SubjectName, ExamMarksDefine.ST1Marks1, ExamMarksDefine.ST1Marks2, ExamMarksDefine.ST1Marks3, ExamMarksDefine.ST1Marks4, 
							  ExamMarksDefine.ST1Marks5, ExamMarksDefine.ST1Marks6, ExamMarksDefine.ST1Marks7, ExamMarksDefine.ST1MarksTotal, ExamMarksDefine.ST2MarksTotal, 
							  ExamMarksDefine.ST3MarksTotal, ExamMarksDefine.ExamMarksTypeCode, ClassMaster.MaxSubDEntry, ClassMaster.MaxTermDEntry, ExamMarksDefine.DivideMarks, 
							  ExamMarksDefine.MarksAddInTotalFlag
		FROM         ExamMarksDefine INNER JOIN
							  ClassMaster ON ExamMarksDefine.ClassCode = ClassMaster.ClassCode INNER JOIN
							  SubjectMaster ON ExamMarksDefine.SubjectCode = SubjectMaster.SubjectCode INNER JOIN
							  ExamMarksTypeMaster ON ExamMarksDefine.ExamMarksTypeCode = ExamMarksTypeMaster.ExamMarksTypeCode INNER JOIN
							  ExamGroupDetail ON ExamMarksDefine.ExamGroupcode = ExamGroupDetail.ExamGroupcode INNER JOIN
							  ExamMaster ON ExamGroupDetail.ExamCode = ExamMaster.ExamCode INNER JOIN
							  DivisionMaster ON ExamGroupDetail.DivisionCode = DivisionMaster.DivisionCode
		ORDER BY ExamMarksDefine.SrNo
	END		 	 

	Else If @RecordSelection='SubjectDEMaster'
	 BEGIN
		SELECT     SubjectDEMaster.SubjectDECode, SubjectDEMaster.SrNo, SubDEClassGroupMaster.SubDEClassGName, SubjectMaster.SubjectName, SubjectDEMaster.SubjectDEName, 
							  SubjectDEMaster.DeleteFlag
		FROM         SubjectDEMaster INNER JOIN
							  SubjectMaster ON SubjectDEMaster.SubjectCode = SubjectMaster.SubjectCode INNER JOIN
							  SubDEClassGroupMaster ON SubjectDEMaster.SubDEClassGCode = SubDEClassGroupMaster.SubDEClassGCode
		ORDER BY SubjectDEMaster.SrNo
	END		 	 

	Else If @RecordSelection='ExamAdmitCard'
	 BEGIN
		SELECT     ExamAdmitCard.TID, ClassMaster.ClassName AS Class, ExamMaster.ExamName, ExamAdmitCard.SrNo, SubjectMaster.SubjectName, ExamAdmitCard.ExamDate, CONVERT(TIME, 
							  ExamAdmitCard.FromTime) AS FromTime, CONVERT(TIME, ExamAdmitCard.ToTime) AS ToTime, CONVERT(varchar(15),CAST(ExamAdmitCard.FromTime AS TIME),100) as FTime, CONVERT(varchar(15),CAST(ExamAdmitCard.ToTime AS TIME),100) as TTime, ExamAdmitCard.Note, ExamAdmitCard.Syllabus, DivisionMaster.DivisionName
		FROM         ExamAdmitCard INNER JOIN
							  ClassMaster ON ExamAdmitCard.ClassCode = ClassMaster.ClassCode INNER JOIN
							  ExamMaster ON ExamAdmitCard.ExamCode = ExamMaster.ExamCode INNER JOIN
							  SubjectMaster ON ExamAdmitCard.SubjectCode = SubjectMaster.SubjectCode LEFT OUTER JOIN
							  DivisionMaster ON ExamAdmitCard.DivisionCode = DivisionMaster.DivisionCode
		ORDER BY ExamAdmitCard.SrNo
	END		 	 

	Else If @RecordSelection='StudOptionalSubjectDefine'
	 BEGIN
		SELECT     StudInfo.RegID, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, StudInfo.RegNo, 
							  CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
							   AS StudentName, MediumMaster.MediumName AS Medium, DivisionMaster.DivisionName AS Div, GenderMaster.GenderShort, StudInfo.AyCode, StudInfo.CloseFlag, 
							  OptionalSubjectGroupMaster.OptionalSubjectGroupName
		FROM         OptionalSubjectGroupMaster RIGHT OUTER JOIN
							  StudOptionalSubjectDefine ON OptionalSubjectGroupMaster.OptionalSubjectGroupCode = StudOptionalSubjectDefine.OptionalSubjectGroupCode RIGHT OUTER JOIN
							  GenderMaster INNER JOIN
							  StudInfo INNER JOIN
							  MainClassMaster ON StudInfo.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfo.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfo.DivisionCode = DivisionMaster.DivisionCode ON GenderMaster.GenderCode = StudInfo.GenderCode INNER JOIN
							  MediumMaster ON StudInfo.MediumCode = MediumMaster.MediumCode ON StudOptionalSubjectDefine.RegID = StudInfo.RegID
		WHERE     (StudInfo.CloseFlag = 'N') AND (StudInfo.EntryFrom = 'A')
	END	 

	Else If @RecordSelection='SubjectTypeDetailMaster'
	 BEGIN
			 SELECT  SubjectTypeDetailMaster.SubjectTypeDetailCode, SubjectTypeDetailMaster.ClassCode, ClassMaster.ClassName as Class, SubjectTypeDetailMaster.SrNo, SubjectTypeDetailMaster.SubjectTypeDetailName, SubjectTypeDetailMaster.DivideMarks, SubjectTypeDetailMaster.DeleteFlag FROM  SubjectTypeDetailMaster INNER JOIN ClassMaster ON SubjectTypeDetailMaster.ClassCode = ClassMaster.ClassCode ORDER BY SubjectTypeDetailMaster.SrNo
	 END	 

	else If @RecordSelection='ExamStudInfo'
	 BEGIN
		SELECT     StudInfo.RegID, MainClassMaster.MainClassName AS MainClass, StudInfo.RegNo, MediumMaster.MediumName AS Medium, 
							  CASE StudInfo.LastName WHEN '-' THEN StudInfo.Firstname + ' ' + StudInfo.MiddleName ELSE StudInfo.Firstname + ' ' + StudInfo.MiddleName + ' ' + StudInfo.LastName END AS StudentName, 
							  ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, GenderMaster.GenderName AS Gender, GenderMaster.GenderShort
		FROM         StudInfo INNER JOIN
							  MainClassMaster ON StudInfo.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfo.ClassCode = ClassMaster.ClassCode INNER JOIN
							  MediumMaster ON StudInfo.MediumCode = MediumMaster.MediumCode INNER JOIN
							  DivisionMaster ON StudInfo.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  GenderMaster ON StudInfo.GenderCode = GenderMaster.GenderCode
		WHERE     (StudInfo.EntryFrom = N'A') AND (StudInfo.CloseFlag = N'N' Or StudInfo.MarksFeedFlag = N'Y')
		ORDER BY GenderShort, StudInfo.RegNo
	 END

	Else If @RecordSelection='StudentExamSubjectDEntry'
	 BEGIN
		SELECT     RegID, ExamCode, SubjectCode, SubjectDECode FROM  StudentExamSubjectDEntry
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='ClassWiseMaxDEntryDefine'
	 BEGIN
		SELECT  ClassMaster.ClassCode, ClassMaster.ClassName AS Class, ClassMaster.MaxSubDEntry, ClassMaster.MaxTermDEntry, MainClassMaster.MainClassName AS MainClass FROM         ClassMaster INNER JOIN MainClassMaster ON ClassMaster.MainClassCode = MainClassMaster.MainClassCode WHERE     (ClassMaster.DeleteFlag = 0) ORDER BY ClassMaster.ClassCode
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='StudentExamTermDEntry'
	 BEGIN
			SELECT     DEMaster.DETitleCode, DEMaster.SrNo, StudentExamTermDEntry.DECode, DEMaster.DEName, DETitleMaster.DETitleName, StudentExamTermDEntry.RegID, StudentExamTermDEntry.ExamCode 
			FROM         StudentExamTermDEntry INNER JOIN
								  DEMaster ON StudentExamTermDEntry.DECode = DEMaster.DECode INNER JOIN
								  DETitleMaster ON DEMaster.DETitleCode = DETitleMaster.DETitleCode
			ORDER BY DEMaster.DETitleCode, DEMaster.SrNo
	END

	Else If @RecordSelection='CRSubjectMaster'
	 BEGIN
				SELECT     SrNo, CRSubjectCode, CRSubjectName, '-' as Class1FT, '-' as Class1ST, '-' as Class2FT, '-' as Class2ST, '-' as Class3FT, '-' as Class3ST, '-' as Class4FT, '-' as Class4ST, '-' as Class5FT, '-' as Class5ST, '-' as Class6FT, '-' as Class6ST, '-' as Class7FT, '-' as Class7ST, '-' as Class8FT, '-' as Class8ST
		FROM         CRSubjectMaster
		WHERE     (DeleteFlag = 0)
		ORDER BY SrNo
	 END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='CRResultDetail'
	 BEGIN
		SELECT     RegID, CRSubjectCode, Class1FT, Class1ST, Class2FT, Class2ST, Class3FT, Class3ST, Class4FT, Class4ST, Class5FT, Class5ST, Class6FT, Class6ST, Class7FT, Class7ST, Class8FT,  Class8ST FROM         CRResultDetail WHERE     (RegID = @FieldCode)
	 END
	 		 	 			 	 	 	 			 	 
	Else If @RecordSelection='CRDEClassExamMaster'
	 BEGIN
		SELECT     SrNo, ExamCode, ClassCode, ClassExamTitle, '-' AS Improvement, '-' AS Hobbies, '-' AS PayAttention, '-' AS Skills, '-' AS ClassTeacherName, '-' AS PrincipleName 
		FROM         CRDEClassExamMaster
		ORDER BY SrNo
	 END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='CRDEDetail'
	 BEGIN
		SELECT     RegID, ClassCode, ExamCode, DETitle1, DETitle2, DETitle3, DETitle4, ClassTeacherName, PrincipleName FROM         CRDEDetail WHERE     (RegID = @FieldCode)
	 END

	Else If @RecordSelection='CRGovSchemeMaster'
	 BEGIN
		SELECT     SrNo, CRGovSchemeCode, CRGovSchemeName,'-' as Class1,'-' as Class2,'-' as Class3,'-' as Class4,'-' as Class5,'-' as Class6,'-' as Class7,'-' as Class8 FROM         CRGovSchemeMaster WHERE     (DeleteFlag = 0) ORDER BY SrNo
	 END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='CRGovSchemeDetail'
	 BEGIN
		SELECT     RegID, CRGovSchemeCode, Class1, Class2, Class3, Class4, Class5, Class6, Class7, Class8 FROM         CRGovSchemeDetail  WHERE     (RegID = @FieldCode)
	 END

	Else If @RecordSelection='StudentGoshwaraDaily'
	 BEGIN
		SELECT     TDate, MainClassCode, RegID  FROM         StudentGoshwaraDaily
	 END

	Else If @RecordSelection='MainClassCountMaster'
	 BEGIN
		SELECT     MainClassCountCode, MainClassCountName, SrNo, DeleteFlag FROM         MainClassCountMaster Where DeleteFlag = 0 ORDER BY SrNo
	END		 	 			 	 	 	 			 	 
	
	Else If @RecordSelection='MainClassCountDetail'
	 BEGIN
		SELECT     MainClassCountCode, ClassCode, DivisionCode FROM         MainClassCountDetail
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='MainClassCountDetailClass'
	 BEGIN
		SELECT     Distinct MainClassCountCode, ClassCode FROM         MainClassCountDetail
	 END		 

	Else If @RecordSelection='MainClassCountDetailDivision'
	 BEGIN
		SELECT     Distinct MainClassCountCode, DivisionCode FROM         MainClassCountDetail
	 END

	Else If @RecordSelection='EmpITReturnAmount'
	 BEGIN
		SELECT     EmpMaster.TID, MainClassMaster.MainClassName AS MainClass, EmpMaster.SrNo, EmpMaster.Firstname + ' ' + EmpMaster.MiddleName + ' ' + EmpMaster.LastName AS EmployeeName, 
							  EmpITReturnAmount.HouseRentReceived, EmpITReturnAmount.OtherTaxableIncome, EmpITReturnAmount.HouseRentPaid, EmpITReturnAmount.HouseLoanPrincipal, 
							  EmpITReturnAmount.HouseLoanInterest, EmpITReturnAmount.MunicipalTaxPaid, EmpITReturnAmount.LICExternal, EmpITReturnAmount.MatualFund, EmpITReturnAmount.TutionFees, 
							  EmpITReturnAmount.EduLoanIntrest, EmpITReturnAmount.Donation80G, EmpITReturnAmount.Insurance, EmpITReturnAmount.MediClaimPolicy, EmpITReturnAmount.OtherDeduction, 
							  EmpTypeMaster.EmpTypeName
		FROM         EmpMaster INNER JOIN
							  MainClassMaster ON EmpMaster.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  EmpTypeMaster ON EmpMaster.EmpTypeCode = EmpTypeMaster.EmpTypeCode LEFT OUTER JOIN
							  EmpITReturnAmount ON EmpMaster.TID = EmpITReturnAmount.TID
		WHERE     (EmpMaster.DeleteFlag = 0)
		ORDER BY EmpMaster.SrNo	
	 END	 

	  Else If @RecordSelection='LibBookMaster'  
	  BEGIN   
		SELECT     LibBookMaster.BookTID, LibBookMaster.AccessionNo, LibAuthorMaster.LibAuthorName, LibBookTitleMaster.LibBookTitleName, LibBookTitleGroupMaster.LibBookTitleGroupName, 
							  LibEditionMaster.LibEditionName, LibBookMaster.BookSubTitle, LibPublicationMaster.LibPublicationName, LibBookMaster.PublicationYear, LibPublisherMaster.LibPublisherName, 
							  LibBookMaster.TotalPages, LibBookMaster.NoOfQty, LibBookMaster.BookPrice, LibBookMaster.BillNo, CONVERT(varchar, LibBookMaster.BillDate, 106) 
							  AS BillDate, LibBookSubjectMaster.LibBookSubjectName, LibSupplierMaster.LibSupplierName, LibBookLocationMaster.LibBookLocationName, LibBookStatusMaster.LibBookStatusName, 
							  LibBookLanguageMaster.LibBookLanguageName, LibBookMaster.Remark, LibBookMaster.LibStatusCode, LibBookMaster.DeleteFlag
		FROM         LibBookMaster INNER JOIN
							  LibSupplierMaster ON LibBookMaster.LibSupplierCode = LibSupplierMaster.LibSupplierCode INNER JOIN
							  LibAuthorMaster ON LibBookMaster.AuthorCode = LibAuthorMaster.LibAuthorCode INNER JOIN
							  LibEditionMaster ON LibBookMaster.EditionCode = LibEditionMaster.LibEditionCode INNER JOIN
							  LibPublicationMaster ON LibBookMaster.LibPublicationCode = LibPublicationMaster.LibPublicationCode INNER JOIN
							  LibPublisherMaster ON LibBookMaster.LibPublisherCode = LibPublisherMaster.LibPublisherCode INNER JOIN
							  LibBookLanguageMaster ON LibBookMaster.LibBookLanguageCode = LibBookLanguageMaster.LibBookLanguageCode INNER JOIN
							  LibBookLocationMaster ON LibBookMaster.LibBookLocationCode = LibBookLocationMaster.LibBookLocationCode INNER JOIN
							  LibBookStatusMaster ON LibBookMaster.LibStatusCode = LibBookStatusMaster.LibBookStatusCode INNER JOIN
							  LibBookSubjectMaster ON LibBookMaster.LibBookSubjectCode = LibBookSubjectMaster.LibBookSubjectCode INNER JOIN
							  LibBookTitleGroupMaster ON LibBookMaster.BookTitleGroupCode = LibBookTitleGroupMaster.LibBookTitleGroupCode INNER JOIN
							  LibBookTitleMaster ON LibBookMaster.BookTitleCode = LibBookTitleMaster.LibBookTitleCode
								WHERE     (LibBookMaster.DeleteFlag = 0)
	 END

	Else if @RecordSelection='StoreClassWiseStationeryItemDefine'
	  BEGIN
	     SELECT     dbo.StoreClassWiseStationeryItemDefine.CDTID, dbo.StoreClassWiseStationeryItemDefine.SrNo, dbo.StoreClassWiseStationeryItemDefine.ClassCode, dbo.ClassMaster.ClassName, 
                      dbo.StoreClassWiseStationeryItemDefine.ItemCode, dbo.ItemMaster.ItemName, dbo.StoreClassWiseStationeryItemDefine.Qty
			FROM         dbo.StoreClassWiseStationeryItemDefine INNER JOIN
                      dbo.ItemMaster ON dbo.StoreClassWiseStationeryItemDefine.ItemCode = dbo.ItemMaster.ItemCode INNER JOIN
                      dbo.ClassMaster ON dbo.StoreClassWiseStationeryItemDefine.ClassCode = dbo.ClassMaster.ClassCode
	  END
END
GO
/****** Object:  StoredProcedure [dbo].[SP_EditRecord1]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_EditRecord1]
	@RecordSelection nvarchar(120)=null, @FieldCode bigint=null, @AyCode bigint=null, @WhereCondition nvarchar(Max)=Null, @RegID bigint=null, @ExamCode bigint=null, @DETitleCode bigint=null, @TID bigint=null
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	If @RecordSelection='SPAClassTypeMaster'
	 BEGIN
		SELECT     SPAClassTypeCode, SPAClassTypeName, DeleteFlag FROM         SPAClassTypeMaster Where DeleteFlag = 0 ORDER BY SPAClassTypeCode
	END		 	 			 	 	 	 			 	 
	
	Else If @RecordSelection='SPAClassTypeClassDetail'
	 BEGIN
		SELECT     SPAClassTypeCode, ClassCode, DivisionCode FROM         SPAClassTypeClassDetail
	END		 	 			 	 	 	 			 	 

	 Else If @RecordSelection='SPAItemMaster'
	 BEGIN
		SELECT     SPAItemMaster.SPAItemCode, SPAItemMaster.SPAItemName, SPAItemMaster.UnitCode, UnitMaster.UnitName, SPAItemMaster.DeleteFlag FROM         SPAItemMaster INNER JOIN UnitMaster ON SPAItemMaster.UnitCode = UnitMaster.UnitCode
	 END

	 Else If @RecordSelection='SPAItemQtyDefine'
	 BEGIN
		SELECT     SPAItemQtyDefine.SPAItemTID, SPAItemQtyDefine.SrNo, SPAItemQtyDefine.SPAItemCode, SPAItemMaster.SPAItemName, SPAClassTypeMaster.SPAClassTypeName, 
							  SPAMenuTypeMaster.SPAMenuTypeName
		FROM         SPAItemQtyDefine INNER JOIN
							  SPAItemMaster ON SPAItemQtyDefine.SPAItemCode = SPAItemMaster.SPAItemCode INNER JOIN
							  SPAMenuTypeMaster ON SPAItemQtyDefine.SPAMenuTypeCode = SPAMenuTypeMaster.SPAMenuTypeCode INNER JOIN
							  SPAClassTypeMaster ON SPAItemQtyDefine.SPAClassTypeCode = SPAClassTypeMaster.SPAClassTypeCode
		WHERE     (SPAItemQtyDefine.DeleteFlag = 0)
		ORDER BY SPAItemQtyDefine.SrNo
	 END

	 Else If @RecordSelection='SPAItemQtyDefineDetail'
	 BEGIN
		SELECT     SPAItemQtyDefineDetail.Qty, SPAItemQtyDefine.SPAItemCode, SPAItemQtyDefine.SPAClassTypeCode, SPAItemQtyDefine.SPAMenuTypeCode, SPAItemQtyDefineDetail.SPADayCode FROM         SPAItemQtyDefineDetail INNER JOIN SPAItemQtyDefine ON SPAItemQtyDefineDetail.SPAItemTID = SPAItemQtyDefine.SPAItemTID WHERE     (SPAItemQtyDefine.DeleteFlag = 0)
	 END

	 Else If @RecordSelection='SPAMainMenuMaster'
	 BEGIN
		SELECT     SPAMainMenuMaster.SPAMainMenuTID, SPAMainMenuMaster.SPAMainMenuCode, SPADayMaster.SPADayName, SPAMainMenuMaster.SPAMainMenuName, SPAMenuTypeMaster.SPAMenuTypeName, 
							  SPAClassTypeMaster.SPAClassTypeName, SPAMainMenuMaster.SPADayCode
		FROM         SPAMainMenuMaster INNER JOIN
							  SPAMenuTypeMaster ON SPAMainMenuMaster.SPAMenuTypeCode = SPAMenuTypeMaster.SPAMenuTypeCode INNER JOIN
							  SPAClassTypeMaster ON SPAMainMenuMaster.SPAClassTypeCode = SPAClassTypeMaster.SPAClassTypeCode INNER JOIN
							  SPADayMaster ON SPAMainMenuMaster.SPADayCode = SPADayMaster.SPADayCode	 END

	 Else If @RecordSelection='LibBookTitleGroupMaster'
	 BEGIN
		SELECT LibBookTitleGroupCode, LibBookTitleGroupName, DeleteFlag FROM LibBookTitleGroupMaster ORDER BY LibBookTitleGroupMaster.LibBookTitleGroupCode
	 END

	 Else If @RecordSelection='LibBookTitleMaster'
	 BEGIN
		SELECT LibBookTitleCode, LibBookTitleName, DeleteFlag FROM LibBookTitleMaster ORDER BY LibBookTitleMaster.LibBookTitleCode
	 END

	 Else If @RecordSelection='LibAuthorMaster'
	 BEGIN
		SELECT LibAuthorCode, LibAuthorName, DeleteFlag FROM LibAuthorMaster ORDER BY LibAuthorMaster.LibAuthorCode
	 END

	 Else If @RecordSelection='LibEditionMaster'
	 BEGIN
		SELECT LibEditionCode, LibEditionName, DeleteFlag FROM LibEditionMaster ORDER BY LibEditionMaster.LibEditionCode
	 END

	 Else If @RecordSelection='LibPublisherMaster'
	 BEGIN
		SELECT LibPublisherCode, LibPublisherName, DeleteFlag FROM LibPublisherMaster ORDER BY LibPublisherMaster.LibPublisherCode
	 END

	 Else If @RecordSelection='LibSupplierMaster'
	 BEGIN
		SELECT LibSupplierCode, LibSupplierName, DeleteFlag FROM LibSupplierMaster ORDER BY LibSupplierMaster.LibSupplierCode
	 END

	 Else If @RecordSelection='LibBookLanguageMaster'
	 BEGIN
		SELECT LibBookLanguageCode, LibBookLanguageName, DeleteFlag FROM LibBookLanguageMaster ORDER BY LibBookLanguageMaster.LibBookLanguageCode
	 END

	 Else If @RecordSelection='LibBookStatusMaster'
	 BEGIN
		SELECT LibBookStatusCode, LibBookStatusName, DeleteFlag FROM LibBookStatusMaster ORDER BY LibBookStatusMaster.LibBookStatusCode
	 END

	 Else If @RecordSelection='LibBookSubjectMaster'
	 BEGIN
		SELECT LibBookSubjectCode, LibBookSubjectName, DeleteFlag FROM LibBookSubjectMaster ORDER BY LibBookSubjectMaster.LibBookSubjectCode
	 END

	 Else If @RecordSelection='LibBookLocationMaster'
	 BEGIN
		SELECT LibBookLocationCode, LibBookLocationName, DeleteFlag FROM LibBookLocationMaster ORDER BY LibBookLocationMaster.LibBookLocationCode
	 END

	 Else If @RecordSelection='UnitMaster'
	 BEGIN
		SELECT UnitCode, UnitName, DeleteFlag FROM UnitMaster ORDER BY UnitMaster.UnitCode
	 END

	Else If @RecordSelection='SPATransaction'
	BEGIN
		SELECT     SPATransaction.TID, CONVERT(varchar, SPATransaction.TMonth, 106) as TMonth, SPAClassTypeMaster.SPAClassTypeName, SPAMenuTypeMaster.SPAMenuTypeName, SPATransaction.MaxStudent, SPATransaction.TotalDays, 
							  SPATransaction.WorkingDays, SPATransaction.Remark, SPATransaction.ExpAmt1, SPATransaction.ExpAmt2, SPATransaction.ExpAmt3, SPATransaction.ExpAmt4, SPATransaction.ExpAmt5, 
							  SPATransaction.AnudanTotal
		FROM         SPATransaction INNER JOIN
							  SPAClassTypeMaster ON SPATransaction.SPAClassTypeCode = SPAClassTypeMaster.SPAClassTypeCode INNER JOIN
							  SPAMenuTypeMaster ON SPATransaction.SPAMenuTypeCode = SPAMenuTypeMaster.SPAMenuTypeCode
	END		 	 

	Else If @RecordSelection='SPATransactionItem'
	BEGIN
		SELECT     TID, TDate, SPAItemTID, Opening, Receipt, Used, Closing FROM         SPATransactionItem
	END

	Else If @RecordSelection='SPATransactionStudent'
	BEGIN
		SELECT     TID, TDate, PresentStudent, LunchStudent FROM         SPATransactionStudent
	END

	 Else If @RecordSelection='FeesCollectionOther'
		 BEGIN
			SELECT     FeesCollectionOther.ReceiptTID, FeesCollectionOther.ReceiptNo, CONVERT(varchar, FeesCollectionOther.ReceiptDate, 106) AS ReceiptDate, MainClassMaster.MainClassName AS MainClass,  ClassMaster.ClassName AS Class, FeesCollectionOther.RegNo, FeesCollectionOther.StudentName, FeeTitleOtherGroupMaster.FeeTitleOtherGroupName,  FeesCollectionOther.TotalFeesAmount AS FeesAmount, FeesCollectionOther.CancelReceiptAmt, FeesCollectionOther.Remark, PaymentTypeMaster.PaymentTypeName AS PType,  FeesCollectionOther.FeeCategoryCode, FeesCollectionOther.BankName, FeesCollectionOther.ChequeNo, CONVERT(varchar, FeesCollectionOther.ChequeDate, 106) AS ChequeDate,  FeesCollectionOther.AyCode, FeesCollectionOther.CancelReceiptFlag, FeesCollectionOther.PrintFlag, MainClassMaster.MainClassCode, AyMaster.AyName, FeesCollectionOther.FyCode,  FyMaster.FyName, FeesCollectionOther.UserCode, UserMaster.UserName FROM         MainClassMaster INNER JOIN PaymentTypeMaster INNER JOIN FeesCollectionOther ON PaymentTypeMaster.PaymentTypeCode = FeesCollectionOther.PaymentTypeCode INNER JOIN ClassMaster ON FeesCollectionOther.ClassCode = ClassMaster.ClassCode ON MainClassMaster.MainClassCode = FeesCollectionOther.MainClassCode INNER JOIN FeeTitleOtherGroupMaster ON FeesCollectionOther.FeeTitleOtherGroupCode = FeeTitleOtherGroupMaster.FeeTitleOtherGroupCode INNER JOIN AyMaster ON FeesCollectionOther.AyCode = AyMaster.AyCode INNER JOIN FyMaster ON FeesCollectionOther.FyCode = FyMaster.FyCode INNER JOIN UserMaster ON FeesCollectionOther.UserCode = UserMaster.UserCode where FeesCollectionOther.ReceiptTID = @FieldCode
		END		 	 

	Else If @RecordSelection='FeesCollectionOtherDetail'
	BEGIN
				SELECT     FeeTitleOtherMaster.FeeTitleOtherCode, FeeTitleOtherMaster.SrNo, FeeTitleOtherMaster.FeeTitleOtherName, FeesDefineOther.FeesAmount AS PaidAmount
		FROM         FeeTitleOtherMaster INNER JOIN
							  FeesDefineOther ON FeeTitleOtherMaster.FeeTitleOtherCode = FeesDefineOther.FeeTitleOtherCode INNER JOIN
							  ClassMaster ON FeesDefineOther.ClassCode = ClassMaster.ClassCode INNER JOIN
							  FeeTitleOtherGroupMaster ON FeesDefineOther.FeeTitleOtherGroupCode = FeeTitleOtherGroupMaster.FeeTitleOtherGroupCode
		WHERE     FeeTitleOtherMaster.DeleteFlag = 0  And ClassMaster.ClassCode = @FieldCode And FeesDefineOther.AyCode = @AyCode And FeeTitleOtherGroupMaster.FeeTitleOtherGroupName = @WhereCondition ORDER BY FeeTitleOtherMaster.SrNo
	END

	Else If @RecordSelection='FeesCollectionOtherDetailReceived'
	BEGIN
		IF EXISTS (SELECT ReceiptTID FROM  FeesCollectionOtherDetail WHERE ReceiptTID = @TID)
			Begin
				SELECT     FeeTitleOtherMaster.FeeTitleOtherCode, FeesCollectionOtherDetail.SrNo, FeeTitleOtherMaster.FeeTitleOtherName, 0 AS PaidAmount
				FROM         FeeTitleOtherGroupMaster INNER JOIN
									  FeeTitleOtherMaster INNER JOIN
									  FeesCollectionOtherDetail ON FeeTitleOtherMaster.FeeTitleOtherCode = FeesCollectionOtherDetail.FeeTitleOtherCode INNER JOIN
									  FeesCollectionOther INNER JOIN
									  ClassMaster ON FeesCollectionOther.MainClassCode = ClassMaster.MainClassCode AND FeesCollectionOther.ClassCode = ClassMaster.ClassCode ON 
									  FeesCollectionOtherDetail.ReceiptTID = FeesCollectionOther.ReceiptTID ON FeeTitleOtherGroupMaster.FeeTitleOtherGroupCode = FeesCollectionOther.FeeTitleOtherGroupCode
				WHERE     (FeesCollectionOther.ReceiptTID = @TID) ORDER BY FeesCollectionOtherDetail.SrNo
			End
		else
			Begin
				SELECT     FeeTitleOtherMaster.FeeTitleOtherCode, FeeTitleOtherMaster.SrNo, FeeTitleOtherMaster.FeeTitleOtherName, FeesDefineOther.FeesAmount AS PaidAmount
				FROM         FeeTitleOtherMaster INNER JOIN
									  FeesDefineOther ON FeeTitleOtherMaster.FeeTitleOtherCode = FeesDefineOther.FeeTitleOtherCode INNER JOIN
									  ClassMaster ON FeesDefineOther.ClassCode = ClassMaster.ClassCode INNER JOIN
									  FeeTitleOtherGroupMaster ON FeesDefineOther.FeeTitleOtherGroupCode = FeeTitleOtherGroupMaster.FeeTitleOtherGroupCode
				WHERE     FeeTitleOtherMaster.DeleteFlag = 0  And ClassMaster.ClassCode = @FieldCode And FeesDefineOther.AyCode = @AyCode And FeeTitleOtherGroupMaster.FeeTitleOtherGroupName = @WhereCondition ORDER BY FeeTitleOtherMaster.SrNo
			End
 	  End
	 Else If @RecordSelection='FeeTitleOtherMaster'
	 BEGIN
				SELECT     FeeTitleOtherMaster.FeeTitleOtherCode, FeeTitleOtherMaster.SrNo, FeeTitleOtherMaster.FeeTitleOtherName, FeeTitleShortMaster.FeeTitleShortName, FeeTitleOtherMaster.FeeTitleShortCode, 
							  FeeTitleOtherMaster.DeleteFlag
		FROM         FeeTitleOtherMaster INNER JOIN
							  FeeTitleShortMaster ON FeeTitleOtherMaster.FeeTitleShortCode = FeeTitleShortMaster.FeeTitleShortCode
		ORDER BY FeeTitleOtherMaster.FeeTitleOtherCode
	 END	

	 Else If @RecordSelection='FeeTitleOtherGroupMaster'
	 BEGIN
		SELECT     FeeTitleOtherGroupMaster.FeeTitleOtherGroupCode, FeeTitleOtherGroupMaster.SrNo, FeeTitleOtherGroupMaster.FeeTitleOtherGroupName, FeeTitleOtherGroupMaster.DeleteFlag,  FeeTitleOtherGroupMaster.FeeTitleOtherMainGroupCode, FeeTitleOtherMainGroupMaster.FeeTitleOtherMainGroupName FROM         FeeTitleOtherGroupMaster INNER JOIN FeeTitleOtherMainGroupMaster ON FeeTitleOtherGroupMaster.FeeTitleOtherMainGroupCode = FeeTitleOtherMainGroupMaster.FeeTitleOtherMainGroupCode ORDER BY FeeTitleOtherGroupMaster.FeeTitleOtherGroupCode
	 END	
	 
	 Else If @RecordSelection='BusFeeTitleMaster'
	 BEGIN
		SELECT  BusFeeTitleCode, SrNo, BusFeeTitleName, BusFeeTitleNameShort, DeleteFlag FROM    BusFeeTitleMaster ORDER BY BusFeeTitleCode
	 END	

	 Else If @RecordSelection='BusMaster'
	 BEGIN
		SELECT  BusCode, BusName, DeleteFlag FROM    BusMaster ORDER BY BusCode
	 END	

	 Else If @RecordSelection='BusFeesDefine'
	 BEGIN
		SELECT  BusFeeTitleCode, SrNo, BusFeeTitleName, 0 as BusAmount FROM    BusFeeTitleMaster WHERE     (DeleteFlag = 0) ORDER BY SrNo
	 END	

	 Else If @RecordSelection='BusFeesCollection'
		 BEGIN
			SELECT     BusFeesCollection.ReceiptTID, BusFeesCollection.ReceiptNo, CONVERT(varchar, BusFeesCollection.ReceiptDate, 106) AS ReceiptDate, StudInfoYearly.RegID,  MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, StudInfoAll.RegNo,  CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, BusFeesCollection.TotalFeesAmount AS FeesAmount, BusFeesCollection.TotalDiscountAmt AS DiscountAmt, BusFeesCollection.CancelReceiptAmt, BusFeesCollection.Remark,  PaymentTypeMaster.PaymentTypeName AS PType, BusFeesCollection.FeeCategoryCode, BusFeesCollection.BankName, BusFeesCollection.ChequeNo, CONVERT(varchar,  BusFeesCollection.ChequeDate, 106) AS ChequeDate, BusFeesCollection.CancelReceiptFlag, BusFeesCollection.PrintFlag, StudInfoYearly.AyCode, AyMaster.AyName, BusFeesCollection.FyCode,  FyMaster.FyName, BusFeesCollection.UserCode, UserMaster.UserName FROM         MainClassMaster INNER JOIN StudInfoAll INNER JOIN StudInfoYearly ON StudInfoAll.RegID = StudInfoYearly.RegID ON MainClassMaster.MainClassCode = StudInfoYearly.MainClassCode INNER JOIN PaymentTypeMaster INNER JOIN BusFeesCollection ON PaymentTypeMaster.PaymentTypeCode = BusFeesCollection.PaymentTypeCode ON StudInfoYearly.RegID = BusFeesCollection.RegID AND  StudInfoYearly.AyCode = BusFeesCollection.AyCode INNER JOIN DivisionMaster ON StudInfoYearly.DivisionCode = DivisionMaster.DivisionCode INNER JOIN MediumMaster ON StudInfoYearly.MediumCode = MediumMaster.MediumCode INNER JOIN ClassMaster ON StudInfoYearly.ClassCode = ClassMaster.ClassCode INNER JOIN AyMaster ON StudInfoYearly.AyCode = AyMaster.AyCode INNER JOIN FyMaster ON BusFeesCollection.FyCode = FyMaster.FyCode INNER JOIN UserMaster ON BusFeesCollection.UserCode = UserMaster.UserCode where BusFeesCollection.ReceiptTID = @FieldCode ORDER BY StudInfoYearly.RegID DESC
		END		 	 

	Else If @RecordSelection='BusFeesCollectionDetail'
	BEGIN
		SELECT     BusFeeTitleMaster.SrNo, BusFeesDefine.BusFeeTitleCode, BusFeeTitleMaster.BusFeeTitleName, 0 AS TotalBalance, 0 AS PaidAmount, 0 AS AdjOrDiscount, 
							  BusFeesDefine.BusAmount AS FeesAmount, BusFeesDefine.BusCode, BusMaster.BusName
		FROM         BusFeeTitleMaster INNER JOIN
							  BusFeesDefine ON BusFeeTitleMaster.BusFeeTitleCode = BusFeesDefine.BusFeeTitleCode INNER JOIN
							  BusMaster ON BusFeesDefine.BusCode = BusMaster.BusCode		WHERE     (BusFeesDefine.RegID = @FieldCode And BusFeesDefine.AyCode = @AyCode) ORDER BY BusFeeTitleMaster.SrNo
	END

	Else If @RecordSelection='LibPublicationMaster'
	 BEGIN
		SELECT LibPublicationCode, LibPublicationName, DeleteFlag FROM LibPublicationMaster ORDER BY LibPublicationMaster.LibPublicationCode
	 END

	Else If @RecordSelection='LibStudentIssueReturnBook'
	BEGIN
		SELECT     LibStudentIssueReturnBook.TID, LibStudentIssueReturnBook.RegID, LibStudentIssueReturnBook.BookTID, CONVERT(varchar, LibStudentIssueReturnBook.IssueDate, 106) AS IssueDate, 
							  LibBookMaster.AccessionNo, LibBookTitleMaster.LibBookTitleName AS BookTitleName, CONVERT(varchar, LibStudentIssueReturnBook.ReturnDate, 106) AS ReturnDate, 
							  LibStudentIssueReturnBook.NoofDays, LibStudentIssueReturnBook.DueAmt, LibStudentIssueReturnBook.Remark
		FROM         LibBookMaster INNER JOIN
							  LibStudentIssueReturnBook ON LibBookMaster.BookTID = LibStudentIssueReturnBook.BookTID INNER JOIN
							  LibBookTitleMaster ON LibBookMaster.BookTitleCode = LibBookTitleMaster.LibBookTitleCode
		ORDER BY IssueDate DESC
	END

	Else If @RecordSelection='LibBooksQty'
	BEGIN
		SELECT  BookTID, NoOfQty FROM dbo.LibBookMaster WHERE  (LibBookMaster.BookTID = @FieldCode)
	END

	Else If @RecordSelection='LibBooksIssueQty'
	BEGIN
		SELECT COUNT(TID) AS IssueQty FROM         LibStudentIssueReturnBook WHERE     (ReturnDate IS NULL) AND (BookTID = @FieldCode)
	END

	Else If @RecordSelection='LibBooksConsumeQty'
	BEGIN
		SELECT     SUM(Qty) AS ConsumeQty FROM  LibBookConsumeEntry WHERE  (BookTID = @FieldCode)
	END

	 Else If @RecordSelection='StoreStationeryIssue'
    BEGIN
          SELECT   dbo.StoreStationeryIssue.ReceiptTID,dbo.StudInfoAll.RegID, dbo.MainClassMaster.MainClassName AS MainClass, dbo.ClassMaster.ClassName AS Class, dbo.StudInfoAll.RegNo, 
                      CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
                        dbo.StoreStationeryIssue.ReceiptNo, dbo.StoreStationeryIssue.ReceiptDate, dbo.StoreStationeryIssueDetail.SrNo, dbo.StoreStationeryIssueDetail.IssueQty, 
                      dbo.StoreStationeryIssueDetail.ItemCode, dbo.ItemMaster.ItemName, dbo.StoreStationeryIssueDetail.BalanceQty, dbo.StoreStationeryIssueDetail.Rate, dbo.StoreStationeryIssueDetail.Amount,dbo.StoreStationeryIssue.Remark
                FROM         dbo.StudInfoAll INNER JOIN
                      dbo.MainClassMaster ON dbo.StudInfoAll.MainClassCode = dbo.MainClassMaster.MainClassCode INNER JOIN
                      dbo.ClassMaster ON dbo.StudInfoAll.ClassCode = dbo.ClassMaster.ClassCode INNER JOIN
                      dbo.MediumMaster ON dbo.StudInfoAll.MediumCode = dbo.MediumMaster.MediumCode INNER JOIN
                      dbo.DivisionMaster ON dbo.StudInfoAll.DivisionCode = dbo.DivisionMaster.DivisionCode INNER JOIN
                      dbo.StoreStationeryIssue ON dbo.StudInfoAll.RegID = dbo.StoreStationeryIssue.RegID INNER JOIN
                      dbo.StoreStationeryIssueDetail ON dbo.StoreStationeryIssue.ReceiptTID = dbo.StoreStationeryIssueDetail.ReceiptTID INNER JOIN
                      dbo.ItemMaster ON dbo.StoreStationeryIssueDetail.ItemCode = dbo.ItemMaster.ItemCode
                 ORDER BY dbo.StudInfoAll.RegID DESC
    END
    Else if @RecordSelection='StoreStationeryIssueDetail'
	 BEGIN                     
	     SELECT  dbo.StoreClassWiseStationeryItemDefine.SrNo, dbo.ItemMaster.ItemName, dbo.StoreClassWiseStationeryItemDefine.Qty AS BalanceQty, 0 AS IssueQty, dbo.ItemMaster.Rate, 0 AS Amount, 
                      dbo.StoreClassWiseStationeryItemDefine.ClassCode, dbo.StoreClassWiseStationeryItemDefine.ItemCode
            FROM         dbo.ItemMaster INNER JOIN
                      dbo.StoreClassWiseStationeryItemDefine ON dbo.ItemMaster.ItemCode = dbo.StoreClassWiseStationeryItemDefine.ItemCode INNER JOIN
                      dbo.ItemGroupMaster ON dbo.ItemMaster.ItemGroupCode = dbo.ItemGroupMaster.ItemGroupCode
		WHERE     (dbo.StoreClassWiseStationeryItemDefine.ClassCode = @FieldCode)
		ORDER BY dbo.StoreClassWiseStationeryItemDefine.SrNo
	END
   Else IF @RecordSelection='ItemGroupMaster'
	BEGIN
	   SELECT     ItemGroupCode, ItemGroupName, DeleteFlag FROM dbo.ItemGroupMaster WHERE (DeleteFlag = 0)
	END 
   Else IF @RecordSelection='ItemMaster'
	BEGIN
	  SELECT     dbo.ItemMaster.ItemCode, dbo.ItemMaster.SrNo, dbo.ItemMaster.ItemName, dbo.ItemGroupMaster.ItemGroupName, dbo.ItemMaster.ItemGroupCode, dbo.ItemMaster.Rate,dbo.ItemMaster.DeleteFlag FROM dbo.ItemMaster INNER JOIN dbo.ItemGroupMaster ON dbo.ItemMaster.ItemGroupCode = dbo.ItemGroupMaster.ItemGroupCode WHERE (dbo.ItemMaster.DeleteFlag = 0)
	END 
   Else If @RecordSelection='WordLibraryMaster'
	 BEGIN
		SELECT     WordLibraryCode, NotoSans, Khula, BalBharatiDev, Mangal, DeleteFlag FROM         WordLibraryMaster WHERE (dbo.WordLibraryMaster.DeleteFlag = 0)
	 END

	 Else If @RecordSelection='CBSCDEGroupMaster'
	 BEGIN
		SELECT     CBSCDEGroupCode, SrNo, CBSCDEGroupName, DeleteFlag FROM         CBSCDEGroupMaster Where DeleteFlag = 0 ORDER BY SrNo
	 END

	 Else If @RecordSelection='CBSCDETitleGroupMaster'
	 BEGIN
		SELECT     CBSCDETitleGroupMaster.CBSCDETitleGroupCode, CBSCDETitleGroupMaster.SrNo, CBSCDETitleGroupMaster.CBSCDETitleGroupName, CBSCDEGroupMaster.CBSCDEGroupName,  CBSCDETitleGroupMaster.DeleteFlag FROM         CBSCDETitleGroupMaster INNER JOIN CBSCDEGroupMaster ON CBSCDETitleGroupMaster.CBSCDEGroupCode = CBSCDEGroupMaster.CBSCDEGroupCode ORDER BY CBSCDETitleGroupMaster.SrNo
	 END

	 Else If @RecordSelection='CBSCDETitleMaster'
	 BEGIN
		SELECT     CBSCDETitleMaster.CBSCDETitleCode, CBSCDETitleMaster.SrNo, CBSCDETitleMaster.CBSCDETitleName, CBSCDETitleGroupMaster.CBSCDETitleGroupName, CBSCDETitleMaster.DeleteFlag FROM         CBSCDETitleMaster INNER JOIN CBSCDETitleGroupMaster ON CBSCDETitleMaster.CBSCDETitleGroupCode = CBSCDETitleGroupMaster.CBSCDETitleGroupCode ORDER BY CBSCDETitleMaster.SrNo
	 END

	 Else If @RecordSelection='CBSCDEMaster'
	 BEGIN
				SELECT     CBSCDEMaster.CBSCDECode, CBSCDEMaster.SrNo, GradeMaster.GradeName, CBSCDEMaster.CBSCDEName, 
							  CBSCDETitleMaster.CBSCDETitleName + ' - ' + CBSCDETitleGroupMaster.CBSCDETitleGroupName AS CBSCDETitleName, CBSCDEMaster.DeleteFlag
		FROM         CBSCDETitleMaster INNER JOIN
							  CBSCDETitleGroupMaster ON CBSCDETitleMaster.CBSCDETitleGroupCode = CBSCDETitleGroupMaster.CBSCDETitleGroupCode INNER JOIN
							  CBSCDEMaster ON CBSCDETitleMaster.CBSCDETitleCode = CBSCDEMaster.CBSCDETitleCode INNER JOIN
							  GradeMaster ON CBSCDEMaster.GradeCode = GradeMaster.GradeCode
	 END

	Else If @RecordSelection='StudentExamTermDEntryTitleCBSC'
	 BEGIN 
		SELECT DISTINCT StudentExamTermDEntryCBSC.RegID, StudentExamTermDEntryCBSC.ExamCode, CBSCDEMaster.CBSCDETitleCode FROM         StudentExamTermDEntryCBSC INNER JOIN CBSCDEMaster ON StudentExamTermDEntryCBSC.CBSCDECode = CBSCDEMaster.CBSCDECode
	END

	Else If @RecordSelection='StudentExamTermDEntryCBSC'
	 BEGIN 
		SELECT StudentExamTermDEntryCBSC.RegID, StudentExamTermDEntryCBSC.ExamCode, CBSCDEMaster.CBSCDETitleCode, StudentExamTermDEntryCBSC.CBSCDECode FROM         StudentExamTermDEntryCBSC INNER JOIN CBSCDEMaster ON StudentExamTermDEntryCBSC.CBSCDECode = CBSCDEMaster.CBSCDECode
	END

	else If @RecordSelection='ExamStudInfoCBSC'
	 BEGIN
		SELECT     StudInfo.RegID, MainClassMaster.MainClassName AS MainClass, StudInfo.RegNo, MediumMaster.MediumName AS Medium, 
							  CASE StudInfo.LastName WHEN '-' THEN StudInfo.Firstname + ' ' + StudInfo.MiddleName ELSE StudInfo.Firstname + ' ' + StudInfo.MiddleName + ' ' + StudInfo.LastName END AS StudentName, 
							  ClassMaster.ClassName, DivisionMaster.DivisionName, GenderMaster.GenderName, GenderMaster.GenderShort
		FROM         StudInfo INNER JOIN
							  MainClassMaster ON StudInfo.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfo.ClassCode = ClassMaster.ClassCode INNER JOIN
							  MediumMaster ON StudInfo.MediumCode = MediumMaster.MediumCode INNER JOIN
							  DivisionMaster ON StudInfo.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  GenderMaster ON StudInfo.GenderCode = GenderMaster.GenderCode
		WHERE     (StudInfo.EntryFrom = N'A') AND (StudInfo.CloseFlag = N'N')
		ORDER BY GenderShort, StudInfo.RegNo
	 END

	  Else If @RecordSelection='LibBookMaster'  
	  BEGIN   
			SELECT     LibBookMaster.BookTID, LibBookMaster.AccessionNo, LibAuthorMaster.LibAuthorName, LibBookTitleMaster.LibBookTitleName, LibBookTitleGroupMaster.LibBookTitleGroupName, 
								  LibBookMaster.NoOfQty, LibBookMaster.BookPrice, LibBookMaster.BillNo,
								  LibBookStatusMaster.LibBookStatusName, LibBookMaster.LibStatusCode, LibBookMaster.DeleteFlag
			FROM         LibBookMaster INNER JOIN
								  LibAuthorMaster ON LibBookMaster.AuthorCode = LibAuthorMaster.LibAuthorCode INNER JOIN
								  LibBookStatusMaster ON LibBookMaster.LibStatusCode = LibBookStatusMaster.LibBookStatusCode INNER JOIN
								  LibBookTitleGroupMaster ON LibBookMaster.BookTitleGroupCode = LibBookTitleGroupMaster.LibBookTitleGroupCode INNER JOIN
								  LibBookTitleMaster ON LibBookMaster.BookTitleCode = LibBookTitleMaster.LibBookTitleCode
			WHERE     (LibBookMaster.DeleteFlag = 0)
	 END

	  Else If @RecordSelection='LibBookConsumeEntry'  
	  BEGIN   
		SELECT     LibBookConsumeEntry.TID, CONVERT(varchar, LibBookConsumeEntry.TDate, 106) AS TDate, LibBookMaster.AccessionNo, LibBookTitleMaster.LibBookTitleName, LibBookConsumeEntry.Qty, 
							  LibBookConsumeEntry.FineAmt, LibBookStatusMaster.LibBookStatusName, LibBookConsumeEntry.Remark, LibBookConsumeEntry.BookTID
		FROM         LibBookTitleMaster INNER JOIN
							  LibBookMaster ON LibBookTitleMaster.LibBookTitleCode = LibBookMaster.BookTitleCode INNER JOIN
							  LibBookConsumeEntry ON LibBookMaster.BookTID = LibBookConsumeEntry.BookTID INNER JOIN
							  LibBookStatusMaster ON LibBookConsumeEntry.LibStatusCode = LibBookStatusMaster.LibBookStatusCode
		ORDER BY LibBookConsumeEntry.TID DESC
	  
	 END

	Else If @RecordSelection='StudentPresentyCertificate'
	 BEGIN
		SELECT     StudentPresentyCertificate.TID, StudentPresentyCertificate.RecordNo, CONVERT(varchar, StudentPresentyCertificate.TDate, 106) AS TDate, StudInfoAll.RegID, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, 
							  DivisionMaster.DivisionName AS Div, StudInfoAll.RegNo, CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, StudInfoAll.AyCode, 
							  StudInfoAll.CloseFlag
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  StudentPresentyCertificate ON StudInfoAll.RegID = StudentPresentyCertificate.RegID
		WHERE     (StudInfoAll.EntryFrom = N'A')
		ORDER BY StudInfoAll.RegID DESC
	END	 


	 Else If @RecordSelection='FeeTitleRegularMaster'
	 BEGIN
		SELECT  FeeTitleRegularCode, SrNo, FeeTitleRegularName, FeeTitleRegularNameShort, DeleteFlag FROM    FeeTitleRegularMaster ORDER BY FeeTitleRegularCode
	 END	

	 Else If @RecordSelection='FeesDefineRegular'
	 BEGIN
		SELECT  FeeTitleRegularCode, SrNo, FeeTitleRegularName, 0 as FeesAmount FROM    FeeTitleRegularMaster WHERE     (DeleteFlag = 0) ORDER BY SrNo
	 END	

	 Else If @RecordSelection='FeesCollectionRegular'
		 BEGIN
			SELECT     FeesCollectionRegular.ReceiptTID, FeesCollectionRegular.ReceiptNo, CONVERT(varchar, FeesCollectionRegular.ReceiptDate, 106) AS ReceiptDate, StudInfoYearly.RegID, 
								  MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, StudInfoAll.RegNo, 
								  CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
								   FeesCollectionRegular.TotalFeesAmount AS FeesAmount, FeesCollectionRegular.TotalDiscountAmt AS DiscountAmt, FeesCollectionRegular.CancelReceiptAmt, FeesCollectionRegular.Remark, 
								  PaymentTypeMaster.PaymentTypeName AS PType, FeesCollectionRegular.FeeCategoryCode, FeesCollectionRegular.BankName, FeesCollectionRegular.ChequeNo, CONVERT(varchar, 
								  FeesCollectionRegular.ChequeDate, 106) AS ChequeDate, StudInfoYearly.AyCode, FeesCollectionRegular.CancelReceiptFlag, FeesCollectionRegular.PrintFlag, AyMaster.AyName, 
								  FeesCollectionRegular.FyCode, FyMaster.FyName, FeesCollectionRegular.UserCode, UserMaster.UserName
			FROM         DivisionMaster INNER JOIN
								  StudInfoAll INNER JOIN
								  StudInfoYearly ON StudInfoAll.RegID = StudInfoYearly.RegID ON DivisionMaster.DivisionCode = StudInfoYearly.DivisionCode INNER JOIN
								  MainClassMaster ON StudInfoYearly.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
								  AyMaster ON StudInfoYearly.AyCode = AyMaster.AyCode INNER JOIN
								  ClassMaster ON StudInfoYearly.ClassCode = ClassMaster.ClassCode INNER JOIN
								  PaymentTypeMaster INNER JOIN
								  FeesCollectionRegular ON PaymentTypeMaster.PaymentTypeCode = FeesCollectionRegular.PaymentTypeCode INNER JOIN
								  UserMaster ON FeesCollectionRegular.UserCode = UserMaster.UserCode INNER JOIN
								  FyMaster ON FeesCollectionRegular.FyCode = FyMaster.FyCode ON StudInfoYearly.RegID = FeesCollectionRegular.RegID AND StudInfoYearly.AyCode = FeesCollectionRegular.AyCode INNER JOIN
								  MediumMaster ON StudInfoYearly.MediumCode = MediumMaster.MediumCode
			ORDER BY StudInfoYearly.RegID DESC
	END		 	 

	Else If @RecordSelection='FeesCollectionRegularDetail'
	BEGIN
		SELECT     FeeTitleRegularMaster.SrNo, FeesDefineRegular.FeeTitleRegularCode, FeeTitleRegularMaster.FeeTitleRegularName, 0 AS TotalBalance, 0 AS PaidAmount, 0 AS AdjOrDiscount, 
							  FeesDefineRegular.FeesAmountRegular AS FeesAmount
		FROM         FeeTitleRegularMaster INNER JOIN
                      FeesDefineRegular ON FeeTitleRegularMaster.FeeTitleRegularCode = FeesDefineRegular.FeeTitleRegularCode		WHERE     (FeesDefineRegular.RegID = @FieldCode) ORDER BY FeeTitleRegularMaster.SrNo
	END

	Else If @RecordSelection='FeesAlertDefine'
	BEGIN
		SELECT     TOP (100) PERCENT StudInfoAll.RegID, StudInfoAll.RegNo, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
							   END AS StudentName, FeeTypeMaster.FeeTypeName, TempMonthlyFeesCollection.TotalFeesAmount, TempMonthlyFeesCollection.TotalPaidAmount, TempMonthlyFeesCollection.TotalBalance, 
							  StudInfoAll.MobileNo1, StudInfoAll.MobileNo2, CONVERT(varchar, FeesAlertDefine.AlertDate, 106) as AlertDate, FeesAlertDefine.Remark
		FROM         GenderMaster INNER JOIN
							  StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode ON GenderMaster.GenderCode = StudInfoAll.GenderCode INNER JOIN
							  MediumMaster ON StudInfoAll.MediumCode = MediumMaster.MediumCode INNER JOIN
							  TempMonthlyFeesCollection ON StudInfoAll.RegID = TempMonthlyFeesCollection.RegID INNER JOIN
							  FeeTypeMaster ON StudInfoAll.FeeTypeCode = FeeTypeMaster.FeeTypeCode LEFT OUTER JOIN
							  FeesAlertDefine ON StudInfoAll.RegID = FeesAlertDefine.RegID
		ORDER BY GenderMaster.GenderShort, StudInfoAll.RegNo
	END

	Else If @RecordSelection='ExamDefineForTotal'
	BEGIN
		SELECT     ExamCode, ExamCodeForTotal FROM         ExamDefineForTotal
	END

	Else If @RecordSelection='SubjectGroupMaster'
	 BEGIN
		SELECT     SubjectGroupCode, SubjectGroupName, DeleteFlag FROM         SubjectGroupMaster ORDER BY SubjectGroupCode
	END		 	 			 	 	 	 			 	 
	
	Else If @RecordSelection='SubjectGroupDetail'
	 BEGIN
		SELECT     SubjectGroupCode, SubjectCode, CompulsoryFlag FROM SubjectGroupDetail
	END		 	 			 	 	 	 			 	 
	
	Else If @RecordSelection='FeesDefineAllTitle'
	 BEGIN		
		SELECT     SrNo, FeeTitleCode, FeeTitleName AS FeeTitle, 0 AS FeesAmount FROM   FeeTitleMaster Where FeeTitleCode>0 ORDER BY SrNo 
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='FeesDefineOtherAllTitle'
	 BEGIN		
		SELECT     SrNo, FeeTitleOtherCode, FeeTitleOtherName AS FeeTitleOther, 0 AS FeesAmount FROM         FeeTitleOtherMaster WHERE     (DeleteFlag = 0) ORDER BY SrNo
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='FeesDefineOther'
	 BEGIN
		SELECT     FeesDefineOther.FDTID, FeesDefineOther.SrNo, ClassMaster.ClassName AS Class, FeeTitleOtherGroupMaster.FeeTitleOtherGroupName AS FeeTitleOtherGroup, 
							  FeeTitleOtherMaster.FeeTitleOtherName, FeesDefineOther.FeesAmount, FeesDefineOther.FeeTitleOtherGroupCode, FeesDefineOther.FeeTitleOtherCode, FeesDefineOther.AyCode, 
							  AyMaster.AyName
		FROM         FeesDefineOther INNER JOIN
							  ClassMaster ON FeesDefineOther.ClassCode = ClassMaster.ClassCode INNER JOIN
							  FeeTitleOtherGroupMaster ON FeesDefineOther.FeeTitleOtherGroupCode = FeeTitleOtherGroupMaster.FeeTitleOtherGroupCode INNER JOIN
							  FeeTitleOtherMaster ON FeesDefineOther.FeeTitleOtherCode = FeeTitleOtherMaster.FeeTitleOtherCode INNER JOIN
							  AyMaster ON FeesDefineOther.AyCode = AyMaster.AyCode
		ORDER BY FeesDefineOther.SrNo
	END		 	 

	Else If @RecordSelection='StudentFeesDetails'
	 BEGIN
		SELECT     RegID, ReceiptNo, CONVERT(varchar, ReceiptDate, 106) AS ReceiptDate, TotalFeesAmount as FeesPaidAmount FROM         FeesCollection WHERE     (RegID = @FieldCode) ORDER BY ReceiptNo
	 END		 	 			 	 	 	 			 	 

	 Else If @RecordSelection='Covid19DoseMaster'
	 BEGIN
		SELECT Covid19DoseCode, Covid19DoseName, DeleteFlag FROM Covid19DoseMaster ORDER BY Covid19DoseMaster.Covid19DoseCode
	 END

	 Else If @RecordSelection='StudentSubjectDetails'
	 BEGIN
		SELECT     StudentSubjectDetails.RegID, StudentSubjectDetails.SubjectGroupCode, StudentSubjectDetails.SubjectCode, SubjectMaster.SubjectName, SubjectMaster.SubjectNameShort, SubjectGroupMaster.SubjectGroupName
		FROM         StudentSubjectDetails INNER JOIN
							  SubjectMaster ON StudentSubjectDetails.SubjectCode = SubjectMaster.SubjectCode INNER JOIN
							  SubjectGroupMaster ON StudentSubjectDetails.SubjectGroupCode = SubjectGroupMaster.SubjectGroupCode
		WHERE     (StudentSubjectDetails.RegID = @FieldCode)
	 END

	Else If @RecordSelection='ClassWiseMaxStudentAndSubjectDefine'
	 BEGIN
		SELECT  ClassMaster.ClassCode, ClassMaster.ClassName AS Class, ClassMaster.MaxStudentPerDiv, ClassMaster.MinSubject, MainClassMaster.MainClassName AS MainClass FROM         ClassMaster INNER JOIN MainClassMaster ON ClassMaster.MainClassCode = MainClassMaster.MainClassCode WHERE     (ClassMaster.DeleteFlag = 0) ORDER BY ClassMaster.ClassCode
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='UserReportDetail'
	 BEGIN
		SELECT UserCode, ReportCode, ReportNameAlias FROM  UserReportDetail Where UserCode = @FieldCode
	 END		 

	Else If @RecordSelection='ReportMaster'
	BEGIN
		SELECT     ReportMaster.ReportCode, ReportTypeMaster.ReportTypeName, ReportMaster.ReportName, ReportMaster.SrNo, ReportMaster.ReportName as ReportNameAlias, ReportMaster.ReportTypeCode  FROM         ReportMaster INNER JOIN ReportTypeMaster ON ReportMaster.ReportTypeCode = ReportTypeMaster.ReportTypeCode WHERE     (ReportMaster.DisplaySetting = 'A' OR ReportMaster.DisplaySetting = @WhereCondition)  ORDER BY ReportTypeMaster.SrNo, ReportMaster.SrNo
	END

	Else If @RecordSelection='ReportMasterEN'
	BEGIN
		SELECT     ReportMaster.ReportCode, ReportTypeMaster.ReportTypeNameEN, ReportMaster.ReportNameEN, ReportMaster.SrNo, ReportMaster.ReportNameEN as ReportNameAlias, ReportMaster.ReportTypeCode  FROM         ReportMaster INNER JOIN ReportTypeMaster ON ReportMaster.ReportTypeCode = ReportTypeMaster.ReportTypeCode WHERE     (ReportMaster.DisplaySetting = 'A' OR ReportMaster.DisplaySetting = @WhereCondition)   ORDER BY ReportTypeMaster.SrNo, ReportMaster.SrNo
	END

	 Else If @RecordSelection='StudentFeesTitleOpening'
	 BEGIN
		SELECT  FeeTitleCode, SrNo, FeeTitleName, 0 as FeesAmount FROM    FeeTitleMaster WHERE  FeeTitleCode>0 And   (DeleteFlag = 0) ORDER BY SrNo
	 END	

	Else If @RecordSelection='CasteValidationCertificate'
	 BEGIN
		SELECT     CasteValidationCertificate.TID, CasteValidationCertificate.RecordNo, CONVERT(varchar, CasteValidationCertificate.TDate, 106) AS TDate, StudInfoAll.RegID, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, 
							  DivisionMaster.DivisionName AS Div, StudInfoAll.RegNo, CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, CasteValidationCertificate.District, StudInfoAll.AyCode, 
							  StudInfoAll.CloseFlag
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  CasteValidationCertificate ON StudInfoAll.RegID = CasteValidationCertificate.RegID
		ORDER BY StudInfoAll.RegID DESC
	END	 

	Else If @RecordSelection='StudentPhotoUpdate'
	 BEGIN
		SELECT     StudInfo.RegID, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, StudInfo.RegNo, 
							  CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
							   AS StudentName, StudInfo.Photpath, MediumMaster.MediumName AS Medium, DivisionMaster.DivisionName AS Div, GenderMaster.GenderShort, StudInfo.AyCode, StudInfo.MainClassCode, StudInfo.CloseFlag
		FROM         GenderMaster INNER JOIN
							  StudInfo INNER JOIN
							  MainClassMaster ON StudInfo.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfo.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfo.DivisionCode = DivisionMaster.DivisionCode ON GenderMaster.GenderCode = StudInfo.GenderCode INNER JOIN
							  MediumMaster ON StudInfo.MediumCode = MediumMaster.MediumCode
		WHERE     (StudInfo.CloseFlag = 'N') AND (StudInfo.EntryFrom = 'A')	
	END	 

	Else If @RecordSelection='VisitorRegister'
	 BEGIN
			 SELECT     dbo.VisitorRegister.TID, dbo.VisitorRegister.MainClassCode, dbo.MainClassMaster.MainClassName, dbo.VisitorRegister.RecordNo, CONVERT(varchar, dbo.VisitorRegister.VisitDate, 106) AS VisitDate, dbo.VisitorRegister.VisitorName, 
							  dbo.VisitorRegister.PersonToMeet, dbo.VisitorRegister.Purpose, CONVERT(TIME,VisitorRegister.InTime) as InTime, CONVERT(TIME,VisitorRegister.OutTime) as OutTime, dbo.VisitorRegister.RegNo, dbo.VisitorRegister.PhotoPath, dbo.VisitorRegister.MobileNo
		FROM         dbo.VisitorRegister INNER JOIN
							  dbo.MainClassMaster ON dbo.VisitorRegister.MainClassCode = dbo.MainClassMaster.MainClassCode
                      
	END	 

	Else If @RecordSelection='SubjectGroupClassDetail'
	 BEGIN
		SELECT     SubjectGroupCode, ClassCode FROM SubjectGroupClassDetail
	END		 	 			 	 	 	 			 	 
	
	Else If @RecordSelection='StudentSubjectUpdate'
	 BEGIN
		SELECT     StudInfo.RegID, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, StudInfo.RegNo, 
							  CASE dbo.StudInfo.LastName WHEN '-' THEN dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName ELSE dbo.StudInfo.Firstname + ' ' + dbo.StudInfo.MiddleName + ' ' + dbo.StudInfo.LastName END
							   AS StudentName, SubjectGroupMaster.SubjectGroupName, MediumMaster.MediumName AS Medium, DivisionMaster.DivisionName AS Div, GenderMaster.GenderShort, StudInfo.AyCode, 
							  StudInfo.MainClassCode, StudInfo.CloseFlag
		FROM         GenderMaster INNER JOIN
							  StudInfo INNER JOIN
							  MainClassMaster ON StudInfo.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfo.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfo.DivisionCode = DivisionMaster.DivisionCode ON GenderMaster.GenderCode = StudInfo.GenderCode INNER JOIN
							  MediumMaster ON StudInfo.MediumCode = MediumMaster.MediumCode LEFT OUTER JOIN
							  SubjectGroupMaster ON StudInfo.SubjectGroupCode = SubjectGroupMaster.SubjectGroupCode
		WHERE     (StudInfo.CloseFlag = 'N') AND (StudInfo.EntryFrom = 'A')
	END	        
	
	Else If @RecordSelection='FeesCollectionDetailOpening'
	BEGIN
		SELECT     FeeTitleMaster.SrNo, StudentFeesOpeningBalance.FeeTitleCode, FeeTitleMaster.FeeTitleName, 0 AS TotalBalance, 0 AS CurrentBalance, 0 AS PaidAmount, 0 AS AdjOrDiscount, 
							  StudentFeesOpeningBalance.FeesAmount, 2 AS FeeInstallementCode, StudInfoYearly.AdmissionType, StudInfoYearly.AyCode
		FROM         StudInfoYearly INNER JOIN
							  StudInfoAll ON StudInfoYearly.RegID = StudInfoAll.RegID INNER JOIN
							  StudentFeesOpeningBalance ON StudInfoYearly.RegID = StudentFeesOpeningBalance.RegID AND StudInfoYearly.AyCode = StudentFeesOpeningBalance.AyCode INNER JOIN
							  FeeTitleMaster ON StudentFeesOpeningBalance.FeeTitleCode = FeeTitleMaster.FeeTitleCode
                      							WHERE     (StudInfoYearly.RegID = @FieldCode and StudInfoYearly.AyCode = @AyCode)
									ORDER BY FeeTitleMaster.SrNo
	END

	Else If @RecordSelection='PageSizeMaster'
	 BEGIN
		SELECT     PageSizeCode, PageSizeName, DeleteFlag FROM         PageSizeMaster WHERE     (DeleteFlag = 0) ORDER BY PageSizeCode
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='FeeTitleShortMaster'
	 BEGIN
		SELECT     FeeTitleShortCode, SrNo, FeeTitleShortName, DeleteFlag FROM         FeeTitleShortMaster WHERE     (DeleteFlag = 0) ORDER BY SrNo
	END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='TimeTableMaster'
	 BEGIN
			 SELECT     TimeTableMaster.TID, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, TimeTableMaster.SrNo, SubjectMaster.SubjectName, SPADayMaster.SPADayName AS DayName, 
							  TimeTableMaster.FromTime, TimeTableMaster.ToTime, CONVERT(varchar(15),CAST(TimeTableMaster.FromTime AS TIME),100) as FTime, CONVERT(varchar(15),CAST(TimeTableMaster.ToTime AS TIME),100) as TTime
		FROM         TimeTableMaster INNER JOIN
							  ClassMaster ON TimeTableMaster.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON TimeTableMaster.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  SubjectMaster ON TimeTableMaster.SubjectCode = SubjectMaster.SubjectCode INNER JOIN
							  SPADayMaster ON TimeTableMaster.DayCode = SPADayMaster.SPADayCode ORDER BY TimeTableMaster.SrNo
	END		 	 
	Else If @RecordSelection='EmpMasterForImport'
	 BEGIN
			SELECT     MainClassMaster.MainClassName, EmpMaster.RecordNo, EmpMaster.Firstname + ' ' + EmpMaster.MiddleName + '  ' + EmpMaster.LastName AS EmployeeName, DesignationMaster.DesignationName, 
							  EmpMaster.MobileNo1, EmpMaster.MobileNo2, EmpMaster.EmailIDITR, EmpMaster.MainClassCode, EmpMaster.DeleteFlag
		FROM         EmpMaster INNER JOIN
							  DesignationMaster ON EmpMaster.DesignationCode = DesignationMaster.DesignationCode INNER JOIN
							  MainClassMaster ON EmpMaster.MainClassCode = MainClassMaster.MainClassCode
		ORDER BY EmpMaster.RecordNo
	END	 
	Else If @RecordSelection='StudentWiseExamTermDEntry'
	 BEGIN
			SELECT     DEMaster.DETitleCode, DEMaster.SrNo, StudentExamTermDEntry.DECode, DEMaster.DEName, DETitleMaster.DETitleName, StudentExamTermDEntry.RegID, 
							  StudentExamTermDEntry.ExamCode
		FROM         StudentExamTermDEntry INNER JOIN
							  DEMaster ON StudentExamTermDEntry.DECode = DEMaster.DECode INNER JOIN
							  DETitleMaster ON StudentExamTermDEntry.DETitleCode = DETitleMaster.DETitleCode
		WHERE     (StudentExamTermDEntry.RegID = @RegID) AND (StudentExamTermDEntry.ExamCode = @ExamCode) AND (StudentExamTermDEntry.DETitleCode = @DETitleCode)
		ORDER BY StudentExamTermDEntry.DETitleCode, DEMaster.SrNo
	END

	  Else If @RecordSelection='ACVoucherEditSummary'	
	 BEGIN			
				SELECT        ACVoucher.VType, ACLedgerHeadMaster.LedgerHead, SUM(ACVoucherDetail.Amount) AS Amount, ACVoucher.FyCode, ACAccountRegisterMaster.AccountRegister
			FROM            ACVoucher INNER JOIN
									 ACVoucherDetail ON ACVoucher.TID = ACVoucherDetail.TID INNER JOIN
									 ACLedgerHeadMaster ON ACVoucherDetail.LedgerHeadCode = ACLedgerHeadMaster.LedgerHeadCode INNER JOIN
									 ACAccountRegisterMaster ON ACVoucher.AccountRegisterCode = ACAccountRegisterMaster.AccountRegisterCode
			GROUP BY ACVoucher.VType, ACLedgerHeadMaster.LedgerHead, ACVoucher.FyCode, ACAccountRegisterMaster.AccountRegister
			UNION ALL
			SELECT        ACVoucher.VType, ACLedgerHeadMaster.LedgerHead, SUM(ACVoucher.Amount) AS Amount, ACVoucher.FyCode, ACAccountRegisterMaster.AccountRegister
			FROM            ACVoucher INNER JOIN
										ACLedgerHeadMaster ON ACVoucher.LedgerHeadBankCode = ACLedgerHeadMaster.LedgerHeadCode INNER JOIN
										ACAccountRegisterMaster ON ACVoucher.AccountRegisterCode = ACAccountRegisterMaster.AccountRegisterCode
			WHERE        (ACVoucher.PaymentTypeCode <> 1)
			GROUP BY ACVoucher.VType, ACLedgerHeadMaster.LedgerHead, ACVoucher.FyCode, ACAccountRegisterMaster.AccountRegister
			ORDER BY ACLedgerHeadMaster.LedgerHead
      END	

	Else If @RecordSelection='ACVoucherAndVoucherDetail'	
	 BEGIN						
		SELECT        ACVoucher.TID, ACVoucher.VCode, ACVoucher.VNo, ACVoucher.AccountRegisterCode, ACAccountRegisterMaster.AccountRegister, ACVoucher.MainClassCode, MainClassMaster.MainClassName, ACVoucher.VType, 
								 CONVERT(varchar, ACVoucher.VDate, 106) AS VDate, ACVoucher.VFlag, ACLedgerHeadMaster_1.LedgerHead, ACLedgerHeadMaster.LedgerHead AS LedgerHeadBank, ACVoucherDetail.Amount, ACVoucher.PaymentTypeCode, 
								 ACPaymentTypeMaster.PaymentTypeName AS PType, ACVoucher.PartyTID, ACPartyMaster.PartyName, ACVoucher.LedgerHeadBankCode, ACVoucher.LedgerHeadNarrationBank, ACVoucher.ChequeDate, ACVoucher.UserCode, 
								 ACVoucher.FyCode, ACVoucher.FilePath
		FROM            ACVoucher INNER JOIN
								 ACAccountRegisterMaster ON ACVoucher.AccountRegisterCode = ACAccountRegisterMaster.AccountRegisterCode INNER JOIN
								 ACPaymentTypeMaster ON ACVoucher.PaymentTypeCode = ACPaymentTypeMaster.PaymentTypeCode INNER JOIN
								 ACLedgerHeadMaster ON ACVoucher.LedgerHeadBankCode = ACLedgerHeadMaster.LedgerHeadCode INNER JOIN
								 ACPartyMaster ON ACVoucher.PartyTID = ACPartyMaster.TID INNER JOIN
								 ACVoucherDetail ON ACVoucher.TID = ACVoucherDetail.TID INNER JOIN
								 ACLedgerHeadMaster AS ACLedgerHeadMaster_1 ON ACVoucherDetail.LedgerHeadCode = ACLedgerHeadMaster_1.LedgerHeadCode INNER JOIN
								 MainClassMaster ON ACVoucher.MainClassCode = MainClassMaster.MainClassCode
		ORDER BY VDate, ACVoucher.VCode
	END	

	 Else If @RecordSelection='ACVoucherDetail'	
	 BEGIN			
			SELECT        ACVoucherDetail.TID, ACVoucherDetail.SrNo, ACVoucherDetail.LedgerHeadCode, ACLedgerHeadMaster.LedgerHead, ACVoucherDetail.LedgerHeadNarration,  
                         ACVoucherDetail.Amount
			FROM            ACVoucherDetail INNER JOIN
									 ACLedgerHeadMaster ON ACVoucherDetail.LedgerHeadCode = ACLedgerHeadMaster.LedgerHeadCode
			WHERE        (ACVoucherDetail.TID = @FieldCode)
			ORDER BY ACVoucherDetail.SrNo
     END	
	
	 Else If @RecordSelection='ACVoucher'	
	 BEGIN						
			SELECT        ACVoucher.TID, ACVoucher.VCode, ACVoucher.AccountRegisterCode, ACAccountRegisterMaster.AccountRegister, ACVoucher.MainClassCode, MainClassMaster.MainClassName, ACVoucher.VType, CONVERT(varchar, 
                         ACVoucher.VDate, 106) AS VDate, ACVoucher.VFlag, ACVoucher.VNo, ACVoucher.PartyTID, ACPartyMaster.PartyName, ACVoucher.Amount, ACVoucher.PaymentTypeCode, ACPaymentTypeMaster.PaymentTypeName, 
                         ACVoucher.LedgerHeadBankCode, ACLedgerHeadMaster.LedgerHead AS LedgerHeadBank, ACVoucher.LedgerHeadNarrationBank, ACVoucher.ChequeDate, ACVoucher.UserCode, ACVoucher.FyCode, ACVoucher.FilePath
			FROM            ACVoucher INNER JOIN
									 ACAccountRegisterMaster ON ACVoucher.AccountRegisterCode = ACAccountRegisterMaster.AccountRegisterCode INNER JOIN
									 ACPaymentTypeMaster ON ACVoucher.PaymentTypeCode = ACPaymentTypeMaster.PaymentTypeCode INNER JOIN
									 ACLedgerHeadMaster ON ACVoucher.LedgerHeadBankCode = ACLedgerHeadMaster.LedgerHeadCode INNER JOIN
									 ACPartyMaster ON ACVoucher.PartyTID = ACPartyMaster.TID INNER JOIN
									 MainClassMaster ON ACVoucher.MainClassCode = MainClassMaster.MainClassCode
			ORDER BY ACVoucher.VCode DESC
	 END

	 Else If @RecordSelection='ACPartyMaster'
	 BEGIN
				SELECT        TID, PartyCode, PartyName, Address, MobNo, PanNo, DeleteFlag
				FROM            ACPartyMaster
				WHERE        (DeleteFlag = 'N')
				ORDER BY PartyCode DESC
	END
	
	 Else If @RecordSelection='ACLedgerHeadMaster'
	 BEGIN
				SELECT        ACLedgerHeadMaster.LedgerHeadCode, ACLedgerHeadMaster.SrNo, ACLedgerTypeMaster.LedgerType, ACLedgerHeadMaster.LedgerHead,  
								 ACLedgerHeadMaster.LedgerTypeCode, ACLedgerHeadMaster.DeleteFlag
		FROM            ACLedgerHeadMaster INNER JOIN
								 ACLedgerTypeMaster ON ACLedgerHeadMaster.LedgerTypeCode = ACLedgerTypeMaster.LedgerTypeCode
		ORDER BY ACLedgerHeadMaster.LedgerHeadCode
	 END		
	 
	 Else If @RecordSelection='ACLedgerHeadNarrationMaster'
	 BEGIN
		SELECT     ACLedgerHeadNarrationMaster.LedgerHeadNarrationCode, ACLedgerHeadMaster.LedgerHead, ACLedgerHeadNarrationMaster.LedgerHeadNarration, ACLedgerHeadNarrationMaster.LedgerHeadCode, 
							  ACLedgerHeadNarrationMaster.DeleteFlag
		FROM         ACLedgerHeadNarrationMaster INNER JOIN
							  ACLedgerHeadMaster ON ACLedgerHeadNarrationMaster.LedgerHeadCode = ACLedgerHeadMaster.LedgerHeadCode
		ORDER BY ACLedgerHeadNarrationMaster.LedgerHeadNarrationCode
	 END		

	Else If @RecordSelection='ACAccountRegisterMaster'
	 BEGIN
					SELECT        AccountRegisterCode, AccountRegister, DeleteFlag
			FROM            ACAccountRegisterMaster ORDER BY AccountRegisterCode
	 END
	Else If @RecordSelection='CountryMaster'
	 BEGIN
		SELECT  CountryCode, CountryName, DeleteFlag FROM    CountryMaster ORDER BY CountryCode
		OPTION (RECOMPILE)
	 END	

END
GO
/****** Object:  StoredProcedure [dbo].[SP_EditRecordAdmission]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_EditRecordAdmission]
	@RecordSelection nvarchar(120)=null, @FieldCode bigint=null, @AyCode bigint=null, @WhereCondition nvarchar(Max)=Null
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	
	If @RecordSelection='StudInfo'
	 BEGIN
		SELECT     StudInfo.RegID, MainClassMaster.MainClassName AS MainClass, StudInfo.RegNo, MediumMaster.MediumName AS Medium, CONVERT(varchar, StudInfo.AdmittionDate, 103) AS AdmiDate,  CASE StudInfo.LastName WHEN '-' THEN StudInfo.Firstname + ' ' + StudInfo.MiddleName ELSE StudInfo.Firstname + ' ' + StudInfo.MiddleName + ' ' + StudInfo.LastName END AS StudentName,  ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, GenderMaster.GenderName AS Gender, CONVERT(varchar, StudInfo.Dob, 103) AS DOB, CasteMaster.CasteName AS Caste,  CategoryMaster.CategoryName AS Category, StudInfo.EntryFrom,  CASE StudInfo.LastNameE WHEN '-' THEN StudInfo.FirstnameE + ' ' + StudInfo.MiddleNameE ELSE StudInfo.FirstnameE + ' ' + StudInfo.MiddleNameE + ' ' + StudInfo.LastNameE END AS StudentNameE, StudInfo.CloseFlag AS TCFlag, StudInfo.AyCode, AyMaster.AyName FROM  StudInfo INNER JOIN MainClassMaster ON StudInfo.MainClassCode = MainClassMaster.MainClassCode INNER JOIN ClassMaster ON StudInfo.ClassCode = ClassMaster.ClassCode INNER JOIN MediumMaster ON StudInfo.MediumCode = MediumMaster.MediumCode INNER JOIN DivisionMaster ON StudInfo.DivisionCode = DivisionMaster.DivisionCode INNER JOIN GenderMaster ON StudInfo.GenderCode = GenderMaster.GenderCode INNER JOIN CategoryMaster ON StudInfo.CategoryCode = CategoryMaster.CategoryCode INNER JOIN CasteMaster ON StudInfo.CastCode = CasteMaster.CasteCode INNER JOIN AyMaster ON StudInfo.AyCode = AyMaster.AyCode 
	 END
	 
	Else If @RecordSelection='StudInfoEdit'
	 BEGIN
			SELECT     StudInfo.RegID, StudInfo.MainClassCode, MainClassMaster.MainClassName, StudInfo.RegNo, StudInfo.MediumCode, MediumMaster.MediumName, StudInfo.AyCode, StudInfo.CloseFlag, 
								  StudInfo.StudDisplayFlag, StudInfo.EntryFrom, StudInfo.FeesPaidFlag, StudInfo.MarksFeedFlag, StudInfo.TSuspendedFlag, StudInfo.TSupendedDate, StudInfo.AdmissionType, CONVERT(varchar, 
								  StudInfo.AdmittionDate, 106) AS AdmittionDate, StudInfo.Firstname, StudInfo.MiddleName, StudInfo.LastName, StudInfo.ClassCode, ClassMaster.ClassName, StudInfo.DivisionCode, 
								  DivisionMaster.DivisionName, StudInfo.GenderCode, GenderMaster.GenderName, StudInfo.StudentID, StudInfo.AadharNo, StudInfo.Photpath, StudInfo.RollNo, StudInfo.FormNo, 
								  StudInfo.FeeTypeCode, FeeTypeMaster.FeeTypeName, StudInfo.PermanentAddress, StudInfo.PerCitycode, CityMaster.CityName AS PerCityName, StudInfo.LocalAddress, StudInfo.LocCitycode, 
								  CityMaster_1.CityName AS LocCityName, StudInfo.AreaCode, AreaMaster.AreaName, StudInfo.MobileNo1, StudInfo.MobileNo2, StudInfo.Dob, StudInfo.BirthPlaceCode, 
								  CityMaster_2.CityName AS BirthPlaceCity, CityMaster_2.TalukaCode, TalukaMaster.TalukaName, TalukaMaster.DistrictCode, DistrictMaster.DistrictName, StudInfo.BloodGroup, StudInfo.CastCode, 
								  CasteMaster.CasteName, CasteMaster.CasteNameEN, StudInfo.SubCast, StudInfo.ReligionCode, ReligionMaster.ReligionName, StudInfo.MotherTongueCode, 
								  LanguageMaster.LanguageName AS MotherTongue, StudInfo.LanguageKnownCode, LanguageMaster_1.LanguageName AS LanguageKnown, StudInfo.CategoryCode, CategoryMaster.CategoryName, 
								  StudInfo.PSCode, OtherSchoolMaster.OtherSchoolName AS PreviousSchoolName, OtherSchoolMaster.UDIESNo, StudInfo.PSClassCode, ClassMaster_1.ClassName AS PSClassName, 
								  StudInfo.PSResult, StudInfo.PSRegNo, StudInfo.PSTCNo, StudInfo.PSLeaveDate, StudInfo.PSLeaveReasonCode, TCSLRMaster.TCSLRName, StudInfo.FatherName, StudInfo.FEducationCode, 
								  EducationMaster.EducationName AS FEducationName, StudInfo.FOccupationCode, OccupationMaster.OccupationName AS FOccupationName, 
								  OccupationMaster.OccupationNameEN AS FOccupationNameEN, StudInfo.FAnnualIncome, StudInfo.MotherName, StudInfo.MEducationCode, EducationMaster_1.EducationName AS MEducationName, 
								  StudInfo.MCccupationCode, OccupationMaster_1.OccupationName AS MOccupationName, OccupationMaster_1.OccupationNameEN AS MOccupationNameEN, StudInfo.GaurdianName, 
								  StudInfo.RelationCode, RelationMaster.RelationName, StudInfo.ClassCodeAT, ClassMaster_2.ClassName AS ClassNameAT, StudInfo.DivisionCodeAT, 
								  DivisionMaster_1.DivisionName AS DivisionNameAT, StudInfo.BankCode, BankMaster.BankName, BankMaster.IFSCCode, StudInfo.BankAcNo, StudInfo.BankAPersonName, 
								  StudInfo.PersonalIdentMark, StudInfo.Age30Sept, StudInfo.Remark, StudInfo.UserCode, StudInfo.MargeFlag, StudInfo.OpeningBalance, StudInfo.HandyCapStatus, StudInfo.HandyCapCode, 
								  HandyCapMaster.HandyCapName, StudInfo.BPLCardStatus, StudInfo.PPECompleteStatus, StudInfo.WeightFT, StudInfo.WeightST, StudInfo.HeightFT, StudInfo.HeightST, StudInfo.SeatNo, 
								  StudInfo.Nationality, StudInfo.FirstnameE, StudInfo.MiddleNameE, StudInfo.LastNameE, StudInfo.AdmiSchoolType, StudInfo.MotherNameE, StudInfo.WeekPointDetail, StudInfo.LearningStopResion, 
								  StudInfo.PrePrimarySchoolName, StudInfo.GovermentOffer, StudInfo.AadharLinkBankStatus, StudInfo.HostelStayFlag, StudInfo.FAadharCardNo, StudInfo.FPanCard, StudInfo.MAnnualIncome, 
								  StudInfo.MAadharCardNo, StudInfo.MPanCard, StudInfo.WhatsAppMobileNo, StudInfo.EmailID, StudInfo.FacebookID, StudInfo.InstragramID, StudInfo.TwitterID, StudInfo.TelegramID, StudInfo.Branch, 
								  StudInfo.MotherFatherAreAlive, StudInfo.EWSCertificateStatus, StudInfo.HandyCapPercentage, StudInfo.BPLCardNo, 
								  CASE StudInfo.LastName WHEN '-' THEN StudInfo.Firstname + ' ' + StudInfo.MiddleName ELSE StudInfo.Firstname + ' ' + StudInfo.MiddleName + ' ' + StudInfo.LastName END AS StudentName, 
								  StudInfo.SubjectGroupCode, StudInfo.SubjectDetails, ClassMaster.MinSubject, ClassMaster.MaxStudentPerDiv, StudInfo.FeeTypeConcessionCode, 
								  FeeTypeConcessionMaster.FeeTypeConcessionName, AyMaster.AyName, StudInfo.NationalCode, StudInfo.ApaarID, StudInfo.StudentNameAadhar, StudInfo.AadharVerifiedFlag
			FROM         StudInfo INNER JOIN
								  MainClassMaster ON StudInfo.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
								  ClassMaster ON StudInfo.ClassCode = ClassMaster.ClassCode INNER JOIN
								  MediumMaster ON StudInfo.MediumCode = MediumMaster.MediumCode INNER JOIN
								  DivisionMaster ON StudInfo.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
								  GenderMaster ON StudInfo.GenderCode = GenderMaster.GenderCode INNER JOIN
								  FeeTypeMaster ON StudInfo.FeeTypeCode = FeeTypeMaster.FeeTypeCode INNER JOIN
								  CityMaster ON StudInfo.PerCitycode = CityMaster.CityCode INNER JOIN
								  CityMaster AS CityMaster_1 ON StudInfo.LocCitycode = CityMaster_1.CityCode INNER JOIN
								  AreaMaster ON StudInfo.AreaCode = AreaMaster.AreaCode INNER JOIN
								  CityMaster AS CityMaster_2 ON StudInfo.BirthPlaceCode = CityMaster_2.CityCode INNER JOIN
								  TalukaMaster ON CityMaster_2.TalukaCode = TalukaMaster.Talukacode INNER JOIN
								  DistrictMaster ON TalukaMaster.DistrictCode = DistrictMaster.DistrictCode INNER JOIN
								  CasteMaster ON StudInfo.CastCode = CasteMaster.CasteCode INNER JOIN
								  ReligionMaster ON StudInfo.ReligionCode = ReligionMaster.ReligionCode INNER JOIN
								  LanguageMaster ON StudInfo.MotherTongueCode = LanguageMaster.LanguageCode INNER JOIN
								  LanguageMaster AS LanguageMaster_1 ON StudInfo.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
								  CategoryMaster ON StudInfo.CategoryCode = CategoryMaster.CategoryCode INNER JOIN
								  RelationMaster ON StudInfo.RelationCode = RelationMaster.RelationCode INNER JOIN
								  OtherSchoolMaster ON StudInfo.PSCode = OtherSchoolMaster.OtherSchoolCode INNER JOIN
								  ClassMaster AS ClassMaster_1 ON StudInfo.PSClassCode = ClassMaster_1.ClassCode INNER JOIN
								  ClassMaster AS ClassMaster_2 ON StudInfo.ClassCodeAT = ClassMaster_2.ClassCode INNER JOIN
								  TCSLRMaster ON StudInfo.PSLeaveReasonCode = TCSLRMaster.TCSLRCode INNER JOIN
								  EducationMaster ON StudInfo.FEducationCode = EducationMaster.EducationCode INNER JOIN
								  EducationMaster AS EducationMaster_1 ON StudInfo.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
								  OccupationMaster ON StudInfo.FOccupationCode = OccupationMaster.OccupationCode INNER JOIN
								  OccupationMaster AS OccupationMaster_1 ON StudInfo.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
								  DivisionMaster AS DivisionMaster_1 ON StudInfo.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
								  BankMaster ON StudInfo.BankCode = BankMaster.BankCode INNER JOIN
								  HandyCapMaster ON StudInfo.HandyCapCode = HandyCapMaster.HandyCapCode INNER JOIN
								  FeeTypeConcessionMaster ON StudInfo.FeeTypeConcessionCode = FeeTypeConcessionMaster.FeeTypeConcessionCode INNER JOIN
								  AyMaster ON StudInfo.AyCode = AyMaster.AyCode
		WHERE     (StudInfo.RegID = @FieldCode)
	END

	Else If @RecordSelection='StudInfoAll'
	 BEGIN
		SELECT     StudInfoAll.RegID, MainClassMaster.MainClassName AS MainClass, StudInfoAll.RegNo, MediumMaster.MediumName AS Medium, CONVERT(varchar, StudInfoAll.AdmittionDate, 103) AS AdmiDate,  CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, GenderMaster.GenderName AS Gender, CONVERT(varchar, StudInfoAll.Dob, 103) AS DOB,  CasteMaster.CasteName AS Caste, CategoryMaster.CategoryName AS Category, StudInfoAll.EntryFrom,  CASE StudInfoAll.LastNameE WHEN '-' THEN StudInfoAll.FirstnameE + ' ' + StudInfoAll.MiddleNameE ELSE StudInfoAll.FirstnameE + ' ' + StudInfoAll.MiddleNameE + ' ' + StudInfoAll.LastNameE END AS StudentNameE, StudInfoAll.CloseFlag AS TCFlag, StudInfoAll.AyCode, AyMaster.AyName FROM         StudInfoAll INNER JOIN MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN MediumMaster ON StudInfoAll.MediumCode = MediumMaster.MediumCode INNER JOIN DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN CategoryMaster ON StudInfoAll.CategoryCode = CategoryMaster.CategoryCode INNER JOIN GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode INNER JOIN CasteMaster ON StudInfoAll.CastCode = CasteMaster.CasteCode INNER JOIN AyMaster ON StudInfoAll.AyCode = AyMaster.AyCode
	 END

	 
	Else If @RecordSelection='StudInfoAllEdit'
	 BEGIN
			SELECT     StudInfoAll.RegID, StudInfoAll.MainClassCode, MainClassMaster.MainClassName, StudInfoAll.RegNo, StudInfoAll.MediumCode, MediumMaster.MediumName, StudInfoAll.AyCode, 
								  StudInfoAll.CloseFlag, StudInfoAll.StudDisplayFlag, StudInfoAll.EntryFrom, StudInfoAll.FeesPaidFlag, StudInfoAll.MarksFeedFlag, StudInfoAll.TSuspendedFlag, StudInfoAll.TSupendedDate, 
								  StudInfoAll.AdmissionType, CONVERT(varchar, StudInfoAll.AdmittionDate, 106) AS AdmittionDate, StudInfoAll.Firstname, StudInfoAll.MiddleName, StudInfoAll.LastName, StudInfoAll.ClassCode, 
								  ClassMaster.ClassName, StudInfoAll.DivisionCode, DivisionMaster.DivisionName, StudInfoAll.GenderCode, GenderMaster.GenderName, StudInfoAll.StudentID, StudInfoAll.AadharNo, 
								  StudInfoAll.Photpath, StudInfoAll.RollNo, StudInfoAll.FormNo, StudInfoAll.FeeTypeCode, FeeTypeMaster.FeeTypeName, StudInfoAll.PermanentAddress, StudInfoAll.PerCitycode, 
								  CityMaster.CityName AS PerCityName, StudInfoAll.LocalAddress, StudInfoAll.LocCitycode, CityMaster_1.CityName AS LocCityName, StudInfoAll.AreaCode, AreaMaster.AreaName, 
								  StudInfoAll.MobileNo1, StudInfoAll.MobileNo2, StudInfoAll.Dob, StudInfoAll.BirthPlaceCode, CityMaster_2.CityName AS BirthPlaceCity, CityMaster_2.TalukaCode, TalukaMaster.TalukaName, 
								  TalukaMaster.DistrictCode, DistrictMaster.DistrictName, StudInfoAll.BloodGroup, StudInfoAll.CastCode, CasteMaster.CasteName, CasteMaster.CasteNameEN, StudInfoAll.SubCast, 
								  StudInfoAll.ReligionCode, ReligionMaster.ReligionName, StudInfoAll.MotherTongueCode, LanguageMaster.LanguageName AS MotherTongue, StudInfoAll.LanguageKnownCode, 
								  LanguageMaster_1.LanguageName AS LanguageKnown, StudInfoAll.CategoryCode, CategoryMaster.CategoryName, StudInfoAll.PSCode, 
								  OtherSchoolMaster.OtherSchoolName AS PreviousSchoolName, OtherSchoolMaster.UDIESNo, StudInfoAll.PSClassCode, ClassMaster_1.ClassName AS PSClassName, StudInfoAll.PSResult, 
								  StudInfoAll.PSRegNo, StudInfoAll.PSTCNo, StudInfoAll.PSLeaveDate, StudInfoAll.PSLeaveReasonCode, TCSLRMaster.TCSLRName, StudInfoAll.FatherName, StudInfoAll.FEducationCode, 
								  EducationMaster.EducationName AS FEducationName, StudInfoAll.FOccupationCode, OccupationMaster.OccupationName AS FOccupationName, 
								  OccupationMaster.OccupationNameEN AS FOccupationNameEN, StudInfoAll.FAnnualIncome, StudInfoAll.MotherName, StudInfoAll.MEducationCode, 
								  EducationMaster_1.EducationName AS MEducationName, StudInfoAll.MCccupationCode, OccupationMaster_1.OccupationName AS MOccupationName, 
								  OccupationMaster_1.OccupationNameEN AS MOccupationNameEN, StudInfoAll.GaurdianName, StudInfoAll.RelationCode, RelationMaster.RelationName, StudInfoAll.ClassCodeAT, 
								  ClassMaster_2.ClassName AS ClassNameAT, StudInfoAll.DivisionCodeAT, DivisionMaster_1.DivisionName AS DivisionNameAT, StudInfoAll.BankCode, BankMaster.BankName, 
								  BankMaster.IFSCCode, StudInfoAll.BankAcNo, StudInfoAll.BankAPersonName, StudInfoAll.PersonalIdentMark, StudInfoAll.Age30Sept, StudInfoAll.Remark, StudInfoAll.UserCode, StudInfoAll.MargeFlag,
								   StudInfoAll.OpeningBalance, StudInfoAll.HandyCapStatus, StudInfoAll.HandyCapCode, HandyCapMaster.HandyCapName, StudInfoAll.BPLCardStatus, StudInfoAll.PPECompleteStatus, 
								  StudInfoAll.WeightFT, StudInfoAll.WeightST, StudInfoAll.HeightFT, StudInfoAll.HeightST, StudInfoAll.SeatNo, StudInfoAll.Nationality, StudInfoAll.FirstnameE, StudInfoAll.MiddleNameE, 
								  StudInfoAll.LastNameE, StudInfoAll.AdmiSchoolType, StudInfoAll.MotherNameE, StudInfoAll.WeekPointDetail, StudInfoAll.LearningStopResion, StudInfoAll.PrePrimarySchoolName, 
								  StudInfoAll.GovermentOffer, StudInfoAll.AadharLinkBankStatus, StudInfoAll.HostelStayFlag, StudInfoAll.FAadharCardNo, StudInfoAll.FPanCard, StudInfoAll.MAnnualIncome, 
								  StudInfoAll.MAadharCardNo, StudInfoAll.MPanCard, StudInfoAll.WhatsAppMobileNo, StudInfoAll.EmailID, StudInfoAll.FacebookID, StudInfoAll.InstragramID, StudInfoAll.TwitterID, 
								  StudInfoAll.TelegramID, StudInfoAll.Branch, StudInfoAll.MotherFatherAreAlive, StudInfoAll.EWSCertificateStatus, StudInfoAll.HandyCapPercentage, StudInfoAll.BPLCardNo, 
								  CASE StudInfoAll.LastName WHEN '-' THEN StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName ELSE StudInfoAll.Firstname + ' ' + StudInfoAll.MiddleName + ' ' + StudInfoAll.LastName END AS StudentName,
								   StudInfoAll.SubjectGroupCode, StudInfoAll.SubjectDetails, ClassMaster.MinSubject, ClassMaster.MaxStudentPerDiv, StudInfoAll.FeeTypeConcessionCode, 
								  FeeTypeConcessionMaster.FeeTypeConcessionName, AyMaster.AyName, StudInfoAll.NationalCode, StudInfoAll.ApaarID, StudInfoAll.StudentNameAadhar, StudInfoAll.AadharVerifiedFlag
			FROM         StudInfoAll INNER JOIN
								  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
								  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
								  MediumMaster ON StudInfoAll.MediumCode = MediumMaster.MediumCode INNER JOIN
								  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
								  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode INNER JOIN
								  FeeTypeMaster ON StudInfoAll.FeeTypeCode = FeeTypeMaster.FeeTypeCode INNER JOIN
								  CityMaster ON StudInfoAll.PerCitycode = CityMaster.CityCode INNER JOIN
								  CityMaster AS CityMaster_1 ON StudInfoAll.LocCitycode = CityMaster_1.CityCode INNER JOIN
								  AreaMaster ON StudInfoAll.AreaCode = AreaMaster.AreaCode INNER JOIN
								  CityMaster AS CityMaster_2 ON StudInfoAll.BirthPlaceCode = CityMaster_2.CityCode INNER JOIN
								  TalukaMaster ON CityMaster_2.TalukaCode = TalukaMaster.Talukacode INNER JOIN
								  DistrictMaster ON TalukaMaster.DistrictCode = DistrictMaster.DistrictCode INNER JOIN
								  CasteMaster ON StudInfoAll.CastCode = CasteMaster.CasteCode INNER JOIN
								  ReligionMaster ON StudInfoAll.ReligionCode = ReligionMaster.ReligionCode INNER JOIN
								  LanguageMaster ON StudInfoAll.MotherTongueCode = LanguageMaster.LanguageCode INNER JOIN
								  LanguageMaster AS LanguageMaster_1 ON StudInfoAll.LanguageKnownCode = LanguageMaster_1.LanguageCode INNER JOIN
								  CategoryMaster ON StudInfoAll.CategoryCode = CategoryMaster.CategoryCode INNER JOIN
								  RelationMaster ON StudInfoAll.RelationCode = RelationMaster.RelationCode INNER JOIN
								  OtherSchoolMaster ON StudInfoAll.PSCode = OtherSchoolMaster.OtherSchoolCode INNER JOIN
								  ClassMaster AS ClassMaster_1 ON StudInfoAll.PSClassCode = ClassMaster_1.ClassCode INNER JOIN
								  ClassMaster AS ClassMaster_2 ON StudInfoAll.ClassCodeAT = ClassMaster_2.ClassCode INNER JOIN
								  TCSLRMaster ON StudInfoAll.PSLeaveReasonCode = TCSLRMaster.TCSLRCode INNER JOIN
								  EducationMaster ON StudInfoAll.FEducationCode = EducationMaster.EducationCode INNER JOIN
								  EducationMaster AS EducationMaster_1 ON StudInfoAll.MEducationCode = EducationMaster_1.EducationCode INNER JOIN
								  OccupationMaster ON StudInfoAll.FOccupationCode = OccupationMaster.OccupationCode INNER JOIN
								  OccupationMaster AS OccupationMaster_1 ON StudInfoAll.MCccupationCode = OccupationMaster_1.OccupationCode INNER JOIN
								  DivisionMaster AS DivisionMaster_1 ON StudInfoAll.DivisionCodeAT = DivisionMaster_1.DivisionCode INNER JOIN
								  BankMaster ON StudInfoAll.BankCode = BankMaster.BankCode INNER JOIN
								  HandyCapMaster ON StudInfoAll.HandyCapCode = HandyCapMaster.HandyCapCode INNER JOIN
								  FeeTypeConcessionMaster ON StudInfoAll.FeeTypeConcessionCode = FeeTypeConcessionMaster.FeeTypeConcessionCode INNER JOIN
								  AyMaster ON StudInfoAll.AyCode = AyMaster.AyCode
		WHERE     (StudInfoAll.RegID = @FieldCode)
	END
	Else If @RecordSelection='StudentFamilyDetail'
	 BEGIN
		SELECT     RegID, SrNo, FamilyName, Age, Relation, Education, Business FROM  StudentFamilyDetail WHERE (RegID = @FieldCode) ORDER BY SrNo
	 END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='StudentPSchoolDetail'
	 BEGIN
		SELECT     RegID, SrNo, PSchoolName, SchoolAddress, RegNo, FromYear, ToYear, SchoolLeaveReason FROM  StudentPSchoolDetail WHERE (RegID = @FieldCode) ORDER BY SrNo
	 END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='StudentPEducationalDetails'
	 BEGIN
		SELECT     RegID, SrNo, ExaminationName, BoardOrUniversity, SchoolOrCollege, DateOfPassing, ExamSeatNo, DegreeCertificateNo, TotalMarksOrGrade, OutOfMarks, QualifyExam FROM         StudentPEducationalDetails  WHERE (RegID = @FieldCode) ORDER BY SrNo
	 END		 	 			 	 	 	 			 	 
	Else If @RecordSelection='StudentFeesDetails'
	 BEGIN
		SELECT     RegID, ReceiptNo, CONVERT(varchar, ReceiptDate, 106) AS ReceiptDate, TotalFeesAmount as FeesPaidAmount FROM         FeesCollection WHERE     (RegID = @FieldCode) ORDER BY ReceiptNo
	 END		 	 			 	 	 	 			 	 

	Else If @RecordSelection='CityMaster'																		
	BEGIN																	
		SELECT     CityMaster.CityCode, CityMaster.CityName, CityMaster.TalukaCode, TalukaMaster.TalukaName, CityMaster.DeleteFlag, TalukaMaster.DistrictCode, DistrictMaster.DistrictName, 
							  DistrictMaster.StateCode, StateMaster.StateName
		FROM         CityMaster INNER JOIN
							  TalukaMaster ON CityMaster.TalukaCode = TalukaMaster.Talukacode INNER JOIN
							  DistrictMaster ON TalukaMaster.DistrictCode = DistrictMaster.DistrictCode INNER JOIN
							  StateMaster ON DistrictMaster.StateCode = StateMaster.StateCode
		ORDER BY CityMaster.CityCode
	END																	
	
	else If @RecordSelection='ReligionMaster'
	BEGIN
		SELECT ReligionCode, ReligionName, MinorityFlag, DeleteFlag FROM ReligionMaster ORDER BY ReligionMaster.ReligionCode
	END

	Else If @RecordSelection='CasteMaster'
	BEGIN
		SELECT CasteMaster.CasteCode, CasteMaster.CasteName, CategoryMaster.CategoryName, CasteMaster.CategoryCode FROM CasteMaster INNER JOIN CategoryMaster ON CasteMaster.CategoryCode = CategoryMaster.CategoryCode WHERE (CasteMaster.DeleteFlag = 0) ORDER BY CasteMaster.CasteName
	END

	Else If @RecordSelection='CasteMasterEN'
	BEGIN
		SELECT CasteMaster.CasteCode, CasteMaster.CasteNameEN, CategoryMaster.CategoryName, CasteMaster.CategoryCode FROM CasteMaster INNER JOIN CategoryMaster ON CasteMaster.CategoryCode = CategoryMaster.CategoryCode WHERE (CasteMaster.DeleteFlag = 0) ORDER BY CasteMaster.CasteNameEN
	END

	Else If @RecordSelection='CategoryMaster'
	BEGIN
		SELECT CategoryCode, CategoryName from CategoryMaster where DeleteFlag = 0 ORDER BY CategoryCode
	END

	Else If @RecordSelection='CategoryMasterEN'
	BEGIN
		SELECT CategoryCode, CategoryNameEN from CategoryMaster where DeleteFlag = 0 ORDER BY CategoryCode
	END	 	 
		Else If @RecordSelection='BankAPersonMaster'
	BEGIN
		SELECT BankAPersonCode, BankAPersonName from BankAPersonMaster where DeleteFlag = 0 ORDER BY BankAPersonCode
	END

	Else If @RecordSelection='AdmiSchoolType'
	BEGIN
		SELECT RFilterCode, RFilterName FROM  RecordFilterMaster WHERE (RFWhere = N'FirstClassAdmission') ORDER BY RFilterCode
	END

	Else If @RecordSelection='SIRFEdit'
	BEGIN
		SELECT RFilterCode, RFilterName FROM  RecordFilterMaster WHERE (RFWhere = N'SI') ORDER BY RFilterCode
	END
	Else If @RecordSelection='BloodGroupMaster'
	BEGIN
		SELECT BloodGroupCode, BloodGroupName from BloodGroupMaster where DeleteFlag = 0 ORDER BY BloodGroupCode
	END

	Else If @RecordSelection='LanguageMaster'
	BEGIN
		SELECT LanguageCode, LanguageName from LanguageMaster where DeleteFlag = 0 ORDER BY LanguageCode
	END
	Else If @RecordSelection='RelationMaster'
	BEGIN
		SELECT RelationCode, RelationName from RelationMaster where DeleteFlag = 0 ORDER BY RelationCode
	END
	Else If @RecordSelection='DocumentMaster'
	BEGIN
		SELECT DocumentCode, DocumentName, '-' as DocumentPath from DocumentMaster where DeleteFlag = 0 ORDER BY DocumentCode
	END
	Else If @RecordSelection='StudentDocument'
	 BEGIN
		SELECT RegID, DocumentCode, DocumentPath FROM StudentDocument where RegID = @FieldCode
	 END		 
	Else If @RecordSelection='SubjectGroupSubjectMaster'
	BEGIN
		SELECT     SubjectMaster.SubjectCode, SubjectMaster.SubjectName, SubjectGroupDetail.SubjectGroupCode, SubjectGroupMaster.SubjectGroupName, SubjectGroupDetail.CompulsoryFlag, 
							  ClassMaster.ClassName
		FROM         SubjectGroupClassDetail INNER JOIN
							  ClassMaster ON SubjectGroupClassDetail.ClassCode = ClassMaster.ClassCode INNER JOIN
							  SubjectMaster INNER JOIN
							  SubjectGroupDetail ON SubjectMaster.SubjectCode = SubjectGroupDetail.SubjectCode INNER JOIN
							  SubjectGroupMaster ON SubjectGroupDetail.SubjectGroupCode = SubjectGroupMaster.SubjectGroupCode ON 
							  SubjectGroupClassDetail.SubjectGroupCode = SubjectGroupMaster.SubjectGroupCode
		WHERE     (SubjectMaster.DeleteFlag = 0)
		ORDER BY SubjectMaster.SubjectCode
	END
	 Else If @RecordSelection='StudentSubjectDetails'
	 BEGIN
		SELECT     StudentSubjectDetails.RegID, StudentSubjectDetails.SubjectGroupCode, StudentSubjectDetails.SubjectCode, SubjectMaster.SubjectName, SubjectMaster.SubjectNameShort, SubjectGroupMaster.SubjectGroupName
		FROM         StudentSubjectDetails INNER JOIN
							  SubjectMaster ON StudentSubjectDetails.SubjectCode = SubjectMaster.SubjectCode INNER JOIN
							  SubjectGroupMaster ON StudentSubjectDetails.SubjectGroupCode = SubjectGroupMaster.SubjectGroupCode
		WHERE     (StudentSubjectDetails.RegID = @FieldCode)
	 END

END
GO
/****** Object:  StoredProcedure [dbo].[SP_EditRecordCommon]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_EditRecordCommon]
	@RecordSelection nvarchar(120)=null, @FieldCode bigint=null, @AyCode bigint=null, @WhereCondition nvarchar(Max)=Null
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	
	If @RecordSelection='AyMaster'
	BEGIN
		SELECT AyCode,  AyName, DeleteFlag FROM AyMaster ORDER BY AyCode Desc
	END
	Else If @RecordSelection='PageSizeMaster'
	BEGIN
		SELECT     PageSizeCode, PageSizeName FROM         PageSizeMaster WHERE     (DeleteFlag = 0) ORDER BY PageSizeCode
	END
	Else If @RecordSelection='MainClassMaster'
	BEGIN
		SELECT MainClassCode, MainClassName from MainClassMaster where DeleteFlag = 0 ORDER BY MainClassCode
	END
	Else If @RecordSelection='MediumMaster'
	BEGIN
		SELECT MediumCode, MediumName from MediumMaster where DeleteFlag = 0 ORDER BY MediumCode
	END
	Else If @RecordSelection='ClassMaster'
	BEGIN
		SELECT ClassCode, ClassName from ClassMaster where DeleteFlag = 0 ORDER BY ClassCode
	END
	Else If @RecordSelection='PSClassMaster'
	BEGIN
		SELECT ClassCode, ClassName from ClassMaster where ClassCode<0 or DeleteFlag = 0 OR ClassCode = (SELECT Min(ClassMaster.ClassCode)-1 as MinClassCode From ClassMaster Where DeleteFlag = 0) ORDER BY ClassCode
	END

	Else If @RecordSelection='DivisionMaster'
	BEGIN
		SELECT DivisionCode, DivisionName from DivisionMaster where DeleteFlag = 0 ORDER BY DivisionCode
	END

	Else If @RecordSelection='GenderMaster'
	BEGIN
		SELECT GenderCode, GenderName from GenderMaster where DeleteFlag = 0 And GenderType = 'BG' ORDER BY GenderCode
	END
		 	 
END
GO
/****** Object:  StoredProcedure [dbo].[SP_EditRecordExam]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_EditRecordExam]
	@RecordSelection nvarchar(120)=null, @FieldCode bigint=null, @AyCode bigint=null, @WhereCondition nvarchar(Max)=Null
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	
	If @RecordSelection='ExamMarksDefineDetail'
	 BEGIN
		SELECT     ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, ExamMarksTypeMaster.ExamMarksTypeName AS MarksType, ExamMaster.ExamName AS Exam, 
							  ExamMarksDefine.SrNo, SubjectMaster.SubjectName, ExamMarksDefine.ST1Marks1, ExamMarksDefine.ST1Marks2, ExamMarksDefine.ST1Marks3, ExamMarksDefine.ST1Marks4, 
							  ExamMarksDefine.ST1Marks5, ExamMarksDefine.ST1Marks6, ExamMarksDefine.ST1Marks7, ExamMarksDefine.ST1MarksTotal, ExamMarksDefine.ST2MarksTotal, 
							  ExamMarksDefine.ST3MarksTotal, ExamMarksDefine.ExamMarksTypeCode, ClassMaster.MaxSubDEntry, ClassMaster.MaxTermDEntry, ExamMarksDefine.DivideMarks, 
							  ExamMarksDefine.MarksAddInTotalFlag
		FROM         ExamMarksDefine INNER JOIN
							  ClassMaster ON ExamMarksDefine.ClassCode = ClassMaster.ClassCode INNER JOIN
							  SubjectMaster ON ExamMarksDefine.SubjectCode = SubjectMaster.SubjectCode INNER JOIN
							  ExamMarksTypeMaster ON ExamMarksDefine.ExamMarksTypeCode = ExamMarksTypeMaster.ExamMarksTypeCode INNER JOIN
							  ExamGroupDetail ON ExamMarksDefine.ExamGroupcode = ExamGroupDetail.ExamGroupcode INNER JOIN
							  ExamMaster ON ExamGroupDetail.ExamCode = ExamMaster.ExamCode INNER JOIN
							  DivisionMaster ON ExamGroupDetail.DivisionCode = DivisionMaster.DivisionCode
		ORDER BY ExamMarksDefine.SrNo
	END		 	 
END
GO
/****** Object:  StoredProcedure [dbo].[SP_EditRecordFees]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_EditRecordFees]
	@RecordSelection nvarchar(120)=null, @FieldCode bigint=null, @AyCode bigint=null, @WhereCondition nvarchar(Max)=Null
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	
	If @RecordSelection='FeeTypeMaster'
	BEGIN
		SELECT FeeTypeCode, FeeTypeName from FeeTypeMaster where DeleteFlag = 0 ORDER BY FeeTypeCode
	END

	Else If @RecordSelection='FeeTitleMaster'
	BEGIN
		SELECT FeeTitleCode, FeeTitleName from FeeTitleMaster where DeleteFlag = 0 And FeeTitleCode>0 ORDER BY FeeTitleCode
	END

	Else If @RecordSelection='FeeInstallementMaster'
	BEGIN
		SELECT FeeInstallementCode, FeeInstallementName from FeeInstallementMaster where DeleteFlag = 0 ORDER BY FeeInstallementCode
	END
	Else If @RecordSelection='FeeTypeConcessionMaster'
	BEGIN
		SELECT FeeTypeConcessionCode, FeeTypeConcessionName from FeeTypeConcessionMaster where DeleteFlag = 0 ORDER BY FeeTypeConcessionCode
	END
	 
END
GO
/****** Object:  StoredProcedure [dbo].[SP_EditRecordMainScreen]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_EditRecordMainScreen]
	@RecordSelection nvarchar(120)=null, @FieldCode bigint=null, @AyCode bigint=null, @WhereCondition nvarchar(Max)=Null
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	
	If @RecordSelection='SoftwareSetting'
	 BEGIN
		SELECT SoftwareSetting.Title, SoftwareSetting.Condition From SoftwareSetting
	 END
	Else If @RecordSelection='TCPrintTypeMaster'
	 BEGIN
	    SELECT TCReportTypeCode, TCReportTypeName, DefaultTick, TCPrintFlag FROM TCPrintTypeMaster ORDER BY TCReportTypeCode
	 END		 
	Else If @RecordSelection='FeesReportTypeMasterTemp'
	BEGIN
		SELECT * From  FeesReportTypeMasterTemp
	END
 	 
END
GO
/****** Object:  StoredProcedure [dbo].[SP_FillList]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- CREATE Used To CREATE A NEW Procedure
-- ALTER Used To Modify Procedure

CREATE PROCEDURE [dbo].[SP_FillList]
	@RecordSelection nvarchar(100)=0, @WhereCondition nvarchar(120)=Null, @WhereCondition1 nvarchar(120)=Null, @WhereCondition2 nvarchar(120)=Null, @AyCode bigint=null, @FyCode bigint=null, @MainClassCode bigint=null
AS

BEGIN

	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	If @RecordSelection='UserMaster'
	BEGIN
		SELECT UserCode, UserName FROM UserMaster WHERE DeleteFlag = 0 ORDER BY UserCode
	END

	Else If @RecordSelection='UserWiseMenuDispaly'
	BEGIN
		SELECT  UserDetail.UserCode, UserDetail.MenuType, UserDetail.MenuID, MenuList.MenuName
		FROM    UserDetail INNER JOIN MenuList ON UserDetail.MenuType = MenuList.MenuType AND UserDetail.MenuID = MenuList.MenuID
		ORDER BY UserDetail.UserCode
	END

	Else If @RecordSelection='AyMaster'
	BEGIN
		SELECT AyCode, CONVERT(varchar, FromDate, 106) AS FromDate, CONVERT(varchar, ToDate, 106) AS ToDate, DeleteFlag FROM AyMaster ORDER BY AyCode
	END
	
	Else If @RecordSelection='MainMenuTitle'
	BEGIN
		SELECT MenuID,SrNo, MenuName, MainMenuID, SubMenuID FROM MenuList WHERE DisplaySetting <> 'D' And (DisplaySetting = 'A' OR DisplaySetting = @WhereCondition2)  AND MenuType = 'MainMenu' ORDER BY SrNo
	END

	Else If @RecordSelection='MenuSubTitle'
	BEGIN
		SELECT MenuID, SrNo, MenuName, MainMenuID, SubMenuID FROM MenuList WHERE DisplaySetting <> 'D' And (DisplaySetting = 'A' OR DisplaySetting = @WhereCondition2)  AND MenuType = 'SubMenu' ORDER BY SrNo
	END

	Else If @RecordSelection='MenuItemTitle'
	BEGIN
		SELECT MenuID, SrNo, MenuName, MainMenuID, SubMenuID FROM MenuList WHERE DisplaySetting <> 'D' And (DisplaySetting = 'A' OR DisplaySetting = @WhereCondition2) AND MenuType = 'SubSubMenu' ORDER BY SrNo
	END

	Else If @RecordSelection='CityMaster'
	BEGIN
		SELECT CityCode, CityName from CityMaster where DeleteFlag = 0 ORDER BY CityName
	END

	Else If @RecordSelection='PaymentTypeMaster'
	BEGIN
		SELECT PaymentTypeCode, PaymentTypeName from PaymentTypeMaster where DeleteFlag = 0 ORDER BY PaymentTypeCode
	END

	Else If @RecordSelection='DistrictMaster'
	  BEGIN
				SELECT     DistrictMaster.DistrictCode, DistrictMaster.DistrictName, DistrictMaster.StateCode, StateMaster.StateName
		FROM         DistrictMaster INNER JOIN
							  StateMaster ON DistrictMaster.StateCode = StateMaster.StateCode
		WHERE     (DistrictMaster.DeleteFlag = 0)
		ORDER BY DistrictMaster.DistrictName
	  END

	Else If @RecordSelection='StateMaster'
	  BEGIN
		SELECT StateCode, StateName FROM StateMaster  WHERE DeleteFlag = 0 ORDER BY StateName
	  END

	Else If @RecordSelection='CountryMaster'
	BEGIN
		SELECT CountryCode, CountryName from CountryMaster where DeleteFlag = 0 ORDER BY CountryName
	END

	Else If @RecordSelection='AreaMaster'
	BEGIN	
	   SELECT AreaCode, AreaName FROM AreaMaster WHERE DeleteFlag = 0 ORDER BY AreaName
	END

	Else If @RecordSelection='NoticeMaster'
	BEGIN	
	   SELECT NoticeCode, NoticeName FROM NoticeMaster WHERE DeleteFlag = 0 ORDER BY NoticeCode
	END

	Else If @RecordSelection='HandyCapMaster'
	BEGIN	
	   SELECT HandyCapCode, HandyCapName FROM HandyCapMaster WHERE DeleteFlag = 0 ORDER BY HandyCapName
	END

	Else If @RecordSelection='TalukaMaster'
	BEGIN
				SELECT     TalukaMaster.Talukacode, TalukaMaster.TalukaName, TalukaMaster.DistrictCode, DistrictMaster.DistrictName, DistrictMaster.StateCode, StateMaster.StateName
		FROM         TalukaMaster INNER JOIN
							  DistrictMaster ON TalukaMaster.DistrictCode = DistrictMaster.DistrictCode INNER JOIN
							  StateMaster ON DistrictMaster.StateCode = StateMaster.StateCode
		WHERE     (TalukaMaster.DeleteFlag = 0)
		ORDER BY TalukaMaster.TalukaName
	END

	Else If @RecordSelection='MainClassMaster'
	BEGIN
		SELECT MainClassCode, MainClassName from MainClassMaster where DeleteFlag = 0 ORDER BY MainClassCode
	END

	Else If @RecordSelection='MainClassSubMaster'
	BEGIN
		SELECT Distinct MainClassSubMaster.MainClassSubCode, MainClassSubMaster.MainClassSubName FROM MainClassSubMaster INNER JOIN ClassMaster ON MainClassSubMaster.MainClassSubCode = ClassMaster.MainClassSubCode WHERE     (ClassMaster.DeleteFlag = 0) ORDER BY MainClassSubMaster.MainClassSubCode
	END

	Else If @RecordSelection='MediumMaster'
	BEGIN
		SELECT MediumCode, MediumName from MediumMaster where DeleteFlag = 0 ORDER BY MediumCode
	END

	Else If @RecordSelection='ClassMaster'
	BEGIN
		SELECT ClassCode, ClassName from ClassMaster where DeleteFlag = 0 ORDER BY ClassCode
	END

	Else If @RecordSelection='ClassDivisionMaster'
	BEGIN
		SELECT     ClassMaster.ClassCode, DivisionMaster.DivisionCode, ClassMaster.ClassName + ' ' + DivisionMaster.DivisionName as ClassDiv FROM         ClassMaster CROSS JOIN DivisionMaster WHERE     (ClassName != N'-') AND (DivisionMaster.DeleteFlag = 0) AND (ClassMaster.DeleteFlag = 0) ORDER BY ClassMaster.ClassCode
	END

	Else If @RecordSelection='ClassMasterWithMainClass'
	BEGIN
		SELECT     ClassMaster.ClassCode, ClassMaster.ClassName, MainClassMaster.MainClassName as MainClass, ClassMaster.MainClassCode
		FROM         ClassMaster INNER JOIN
							  MainClassMaster ON ClassMaster.MainClassCode = MainClassMaster.MainClassCode
		WHERE     (ClassMaster.DeleteFlag = 0)
		ORDER BY ClassMaster.ClassCode
	END

	Else If @RecordSelection='PSClassMaster'
	BEGIN
		SELECT ClassCode, ClassName from ClassMaster where ClassCode<0 or DeleteFlag = 0 OR ClassCode = (SELECT Min(ClassMaster.ClassCode)-1 as MinClassCode From ClassMaster Where DeleteFlag = 0) ORDER BY ClassCode
	END

	Else If @RecordSelection='DivisionMaster'
	BEGIN
		SELECT DivisionCode, DivisionName from DivisionMaster where DeleteFlag = 0 ORDER BY DivisionCode
	END

	Else If @RecordSelection='GenderMaster'
	BEGIN
		SELECT GenderCode, GenderName from GenderMaster where DeleteFlag = 0 And GenderType = 'BG' ORDER BY GenderCode
	END

	Else If @RecordSelection='GenderMasterMF'
	BEGIN
		SELECT GenderCode, GenderName from GenderMaster where DeleteFlag = 0 And GenderType = 'MF' ORDER BY GenderCode
	END
	
	Else If @RecordSelection='GenderMasterShort'
	BEGIN
		SELECT GenderCode, GenderShort from GenderMaster where DeleteFlag = 0 And GenderType = 'BG' ORDER BY GenderCode
	END

	Else If @RecordSelection='FeeTypeMaster'
	BEGIN
		SELECT FeeTypeCode, FeeTypeName from FeeTypeMaster where DeleteFlag = 0 ORDER BY FeeTypeCode
	END

	Else If @RecordSelection='FeeTitleMaster'
	BEGIN
		SELECT FeeTitleCode, FeeTitleName from FeeTitleMaster where DeleteFlag = 0 And FeeTitleCode>0 ORDER BY FeeTitleCode
	END

	Else If @RecordSelection='FeeInstallementMaster'
	BEGIN
		SELECT FeeInstallementCode, FeeInstallementName from FeeInstallementMaster where DeleteFlag = 0 ORDER BY FeeInstallementCode
	END

	Else If @RecordSelection='DRHeadMaster'
	BEGIN
		SELECT DRHeadCode, DRHeadName from DRHeadMaster where DeleteFlag = 0 ORDER BY DRHeadCode
	END

	Else If @RecordSelection='ReligionMaster'
	BEGIN
		SELECT ReligionCode, ReligionName, MinorityFlag, DeleteFlag FROM ReligionMaster ORDER BY ReligionMaster.ReligionCode
	END

	Else If @RecordSelection='CasteMaster'
	BEGIN
		SELECT CasteMaster.CasteCode, CasteMaster.CasteName, CategoryMaster.CategoryName, CasteMaster.CategoryCode FROM CasteMaster INNER JOIN CategoryMaster ON CasteMaster.CategoryCode = CategoryMaster.CategoryCode WHERE (CasteMaster.DeleteFlag = 0) ORDER BY CasteMaster.CasteName
	END

	Else If @RecordSelection='CasteMasterEN'
	BEGIN
		SELECT CasteMaster.CasteCode, CasteMaster.CasteNameEN, CategoryMaster.CategoryName, CasteMaster.CategoryCode FROM CasteMaster INNER JOIN CategoryMaster ON CasteMaster.CategoryCode = CategoryMaster.CategoryCode WHERE (CasteMaster.DeleteFlag = 0) ORDER BY CasteMaster.CasteNameEN
	END

	Else If @RecordSelection='CategoryMaster'
	BEGIN
		SELECT CategoryCode, CategoryName from CategoryMaster where DeleteFlag = 0 ORDER BY CategoryCode
	END

	Else If @RecordSelection='CategoryMasterEN'
	BEGIN
		SELECT CategoryCode, CategoryNameEN from CategoryMaster where DeleteFlag = 0 ORDER BY CategoryCode
	END
	
	Else If @RecordSelection='DETitleMaster'
	BEGIN
		SELECT DETitleCode, DETitleName from DETitleMaster where DeleteFlag = 0 ORDER BY DETitleCode
	END

	Else If @RecordSelection='BloodGroupMaster'
	BEGIN
		SELECT BloodGroupCode, BloodGroupName from BloodGroupMaster where DeleteFlag = 0 ORDER BY BloodGroupCode
	END

	Else If @RecordSelection='LanguageMaster'
	BEGIN
		SELECT LanguageCode, LanguageName from LanguageMaster where DeleteFlag = 0 ORDER BY LanguageCode
	END

	Else If @RecordSelection='EmpTypeMaster'
	BEGIN
		SELECT EmpTypeCode, EmpTypeName from EmpTypeMaster where DeleteFlag = 0 ORDER BY EmpTypeCode
	END

	Else If @RecordSelection='DesignationMaster'
	BEGIN
		SELECT DesignationCode, DesignationName from DesignationMaster where DeleteFlag = 0 ORDER BY DesignationCode
	END

	Else If @RecordSelection='BusMaster'
	BEGIN
		SELECT BusCode, BusName from BusMaster where DeleteFlag = 0 ORDER BY BusCode
	END

	Else If @RecordSelection='OtherSchoolMaster'
	BEGIN
		SELECT  OtherSchoolCode, OtherSchoolName, UDIESNo FROM OtherSchoolMaster WHERE  (DeleteFlag = 0) ORDER BY OtherSchoolName
	END

	
	Else If @RecordSelection='PermanentAddress'
	BEGIN
		SELECT Distinct 1 as AddressCode, PermanentAddress FROM StudInfo ORDER BY PermanentAddress
	END

	Else If @RecordSelection='LocalAddress'
	BEGIN
		SELECT Distinct 1 as AddressCode, LocalAddress FROM StudInfo ORDER BY LocalAddress
	END

	Else If @RecordSelection='BirthPlaceCity'
	BEGIN
		SELECT     CityMaster.CityCode, CityMaster.CityName, CityMaster.TalukaCode, TalukaMaster.TalukaName, TalukaMaster.DistrictCode, DistrictMaster.DistrictName FROM         CityMaster INNER JOIN TalukaMaster ON CityMaster.TalukaCode = TalukaMaster.Talukacode INNER JOIN DistrictMaster ON TalukaMaster.DistrictCode = DistrictMaster.DistrictCode WHERE     (CityMaster.DeleteFlag = 0) ORDER BY CityMaster.CityName
	END

	Else If @RecordSelection='BirthPlaceTaluka'
	BEGIN
		SELECT     TalukaMaster.Talukacode, TalukaMaster.TalukaName, TalukaMaster.DistrictCode, DistrictMaster.DistrictName FROM         TalukaMaster INNER JOIN DistrictMaster ON TalukaMaster.DistrictCode = DistrictMaster.DistrictCode WHERE     (TalukaMaster.DeleteFlag = 0) ORDER BY TalukaMaster.TalukaName
	END

	Else If @RecordSelection='EducationMaster'
	BEGIN
		SELECT EducationCode, EducationName from EducationMaster where DeleteFlag = 0 ORDER BY EducationName
	END

	Else If @RecordSelection='OccupationMaster'
	BEGIN
		SELECT OccupationCode, OccupationName from OccupationMaster where DeleteFlag = 0 ORDER BY OccupationName
	END

	Else If @RecordSelection='OccupationMasterEN'
	BEGIN
		SELECT OccupationCode, OccupationNameEN from OccupationMaster where DeleteFlag = 0 ORDER BY OccupationName
	END

	Else If @RecordSelection='TCSLRMaster'
	BEGIN
		SELECT TCSLRCode, TCSLRName from TCSLRMaster where DeleteFlag = 0 ORDER BY TCSLRCode
	END
	
	Else If @RecordSelection='TCStatusMaster'
	BEGIN
		SELECT TCStatusCode, TCStatusName from TCStatusMaster where DeleteFlag = 0 ORDER BY TCStatusCode
	END

	Else If @RecordSelection='TCBehaviorMaster'
	BEGIN
		SELECT TCBehaviorCode, TCBehaviorName from TCBehaviorMaster where DeleteFlag = 0 ORDER BY TCBehaviorCode
	END

	Else If @RecordSelection='TCRemarkMaster'
	BEGIN
		SELECT TCRemarkCode, TCRemarkName from TCRemarkMaster where DeleteFlag = 0 ORDER BY TCRemarkCode
	END

	Else If @RecordSelection='TCClassPromotStatusMaster'
	BEGIN
		SELECT TCClassPromotStatusCode, TCClassPromotStatusName from TCClassPromotStatusMaster where DeleteFlag = 0 ORDER BY TCClassPromotStatusCode
	END

	Else If @RecordSelection='BankMaster'
	BEGIN
		SELECT  BankCode, BankName, IFSCCode FROM BankMaster WHERE (DeleteFlag = 0) ORDER BY BankName
	END

	Else If @RecordSelection='RelationMaster'
	BEGIN
		SELECT RelationCode, RelationName from RelationMaster where DeleteFlag = 0 ORDER BY RelationCode
	END

	Else If @RecordSelection='ExamMaster'
	BEGIN
		SELECT ExamCode, ExamName from ExamMaster where DeleteFlag = 0 ORDER BY ExamCode
	END

	Else If @RecordSelection='ExamMasterFTST'
	BEGIN
		SELECT ExamCode, ExamName from ExamMaster where DeleteFlag = 0 And (ExamCode = 1 Or ExamCode = 2) ORDER BY ExamCode
	END

	Else If @RecordSelection='ExamTypeMaster'
	BEGIN
		SELECT ExamTypeCode, ExamTypeName from ExamTypeMaster where DeleteFlag = 0 ORDER BY ExamTypeCode
	END

	Else If @RecordSelection='ExamGroupMaster'
	BEGIN
		SELECT ExamGroupCode, ExamGroupName from ExamGroupMaster where DeleteFlag = 0 ORDER BY ExamGroupCode
	END

	Else If @RecordSelection='ExamMarksTypeMaster'
	BEGIN
		SELECT ExamMarksTypeCode, ExamMarksTypeName from ExamMarksTypeMaster where DeleteFlag = 0 ORDER BY ExamMarksTypeCode
	END

	Else If @RecordSelection='SubjectMaster'
	BEGIN
		SELECT SubjectCode, SubjectName from SubjectMaster where DeleteFlag = 0 ORDER BY SubjectCode
	END

	Else If @RecordSelection='SubjectMasterExam'
	BEGIN
		SELECT DISTINCT SubjectMaster.SubjectCode, SubjectMaster.SubjectName FROM         SubjectMaster INNER JOIN ExamMarksDefine ON SubjectMaster.SubjectCode = ExamMarksDefine.SubjectCode WHERE     (SubjectMaster.DeleteFlag = 0) ORDER BY SubjectMaster.SubjectCode
	END

	Else If @RecordSelection='SubDEClassGroupMaster'
	BEGIN
		SELECT SubDEClassGCode, SubDEClassGName from SubDEClassGroupMaster where DeleteFlag = 0 ORDER BY SubDEClassGCode
	END

	Else If @RecordSelection='BankAPersonMaster'
	BEGIN
		SELECT BankAPersonCode, BankAPersonName from BankAPersonMaster where DeleteFlag = 0 ORDER BY BankAPersonCode
	END

	Else If @RecordSelection='SIRFEdit'
	BEGIN
		SELECT RFilterCode, RFilterName FROM  RecordFilterMaster WHERE (RFWhere = N'SI') ORDER BY RFilterCode
	END

	Else If @RecordSelection='TCRFAdd'
	BEGIN
		SELECT RFilterCode, RFilterName FROM  RecordFilterMaster WHERE (RFWhere = N'TCAdd') ORDER BY RFilterCode
	END

	Else If @RecordSelection='TCRFEdit'
	BEGIN
		SELECT RFilterCode, RFilterName FROM  RecordFilterMaster WHERE (RFWhere = N'TCEdit') ORDER BY RFilterCode
	END

	Else If @RecordSelection='AdmiSchoolType'
	BEGIN
		SELECT RFilterCode, RFilterName FROM  RecordFilterMaster WHERE (RFWhere = N'FirstClassAdmission') ORDER BY RFilterCode
	END

	Else If @RecordSelection='EmployeeName'
	BEGIN
				SELECT     EmpMaster.TID, EmpMaster.Firstname + ' ' + EmpMaster.MiddleName + ' ' + EmpMaster.LastName AS EmployeeName
		FROM         EmpMaster INNER JOIN
							  MainClassMaster ON EmpMaster.MainClassCode = MainClassMaster.MainClassCode
		WHERE     (EmpMaster.DeleteFlag = 0) ORDER BY EmpMaster.SrNo
	END

	Else If @RecordSelection='PayBillReportName'
	BEGIN
		SELECT  TID, ReportName FROM  EmpMonthlySalary ORDER BY TMDate DESC
	END

	Else If @RecordSelection='StudInfoAllStudentName'
	BEGIN
		SELECT     StudInfoAll.RegID, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
							   END AS StudentName, StudInfoAll.RegNo, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.AyCode, 
							  StudInfoAll.CloseFlag, StudInfoAll.MarksFeedFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender, CategoryMaster.CategoryName, CategoryMaster.CategoryNameEN, 
							  StudInfoAll.StudDisplayFlag, StudInfoAll.FatherName, StudInfoAll.LocalAddress, FeeTypeMaster.FeeTypeName, StudInfoAll.StudentID
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode INNER JOIN
							  CategoryMaster ON StudInfoAll.CategoryCode = CategoryMaster.CategoryCode INNER JOIN
							  FeeTypeMaster ON StudInfoAll.FeeTypeCode = FeeTypeMaster.FeeTypeCode
		WHERE     (StudInfoAll.EntryFrom = 'A')
		ORDER BY StudInfoAll.RegID DESC
	END

	Else If @RecordSelection='StudInfoAllStudentRegNo'
	BEGIN
		SELECT     StudInfoAll.RegID, StudInfoAll.RegNo, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
							   END AS StudentName, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.AyCode, StudInfoAll.CloseFlag, 
							  StudInfoAll.MarksFeedFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender, CategoryMaster.CategoryName, CategoryMaster.CategoryNameEN, StudInfoAll.StudDisplayFlag, 
							  StudInfoAll.FatherName, StudInfoAll.LocalAddress, FeeTypeMaster.FeeTypeName, StudInfoAll.StudentID
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode INNER JOIN
							  CategoryMaster ON StudInfoAll.CategoryCode = CategoryMaster.CategoryCode INNER JOIN
							  FeeTypeMaster ON StudInfoAll.FeeTypeCode = FeeTypeMaster.FeeTypeCode
		WHERE     (StudInfoAll.EntryFrom = 'A')
		ORDER BY StudInfoAll.RegNo
	END

	Else If @RecordSelection='StudInfoAllStudentNameForTC'
	BEGIN
		SELECT     StudInfoAll.RegID, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
							   END AS StudentName, StudInfoAll.RegNo, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.AyCode, 
							  StudInfoAll.CloseFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender, StudInfoAll.EntryFrom, StudInfoAll.SeatNo
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode
		WHERE     (StudInfoAll.EntryFrom = 'A') AND (StudInfoAll.CloseFlag = 'N') OR
							  (StudInfoAll.EntryFrom = 'A') AND (StudInfoAll.TSuspendedFlag = 'Y')
		ORDER BY StudInfoAll.RegID DESC
	END

	Else If @RecordSelection='StudInfoAllStudentRegNoForTC'
	BEGIN
		SELECT     StudInfoAll.RegID, StudInfoAll.RegNo, CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName END AS StudentName, 
		MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.AyCode, StudInfoAll.CloseFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender, StudInfoAll.EntryFrom, StudInfoAll.SeatNo
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode
		WHERE     (StudInfoAll.EntryFrom = 'A') AND ((StudInfoAll.CloseFlag = 'N' Or StudInfoAll.TSuspendedFlag = 'Y'))
		ORDER BY StudInfoAll.RegNo
	END

	Else If @RecordSelection='StudInfoAllStudentMulti'
	BEGIN
		SELECT     StudInfoAll.RegID, StudInfoAll.RegNo, CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName END AS StudentName, 
		MainClassMaster.MainClassName AS MainClass, 
							  ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.AyCode, StudInfoAll.CloseFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode
		ORDER BY StudInfoAll.RegID DESC
	END

	Else If @RecordSelection='AdmissionDateYear'
	BEGIN
		SELECT DISTINCT 1 AS SelectionYearCode, CONVERT(varchar(10),YEAR(AdmittionDate)) + '-'+ CONVERT(varchar(10),(YEAR(AdmittionDate)+1)) AS SelectYear FROM StudInfoAll Order by CONVERT(varchar(10),YEAR(AdmittionDate)) + '-'+ CONVERT(varchar(10),(YEAR(AdmittionDate)+1)) Desc
	END
	
	Else If @RecordSelection='DocumentMaster'
	BEGIN
		SELECT DocumentCode, DocumentName, '-' as DocumentPath from DocumentMaster where DeleteFlag = 0 ORDER BY DocumentCode
	END

	Else If @RecordSelection='EmpDocumentMaster'
	BEGIN
		SELECT EmpDocumentCode, EmpDocumentName, '-' as EmpDocumentPath from EmpDocumentMaster where DeleteFlag = 0 ORDER BY EmpDocumentCode
	END

	Else If @RecordSelection='TCDocumentMaster'
	BEGIN
		SELECT TCDocumentCode, TCDocumentName, '-' as TCDocumentPath from TCDocumentMaster where DeleteFlag = 0 ORDER BY TCDocumentCode
	END

	Else If @RecordSelection='DesignationMaster'
	BEGIN
		SELECT DesignationCode, DesignationName from DesignationMaster where DeleteFlag = 0 ORDER BY DesignationCode
	END

	Else If @RecordSelection='ScholarshipMaster'
	BEGIN
		SELECT ScholarshipCode, ScholarshipName from ScholarshipMaster where DeleteFlag = 0 ORDER BY ScholarshipCode
	END

	Else If @RecordSelection='ReNewSoftwareTableDataDelete'
	BEGIN
		SELECT BlankTableCode, BlankTableName, DeleteType, Description FROM BlankTableMaster WHERE (DeleteType = N'A') ORDER BY BlankTableCode
	END

	Else If @RecordSelection='NewSoftwareTableDataDelete'
	BEGIN
		SELECT BlankTableCode, BlankTableName, DeleteType, Description FROM BlankTableMaster WHERE (DeleteType = N'A' OR DeleteType = N'N') ORDER BY BlankTableCode
	END

	Else If @RecordSelection='ScholarshipReportTitle'
	BEGIN
		SELECT TID, ReportName FROM ScholarshipEntry
	END

	Else If @RecordSelection='LockTypeMaster'
	BEGIN
		SELECT LockTypeCode, LockTypeName from LockTypeMaster where DeleteFlag = 0 ORDER BY LockTypeCode
	END

	Else If @RecordSelection='SubjectDEMaster'
	BEGIN
		SELECT     SubjectDEMaster.SubjectDECode, SubjectDEMaster.SrNo, SubjectDEMaster.SubjectDEName, SubjectMaster.SubjectName,  
							  ClassMaster.ClassName
		FROM         SubjectDEMaster INNER JOIN
							  SubDEClassGroupDetail ON SubjectDEMaster.SubDEClassGCode = SubDEClassGroupDetail.SubDEClassGCode INNER JOIN
							  ClassMaster ON SubDEClassGroupDetail.ClassCode = ClassMaster.ClassCode INNER JOIN
							  SubjectMaster ON SubjectDEMaster.SubjectCode = SubjectMaster.SubjectCode
		WHERE     (SubjectDEMaster.DeleteFlag = 0)
		ORDER BY SubjectDEMaster.SrNo		
	END

	Else If @RecordSelection='DEMaster'
	BEGIN
		SELECT     DEMaster.DECode, DEMaster.DEName, DETitleMaster.DETitleCode, DETitleMaster.DETitleName
		FROM         DEMaster INNER JOIN
							  DETitleMaster ON DEMaster.DETitleCode = DETitleMaster.DETitleCode
		WHERE     (DEMaster.DeleteFlag = 0)
		ORDER BY DEMaster.SrNo	
	END

	Else If @RecordSelection='CRMedicalPointMaster'
	BEGIN
		SELECT     CRMedicalPointCode, CRMedicalPointName FROM         CRMedicalPointMaster WHERE     (DeleteFlag = 0)
	END

	Else If @RecordSelection='CRPSTeacherMaster'
	BEGIN
		SELECT     CRPSTeacherCode, CRPSTeacherName FROM         CRPSTeacherMaster WHERE     (DeleteFlag = 0)
	END

	Else If @RecordSelection='GradeMaster'
	BEGIN
		SELECT     GradeCode, GradeName, PerFrom, PerTo, PerFromCal, PerToCal, GradeRemark, GradeTypeCode, SrNo, DeleteFlag FROM         GradeMaster WHERE     (DeleteFlag = 0) ORDER BY SrNo
	END

	Else If @RecordSelection='GradeMaster1To8'
	BEGIN
		SELECT GradeCode, GradeName FROM GradeMaster Where GradeTypeCode = 4 ORDER BY SrNo
	END

	Else If @RecordSelection='MainClassCountMaster'
	BEGIN
		SELECT     MainClassCountCode, MainClassCountName FROM         MainClassCountMaster WHERE     (DeleteFlag = 0) ORDER BY SrNo
	END

	Else If @RecordSelection='SPAClassTypeMaster'
	BEGIN
		SELECT     SPAClassTypeCode, SPAClassTypeName, DeleteFlag FROM         SPAClassTypeMaster WHERE     (DeleteFlag = 0) ORDER BY SPAClassTypeCode
	END

	Else If @RecordSelection='SPAItemMaster'
	BEGIN
		SELECT     SPAItemMaster.SPAItemCode, SPAItemMaster.SPAItemName, SPAItemMaster.UnitCode, UnitMaster.UnitName FROM         SPAItemMaster INNER JOIN UnitMaster ON SPAItemMaster.UnitCode = UnitMaster.UnitCode WHERE     (SPAItemMaster.DeleteFlag = 0) ORDER BY SPAItemMaster.SPAItemCode
	END

	Else If @RecordSelection='SPAMainMenuMaster'
	BEGIN
		SELECT     SPAMainMenuTID, SPAMainMenuName, SPAMainMenuCode, SPAClassTypeCode, SPAMenuTypeCode, SPADayCode FROM         SPAMainMenuMaster WHERE     (DeleteFlag = 0) ORDER BY SPAMainMenuTID
	END

	Else If @RecordSelection='SPAMenuTypeMaster'
	BEGIN
		SELECT     SPAMenuTypeCode, SPAMenuTypeName, DeleteFlag FROM         SPAMenuTypeMaster WHERE     (DeleteFlag = 0) ORDER BY SPAMenuTypeCode
	END

	Else If @RecordSelection='SPAItemQtyDefine'
	BEGIN
		SELECT     SPAItemQtyDefine.SPAItemTID, SPAItemMaster.SPAItemName, SPAItemQtyDefine.SPAClassTypeCode, SPAItemQtyDefine.SPAMenuTypeCode FROM         SPAItemQtyDefine INNER JOIN SPAItemMaster ON SPAItemQtyDefine.SPAItemCode = SPAItemMaster.SPAItemCode WHERE     (SPAItemQtyDefine.DeleteFlag = 0) ORDER BY SPAItemQtyDefine.SrNo
	END


	Else If @RecordSelection='SPADayMasterItemQtyDefine'
	BEGIN
		SELECT     SPADayCode, SPADayName, CONVERT(DECIMAL(18,3), 0) AS Qty FROM         SPADayMaster WHERE     (DeleteFlag = 0)
	END


	Else If @RecordSelection='LibAuthorMaster'
	BEGIN
		SELECT     LibAuthorCode, LibAuthorName, DeleteFlag FROM         LibAuthorMaster WHERE     (DeleteFlag = 0) ORDER BY LibAuthorCode
	END

	Else If @RecordSelection='LibEditionMaster'
	BEGIN
		SELECT     LibEditionCode, LibEditionName, DeleteFlag FROM         LibEditionMaster WHERE     (DeleteFlag = 0) ORDER BY LibEditionCode
	END

	Else If @RecordSelection='LibPublisherMaster'
	BEGIN
		SELECT     LibPublisherCode, LibPublisherName, DeleteFlag FROM         LibPublisherMaster WHERE     (DeleteFlag = 0) ORDER BY LibPublisherCode
	END

	Else If @RecordSelection='LibPublicationMaster'
	BEGIN
		SELECT     LibPublicationCode, LibPublicationName, DeleteFlag FROM LibPublicationMaster WHERE     (DeleteFlag = 0) ORDER BY LibPublicationCode
	END

	Else If @RecordSelection='LibSupplierMaster'
	BEGIN
		SELECT     LibSupplierCode, LibSupplierName, DeleteFlag FROM         LibSupplierMaster WHERE     (DeleteFlag = 0) ORDER BY LibSupplierCode
	END

	Else If @RecordSelection='LibBookLanguageMaster'
	BEGIN
		SELECT     LibBookLanguageCode, LibBookLanguageName, DeleteFlag FROM         LibBookLanguageMaster WHERE     (DeleteFlag = 0) ORDER BY LibBookLanguageCode
	END

	Else If @RecordSelection='LibBookStatusMaster'
	BEGIN
		SELECT     LibBookStatusCode, LibBookStatusName, DeleteFlag FROM         LibBookStatusMaster WHERE     (DeleteFlag = 0) ORDER BY LibBookStatusCode
	END

	Else If @RecordSelection='LibBookSubjectMaster'
	BEGIN
		SELECT     LibBookSubjectCode, LibBookSubjectName, DeleteFlag FROM         LibBookSubjectMaster WHERE     (DeleteFlag = 0) ORDER BY LibBookSubjectCode
	END

	Else If @RecordSelection='LibBookLocationMaster'
	BEGIN
		SELECT     LibBookLocationCode, LibBookLocationName, DeleteFlag FROM         LibBookLocationMaster WHERE     (DeleteFlag = 0) ORDER BY LibBookLocationCode
	END

	Else If @RecordSelection='UnitMaster'
	BEGIN
		SELECT     UnitCode, UnitName, DeleteFlag FROM         UnitMaster WHERE     (DeleteFlag = 0) ORDER BY UnitCode
	END
     Else If @RecordSelection='LibBookNameFill'
	BEGIN
				 SELECT     LibBookMaster.BookTID, LibBookTitleMaster.LibBookTitleName AS BookTitle, LibBookMaster.AccessionNo, LibBookMaster.DeleteFlag
		FROM         LibBookMaster INNER JOIN
							  LibBookTitleMaster ON LibBookMaster.BookTitleCode = LibBookTitleMaster.LibBookTitleCode
		WHERE     (LibBookMaster.DeleteFlag = 0)
		ORDER BY BookTitle
	END	
	Else If @RecordSelection='LibAccesstionNo'
	BEGIN
				  SELECT     LibBookMaster.BookTID, LibBookMaster.AccessionNo, LibBookTitleMaster.LibBookTitleName AS BookTitle, LibBookMaster.DeleteFlag
		FROM         LibBookMaster INNER JOIN
							  LibBookTitleMaster ON LibBookMaster.BookTitleCode = LibBookTitleMaster.LibBookTitleCode
		WHERE     (LibBookMaster.DeleteFlag = 0)
		ORDER BY LibBookMaster.AccessionNo
	END			

   Else If @RecordSelection='ItemGroupMaster'
	BEGIN
		SELECT     ItemGroupCode, ItemGroupName, DeleteFlag FROM dbo.ItemGroupMaster WHERE (DeleteFlag = 0) ORDER BY ItemGroupCode 
   END

   Else If @RecordSelection='ItemMaster'
   BEGIN
        SELECT    dbo.ItemMaster.ItemCode, dbo.ItemMaster.ItemName,dbo.ItemMaster.SrNo,  dbo.ItemMaster.ItemGroupCode, dbo.ItemGroupMaster.ItemGroupName, dbo.ItemMaster.Rate,dbo.ItemMaster.DeleteFlag FROM  dbo.ItemMaster INNER JOIN dbo.ItemGroupMaster ON dbo.ItemMaster.ItemGroupCode = dbo.ItemGroupMaster.ItemGroupCode WHERE(dbo.ItemMaster.DeleteFlag = 0)  
   END

   Else If @RecordSelection='BranchMaster'
   BEGIN
        SELECT DISTINCT -1 as BranchCode, Branch FROM  StudInfoAll
   END

	Else If @RecordSelection='MainClassMasterSetting'
	BEGIN
		SELECT MainClassCode, MainClassName as MainClass, DefaultDisplay as DD  from MainClassMaster where DeleteFlag = 0 ORDER BY MainClassCode
	END

	Else If @RecordSelection='MainClassSubMasterSetting'
	BEGIN
		SELECT Distinct MainClassSubMaster.MainClassSubCode, MainClassSubMaster.MainClassSubName FROM MainClassSubMaster INNER JOIN ClassMaster ON MainClassSubMaster.MainClassSubCode = ClassMaster.MainClassSubCode WHERE     (ClassMaster.MainClassSubCode <> 3) ORDER BY MainClassSubMaster.MainClassSubCode
	END

	Else If @RecordSelection='MediumMasterSetting'
	BEGIN
		SELECT MediumCode, MediumName as Medium , DefaultDisplay as DD , DeleteFlag from MediumMaster ORDER BY MediumCode
	END

	Else If @RecordSelection='ClassMasterSetting'
	BEGIN
		SELECT ClassCode, ClassName as Class ,ClassNameEN as ClassEN,ClassNameInWord as Inword, MainClassCode, DeleteFlag from ClassMaster ORDER BY ClassCode
	END

	Else If @RecordSelection='DivisionMasterSetting'
	BEGIN
		SELECT DivisionCode, DivisionName as Div, DeleteFlag from DivisionMaster ORDER BY DivisionCode
	END
	
END
GO
/****** Object:  StoredProcedure [dbo].[SP_FillList1]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- CREATE Used To CREATE A NEW Procedure
-- ALTER Used To Modify Procedure

CREATE PROCEDURE [dbo].[SP_FillList1]
	@RecordSelection nvarchar(100)=0, @WhereCondition nvarchar(120)=Null, @WhereCondition1 nvarchar(120)=Null, @WhereCondition2 nvarchar(120)=Null, @AyCode bigint=null, @FyCode bigint=null, @MainClassCode bigint=null
AS

BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	If @RecordSelection='CBSCDEGroupMaster'
	BEGIN
		SELECT     CBSCDEGroupCode, CBSCDEGroupName FROM         CBSCDEGroupMaster WHERE     (DeleteFlag = 0) ORDER BY SrNo
	END

	else If @RecordSelection='CBSCDETitleGroupMaster'
	BEGIN
		SELECT     CBSCDETitleGroupCode, CBSCDETitleGroupName FROM         CBSCDETitleGroupMaster WHERE     (DeleteFlag = 0) ORDER BY SrNo
	END

	else If @RecordSelection='CBSCDETitleAndGroupMaster'
	BEGIN
				SELECT     CBSCDETitleMaster.CBSCDETitleCode, CBSCDETitleMaster.CBSCDETitleName + ' - ' + CBSCDETitleGroupMaster.CBSCDETitleGroupName AS CBSCDETitleName
		FROM         CBSCDETitleMaster INNER JOIN
							  CBSCDETitleGroupMaster ON CBSCDETitleMaster.CBSCDETitleGroupCode = CBSCDETitleGroupMaster.CBSCDETitleGroupCode
		WHERE     (CBSCDETitleMaster.DeleteFlag = 0)
		ORDER BY CBSCDETitleGroupMaster.SrNo, CBSCDETitleMaster.SrNo
	END
	
	Else If @RecordSelection='GradeMaster1To8Grade'
	BEGIN
		SELECT GradeCode, GradeName FROM GradeMaster Where (DeleteFlag = 0) And GradeTypeCode = 3 ORDER BY SrNo
	END

	else If @RecordSelection='CBSCDETitleGroupMaster'
	BEGIN
		SELECT     CBSCDETitleGroupCode, CBSCDETitleGroupName FROM         CBSCDETitleGroupMaster WHERE     (DeleteFlag = 0) ORDER BY SrNo
	END
	
	else If @RecordSelection='CBSCDETitleMaster'
	BEGIN
		SELECT     CBSCDETitleMaster.CBSCDETitleCode, CBSCDETitleMaster.SrNo, CBSCDETitleMaster.CBSCDETitleName, CBSCDETitleMaster.CBSCDETitleGroupCode,  CBSCDETitleGroupMaster.CBSCDETitleGroupName FROM         CBSCDETitleMaster INNER JOIN CBSCDETitleGroupMaster ON CBSCDETitleMaster.CBSCDETitleGroupCode = CBSCDETitleGroupMaster.CBSCDETitleGroupCode WHERE     (CBSCDETitleMaster.DeleteFlag = 0) ORDER BY CBSCDETitleMaster.SrNo
	END

	else If @RecordSelection='CBSCDEMaster'
	BEGIN
		SELECT     CBSCDEMaster.CBSCDECode, CBSCDEMaster.SrNo, GradeMaster.GradeName, CBSCDEMaster.CBSCDEName, CBSCDETitleMaster.CBSCDETitleName, CBSCDEMaster.GradeCode,  CBSCDEMaster.CBSCDETitleCode FROM         CBSCDEMaster INNER JOIN GradeMaster ON CBSCDEMaster.GradeCode = GradeMaster.GradeCode INNER JOIN CBSCDETitleMaster ON CBSCDEMaster.CBSCDETitleCode = CBSCDETitleMaster.CBSCDETitleCode WHERE     (CBSCDEMaster.DeleteFlag = 0) ORDER BY CBSCDEMaster.SrNo
	END

	Else If @RecordSelection='LibBookTitleGroupMaster'
	BEGIN
		SELECT     LibBookTitleGroupCode, LibBookTitleGroupName, DeleteFlag FROM         LibBookTitleGroupMaster WHERE     (DeleteFlag = 0) ORDER BY LibBookTitleGroupCode
	END

	Else If @RecordSelection='LibBookTitleMaster'
	BEGIN
		SELECT     LibBookTitleCode, LibBookTitleName, DeleteFlag FROM         LibBookTitleMaster WHERE     (DeleteFlag = 0) ORDER BY LibBookTitleCode
	END
	
	Else If @RecordSelection='LibBookStatusForConsumeMaster'
	BEGIN
		SELECT     LibBookStatusCode, LibBookStatusName, DeleteFlag FROM         LibBookStatusMaster WHERE     (DeleteFlag = 0) And LibBookStatusCode<>1 ORDER BY LibBookStatusCode
	END

	Else If @RecordSelection='StudentName'
	BEGIN
		SELECT  Distinct   1 as MaxCode , Firstname FROM StudInfoAll UNION All SELECT  1 as MaxCode , MiddleName FROM StudInfoAll 
	END
	
	Else If @RecordSelection='StudentSurname'
	BEGIN
		SELECT  Distinct   1 as MaxCode , LastName FROM StudInfoAll 
	END
	
	Else If @RecordSelection='StudentMotherName'
	BEGIN
		SELECT  Distinct   1 as MaxCode , MotherName FROM StudInfoAll 
	END

	Else If @RecordSelection='StudentNameE'
	BEGIN
		SELECT  Distinct   1 as MaxCode , FirstnameE FROM StudInfoAll UNION All SELECT  1 as MaxCode , MiddleNameE FROM StudInfoAll 
	END
	
	Else If @RecordSelection='StudentSurnameE'
	BEGIN
		SELECT  Distinct   1 as MaxCode , LastNameE FROM StudInfoAll 
	END
	
	Else If @RecordSelection='StudentMotherNameE'
	BEGIN
		SELECT  Distinct   1 as MaxCode , MotherNameE FROM StudInfoAll 
	END

	Else If @RecordSelection='FeesDefineImport'
	BEGIN
		SELECT DISTINCT MediumMaster.MediumName, ClassMaster.ClassName, FeeTypeMaster.FeeTypeName, FeeInstallementMaster.FeeInstallementName, FeesDefine.AyCode, AyMaster.AyName
		FROM         FeesDefine INNER JOIN
							  ClassMaster ON FeesDefine.ClassCode = ClassMaster.ClassCode INNER JOIN
							  FeeTypeMaster ON FeesDefine.FeeTypeCode = FeeTypeMaster.FeeTypeCode INNER JOIN
							  MediumMaster ON FeesDefine.MediumCode = MediumMaster.MediumCode INNER JOIN
							  FeeInstallementMaster ON FeesDefine.FeeInstallementCode = FeeInstallementMaster.FeeInstallementCode INNER JOIN
							  AyMaster ON FeesDefine.AyCode = AyMaster.AyCode
		ORDER BY ClassMaster.ClassName
	END

	Else If @RecordSelection='MotherTongueMasterSetting'
	BEGIN
		SELECT LanguageCode, LanguageName as MotherTongue , DeleteFlag from LanguageMaster ORDER BY LanguageCode
	END

	Else If @RecordSelection='Covid19DoseMaster'
	BEGIN
		SELECT     Covid19DoseCode, Covid19DoseName, DeleteFlag FROM         Covid19DoseMaster WHERE     (DeleteFlag = 0) ORDER BY Covid19DoseCode
	END

	Else If @RecordSelection='SubjectGroupMaster'
	BEGIN
		SELECT     SubjectGroupCode, SubjectGroupName, DeleteFlag FROM         SubjectGroupMaster WHERE     (DeleteFlag = 0) ORDER BY SubjectGroupCode
	END

	Else If @RecordSelection='SubDEClassGroupDisplay'
	BEGIN
		SELECT DISTINCT SubDEClassGroupMaster.SubDEClassGCode, SubDEClassGroupMaster.SubDEClassGName, SubjectMaster.SubjectName, SubjectMaster.SubjectCode FROM         SubjectDEMaster INNER JOIN SubDEClassGroupMaster ON SubjectDEMaster.SubDEClassGCode = SubDEClassGroupMaster.SubDEClassGCode INNER JOIN SubjectMaster ON SubjectDEMaster.SubjectCode = SubjectMaster.SubjectCode ORDER BY SubDEClassGroupMaster.SubDEClassGCode, SubjectMaster.SubjectCode
	END

	Else If @RecordSelection='FeeTitleOtherMaster'
	BEGIN
		SELECT     FeeTitleOtherCode, FeeTitleOtherName FROM         FeeTitleOtherMaster WHERE     (DeleteFlag = 0) ORDER BY SrNo
	END

	Else If @RecordSelection='FeeTitleOtherGroupMaster'
	BEGIN
		SELECT     FeeTitleOtherGroupCode, FeeTitleOtherGroupName FROM         FeeTitleOtherGroupMaster WHERE     (DeleteFlag = 0) ORDER BY SrNo
	END

	Else If @RecordSelection='FeesDefineOtherImport'
	BEGIN
		SELECT DISTINCT ClassMaster.ClassName, FeeTitleOtherGroupMaster.FeeTitleOtherGroupName, FeesDefineOther.AyCode, AyMaster.AyName
		FROM         FeesDefineOther INNER JOIN
							  ClassMaster ON FeesDefineOther.ClassCode = ClassMaster.ClassCode INNER JOIN
							  FeeTitleOtherGroupMaster ON FeesDefineOther.FeeTitleOtherGroupCode = FeeTitleOtherGroupMaster.FeeTitleOtherGroupCode INNER JOIN
							  AyMaster ON FeesDefineOther.AyCode = AyMaster.AyCode
		ORDER BY ClassMaster.ClassName	
	END
	
	Else If @RecordSelection='SubjectGroupSubjectMaster'
	BEGIN
		SELECT     SubjectMaster.SubjectCode, SubjectMaster.SubjectName, SubjectGroupDetail.SubjectGroupCode, SubjectGroupMaster.SubjectGroupName, SubjectGroupDetail.CompulsoryFlag, 
							  ClassMaster.ClassName
		FROM         SubjectGroupClassDetail INNER JOIN
							  ClassMaster ON SubjectGroupClassDetail.ClassCode = ClassMaster.ClassCode INNER JOIN
							  SubjectMaster INNER JOIN
							  SubjectGroupDetail ON SubjectMaster.SubjectCode = SubjectGroupDetail.SubjectCode INNER JOIN
							  SubjectGroupMaster ON SubjectGroupDetail.SubjectGroupCode = SubjectGroupMaster.SubjectGroupCode ON 
							  SubjectGroupClassDetail.SubjectGroupCode = SubjectGroupMaster.SubjectGroupCode
		WHERE     (SubjectMaster.DeleteFlag = 0)
		ORDER BY SubjectMaster.SubjectCode
	END

	Else If @RecordSelection='SubjectMasterSubjectGroup'
	BEGIN
		SELECT SubjectCode, SubjectName, 'N' as CompulsoryFlag  from SubjectMaster where DeleteFlag = 0 ORDER BY SubjectCode
	END

	Else If @RecordSelection='ReportTypeMaster'
	BEGIN
	    SELECT     ReportTypeCode, ReportTypeName FROM         ReportTypeMaster WHERE     (DisplaySetting = 'A' Or DisplaySetting = @WhereCondition2) ORDER BY SrNo
	END

	Else If @RecordSelection='ReportTypeMasterEN'
	BEGIN
	    SELECT     ReportTypeCode, ReportTypeNameEN FROM         ReportTypeMaster WHERE     (DisplaySetting = 'A' Or DisplaySetting = @WhereCondition2) ORDER BY SrNo
	END
	
	Else If @RecordSelection='FeeCategoryMaster'
	BEGIN
		SELECT     FeeCategoryCode, FeeCategoryName FROM         FeeCategoryMaster WHERE     (DeleteFlag = 0) ORDER BY FeeCategoryCode
	END

	Else If @RecordSelection='CBSCDEMasterImport'
	BEGIN
		SELECT DISTINCT 
							  CBSCDETitleGroupMaster.CBSCDETitleGroupCode, CBSCDETitleGroupMaster.CBSCDETitleGroupName, CBSCDETitleMaster.CBSCDETitleName, CBSCDETitleMaster.CBSCDETitleCode
		FROM         CBSCDETitleMaster INNER JOIN
							  CBSCDETitleGroupMaster ON CBSCDETitleMaster.CBSCDETitleGroupCode = CBSCDETitleGroupMaster.CBSCDETitleGroupCode
	END

	Else If @RecordSelection='MainClassGroupMaster'
	BEGIN
		SELECT     MainClassGroupCode, MainClassGroupName FROM         MainClassGroupMaster WHERE     (DeleteFlag = 0) ORDER BY MainClassGroupCode
	END

	Else If @RecordSelection='PurposeList'
	BEGIN
		SELECT DISTINCT 1 as PurposeID, Purpose FROM         VisitorRegister
	END

	Else If @RecordSelection='FeesReportTypeMasterTemp'
	BEGIN
		SELECT * From  FeesReportTypeMasterTemp
	END
	
	Else If @RecordSelection='PayBillReportName'
	BEGIN
		SELECT     EmpMonthlySalary.TID, EmpMonthlySalary.ReportName FROM         EmpMonthlySalary  Where EmpMonthlySalary.MainClassCode = @WhereCondition  And EmpMonthlySalary.FyCode = @WhereCondition1 ORDER BY EmpMonthlySalary.TMDate DESC
	END

	Else If @RecordSelection='FeeTypeConcessionMaster'
	BEGIN
		SELECT FeeTypeConcessionCode, FeeTypeConcessionName from FeeTypeConcessionMaster where DeleteFlag = 0 ORDER BY FeeTypeConcessionCode
	END

	Else If @RecordSelection='AyMaster'
	BEGIN
		SELECT AyCode,  AyName, DeleteFlag FROM AyMaster ORDER BY AyCode Desc
	END

	Else If @RecordSelection='AyMasterOpening'
	BEGIN
		SELECT     AyCode, AyName, DeleteFlag FROM         AyMaster WHERE     (FeesOutstandingMaintainFlag = N'O')
	END

	Else If @RecordSelection='FyMaster'
	BEGIN
		SELECT FyCode,  FyName, DeleteFlag FROM FyMaster ORDER BY FyCode Desc
	END

	Else If @RecordSelection='PageSizeMaster'
	BEGIN
		SELECT     PageSizeCode, PageSizeName FROM         PageSizeMaster WHERE     (DeleteFlag = 0) ORDER BY PageSizeCode
	END
	Else If @RecordSelection='StudInfoYearlyStudentName'
	BEGIN
		SELECT     StudInfoYearly.RegID, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
							   END AS StudentName, StudInfoAll.RegNo, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoYearly.AyCode, 
							  StudInfoAll.CloseFlag, StudInfoAll.MarksFeedFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender, CategoryMaster.CategoryName, CategoryMaster.CategoryNameEN, 
							  StudInfoAll.StudDisplayFlag, StudInfoAll.FatherName, StudInfoAll.LocalAddress, FeeTypeMaster.FeeTypeName, StudInfoAll.StudentID, AyMaster.AyName
		FROM         StudInfoAll INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode INNER JOIN
							  CategoryMaster ON StudInfoAll.CategoryCode = CategoryMaster.CategoryCode INNER JOIN
							  StudInfoYearly ON StudInfoAll.RegID = StudInfoYearly.RegID INNER JOIN
							  FeeTypeMaster ON StudInfoYearly.FeeTypeCode = FeeTypeMaster.FeeTypeCode INNER JOIN
							  MainClassMaster ON StudInfoYearly.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoYearly.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfoYearly.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  AyMaster ON StudInfoYearly.AyCode = AyMaster.AyCode
		ORDER BY StudInfoYearly.RegID DESC
	END

	Else If @RecordSelection='StudInfoYearlyStudentRegNo'
	BEGIN
		SELECT     StudInfoYearly.RegID, StudInfoAll.RegNo, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
							   END AS StudentName, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoYearly.AyCode, 
							  StudInfoAll.CloseFlag, StudInfoAll.MarksFeedFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender, CategoryMaster.CategoryName, CategoryMaster.CategoryNameEN, 
							  StudInfoAll.StudDisplayFlag, StudInfoAll.FatherName, StudInfoAll.LocalAddress, FeeTypeMaster.FeeTypeName, StudInfoAll.StudentID, AyMaster.AyName
		FROM         StudInfoAll INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode INNER JOIN
							  CategoryMaster ON StudInfoAll.CategoryCode = CategoryMaster.CategoryCode INNER JOIN
							  StudInfoYearly ON StudInfoAll.RegID = StudInfoYearly.RegID INNER JOIN
							  FeeTypeMaster ON StudInfoYearly.FeeTypeCode = FeeTypeMaster.FeeTypeCode INNER JOIN
							  MainClassMaster ON StudInfoYearly.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoYearly.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfoYearly.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  AyMaster ON StudInfoYearly.AyCode = AyMaster.AyCode
		ORDER BY StudInfoAll.RegNo
	END

	Else If @RecordSelection='FeeTitleOtherMainGroupMaster'
	BEGIN
		SELECT     FeeTitleOtherMainGroupCode, FeeTitleOtherMainGroupName, SrNo, DeleteFlag FROM         FeeTitleOtherMainGroupMaster WHERE     (DeleteFlag = 0) ORDER BY SrNo
	END
	
	Else If @RecordSelection='FeeTitleShortMaster'
	BEGIN
		SELECT     FeeTitleShortCode, FeeTitleShortName, DeleteFlag FROM         FeeTitleShortMaster WHERE     (DeleteFlag = 0) ORDER BY SrNo
	END	

	Else If @RecordSelection='MainClassMasterWithDelete'
	BEGIN
		SELECT MainClassCode, MainClassName from MainClassMaster ORDER BY MainClassCode
	END

	Else If @RecordSelection='PayBillReportNameSansthaSoftware'
	BEGIN
		SELECT        EmpMonthlySalary.TID, EmpMonthlySalary.ReportName, FyMaster.FyName FROM            EmpMonthlySalary INNER JOIN FyMaster ON EmpMonthlySalary.FyCode = FyMaster.FyCode  Where EmpMonthlySalary.MainClassCode = @WhereCondition  And FyMaster.FyName = @WhereCondition1 ORDER BY EmpMonthlySalary.TMDate DESC
	END
	
	Else If @RecordSelection='SPADayMaster'
	BEGIN
		SELECT     SPADayCode, SPADayName FROM         SPADayMaster WHERE     (DeleteFlag = 0) ORDER BY SPADayCode
	END	

	else If @RecordSelection='ACPaymentTypeMaster'
	BEGIN
		SELECT     PaymentTypeCode, PaymentTypeName, DeleteFlag FROM         ACPaymentTypeMaster WHERE     (DeleteFlag = 'N') ORDER BY PaymentTypeCode
	END

	else If @RecordSelection='ACPartyMaster'
	BEGIN
		SELECT     ACPartyMaster.PartyCode, ACPartyMaster.PartyName, ACPartyMaster.DeleteFlag, ACPartyMaster.PanNo
		FROM         ACPartyMaster 		WHERE     (ACPartyMaster.DeleteFlag = 'N')		ORDER BY ACPartyMaster.PartyCode
	END

	else If @RecordSelection='ACLedgerHeadDefineMaster'
	BEGIN
		SELECT        ACLedgerHeadMaster.LedgerHeadCode, ACLedgerHeadMaster.LedgerHead, ACLedgerHeadMaster.DeleteFlag, ACLedgerHeadMaster.SrNo, ACLedgerHeadMaster.LedgerTypeCode, ACLedgerTypeMaster.BankFlag, 
								 ACLedgerTypeMaster.ReceiptFlag, ACLedgerTypeMaster.PaymentFlag
		FROM            ACLedgerHeadMaster INNER JOIN
								 ACLedgerTypeMaster ON ACLedgerHeadMaster.LedgerTypeCode = ACLedgerTypeMaster.LedgerTypeCode
		WHERE        (ACLedgerHeadMaster.DeleteFlag = 'N')
		ORDER BY ACLedgerHeadMaster.SrNo
	END		

	else If @RecordSelection='ACLedgerHeadDefineMaster'
	BEGIN
		SELECT        ACLedgerHeadMaster.LedgerHeadCode, ACLedgerHeadMaster.LedgerHead, ACLedgerHeadMaster.DeleteFlag, ACLedgerHeadMaster.SrNo, ACLedgerHeadMaster.LedgerTypeCode, ACLedgerTypeMaster.BankFlag, 
								 ACLedgerTypeMaster.ReceiptFlag, ACLedgerTypeMaster.PaymentFlag
		FROM            ACLedgerHeadMaster INNER JOIN
								 ACLedgerTypeMaster ON ACLedgerHeadMaster.LedgerTypeCode = ACLedgerTypeMaster.LedgerTypeCode
		WHERE        (ACLedgerHeadMaster.DeleteFlag = 'N')
		ORDER BY ACLedgerHeadMaster.SrNo
	END

	else If @RecordSelection='ACLedgerHeadMaster'
	BEGIN
				SELECT        LedgerHeadCode, LedgerHead, DeleteFlag, SrNo, LedgerTypeCode
		FROM            ACLedgerHeadMaster
		WHERE        (DeleteFlag = 'N')
		ORDER BY SrNo
	END
	else If @RecordSelection='ACLedgerTypeMaster'
	BEGIN
		SELECT     LedgerTypeCode, LedgerType, DeleteFlag FROM         ACLedgerTypeMaster WHERE     (DeleteFlag = 'N') ORDER BY LedgerTypeCode
	END

	else If @RecordSelection='ACAccountRegisterMaster'
	BEGIN
		SELECT     AccountRegisterCode, AccountRegister, DeleteFlag FROM         ACAccountRegisterMaster WHERE     (DeleteFlag = 'N') ORDER BY AccountRegisterCode
	END	

	else If @RecordSelection='ACLedgerHeadNarrationMaster'
	BEGIN
		SELECT     ACLedgerHeadNarrationMaster.LedgerHeadNarrationCode, ACLedgerHeadNarrationMaster.LedgerHeadNarration, ACLedgerHeadNarrationMaster.DeleteFlag FROM         ACLedgerHeadNarrationMaster INNER JOIN ACLedgerHeadMaster ON ACLedgerHeadNarrationMaster.LedgerHeadCode = ACLedgerHeadMaster.LedgerHeadCode WHERE     (ACLedgerHeadNarrationMaster.DeleteFlag = 'N') AND (ACLedgerHeadMaster.LedgerHead = @WhereCondition)
	END	

END
GO
/****** Object:  StoredProcedure [dbo].[SP_FillListStudent]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- CREATE Used To CREATE A NEW Procedure
-- ALTER Used To Modify Procedure

CREATE PROCEDURE [dbo].[SP_FillListStudent]
	@RecordSelection nvarchar(100)=0, @WhereCondition nvarchar(120)=Null, @WhereCondition1 nvarchar(120)=Null, @WhereCondition2 nvarchar(120)=Null, @AyCode bigint=null, @FyCode bigint=null, @MainClassCode bigint=null
AS

BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	If @RecordSelection='StudInfoAllStudentName'
	BEGIN
				SELECT     StudInfoAll.RegID, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
							   END AS StudentName, StudInfoAll.RegNo, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.AyCode, 
							  StudInfoAll.CloseFlag, StudInfoAll.MarksFeedFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender, StudInfoAll.StudDisplayFlag
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode
		WHERE     (StudInfoAll.EntryFrom = 'A')
		ORDER BY StudInfoAll.RegID DESC
	END

	Else If @RecordSelection='StudInfoAllStudentRegNo'
	BEGIN
		SELECT     StudInfoAll.RegID, StudInfoAll.RegNo, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
							   END AS StudentName, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.AyCode, StudInfoAll.CloseFlag, 
							  StudInfoAll.MarksFeedFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender, StudInfoAll.StudDisplayFlag
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode
		WHERE     (StudInfoAll.EntryFrom = 'A')
		ORDER BY StudInfoAll.RegNo
	END

	Else If @RecordSelection='StudInfoAllStudentNameInfo'
	BEGIN
		SELECT     StudInfoAll.RegID, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
							   END AS StudentName, StudInfoAll.RegNo, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.AyCode, 
							  StudInfoAll.CloseFlag, StudInfoAll.MarksFeedFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender, CategoryMaster.CategoryName, CategoryMaster.CategoryNameEN, 
							  StudInfoAll.StudDisplayFlag, StudInfoAll.FatherName, StudInfoAll.LocalAddress, FeeTypeMaster.FeeTypeName, StudInfoAll.StudentID
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode INNER JOIN
							  CategoryMaster ON StudInfoAll.CategoryCode = CategoryMaster.CategoryCode INNER JOIN
							  FeeTypeMaster ON StudInfoAll.FeeTypeCode = FeeTypeMaster.FeeTypeCode
		WHERE     (StudInfoAll.EntryFrom = 'A')
		ORDER BY StudInfoAll.RegID DESC
	END

	Else If @RecordSelection='StudInfoAllStudentRegNoInfo'
	BEGIN
		SELECT     StudInfoAll.RegID, StudInfoAll.RegNo, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
							   END AS StudentName, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.AyCode, StudInfoAll.CloseFlag, 
							  StudInfoAll.MarksFeedFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender, CategoryMaster.CategoryName, CategoryMaster.CategoryNameEN, StudInfoAll.StudDisplayFlag, 
							  StudInfoAll.FatherName, StudInfoAll.LocalAddress, FeeTypeMaster.FeeTypeName, StudInfoAll.StudentID
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode INNER JOIN
							  CategoryMaster ON StudInfoAll.CategoryCode = CategoryMaster.CategoryCode INNER JOIN
							  FeeTypeMaster ON StudInfoAll.FeeTypeCode = FeeTypeMaster.FeeTypeCode
		WHERE     (StudInfoAll.EntryFrom = 'A')
		ORDER BY StudInfoAll.RegNo
	END

	Else If @RecordSelection='StudInfoAllStudentNameForTC'
	BEGIN
		SELECT     StudInfoAll.RegID, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
							   END AS StudentName, StudInfoAll.RegNo, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.AyCode, 
							  StudInfoAll.CloseFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender, StudInfoAll.EntryFrom, StudInfoAll.SeatNo
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode
		WHERE     (StudInfoAll.EntryFrom = 'A') AND (StudInfoAll.CloseFlag = 'N') OR
							  (StudInfoAll.EntryFrom = 'A') AND (StudInfoAll.TSuspendedFlag = 'Y')
		ORDER BY StudInfoAll.RegID DESC
	END

	Else If @RecordSelection='StudInfoAllStudentRegNoForTC'
	BEGIN
		SELECT     StudInfoAll.RegID, StudInfoAll.RegNo, CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName END AS StudentName, 
		MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.AyCode, StudInfoAll.CloseFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender, StudInfoAll.EntryFrom, StudInfoAll.SeatNo
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode
		WHERE     (StudInfoAll.EntryFrom = 'A') AND ((StudInfoAll.CloseFlag = 'N' Or StudInfoAll.TSuspendedFlag = 'Y'))
		ORDER BY StudInfoAll.RegNo
	END

	Else If @RecordSelection='StudInfoAllStudentMulti'
	BEGIN
		SELECT     StudInfoAll.RegID, StudInfoAll.RegNo, CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName END AS StudentName, 
		MainClassMaster.MainClassName AS MainClass, 
							  ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.AyCode, StudInfoAll.CloseFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode
		ORDER BY StudInfoAll.RegID DESC
	END

		Else If @RecordSelection='StudInfoYearlyStudentName'
	BEGIN
		SELECT     StudInfoYearly.RegID, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
							   END AS StudentName, StudInfoAll.RegNo, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoYearly.AyCode, 
							  StudInfoAll.CloseFlag, StudInfoAll.MarksFeedFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender, StudInfoAll.StudDisplayFlag
		FROM         StudInfoAll INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode INNER JOIN
							  StudInfoYearly ON StudInfoAll.RegID = StudInfoYearly.RegID INNER JOIN
							  MainClassMaster ON StudInfoYearly.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoYearly.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfoYearly.DivisionCode = DivisionMaster.DivisionCode
		ORDER BY StudInfoYearly.RegID DESC
	END

	Else If @RecordSelection='StudInfoYearlyStudentRegNo'
	BEGIN
		SELECT     StudInfoYearly.RegID, StudInfoAll.RegNo, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
							   END AS StudentName, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoYearly.AyCode, StudInfoAll.CloseFlag, 
							  StudInfoAll.MarksFeedFlag, GenderMaster.GenderShort, GenderMaster.GenderName AS Gender, StudInfoAll.StudDisplayFlag, AyMaster.AyName
		FROM         StudInfoAll INNER JOIN
							  GenderMaster ON StudInfoAll.GenderCode = GenderMaster.GenderCode INNER JOIN
							  StudInfoYearly ON StudInfoAll.RegID = StudInfoYearly.RegID INNER JOIN
							  FeeTypeMaster ON StudInfoYearly.FeeTypeCode = FeeTypeMaster.FeeTypeCode INNER JOIN
							  MainClassMaster ON StudInfoYearly.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoYearly.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfoYearly.DivisionCode = DivisionMaster.DivisionCode INNER JOIN
							  AyMaster ON StudInfoYearly.AyCode = AyMaster.AyCode
		ORDER BY StudInfoAll.AyCode Desc, StudInfoAll.RegNo
	END


END
GO
/****** Object:  StoredProcedure [dbo].[SP_FillListWithCondition]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_FillListWithCondition]
    @TableName nvarchar(120)=Null, @WhereCondition nvarchar(120)=Null, @WhereCondition1 nvarchar(120)=Null, @WhereCondition2 nvarchar(120)=Null, @AyCode bigint=null, @FyCode bigint=null, @MainClassCode bigint=null
AS

BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	If @TableName='ClassMaster'
	BEGIN
		SELECT ClassMaster.ClassCode, ClassMaster.ClassName FROM ClassMaster INNER JOIN MainClassMaster ON ClassMaster.MainClassCode = MainClassMaster.MainClassCode Where ClassMaster.DeleteFlag = 0 And MainClassMaster.MainClassName = @WhereCondition ORDER BY ClassCode
	END
	
	Else If @TableName='ClassMasterRenew'
	BEGIN
		SELECT ClassMaster.ClassCode, ClassMaster.ClassName  FROM ClassMaster INNER JOIN MainClassMaster ON ClassMaster.MainClassCode = MainClassMaster.MainClassCode WHERE  (ClassMaster.ClassCode <> (SELECT Max(ClassMaster.ClassCode) as MaxClassCode FROM ClassMaster INNER JOIN MainClassMaster ON ClassMaster.MainClassCode = MainClassMaster.MainClassCode WHERE  (ClassMaster.DeleteFlag = 0) AND (MainClassMaster.MainClassName = @WhereCondition)))  And (ClassMaster.DeleteFlag = 0) AND (MainClassMaster.MainClassName = @WhereCondition) ORDER BY ClassMaster.ClassCode
	END
	
	Else If @TableName='ClassMasterFeeOpening'
	BEGIN
		SELECT ClassMaster.ClassCode, ClassMaster.ClassName FROM ClassMaster INNER JOIN MainClassMaster ON ClassMaster.MainClassCode = MainClassMaster.MainClassCode Where ClassMaster.DeleteFlag = 0 And ClassMaster.ClassCode = @WhereCondition ORDER BY ClassCode
	END

	Else If @TableName='MainClassMaster'
	BEGIN
		SELECT MainClassCode, MainClassName from MainClassMaster where DeleteFlag = 0 ORDER BY MainClassCode
	END
	
	Else If @TableName='MainClassSubMaster'
	BEGIN
		SELECT Distinct MainClassSubMaster.MainClassSubCode, MainClassSubMaster.MainClassSubName FROM   ClassMaster INNER JOIN MainClassSubMaster ON ClassMaster.MainClassSubCode = MainClassSubMaster.MainClassSubCode INNER JOIN MainClassMaster ON ClassMaster.MainClassCode = MainClassMaster.MainClassCode WHERE  ClassMaster.DeleteFlag = 0 And MainClassMaster.MainClassName = @WhereCondition  ORDER BY MainClassSubMaster.MainClassSubCode
	END

	Else If @TableName='ClassMainClassMaster'
	BEGIN
		SELECT     MainClassMaster.MainClassCode, MainClassMaster.MainClassName FROM ClassMaster INNER JOIN MainClassMaster ON ClassMaster.MainClassCode = MainClassMaster.MainClassCode WHERE (ClassMaster.ClassName = @WhereCondition)
	END

	Else If @TableName='GetClassMainClassMaster'
	BEGIN
				SELECT     ClassMaster.ClassName, MainClassMaster.MainClassName, ClassMaster.ClassCode, MainClassMaster.MainClassCode
		FROM         ClassMaster INNER JOIN
							  MainClassMaster ON ClassMaster.MainClassCode = MainClassMaster.MainClassCode WHERE (ClassMaster.ClassCode = @WhereCondition)
	END

	Else If @TableName='GenderMasterShort'
	BEGIN
		SELECT     GenderCode, GenderName FROM         GenderMaster WHERE     (GenderShort = @WhereCondition) AND (GenderType = N'BG')
	END

	Else If @TableName='DivisionMaster'
	BEGIN
		SELECT DivisionCode, DivisionName from DivisionMaster where DeleteFlag = 0 ORDER BY DivisionCode
	END
	
	Else If  @TableName='TCIssue'
	BEGIN
		SELECT TCPrintAll.TCNo, TCPrintAll.TCDate , TCPrintAll.TCStatus, TCPrintAll.TCBehavior, ClassMaster.ClassName AS SchoolLeaveClass, TCPrintAll.SLeaveReason, TCPrintAll.TCRemark, TCPrintAll.DuplicateTCPrintFlag, TCPrintAll.ReportDateOTC, TCPrintAll.ReportDate FROM TCPrintAll INNER JOIN ClassMaster ON TCPrintAll.TeachingClassCode = ClassMaster.ClassCode WHERE RegID = @WhereCondition
	END

	Else If  @TableName='TCIssueRegNoMainClass'
	BEGIN
		SELECT     TCPrintAll.TCNo, TCPrintAll.TCDate, TCPrintAll.TCStatus, TCPrintAll.TCBehavior, ClassMaster.ClassName AS SchoolLeaveClass, TCPrintAll.SLeaveReason, TCPrintAll.TCRemark,  TCPrintAll.DuplicateTCPrintFlag, TCPrintAll.ReportDateOTC, TCPrintAll.ReportDate, StudInfoAll.RegNo FROM         TCPrintAll INNER JOIN ClassMaster ON TCPrintAll.TeachingClassCode = ClassMaster.ClassCode INNER JOIN StudInfoAll ON TCPrintAll.RegID = StudInfoAll.RegID WHERE     StudInfoAll.RegNo = @WhereCondition And StudInfoAll.MainClassCode = @MainClassCode
	END
	
	Else If @TableName='MainClassMasterWithoutMax'
	BEGIN
		SELECT MainClassCode, MainClassName from MainClassMaster where (MainClassCode <> (SELECT MAX(MainClassCode) AS MaxMainClassCode FROM MainClassMaster WHERE (DeleteFlag = 0))) And DeleteFlag = 0
	END
	
	Else If @TableName='MaxClassCode'
	BEGIN
		SELECT MAX(ClassMaster.ClassCode) AS MaxClassCode FROM ClassMaster INNER JOIN MainClassMaster ON ClassMaster.MainClassCode = MainClassMaster.MainClassCode Where ClassMaster.DeleteFlag = 0 And MainClassMaster.MainClassName = @WhereCondition
	END
	
	Else If @TableName='RenewClassCode'
	BEGIN
	    SELECT ClassMaster.RenewClassCode, ClassMaster_1.MainClassCode AS RenewMainClassCode FROM ClassMaster INNER JOIN ClassMaster AS ClassMaster_1 ON ClassMaster.RenewClassCode = ClassMaster_1.ClassCode WHERE (ClassMaster.ClassCode = @WhereCondition) AND (ClassMaster_1.DeleteFlag = 0)
	END

	Else If @TableName='ClassWiseRegID'
	BEGIN
		SELECT RegID FROM StudInfo WHERE (AyCode = @AyCode) AND (ClassCode = @WhereCondition)
	END

	Else If @TableName='AdmissionDateLessthan'
	BEGIN
		SELECT  RegNo, AdmittionDate FROM StudInfoAll WHERE EntryFrom='A' And (RegNo < @WhereCondition)  and MainClassCode=@MainClassCode ORDER BY RegNo DESC
	END

	Else If @TableName='AdmissionDateGraterthan'
	BEGIN
		SELECT  RegNo, AdmittionDate FROM StudInfoAll WHERE EntryFrom='A' And (RegNo > @WhereCondition)  and  MainClassCode=@MainClassCode ORDER BY RegNo
	END

	Else If @TableName='ReportMaster'
	BEGIN
		SELECT     ReportMaster.ReportCode, UserReportDetail.ReportNameAlias AS ReportName  FROM ReportMaster INNER JOIN UserReportDetail ON ReportMaster.ReportCode = UserReportDetail.ReportCode  WHERE  (ReportMaster.DisplaySetting = 'A' OR ReportMaster.DisplaySetting = @WhereCondition2) AND UserReportDetail.UserCode = @WhereCondition1 And ReportMaster.ReportType = @WhereCondition ORDER BY SrNo
	END

	Else If @TableName='ReportMasterEN'
	BEGIN
		SELECT     ReportMaster.ReportCode, UserReportDetail.ReportNameAlias AS ReportNameEN  FROM ReportMaster INNER JOIN UserReportDetail ON ReportMaster.ReportCode = UserReportDetail.ReportCode  WHERE  (ReportMaster.DisplaySetting = 'A' OR ReportMaster.DisplaySetting = @WhereCondition2) AND UserReportDetail.UserCode = @WhereCondition1 And ReportMaster.ReportType = @WhereCondition ORDER BY SrNo
	END

	Else If @TableName='ReportMasterUpdateAndImport'
	BEGIN
		SELECT     ReportMaster.ReportCode, UserReportDetail.ReportNameAlias AS ReportName  FROM ReportMaster INNER JOIN UserReportDetail ON ReportMaster.ReportCode = UserReportDetail.ReportCode  WHERE  (ReportMaster.DisplaySetting = 'A' OR ReportMaster.DisplaySetting = @WhereCondition2) AND UserReportDetail.UserCode = @WhereCondition1 And ReportMaster.ReportCode<>110 And ReportMaster.ReportCode<>112 And ReportMaster.ReportCode<>231 And (ReportMaster.ReportType = 'OMUpdate' OR ReportMaster.ReportType = 'OMExportImport') ORDER BY SrNo
		--SELECT ReportCode, ReportName from ReportMaster where DeleteFlag = 0 And ReportMaster.ReportCode<>110 And ReportMaster.ReportCode<>112 And (ReportMaster.ReportType = 'OMUpdate' OR ReportMaster.ReportType = 'OMExportImport') ORDER BY SrNo
	END

	Else If @TableName='ReportMasterUpdateAndImportEN'
	BEGIN
		SELECT     ReportMaster.ReportCode, UserReportDetail.ReportNameAlias AS ReportNameEN  FROM ReportMaster INNER JOIN UserReportDetail ON ReportMaster.ReportCode = UserReportDetail.ReportCode  WHERE  (ReportMaster.DisplaySetting = 'A' OR ReportMaster.DisplaySetting = @WhereCondition2) AND UserReportDetail.UserCode = @WhereCondition1 And ReportMaster.ReportCode<>110 And ReportMaster.ReportCode<>112 And ReportMaster.ReportCode<>231 And (ReportMaster.ReportType = 'OMUpdate' OR ReportMaster.ReportType = 'OMExportImport') ORDER BY SrNo
		--SELECT ReportCode, ReportNameEN from ReportMaster where DeleteFlag = 0 And ReportCode<>110 And ReportCode<>112 And (ReportType = 'OMUpdate' OR ReportType = 'OMExportImport') ORDER BY SrNo
	END

	Else If @TableName='EmployeeMaster'
	BEGIN
				SELECT     EmpMaster.TID, EmpMaster.Firstname + ' ' + EmpMaster.MiddleName + ' ' + EmpMaster.LastName AS EmployeeName
		FROM         EmpMaster INNER JOIN
							  MainClassMaster ON EmpMaster.MainClassCode = MainClassMaster.MainClassCode
		WHERE     EmpMaster.DeleteFlag = 0 And MainClassMaster.MainClassName = @WhereCondition  ORDER BY EmpMaster.TID
	END

	Else If  @TableName='EmpTypeData'
	BEGIN
		SELECT     CDTTitle1, CDTTitle1Count, CDTTitle2, CDTTitle2Count, CDTTitle3, CDTTitle3Count, CDTTitle4, CDTTitle4Count FROM         EmpTypeMaster WHERE  EmpTypeCode = @WhereCondition
	END

	Else If @TableName='PayBillReportName'
	BEGIN
		SELECT EmpMonthlySalary.TID, EmpMonthlySalary.ReportName FROM EmpMonthlySalary INNER JOIN EmpTypeMaster ON EmpMonthlySalary.EmpTypeCode = EmpTypeMaster.EmpTypeCode WHERE  (EmpMonthlySalary.FyCode = @FyCode) AND (EmpMonthlySalary.MainClassCode = @MainClassCode) AND (EmpTypeMaster.EmpTypeName = @WhereCondition) ORDER BY EmpMonthlySalary.TID DESC
	END

	
	Else If @TableName='StudentInfo'
	BEGIN
		SELECT     StudInfoAll.RegID, StudInfoAll.RegNo, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName
							   END AS StudentName, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, StudInfoAll.FatherName, StudInfoAll.LocalAddress
		FROM         StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode
		WHERE     (StudInfoAll.RegID = @WhereCondition)
	END

	Else If @TableName='ClassWiseSubjectMaster'
	BEGIN
		SELECT DISTINCT ExamMarksDefine.SubjectCode, SubjectMaster.SubjectName FROM ExamMarksDefine INNER JOIN ClassMaster ON ExamMarksDefine.ClassCode = ClassMaster.ClassCode INNER JOIN SubjectMaster ON ExamMarksDefine.SubjectCode = SubjectMaster.SubjectCode WHERE  ClassMaster.ClassName = @WhereCondition 
	END

	Else If @TableName='ClassExamWiseSubjectMaster'
	BEGIN
		SELECT DISTINCT ExamMarksDefine.SubjectCode, SubjectMaster.SubjectName
		FROM     ExamMarksDefine INNER JOIN
						  ClassMaster ON ExamMarksDefine.ClassCode = ClassMaster.ClassCode INNER JOIN
						  SubjectMaster ON ExamMarksDefine.SubjectCode = SubjectMaster.SubjectCode INNER JOIN
						  ExamGroupDetail ON ExamMarksDefine.ExamGroupcode = ExamGroupDetail.ExamGroupcode INNER JOIN
						  ExamMaster ON ExamGroupDetail.ExamCode = ExamMaster.ExamCode INNER JOIN
						  DivisionMaster ON ExamGroupDetail.DivisionCode = DivisionMaster.DivisionCode
		WHERE SubjectMaster.DeleteFlag = 0 And ClassMaster.ClassName = @WhereCondition And ExamMaster.ExamName = @WhereCondition1 And DivisionMaster.DivisionName = @WhereCondition2 
	END

	Else If @TableName='ClassWiseSubjectMasterDE'
	BEGIN
				SELECT DISTINCT ExamMarksDefine.SubjectCode, SubjectMaster.SubjectName, SubDEClassGroupMaster.SubDEClassGName
		FROM         ExamMarksDefine INNER JOIN
							  ClassMaster ON ExamMarksDefine.ClassCode = ClassMaster.ClassCode INNER JOIN
							  SubjectMaster ON ExamMarksDefine.SubjectCode = SubjectMaster.SubjectCode INNER JOIN
							  SubDEClassGroupDetail ON ClassMaster.ClassCode = SubDEClassGroupDetail.ClassCode INNER JOIN
							  SubDEClassGroupMaster ON SubDEClassGroupDetail.SubDEClassGCode = SubDEClassGroupMaster.SubDEClassGCode
		WHERE     SubjectMaster.DeleteFlag = 0 And SubDEClassGroupMaster.SubDEClassGName = @WhereCondition
	END
	
	Else If @TableName='OptionalSubjectGroupMaster'
	BEGIN
		SELECT OptionalSubjectGroupMaster.OptionalSubjectGroupCode, OptionalSubjectGroupMaster.OptionalSubjectGroupName  FROM OptionalSubjectGroupMaster INNER JOIN ClassMaster ON OptionalSubjectGroupMaster.ClassCode = ClassMaster.ClassCode WHERE  ClassMaster.ClassName = @WhereCondition AND OptionalSubjectGroupMaster.DeleteFlag = 0
	END
	

	Else If @TableName='MainClassSubMasterSetting'
	BEGIN
		SELECT MainClassSubMaster.MainClassSubCode, MainClassSubMaster.MainClassSubName FROM   MainClassSubMaster  WHERE  MainClassSubMaster.MainClassSubCode = @WhereCondition  ORDER BY MainClassSubMaster.MainClassSubCode
	END

	Else If @TableName='PermanentAddress'
	BEGIN
		SELECT Distinct 1 as AddressCode, PermanentAddress FROM StudInfo WHERE  AyCode = @WhereCondition ORDER BY PermanentAddress
	END

	Else If @TableName='LocalAddress'
	BEGIN
		SELECT Distinct 1 as AddressCode, LocalAddress FROM StudInfo WHERE  AyCode = @WhereCondition ORDER BY LocalAddress
	END

	Else If @TableName='StudInfoAllEdit'
	BEGIN
			SELECT     StudInfoAll.SubjectGroupCode, SubjectGroupMaster.SubjectGroupName, StudInfoAll.ScholarshipEligibleStatus, ScholarshipMaster.ScholarshipName, StudInfoAll.ScholarshipCode, 
						  StudInfoAll.ScholarshipFormFeedStatus, StudInfoAll.Covid19Dose1Code, Covid19DoseMaster.Covid19DoseName AS Covid19Dose1, StudInfoAll.Covid19Dose1Date, StudInfoAll.Covid19Dose2Code, 
						  Covid19DoseMaster_1.Covid19DoseName AS Covid19Dose2, StudInfoAll.Covid19Dose2Date, StudInfoAll.Covid19BoosterDoseCode, 
						  Covid19DoseMaster_2.Covid19DoseName AS Covid19BoosterDose, StudInfoAll.Covid19BoosterDoseDate
	FROM         StudInfoAll LEFT OUTER JOIN
						  Covid19DoseMaster AS Covid19DoseMaster_2 ON StudInfoAll.Covid19BoosterDoseCode = Covid19DoseMaster_2.Covid19DoseCode LEFT OUTER JOIN
						  Covid19DoseMaster AS Covid19DoseMaster_1 ON StudInfoAll.Covid19Dose2Code = Covid19DoseMaster_1.Covid19DoseCode LEFT OUTER JOIN
						  Covid19DoseMaster ON StudInfoAll.Covid19Dose1Code = Covid19DoseMaster.Covid19DoseCode LEFT OUTER JOIN
						  ScholarshipMaster ON StudInfoAll.ScholarshipCode = ScholarshipMaster.ScholarshipCode LEFT OUTER JOIN
						  SubjectGroupMaster ON StudInfoAll.SubjectGroupCode = SubjectGroupMaster.SubjectGroupCode WHERE     StudInfoAll.RegID = @WhereCondition
	END

	Else If @TableName='SubjectGroup'
	BEGIN
		SELECT     SubjectGroupMaster.SubjectGroupCode, SubjectGroupMaster.SubjectGroupName, SubjectGroupClassDetail.ClassCode, ClassMaster.ClassName FROM         SubjectGroupClassDetail INNER JOIN ClassMaster ON SubjectGroupClassDetail.ClassCode = ClassMaster.ClassCode INNER JOIN SubjectGroupMaster ON SubjectGroupClassDetail.SubjectGroupCode = SubjectGroupMaster.SubjectGroupCode WHERE  ClassMaster.DeleteFlag = 0 And ClassMaster.ClassName = @WhereCondition
	END
	
	Else If @TableName='ReportMasterSOB'
	BEGIN
	    SELECT     ReportMaster.ReportCode, UserReportDetail.ReportNameAlias AS ReportName  FROM ReportMaster INNER JOIN UserReportDetail ON ReportMaster.ReportCode = UserReportDetail.ReportCode  WHERE  (ReportMaster.DisplaySetting = 'A' OR ReportMaster.DisplaySetting = @WhereCondition2)  AND UserReportDetail.UserCode = @WhereCondition1 And ReportMaster.ReportCode = 108 ORDER BY SrNo
	END

	Else If @TableName='ReportMasterENSOB'
	BEGIN
		SELECT     ReportMaster.ReportCode, UserReportDetail.ReportNameAlias AS ReportNameEN  FROM ReportMaster INNER JOIN UserReportDetail ON ReportMaster.ReportCode = UserReportDetail.ReportCode  WHERE  (ReportMaster.DisplaySetting = 'A' OR ReportMaster.DisplaySetting = @WhereCondition2)  AND UserReportDetail.UserCode = @WhereCondition1 And ReportMaster.ReportCode = 108 ORDER BY SrNo
	END

	Else If @TableName='ReportMasterSAT'
	BEGIN
	    SELECT     ReportMaster.ReportCode, UserReportDetail.ReportNameAlias AS ReportName  FROM ReportMaster INNER JOIN UserReportDetail ON ReportMaster.ReportCode = UserReportDetail.ReportCode  WHERE  (ReportMaster.DisplaySetting = 'A' OR ReportMaster.DisplaySetting = @WhereCondition2)  AND UserReportDetail.UserCode = @WhereCondition1 And ReportMaster.ReportCode = 114 ORDER BY SrNo
	END

	Else If @TableName='ReportMasterENSAT'
	BEGIN
		SELECT     ReportMaster.ReportCode, UserReportDetail.ReportNameAlias AS ReportNameEN  FROM ReportMaster INNER JOIN UserReportDetail ON ReportMaster.ReportCode = UserReportDetail.ReportCode  WHERE  (ReportMaster.DisplaySetting = 'A' OR ReportMaster.DisplaySetting = @WhereCondition2)  AND UserReportDetail.UserCode = @WhereCondition1 And ReportMaster.ReportCode = 114 ORDER BY SrNo
	END

	Else If @TableName='ReportMasterSHAndW'
	BEGIN
	    SELECT     ReportMaster.ReportCode, UserReportDetail.ReportNameAlias AS ReportName  FROM ReportMaster INNER JOIN UserReportDetail ON ReportMaster.ReportCode = UserReportDetail.ReportCode  WHERE  (ReportMaster.DisplaySetting = 'A' OR ReportMaster.DisplaySetting = @WhereCondition2)  AND UserReportDetail.UserCode = @WhereCondition1 And ReportMaster.ReportCode = 107 ORDER BY SrNo
	END

	Else If @TableName='ReportMasterENSHAndW'
	BEGIN
		SELECT     ReportMaster.ReportCode, UserReportDetail.ReportNameAlias AS ReportNameEN  FROM ReportMaster INNER JOIN UserReportDetail ON ReportMaster.ReportCode = UserReportDetail.ReportCode  WHERE  (ReportMaster.DisplaySetting = 'A' OR ReportMaster.DisplaySetting = @WhereCondition2)  AND UserReportDetail.UserCode = @WhereCondition1 And ReportMaster.ReportCode = 107 ORDER BY SrNo
	END

	Else If @TableName='ReportMasterSeatNo'
	BEGIN
		SELECT     ReportMaster.ReportCode, UserReportDetail.ReportNameAlias AS ReportNameEN  FROM ReportMaster INNER JOIN UserReportDetail ON ReportMaster.ReportCode = UserReportDetail.ReportCode  WHERE  (ReportMaster.DisplaySetting = 'A' OR ReportMaster.DisplaySetting = @WhereCondition2)  AND UserReportDetail.UserCode = @WhereCondition1 And ReportMaster.ReportCode = 106 ORDER BY SrNo
	END

	Else If @TableName='ReportMasterENSeatNo'
	BEGIN
		SELECT     ReportMaster.ReportCode, UserReportDetail.ReportNameAlias AS ReportNameEN  FROM ReportMaster INNER JOIN UserReportDetail ON ReportMaster.ReportCode = UserReportDetail.ReportCode  WHERE  (ReportMaster.DisplaySetting = 'A' OR ReportMaster.DisplaySetting = @WhereCondition2)  AND UserReportDetail.UserCode = @WhereCondition1 And ReportMaster.ReportCode = 106 ORDER BY SrNo
	END

	If @TableName='FeeTitleOtherGroupMaster'
	BEGIN
		SELECT DISTINCT FeeTitleOtherGroupMaster.FeeTitleOtherGroupCode, FeeTitleOtherGroupMaster.FeeTitleOtherGroupName
		FROM         FeeTitleOtherGroupMaster INNER JOIN
							  FeesDefineOther ON FeeTitleOtherGroupMaster.FeeTitleOtherGroupCode = FeesDefineOther.FeeTitleOtherGroupCode INNER JOIN
							  ClassMaster ON FeesDefineOther.ClassCode = ClassMaster.ClassCode
		WHERE     (FeeTitleOtherGroupMaster.DeleteFlag = 0) AND (ClassMaster.ClassName = @WhereCondition)
	END
					 
END
GO
/****** Object:  StoredProcedure [dbo].[SP_FillRenewAdmission]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_FillRenewAdmission]
    @OldAyCode bigint=null, @AyCode bigint=null, @MainClassCode bigint=null, @ClassCode bigint=null
AS

BEGIN
	SET NOCOUNT ON;
		SELECT     StudInfoAll.RegID, MainClassMaster.MainClassName AS MainClass, ClassMaster.ClassName AS Class, DivisionMaster.DivisionName AS Div, StudInfoAll.RegNo, 
							  CASE dbo.StudInfoAll.LastName WHEN '-' THEN dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName ELSE dbo.StudInfoAll.Firstname + ' ' + dbo.StudInfoAll.MiddleName + ' ' + dbo.StudInfoAll.LastName END AS StudentName, ClassMaster_1.ClassName AS NewClass, ClassMaster.RenewClassCode, GenderMaster.GenderShort, StudInfoAll.AyCode, 
							  StudInfoAll.CloseFlag
		FROM         GenderMaster INNER JOIN
							  StudInfoAll INNER JOIN
							  MainClassMaster ON StudInfoAll.MainClassCode = MainClassMaster.MainClassCode INNER JOIN
							  ClassMaster ON StudInfoAll.ClassCode = ClassMaster.ClassCode INNER JOIN
							  DivisionMaster ON StudInfoAll.DivisionCode = DivisionMaster.DivisionCode ON GenderMaster.GenderCode = StudInfoAll.GenderCode INNER JOIN
							  ClassMaster AS ClassMaster_1 ON ClassMaster.RenewClassCode = ClassMaster_1.ClassCode
		WHERE  StudInfoAll.CloseFlag = 'N' And StudInfoAll.TSuspendedFlag = 'N' And StudInfoAll.AyCode = @OldAyCode And StudInfoAll.ClassCode = @ClassCode And StudInfoAll.MainClassCode = @MainClassCode And (StudInfoAll.RegID NOT IN (SELECT RegID FROM StudInfo WHERE (AyCode = @AyCode)))		
END
GO
/****** Object:  StoredProcedure [dbo].[SP_GetDefaultValue]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_GetDefaultValue]
	@RecordSelection nvarchar(100)= '-'
AS 

DECLARE @TempCode nvarchar(120)
DECLARE @TempName nvarchar(120)
Begin
	SET NOCOUNT ON;
	Set @TempName = '-';
	If @RecordSelection='MainClassMaster'
		BEGIN
   		   SELECT @TempCode = MainClassCode, @TempName = MainClassName from MainClassMaster where DefaultDisplay = 'Y'
		END
	else If @RecordSelection='MediumMaster'
		BEGIN
   		   SELECT @TempCode = MediumCode, @TempName = MediumName from MediumMaster where  DefaultDisplay = 'Y'
		END
	else If @RecordSelection='GenderMaster'
		BEGIN
   		   SELECT @TempCode = GenderCode, @TempName = GenderName from GenderMaster where GenderCode = 1
		END
	else If @RecordSelection='LanguageMaster'
		BEGIN
   		   SELECT @TempCode = LanguageCode, @TempName = LanguageName from LanguageMaster where LanguageCode = 1
		END
	else If @RecordSelection='CityMaster'
		BEGIN
   		   SELECT @TempCode = CityCode, @TempName = CityName from CityMaster where CityCode = 1
		END
	else If @RecordSelection='OccupationMaster'
		BEGIN
   		   SELECT @TempCode = OccupationCode, @TempName = OccupationName from OccupationMaster where OccupationCode = 1
		END
	else If @RecordSelection='EducationMaster'
		BEGIN
		   SELECT @TempCode = EducationCode, @TempName = EducationName from EducationMaster where EducationCode = 1
		END
	else If @RecordSelection='TCSLRMaster'
		BEGIN
   		   SELECT @TempCode = TCSLRCode, @TempName = TCSLRName from TCSLRMaster where TCSLRCode = 1
		END
	else If @RecordSelection='TCRemarkMaster'
		BEGIN
   		   SELECT @TempCode = TCRemarkCode, @TempName = TCRemarkName from TCRemarkMaster where TCRemarkCode = 1
		END

	 SELECT 'RecordCode' = @TempCode, 'RecordName' = @TempName;
	 return;
End
GO
/****** Object:  StoredProcedure [dbo].[SP_GetFeesBalance]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- CREATE Used To CREATE A NEW Procedure
-- ALTER Used To Modify Procedure

CREATE PROCEDURE [dbo].[SP_GetFeesBalance]
	@RecordSelection nvarchar(120)=null, @RegID bigint=null,@ReceiptTID bigint=null,@FeeTitleCode bigint=null, @AyCode bigint=null
AS
DECLARE @TotalPaidAmount bigint
DECLARE @TotalDiscount bigint
DECLARE @ReceiptPaidAmt bigint
DECLARE @ReceiptDisAmt bigint
DECLARE @TotalPaidOepningAmount bigint

BEGIN
	SET NOCOUNT ON;
	Set @TotalPaidAmount = NULL
	Set @TotalDiscount = NULL
	Set @ReceiptPaidAmt = NULL
	Set @ReceiptDisAmt = NULL
	Set @TotalPaidOepningAmount = NULL
	
	If @RecordSelection='FeesCollection'
	 BEGIN
		SELECT @TotalPaidAmount = SUM(FeesCollectionDetail.FeesAmount), @TotalDiscount = SUM(FeesCollectionDetail.DiscountAmount) FROM FeesCollectionDetail INNER JOIN FeesCollection ON FeesCollectionDetail.ReceiptTID = FeesCollection.ReceiptTID WHERE (FeesCollectionDetail.FeeTitleCode = @FeeTitleCode) AND (FeesCollection.RegID = @RegID) AND (FeesCollection.AyCode = @AyCode) AND (FeesCollection.CancelReceiptFlag = N'N')
		IF @TotalPaidAmount IS NULL
		Begin
		   Set @TotalPaidAmount = 0
		End
		IF @TotalDiscount IS NULL
		Begin
		   Set @TotalDiscount = 0
		End

		SELECT @ReceiptPaidAmt = SUM(FeesCollectionDetail.FeesAmount), @ReceiptDisAmt = SUM(FeesCollectionDetail.DiscountAmount) FROM FeesCollectionDetail INNER JOIN FeesCollection ON FeesCollectionDetail.ReceiptTID = FeesCollection.ReceiptTID WHERE (FeesCollection.ReceiptTID = @ReceiptTID) AND (FeesCollectionDetail.FeeTitleCode = @FeeTitleCode) AND (FeesCollection.RegID = @RegID) AND (FeesCollection.AyCode = @AyCode)
		IF @ReceiptPaidAmt IS NULL
		Begin
		   Set @ReceiptPaidAmt = 0
		End
		IF @ReceiptDisAmt IS NULL
		Begin
		   Set @ReceiptDisAmt = 0
		End
		
		SELECT 'TotalPaidAmount' = @TotalPaidAmount,'TotalDiscount' = @TotalDiscount,'ReceiptPaidAmt' = @ReceiptPaidAmt,'ReceiptDisAmt' = @ReceiptDisAmt;
		return;
	End
	else If @RecordSelection='FeesCollectionRegIDYearWise'
	 BEGIN
		SELECT @TotalPaidAmount = SUM(FeesCollectionDetail.FeesAmount), @TotalDiscount = SUM(FeesCollectionDetail.DiscountAmount) FROM FeesCollectionDetail INNER JOIN FeesCollection ON FeesCollectionDetail.ReceiptTID = FeesCollection.ReceiptTID WHERE (FeesCollection.RegID = @RegID) AND (FeesCollection.AyCode = @AyCode) AND (FeesCollection.CancelReceiptFlag = N'N')
		IF @TotalPaidAmount IS NULL
		Begin
		   Set @TotalPaidAmount = 0
		End
		IF @TotalDiscount IS NULL
		Begin
		   Set @TotalDiscount = 0
		End

		SELECT @TotalPaidOepningAmount = SUM(FeesCollectionDetail.FeesAmount) FROM FeesCollectionDetail INNER JOIN FeesCollection ON FeesCollectionDetail.ReceiptTID = FeesCollection.ReceiptTID WHERE (FeesCollectionDetail.FeeTitleCode=-1) And (FeesCollection.RegID = @RegID) AND (FeesCollection.AyCode = @AyCode) AND (FeesCollection.CancelReceiptFlag = N'N')
		IF @TotalPaidOepningAmount IS NULL
		Begin
		   Set @TotalPaidOepningAmount = 0
		End

		SELECT 'TotalPaidAmount' = @TotalPaidAmount,'TotalDiscount' = @TotalDiscount,'TotalPaidOepningAmount' = @TotalPaidOepningAmount;
		return;
	End
	else If @RecordSelection='BusFeesCollection'
	 BEGIN
		SELECT @TotalPaidAmount = SUM(BusFeesCollectionDetail.FeesAmount), @TotalDiscount = SUM(BusFeesCollectionDetail.DiscountAmount) FROM BusFeesCollectionDetail INNER JOIN BusFeesCollection ON BusFeesCollectionDetail.ReceiptTID = BusFeesCollection.ReceiptTID WHERE (BusFeesCollectionDetail.BusFeeTitleCode = @FeeTitleCode) AND (BusFeesCollection.RegID = @RegID) AND (BusFeesCollection.AyCode = @AyCode) AND (BusFeesCollection.CancelReceiptFlag = N'N')
		IF @TotalPaidAmount IS NULL
		Begin
		   Set @TotalPaidAmount = 0
		End
		IF @TotalDiscount IS NULL
		Begin
		   Set @TotalDiscount = 0
		End

		SELECT @ReceiptPaidAmt = SUM(BusFeesCollectionDetail.FeesAmount), @ReceiptDisAmt = SUM(BusFeesCollectionDetail.DiscountAmount) FROM BusFeesCollectionDetail INNER JOIN BusFeesCollection ON BusFeesCollectionDetail.ReceiptTID = BusFeesCollection.ReceiptTID WHERE (BusFeesCollection.ReceiptTID = @ReceiptTID) AND (BusFeesCollectionDetail.BusFeeTitleCode = @FeeTitleCode) AND (BusFeesCollection.RegID = @RegID) AND (BusFeesCollection.AyCode = @AyCode)
		IF @ReceiptPaidAmt IS NULL
		Begin
		   Set @ReceiptPaidAmt = 0
		End
		IF @ReceiptDisAmt IS NULL
		Begin
		   Set @ReceiptDisAmt = 0
		End
		
		SELECT 'TotalPaidAmount' = @TotalPaidAmount,'TotalDiscount' = @TotalDiscount,'ReceiptPaidAmt' = @ReceiptPaidAmt,'ReceiptDisAmt' = @ReceiptDisAmt;
		return;
	End

	else If @RecordSelection='FeesCollectionRegular'
	 BEGIN
		SELECT @TotalPaidAmount = SUM(FeesCollectionRegularDetail.FeesAmount), @TotalDiscount = SUM(FeesCollectionRegularDetail.DiscountAmount) FROM FeesCollectionRegularDetail INNER JOIN FeesCollectionRegular ON FeesCollectionRegularDetail.ReceiptTID = FeesCollectionRegular.ReceiptTID WHERE (FeesCollectionRegularDetail.FeeTitleRegularCode = @FeeTitleCode) AND (FeesCollectionRegular.RegID = @RegID) AND (FeesCollectionRegular.AyCode = @AyCode) AND (FeesCollectionRegular.CancelReceiptFlag = N'N')
		IF @TotalPaidAmount IS NULL
		Begin
		   Set @TotalPaidAmount = 0
		End
		IF @TotalDiscount IS NULL
		Begin
		   Set @TotalDiscount = 0
		End

		SELECT @ReceiptPaidAmt = SUM(FeesCollectionRegularDetail.FeesAmount), @ReceiptDisAmt = SUM(FeesCollectionRegularDetail.DiscountAmount) FROM FeesCollectionRegularDetail INNER JOIN FeesCollectionRegular ON FeesCollectionRegularDetail.ReceiptTID = FeesCollectionRegular.ReceiptTID WHERE (FeesCollectionRegular.ReceiptTID = @ReceiptTID) AND (FeesCollectionRegularDetail.FeeTitleRegularCode = @FeeTitleCode) AND (FeesCollectionRegular.RegID = @RegID) AND (FeesCollectionRegular.AyCode = @AyCode) 
		IF @ReceiptPaidAmt IS NULL
		Begin
		   Set @ReceiptPaidAmt = 0
		End
		IF @ReceiptDisAmt IS NULL
		Begin
		   Set @ReceiptDisAmt = 0
		End
		
		SELECT 'TotalPaidAmount' = @TotalPaidAmount,'TotalDiscount' = @TotalDiscount,'ReceiptPaidAmt' = @ReceiptPaidAmt,'ReceiptDisAmt' = @ReceiptDisAmt;
		return;
	End
	else If @RecordSelection='FeesCollectionOther'
	 BEGIN
		SELECT @ReceiptPaidAmt = SUM(FeesCollectionOtherDetail.FeesAmount) FROM FeesCollectionOtherDetail INNER JOIN FeesCollectionOther ON FeesCollectionOtherDetail.ReceiptTID = FeesCollectionOther.ReceiptTID WHERE (FeesCollectionOther.ReceiptTID = @ReceiptTID) AND (FeesCollectionOtherDetail.FeeTitleOtherCode = @FeeTitleCode)
		IF @ReceiptPaidAmt IS NULL
		Begin
		   Set @ReceiptPaidAmt = 0
		End
		
		SELECT 'ReceiptPaidAmt' = @ReceiptPaidAmt;
		return;
	End

	else If @RecordSelection='BusFeesDefine'
	 BEGIN
		SELECT @ReceiptPaidAmt = BusAmount FROM BusFeesDefine WHERE (RegID = @RegID) AND (AyCode = @AyCode) AND (BusFeeTitleCode = @FeeTitleCode)
		IF @ReceiptPaidAmt IS NULL
		Begin
		   Set @ReceiptPaidAmt = 0
		End

		SELECT 'BusAmount' = @ReceiptPaidAmt;
		return;
	End
	
	else If @RecordSelection='FeesDefineRegular'
	 BEGIN
		SELECT @ReceiptPaidAmt = FeesAmountRegular FROM FeesDefineRegular WHERE (RegID = @RegID) AND (FeeTitleRegularCode = @FeeTitleCode)
		IF @ReceiptPaidAmt IS NULL
		Begin
		   Set @ReceiptPaidAmt = 0
		End

		SELECT 'FeesAmount' = @ReceiptPaidAmt;
		return;
	End
	
	else If @RecordSelection='StudentFeesOpeningBalance'
	 BEGIN
		SELECT @ReceiptPaidAmt = FeesAmount FROM StudentFeesOpeningBalance WHERE (RegID = @RegID) AND (AyCode = @AyCode) AND (FeeTitleCode = @FeeTitleCode)
		IF @ReceiptPaidAmt IS NULL
		Begin
		   Set @ReceiptPaidAmt = 0
		End

		SELECT 'FeesAmount' = @ReceiptPaidAmt;
		return;
	  End
	  
	else If @RecordSelection='FeesTitleBalance'
	 BEGIN
		SELECT @TotalPaidAmount = SUM(FeesCollectionDetail.FeesAmount), @TotalDiscount = SUM(FeesCollectionDetail.DiscountAmount) FROM FeesCollectionDetail INNER JOIN FeesCollection ON FeesCollectionDetail.ReceiptTID = FeesCollection.ReceiptTID WHERE (FeesCollectionDetail.FeeTitleCode = @FeeTitleCode) AND (FeesCollection.RegID = @RegID) AND (FeesCollection.AyCode = @AyCode) AND (FeesCollection.CancelReceiptFlag = N'N')
		IF @TotalPaidAmount IS NULL
		Begin
		   Set @TotalPaidAmount = 0
		End
		IF @TotalDiscount IS NULL
		Begin
		   Set @TotalDiscount = 0
		End

		SELECT 'TotalPaidAmount' = @TotalPaidAmount,'TotalDiscount' = @TotalDiscount;
		return;
	End

	else If @RecordSelection='BusFeesTitleBalance'
	 BEGIN
		SELECT @TotalPaidAmount = SUM(BusFeesCollectionDetail.FeesAmount), @TotalDiscount = SUM(BusFeesCollectionDetail.DiscountAmount) FROM BusFeesCollectionDetail INNER JOIN BusFeesCollection ON BusFeesCollectionDetail.ReceiptTID = BusFeesCollection.ReceiptTID WHERE (BusFeesCollectionDetail.BusFeeTitleCode = @FeeTitleCode) AND (BusFeesCollection.RegID = @RegID) AND (BusFeesCollection.AyCode = @AyCode) AND (BusFeesCollection.CancelReceiptFlag = N'N')
		IF @TotalPaidAmount IS NULL
		Begin
		   Set @TotalPaidAmount = 0
		End
		IF @TotalDiscount IS NULL
		Begin
		   Set @TotalDiscount = 0
		End

		SELECT 'TotalPaidAmount' = @TotalPaidAmount,'TotalDiscount' = @TotalDiscount;
		return;
	End

	else If @RecordSelection='FeeTitleRegularBalance'
	 BEGIN
		SELECT @TotalPaidAmount = SUM(FeesCollectionRegularDetail.FeesAmount), @TotalDiscount = SUM(FeesCollectionRegularDetail.DiscountAmount) FROM FeesCollectionRegularDetail INNER JOIN FeesCollectionRegular ON FeesCollectionRegularDetail.ReceiptTID = FeesCollectionRegular.ReceiptTID WHERE (FeesCollectionRegularDetail.FeeTitleRegularCode = @FeeTitleCode) AND (FeesCollectionRegular.RegID = @RegID) AND (FeesCollectionRegular.AyCode = @AyCode) AND (FeesCollectionRegular.CancelReceiptFlag = N'N')
		IF @TotalPaidAmount IS NULL
		Begin
		   Set @TotalPaidAmount = 0
		End
		IF @TotalDiscount IS NULL
		Begin
		   Set @TotalDiscount = 0
		End

		SELECT 'TotalPaidAmount' = @TotalPaidAmount,'TotalDiscount' = @TotalDiscount;
		return;
	End


	else If @RecordSelection='FeesBalance'
	 BEGIN
		SELECT @TotalPaidAmount = SUM(FeesCollectionDetail.FeesAmount), @TotalDiscount = SUM(FeesCollectionDetail.DiscountAmount) FROM FeesCollectionDetail INNER JOIN FeesCollection ON FeesCollectionDetail.ReceiptTID = FeesCollection.ReceiptTID WHERE (FeesCollection.RegID = @RegID) AND (FeesCollection.AyCode = @AyCode) AND (FeesCollection.CancelReceiptFlag = N'N')
		IF @TotalPaidAmount IS NULL
		Begin
		   Set @TotalPaidAmount = 0
		End
		IF @TotalDiscount IS NULL
		Begin
		   Set @TotalDiscount = 0
		End

		SELECT 'TotalPaidAmount' = @TotalPaidAmount,'TotalDiscount' = @TotalDiscount;
		return;
	End

	else If @RecordSelection='BusFeesBalance'
	 BEGIN
		SELECT @TotalPaidAmount = SUM(BusFeesCollectionDetail.FeesAmount), @TotalDiscount = SUM(BusFeesCollectionDetail.DiscountAmount) FROM BusFeesCollectionDetail INNER JOIN BusFeesCollection ON BusFeesCollectionDetail.ReceiptTID = BusFeesCollection.ReceiptTID WHERE (BusFeesCollection.RegID = @RegID) AND (BusFeesCollection.AyCode = @AyCode) AND (BusFeesCollection.CancelReceiptFlag = N'N')
		IF @TotalPaidAmount IS NULL
		Begin
		   Set @TotalPaidAmount = 0
		End
		IF @TotalDiscount IS NULL
		Begin
		   Set @TotalDiscount = 0
		End

		SELECT 'TotalPaidAmount' = @TotalPaidAmount,'TotalDiscount' = @TotalDiscount;
		return;
	End
	
	else If @RecordSelection='FeesRegularBalance'
	 BEGIN
		SELECT @TotalPaidAmount = SUM(FeesCollectionRegularDetail.FeesAmount), @TotalDiscount = SUM(FeesCollectionRegularDetail.DiscountAmount) FROM FeesCollectionRegularDetail INNER JOIN FeesCollectionRegular ON FeesCollectionRegularDetail.ReceiptTID = FeesCollectionRegular.ReceiptTID WHERE (FeesCollectionRegular.RegID = @RegID) AND (FeesCollectionRegular.AyCode = @AyCode) AND (FeesCollectionRegular.CancelReceiptFlag = N'N')
		IF @TotalPaidAmount IS NULL
		Begin
		   Set @TotalPaidAmount = 0
		End
		IF @TotalDiscount IS NULL
		Begin
		   Set @TotalDiscount = 0
		End

		SELECT 'TotalPaidAmount' = @TotalPaidAmount,'TotalDiscount' = @TotalDiscount;
		return;
	End

END
GO
/****** Object:  StoredProcedure [dbo].[SP_GetLanMaxCode]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_GetLanMaxCode]
	@FormName nvarchar(100)
AS
BEGIN	
		declare @tmpTID bigint
		declare @tmpMaxNo bigint
		
		BEGIN TRANSACTION

		SELECT @tmpTID = max(MaxTid)+1 FROM MaxNumber where FormName = @FormName
		SELECT @tmpMaxNo = max(MaxNo)+1 FROM MaxNumber where FormName = @FormName
		Update MaxNumber Set MaxTid = @tmpTID, MaxNo = @tmpMaxNo  where FormName = @FormName
		SELECT @tmpTID, @tmpMaxNo  FROM MaxNumber where FormName = @FormName
		
		COMMIT TRANSACTION
		RETURN;  -- Record Successfully Saved
END
GO
/****** Object:  StoredProcedure [dbo].[SP_GetLogin]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_GetLogin]
	@UserName nvarchar(100)=null,@Password nvarchar(100)=null
AS
Begin
	SET NOCOUNT ON;
	SELECT UserName, Password, UserCode, SecondPassword, LockTypeCode, DuplicateTCPassShow , PhotoPath, TCPassword, FeesPassword, AdmissionFormShortEntry, AdminFlag, TCPermanentDelete, FeesPermanentDelete, StudentPermanentDelete FROM UserMaster WHERE     (UserName = @UserName) AND (Password = @Password)
End
GO
/****** Object:  StoredProcedure [dbo].[SP_GetMaxCode]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- CREATE Used To CREATE A NEW Procedure
-- ALTER Used To Modify Procedure

CREATE PROCEDURE [dbo].[SP_GetMaxCode]
	@TableName nvarchar(120)=null, @FieldName nvarchar(120)=null, @WhereCondition nvarchar(255)='NC'   -- NC means NoCondition
AS
BEGIN
	SET NOCOUNT ON;
	BEGIN
		--SELECT MAX(@FieldName) FROM @TableName
		if @WhereCondition = 'NC'
		   --EXECUTE ('SELECT MAX('+@FieldName+') FROM '+ @TableName)	
		   EXECUTE ('SELECT COALESCE(MAX('+@FieldName+'),0) + 1 FROM '+ @TableName +'(UPDLOCK)')
		else 
		   --EXECUTE ('SELECT MAX('+@FieldName+') FROM '+ @TableName+' '+ @WhereCondition)
		   EXECUTE ('SELECT COALESCE(MAX('+@FieldName+'),0) + 1 FROM '+ @TableName +'(UPDLOCK) '+ @WhereCondition)
			--'Where ' + CONVERT(varchar, '03/20/2013',101) + ' = ' + CONVERT(varchar,'03/20/2013',101)  -- OK Condition for Date
	END
END
GO
/****** Object:  StoredProcedure [dbo].[SP_GetMaxCodeQuery]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- CREATE Used To CREATE A NEW Procedure
-- ALTER Used To Modify Procedure
CREATE PROCEDURE [dbo].[SP_GetMaxCodeQuery]
	@TableName nvarchar(Max)=null, @FyCode bigint=null, @WhereCondition nvarchar(255)='NC'   -- NC means NoCondition
AS
BEGIN
	SET NOCOUNT ON;
	BEGIN
		if @TableName = 'FeesCollection'
		   SELECT     COALESCE(MAX(FeesCollection.ReceiptNo),0) + 1 FROM FeesCollection INNER JOIN MainClassMaster ON FeesCollection.MainClassCode = MainClassMaster.MainClassCode  WHERE FeesCollection.FyCode = @FyCode And MainClassMaster.FeesNoGroupID = @WhereCondition
		else if @TableName = 'FeesCollectionOther'
		   SELECT     COALESCE(MAX(FeesCollectionOther.ReceiptNo),0) + 1 FROM FeesCollectionOther INNER JOIN MainClassMaster ON FeesCollectionOther.MainClassCode = MainClassMaster.MainClassCode  WHERE FeesCollectionOther.FyCode = @FyCode And MainClassMaster.FeesNoGroupID = @WhereCondition
		else if @TableName = 'FeesCollectionRegular'
		   SELECT     COALESCE(MAX(FeesCollectionRegular.ReceiptNo),0) + 1 FROM FeesCollectionRegular INNER JOIN MainClassMaster ON FeesCollectionRegular.MainClassCode = MainClassMaster.MainClassCode  WHERE FeesCollectionRegular.FyCode = @FyCode And MainClassMaster.FeesNoGroupID = @WhereCondition		   
		else if @TableName = 'TCPrintAll'
		   SELECT     COALESCE(MAX(TCPrintAll.TCCode),0) + 1 FROM TCPrintAll INNER JOIN MainClassMaster ON TCPrintAll.MainClassCode = MainClassMaster.MainClassCode  WHERE MainClassMaster.TCNoGroupID = @WhereCondition
		else if @TableName = 'BonafiedCertificate'
		   SELECT     COALESCE(MAX(BonafiedCertificate.RecordNo),0) + 1 FROM BonafiedCertificate INNER JOIN MainClassMaster ON BonafiedCertificate.MainClassCode = MainClassMaster.MainClassCode  WHERE MainClassMaster.BonafiedNoGroupID = @WhereCondition
		else if @TableName = 'BusFeesCollection'
		   SELECT     COALESCE(MAX(BusFeesCollection.ReceiptNo),0) + 1 FROM BusFeesCollection INNER JOIN MainClassMaster ON BusFeesCollection.MainClassCode = MainClassMaster.MainClassCode  WHERE BusFeesCollection.FyCode = @FyCode And MainClassMaster.FeesNoGroupID = @WhereCondition
	END
END
GO
/****** Object:  StoredProcedure [dbo].[SP_GetMaxTID]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_GetMaxTID]	
	 @TableName nvarchar(120)=null, @FieldName nvarchar(120)=null, @WhereCondition nvarchar(255)='NC'   -- NC means NoCondition 
AS
BEGIN
DECLARE @retval int   
DECLARE @sSQL nvarchar(500);
DECLARE @ParmDefinition nvarchar(500);

	SET NOCOUNT ON;
	Set @sSQL = 'SELECT @retvalOUT = max(' + @FieldName + ') + 1 FROM ' + @TableName
	SET @ParmDefinition = N'@retvalOUT int OUTPUT';
	EXEC sp_executesql @sSQL, @ParmDefinition, @retvalOUT=@retval OUTPUT;	
	if @retval <> 0 
	   Begin	 
	   Return @retval
	End
	Else
	   Begin
	   Return 1
	End
END
GO
/****** Object:  StoredProcedure [dbo].[SP_GetRecordCode]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- CREATE Used To CREATE A NEW Procedure
-- ALTER Used To Modify Procedure

CREATE PROCEDURE [dbo].[SP_GetRecordCode]
	@TableName nvarchar(120)=null, @FieldName nvarchar(120)=null
AS
DECLARE @TempCode bigint
BEGIN
	SET NOCOUNT ON;
	BEGIN
		If @TableName='CityMaster'
			BEGIN
   			   SELECT @TempCode = CityCode from CityMaster where CityName = @fieldName
			   IF @TempCode IS Not NULL
				  SELECT 'ReturnStatus' = @TempCode;
			   else
				  SELECT 'ReturnStatus' = -1;
			END

		 return;

	END
END
GO
/****** Object:  StoredProcedure [dbo].[SP_GetRecordNameFromCode]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- CREATE Used To CREATE A NEW Procedure
-- ALTER Used To Modify Procedure

CREATE PROCEDURE [dbo].[SP_GetRecordNameFromCode]
	@TableName nvarchar(120)=null, @FieldCode bigint = null, @FieldName nvarchar(120) = null
AS
DECLARE @TempName nvarchar(120)
DECLARE @RecordName nvarchar(120)

BEGIN
	SET NOCOUNT ON;
	Set @RecordName = '-1';
	If @TableName='ClassMaster'
		BEGIN
		   SELECT @TempName = ClassName from ClassMaster where ClassCode = @FieldCode
		   IF @TempName IS Not NULL
			  Set @RecordName = @TempName;
		END
	else If @TableName='MediumMaster'
		BEGIN
		   SELECT @TempName = MediumName from MediumMaster where MediumCode = @FieldCode
		   IF @TempName IS Not NULL
			  Set @RecordName = @TempName;
		END

	else If @TableName='MainClassMaster'
		BEGIN
		   SELECT @TempName = MainClassName from MainClassMaster where MainClassCode = @FieldCode
		   IF @TempName IS Not NULL
			  Set @RecordName = @TempName;
		END
	else If @TableName='FeeTypeMaster'
		BEGIN
		   SELECT @TempName = FeeTypeName from FeeTypeMaster where FeeTypeCode = @FieldCode
		   IF @TempName IS Not NULL
			  Set @RecordName = @TempName;
		END	 
	else If @TableName='CategoryMaster'
		BEGIN
		   SELECT @TempName = CategoryName from CategoryMaster where CategoryCode = @FieldCode
		   IF @TempName IS Not NULL
			  Set @RecordName = @TempName;
		END	 
	else If @TableName='OtherSchoolMaster'
		BEGIN
		   SELECT @TempName = OtherSchoolName from OtherSchoolMaster where OtherSchoolCode = @FieldCode
		   IF @TempName IS Not NULL
			  Set @RecordName = @TempName;
		END	 

	else If @TableName='ReportStudInfoAllStudentName'
		BEGIN
		   SELECT @TempName = (CASE LastName WHEN '-' THEN Firstname + ' ' + MiddleName ELSE Firstname + ' ' + MiddleName + ' ' + LastName END) from StudInfoAll where (CASE LastName WHEN '-' THEN Firstname + ' ' + MiddleName ELSE Firstname + ' ' + MiddleName + ' ' + LastName END)  = @FieldName
		   IF @TempName IS Not NULL
			  Set @RecordName = @TempName;
		END	 

	else If @TableName='FieldNameChangeMasterMarathi'
		BEGIN
		   SELECT @TempName = FieldNameMarathi from FieldNameChangeMaster where FieldNameDatabase = @FieldName
		   IF @TempName IS Not NULL
			  Set @RecordName = @TempName;
		   else
			  Set @RecordName = @FieldName	  
		END	 
	else If @TableName='FieldNameChangeMasterEnglish'
		BEGIN
		   SELECT @TempName = FieldNameEnglish from FieldNameChangeMaster where FieldNameDatabase = @FieldName
		   IF @TempName IS Not NULL
			  Set @RecordName = @TempName;
		   else
			  Set @RecordName = @FieldName	  
		END	 
	 SELECT 'ReturnStatus' = @RecordName;
	 return;
END
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveACAccountRegisterMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveACAccountRegisterMaster] 
	@AccountRegisterCode bigint=null,@AccountRegister nvarchar(255)=null,@DeleteFlag char(1)=null,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin


		BEGIN TRANSACTION
		If @CurrentFlag = 'A'
			Begin
				INSERT INTO ACAccountRegisterMaster VALUES (@AccountRegister, @DeleteFlag)
				Select @AccountRegisterCode=SCOPE_IDENTITY()
			End
		else
			Begin
				Update ACAccountRegisterMaster Set AccountRegister = @AccountRegister Where AccountRegisterCode=@AccountRegisterCode
			End

		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = @AccountRegisterCode;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Update ACAccountRegisterMaster Set DeleteFlag = 'N' where AccountRegisterCode = @AccountRegisterCode
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveACLedgerHeadMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveACLedgerHeadMaster] 
	@LedgerHeadCode bigint, @SrNo bigint=null,@LedgerHead nvarchar(255)=null,@LedgerTypeCode bigint=null,
	@DeleteFlag nvarchar(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
	
		BEGIN TRANSACTION
		If @CurrentFlag = 'A'
			Begin
				INSERT INTO ACLedgerHeadMaster VALUES (@SrNo, @LedgerHead,@LedgerTypeCode, @DeleteFlag)
				Select @LedgerHeadCode=SCOPE_IDENTITY()
			End
		else
			Begin
				Update ACLedgerHeadMaster Set SrNo = @SrNo, LedgerHead = @LedgerHead, LedgerTypeCode = @LedgerTypeCode Where LedgerHeadCode=@LedgerHeadCode
			End

		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @LedgerHeadCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveACLedgerHeadNarrationMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveACLedgerHeadNarrationMaster] 
	@LedgerHeadNarrationCode bigint=null,@LedgerHeadNarration nvarchar(Max)=null,@LedgerHeadCode bigint=null, 
	@DeleteFlag char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
	
		BEGIN TRANSACTION
		If @CurrentFlag = 'A'
			Begin
				INSERT INTO ACLedgerHeadNarrationMaster VALUES (@LedgerHeadNarration,@LedgerHeadCode,@DeleteFlag)
				Select @LedgerHeadNarrationCode=SCOPE_IDENTITY()
			End
		else
			Begin
				Update ACLedgerHeadNarrationMaster Set LedgerHeadNarration = @LedgerHeadNarration, LedgerHeadCode = @LedgerHeadCode Where LedgerHeadNarrationCode=@LedgerHeadNarrationCode
			End

		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = @LedgerHeadNarrationCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveACPartyMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveACPartyMaster] 
	@TID bigint=null, @PartyCode bigint=null, @PartyName nvarchar(255)=null, @Address nvarchar(255)=null, @MobNo nvarchar(50)=null, @SchoolCode bigint=null, @PanNo nvarchar(50)=null, @SType nvarchar(50)=null, @DeleteFlag char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		if @PartyCode = 0 -- SrNoAuto Not Zero Means It's Edit Mode Then Previous Stock Deduct
		Begin
			SELECT @TempCode = coalesce(MAX(PartyCode),0)+1 FROM ACPartyMaster
			Set @PartyCode = @TempCode
			Set @TempCode = NULL
        End 

		BEGIN TRANSACTION
		If @CurrentFlag = 'A'
		Begin
			INSERT INTO ACPartyMaster (PartyCode,PartyName,Address,MobNo,PanNo,DeleteFlag) Values(@PartyCode,@PartyName,@Address,@MobNo,@PanNo,@DeleteFlag)
			Select @TID=SCOPE_IDENTITY()
		End
		else
		Begin
			Update ACPartyMaster Set PartyCode = @PartyCode, PartyName=@PartyName, Address = @Address, MobNo = @MobNo, PanNo = @PanNo Where TID = @TID
		End

		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @TID;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveACTempCashBookReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveACTempCashBookReport] 
	@SrNo int=null, @TDate datetime=null, @RLedgerHeadSeqNo int=null, @RRecordNo int=null, @RVoucherNo nvarchar(50)=null,@RVDate datetime=null, @RSrNoGroup int=null, @RSrNo int=null, @RLedgerHeadName nvarchar(255)=null, @RLedgerHeadNaration nvarchar(255)=null, @REntryType nvarchar(50)=null,@RInnerAmount numeric(18,2)=null,@RCashAmount numeric(18,2)=null, @RBankAmount numeric(18,2)=null,@RBank1Amount numeric(18,2)=null,
	@PLedgerHeadSeqNo int=null, @PRecordNo int=null, @PVoucherNo nvarchar(50)=null,@PVDate datetime=null, @PSrNoGroup int=null, @PSrNo int=null, @PLedgerHeadName nvarchar(255)=null, @PLedgerHeadNaration nvarchar(255)=null, @PEntryType nvarchar(255)=null,@PInnerAmount numeric(18,2)=null,@PCashAmount numeric(18,2)=null, @PBankAmount numeric(18,2)=null,@PBank1Amount numeric(18,2)=null,
	@RBank2Amount numeric(18,2)=null,@PBank2Amount numeric(18,2)=null,@RBankTAmount numeric(18,2)=null,@PBankTAmount numeric(18,2)=null,
	@RecordStatus nvarchar(1)=null	
AS

Begin
	SET NOCOUNT ON;
	BEGIN TRANSACTION
		if @RecordStatus = 'D'
			Begin
				Delete from ACTempCashBookReport
			End	
		Else if @RecordStatus = 'I'
			Begin
				INSERT INTO ACTempCashBookReport VALUES (@SrNo,@TDate,@RLedgerHeadSeqNo,@RRecordNo,@RVoucherNo,@RVDate,@RSrNoGroup,@RSrNo, @RLedgerHeadName,@RLedgerHeadNaration,@REntryType,@RInnerAmount,@RCashAmount,@RBankAmount,@RBank1Amount,@PLedgerHeadSeqNo,@PRecordNo,@PVoucherNo,@PVDate,@PSrNoGroup, @PSrNo, @PLedgerHeadName,@PLedgerHeadNaration,@PEntryType,@PInnerAmount,@PCashAmount,@PBankAmount,@PBank1Amount,@RBank2Amount,@PBank2Amount,@RBankTAmount,@PBankTAmount)
			End
		Else if @RecordStatus = 'U'
			Begin
				UPDATE ACTempCashBookReport SET PLedgerHeadSeqNo =@PLedgerHeadSeqNo, PRecordNo = @PRecordNo, PVoucherNo = @PVoucherNo, PVoucherDate = @PVDate, PSrNoGroup = @PSrNoGroup, PSrNo = @PSrNo, PLedgerHeadName = @PLedgerHeadName, PLedgerHeadNaration = @PLedgerHeadNaration, PEntryType = @PEntryType, PInnerAmount = @PInnerAmount, PCashAmount = @PCashAmount, PBankAmount = @PBankAmount, PBank1Amount = @PBank1Amount, RBank2Amount = @RBank2Amount, PBank2Amount = @PBank2Amount, RBankTAmount = @RBankTAmount, PBankTAmount = @PBankTAmount where SrNo = @SrNo And CONVERT(varchar,TDate,101) = CONVERT(varchar,@TDate,101)
			End 	
			
		COMMIT TRANSACTION
		SELECT 'SrNo' = @SrNo  -- Record Successfully Saved	 
		RETURN;  -- Record Successfully Saved
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveACTempFillAllDate]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- CREATE Used To CREATE A NEW Procedure
-- ALTER Used To Modify Procedure

CREATE PROCEDURE [dbo].[SP_SaveACTempFillAllDate]
	@AccountRegisterCode nvarchar(120)=0, @FyCode nvarchar(120)=0
AS

BEGIN
	SET NOCOUNT ON;
	BEGIN TRANSACTION

	Delete from ACTempDate
	INSERT INTO ACTempDate (TDate) SELECT DISTINCT CONVERT(varchar, VDate, 106) as VDate FROM ACVoucher WHERE (AccountRegisterCode = @AccountRegisterCode And FyCode = @FyCode) 

	SELECT Distinct TDate, CONVERT(varchar, TDate, 106) as VDate  FROM ACTempDate ORDER BY TDate

	COMMIT TRANSACTION
END
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveACVoucher]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveACVoucher] 
	@TID bigint=null, @AccountRegisterCode bigint=null, @MainClassCode  bigint=null, @VType nvarchar(50)=null, @VCode bigint=null,@VDate datetime=null,
	@VFlag nvarchar(50)=null, @VNo bigint=null,
	@Amount numeric(18,2)=null,  @PartyTID bigint=null, @PaymentTypeCode bigint=null, 
	@ChequeDate datetime=null, @LedgerHeadBankCode bigint=null, @LedgerHeadBankNarration nvarchar(255)=null, @UserCode bigint=null,@FyCode bigint=null,
	@CurrentFlag nvarchar(50)=null, @FilePath nvarchar(255)=null,
	
	@DetailRecordFlag nvarchar(1)=null, 
    @SrNo bigint=null,
    @LedgerHeadCode bigint=null,
    @LedgerHeadNarration nvarchar(255)=null,
	@AmountDetail numeric(18,2)=null,  
	@RecordStatus nvarchar(1)=null,
	@SyncFlag nvarchar(1)=null
	
AS

DECLARE @TempCode bigint
Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
			Begin
				INSERT INTO ACVoucher (MainClassCode,AccountRegisterCode,VType,VCode,VDate, VFlag, VNo, Amount, PartyTID, PaymentTypeCode, ChequeDate, LedgerHeadBankCode, LedgerHeadNarrationBank,  UserCode, FyCode, FilePath,SyncFlag) VALUES (@MainClassCode,@AccountRegisterCode ,@VType ,@VCode,@VDate,@VFlag,@VNo,@Amount,@PartyTID,@PaymentTypeCode, @ChequeDate,@LedgerHeadBankCode,@LedgerHeadBankNarration,@FilePath, @UserCode,@FyCode,@SyncFlag)
				--Get Latest Inserted ID
				Select @TID=SCOPE_IDENTITY()
			End
		else
			Begin
				Update ACVoucher Set MainClassCode = @MainClassCode, AccountRegisterCode = @AccountRegisterCode, VType = @VType, VCode=@VCode, VDate = @VDate, VFlag = @VFlag, VNo = @VNo, Amount = @Amount, PartyTID = @PartyTID, PaymentTypeCode = @PaymentTypeCode, ChequeDate = @ChequeDate, LedgerHeadBankCode = @LedgerHeadBankCode, LedgerHeadNarrationBank = @LedgerHeadBankNarration, FilePath = @FilePath, UserCode = @UserCode, FyCode = @FyCode,SyncFlag=@SyncFlag Where TID = @TID
			End

		if @DetailRecordFlag = 'Y'
		Begin
			if @srno <> 0 --SrNo Not Zero Means It's Edit Mode Then Previous Stock Deduct
			   Begin
				  Delete from ACVoucherDetail where TID=@TID And srno=@srno
               End 
			else
			   Begin				
				  SELECT @srno = coalesce(MAX(Srno),0)+1 FROM AcVoucherDetail(UPDLOCK) where TID=@TID				
			   End
			   
			INSERT INTO AcVoucherDetail VALUES (@TID,@srno,@LedgerHeadCode,@LedgerHeadNarration,@AmountDetail)
		End 

		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = @TID;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		  Begin
		   Delete from AcVoucher where TID=@TID
		   Delete from AcVoucherDetail where TID=@TID
		  End 
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveAge]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveAge] 
	@RegNo bigint=null, @MediumCode bigint=null, @Age30Sept nvarchar(120)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null


Begin
	SET NOCOUNT ON;
	BEGIN TRANSACTION
	
	Update StudInfoAll Set Age30Sept = @Age30Sept where MediumCode= @MediumCode And RegNo = @RegNo
	Update StudInfo Set Age30Sept = @Age30Sept where MediumCode= @MediumCode And RegNo = @RegNo
	
	COMMIT TRANSACTION
	
	SELECT 'ReturnStatus' = 0;

End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveAlterDaysDefineMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveAlterDaysDefineMaster] 
	@NoOfDays bigint=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		BEGIN TRANSACTION
		--Delete from AlterDaysDefineMaster where NoOfDays=@NoOfDays
		INSERT INTO AlterDaysDefineMaster VALUES (@NoOfDays)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @NoOfDays;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveAreaMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveAreaMaster] 
	@AreaCode bigint=null,@AreaName nvarchar(120)=null,@KM nvarchar(50)=0,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(AreaCode),0)+1 FROM AreaMaster(UPDLOCK)
			Set @AreaCode = @TempCode
			Set @TempCode = NULL
		End
	
		BEGIN TRANSACTION
		Delete from AreaMaster where AreaCode=@AreaCode
		INSERT INTO AreaMaster VALUES (@AreaCode,@AreaName,@KM,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @AreaCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveBankMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveBankMaster] 
	@BankCode bigint=null,@BankName nvarchar(120)=null, @IFSCCode nvarchar(50)=null, @DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(BankCode),0)+1 FROM BankMaster(UPDLOCK)
			Set @BankCode = @TempCode
			Set @TempCode = NULL
		End
		

		BEGIN TRANSACTION
		Delete from BankMaster where BankCode=@BankCode
		INSERT INTO BankMaster VALUES (@BankCode,@BankName,@IFSCCode,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @BankCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveBloodGroupMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveBloodGroupMaster] 
	@BloodGroupCode bigint=null,@BloodGroupName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(BloodGroupCode),0)+1 FROM BloodGroupMaster(UPDLOCK)
			Set @BloodGroupCode = @TempCode
			Set @TempCode = NULL
		End
		
		
		BEGIN TRANSACTION
		Delete from BloodGroupMaster where BloodGroupCode=@BloodGroupCode
		INSERT INTO BloodGroupMaster VALUES (@BloodGroupCode,@BloodGroupName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @BloodGroupCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveBonafiedCertificate]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveBonafiedCertificate] 
	@TID bigint=null,@MainClassCode bigint=null,@RecordNo bigint=null,
	@TDate datetime=null,@RegID bigint=null,
	@UserCode bigint=null,@AyCode bigint=null, @Ayear nvarchar(120)=null, @EducationStatus nvarchar(120)=null,
	@Purpose nvarchar(255)=null,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from BonafiedCertificate where TID=@TID
		INSERT INTO BonafiedCertificate VALUES (@TID,@MainClassCode,@RecordNo,@TDate, @RegID,@UserCode,@AyCode,@EducationStatus,@Ayear,@Purpose)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from BonafiedCertificate where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveBusFeesCollection]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveBusFeesCollection] 
	@ReceiptTID bigint=null,@MainClassCode bigint=null,@FeeCategoryCode bigint=null, @ReceiptNo bigint=null,
	@ReceiptDate datetime=null,@RegID bigint=null,@TotalFeesAmount numeric(18, 2)=0,@TotalDiscountAmt numeric(18, 2)=0,@CancelReceiptAmt numeric(18, 2)=0,
	@Remark nvarchar(255)=null, @CancelReceiptFlag char(1)=null, @PaymentTypeCode bigint=null,@BankName nvarchar(255)=null,@ChequeNo nvarchar(120)=null,@ChequeDate datetime=null,
	@BusCode bigint=0, @PrintFlag char(1)=null,
	@UserCode bigint=null,@AyCode bigint=null,@FyCode bigint=null,@PermanentDeleteFlag char(1)='N',
	@RecordStatus char(1)=null, @DeleteFlag char(50)=null, @SyncFlag char(50)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
			Begin
				INSERT INTO BusFeesCollection VALUES (@MainClassCode,@FeeCategoryCode,@ReceiptNo,@ReceiptDate, @RegID,@TotalFeesAmount,@TotalDiscountAmt,@CancelReceiptAmt, @Remark, @CancelReceiptFlag, @PaymentTypeCode,@BankName,@ChequeNo,@ChequeDate,@BusCode,@UserCode,@AyCode,@PrintFlag,@FyCode,@DeleteFlag,@SyncFlag)
				--Get Latest Inserted ID
				Select @ReceiptTID=SCOPE_IDENTITY()
			End
		else
			Begin
				Update BusFeesCollection Set MainClassCode = @MainClassCode, FeeCategoryCode = @FeeCategoryCode, ReceiptNo=@ReceiptNo, ReceiptDate = @ReceiptDate, RegID = @RegID, TotalFeesAmount = @TotalFeesAmount, TotalDiscountAmt = @TotalDiscountAmt, CancelReceiptAmt = @CancelReceiptAmt, Remark = @Remark, CancelReceiptFlag = @CancelReceiptFlag, PaymentTypeCode = @PaymentTypeCode, BankName = @BankName, ChequeNo = @ChequeNo, ChequeDate = @ChequeDate, BusCode = @BusCode, UserCode = @UserCode, AyCode = @AyCode, PrintFlag = @PrintFlag, FyCode = @FyCode, DeleteFlag = @DeleteFlag, SyncFlag = @SyncFlag Where ReceiptTID = @ReceiptTID
			End

		Delete from BusFeesCollectionDetail where ReceiptTID=@ReceiptTID

		Update StudInfo Set FeesPaidFlag = 'Y' where RegID = @RegID
		Update StudInfoAll Set FeesPaidFlag = 'Y' where RegID = @RegID

		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = @ReceiptTID;
		RETURN;  -- Record Successfully Saved
 	  End
	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		
		if (@PermanentDeleteFlag='Y')
		   Begin
			Delete from BusFeesCollection where ReceiptTID=@ReceiptTID
			Delete from BusFeesCollectionDetail where ReceiptTID=@ReceiptTID
		   End
		else
		   Begin   
			Update BusFeesCollection Set DeleteFlag = 'Y' where ReceiptTID=@ReceiptTID
		   End
		
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveBusFeeTitleMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveBusFeeTitleMaster] 
	@BusFeeTitleCode bigint=null,@SrNo bigint=null,@BusFeeTitleName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null,@BusFeeTitleShortName nvarchar(120)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(BusFeeTitleCode),0)+1 FROM BusFeeTitleMaster(UPDLOCK)
			Set @BusFeeTitleCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from BusFeeTitleMaster where BusFeeTitleCode=@BusFeeTitleCode
		INSERT INTO BusFeeTitleMaster VALUES (@BusFeeTitleCode,@SrNo, @BusFeeTitleName,@DeleteFlag,@BusFeeTitleShortName)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @BusFeeTitleCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveBusMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveBusMaster] 
	@BusCode bigint=null,@BusName nvarchar(255)=null,@DeleteFlag bit = 0,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(BusCode),0)+1 FROM BusMaster(UPDLOCK)
			Set @BusCode = @TempCode
			Set @TempCode = NULL
		End

		SELECT @TempCode = BusCode from BusMaster where BusCode <> @BusCode And BusName = @BusName 
		IF @TempCode IS Not NULL
		Begin
			SELECT 'ReturnStatus' = -1;
			RETURN;
		End 
		
		Delete from BusMaster where BusCode=@BusCode
		INSERT INTO BusMaster VALUES (@BusCode,@BusName,@DeleteFlag)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Update BusMaster Set DeleteFlag = 1 where BusCode = @BusCode
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCasteMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveCasteMaster] 
	@CasteCode bigint=null,@CasteName nvarchar(120)=null,@CasteNameEN nvarchar(120)=null,@CategoryCode bigint=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(CasteCode),0)+1 FROM CasteMaster(UPDLOCK)
			Set @CasteCode = @TempCode
			Set @TempCode = NULL
		End
		

		BEGIN TRANSACTION
		Delete from CasteMaster where CasteCode=@CasteCode
		INSERT INTO CasteMaster VALUES (@CasteCode,@CasteName,@CasteNameEN,@CategoryCode,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @CasteCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCasteValidationCertificate]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveCasteValidationCertificate] 
	@TID bigint=null,@MainClassCode bigint=null,@RecordNo bigint=null,
	@TDate datetime=null,@RegID bigint=null,@District nvarchar(120)=null,
	@UserCode bigint=null,@AyCode bigint=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from CasteValidationCertificate where TID=@TID
		INSERT INTO CasteValidationCertificate VALUES (@TID,@MainClassCode,@RecordNo,@TDate, @RegID,@UserCode,@AyCode,@District)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from CasteValidationCertificate where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCBSCDEGroupMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveCBSCDEGroupMaster] 
	@CBSCDEGroupCode bigint=null,@SrNo bigint=null,@CBSCDEGroupName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(CBSCDEGroupCode),0)+1 FROM CBSCDEGroupMaster(UPDLOCK)
			Set @CBSCDEGroupCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from CBSCDEGroupMaster where CBSCDEGroupCode=@CBSCDEGroupCode
		INSERT INTO CBSCDEGroupMaster VALUES (@CBSCDEGroupCode,@SrNo,@CBSCDEGroupName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @CBSCDEGroupCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCBSCDEMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveCBSCDEMaster] 
	@CBSCDECode bigint=null, @GradeCode bigint=null,@CBSCDETitleCode bigint=null,
	@SrNo bigint=null, @CBSCDEName nvarchar(Max)=null, @DeleteFlag bit = 0,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(CBSCDECode),0)+1 FROM CBSCDEMaster(UPDLOCK)
			Set @CBSCDECode = @TempCode
			Set @TempCode = NULL
		End

		--SELECT @TempCode = CBSCDECode from CBSCDEMaster where CBSCDECode <> @CBSCDECode And CBSCDEName = @CBSCDEName 
		--IF @TempCode IS Not NULL
		--Begin
		--	SELECT 'ReturnStatus' = -1;
		--	RETURN;
		--End 
		
		Delete from CBSCDEMaster where CBSCDECode=@CBSCDECode
		INSERT INTO CBSCDEMaster VALUES (@CBSCDECode,@SrNo, @CBSCDEName, @GradeCode, @CBSCDETitleCode, @DeleteFlag)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Update CBSCDEMaster Set DeleteFlag = 1 where CBSCDECode = @CBSCDECode
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCBSCDETitleGroupMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveCBSCDETitleGroupMaster] 
	@CBSCDETitleGroupCode bigint=null, @SrNo bigint=null,
	@CBSCDETitleGroupName nvarchar(Max)=null, @CBSCDEGroupCode bigint=null, @DeleteFlag bit = 0,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(CBSCDETitleGroupCode),0)+1 FROM CBSCDETitleGroupMaster(UPDLOCK)
			Set @CBSCDETitleGroupCode = @TempCode
			Set @TempCode = NULL
		End

		--SELECT @TempCode = CBSCDETitleGroupCode from CBSCDETitleGroupMaster where CBSCDETitleGroupCode <> @CBSCDETitleGroupCode AND CBSCDETitleGroupName = @CBSCDETitleGroupName 
		--IF @TempCode IS Not NULL
		--Begin
		--	SELECT 'ReturnStatus' = -1;
		--	RETURN;
		--End 
		
		Delete from CBSCDETitleGroupMaster where CBSCDETitleGroupCode=@CBSCDETitleGroupCode
		INSERT INTO CBSCDETitleGroupMaster VALUES (@CBSCDETitleGroupCode, @SrNo, @CBSCDETitleGroupName, @CBSCDEGroupCode, @DeleteFlag)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Update CBSCDETitleGroupMaster Set DeleteFlag = 1 where CBSCDETitleGroupCode = @CBSCDETitleGroupCode
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCBSCDETitleMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveCBSCDETitleMaster] 
	@CBSCDETitleCode bigint=null, @SrNo bigint=null,
	@CBSCDETitleName nvarchar(Max)=null, @CBSCDETitleGroupCode bigint=null, @DeleteFlag bit = 0,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(CBSCDETitleCode),0)+1 FROM CBSCDETitleMaster(UPDLOCK)
			Set @CBSCDETitleCode = @TempCode
			Set @TempCode = NULL
		End

		--SELECT @TempCode = CBSCDETitleCode from CBSCDETitleMaster where CBSCDETitleCode <> @CBSCDETitleCode AND CBSCDETitleName = @CBSCDETitleName 
		--IF @TempCode IS Not NULL
		--Begin
		--	SELECT 'ReturnStatus' = -1;
		--	RETURN;
		--End 
		
		Delete from CBSCDETitleMaster where CBSCDETitleCode=@CBSCDETitleCode
		INSERT INTO CBSCDETitleMaster VALUES (@CBSCDETitleCode, @SrNo, @CBSCDETitleName, @CBSCDETitleGroupCode, @DeleteFlag)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Update CBSCDETitleMaster Set DeleteFlag = 1 where CBSCDETitleCode = @CBSCDETitleCode
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCityMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveCityMaster] 
	@CityCode bigint=null,@CityName nvarchar(120)=null,@TalukaCode bigint=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(CityCode),0)+1 FROM CityMaster(UPDLOCK)
			Set @CityCode = @TempCode
			Set @TempCode = NULL
		End
		
		--BEGIN TRANSACTION
		Delete from CityMaster where CityCode=@CityCode
		INSERT INTO CityMaster VALUES (@CityCode,@CityName,@TalukaCode,@DeleteFlag)
		--COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @CityCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCityMasterTemp]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveCityMasterTemp] 
	@CityCode bigint=null,@CityName nvarchar(120)=null,@TalukaCode bigint=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(CityCode),0)+1 FROM CityMaster(UPDLOCK)
			Set @CityCode = @TempCode
			Set @TempCode = NULL
		End
		
		--BEGIN TRANSACTION
		Delete from CityMaster where CityCode=@CityCode
		INSERT INTO CityMaster VALUES (@CityCode,@CityName,@TalukaCode,@DeleteFlag)
		--COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @CityCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCountryMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create PROCEDURE [dbo].[SP_SaveCountryMaster] 
	@CountryCode bigint=null,@CountryName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(CountryCode),0)+1 FROM CountryMaster(UPDLOCK)
			Set @CountryCode = @TempCode
			Set @TempCode = NULL
		End

		BEGIN TRANSACTION
		Delete from CountryMaster where CountryCode=@CountryCode
		INSERT INTO CountryMaster VALUES (@CountryCode,@CountryName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @CountryCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCovid19DoseMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveCovid19DoseMaster] 
	@Covid19DoseCode bigint=null,@Covid19DoseName nvarchar(255)=null,@DeleteFlag bit = 0,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(Covid19DoseCode),0)+1 FROM Covid19DoseMaster(UPDLOCK)
			Set @Covid19DoseCode = @TempCode
			Set @TempCode = NULL
		End

		SELECT @TempCode = Covid19DoseCode from Covid19DoseMaster where Covid19DoseCode <> @Covid19DoseCode And Covid19DoseName = @Covid19DoseName 
		IF @TempCode IS Not NULL
		Begin
			SELECT 'ReturnStatus' = -1;
			RETURN;
		End 
		
		Delete from Covid19DoseMaster where Covid19DoseCode=@Covid19DoseCode
		INSERT INTO Covid19DoseMaster VALUES (@Covid19DoseCode,@Covid19DoseName,@DeleteFlag)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Update Covid19DoseMaster Set DeleteFlag = 1 where Covid19DoseCode = @Covid19DoseCode
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCRPSTeacherMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveCRPSTeacherMaster] 
	@CRPSTeacherCode bigint=null,@CRPSTeacherName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(CRPSTeacherCode),0)+1 FROM CRPSTeacherMaster(UPDLOCK)
			Set @CRPSTeacherCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from CRPSTeacherMaster where CRPSTeacherCode=@CRPSTeacherCode
		INSERT INTO CRPSTeacherMaster VALUES (@CRPSTeacherCode,@CRPSTeacherName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @CRPSTeacherCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveCRSubjectMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveCRSubjectMaster] 
	@CRSubjectCode bigint=null, @CRSubjectName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint
DECLARE @SrNo bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(CRSubjectCode),0)+1 FROM CRSubjectMaster(UPDLOCK)
			Set @CRSubjectCode = @TempCode
			Set @TempCode = NULL

			SELECT @SrNo = coalesce(MAX(SrNo),0)+1 FROM CRSubjectMaster Where CRSubjectCode>0
		End
		
		 
		BEGIN TRANSACTION
		Delete from CRSubjectMaster where CRSubjectCode=@CRSubjectCode
		INSERT INTO CRSubjectMaster VALUES (@CRSubjectCode,@Srno,@CRSubjectName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @CRSubjectCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDEMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveDEMaster] 
	@DECode bigint=null,@DEName nvarchar(255)=null,	@DETitleCode bigint=null, 
	@SrNo bigint=null, @DeleteFlag bit = 0,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(DECode),0)+1 FROM DEMaster(UPDLOCK)
			Set @DECode = @TempCode
			Set @TempCode = NULL
		End

		SELECT @TempCode = DECode from DEMaster where DECode <> @DECode AND DETitleCode = @DETitleCode And DEName = @DEName 
		IF @TempCode IS Not NULL
		Begin
			SELECT 'ReturnStatus' = -1;
			RETURN;
		End 
		
		Delete from DEMaster where DECode=@DECode
		INSERT INTO DEMaster VALUES (@DECode,@DETitleCode,@SrNo,@DEName,@DeleteFlag)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Update DEMaster Set DeleteFlag = 1 where DECode = @DECode
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDesignationMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveDesignationMaster] 
	@DesignationCode bigint=null,@DesignationName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(DesignationCode),0)+1 FROM DesignationMaster(UPDLOCK)
			Set @DesignationCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from DesignationMaster where DesignationCode=@DesignationCode
		INSERT INTO DesignationMaster VALUES (@DesignationCode,@DesignationName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @DesignationCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDETitleMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveDETitleMaster] 
	@DETitleCode bigint=null,@DETitleName nvarchar(255)=null,@DeleteFlag bit = 0,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(DETitleCode),0)+1 FROM DETitleMaster(UPDLOCK)
			Set @DETitleCode = @TempCode
			Set @TempCode = NULL
		End

		SELECT @TempCode = DETitleCode from DETitleMaster where DETitleCode <> @DETitleCode And DETitleName = @DETitleName 
		IF @TempCode IS Not NULL
		Begin
			SELECT 'ReturnStatus' = -1;
			RETURN;
		End 
		
		Delete from DETitleMaster where DETitleCode=@DETitleCode
		INSERT INTO DETitleMaster VALUES (@DETitleCode,@DETitleName,@DeleteFlag)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Update DETitleMaster Set DeleteFlag = 1 where DETitleCode = @DETitleCode
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDistrictMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveDistrictMaster] 
	@DistrictCode bigint=null,@DistrictName nvarchar(120)=null,@StateCode bigint=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(DistrictCode),0)+1 FROM DistrictMaster(UPDLOCK)
			Set @DistrictCode = @TempCode
			Set @TempCode = NULL
		End

		BEGIN TRANSACTION
		Delete from DistrictMaster where DistrictCode=@DistrictCode
		INSERT INTO DistrictMaster VALUES (@DistrictCode,@DistrictName,@StateCode,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @DistrictCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDivisionMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveDivisionMaster] 
	@DivisionCode bigint=null,@DivisionName nvarchar(120)=null,@DivisionNameEN nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(DivisionCode),0)+1 FROM DivisionMaster(UPDLOCK)
			Set @DivisionCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from DivisionMaster where DivisionCode=@DivisionCode
		INSERT INTO DivisionMaster VALUES (@DivisionCode,@DivisionName,@DivisionNameEN,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @DivisionCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDocumentMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveDocumentMaster] 
	@DocumentCode bigint=null,@DocumentName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(DocumentCode),0)+1 FROM DocumentMaster(UPDLOCK)
			Set @DocumentCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from DocumentMaster where DocumentCode=@DocumentCode
		INSERT INTO DocumentMaster VALUES (@DocumentCode,@DocumentName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @DocumentCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDREntry]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveDREntry] 
	@TID bigint=null,@MainClassCode bigint=null,@ReceiptNo bigint=null,
	@RDate datetime=null,@DRHeadCode bigint=null,
	@DonorName nvarchar(120)=null,@Address nvarchar(120)=null,
	@Amount numeric(18, 0)=null,
	@Remark nvarchar(255)=null,@RegID bigint=null,
	@UserCode bigint=null,@AyCode bigint=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from DREntry where TID=@TID
		INSERT INTO DREntry VALUES (@TID,@MainClassCode,@ReceiptNo,@RDate,@DRHeadCode, @DonorName,@Address,@Amount,@Remark,@RegID,@UserCode,@AyCode)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from DREntry where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveDRHeadMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveDRHeadMaster] 
	@DRHeadCode bigint=null,@DRHeadName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(DRHeadCode),0)+1 FROM DRHeadMaster(UPDLOCK)
			Set @DRHeadCode = @TempCode
			Set @TempCode = NULL
		End
		
		 
		BEGIN TRANSACTION
		Delete from DRHeadMaster where DRHeadCode=@DRHeadCode
		INSERT INTO DRHeadMaster VALUES (@DRHeadCode,@DRHeadName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @DRHeadCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveEducationMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveEducationMaster] 
	@EducationCode bigint=null,@EducationName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(EducationCode),0)+1 FROM EducationMaster(UPDLOCK)
			Set @EducationCode = @TempCode
			Set @TempCode = NULL
		End

		BEGIN TRANSACTION
		Delete from EducationMaster where EducationCode=@EducationCode
		INSERT INTO EducationMaster VALUES (@EducationCode,@EducationName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @EducationCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveEmpDocumentMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveEmpDocumentMaster] 
	@EmpDocumentCode bigint=null,@EmpDocumentName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(EmpDocumentCode),0)+1 FROM EmpDocumentMaster(UPDLOCK)
			Set @EmpDocumentCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from EmpDocumentMaster where EmpDocumentCode=@EmpDocumentCode
		INSERT INTO EmpDocumentMaster VALUES (@EmpDocumentCode,@EmpDocumentName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @EmpDocumentCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveEmpMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveEmpMaster] 
	@TID bigint=null,@MainClassCode bigint=null,@RecordNo bigint=null,
	@EmpTypeCode bigint=null, @SrNo bigint=null, @ScaleOfPay nvarchar(120)=null,
	@Firstname nvarchar(120)=null,@MiddleName nvarchar(120)=null,@LastName nvarchar(120)=null,
	@FirstnameEN nvarchar(120)=null,@MiddleNameEN nvarchar(120)=null,@LastNameEN nvarchar(120)=null,
	@PermanentAddress nvarchar(255)=null,@PerCitycode bigint=null, 
	@LocalAddress nvarchar(255)=null,@LocCitycode bigint=null,
	@MobileNo1 nvarchar(50)=null, @MobileNo2 nvarchar(50)=null,
	@BloodGroup nvarchar(50)=null, @CasteCode bigint=null, @ReligionCode bigint=null, @CategoryCode bigint=null,
	@BirthPlaceCode as bigint=null, @GenderCode bigint=null,
	@Dob datetime=null, @TeachingSubject nvarchar(255)=null, @TeachingClass nvarchar(255)=null,
	@SQualification nvarchar(50)=null, @BQualification nvarchar(50)=null, @PassingYear nvarchar(50)=null, 
	@VMANoandDate nvarchar(255)=null,@DoWS datetime=null,
	@DesignationCode bigint=null, @BankCode bigint=null, @BranchName nvarchar(120)=null,  
	@BankAcNo nvarchar(120)=null, @Photpath nvarchar(120)=null,   
	@AdharCardNo nvarchar(120)=null, @ShalarthID nvarchar(120)=null, @GPFOrDCPSNo nvarchar(120)=null,
	@PanNo nvarchar(120)=null, @LICNo nvarchar(120)=null,
	@AddressITR nvarchar(255)=null, @CityITR nvarchar(120)=null,
	@PinNoITR nvarchar(120)=null, @BankNameITR nvarchar(120)=null,
	@BankBranchITR nvarchar(120)=null, @IFSCCodeITR nvarchar(120)=null,
	@BankAcNoITR nvarchar(120)=null, @EmailIDITR nvarchar(120)=null,
	@MobileNoITR nvarchar(120)=null, @ITRPassword nvarchar(120)=null, 
	@AadharLinkStatus char(1)=null,
	@ClassTeacherShortName nvarchar(120)=null, 
	@BankCode2 bigint=null, @BranchName2 nvarchar(120)=null, @BankAcNo2 nvarchar(120)=null,
	@BankCode3 bigint=null, @BranchName3 nvarchar(120)=null, @BankAcNo3 nvarchar(120)=null,
	@BankCodeRD bigint=null, @BranchNameRD nvarchar(120)=null, @BankAcNoRD nvarchar(120)=null,
	@BankCodeSociety bigint=null, @BranchNameSociety nvarchar(120)=null, @BankAcNoSociety nvarchar(120)=null,
	@Remark nvarchar(255)=null, @DeleteFlag bit = 0,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null,@JoiningDate datetime=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from EmpMaster where TID=@TID
		INSERT INTO EmpMaster VALUES (@TID,@MainClassCode,@RecordNo,@EmpTypeCode, @SrNo, @ScaleOfPay,@Firstname, @MiddleName, @LastName, @FirstnameEN, @MiddleNameEN, @LastNameEN, @PermanentAddress,@PerCitycode,@LocalAddress,@LocCitycode,@MobileNo1,@MobileNo2,@BloodGroup,@CasteCode,@ReligionCode, @CategoryCode,@BirthPlaceCode,@GenderCode,@Dob,@TeachingSubject,@TeachingClass,@SQualification,@BQualification,@PassingYear,@VMANoandDate,@DoWS,@DesignationCode,@BankCode,@BranchName,@BankAcNo,@Photpath,@AdharCardNo, @ShalarthID, @GPFOrDCPSNo,@PanNo, @LICNo, @ClassTeacherShortName, @DeleteFlag,@JoiningDate,@AddressITR,@CityITR,@PinNoITR,@BankNameITR ,@BankBranchITR ,@IFSCCodeITR,@BankAcNoITR, @EmailIDITR,@MobileNoITR, @ITRPassword,@AadharLinkStatus,@BankCode2,@BranchName2,@BankAcNo2,@BankCode3,@BranchName3,@BankAcNo3,@BankCodeRD,@BranchNameRD,@BankAcNoRD,@BankCodeSociety,@BranchNameSociety,@BankAcNoSociety)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from StudentNirgamUtara where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveEmpMonthlySalary]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveEmpMonthlySalary] 
	@TID bigint=null,@MainClassCode bigint=null,@RecordNo bigint=null,@EmpTypeCode bigint=null, 
	@TMDate datetime=null,@ReportName nvarchar(120)=null,
	@CDTTitle1 nvarchar(50)=null,@CDTTitle1Count nvarchar(50)=null,
	@CDTTitle2 nvarchar(50)=null,@CDTTitle2Count nvarchar(50)=null,
	@CDTTitle3 nvarchar(50)=null,@CDTTitle3Count nvarchar(50)=null,
	@CDTTitle4 nvarchar(50)=null,@CDTTitle4Count nvarchar(50)=null,
	@RecoveryAdjusted numeric(18, 0)=0,@RefundOfBalance numeric(18, 0)=0,
	@GrossAmount numeric(18, 0)=0,@NetAmount numeric(18, 0)=0,
	@Remark nvarchar(255)=null,@FyCode bigint=null,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(TID),0)+1 FROM EmpMonthlySalary(UPDLOCK)
			Set @TID = @TempCode
			Set @TempCode = NULL
		End

		Delete from EmpMonthlySalaryDetail where TID=@TID

		Delete from EmpMonthlySalary where TID=@TID
		INSERT INTO EmpMonthlySalary VALUES (@TID,@MainClassCode,@RecordNo,@EmpTypeCode, @TMDate,@ReportName,@CDTTitle1,@CDTTitle1Count,@CDTTitle2,@CDTTitle2Count,@CDTTitle3,@CDTTitle3Count,@CDTTitle4,@CDTTitle4Count,@RecoveryAdjusted, @RefundOfBalance, @Remark, @FyCode,@GrossAmount,@NetAmount)

		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = @TID;
		RETURN;  -- Record Successfully Saved
 	  End
	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from EmpMonthlySalary where TID=@TID
		Delete from EmpMonthlySalaryDetail where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveEmpTypeMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveEmpTypeMaster] 
	@EmpTypeCode bigint=null,@EmpTypeName nvarchar(120)=null,
	@CDTTitle1 nvarchar(50)=null,@CDTTitle1Count nvarchar(50)=null,
	@CDTTitle2 nvarchar(50)=null,@CDTTitle2Count nvarchar(50)=null,
	@CDTTitle3 nvarchar(50)=null,@CDTTitle3Count nvarchar(50)=null,
	@CDTTitle4 nvarchar(50)=null,@CDTTitle4Count nvarchar(50)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(EmpTypeCode),0)+1 FROM EmpTypeMaster(UPDLOCK)
			Set @EmpTypeCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from EmpTypeMaster where EmpTypeCode=@EmpTypeCode
		INSERT INTO EmpTypeMaster VALUES (@EmpTypeCode,@EmpTypeName, @DeleteFlag,@CDTTitle1, @CDTTitle1Count,@CDTTitle2, @CDTTitle2Count,@CDTTitle3, @CDTTitle3Count,@CDTTitle4, @CDTTitle4Count)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @EmpTypeCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveExamAdmitCard]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveExamAdmitCard] 
	@TID bigint=null, @ClassCode bigint=null,@ExamCode bigint=null,@DivisionCode bigint=null,
	@SrNo bigint=null,@SubjectCode bigint=null,@ExamDate datetime=null,@FromTime datetime=null,@ToTime datetime=null,
	@Note nvarchar(Max)=null, @Syllabus nvarchar(Max)=null, @RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(TID),0)+1 FROM ExamAdmitCard(UPDLOCK)
			Set @TID = @TempCode
			Set @TempCode = NULL
		End

		--SELECT @TempCode = TID from ExamAdmitCard where TID <> @TID AND ClassCode = @ClassCode And DivisionCode = @DivisionCode And ExamCode = @ExamCode And SubjectCode = @SubjectCode 
		--IF @TempCode IS Not NULL
		--Begin
		--	SELECT 'ReturnStatus' = -1;
		--	RETURN;
		--End 
		
		Delete from ExamAdmitCard where TID=@TID
		INSERT INTO ExamAdmitCard VALUES (@TID, @ClassCode,@ExamCode,@SrNo, @SubjectCode,@ExamDate, @FromTime,@ToTime,@Note,@Syllabus,@DivisionCode)
		Update ExamAdmitCard Set Note = @Note where ExamCode=@ExamCode And ClassCode=@ClassCode And DivisionCode = @DivisionCode
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from ExamAdmitCard where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveExamMarksDefine]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveExamMarksDefine] 
	@TID bigint=null, @ClassCode bigint=null,@ExamGroupCode bigint=null,
	@SubjectCode bigint=null,@ExamMarksTypeCode bigint=null,@SrNo bigint=null,
	@MinMarks numeric(18, 2)=0, @MaxMarks numeric(18, 2)=0, @DivideMarks numeric(18, 2)=0, @MarksAddInTotalFlag char(1)=null,
	@ST1Marks1 nvarchar(50)=null,@ST1Marks2 nvarchar(50)=null,@ST1Marks3 nvarchar(50)=null,@ST1Marks4 nvarchar(50)=null,
	@ST1Marks5 nvarchar(50)=null,@ST1Marks6 nvarchar(50)=null,@ST1Marks7 nvarchar(50)=null,
	@ST1MarksTotal nvarchar(50)=null,@ST2MarksTotal nvarchar(50)=null,@ST3MarksTotal nvarchar(50)=null,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(TID),0)+1 FROM ExamMarksDefine(UPDLOCK)
			Set @TID = @TempCode
			Set @TempCode = NULL
		End

		SELECT @TempCode = TID from ExamMarksDefine where TID <> @TID AND ClassCode = @ClassCode And SubjectCode = @SubjectCode And ExamGroupCode = @ExamGroupCode
		IF @TempCode IS Not NULL
		Begin
			SELECT 'ReturnStatus' = -1;
			RETURN;
		End 

		SELECT @TempCode = TID from ExamMarksDefine where TID <> @TID AND ClassCode = @ClassCode And SrNo = @SrNo And ExamGroupCode = @ExamGroupCode
		IF @TempCode IS Not NULL
		Begin
			SELECT 'ReturnStatus' = -1;
			RETURN;
		End 
		
		Delete from ExamMarksDefine where TID=@TID
		INSERT INTO ExamMarksDefine VALUES (@TID, @ClassCode,@ExamGroupCode,@SrNo, @SubjectCode, @ExamMarksTypeCode,@MinMarks,@MaxMarks,@DivideMarks,@MarksAddInTotalFlag,@ST1Marks1,@ST1Marks2,@ST1Marks3,@ST1Marks4,@ST1Marks5,@ST1Marks6,@ST1Marks7,@ST1MarksTotal,@ST2MarksTotal,@ST3MarksTotal)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from ExamMarksDefine where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveExamMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveExamMaster] 
	@ExamCode bigint=null,@ExamName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(ExamCode),0)+1 FROM ExamMaster(UPDLOCK)
			Set @ExamCode = @TempCode
			Set @TempCode = NULL
		End
	
		BEGIN TRANSACTION
		Delete from ExamMaster where ExamCode=@ExamCode
		INSERT INTO ExamMaster VALUES (@ExamCode,@ExamName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @ExamCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeDefine]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveFeeDefine] 
	@FDTID bigint=null, @MediumCode bigint=null,@ClassCode bigint=null,@FeeTypeCode bigint=null,
	@FeeTitleCode bigint=null,@FeeInstallementCode bigint=null,@SrNo bigint=null,
	@FeeAmount numeric(18, 2)=0,@AyCode bigint=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(FDTID),0)+1 FROM FeesDefine(UPDLOCK)
			Set @FDTID = @TempCode
			Set @TempCode = NULL
		End

		SELECT @TempCode = FDTID from FeesDefine where FDTID <> @FDTID AND AyCode = @AyCode AND MediumCode = @MediumCode And ClassCode = @ClassCode And FeeTypeCode = @FeeTypeCode And FeeTitleCode = @FeeTitleCode
		IF @TempCode IS Not NULL
		Begin
			Set @FDTID = @TempCode
			--SELECT 'ReturnStatus' = -1;
			--RETURN;
		End 

		Delete from FeesDefine where FDTID=@FDTID
		INSERT INTO FeesDefine VALUES (@FDTID, @MediumCode,@ClassCode,@FeeTypeCode,@SrNo, @FeeTitleCode,@FeeInstallementCode, @FeeAmount, @AyCode)

		-- Opening Balance
		Set @TempCode = NULL
		SELECT @TempCode = FDTID from FeesDefine where AyCode = @AyCode And MediumCode = @MediumCode And ClassCode = @ClassCode And FeeTypeCode = @FeeTypeCode And FeeTitleCode = -1
		IF @TempCode IS NULL
		Begin
			SELECT @TempCode = coalesce(MAX(FDTID),0)+1 FROM FeesDefine(UPDLOCK)
			Set @FDTID = @TempCode
			INSERT INTO FeesDefine VALUES (@FDTID, @MediumCode,@ClassCode,@FeeTypeCode,-1, -1,2, 0, @AyCode)
		End 

		-- Advance 
		Set @TempCode = NULL
		SELECT @TempCode = FDTID from FeesDefine where AyCode = @AyCode And MediumCode = @MediumCode And ClassCode = @ClassCode And FeeTypeCode = @FeeTypeCode And FeeTitleCode = -2
		IF @TempCode IS NULL
		Begin
			SELECT @TempCode = coalesce(MAX(FDTID),0)+1 FROM FeesDefine(UPDLOCK)
			Set @FDTID = @TempCode
			INSERT INTO FeesDefine VALUES (@FDTID, @MediumCode,@ClassCode,@FeeTypeCode,-2, -2,2, 0,@AyCode)
		End 

		-- Bus Fees
		Set @TempCode = NULL
		SELECT @TempCode = FDTID from FeesDefine where AyCode = @AyCode And MediumCode = @MediumCode And ClassCode = @ClassCode And FeeTypeCode = @FeeTypeCode And FeeTitleCode = -3
		IF @TempCode IS NULL
		Begin
			SELECT @TempCode = coalesce(MAX(FDTID),0)+1 FROM FeesDefine(UPDLOCK)
			Set @FDTID = @TempCode
			INSERT INTO FeesDefine VALUES (@FDTID, @MediumCode,@ClassCode,@FeeTypeCode,-3, -3,2, 0,@AyCode)
		End 
		
		-- Tution Fees
		Set @TempCode = NULL
		SELECT @TempCode = FDTID from FeesDefine where AyCode = @AyCode And MediumCode = @MediumCode And ClassCode = @ClassCode And FeeTypeCode = @FeeTypeCode And FeeTitleCode = -4
		IF @TempCode IS NULL
		Begin
			SELECT @TempCode = coalesce(MAX(FDTID),0)+1 FROM FeesDefine(UPDLOCK)
			Set @FDTID = @TempCode
			INSERT INTO FeesDefine VALUES (@FDTID, @MediumCode,@ClassCode,@FeeTypeCode,-4, -4,2, 0, @AyCode)
		End 

		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from FeesDefine where FDTID=@FDTID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeDefineOther]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveFeeDefineOther] 
	@FDTID bigint=null, @ClassCode bigint=null,@FeeTitleOtherGroupCode bigint=null,
	@FeeTitleOtherCode bigint=null,@SrNo bigint=null,
	@FeeAmount numeric(18, 2)=0,@AyCode bigint=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(FDTID),0)+1 FROM FeesDefineOther(UPDLOCK)
			Set @FDTID = @TempCode
			Set @TempCode = NULL
		End

		SELECT @TempCode = FDTID from FeesDefineOther where FDTID <> @FDTID AND AyCode = @AyCode And ClassCode = @ClassCode And FeeTitleOtherGroupCode = @FeeTitleOtherGroupCode And FeeTitleOtherCode = @FeeTitleOtherCode
		IF @TempCode IS Not NULL
		Begin
			Set @FDTID = @TempCode
		End 
		
		Delete from FeesDefineOther where FDTID=@FDTID
		INSERT INTO FeesDefineOther VALUES (@FDTID, @ClassCode,@FeeTitleOtherGroupCode,@SrNo, @FeeTitleOtherCode, @FeeAmount, @AyCode)

		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from FeesDefineOther where FDTID=@FDTID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeesAlertDefine]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveFeesAlertDefine] 
	@RegID bigint=null, @AlertDate datetime=null, @Remark nvarchar(120)=null,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		Delete from FeesAlertDefine where RegID=@RegID
		INSERT INTO FeesAlertDefine VALUES (@RegID, @AlertDate,@Remark)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from FeesAlertDefine where RegID=@RegID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeesCollection]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveFeesCollection] 
	@ReceiptTID bigint=null,@MainClassCode bigint=null,@FeeCategoryCode bigint=null, @ReceiptNo bigint=null,
	@ReceiptDate datetime=null,@RegID bigint=null,@TotalFeesAmount numeric(18, 2)=0,@TotalDiscountAmt numeric(18, 2)=0,@CancelReceiptAmt numeric(18, 2)=0,
	@Remark nvarchar(255)=null, @CancelReceiptFlag char(1)=null, @PaymentTypeCode bigint=null,@BankName nvarchar(255)=null,@ChequeNo nvarchar(120)=null,@ChequeDate datetime=null,
	@BusCode bigint=0, @PrintFlag char(1)=null,
	@UserCode bigint=null,@AyCode bigint=null,@FyCode bigint=null,@PermanentDeleteFlag char(1)='N',
	@RecordStatus char(1)=null, @DeleteFlag char(50)=null, @SyncFlag char(50)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
			Begin
				INSERT INTO FeesCollection VALUES (@MainClassCode,@FeeCategoryCode,@ReceiptNo,@ReceiptDate, @RegID,@TotalFeesAmount,@TotalDiscountAmt,@CancelReceiptAmt, @Remark, @CancelReceiptFlag, @PaymentTypeCode,@BankName,@ChequeNo,@ChequeDate,@BusCode,@UserCode,@AyCode,@PrintFlag,@FyCode,@DeleteFlag,@SyncFlag)
				--Get Latest Inserted ID
				Select @ReceiptTID=SCOPE_IDENTITY()
			End
		else
			Begin
				Update FeesCollection Set MainClassCode = @MainClassCode, FeeCategoryCode = @FeeCategoryCode, ReceiptNo=@ReceiptNo, ReceiptDate = @ReceiptDate, RegID = @RegID, TotalFeesAmount = @TotalFeesAmount, TotalDiscountAmt = @TotalDiscountAmt, CancelReceiptAmt = @CancelReceiptAmt, Remark = @Remark, CancelReceiptFlag = @CancelReceiptFlag, PaymentTypeCode = @PaymentTypeCode, BankName = @BankName, ChequeNo = @ChequeNo, ChequeDate = @ChequeDate, BusCode = @BusCode, UserCode = @UserCode, AyCode = @AyCode, PrintFlag = @PrintFlag, FyCode = @FyCode, DeleteFlag = @DeleteFlag, SyncFlag = @SyncFlag Where ReceiptTID = @ReceiptTID
			End

		--INSERT INTO FeesCollection VALUES (@ReceiptTID,@MainClassCode,@FeeCategoryCode,@ReceiptNo,@ReceiptDate, @RegID,@TotalFeesAmount,@TotalDiscountAmt,@CancelReceiptAmt, @Remark, @CancelReceiptFlag, @PaymentTypeCode,@BankName,@ChequeNo,@ChequeDate,@BusCode,@UserCode,@AyCode,@PrintFlag,@FyCode,@DeleteFlag,@SyncFlag)
		Delete from FeesCollectionDetail where ReceiptTID=@ReceiptTID
		
		Update StudInfo Set FeesPaidFlag = 'Y' where RegID = @RegID
		Update StudInfoAll Set FeesPaidFlag = 'Y' where RegID = @RegID
		Update StudInfoYearly Set FeesPaidFlag = 'Y' where RegID = @RegID And AyCode = @AyCode

		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = @ReceiptTID;
		RETURN;  -- Record Successfully Saved
 	  End
	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		
		if (@PermanentDeleteFlag='Y')
		   Begin
			Delete from FeesCollection where ReceiptTID=@ReceiptTID
			Delete from FeesCollectionDetail where ReceiptTID=@ReceiptTID
		   End
		else
		   Begin   
			Update FeesCollection Set DeleteFlag = 'Y' where ReceiptTID=@ReceiptTID
		   End

		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeesCollectionOther]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveFeesCollectionOther] 
	@ReceiptTID bigint=null,@MainClassCode bigint=null,@FeeCategoryCode bigint=null, @ReceiptNo bigint=null,
	@ReceiptDate datetime=null,@RegID bigint=null,@TotalFeesAmount numeric(18, 2)=0,@CancelReceiptAmt numeric(18, 2)=0,
	@Remark nvarchar(255)=null, @CancelReceiptFlag char(1)=null, @PaymentTypeCode bigint=null,@BankName nvarchar(255)=null,@ChequeNo nvarchar(120)=null,@ChequeDate datetime=null,
	@BusCode bigint=0,@StudentName nvarchar(120)=null,@ClassCode bigint=null,@RegNo bigint=null,@OtherFeesGroupCode bigint=null,
	@UserCode bigint=null,@AyCode bigint=null, @PrintFlag char(1)=null,@FyCode bigint=null,@PermanentDeleteFlag char(1)='N',
	@RecordStatus char(1)=null, @DeleteFlag char(50)=null, @SyncFlag char(50)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
			Begin
				INSERT INTO FeesCollectionOther VALUES (@MainClassCode,@FeeCategoryCode,@ReceiptNo,@ReceiptDate, @TotalFeesAmount,@CancelReceiptAmt, @Remark, @CancelReceiptFlag, @PaymentTypeCode,@BankName,@ChequeNo,@ChequeDate,@BusCode,@UserCode,@AyCode,@StudentName,@ClassCode,@RegNo,@PrintFlag,@OtherFeesGroupCode,@FyCode,@DeleteFlag,@SyncFlag)
				--Get Latest Inserted ID
				Select @ReceiptTID=SCOPE_IDENTITY()
			End
		else
			Begin
				Update FeesCollectionOther Set MainClassCode = @MainClassCode, FeeCategoryCode = @FeeCategoryCode, ReceiptNo=@ReceiptNo, ReceiptDate = @ReceiptDate, TotalFeesAmount = @TotalFeesAmount,  CancelReceiptAmt = @CancelReceiptAmt, Remark = @Remark, CancelReceiptFlag = @CancelReceiptFlag, PaymentTypeCode = @PaymentTypeCode, BankName = @BankName, ChequeNo = @ChequeNo, ChequeDate = @ChequeDate, BusCode = @BusCode, UserCode = @UserCode, AyCode = @AyCode, StudentName = @StudentName, ClassCode = @ClassCode, RegNo = @RegNo, PrintFlag = @PrintFlag, FeeTitleOtherGroupCode = @OtherFeesGroupCode, FyCode = @FyCode, DeleteFlag = @DeleteFlag, SyncFlag = @SyncFlag Where ReceiptTID = @ReceiptTID
			End

		--Delete from FeesCollectionOther where ReceiptTID=@ReceiptTID
		--INSERT INTO FeesCollectionOther VALUES (@ReceiptTID,@MainClassCode,@FeeCategoryCode,@ReceiptNo,@ReceiptDate, @TotalFeesAmount,@CancelReceiptAmt, @Remark, @CancelReceiptFlag, @PaymentTypeCode,@BankName,@ChequeNo,@ChequeDate,@BusCode,@UserCode,@AyCode,@StudentName,@ClassCode,@RegNo,@PrintFlag,@OtherFeesGroupCode,@FyCode,@DeleteFlag,@SyncFlag)
		
		Delete from FeesCollectionOtherDetail where ReceiptTID=@ReceiptTID

		Update StudInfo Set FeesPaidFlag = 'Y' where RegID = @RegID
		Update StudInfoAll Set FeesPaidFlag = 'Y' where RegID = @RegID

		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = @ReceiptTID;
		RETURN;  -- Record Successfully Saved
 	  End
	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		
		if (@PermanentDeleteFlag='Y')
		   Begin
			Delete from FeesCollectionOther where ReceiptTID=@ReceiptTID
			Delete from FeesCollectionOtherDetail where ReceiptTID=@ReceiptTID
		   End
		else
		   Begin   
			Update FeesCollectionOther Set DeleteFlag = 'Y' where ReceiptTID=@ReceiptTID
		   End
		
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeesCollectionRegular]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveFeesCollectionRegular] 
	@ReceiptTID bigint=null,@MainClassCode bigint=null,@FeeCategoryCode bigint=null, @ReceiptNo bigint=null,
	@ReceiptDate datetime=null,@RegID bigint=null,@TotalFeesAmount numeric(18, 2)=0,@TotalDiscountAmt numeric(18, 2)=0,@CancelReceiptAmt numeric(18, 2)=0,
	@Remark nvarchar(255)=null, @CancelReceiptFlag char(1)=null, @PaymentTypeCode bigint=null,@BankName nvarchar(255)=null,@ChequeNo nvarchar(120)=null,@ChequeDate datetime=null,
	@PrintFlag char(1)=null,
	@UserCode bigint=null,@AyCode bigint=null,@FyCode bigint=null,
	@RecordStatus char(1)=null, @DeleteFlag char(50)=null, @SyncFlag char(50)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(ReceiptTID),0)+1 FROM FeesCollectionRegular(UPDLOCK)
			Set @ReceiptTID = @TempCode
			Set @TempCode = NULL
		End

		Delete from FeesCollectionRegular where ReceiptTID=@ReceiptTID
		Delete from FeesCollectionRegularDetail where ReceiptTID=@ReceiptTID
		INSERT INTO FeesCollectionRegular VALUES (@ReceiptTID,@MainClassCode,@FeeCategoryCode,@ReceiptNo,@ReceiptDate, @RegID,@TotalFeesAmount,@TotalDiscountAmt,@CancelReceiptAmt, @Remark, @CancelReceiptFlag, @PaymentTypeCode,@BankName,@ChequeNo,@ChequeDate,@UserCode,@AyCode,@PrintFlag,@FyCode,@DeleteFlag,@SyncFlag)

		Update StudInfo Set FeesPaidFlag = 'Y' where RegID = @RegID
		Update StudInfoAll Set FeesPaidFlag = 'Y' where RegID = @RegID

		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = @ReceiptTID;
		RETURN;  -- Record Successfully Saved
 	  End
	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		--Delete from FeesCollectionRegular where ReceiptTID=@ReceiptTID
		--Delete from FeesCollectionRegularDetail where ReceiptTID=@ReceiptTID
		Update FeesCollectionRegular Set DeleteFlag = 'Y' where ReceiptTID=@ReceiptTID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeTitleMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveFeeTitleMaster] 
	@FeeTitleCode bigint=null,@FeeTitleName nvarchar(120)=null,@SrNo bigint=null,@FeesCertificateDisplayFlag nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null,@FeeTitleShortCode bigint=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(FeeTitleCode),0)+1 FROM FeeTitleMaster(UPDLOCK)
			Set @FeeTitleCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from FeeTitleMaster where FeeTitleCode=@FeeTitleCode
		INSERT INTO FeeTitleMaster VALUES (@FeeTitleCode,@FeeTitleName,@DeleteFlag,@SrNo,@FeesCertificateDisplayFlag,@FeeTitleShortCode)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @FeeTitleCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeTitleOtherGroupMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveFeeTitleOtherGroupMaster] 
	@FeeTitleOtherGroupCode bigint=null,@SrNo bigint=null,@FeeTitleOtherGroupName nvarchar(120)=null,
	@FeeTitleOtherMainGroupCode bigint=null,@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(FeeTitleOtherGroupCode),0)+1 FROM FeeTitleOtherGroupMaster(UPDLOCK)
			Set @FeeTitleOtherGroupCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from FeeTitleOtherGroupMaster where FeeTitleOtherGroupCode=@FeeTitleOtherGroupCode
		INSERT INTO FeeTitleOtherGroupMaster VALUES (@FeeTitleOtherGroupCode,@SrNo, @FeeTitleOtherGroupName,@DeleteFlag,@FeeTitleOtherMainGroupCode)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @FeeTitleOtherGroupCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeTitleOtherMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveFeeTitleOtherMaster] 
	@FeeTitleOtherCode bigint=null,@SrNo bigint=null,@FeeTitleOtherName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null,@FeeTitleShortCode bigint=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(FeeTitleOtherCode),0)+1 FROM FeeTitleOtherMaster(UPDLOCK)
			Set @FeeTitleOtherCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from FeeTitleOtherMaster where FeeTitleOtherCode=@FeeTitleOtherCode
		INSERT INTO FeeTitleOtherMaster VALUES (@FeeTitleOtherCode,@SrNo, @FeeTitleOtherName,@DeleteFlag,@FeeTitleShortCode)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @FeeTitleOtherCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeTitleRegularMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveFeeTitleRegularMaster] 
	@FeeTitleRegularCode bigint=null,@SrNo bigint=null,@FeeTitleRegularName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null,@FeeTitleRegularNameShort nvarchar(120)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(FeeTitleRegularCode),0)+1 FROM FeeTitleRegularMaster(UPDLOCK)
			Set @FeeTitleRegularCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from FeeTitleRegularMaster where FeeTitleRegularCode=@FeeTitleRegularCode
		INSERT INTO FeeTitleRegularMaster VALUES (@FeeTitleRegularCode,@SrNo, @FeeTitleRegularName,@DeleteFlag,@FeeTitleRegularNameShort)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @FeeTitleRegularCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeTitleShortMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveFeeTitleShortMaster] 
	@FeeTitleShortCode bigint=null,@SrNo bigint=null,@FeeTitleShortName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(FeeTitleShortCode),0)+1 FROM FeeTitleShortMaster(UPDLOCK)
			Set @FeeTitleShortCode = @TempCode
			Set @TempCode = NULL
		End

		If @SrNo = 0
		Begin
			SELECT @SrNo = coalesce(MAX(SrNo),0)+1 FROM FeeTitleShortMaster(UPDLOCK)
			Set @SrNo = @SrNo
		End
		
		BEGIN TRANSACTION
		Delete from FeeTitleShortMaster where FeeTitleShortCode=@FeeTitleShortCode
		INSERT INTO FeeTitleShortMaster VALUES (@FeeTitleShortCode,@SrNo, @FeeTitleShortName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @FeeTitleShortCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveFeeTypeMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveFeeTypeMaster] 
	@FeeTypeCode bigint=null,@FeeTypeName nvarchar(120)=null,@FeeTypeFullName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(FeeTypeCode),0)+1 FROM FeeTypeMaster(UPDLOCK)
			Set @FeeTypeCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from FeeTypeMaster where FeeTypeCode=@FeeTypeCode
		INSERT INTO FeeTypeMaster VALUES (@FeeTypeCode,@FeeTypeName,@DeleteFlag,@FeeTypeFullName)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @FeeTypeCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveHandyCapMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveHandyCapMaster] 
	@HandyCapCode bigint=null,@HandyCapName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(HandyCapCode),0)+1 FROM HandyCapMaster(UPDLOCK)
			Set @HandyCapCode = @TempCode
			Set @TempCode = NULL
		End
	
		BEGIN TRANSACTION
		Delete from HandyCapMaster where HandyCapCode=@HandyCapCode
		INSERT INTO HandyCapMaster VALUES (@HandyCapCode,@HandyCapName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @HandyCapCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveInwardRegister]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveInwardRegister] 
	@TID bigint=null,@MainClassCode bigint=null,@RecordNo bigint=null,
	@IRDate datetime=null, @FileNo nvarchar(50)=null, @LetterNo nvarchar(50)=null,
	@FromWhomReceived nvarchar(Max)=null,@Subject nvarchar(Max)=null,
	@ToWhomIssued nvarchar(Max)=null,@Remark nvarchar(Max)=null,@Attachment1Path nvarchar(50)=Null,
	@FyCode bigint=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from InwardRegister where TID=@TID
		INSERT INTO InwardRegister VALUES (@TID,@MainClassCode,@RecordNo,@IRDate, @FileNo,@LetterNo, @FromWhomReceived,@Subject,@ToWhomIssued,@Remark,@Attachment1Path,@FyCode)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from InwardRegister where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveItemGroupMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveItemGroupMaster] 
	@ItemGroupCode bigint=null,@ItemGroupName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(ItemGroupCode),0)+1 FROM ItemGroupMaster(UPDLOCK)
			Set @ItemGroupCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from ItemGroupMaster where ItemGroupCode=@ItemGroupCode
		INSERT INTO ItemGroupMaster VALUES (@ItemGroupCode,@ItemGroupName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @ItemGroupCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveItemMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveItemMaster] 
	@ItemCode bigint=null,@SrNo bigint=null,@ItemName nvarchar(120)=null,@ItemGroupCode bigint=null,
	@Rate numeric(18, 2)=null,@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(ItemCode),0)+1 FROM ItemMaster(UPDLOCK)
			Set @ItemCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from ItemMaster where ItemCode=@ItemCode
		INSERT INTO ItemMaster VALUES (@ItemCode,@SrNo,@ItemName,@ItemGroupCode,@Rate,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @ItemCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLanguageMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLanguageMaster] 
	@LanguageCode bigint=null,@LanguageName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(LanguageCode),0)+1 FROM LanguageMaster(UPDLOCK)
			Set @LanguageCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from LanguageMaster where LanguageCode=@LanguageCode
		INSERT INTO LanguageMaster VALUES (@LanguageCode,@LanguageName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @LanguageCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibAuthorMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLibAuthorMaster] 
	@LibAuthorCode bigint=null,@LibAuthorName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(LibAuthorCode),0)+1 FROM LibAuthorMaster(UPDLOCK)
			Set @LibAuthorCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from LibAuthorMaster where LibAuthorCode=@LibAuthorCode
		INSERT INTO LibAuthorMaster VALUES (@LibAuthorCode,@LibAuthorName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @LibAuthorCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookConsumeEntry]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLibBookConsumeEntry] 
	@TID bigint=null,@TDate datetime=null,@BookTID bigint=null, @Qty bigint=null,
	@FineAmt numeric(18,2)=null,@LibStatusCode bigint=null,@Remark nvarchar(120)=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from LibBookConsumeEntry Where TID=@TID
		INSERT INTO LibBookConsumeEntry VALUES (@TID,@TDate,@BookTID,@Qty,@FineAmt,@LibStatusCode,@Remark)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from LibBookConsumeEntry where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookLanguageMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLibBookLanguageMaster] 
	@LibBookLanguageCode bigint=null,@LibBookLanguageName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(LibBookLanguageCode),0)+1 FROM LibBookLanguageMaster(UPDLOCK)
			Set @LibBookLanguageCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from LibBookLanguageMaster where LibBookLanguageCode=@LibBookLanguageCode
		INSERT INTO LibBookLanguageMaster VALUES (@LibBookLanguageCode,@LibBookLanguageName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @LibBookLanguageCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookLocationMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLibBookLocationMaster] 
	@LibBookLocationCode bigint=null,@LibBookLocationName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(LibBookLocationCode),0)+1 FROM LibBookLocationMaster(UPDLOCK)
			Set @LibBookLocationCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from LibBookLocationMaster where LibBookLocationCode=@LibBookLocationCode
		INSERT INTO LibBookLocationMaster VALUES (@LibBookLocationCode,@LibBookLocationName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @LibBookLocationCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLibBookMaster] 
	@BookTID bigint = NULL,@BillNo nvarchar(120)= NULL,	@BillDate datetime=null, @LibSupplierCode bigint=null,
	@AccessionNo bigint=null,@AuthorCode bigint=null, @BookTitleGroupCode bigint=null, @BookTitleCode bigint=null,@BookSubTitle nvarchar(120)= NULL,
	@EditionCode bigint= NULL,@LibPublicationCode bigint= NULL,@LibPublisherCode bigint=Null,@PublicationYear nvarchar(120)=Null,
	@TotalPages nvarchar(120)= NULL,@NoOfQty numeric(18,2),@BookPrice numeric(18,2),@LibBookLanguageCode bigint=null,
	@LibBookSubjectCode bigint=null,@LibBookLocationCode bigint=null,@LibStatusCode bigint=Null,@DeleteFlag bit=null,
	@Remark nvarchar(255)= NULL, @RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from LibBookMaster where BookTID=@BookTID
		INSERT INTO LibBookMaster VALUES (@BookTID,@BillNo,@BillDate,@LibSupplierCode, @AccessionNo,@AuthorCode,@BookTitleGroupCode,@BookTitleCode,@BookSubTitle,@EditionCode,@LibPublicationCode,@LibPublisherCode,@PublicationYear,@TotalPages,@NoOfQty,@BookPrice,@LibBookLanguageCode,@LibBookSubjectCode,@LibBookLocationCode,@LibStatusCode,@DeleteFlag,@Remark)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from LibBookMaster where @BookTID=@BookTID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookStatusMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLibBookStatusMaster] 
	@LibBookStatusCode bigint=null,@LibBookStatusName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(LibBookStatusCode),0)+1 FROM LibBookStatusMaster(UPDLOCK)
			Set @LibBookStatusCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from LibBookStatusMaster where LibBookStatusCode=@LibBookStatusCode
		INSERT INTO LibBookStatusMaster VALUES (@LibBookStatusCode,@LibBookStatusName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @LibBookStatusCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookSubjectMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLibBookSubjectMaster] 
	@LibBookSubjectCode bigint=null,@LibBookSubjectName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(LibBookSubjectCode),0)+1 FROM LibBookSubjectMaster(UPDLOCK)
			Set @LibBookSubjectCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from LibBookSubjectMaster where LibBookSubjectCode=@LibBookSubjectCode
		INSERT INTO LibBookSubjectMaster VALUES (@LibBookSubjectCode,@LibBookSubjectName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @LibBookSubjectCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookTitleGroupMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLibBookTitleGroupMaster] 
	@LibBookTitleGroupCode bigint=null,@LibBookTitleGroupName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(LibBookTitleGroupCode),0)+1 FROM LibBookTitleGroupMaster(UPDLOCK)
			Set @LibBookTitleGroupCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from LibBookTitleGroupMaster where LibBookTitleGroupCode=@LibBookTitleGroupCode
		INSERT INTO LibBookTitleGroupMaster VALUES (@LibBookTitleGroupCode,@LibBookTitleGroupName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @LibBookTitleGroupCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibBookTitleMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLibBookTitleMaster] 
	@LibBookTitleCode bigint=null,@LibBookTitleName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(LibBookTitleCode),0)+1 FROM LibBookTitleMaster(UPDLOCK)
			Set @LibBookTitleCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from LibBookTitleMaster where LibBookTitleCode=@LibBookTitleCode
		INSERT INTO LibBookTitleMaster VALUES (@LibBookTitleCode,@LibBookTitleName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @LibBookTitleCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibEditionMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLibEditionMaster] 
	@LibEditionCode bigint=null,@LibEditionName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(LibEditionCode),0)+1 FROM LibEditionMaster(UPDLOCK)
			Set @LibEditionCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from LibEditionMaster where LibEditionCode=@LibEditionCode
		INSERT INTO LibEditionMaster VALUES (@LibEditionCode,@LibEditionName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @LibEditionCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibPublicationMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLibPublicationMaster] 
	@LibPublicationCode bigint=null,@LibPublicationName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(LibPublicationCode),0)+1 FROM LibPublicationMaster(UPDLOCK)
			Set @LibPublicationCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from LibPublicationMaster where LibPublicationCode=@LibPublicationCode
		INSERT INTO LibPublicationMaster VALUES (@LibPublicationCode,@LibPublicationName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @LibPublicationCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibPublisherMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLibPublisherMaster] 
	@LibPublisherCode bigint=null,@LibPublisherName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(LibPublisherCode),0)+1 FROM LibPublisherMaster(UPDLOCK)
			Set @LibPublisherCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from LibPublisherMaster where LibPublisherCode=@LibPublisherCode
		INSERT INTO LibPublisherMaster VALUES (@LibPublisherCode,@LibPublisherName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @LibPublisherCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibStudentIssueReturnBook]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLibStudentIssueReturnBook] 
	@TID bigint=null,@RegID bigint=null,@IssueDate datetime=null,@BookTID bigint=null,
	@ReturnDate datetime=null,@NoofDays bigint=null,
	@DueAmt numeric(18,2)=null,@Remark nvarchar(120)=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from LibStudentIssueReturnBook where TID=@TID
		INSERT INTO LibStudentIssueReturnBook VALUES (@TID,@RegID,@IssueDate,@BookTID,@ReturnDate,@NoofDays,@DueAmt,@Remark)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from LibStudentIssueReturnBook where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveLibSupplierMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveLibSupplierMaster] 
	@LibSupplierCode bigint=null,@LibSupplierName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(LibSupplierCode),0)+1 FROM LibSupplierMaster(UPDLOCK)
			Set @LibSupplierCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from LibSupplierMaster where LibSupplierCode=@LibSupplierCode
		INSERT INTO LibSupplierMaster VALUES (@LibSupplierCode,@LibSupplierName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @LibSupplierCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveNoticeMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveNoticeMaster] 
	@NoticeCode bigint=null, @NoticeName nvarchar(Max)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(NoticeCode),0)+1 FROM NoticeMaster(UPDLOCK)
			Set @NoticeCode = @TempCode
			Set @TempCode = NULL
		End
		
		
		BEGIN TRANSACTION
		Delete from NoticeMaster where NoticeCode=@NoticeCode
		INSERT INTO NoticeMaster VALUES (@NoticeCode,@NoticeName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @NoticeCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveOccupationMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveOccupationMaster] 
	@OccupationCode bigint=null,@OccupationName nvarchar(120)=null,@OccupationNameEN nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(OccupationCode),0)+1 FROM OccupationMaster(UPDLOCK)
			Set @OccupationCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from OccupationMaster where OccupationCode=@OccupationCode
		INSERT INTO OccupationMaster VALUES (@OccupationCode,@OccupationName,@OccupationNameEN,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @OccupationCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveOtherSchoolMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveOtherSchoolMaster] 
	@OtherSchoolCode bigint=null,@OtherSchoolName nvarchar(255)=null, @Address nvarchar(255)=null, @UDIESNo nvarchar(50)=null, @DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(OtherSchoolCode),0)+1 FROM OtherSchoolMaster(UPDLOCK)
			Set @OtherSchoolCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from OtherSchoolMaster where OtherSchoolCode=@OtherSchoolCode
		INSERT INTO OtherSchoolMaster VALUES (@OtherSchoolCode,@OtherSchoolName,@Address,@UDIESNo,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @OtherSchoolCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveOutwardRegister]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveOutwardRegister] 
	@TID bigint=null, @MainClassCode bigint=null, @RecordNo bigint=null,
	@ORDate datetime=null, 
	@Enclosures nvarchar(Max)=null,@Address nvarchar(Max)=null,
	@Subject nvarchar(Max)=null,@FileNo nvarchar(50)=null, @ORRDate datetime=null, 
	@ExpensesAmt numeric(18, 2)=null,@Remark nvarchar(Max)=null,@Attachment1Path nvarchar(50)=Null,
	@FyCode bigint=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from OutwardRegister where TID=@TID
		INSERT INTO OutwardRegister VALUES (@TID,@MainClassCode,@RecordNo,@ORDate, @Enclosures,@Address, @Subject,@FileNo,@ORRDate,@ExpensesAmt,@Remark,@Attachment1Path,@FyCode)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from OutwardRegister where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SavePageSizeMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
Create PROCEDURE [dbo].[SP_SavePageSizeMaster] 
	@PageSizeCode bigint=null,@PageSizeName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(PageSizeCode),0)+1 FROM PageSizeMaster(UPDLOCK)
			Set @PageSizeCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from PageSizeMaster where PageSizeCode=@PageSizeCode
		INSERT INTO PageSizeMaster VALUES (@PageSizeCode,@PageSizeName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @PageSizeCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SavePresentyDaysMonthMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SavePresentyDaysMonthMaster] 
	@ClassCode bigint=null,@SchoolStartDate datetime=null,
	@Jun numeric(18, 2)=0,@Jully numeric(18, 2)=0,@Aug numeric(18, 2)=0,@Sept numeric(18, 2)=0,@Oct numeric(18, 2)=0,
	@Nov numeric(18, 2)=0,@Dec numeric(18, 2)=0,@Jan numeric(18, 2)=0,@Feb numeric(18, 2)=0,@Mar numeric(18, 2)=0,
	@Apr numeric(18, 2)=0,@May numeric(18, 2)=0,@FTTotal numeric(18, 2)=0,@STTotal numeric(18, 2)=0,@Total numeric(18, 2)=0,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		Delete from PresentyDaysMonthMaster where ClassCode=@ClassCode
		INSERT INTO PresentyDaysMonthMaster VALUES (@ClassCode, @SchoolStartDate,@Jun, @Jully,@Aug, @Sept,@Oct,@Nov,@Dec,@Jan,@Feb,@Mar,@Apr,@May,@FTTotal,@STTotal,@Total)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from PresentyDaysMonthMaster where ClassCode=@ClassCode
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SavePreTCPrint]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SavePreTCPrint] 
	@RegID bigint=null,@TCStatus nvarchar(120)=null,@TCBehavior nvarchar(120)=null,
	@TeachingClassCode bigint=null,@TeachingYear datetime=null,@TeachingYearText nvarchar(120)=null,@TeachingYearInWord nvarchar(255)=null,@NextClassPromote nvarchar(120)=null,
	@SLeaveReason nvarchar(120)=null,@TCRemark nvarchar(120)=null,@AyCode bigint=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	BEGIN TRANSACTION
	Delete from PreTCPrint where RegID=@RegID
	INSERT INTO PreTCPrint VALUES (@RegID,@TCStatus,@TCBehavior,@TeachingClassCode,@TeachingYear,@TeachingYearText, @TeachingYearInWord,@NextClassPromote,@SLeaveReason,@TCRemark,@AyCode)
	
	COMMIT TRANSACTION

	SELECT 'ReturnStatus' = 0;
	RETURN;  -- Record Successfully Saved
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveRelationMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveRelationMaster] 
	@RelationCode bigint=null,@RelationName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(RelationCode),0)+1 FROM RelationMaster(UPDLOCK)
			Set @RelationCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from RelationMaster where RelationCode=@RelationCode
		INSERT INTO RelationMaster VALUES (@RelationCode,@RelationName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @RelationCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveReligionMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveReligionMaster] 
	@ReligionCode bigint=null,@ReligionName nvarchar(120)=null, @MinorityFlag nvarchar(1)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(ReligionCode),0)+1 FROM ReligionMaster(UPDLOCK)
			Set @ReligionCode = @TempCode
			Set @TempCode = NULL
		End
		
		 
		BEGIN TRANSACTION
		Delete from ReligionMaster where ReligionCode=@ReligionCode
		INSERT INTO ReligionMaster VALUES (@ReligionCode,@ReligionName,@DeleteFlag,@MinorityFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @ReligionCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveRenewAdmission]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveRenewAdmission] 
	@RegID bigint=null,@AyCode bigint=null,@RenewClassCode bigint=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null


Begin
	SET NOCOUNT ON;
	BEGIN TRANSACTION
	
	Update StudInfoAll Set AyCode = @AyCode, ClassCode = @RenewClassCode, StudDisplayFlag = 'N', FeesPaidFlag = 'N', MarksFeedFlag='N', AdmissionType='R'  where RegID = @RegID
	INSERT INTO StudInfo Select * from StudInfoAll Where RegID = @RegID
	
	Delete from StudInfoYearly where RegID = @RegID and AyCode = @AyCode
	INSERT INTO StudInfoYearly SELECT  RegID, MainClassCode, MediumCode, ClassCode, DivisionCode, FeeTypeCode, AyCode, FeesPaidFlag, 0 as Opening, AdmissionType, 0 as Outstanding, 0 as SchoolFees, 0 as DiscountFees, 0 as FinalFees FROM   StudInfoAll Where RegID = @RegID and AyCode = @AyCode

	UPDATE StudInfoYearly SET Outstanding = StudInfoYearly_1.FinalFees, SchoolFees = StudInfoYearly_1.SchoolFees, DiscountFees = StudInfoYearly_1.DiscountFees, FinalFees = StudInfoYearly_1.FinalFees FROM     StudInfoYearly INNER JOIN StudInfoYearly AS StudInfoYearly_1 ON StudInfoYearly.RegID = StudInfoYearly_1.RegID WHERE  (StudInfoYearly.RegID = @RegID) AND (StudInfoYearly.AyCode = @AyCode) AND (StudInfoYearly_1.AyCode = @AyCode-1)

	COMMIT TRANSACTION

	SELECT 'ReturnStatus' = 0;
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveScholarshipEntry]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveScholarshipEntry] 
	@TID bigint=null,@MainClassCode bigint=null,@RecordNo bigint=null,
	@TDate datetime=null,@ScholarshipCode bigint=null,@CategoryCode bigint=null,
	@ReportName nvarchar(Max)=null,
	@UserCode bigint=null,@AyCode bigint=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from ScholarshipEntry where TID=@TID
		INSERT INTO ScholarshipEntry VALUES (@TID,@MainClassCode,@RecordNo,@TDate, @ScholarshipCode,@CategoryCode, @ReportName,@UserCode,@AyCode)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from ScholarshipEntry where TID=@TID
		Delete from ScholarshipEntryDetail where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveScholarshipMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveScholarshipMaster] 
	@ScholarshipCode bigint=null,@ScholarshipName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(ScholarshipCode),0)+1 FROM ScholarshipMaster(UPDLOCK)
			Set @ScholarshipCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from ScholarshipMaster where ScholarshipCode=@ScholarshipCode
		INSERT INTO ScholarshipMaster VALUES (@ScholarshipCode,@ScholarshipName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @ScholarshipCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveSendSMS]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveSendSMS] 
	@TDate datetime=null,@TID bigint=null,
	@Message nvarchar(MAX)=null,@MobileNo nvarchar(MAX)=null,@Type nvarchar(MAX)=null,
	@UserCode char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
		BEGIN TRANSACTION
		Delete from SaveSendSMS where TID=@TID
		INSERT INTO SaveSendSMS VALUES (@TID,@TDate,@Type,@MobileNo,@Message,@UserCode)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveSmsMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveSmsMaster] 
	@SMSCode bigint=null,@SMSName nvarchar(MAX)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(SMSCode),0)+1 FROM SMSMaster(UPDLOCK)
			Set @SMSCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from SMSMaster where SMSCode=@SMSCode
		INSERT INTO SMSMaster VALUES (@SMSCode,@SMSName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @SMSCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveSPAItemMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveSPAItemMaster] 
	@SPAItemCode bigint=null,@SPAItemName nvarchar(120)=null,@UnitCode bigint=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(SPAItemCode),0)+1 FROM SPAItemMaster(UPDLOCK)
			Set @SPAItemCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from SPAItemMaster where SPAItemCode=@SPAItemCode
		INSERT INTO SPAItemMaster VALUES (@SPAItemCode,@SPAItemName,@UnitCode,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @SPAItemCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveSPAItemQtyDefine]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveSPAItemQtyDefine] 
	@SPAItemTID bigint=null,@SPAItemCode bigint=null,@SrNo bigint=null,@SPAClassTypeCode bigint=null,@SPAMenuTypeCode bigint=null,
	@DeleteFlag bit = 0,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(SPAItemTID),0)+1 FROM SPAItemQtyDefine(UPDLOCK)
			Set @SPAItemTID = @TempCode
			Set @TempCode = NULL
		End

		SELECT @TempCode = SPAItemTID from SPAItemQtyDefine where SPAItemTID <> @SPAItemTID AND SPAClassTypeCode = @SPAClassTypeCode And SPAMenuTypeCode = @SPAMenuTypeCode And SPAItemCode = @SPAItemCode And @DeleteFlag = 0
		IF @TempCode IS Not NULL
		Begin
			SELECT 'ReturnStatus' = 0;
			RETURN;
		End 

		SELECT @TempCode = SrNo from SPAItemQtyDefine where SrNo <> @SrNo AND SPAClassTypeCode = @SPAClassTypeCode And SPAMenuTypeCode = @SPAMenuTypeCode And SPAItemCode = @SPAItemCode And @DeleteFlag = 0
		IF @TempCode IS Not NULL
		Begin
			SELECT 'ReturnStatus' = 0;
			RETURN;
		End 

		--BEGIN TRANSACTION
		Delete from SPAItemQtyDefineDetail where SPAItemTID=@SPAItemTID
		Delete from SPAItemQtyDefine where SPAItemTID=@SPAItemTID
		INSERT INTO SPAItemQtyDefine VALUES (@SPAItemTID,@SPAItemCode,@SrNo,@SPAClassTypeCode,@SPAMenuTypeCode,@DeleteFlag)
		--COMMIT TRANSACTION
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = @SPAItemTID;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		--Delete from SPAItemQtyDefine where SPAItemTID=@SPAItemTID
		--Delete from SPAItemQtyDefineDetail where SPAItemTID=@SPAItemTID
		UPDATE SPAItemQtyDefine SET DeleteFlag = 0 WHERE SPAItemTID = @SPAItemTID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStateMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveStateMaster] 
	@StateCode bigint=null,@StateName nvarchar(120)=null,@CountryCode bigint=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(StateCode),0)+1 FROM StateMaster(UPDLOCK)
			Set @StateCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from StateMaster where StateCode=@StateCode
		INSERT INTO StateMaster VALUES (@StateCode,@StateName,@CountryCode,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @StateCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStoreClassWiseStationeryItemDefine]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveStoreClassWiseStationeryItemDefine] 
	@CDTID bigint=null,@SrNo bigint=null,@ItemCode bigint=null,@ClassCode nvarchar(120)=null,@Qty numeric(18, 2)=null,@CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(CDTID),0)+1 FROM StoreClassWiseStationeryItemDefine(UPDLOCK)
			Set @ItemCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from StoreClassWiseStationeryItemDefine where CDTID=@CDTID
		INSERT INTO StoreClassWiseStationeryItemDefine VALUES (@CDTID,@SrNo,@ItemCode,@ClassCode,@Qty)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @ItemCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStoreStationeryIssue]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveStoreStationeryIssue] 
	@ReceiptTID bigint=null,@MainClassCode bigint=null,@FeeCategoryCode bigint=null, @ReceiptNo bigint=null,
	@ReceiptDate datetime=null,@RegID bigint=null,
	@Remark nvarchar(255)=null, @PaymentTypeCode bigint=null,@BankName nvarchar(255)=null,@ChequeNo nvarchar(120)=null,@ChequeDate datetime=null,
	@BusCode bigint=0,	@UserCode bigint=null,@AyCode bigint=null,@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS
--@ItemCode bigint=null,@BalanceQty bigint=null,@Amount numeric(18, 2)=0,
DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(ReceiptTID),0)+1 FROM StoreStationeryIssue(UPDLOCK)
			Set @ReceiptTID = @TempCode
			Set @TempCode = NULL
		End

		Delete from StoreStationeryIssue where ReceiptTID=@ReceiptTID
		Delete from StoreStationeryIssueDetail where ReceiptTID=@ReceiptTID
		INSERT INTO StoreStationeryIssue VALUES (@ReceiptTID,@MainClassCode,@FeeCategoryCode,@ReceiptNo,@ReceiptDate,@RegID,@Remark,@PaymentTypeCode,@BankName,@ChequeNo,@ChequeDate,@BusCode,@UserCode,@AyCode)

		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = @ReceiptTID;
		RETURN;  -- Record Successfully Saved
 	  End
	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from StoreStationeryIssue where ReceiptTID=@ReceiptTID
		Delete from StoreStationeryIssueDetail where ReceiptTID=@ReceiptTID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStudentInfoUpdate]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveStudentInfoUpdate] 
	@RecordSelection nvarchar(120)=null, @RegID bigint=null, @RegNo bigint=null, @DivisionCodeNew bigint=null, @MainClassCode bigint=null, @PhotoPath nvarchar(50)=null, @AyCode bigint=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	BEGIN TRANSACTION
	
	If @RecordSelection='StudentDivisionUpdate'
		Begin
			Update StudInfo Set DivisionCode = @DivisionCodeNew where RegID = @RegID And AyCode = @AyCode
			Update StudInfoAll Set DivisionCode = @DivisionCodeNew where RegID = @RegID And AyCode = @AyCode
			Update StudInfoYearly Set DivisionCode = @DivisionCodeNew where RegID = @RegID And AyCode = @AyCode
		End
	else If @RecordSelection='StudentPhotoUpload'
		Begin
			Update StudInfo Set Photpath = @PhotoPath where RegNo = @RegNo And MainClassCode = @MainClassCode
			Update StudInfoAll Set Photpath = @PhotoPath where RegNo = @RegNo And MainClassCode = @MainClassCode
		End
	
	COMMIT TRANSACTION
	
	SELECT 'ReturnStatus' = 0;

End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStudentLeaveApplication]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveStudentLeaveApplication] 
	@TID bigint=null,@MainClassCode bigint=null,@RecordNo bigint=null,
	@TDate datetime=null,@RegID bigint=null,
	@SLeaveReason nvarchar(255)=null,@OtherSchoolName nvarchar(255)=null,
	@UserCode bigint=null,@AyCode bigint=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from StudentLeaveApplication where TID=@TID
		INSERT INTO StudentLeaveApplication VALUES (@TID,@MainClassCode,@RecordNo,@TDate, @RegID,@SLeaveReason,@OtherSchoolName,@UserCode,@AyCode)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from StudentLeaveApplication where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStudentNirgamUtara]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveStudentNirgamUtara] 
	@TID bigint=null,@MainClassCode bigint=null,@RecordNo bigint=null,
	@TDate datetime=null,@RegID bigint=null,@LeaveTimeClassCode bigint=null,
	@TCNo nvarchar(120)=null,@TCDate datetime=null,
	@TCStatus nvarchar(120)=null,@TCBehavior nvarchar(120)=null,
	@SLeaveReason nvarchar(255)=null,@Description nvarchar(255)=null,@PageNo nvarchar(50)=Null,
	@UserCode bigint=null,@AyCode bigint=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from StudentNirgamUtara where TID=@TID
		INSERT INTO StudentNirgamUtara VALUES (@TID,@MainClassCode,@RecordNo,@TDate, @RegID,@LeaveTimeClassCode, @TCNo,@TCDate,@TCStatus,@TCBehavior,@SLeaveReason,@Description, @PageNo,@UserCode,@AyCode)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from StudentNirgamUtara where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStudentNotice]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveStudentNotice] 
	@TID bigint=null,@MainClassCode bigint=null,@RecordNo bigint=null,
	@TDate datetime=null,@RegID bigint=null,
	@ParentsReply nvarchar(max)=null,
	@CompleteNoticeFlag char(1)=null,
	@UserCode bigint=null,@AyCode bigint=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from StudentNotice where TID=@TID
		INSERT INTO StudentNotice VALUES (@TID,@MainClassCode,@RecordNo,@TDate, @RegID,@ParentsReply, @CompleteNoticeFlag,@UserCode,@AyCode)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from StudentNotice where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStudentPresentyCertificate]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveStudentPresentyCertificate] 
	@TID bigint=null,@MainClassCode bigint=null,@RecordNo bigint=null,
	@TDate datetime=null,@RegID bigint=null,
	@UserCode bigint=null,@AyCode bigint=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from StudentPresentyCertificate where TID=@TID
		INSERT INTO StudentPresentyCertificate VALUES (@TID,@MainClassCode,@RecordNo,@TDate, @RegID,@UserCode,@AyCode)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from StudentPresentyCertificate where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveStudInfo]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveStudInfo] 
	@RegID bigint=null,@MainClassCode bigint=null,@RegNo bigint=null,@MediumCode bigint=null,@AyCode bigint=null,@CloseFlag char(1)=null,
	@StudDisplayFlag char(1)=null, @EntryFrom char(1)=null, @FeesPaidFlag char(1)=null, @MarksFeedFlag char(1)=null,
	@TSuspendedFlag char(1)=null,@TSupendedDate datetime=null,@AdmissionType char(1)=null,@AdmittionDate datetime=null,
	@Firstname nvarchar(120)=null,@MiddleName nvarchar(120)=null, @LastName nvarchar(120)=null,@ClassCode bigint=null,@DivisionCode bigint=null, 
	@GenderCode bigint=null,	@StudentID nvarchar(120)=null,@AadharNo nvarchar(120)=null, @Photpath nvarchar(120)=null, @RollNo bigint=null, 
	@FormNo bigint=null, @FeeTypeCode bigint=null,@PermanentAddress nvarchar(255)=null,@PerCitycode bigint=null, 
	@LocalAddress nvarchar(255)=null,@LocCitycode bigint=null,@AreaCode bigint=null,@MobileNo1 nvarchar(50)=null, @MobileNo2 nvarchar(50)=null,
	@Dob datetime=null, @DobInWord nvarchar(255)=null, @BirthPlaceCode as bigint=null, @BloodGroup nvarchar(50)=null, @CasteCode bigint=null,
	@SubCast nvarchar(50)=null, @ReligionCode bigint=null, @MotherTongueCode as bigint=null, @LanguageKnownCode bigint=null, 
	@CategoryCode bigint=null,@PSCode bigint=null, @PSClassCode bigint=null, @PSResult nvarchar(50)=null, @PSRegNo nvarchar(50)=null, 
	@PSTCNo nvarchar(50)=null,@PSLeaveDate datetime=null, @PSLeaveReasonCode bigint=null, 
	@FatherName nvarchar(120)=null, @FEducationCode bigint=null, @FOccupationCode bigint=null, @FAnnualIncome numeric(18, 2)=0, 
	@MotherName nvarchar(120)=null, @MEducationCode bigint=null, @MOccupationCode bigint=null, @GaurdianName nvarchar(120)=null,  
	@RelationCode bigint=null, @ClassCodeAT bigint=null, @DivisionCodeAT bigint=null, @BankCode bigint=null,  
	@BankAcNo nvarchar(120)=null, @BankAPersonName nvarchar(50)=null, @PersonalIdentMark nvarchar(120)=null, @Age30Sept nvarchar(120)=null,  
	@Remark nvarchar(120)=null, @UserCode bigint=null, 	@OpeningBalance numeric(18, 2)=0, 
	@HandyCapStatus char(1)=null, @HandyCapCode bigint=null, @BPLCardStatus char(1)=null, @PPECompleteStatus char(50)=null,
	@WeightFT nvarchar(120)=null, @WeightST nvarchar(120)=null, @HeightFT nvarchar(120)=null, @HeightST nvarchar(120)=null, 
	@SeatNo nvarchar(120)=null, @Nationality nvarchar(120)=null, 
	@FirstnameE nvarchar(120)=null, @MiddleNameE nvarchar(120)=null, @LastNameE nvarchar(120)=null, @AdmiSchoolType nvarchar(120)=null,
	@MotherNameE nvarchar(120)=null, @WeekPointDetail nvarchar(120)=null, @LearningStopResion nvarchar(120)=null, @PrePrimarySchoolName nvarchar(120)=null,
	@GovermentOffer nvarchar(120)=null, @AadharLinkBankStatus char(1)=null, @HostelStayFlag char(1)=null,
	@FAadharCardNo nvarchar(50)=null,@FPanCard nvarchar(50)=null,@MAnnualIncome nvarchar(50)=null,@MAadharCardNo nvarchar(50)=null,@MPanCard nvarchar(50)=null,@WhatsAppMobileNo nvarchar(50)=null,
	@EmailID nvarchar(50)=null,@FacebookID nvarchar(50)=null,@InstragramID nvarchar(50)=null,@TwitterID nvarchar(50)=null,@TelegramID nvarchar(50)=null,@Branch nvarchar(120)=null,
	@MotherFatherAreAlive char(1)=null, @EWSCertificateStatus char(1)=null, @HandyCapPercentage nvarchar(50)=null,@BPLCardNo nvarchar(50)=null,
	@SubjectGroupCode bigint=null, @ScholarshipEligibleStatus char(1)=null, @ScholarshipCode bigint=null, @ScholarshipFormFeed char(1)=null, 
	@CovidDose1Code bigint=null, @CovidDose1Date datetime=null, @CovidDose2Code bigint=null, @CovidDose2Date datetime=null, @CovidBoosterDose bigint=null, @CovidBoosterDoseDate datetime=null,
	@SubjectDetails nvarchar(Max)=null,@FeeTypeConcessionCode bigint=null, @PermanentDeleteFlag char(1)='N',
	@NationalCode nvarchar(50)=null, @Outstanding int=null, @ApaarID nvarchar(50)=null, @StudentNameAadhar nvarchar(120)=null, @AadharVerifiedFlag nvarchar(50)=null,
	@SchoolFees int=null, @DiscountFees int=null, @FinalFees int=null, 
	@MargeFlag char(1)=null, @DeleteFlag char(50)=null, @SyncFlag char(50)=null, @RecordStatus char(1)=null, @CurrentFlag char(50)=null, @CurrentYearStudFlag char(50)=null
AS

	 
DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempRegIDCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		--If EXISTS(Select RegID from StudInfoAll where RegID <> @RegID AND Firstname = @Firstname AND MiddleName = @MiddleName AND LastName = @LastName And AdmittionDate = @AdmittionDate And ClassCode = @ClassCode and EntryFrom='A') 
		--Begin			   
		--	SELECT 'ReturnStatus' = 0;
		--	RETURN;
		--End 

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(RegID),0)+1 FROM StudInfoAll(UPDLOCK)
			Set @RegID = @TempCode
			Set @TempCode = NULL
		End

		Delete from StudInfoAll where RegID=@RegID
		INSERT INTO StudInfoAll VALUES (@RegID,@MainClassCode,@RegNo, @MediumCode,@AyCode,@CloseFlag,@StudDisplayFlag,@EntryFrom,@FeesPaidFlag,@MarksFeedFlag, @TSuspendedFlag, @TSupendedDate,@AdmissionType,@AdmittionDate,@Firstname,@MiddleName,@LastName,@ClassCode,@DivisionCode,@GenderCode,@StudentID,@AadharNo,@Photpath,@RollNo,@FormNo,@FeeTypeCode,@PermanentAddress,@PerCitycode,@LocalAddress,@LocCitycode,@AreaCode,@MobileNo1,@MobileNo2,@Dob,@DobInWord,@BirthPlaceCode,@BloodGroup,@CasteCode,@SubCast,@ReligionCode,@MotherTongueCode,@LanguageKnownCode,@CategoryCode,@PSCode,@PSClassCode,@PSResult,@PSRegNo,@PSTCNo,@PSLeaveDate,@PSLeaveReasonCode,@FatherName,@FEducationCode,@FOccupationCode,@FAnnualIncome,@MotherName,@MEducationCode,@MOccupationCode,@GaurdianName,@RelationCode,@ClassCodeAT,@DivisionCodeAT,@BankCode,@BankAcNo,@BankAPersonName,@PersonalIdentMark,@Age30Sept,@Remark,@UserCode,@OpeningBalance,@MargeFlag,@HandyCapStatus ,@HandyCapCode ,@BPLCardStatus ,@PPECompleteStatus ,@WeightFT ,@WeightST ,@HeightFT ,@HeightST ,@SeatNo ,@Nationality ,@FirstnameE , @MiddleNameE ,@LastNameE,@AdmiSchoolType,@MotherNameE,@WeekPointDetail,@LearningStopResion,@PrePrimarySchoolName,@GovermentOffer,@AadharLinkBankStatus,@HostelStayFlag,@FAadharCardNo,@FPanCard,@MAnnualIncome,@MAadharCardNo,@MPanCard,@WhatsAppMobileNo,@EmailID,@FacebookID,@InstragramID,@TwitterID,@TelegramID,@Branch,@MotherFatherAreAlive, @EWSCertificateStatus, @HandyCapPercentage, @BPLCardNo,@SubjectGroupCode,@ScholarshipEligibleStatus,@ScholarshipCode,@ScholarshipFormFeed,@CovidDose1Code,@CovidDose1Date,@CovidDose2Code,@CovidDose2Date,@CovidBoosterDose,@CovidBoosterDoseDate,@SubjectDetails,@FeeTypeConcessionCode,@DeleteFlag,@SyncFlag,@NationalCode,@ApaarID,@StudentNameAadhar,@AadharVerifiedFlag)		
		
		Delete from StudInfo where RegID=@RegID      
		if (@CurrentYearStudFlag='Y')
		   Begin
			INSERT INTO StudInfo Select * from StudInfoAll Where RegID = @RegID
		   End


		Delete from StudInfoYearly where RegID = @RegID and AyCode = @AyCode
		INSERT INTO StudInfoYearly VALUES (@RegID,@MainClassCode,@MediumCode,@ClassCode,@DivisionCode,@FeeTypeCode,@AyCode,@FeesPaidFlag,@OpeningBalance,@AdmissionType,@Outstanding, @SchoolFees, @DiscountFees, @FinalFees)		

		UPDATE    FeesCollection SET MainClassCode = @MainClassCode WHERE RegID = @RegID

		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = @RegID;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		
		if (@PermanentDeleteFlag='Y')
		   Begin
		    Delete from StudInfo where RegID=@RegID
		    Delete from StudInfoAll where RegID=@RegID
		    Delete from StudInfoYearly where RegID = @RegID
		   End
		else
		   Begin   
			Update StudInfo Set CloseFlag = 'Y', DeleteFlag = 'Y' where RegID = @RegID
			Update StudInfoAll Set CloseFlag = 'Y', DeleteFlag = 'Y' where RegID = @RegID
		   End

		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveSubjectDEMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveSubjectDEMaster] 
	@SubjectDECode bigint=null, @SubDEClassGCode bigint=null,@SubjectCode bigint=null,
	@SrNo bigint=null, @SubjectDEName nvarchar(Max)=null, @DeleteFlag bit = 0,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(SubjectDECode),0)+1 FROM SubjectDEMaster(UPDLOCK)
			Set @SubjectDECode = @TempCode
			Set @TempCode = NULL
		End

		SELECT @TempCode = SubjectDECode from SubjectDEMaster where SubjectCode = 0 And  SubjectDECode <> @SubjectDECode AND SubDEClassGCode = @SubDEClassGCode And SubjectCode = @SubjectCode And SubjectDEName = @SubjectDEName 
		IF @TempCode IS Not NULL
		Begin
			SELECT 'ReturnStatus' = -1;
			RETURN;
		End 
		
		Delete from SubjectDEMaster where SubjectDECode=@SubjectDECode
		INSERT INTO SubjectDEMaster VALUES (@SubjectDECode, @SubDEClassGCode,@SubjectCode,@SrNo, @SubjectDEName, @DeleteFlag)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Update SubjectDEMaster Set DeleteFlag = 1 where SubjectDECode = @SubjectDECode
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveSubjectMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveSubjectMaster] 
	@SubjectCode bigint=null,@SubjectName nvarchar(120)=null,@SubjectNameShort nvarchar(120)=null,@SubjectCodeBoard nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(SubjectCode),0)+1 FROM SubjectMaster(UPDLOCK)
			Set @SubjectCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from SubjectMaster where SubjectCode=@SubjectCode
		INSERT INTO SubjectMaster VALUES (@SubjectCode,@SubjectName,@SubjectNameShort,@DeleteFlag, @SubjectCodeBoard)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @SubjectCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTalukaMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveTalukaMaster] 
	@TalukaCode bigint=null,@TalukaName nvarchar(120)=null,@DistrictCode bigint=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(TalukaCode),0)+1 FROM TalukaMaster(UPDLOCK)
			Set @TalukaCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from TalukaMaster where TalukaCode=@TalukaCode
		INSERT INTO TalukaMaster VALUES (@TalukaCode,@TalukaName,@DistrictCode,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @TalukaCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTalukaMasterTemp]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveTalukaMasterTemp] 
	@TalukaCode bigint=null,@TalukaName nvarchar(120)=null,@DistrictCode bigint=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(TalukaCode),0)+1 FROM TalukaMaster(UPDLOCK)
			Set @TalukaCode = @TempCode
			Set @TempCode = NULL
		End
		
		 --SELECT @TempCode = TalukaCode from TalukaMaster where TalukaName = @TalukaName
		 --IF @TempCode IS Not NULL
  	--     Begin
			--If EXISTS(Select TalukaCode from TalukaMaster where TalukaCode = @TempCode) 
			--Begin			   
			--   Set @TalukaCode = @TempCode
			--End 
		 --End 

		BEGIN TRANSACTION
		Delete from TalukaMaster where TalukaCode=@TalukaCode
		INSERT INTO TalukaMaster VALUES (@TalukaCode,@TalukaName,@DistrictCode,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @TalukaCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCApplication]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveTCApplication] 
	@TID bigint=null,@MainClassCode bigint=null,@RecordNo bigint=null,
	@TDate datetime=null,@StudentName nvarchar(120)=null,@GenderCode bigint=null,
	@ClassCode bigint=null,@PSCode bigint=null,
	@UserCode bigint=null,@AyCode bigint=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from TCApplication where TID=@TID
		INSERT INTO TCApplication VALUES (@TID,@MainClassCode,@RecordNo,@TDate, @StudentName,@GenderCode, @ClassCode,@PSCode,@UserCode,@AyCode)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from TCApplication where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCBehaviorMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveTCBehaviorMaster] 
	@TCBehaviorCode bigint=null,@TCBehaviorName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(TCBehaviorCode),0)+1 FROM TCBehaviorMaster(UPDLOCK)
			Set @TCBehaviorCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from TCBehaviorMaster where TCBehaviorCode=@TCBehaviorCode
		INSERT INTO TCBehaviorMaster VALUES (@TCBehaviorCode,@TCBehaviorName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @TCBehaviorCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCClassPromotStatusMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveTCClassPromotStatusMaster] 
	@TCClassPromotStatusCode bigint=null,@TCClassPromotStatusName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(TCClassPromotStatusCode),0)+1 FROM TCClassPromotStatusMaster(UPDLOCK)
			Set @TCClassPromotStatusCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from TCClassPromotStatusMaster where TCClassPromotStatusCode=@TCClassPromotStatusCode
		INSERT INTO TCClassPromotStatusMaster VALUES (@TCClassPromotStatusCode,@TCClassPromotStatusName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @TCClassPromotStatusCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCDocumentMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveTCDocumentMaster] 
	@TCDocumentCode bigint=null,@TCDocumentName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(TCDocumentCode),0)+1 FROM TCDocumentMaster(UPDLOCK)
			Set @TCDocumentCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from TCDocumentMaster where TCDocumentCode=@TCDocumentCode
		INSERT INTO TCDocumentMaster VALUES (@TCDocumentCode,@TCDocumentName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @TCDocumentCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCPrint]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveTCPrint] 
	@TCID bigint=null,@MainClassCode bigint=null,@TCCode bigint=null,@TCNo nvarchar(120)=null,
	@TCDate datetime=null,@ApplicationDate datetime=null,@RegID bigint=null,@ReportDate datetime=null,
	@TCStatus nvarchar(120)=null,@TCBehavior nvarchar(120)=null,
	@TeachingClassCode bigint=null,@TeachingYear datetime=null,@TeachingYearText nvarchar(120)=null,
	@TeachingYearInWord nvarchar(255)=null,@ClassAndYear nvarchar(120)=null,@NextClassPromote nvarchar(120)=null,
	@SeatNo nvarchar(120)=null, @SLeaveReason nvarchar(255)=null,@TCRemark nvarchar(255)=null,
	@FeesAndDues nvarchar(120)=null, @LastExamResult nvarchar(120)=null,@ScheduleCast nvarchar(120)=null,
	@FailedStatus nvarchar(120)=null, @NextClassCode bigint=null,@FeeConcession nvarchar(120)=null,
	@TWorkingDay nvarchar(120)=null, @TPrsentDay nvarchar(120)=null,@NCCCaded nvarchar(120)=null,
	@SubjectsStudied nvarchar(255)=null, @OptionalSubject nvarchar(255)=null,
	@UserCode bigint=null,@AyCode bigint=null, @MargeFlag char(1)=null, 
	@TCRPersonName nvarchar(255)=null, @TCRPersonRelation nvarchar(255)=null,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null,@StudDisplayFlag char(1)=null, @CurrentYearStudFlag char(50)=null,
	@M1 nvarchar(120)=null,@M2 nvarchar(120)=null,@M3 nvarchar(120)=null,@M4 nvarchar(120)=null,
	@M5 nvarchar(120)=null,@M6 nvarchar(120)=null,@M7 nvarchar(120)=null,@M8 nvarchar(120)=null,
	@Examination nvarchar(120)=null,@ExamYear nvarchar(120)=null,@ExamResult nvarchar(120)=null,@SubjectDegreeCource nvarchar(120)=null,
	@Specilization nvarchar(120)=null,@ContinuedClass nvarchar(120)=null, @PermanentDeleteFlag char(1)='N',
	@ReportDateOTC datetime=null, @DeleteFlag char(50)=null, @SyncFlag char(50)=null, @DuplicateTCPrintFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(TCID),0)+1 FROM TCPrintAll(UPDLOCK)
			Set @TCID = @TempCode
			Set @TempCode = NULL
		End

		UPDATE StudInfo SET CloseFlag = 'N' FROM  StudInfo INNER JOIN TCPrintAll ON StudInfo.RegID = TCPrintAll.RegID WHERE (TCPrintAll.TCID = @TCID)
		UPDATE StudInfoAll SET CloseFlag = 'N' FROM  StudInfoAll INNER JOIN TCPrintAll ON StudInfoAll.RegID = TCPrintAll.RegID WHERE (TCPrintAll.TCID = @TCID)
		
		Update StudInfo Set CloseFlag = 'Y', StudDisplayFlag = @StudDisplayFlag, TSuspendedFlag = 'N', TSupendedDate = Null where RegID = @RegID
		Update StudInfoAll Set CloseFlag = 'Y', StudDisplayFlag = @StudDisplayFlag, TSuspendedFlag = 'N', TSupendedDate = Null where RegID = @RegID

		Delete from TCPrintAll where TCID=@TCID
		INSERT INTO TCPrintAll VALUES (@TCID,@MainClassCode,@TCCode,@TCNo,@TCDate, @ApplicationDate,@RegID,@ReportDate,@TCStatus,@TCBehavior,@TeachingClassCode,@TeachingYear,@TeachingYearText, @TeachingYearInWord,@ClassAndYear,@NextClassPromote,@SeatNo,@SLeaveReason,@TCRemark,@FeesAndDues,@LastExamResult, @ScheduleCast, @FailedStatus, @NextClassCode, @FeeConcession, @TWorkingDay, @TPrsentDay, @NCCCaded, @SubjectsStudied, @OptionalSubject, @UserCode,@AyCode,@MargeFlag,@TCRPersonName,@TCRPersonRelation,@ReportDateOTC,@DuplicateTCPrintFlag,@DeleteFlag,@SyncFlag,@M1,@M2,@M3,@M4,@M5,@M6,@M7,@M8,@Examination,@ExamYear,@ExamResult,@SubjectDegreeCource, @Specilization, @ContinuedClass)
		
		
		if (@CurrentYearStudFlag='Y')
		   Begin
			Delete from TCPrint where TCID=@TCID 
			INSERT INTO TCPrint Select * from TCPrintAll Where TCID=@TCID 
		   End
		   

		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		
		UPDATE StudInfo SET CloseFlag = 'N' FROM  StudInfo INNER JOIN TCPrintAll ON StudInfo.RegID = TCPrintAll.RegID WHERE (TCPrintAll.TCID = @TCID)
		UPDATE StudInfoAll SET CloseFlag = 'N' FROM  StudInfoAll INNER JOIN TCPrintAll ON StudInfoAll.RegID = TCPrintAll.RegID WHERE (TCPrintAll.TCID = @TCID)
		
		if (@PermanentDeleteFlag='Y')
		   Begin
			Delete from TCPrint where TCID=@TCID
			Delete from TCPrintAll where TCID=@TCID
		   End
		else
		   Begin   
			Update TCPrint Set DeleteFlag = 'Y' where TCID=@TCID
			Update TCPrintAll Set DeleteFlag = 'Y' where TCID=@TCID
		   End

		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCPrintTypeMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveTCPrintTypeMaster] 
	@OfficeTCFlag char(1)=null,@OriginalTCFlag char(1)=null,@DuplicateTCFlag char(1)=null, @MigrationTCFlag char(1)=null
AS

Begin
	SET NOCOUNT ON;
	BEGIN TRANSACTION
	Update TCPrintTypeMaster Set TCPrintFlag = @OfficeTCFlag where TCReportTypeCode = 1
	Update TCPrintTypeMaster Set TCPrintFlag = @DuplicateTCFlag where TCReportTypeCode = 2
	Update TCPrintTypeMaster Set TCPrintFlag = @OriginalTCFlag where TCReportTypeCode = 3
	Update TCPrintTypeMaster Set TCPrintFlag = @MigrationTCFlag where TCReportTypeCode = 4
	COMMIT TRANSACTION
	SELECT 'ReturnStatus' = 0;
	RETURN;  -- Record Successfully Saved

End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCRemarkMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveTCRemarkMaster] 
	@TCRemarkCode bigint=null,@TCRemarkName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(TCRemarkCode),0)+1 FROM TCRemarkMaster(UPDLOCK)
			Set @TCRemarkCode = @TempCode
			Set @TempCode = NULL
		End
		
		
		BEGIN TRANSACTION
		Delete from TCRemarkMaster where TCRemarkCode=@TCRemarkCode
		INSERT INTO TCRemarkMaster VALUES (@TCRemarkCode,@TCRemarkName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @TCRemarkCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCSLRMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveTCSLRMaster] 
	@TCSLRCode bigint=null,@TCSLRName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(TCSLRCode),0)+1 FROM TCSLRMaster(UPDLOCK)
			Set @TCSLRCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from TCSLRMaster where TCSLRCode=@TCSLRCode
		INSERT INTO TCSLRMaster VALUES (@TCSLRCode,@TCSLRName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @TCSLRCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTCStatusMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveTCStatusMaster] 
	@TCStatusCode bigint=null,@TCStatusName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(TCStatusCode),0)+1 FROM TCStatusMaster(UPDLOCK)
			Set @TCStatusCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from TCStatusMaster where TCStatusCode=@TCStatusCode
		INSERT INTO TCStatusMaster VALUES (@TCStatusCode,@TCStatusName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @TCStatusCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTimeTableMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveTimeTableMaster] 
	@TID bigint=null, @ClassCode bigint=null,@DayCode bigint=null,@DivisionCode bigint=null,
	@SrNo bigint=null,@SubjectCode bigint=null, @FromTime datetime=null,@ToTime datetime=null,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(TID),0)+1 FROM TimeTableMaster(UPDLOCK)
			Set @TID = @TempCode
			Set @TempCode = NULL
		End

		--SELECT @TempCode = TID from TimeTableMaster where TID <> @TID AND ClassCode = @ClassCode And DivisionCode = @DivisionCode And DayCode = @DayCode And SubjectCode = @SubjectCode 
		--IF @TempCode IS Not NULL
		--Begin
		--	SELECT 'ReturnStatus' = -1;
		--	RETURN;
		--End 
		
		Delete from TimeTableMaster where TID=@TID
		INSERT INTO TimeTableMaster VALUES (@TID, @ClassCode,@DivisionCode,@DayCode,@SrNo, @SubjectCode, @FromTime,@ToTime)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from TimeTableMaster where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveTripCompetationEntry]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveTripCompetationEntry] 
	@TID bigint=null,@MainClassCode bigint=null,@RecordNo bigint=null,
	@TDate datetime=null,@ScholarshipCode bigint=null,@CategoryCode bigint=null,
	@ReportName nvarchar(Max)=null, @TripCity nvarchar(255)=null, @TripDays nvarchar(50)=null, @TripSteyDays nvarchar(50)=null,
	@UserCode bigint=null,@AyCode bigint=null, 
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @TempTCID bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION
		
		Delete from TripCompetationEntry where TID=@TID
		INSERT INTO TripCompetationEntry VALUES (@TID,@MainClassCode,@RecordNo,@TDate, @ReportName,@UserCode,@AyCode,@TripCity, @TripDays,@TripSteyDays)
		
		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from TripCompetationEntry where TID=@TID
		Delete from TripCompetationEntryDetail where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveUnitMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveUnitMaster] 
	@UnitCode bigint=null,@UnitName nvarchar(120)=null,
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(UnitCode),0)+1 FROM UnitMaster(UPDLOCK)
			Set @UnitCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from UnitMaster where UnitCode=@UnitCode
		INSERT INTO UnitMaster VALUES (@UnitCode,@UnitName,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @UnitCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveUserMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveUserMaster] 
	@UserCode bigint=null,@UserName nvarchar(50)=null,@Password nvarchar(50)=null,@SecondPassword nvarchar(50)=null,
	@DetailRecordFlag nvarchar(1)=null, @MenuType nvarchar(50)=null, @MenuID bigint=null, 
	@DeleteFlag bit = 0, @CurrentFlag char(1)=null,@RecordStatus char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	If @RecordStatus = 'S'
	 Begin
		BEGIN TRANSACTION
		Delete from UserMaster where UserCode=@UserCode
		--INSERT INTO UserMaster VALUES (@UserCode,@UserName,@Password,@SecondPassword,@DeleteFlag)
		COMMIT TRANSACTION
		
		if @DetailRecordFlag = 'Y'
		  Begin
			--Delete from UserDetail where UserCode=@UserCode		
			INSERT INTO UserDetail VALUES (@UserCode,@MenuType,@MenuID)
		  End 
		  
		SELECT 'ReturnStatus' = 0;

		RETURN;  -- Record Successfully Saved
 	 End
	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
        if @DetailRecordFlag = 'Y'
          Begin			
			Delete from UserDetail where UserCode=@UserCode
		  End 
		Else
		  Begin
		   Delete from UserMaster where UserCode=@UserCode		   		   
		   Delete from UserDetail where UserCode=@UserCode
		  End 		
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	  End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveVisitorRegister]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveVisitorRegister] 
	@TID bigint=null, @MainClassCode bigint=null,@RecordNo bigint=null,
	@VisitDate datetime=null, @VisitorName nvarchar(120)=null, @PersonToMeet nvarchar(120)=null, @Purpose nvarchar(Max)=null,
	@InTime datetime=null,@OutTime datetime=null, @RegNo bigint=null, @PhotoPath nvarchar(Max)=null, @MobileNo nvarchar(120)=null,
	@RecordStatus char(1)=null, @CurrentFlag char(1)=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null

Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'S'
	  Begin
		BEGIN TRANSACTION

		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(TID),0)+1 FROM VisitorRegister(UPDLOCK)
			Set @TID = @TempCode
			Set @TempCode = NULL
		End

		Delete from VisitorRegister where TID=@TID
		INSERT INTO VisitorRegister VALUES (@TID, @MainClassCode,@RecordNo,@VisitDate, @VisitorName,@PersonToMeet, @Purpose, @InTime,@OutTime, @RegNo,@PhotoPath,@MobileNo)

		COMMIT TRANSACTION
		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
 	  End

	else   -- Delete Record Time Used This Below Code
	  Begin
		BEGIN TRANSACTION
		Delete from VisitorRegister where TID=@TID
		COMMIT TRANSACTION

		SELECT 'ReturnStatus' = 0;
		RETURN;  -- Record Successfully Saved
	End 	
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SaveWordLibraryMaster]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SaveWordLibraryMaster] 
	@WordLibraryCode bigint=null,@NotoSans nvarchar(255)=null, @Khula nvarchar(255)=null, @BalBharatiDev nvarchar(255)=null, @Mangal nvarchar(255)=null, @DeleteFlag bit = 0, @CurrentFlag char(1)=null
AS

DECLARE @TempCode bigint

Begin
	SET NOCOUNT ON;
	Begin
		If @CurrentFlag = 'A'
		Begin
			SELECT @TempCode = coalesce(MAX(WordLibraryCode),0)+1 FROM WordLibraryMaster(UPDLOCK)
			Set @WordLibraryCode = @TempCode
			Set @TempCode = NULL
		End
		
		BEGIN TRANSACTION
		Delete from WordLibraryMaster where WordLibraryCode=@WordLibraryCode
		INSERT INTO WordLibraryMaster VALUES (@WordLibraryCode,@NotoSans,@Khula,@BalBharatiDev,@Mangal,@DeleteFlag)
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @WordLibraryCode;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_SoftwareUpdate]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_SoftwareUpdate] 
	@RecordStatus nvarchar(50)=null, @LastAyCode bigint=null, @AyCode bigint=null, @LastClassCode bigint=null, @RegID bigint=null, @RenewRegID bigint=null, @RenewMainClassCode bigint=null, @RenewClassCode bigint=null, @AdmissionDate datetime=null
AS

DECLARE @ReturnValue bit
DECLARE @TempCode bigint=null
DECLARE @FirstRecrod int, @MaxRecrod int
Declare @BlankTableName nvarchar(120)
Begin
	SET NOCOUNT ON;
	if @RecordStatus = 'StudEnquiryImport'
		Begin
			--BEGIN TRANSACTION
			INSERT INTO StudInfo Select * from StudInfoAll Where ClassCode = @LastClassCode and CloseFlag = N'N' and AyCode = @LastAyCode
			--COMMIT TRANSACTION
			SELECT 'ReturnStatus' = 0;
			RETURN;  -- Record Successfully Saved
		End
	Else If @RecordStatus = 'StudEnquirySetting'
		Begin
			--BEGIN TRANSACTION
			Update StudInfo Set RegID = @RenewRegID, RegNo=0, AyCode = @AyCode, ClassCode = @RenewClassCode, ClassCodeAT = @RenewClassCode, MainClassCode = @RenewMainClassCode, PSCode = 1, PSClassCode = @LastClassCode, EntryFrom = 'E', AdmittionDate = @AdmissionDate, AdmissionType = 'N' where RegID = @RegID
			INSERT INTO StudInfoAll Select * from StudInfo Where RegID = @RenewRegID
			--COMMIT TRANSACTION
			SELECT 'ReturnStatus' = 0;
			RETURN;  -- Record Successfully Saved
		End
	Else If @RecordStatus = 'D'
		Begin
			--BEGIN TRANSACTION
			SET @TempCode = 0;  
			SET @FirstRecrod = 1;
			SET @MaxRecrod = (SELECT Count(BlankTableCode) AS MaxRecord FROM BlankTableMaster Where (DeleteType='A' OR DeleteType='R'));
			IF @MaxRecrod IS Not NULL
			Begin
				WHILE @FirstRecrod <= @MaxRecrod
				BEGIN
					SELECT @TempCode = BlankTableCode, @BlankTableName = BlankTableName FROM BlankTableMaster WHERE BlankTableCode > @TempCode And (DeleteType='A' OR DeleteType='R') Order by BlankTableCode;
					exec ('Delete From '+ @BlankTableName)
					set @FirstRecrod= @FirstRecrod + 1
				END	
			End
			--Delete from StudInfo
			--Delete from TCPrint
			Delete from PreTCPrint Where AyCode <> @AyCode And AyCode <> @LastAyCode
			--COMMIT TRANSACTION

			SELECT 'ReturnStatus' = 0;
			RETURN;  -- Record Successfully Saved
		End 		
End
GO
/****** Object:  StoredProcedure [dbo].[SP_TempAttendanceMonthly]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--SP_TempAttendanceMonthly 31,5,2,2,2

CREATE PROCEDURE [dbo].[SP_TempAttendanceMonthly]
	@MDaysCount bigint=null, @ClassCode bigint=null, @DivisionCode bigint=null, @MediumCode bigint=null, @AyCode bigint=null,
	@StartDate Datetime=null
AS

DECLARE @MonthNo bigint
DECLARE @YearCode bigint
DECLARE @HolidayNo bigint
DECLARE @MWDaysCount bigint


DECLARE @CurrentDate Datetime
DECLARE @ReturnValue bit
DECLARE @TempCode bigint
DECLARE @Day INT
DECLARE @DayName VARCHAR(50)
DECLARE @PresentyStatus varchar(10)
DECLARE @AFieldName as varchar(10)
DECLARE @sql VARCHAR(MAX)
SET @sql = ''
DECLARE @sql1 VARCHAR(MAX)
SET @sql1 = ''
DECLARE @RequestStatus INTEGER

Begin
	SET NOCOUNT ON;
	Begin
		BEGIN TRANSACTION

		--set @StartDate ='2023/03/01'
		
		SELECT @MonthNo = Month(@StartDate);
		--print(@MonthNo);
		
		SELECT @YearCode = YEAR(@StartDate);
		--print(@YearCode);
		
		SELECT  @HolidayNo =  COUNT(TDate) FROM CalendarMaster Where Year(CalendarMaster.Tdate) = CAST(@YearCode AS VARCHAR(10))  And Month(CalendarMaster.Tdate) = CAST(@MonthNo AS VARCHAR(10));
		IF @HolidayNo IS NULL
		Begin
		    Set @HolidayNo = 0;
		End
		--print(@HolidayNo);

		
		Delete from TempAttendanceMonthly
		INSERT INTO TempAttendanceMonthly (RegID) SELECT     RegID FROM         StudInfo WHERE     (CloseFlag = N'N') AND (ClassCode = @ClassCode) AND (DivisionCode = @DivisionCode) AND (MediumCode = @MediumCode) AND (AyCode = @AyCode)

		Set @MWDaysCount = @MDaysCount - @HolidayNo
		UPDATE TempAttendanceMonthly SET TotalWD = @MWDaysCount, TotalPD = 0,TotalPA = 0

		Set @CurrentDate = @StartDate
		SET @Day = 1

		WHILE @Day<= @MDaysCount
		BEGIN
			SET @AFieldName = 'A'+ CAST(@Day AS VARCHAR(10)); 
			SET @PresentyStatus ='P';
			SET @DayName = DATENAME(DW, @CurrentDate);
			
			SELECT @sql = 'UPDATE TempAttendanceMonthly SET ' + @AFieldName + ' = ''P'''; --Where ' + @AFieldName + '==null';
			EXEC(@sql);

			SELECT @sql = 'UPDATE TempAttendanceMonthly SET ' + @AFieldName + ' = ''H'' FROM  CalendarMaster Where Day(CalendarMaster.Tdate) = ' + CAST(@Day AS VARCHAR(10))  + ' And Month(CalendarMaster.Tdate) = ' + CAST(@MonthNo AS VARCHAR(10)) + ' And Year(CalendarMaster.Tdate) = ' + CAST(@YearCode AS VARCHAR(10)) + '';
			EXEC(@sql);

			SELECT @sql = 'UPDATE TempAttendanceMonthly SET ' + @AFieldName + ' = ''AB'', TotalPA = TotalPA+1 FROM  TempAttendanceMonthly INNER JOIN StudentGoshwaraDaily ON TempAttendanceMonthly.RegID = StudentGoshwaraDaily.RegID WHERE   Day(StudentGoshwaraDaily.TDate) = ' + CAST(@Day AS VARCHAR(10))  + ' And Month(StudentGoshwaraDaily.Tdate) = ' + CAST(@MonthNo AS VARCHAR(10)) + ' And Year(StudentGoshwaraDaily.Tdate) = ' + CAST(@YearCode AS VARCHAR(10)) + '';
			EXEC(@sql);
			
			SET @CurrentDate = DATEADD(day, 1, @CurrentDate);
		    SET @Day = @Day + 1;
		END;

		UPDATE TempAttendanceMonthly SET TotalPD = TotalWD - TotalPA
		COMMIT TRANSACTION
		
		SELECT 'ReturnStatus' = @Day;
		RETURN;  -- Record Successfully Saved
 	End
End
GO
/****** Object:  StoredProcedure [dbo].[SP_TempStudentCountingReport]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_TempStudentCountingReport] 
	@TCID bigint=null, @RecordFlag char(1)=null
AS

Begin
	SET NOCOUNT ON;
	BEGIN TRANSACTION
	If @RecordFlag='D'
		BEGIN
			Delete from TempStudentCountingReport 
		END
	If @RecordFlag='S'
		BEGIN
			INSERT INTO TempTCPrintRecord VALUES (@TCID)
		END
	
	COMMIT TRANSACTION
	
	SELECT 'ReturnStatus' = 0;
	RETURN;  -- Record Successfully Saved
End
GO
/****** Object:  StoredProcedure [dbo].[SP_TempTCPrintRecord]    Script Date: 13-08-2025 16:35:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE PROCEDURE [dbo].[SP_TempTCPrintRecord] 
	@TCID bigint=null, @RecordFlag char(1)=null,@TCDate datetime=null,@ReportDate datetime=null,
	@TeachingClassCode bigint=null,@TeachingYear datetime=null,@TeachingYearText nvarchar(120)=null,
	@TeachingYearInWord nvarchar(255)=null,@SLeaveReason nvarchar(255)=null,@TCRemark nvarchar(255)=null
AS

Begin
	SET NOCOUNT ON;
	BEGIN TRANSACTION
	If @RecordFlag='D'
		BEGIN
			Delete from TempTCPrintRecord 
		END
	If @RecordFlag='S'
		BEGIN
			INSERT INTO TempTCPrintRecord VALUES (@TCID)
			
			IF @TCDate IS Not NULL
			Begin
				Update TCPrint Set TCDate = @TCDate, ApplicationDate = @TCDate, ReportDate = @ReportDate, TeachingClassCode = @TeachingClassCode, TeachingYear = @TeachingYear, TeachingYearText = @TeachingYearText , TeachingYearInWord = @TeachingYearInWord , SLeaveReason = @SLeaveReason , TCRemark = @TCRemark where TCID = @TCID
				Update TCPrintAll Set TCDate = @TCDate, ApplicationDate = @TCDate, ReportDate = @ReportDate, TeachingClassCode = @TeachingClassCode, TeachingYear = @TeachingYear, TeachingYearText = @TeachingYearText , TeachingYearInWord = @TeachingYearInWord , SLeaveReason = @SLeaveReason , TCRemark = @TCRemark  where TCID = @TCID
			End
		END
	
	COMMIT TRANSACTION
	
	SELECT 'ReturnStatus' = 0;
	RETURN;  -- Record Successfully Saved
End
GO
