ALTER TABLE [dbo].[acclog] ADD  CONSTRAINT [DF_acclog_txndt]  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[acclog] ADD  CONSTRAINT [DF_acclog_usernm]  DEFAULT ('') FOR [usernm]
GO
ALTER TABLE [dbo].[acclog] ADD  CONSTRAINT [DF_acclog_narration]  DEFAULT ('') FOR [narration]
GO
ALTER TABLE [dbo].[acclog] ADD  CONSTRAINT [DF_acclog_txntype]  DEFAULT ((0)) FOR [txntype]
GO
ALTER TABLE [dbo].[acclog] ADD  CONSTRAINT [DF_acclog_gno]  DEFAULT ((0)) FOR [gno]
GO
ALTER TABLE [dbo].[acclog] ADD  CONSTRAINT [DF__acclog__sessioni__5F0F1F55]  DEFAULT ('') FOR [sessionid]
GO
ALTER TABLE [dbo].[acclog] ADD  DEFAULT ('') FOR [txntrace]
GO
ALTER TABLE [dbo].[acclogdup] ADD  CONSTRAINT [DF__acclogdup__sessi__6003438E]  DEFAULT ('') FOR [sessionid]
GO
ALTER TABLE [dbo].[acclogdup] ADD  DEFAULT ('') FOR [txntrace]
GO
ALTER TABLE [dbo].[ADVANCE] ADD  CONSTRAINT [DF_ADVANCE_MOP]  DEFAULT ((1)) FOR [MOP]
GO
ALTER TABLE [dbo].[ADVANCE] ADD  CONSTRAINT [DF_ADVANCE_GRNO]  DEFAULT ((0)) FOR [GRNO]
GO
ALTER TABLE [dbo].[ADVANCE] ADD  CONSTRAINT [DF_ADVANCE_AMOUNT]  DEFAULT ((0)) FOR [AMOUNT]
GO
ALTER TABLE [dbo].[ADVANCE] ADD  CONSTRAINT [DF_ADVANCE_SPLIT]  DEFAULT (' ') FOR [SPLIT]
GO
ALTER TABLE [dbo].[ADVANCE] ADD  CONSTRAINT [DF_ADVANCE_usernm]  DEFAULT ('SYS') FOR [usernm]
GO
ALTER TABLE [dbo].[BanqBill] ADD  DEFAULT ((0)) FOR [SERVICETYPE]
GO
ALTER TABLE [dbo].[banqbillno] ADD  DEFAULT ((0)) FOR [billno]
GO
ALTER TABLE [dbo].[banqco] ADD  DEFAULT ('') FOR [bnqname]
GO
ALTER TABLE [dbo].[banqco] ADD  DEFAULT ('') FOR [ADD1]
GO
ALTER TABLE [dbo].[banqco] ADD  DEFAULT ('') FOR [ADD2]
GO
ALTER TABLE [dbo].[banqco] ADD  DEFAULT ('') FOR [ADD3]
GO
ALTER TABLE [dbo].[banqco] ADD  DEFAULT ('') FOR [CITY]
GO
ALTER TABLE [dbo].[banqco] ADD  DEFAULT ('') FOR [STATE]
GO
ALTER TABLE [dbo].[banqco] ADD  DEFAULT ('') FOR [PHONE]
GO
ALTER TABLE [dbo].[banqco] ADD  DEFAULT ('') FOR [EMAIL]
GO
ALTER TABLE [dbo].[banqco] ADD  DEFAULT ('') FOR [WEBSITE]
GO
ALTER TABLE [dbo].[banqco] ADD  DEFAULT ('') FOR [info1]
GO
ALTER TABLE [dbo].[BanqDummy] ADD  DEFAULT ((0)) FOR [SERVICETYPE]
GO
ALTER TABLE [dbo].[BanqFood] ADD  CONSTRAINT [DF_BanqFood_Veg]  DEFAULT ((0)) FOR [Veg]
GO
ALTER TABLE [dbo].[BanqMaster] ADD  DEFAULT ((0)) FOR [sttableno]
GO
ALTER TABLE [dbo].[BanqMaster] ADD  DEFAULT ((0)) FOR [lttableno]
GO
ALTER TABLE [dbo].[BanqMaster] ADD  DEFAULT ((0)) FOR [bnqvattableno]
GO
ALTER TABLE [dbo].[BanqMaster] ADD  DEFAULT ((0)) FOR [bnqsttableno]
GO
ALTER TABLE [dbo].[BanqMaster] ADD  DEFAULT ('') FOR [billprefix]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_cno]  DEFAULT ((0)) FOR [cno]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_minpax]  DEFAULT ((0)) FOR [minpax]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_maxpax]  DEFAULT ((0)) FOR [maxpax]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_rate]  DEFAULT ((0)) FOR [rate]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_status]  DEFAULT (' ') FOR [status]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_billno]  DEFAULT ((0)) FOR [billno]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_mop]  DEFAULT ((0)) FOR [mop]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_crname]  DEFAULT (' ') FOR [crname]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_crnum]  DEFAULT (' ') FOR [crnum]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_crbank]  DEFAULT (' ') FOR [crbank]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_glnum]  DEFAULT ((0)) FOR [glnum]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_grno]  DEFAULT ((0)) FOR [grno]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_hall]  DEFAULT ((0)) FOR [hall]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_contactperson]  DEFAULT (' ') FOR [contactperson]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_contactno]  DEFAULT (' ') FOR [contactno]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_chargedpax]  DEFAULT ((0)) FOR [chargedpax]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_billamount]  DEFAULT ((0)) FOR [billamount]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_address]  DEFAULT ('M/S') FOR [address]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF__banquet__fax__5CACADF9]  DEFAULT (' ') FOR [fax]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF__banquet__cancell__64EA2048]  DEFAULT ((0)) FOR [cancellgrno]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF__banquet__STBNQ__244C51F8]  DEFAULT ((0)) FOR [STBNQ]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_cessbnq]  DEFAULT ((0)) FOR [cessbnq]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF__banquet__LTBNQ__25407631]  DEFAULT ((0)) FOR [LTBNQ]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF__banquet__STFOOD__26349A6A]  DEFAULT ((0)) FOR [STFOOD]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF_banquet_cessfood]  DEFAULT ((0)) FOR [cessfood]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF__banquet__VATFOOD__2728BEA3]  DEFAULT ((0)) FOR [VATFOOD]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF__banquet__BNQ1__281CE2DC]  DEFAULT ((0)) FOR [BNQ1]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF__banquet__BNQ2__29110715]  DEFAULT ((0)) FOR [BNQ2]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF__banquet__RATE1__2A052B4E]  DEFAULT ((0)) FOR [RATE1]
GO
ALTER TABLE [dbo].[banquet] ADD  CONSTRAINT [DF__banquet__charged__2AF94F87]  DEFAULT ((0)) FOR [chargedpax1]
GO
ALTER TABLE [dbo].[banquet] ADD  DEFAULT ((0)) FOR [kkcbnq]
GO
ALTER TABLE [dbo].[banquet] ADD  DEFAULT ((0)) FOR [kkcfood]
GO
ALTER TABLE [dbo].[banquet] ADD  DEFAULT ('') FOR [gstin]
GO
ALTER TABLE [dbo].[banquet] ADD  DEFAULT ('') FOR [GSTINNAME]
GO
ALTER TABLE [dbo].[banquet] ADD  DEFAULT ('N') FOR [EINVOICE]
GO
ALTER TABLE [dbo].[banquet] ADD  DEFAULT ('B2B') FOR [TXNCAT]
GO
ALTER TABLE [dbo].[banquet] ADD  DEFAULT ('N') FOR [SEZ]
GO
ALTER TABLE [dbo].[Banquet1] ADD  CONSTRAINT [DF_Banquet1_mode]  DEFAULT ((0)) FOR [mode]
GO
ALTER TABLE [dbo].[banquetVATmaster] ADD  DEFAULT ((0)) FOR [STTABLENO]
GO
ALTER TABLE [dbo].[banquetVATmaster] ADD  DEFAULT ((0)) FOR [cessonwhat]
GO
ALTER TABLE [dbo].[banquetVATmaster] ADD  DEFAULT ('SBC') FOR [cessname]
GO
ALTER TABLE [dbo].[banquetVATmaster] ADD  DEFAULT ((0)) FOR [cess2]
GO
ALTER TABLE [dbo].[banquetVATmaster] ADD  DEFAULT ((0)) FOR [cessonwhat2]
GO
ALTER TABLE [dbo].[banquetVATmaster] ADD  DEFAULT ('KKC') FOR [cessname2]
GO
ALTER TABLE [dbo].[banquetVATmaster] ADD  DEFAULT ('Service Tax') FOR [taxname]
GO
ALTER TABLE [dbo].[banquetVATmaster] ADD  DEFAULT ('ST') FOR [taxshname]
GO
ALTER TABLE [dbo].[banquetVATmaster] ADD  DEFAULT ((0)) FOR [taxacno]
GO
ALTER TABLE [dbo].[barcoupon] ADD  CONSTRAINT [DF_barcoupon_bookno]  DEFAULT ((0)) FOR [bookno]
GO
ALTER TABLE [dbo].[barcoupon] ADD  CONSTRAINT [DF_barcoupon_couponsno]  DEFAULT ((0)) FOR [couponsno]
GO
ALTER TABLE [dbo].[barcoupon] ADD  CONSTRAINT [DF_barcoupon_couponeno]  DEFAULT ((0)) FOR [couponeno]
GO
ALTER TABLE [dbo].[barcoupon] ADD  CONSTRAINT [DF_barcoupon_couponstatus]  DEFAULT ('') FOR [couponstatus]
GO
ALTER TABLE [dbo].[barcoupon] ADD  CONSTRAINT [DF_barcoupon_status]  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[barcoupon] ADD  CONSTRAINT [DF_barcoupon_commnrate]  DEFAULT ((0)) FOR [commnrate]
GO
ALTER TABLE [dbo].[barcoupon] ADD  CONSTRAINT [DF_barcoupon_discountrate]  DEFAULT ((0)) FOR [discountrate]
GO
ALTER TABLE [dbo].[bardiscount] ADD  CONSTRAINT [DF_bardiscount_commission]  DEFAULT ((0)) FOR [commission]
GO
ALTER TABLE [dbo].[BASIC] ADD  CONSTRAINT [DF__BASIC__userno__6E04805A]  DEFAULT ((0)) FOR [userno]
GO
ALTER TABLE [dbo].[BASIC] ADD  CONSTRAINT [DF__BASIC__CODE8__6EF8A493]  DEFAULT (' ') FOR [CODE8]
GO
ALTER TABLE [dbo].[BASIC] ADD  CONSTRAINT [DF__BASIC__CODE9__6FECC8CC]  DEFAULT ('') FOR [CODE9]
GO
ALTER TABLE [dbo].[BASIC] ADD  CONSTRAINT [DF_BASIC_VPDays]  DEFAULT ((7)) FOR [VPDays]
GO
ALTER TABLE [dbo].[BASIC] ADD  CONSTRAINT [DF__basic__olp__536CF4BF]  DEFAULT (' ') FOR [olp]
GO
ALTER TABLE [dbo].[BASIC] ADD  CONSTRAINT [DF_BASIC_eddays]  DEFAULT ((0)) FOR [eddays]
GO
ALTER TABLE [dbo].[BASIC] ADD  CONSTRAINT [DF_BASIC_fbc]  DEFAULT ((0)) FOR [fbc]
GO
ALTER TABLE [dbo].[BASIC] ADD  DEFAULT ((60)) FOR [qcheck]
GO
ALTER TABLE [dbo].[BASIC] ADD  CONSTRAINT [DF_BASIC_crs]  DEFAULT ('N') FOR [crs]
GO
ALTER TABLE [dbo].[BASIC] ADD  CONSTRAINT [DF_BASIC_rdays]  DEFAULT ((7)) FOR [rdays]
GO
ALTER TABLE [dbo].[BASIC] ADD  CONSTRAINT [DF_BASIC_rdaystemp]  DEFAULT ((0)) FOR [rdaystemp]
GO
ALTER TABLE [dbo].[BASIC] ADD  CONSTRAINT [DF_BASIC_rdaysdate]  DEFAULT (getdate()) FOR [rdaysdate]
GO
ALTER TABLE [dbo].[bill2] ADD  DEFAULT ((0)) FOR [cess2]
GO
ALTER TABLE [dbo].[bill2] ADD  DEFAULT ((18)) FOR [LRATE]
GO
ALTER TABLE [dbo].[bill2] ADD  DEFAULT ((0)) FOR [igstamt]
GO
ALTER TABLE [dbo].[BILLHIST] ADD  CONSTRAINT [DF_BILLHIST_SPLIT]  DEFAULT (' ') FOR [SPLIT]
GO
ALTER TABLE [dbo].[BILLHIST] ADD  CONSTRAINT [DF_BILLHIST_RENT]  DEFAULT ((0)) FOR [RENT]
GO
ALTER TABLE [dbo].[BILLHIST] ADD  CONSTRAINT [DF_BILLHIST_OtherChgs]  DEFAULT ((0)) FOR [OtherChgs]
GO
ALTER TABLE [dbo].[BILLHIST] ADD  CONSTRAINT [DF_BILLHIST_DISCOUNT]  DEFAULT ((0)) FOR [DISCOUNT]
GO
ALTER TABLE [dbo].[BILLHIST] ADD  CONSTRAINT [DF_BILLHIST_CESS]  DEFAULT ((0)) FOR [CESS]
GO
ALTER TABLE [dbo].[BILLHIST] ADD  DEFAULT ((0)) FOR [cess2]
GO
ALTER TABLE [dbo].[BILLHIST] ADD  DEFAULT ((0)) FOR [extrabed]
GO
ALTER TABLE [dbo].[BILLHIST] ADD  DEFAULT ((0)) FOR [exbedGST]
GO
ALTER TABLE [dbo].[BILLHIST] ADD  DEFAULT ((0)) FOR [food]
GO
ALTER TABLE [dbo].[BILLHIST] ADD  DEFAULT ((0)) FOR [foodgst]
GO
ALTER TABLE [dbo].[BILLHIST] ADD  DEFAULT ((0)) FOR [gstEXBED]
GO
ALTER TABLE [dbo].[BILLHIST1] ADD  CONSTRAINT [DF_BILLHIST1_SPLIT]  DEFAULT (' ') FOR [SPLIT]
GO
ALTER TABLE [dbo].[BILLHIST1] ADD  CONSTRAINT [DF_BILLHIST1_ADVANCE]  DEFAULT ((0)) FOR [ADVANCE]
GO
ALTER TABLE [dbo].[BILLHIST1] ADD  CONSTRAINT [DF_BILLHIST1_SPLDISCOUNT]  DEFAULT ((0)) FOR [SPLDISCOUNT]
GO
ALTER TABLE [dbo].[BILLHIST1] ADD  CONSTRAINT [DF_BILLHIST1_foodbill]  DEFAULT ((0)) FOR [foodbill]
GO
ALTER TABLE [dbo].[BILLHIST1] ADD  CONSTRAINT [DF_BILLHIST1_CRNAME]  DEFAULT ('') FOR [CRNAME]
GO
ALTER TABLE [dbo].[BILLHIST1] ADD  CONSTRAINT [DF_BILLHIST1_CRNUM]  DEFAULT ('') FOR [CRNUM]
GO
ALTER TABLE [dbo].[BILLHIST1] ADD  CONSTRAINT [DF_BILLHIST1_CRTYPE]  DEFAULT ('') FOR [CRTYPE]
GO
ALTER TABLE [dbo].[BILLHIST1] ADD  CONSTRAINT [DF_BILLHIST1_GLACTNO]  DEFAULT ((0)) FOR [GLACTNO]
GO
ALTER TABLE [dbo].[BILLHIST1] ADD  CONSTRAINT [DF_BILLHIST1_MOP]  DEFAULT ((0)) FOR [MOP]
GO
ALTER TABLE [dbo].[BILLHIST1] ADD  CONSTRAINT [DF_BILLHIST1_GRNO]  DEFAULT ((0)) FOR [GRNO]
GO
ALTER TABLE [dbo].[BILLHIST1] ADD  DEFAULT ('') FOR [gstin]
GO
ALTER TABLE [dbo].[BILLHIST1] ADD  DEFAULT ((0)) FOR [nogroupname]
GO
ALTER TABLE [dbo].[BILLHIST1] ADD  DEFAULT ((0)) FOR [irnsuppress]
GO
ALTER TABLE [dbo].[billhist2] ADD  CONSTRAINT [DF_billhist2_roomservice]  DEFAULT ((0)) FOR [roomservice]
GO
ALTER TABLE [dbo].[BILLPOSITION] ADD  CONSTRAINT [DF_BILLPOSITION_SERVICETYPE]  DEFAULT ((1)) FOR [SERVICETYPE]
GO
ALTER TABLE [dbo].[BILLPOSITION] ADD  CONSTRAINT [DF_BILLPOSITION_OULET]  DEFAULT ((0)) FOR [OUTLET]
GO
ALTER TABLE [dbo].[CashBox] ADD  CONSTRAINT [DF_CashBox_opgbal]  DEFAULT ((0)) FOR [opgbal]
GO
ALTER TABLE [dbo].[CashBox] ADD  CONSTRAINT [DF_CashBox_status]  DEFAULT ('Y') FOR [status]
GO
ALTER TABLE [dbo].[cashboxuser] ADD  CONSTRAINT [DF_cashboxuser_status]  DEFAULT ('N') FOR [status]
GO
ALTER TABLE [dbo].[celcategory] ADD  CONSTRAINT [DF_celcategory_sold]  DEFAULT ((0)) FOR [sold]
GO
ALTER TABLE [dbo].[celcategory] ADD  CONSTRAINT [DF_celcategory_price]  DEFAULT ((0)) FOR [price]
GO
ALTER TABLE [dbo].[celmaster] ADD  CONSTRAINT [DF_celmaster_company]  DEFAULT ((1)) FOR [company]
GO
ALTER TABLE [dbo].[celmaster] ADD  CONSTRAINT [DF_celmaster_glac]  DEFAULT ((0)) FOR [glac]
GO
ALTER TABLE [dbo].[celsession] ADD  CONSTRAINT [DF_celsession_processstep]  DEFAULT ((0)) FOR [processstep]
GO
ALTER TABLE [dbo].[celsessionp] ADD  CONSTRAINT [DF_celsessionp_txndt]  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[celterms] ADD  CONSTRAINT [DF_celterms_condition]  DEFAULT ('') FOR [condition]
GO
ALTER TABLE [dbo].[celtickets] ADD  CONSTRAINT [DF_celtickets_pin]  DEFAULT ('') FOR [pin]
GO
ALTER TABLE [dbo].[celtickets] ADD  CONSTRAINT [DF_celtickets_ID]  DEFAULT ('') FOR [ID]
GO
ALTER TABLE [dbo].[celtickets] ADD  CONSTRAINT [DF_celtickets_sessionid]  DEFAULT ('') FOR [sessionid]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_STYPE]  DEFAULT ((1)) FOR [STYPE]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_PHONENO]  DEFAULT ('') FOR [PHONENO]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_DRIVER]  DEFAULT ('') FOR [DRIVER]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_SREADING]  DEFAULT ((0)) FOR [SREADING]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_V_TYPE]  DEFAULT ('') FOR [V_TYPE]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_V_MAKE]  DEFAULT ('') FOR [V_MAKE]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_V_NUMBER]  DEFAULT ('') FOR [V_NUMBER]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_TRAVELAGENT]  DEFAULT ((0)) FOR [TRAVELAGENT]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_BASICAMT]  DEFAULT ((0)) FOR [BASICAMT]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_PERKM]  DEFAULT ((0)) FOR [PERKM]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_PERHOUR]  DEFAULT ((0)) FOR [PERHOUR]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_BATA]  DEFAULT ((0)) FOR [BATA]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_TTTYPE]  DEFAULT ((1)) FOR [TTTYPE]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_BASICAMT_T]  DEFAULT ((0)) FOR [BASICAMT_T]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_PERKM_T]  DEFAULT ((0)) FOR [PERKM_T]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_PERHOUR_T]  DEFAULT ((0)) FOR [PERHOUR_T]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_BATA_T]  DEFAULT ((0)) FOR [BATA_T]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_ADVANCE]  DEFAULT ((0)) FOR [ADVANCE]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_ADVANCE_T]  DEFAULT ((0)) FOR [ADVANCE_T]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_finalamt]  DEFAULT ((0)) FOR [finalamt]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_finalamt_T]  DEFAULT ((0)) FOR [finalamt_T]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_pamt]  DEFAULT ((0)) FOR [pamt]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_pamt1]  DEFAULT ((0)) FOR [pamt1]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_stax]  DEFAULT ((0)) FOR [stax]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_totbata]  DEFAULT ((0)) FOR [totbata]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_totbata1]  DEFAULT ((0)) FOR [totbata1]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_grno]  DEFAULT ((0)) FOR [grno]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_grno_T]  DEFAULT ((0)) FOR [grno_T]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_STATUS]  DEFAULT (' ') FOR [STATUS]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_ereading]  DEFAULT ((0)) FOR [ereading]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_NOTRAVELAGENT]  DEFAULT ((0)) FOR [NOTRAVELAGENT]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_OGNO]  DEFAULT ((0)) FOR [OGNO]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_maxkm]  DEFAULT ((0)) FOR [maxkm]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_maxhours]  DEFAULT ((0)) FOR [maxhours]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_maxkm_t]  DEFAULT ((0)) FOR [maxkm_t]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_maxhours_t]  DEFAULT ((0)) FOR [maxhours_t]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_mop]  DEFAULT ((0)) FOR [mop]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_CC_NAME]  DEFAULT ('') FOR [CC_NAME]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_CC_NUM]  DEFAULT ('') FOR [CC_NUM]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_CC_BANK]  DEFAULT ('') FOR [CC_BANK]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_GLACTNUM]  DEFAULT ((0)) FOR [GLACTNUM]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_GNO]  DEFAULT ((0)) FOR [GNO]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_discount]  DEFAULT ((0)) FOR [discount]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_finalbasic]  DEFAULT ((0)) FOR [finalbasic]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_finalbasic_t]  DEFAULT ((0)) FOR [finalbasic_t]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_finalbata]  DEFAULT ((0)) FOR [finalbata]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_finalbata_t]  DEFAULT ((0)) FOR [finalbata_t]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_finaltax]  DEFAULT ((0)) FOR [finaltax]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_split]  DEFAULT ('N') FOR [split]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_grno_co1]  DEFAULT ((0)) FOR [grno_co1]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_amt]  DEFAULT ((0)) FOR [amt]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_otherchgs]  DEFAULT ((0)) FOR [otherchgs]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_minkm]  DEFAULT ((0)) FOR [minkm]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_minkm_t]  DEFAULT ((0)) FOR [minkm_t]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_cancelled]  DEFAULT ('') FOR [cancelled]
GO
ALTER TABLE [dbo].[CHALAN] ADD  CONSTRAINT [DF_CHALAN_cess]  DEFAULT ((0)) FOR [cess]
GO
ALTER TABLE [dbo].[CHALAN] ADD  DEFAULT ('') FOR [gstin]
GO
ALTER TABLE [dbo].[CHALAN] ADD  DEFAULT ('N') FOR [cabreadysms]
GO
ALTER TABLE [dbo].[CHALAN] ADD  DEFAULT ('N') FOR [EINVOICE]
GO
ALTER TABLE [dbo].[CHALAN] ADD  DEFAULT ('') FOR [pin]
GO
ALTER TABLE [dbo].[CHALAN] ADD  DEFAULT ('') FOR [gstinname]
GO
ALTER TABLE [dbo].[CHALAN] ADD  DEFAULT ('') FOR [email]
GO
ALTER TABLE [dbo].[CHALAN] ADD  DEFAULT ('B2B') FOR [TXNCAT]
GO
ALTER TABLE [dbo].[CHART] ADD  CONSTRAINT [DF_CHART_TDNO]  DEFAULT ((0)) FOR [TDNO]
GO
ALTER TABLE [dbo].[CHART] ADD  CONSTRAINT [DF_CHART_ASSET]  DEFAULT ('') FOR [ASSET]
GO
ALTER TABLE [dbo].[CHART] ADD  CONSTRAINT [DF_CHART_ONAC]  DEFAULT ('') FOR [ONAC]
GO
ALTER TABLE [dbo].[CHART] ADD  CONSTRAINT [DF_CHART_PERMIT]  DEFAULT ('Y') FOR [PERMIT]
GO
ALTER TABLE [dbo].[chqformat] ADD  CONSTRAINT [DF__chqformat__iheig__0DF7F259]  DEFAULT ((5145)) FOR [iheight]
GO
ALTER TABLE [dbo].[chqformat] ADD  CONSTRAINT [DF_chqformat_orientation]  DEFAULT ((0)) FOR [orientation]
GO
ALTER TABLE [dbo].[chqformat] ADD  CONSTRAINT [DF_chqformat_printvou]  DEFAULT ((0)) FOR [printvou]
GO
ALTER TABLE [dbo].[chqformat] ADD  CONSTRAINT [DF_chqformat_e1width]  DEFAULT ((6000)) FOR [e1width]
GO
ALTER TABLE [dbo].[ColorForm] ADD  CONSTRAINT [DF_ColorForm_BCFixed]  DEFAULT ((0)) FOR [BCFixed]
GO
ALTER TABLE [dbo].[ColorForm] ADD  CONSTRAINT [DF_ColorForm_FrameForeColor]  DEFAULT ('o,0,0') FOR [FrameForeColor]
GO
ALTER TABLE [dbo].[ColorForm] ADD  CONSTRAINT [DF_ColorForm_GFcolor]  DEFAULT ('0,0,0') FOR [GFcolor]
GO
ALTER TABLE [dbo].[comlog] ADD  CONSTRAINT [DF_comlog_txndt]  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[comlog] ADD  CONSTRAINT [DF_comlog_txntype]  DEFAULT ((1)) FOR [txntype]
GO
ALTER TABLE [dbo].[commission] ADD  CONSTRAINT [DF_commission_mop]  DEFAULT ((0)) FOR [mop]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF_COMPANY_add1]  DEFAULT (' ') FOR [add1]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF_COMPANY_add2]  DEFAULT (' ') FOR [add2]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF_COMPANY_city]  DEFAULT ('New Delhi') FOR [city]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF_COMPANY_ADVRNO]  DEFAULT ((0)) FOR [ADVRNO]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF_COMPANY_ADVRDT]  DEFAULT ('1 april 1999') FOR [ADVRDT]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF_COMPANY_BNO]  DEFAULT ((0)) FOR [BNO]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF_COMPANY]  DEFAULT ('1 APR 1999') FOR [BDT]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF_COMPANY_BNO1]  DEFAULT ((0)) FOR [BNO1]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF_COMPANY_BDT1]  DEFAULT ('1 APR 1999') FOR [BDT1]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF_COMPANY_BNO2]  DEFAULT ((0)) FOR [BNO2]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF_COMPANY_BDT2]  DEFAULT ('1 APR 1999') FOR [BDT2]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF__company__g_final__064B1413]  DEFAULT ('') FOR [g_finalbillul]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF__company__link__5E1AFB1C]  DEFAULT ('Y') FOR [link]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF__company__fax__43B27E58]  DEFAULT ('') FOR [fax]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF__company__lic1__66D03021]  DEFAULT ('') FOR [lic1]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF__company__lic2__67C4545A]  DEFAULT ('') FOR [lic2]
GO
ALTER TABLE [dbo].[company] ADD  CONSTRAINT [DF_company_serialno]  DEFAULT ((0)) FOR [serialno]
GO
ALTER TABLE [dbo].[company] ADD  DEFAULT ('COT') FOR [billprefix]
GO
ALTER TABLE [dbo].[company] ADD  DEFAULT ('') FOR [GSTIN]
GO
ALTER TABLE [dbo].[company] ADD  DEFAULT ('COT') FOR [COT]
GO
ALTER TABLE [dbo].[company] ADD  DEFAULT ('') FOR [STATE]
GO
ALTER TABLE [dbo].[company] ADD  DEFAULT ('') FOR [PIN]
GO
ALTER TABLE [dbo].[company] ADD  DEFAULT ('') FOR [GSTINNAME]
GO
ALTER TABLE [dbo].[COMPARTY] ADD  CONSTRAINT [DF_comparty_name]  DEFAULT (' ') FOR [name]
GO
ALTER TABLE [dbo].[comtest] ADD  CONSTRAINT [DF_comtest_calldate]  DEFAULT (getdate()) FOR [calldate]
GO
ALTER TABLE [dbo].[Comtest1] ADD  DEFAULT ((0)) FOR [sms]
GO
ALTER TABLE [dbo].[Comtest1] ADD  DEFAULT ((0)) FOR [systemsms]
GO
ALTER TABLE [dbo].[comuser] ADD  CONSTRAINT [DF_comuser_logintime]  DEFAULT (getdate()) FOR [logintime]
GO
ALTER TABLE [dbo].[comuser] ADD  CONSTRAINT [DF_comuser_chktime]  DEFAULT (getdate()) FOR [chktime]
GO
ALTER TABLE [dbo].[comuser] ADD  CONSTRAINT [DF_comuser_control]  DEFAULT ('N') FOR [control]
GO
ALTER TABLE [dbo].[comuser] ADD  CONSTRAINT [DF__comuser__userno__5A2ECAEE]  DEFAULT ((0)) FOR [userno]
GO
ALTER TABLE [dbo].[comuser] ADD  CONSTRAINT [DF__comuser__CashBox__590CC29A]  DEFAULT ('N') FOR [CashBox]
GO
ALTER TABLE [dbo].[comuser] ADD  CONSTRAINT [DF__comuser__inet__5C32B2AA]  DEFAULT ((0)) FOR [inet]
GO
ALTER TABLE [dbo].[comuser] ADD  CONSTRAINT [DF__comuser__session__5D26D6E3]  DEFAULT ('') FOR [sessionid]
GO
ALTER TABLE [dbo].[comuser] ADD  DEFAULT ((0)) FOR [host_id]
GO
ALTER TABLE [dbo].[CONFIG] ADD  CONSTRAINT [DF_CONFIG_CODE2]  DEFAULT ('0') FOR [CODE2]
GO
ALTER TABLE [dbo].[COUPON] ADD  CONSTRAINT [DF_COUPON_Spl]  DEFAULT ('N') FOR [Spl]
GO
ALTER TABLE [dbo].[COUPON] ADD  CONSTRAINT [DF_COUPON_Gno]  DEFAULT ((0)) FOR [Gno]
GO
ALTER TABLE [dbo].[COUPON] ADD  CONSTRAINT [DF_COUPON_Txndt]  DEFAULT (getdate()) FOR [Txndt]
GO
ALTER TABLE [dbo].[COUPON] ADD  CONSTRAINT [DF_COUPON_Times]  DEFAULT ((1)) FOR [Times]
GO
ALTER TABLE [dbo].[crcardhold] ADD  CONSTRAINT [DF_crcardhold_gno]  DEFAULT ((0)) FOR [gno]
GO
ALTER TABLE [dbo].[crcardhold] ADD  CONSTRAINT [DF_crcardhold_status]  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[CRSINV] ADD  CONSTRAINT [DF_CRSINV_status]  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[CRSINV] ADD  CONSTRAINT [DF_CRSINV_message]  DEFAULT ('') FOR [message]
GO
ALTER TABLE [dbo].[CRSRates] ADD  CONSTRAINT [DF_CRSRates_renttypename]  DEFAULT ('General') FOR [renttypename]
GO
ALTER TABLE [dbo].[currentkot] ADD  CONSTRAINT [DF_currentkot_BNO]  DEFAULT ((0)) FOR [BNO]
GO
ALTER TABLE [dbo].[currentkot] ADD  CONSTRAINT [DF_currentkot_DRATE]  DEFAULT ((0)) FOR [DRATE]
GO
ALTER TABLE [dbo].[currentkot] ADD  CONSTRAINT [DF_currentkot_DAMT]  DEFAULT ((0)) FOR [DAMT]
GO
ALTER TABLE [dbo].[currentkot] ADD  CONSTRAINT [DF_currentkot_SCRATE]  DEFAULT ((0)) FOR [SCRATE]
GO
ALTER TABLE [dbo].[currentkot] ADD  CONSTRAINT [DF_currentkot_SCAMT]  DEFAULT ((0)) FOR [SCAMT]
GO
ALTER TABLE [dbo].[currentkot] ADD  CONSTRAINT [DF_currentkot_ROAMT]  DEFAULT ((0)) FOR [ROAMT]
GO
ALTER TABLE [dbo].[currentkot] ADD  CONSTRAINT [DF_currentkot_ratetype]  DEFAULT ((0)) FOR [ratetype]
GO
ALTER TABLE [dbo].[currentkot] ADD  CONSTRAINT [DF_currentkot_sno]  DEFAULT ((0)) FOR [sno]
GO
ALTER TABLE [dbo].[currentkot] ADD  CONSTRAINT [DF_currentkot_txndt]  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[currentkot] ADD  CONSTRAINT [DF_currentkot_ppcouponamt]  DEFAULT ((0)) FOR [ppcouponamt]
GO
ALTER TABLE [dbo].[currentkot] ADD  CONSTRAINT [DF_currentkot_st1]  DEFAULT ((0)) FOR [st1]
GO
ALTER TABLE [dbo].[currentkot] ADD  CONSTRAINT [DF_currentkot_cess1]  DEFAULT ((0)) FOR [cess1]
GO
ALTER TABLE [dbo].[currentkot] ADD  CONSTRAINT [DF_currentkot_sc1]  DEFAULT ((0)) FOR [sc1]
GO
ALTER TABLE [dbo].[currentkot] ADD  CONSTRAINT [DF_currentkot_sqno]  DEFAULT ((0)) FOR [sqno]
GO
ALTER TABLE [dbo].[currentkot] ADD  DEFAULT ((0)) FOR [cess2]
GO
ALTER TABLE [dbo].[currentkot] ADD  DEFAULT ((0)) FOR [cess21]
GO
ALTER TABLE [dbo].[currentkot] ADD  DEFAULT ((0)) FOR [packingchgs]
GO
ALTER TABLE [dbo].[currentkot] ADD  DEFAULT ((0)) FOR [kotconstant]
GO
ALTER TABLE [dbo].[currentkotbill] ADD  CONSTRAINT [DF_currentkotbill_status]  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[currentkotbill] ADD  DEFAULT ((0)) FOR [dup]
GO
ALTER TABLE [dbo].[currentkotk] ADD  CONSTRAINT [DF_currentkotk_kot]  DEFAULT ((0)) FOR [kot]
GO
ALTER TABLE [dbo].[currentkotm] ADD  CONSTRAINT [DF_currentkotm_rate]  DEFAULT ((0)) FOR [rate]
GO
ALTER TABLE [dbo].[currentkotsqno] ADD  CONSTRAINT [DF_currentkotsqno_status]  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[doorcust] ADD  CONSTRAINT [DF_doorcust_name]  DEFAULT ('') FOR [name]
GO
ALTER TABLE [dbo].[doorcust] ADD  CONSTRAINT [DF_doorcust_add1]  DEFAULT ('''') FOR [add1]
GO
ALTER TABLE [dbo].[doorcust] ADD  CONSTRAINT [DF_doorcust_add2]  DEFAULT ('') FOR [add2]
GO
ALTER TABLE [dbo].[doorcust] ADD  CONSTRAINT [DF_doorcust_area]  DEFAULT ('') FOR [area]
GO
ALTER TABLE [dbo].[doorcust] ADD  CONSTRAINT [DF_doorcust_phone]  DEFAULT ('0') FOR [phone]
GO
ALTER TABLE [dbo].[doorcust] ADD  CONSTRAINT [DF_doorcust_discountrate]  DEFAULT ((0)) FOR [discountrate]
GO
ALTER TABLE [dbo].[doorcust] ADD  DEFAULT ((0)) FOR [dobm]
GO
ALTER TABLE [dbo].[doorcust] ADD  DEFAULT ((0)) FOR [dobd]
GO
ALTER TABLE [dbo].[doorcust] ADD  DEFAULT ((0)) FOR [domm]
GO
ALTER TABLE [dbo].[doorcust] ADD  DEFAULT ((0)) FOR [domd]
GO
ALTER TABLE [dbo].[doorcust] ADD  CONSTRAINT [DF__doorcust__dobsms__73609888]  DEFAULT ('1/1/2000') FOR [dobsmssent]
GO
ALTER TABLE [dbo].[doorcust] ADD  CONSTRAINT [DF__doorcust__domsms__7454BCC1]  DEFAULT ('1/1/2000') FOR [domsmssent]
GO
ALTER TABLE [dbo].[doorcust] ADD  CONSTRAINT [DF__doorcust__dobema__7548E0FA]  DEFAULT ('1/1/2000') FOR [dobemailsent]
GO
ALTER TABLE [dbo].[doorcust] ADD  CONSTRAINT [DF__doorcust__domema__763D0533]  DEFAULT ('1/1/2000') FOR [domemailsent]
GO
ALTER TABLE [dbo].[doorcust] ADD  DEFAULT ('') FOR [GSTIN]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL1__rno__05EEBAAE]  DEFAULT ((0)) FOR [rno]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL1__gno__06E2DEE7]  DEFAULT ((0)) FOR [gno]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL__gname__07D70320]  DEFAULT ('') FOR [gname]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL__total__08CB2759]  DEFAULT ((0)) FOR [total]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL__advan__09BF4B92]  DEFAULT ((0)) FOR [advance]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL1__rent__0AB36FCB]  DEFAULT ((0)) FOR [rent]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL__disco__0BA79404]  DEFAULT ((0)) FOR [discount]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL1__lt__0C9BB83D]  DEFAULT ((0)) FOR [lt]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL1__sc__0D8FDC76]  DEFAULT ((0)) FOR [sc]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL__servi__0E8400AF]  DEFAULT ((0)) FOR [service1]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL__servi__0F7824E8]  DEFAULT ((0)) FOR [service2]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL__servi__106C4921]  DEFAULT ((0)) FOR [service3]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL__servi__11606D5A]  DEFAULT ((0)) FOR [service4]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL__servi__12549193]  DEFAULT ((0)) FOR [service5]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL__servi__1348B5CC]  DEFAULT ((0)) FOR [service6]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL__servi__143CDA05]  DEFAULT ((0)) FOR [service7]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL__servi__1530FE3E]  DEFAULT ((0)) FOR [service8]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL__servi__16252277]  DEFAULT ((0)) FOR [service9]
GO
ALTER TABLE [dbo].[DUMMYBILL1] ADD  CONSTRAINT [DF__DUMMYBILL__servi__171946B0]  DEFAULT ((0)) FOR [service10]
GO
ALTER TABLE [dbo].[dummyMIS] ADD  CONSTRAINT [DF_dummyMIS_roomservice]  DEFAULT ((0)) FOR [roomservice]
GO
ALTER TABLE [dbo].[dummyMIS] ADD  DEFAULT ((0)) FOR [otarent]
GO
ALTER TABLE [dbo].[DUMMYPCC] ADD  CONSTRAINT [DF_DUMMYPCC_partic]  DEFAULT ('') FOR [partic]
GO
ALTER TABLE [dbo].[DUMMYPP] ADD  CONSTRAINT [DF_DUMMYPP_sex]  DEFAULT ('M') FOR [sex]
GO
ALTER TABLE [dbo].[DUMMYPP] ADD  CONSTRAINT [DF__dummypp__VisaLif__6BBCA8C9]  DEFAULT ((0)) FOR [VisaLifeTime]
GO
ALTER TABLE [dbo].[DUMMYRENT] ADD  CONSTRAINT [DF__dummyrent__sc__74AFE73B]  DEFAULT ((0)) FOR [sc]
GO
ALTER TABLE [dbo].[DUMMYSERVICE] ADD  CONSTRAINT [DF__dummyserv__prepe__7C5FF2DD]  DEFAULT ('N') FOR [preper]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF_EDITASST_TXNDT]  DEFAULT (getdate()) FOR [TXNDT]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF_EDITASST_T1]  DEFAULT (getdate()) FOR [T1]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF_EDITASST_T2]  DEFAULT (getdate()) FOR [T2]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF_EDITASST_glname]  DEFAULT ('gupta') FOR [glname]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF_EDITASST_misprinter]  DEFAULT ('lpt1') FOR [misprinter]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF_EDITASST_outlet]  DEFAULT ((0)) FOR [outlet]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF_EDITASST_coprinter]  DEFAULT ((0)) FOR [coprinter]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF__editasst__resdt1__3DB3F0E4]  DEFAULT (getdate()) FOR [resdt1]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF__editasst__resdt2__3EA8151D]  DEFAULT (getdate()) FOR [resdt2]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF__editasst__resdt3__3F9C3956]  DEFAULT (getdate()) FOR [resdt3]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF__editasst__resdt4__40905D8F]  DEFAULT (getdate()) FOR [resdt4]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF__editasst__resdt5__418481C8]  DEFAULT (getdate()) FOR [resdt5]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF__editasst__resdt6__4278A601]  DEFAULT (getdate()) FOR [resdt6]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF__editasst__resdt7__436CCA3A]  DEFAULT (getdate()) FOR [resdt7]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF_EDITASST_kotstep2]  DEFAULT ((0)) FOR [kotstep2]
GO
ALTER TABLE [dbo].[EDITASST] ADD  CONSTRAINT [DF_EDITASST_kot2type]  DEFAULT ((0)) FOR [kot2type]
GO
ALTER TABLE [dbo].[einvoiceheader] ADD  DEFAULT ((0)) FOR [cno]
GO
ALTER TABLE [dbo].[einvoiceheader] ADD  DEFAULT ((0)) FOR [company]
GO
ALTER TABLE [dbo].[emailreport] ADD  CONSTRAINT [DF_emailreport_usernm]  DEFAULT ('AUTO') FOR [usernm]
GO
ALTER TABLE [dbo].[EPBX] ADD  CONSTRAINT [DF_EPBX_STATUS]  DEFAULT ('') FOR [STATUS]
GO
ALTER TABLE [dbo].[EPBX] ADD  CONSTRAINT [DF_EPBX_direction]  DEFAULT ('O') FOR [direction]
GO
ALTER TABLE [dbo].[EPBXData] ADD  CONSTRAINT [DF_EPBXData_Details]  DEFAULT (' ') FOR [Details]
GO
ALTER TABLE [dbo].[EPBXData] ADD  CONSTRAINT [DF_EPBXData_Txndt]  DEFAULT (getdate()) FOR [Txndt]
GO
ALTER TABLE [dbo].[EPBXStatus] ADD  CONSTRAINT [DF_EPBXStatus_txndt]  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[exbedco] ADD  CONSTRAINT [DF_exbedco_narration]  DEFAULT ('') FOR [narration]
GO
ALTER TABLE [dbo].[extension] ADD  CONSTRAINT [DF_extension_name]  DEFAULT ('Other Extensions') FOR [name]
GO
ALTER TABLE [dbo].[FFItems] ADD  CONSTRAINT [DF_FFItems_STATUS]  DEFAULT (' ') FOR [STATUS]
GO
ALTER TABLE [dbo].[FFItems] ADD  CONSTRAINT [DF_FFItems_Pvalue]  DEFAULT ((0)) FOR [Pvalue]
GO
ALTER TABLE [dbo].[FFItems] ADD  CONSTRAINT [DF_Table_1_DPercentage]  DEFAULT ((0)) FOR [DP]
GO
ALTER TABLE [dbo].[FFItems] ADD  CONSTRAINT [DF_FFItems_CValue]  DEFAULT ((0)) FOR [CValue]
GO
ALTER TABLE [dbo].[FINYEAR] ADD  CONSTRAINT [DF_FINYEAR_OnAcRcNo]  DEFAULT ((0)) FOR [OnAcRcNo]
GO
ALTER TABLE [dbo].[FINYEAR] ADD  CONSTRAINT [DF_FINYEAR_Blocked]  DEFAULT ('N') FOR [Blocked]
GO
ALTER TABLE [dbo].[FINYEAR] ADD  CONSTRAINT [DF_FINYEAR_ADvBFADate]  DEFAULT ('1 april 2000') FOR [ADvBFADate]
GO
ALTER TABLE [dbo].[FINYEAR] ADD  CONSTRAINT [DF_FINYEAR_CommnVno]  DEFAULT ((0)) FOR [CommnVno]
GO
ALTER TABLE [dbo].[FINYEAR] ADD  CONSTRAINT [DF_FINYEAR_detached]  DEFAULT ('') FOR [detached]
GO
ALTER TABLE [dbo].[FINYEAR] ADD  CONSTRAINT [DF_FINYEAR_bno1]  DEFAULT ((0)) FOR [bno1]
GO
ALTER TABLE [dbo].[FINYEAR] ADD  CONSTRAINT [DF_FINYEAR_bno2]  DEFAULT ((0)) FOR [bno2]
GO
ALTER TABLE [dbo].[FINYEAR] ADD  DEFAULT ((0)) FOR [bno]
GO
ALTER TABLE [dbo].[FINYEAR] ADD  CONSTRAINT [DF_FINYEAR_PackageBNo]  DEFAULT ((0)) FOR [PackageBNo]
GO
ALTER TABLE [dbo].[FINYEAR] ADD  CONSTRAINT [DF_FINYEAR_TA_ANo]  DEFAULT ((0.0)) FOR [TA_ANo]
GO
ALTER TABLE [dbo].[FINYEAR] ADD  DEFAULT ((0)) FOR [ns_sno]
GO
ALTER TABLE [dbo].[FINYEAR] ADD  DEFAULT ((0)) FOR [commcno]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_ADD1]  DEFAULT ('') FOR [ADD1]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_ADD2]  DEFAULT ('') FOR [ADD2]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_ADD3]  DEFAULT ('') FOR [ADD3]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_CITY]  DEFAULT ('') FOR [CITY]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_STATE]  DEFAULT ('') FOR [STATE]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_PIN]  DEFAULT ('') FOR [PIN]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_CONTACT]  DEFAULT ('') FOR [CONTACT]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_PHONE]  DEFAULT ('') FOR [PHONE]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_FAX]  DEFAULT ('') FOR [FAX]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_EMAIL]  DEFAULT ('') FOR [EMAIL]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_LASTVISIT]  DEFAULT ('1 APR 2002') FOR [LASTVISIT]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_HITCOUNT]  DEFAULT ((0)) FOR [HITCOUNT]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_PROFILE]  DEFAULT ('') FOR [PROFILE]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_renttype]  DEFAULT ((0)) FOR [RENTTYPE]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_lttype]  DEFAULT ((0)) FOR [LTTYPE]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_FPType]  DEFAULT ((1)) FOR [FPType]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_renttype1]  DEFAULT ((1)) FOR [renttype1]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_CRS]  DEFAULT ('N') FOR [CRS]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_pw]  DEFAULT ('') FOR [pw]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_gateqY]  DEFAULT ((0)) FOR [gateway]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  CONSTRAINT [DF_GCOMPANY_onlinestatus]  DEFAULT ((0)) FOR [onlineallowed]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  DEFAULT ('') FOR [gstin]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  DEFAULT ((0)) FOR [stopservice]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  DEFAULT ((1)) FOR [mktmgr]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  DEFAULT ((0)) FOR [commratetable]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  DEFAULT ((0)) FOR [commgstratetable]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  DEFAULT ((0)) FOR [commtcsratetable]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  DEFAULT ((0)) FOR [commglactno]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  DEFAULT ((0)) FOR [commeligibility]
GO
ALTER TABLE [dbo].[GCOMPANY] ADD  DEFAULT ((0)) FOR [commtdsratetable]
GO
ALTER TABLE [dbo].[GCompanyFoodDiscount] ADD  CONSTRAINT [DF_GCompanyFoodDiscount_fooddiscount]  DEFAULT ((0)) FOR [fooddiscount]
GO
ALTER TABLE [dbo].[gcomSet] ADD  CONSTRAINT [DF_gcomSet_fptype]  DEFAULT ((1)) FOR [fptype]
GO
ALTER TABLE [dbo].[gcomSet] ADD  CONSTRAINT [DF_gcomSet_discount]  DEFAULT ((0)) FOR [discount]
GO
ALTER TABLE [dbo].[gcomSet] ADD  CONSTRAINT [DF_gcomSet_sc]  DEFAULT ((0)) FOR [sc]
GO
ALTER TABLE [dbo].[gcomSet] ADD  CONSTRAINT [DF_gcomSet_rent1]  DEFAULT ((0)) FOR [rent1]
GO
ALTER TABLE [dbo].[gcomSet] ADD  CONSTRAINT [DF_gcomSet_rent2]  DEFAULT ((0)) FOR [rent2]
GO
ALTER TABLE [dbo].[gcomSet] ADD  DEFAULT ((1)) FOR [renttype1]
GO
ALTER TABLE [dbo].[GFOODPLAN] ADD  CONSTRAINT [DF_GFOODPLAN_NAME]  DEFAULT ('') FOR [NAME]
GO
ALTER TABLE [dbo].[GFOODPLAN] ADD  CONSTRAINT [DF_GFOODPLAN_DESCRIPTION]  DEFAULT ('') FOR [DESCRIPTION]
GO
ALTER TABLE [dbo].[GFOODPLAN] ADD  CONSTRAINT [DF_GFOODPLAN_CHARGES]  DEFAULT ((0)) FOR [CHARGES]
GO
ALTER TABLE [dbo].[gimages] ADD  CONSTRAINT [DF_gimages_pictype]  DEFAULT ((1)) FOR [pictype]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_COMPANY]  DEFAULT ((1)) FOR [COMPANY]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_BALANCE]  DEFAULT ((0)) FOR [BALANCE]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_OPGBAL]  DEFAULT ((0)) FOR [OPGBAL]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_LTXNDT]  DEFAULT (getdate()) FOR [LTXNDT]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_TXNNO]  DEFAULT ((0)) FOR [TXNNO]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_ASSET]  DEFAULT (' ') FOR [ASSET]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_ONAC]  DEFAULT (' ') FOR [ONAC]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_DEBIT1]  DEFAULT ((0)) FOR [DEBIT1]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_CREDIT1]  DEFAULT ((0)) FOR [CREDIT1]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_DEBIT2]  DEFAULT ((0)) FOR [DEBIT2]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_CREDIT2]  DEFAULT ((0)) FOR [CREDIT2]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_DEBIT3]  DEFAULT ((0)) FOR [DEBIT3]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_CREDIT3]  DEFAULT ((0)) FOR [CREDIT3]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_DEBIT4]  DEFAULT ((0)) FOR [DEBIT4]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_CREDIT4]  DEFAULT ((0)) FOR [CREDIT4]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_DEBIT5]  DEFAULT ((0)) FOR [DEBIT5]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_CREDIT5]  DEFAULT ((0)) FOR [CREDIT5]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_DEBIT6]  DEFAULT ((0)) FOR [DEBIT6]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_CREDIT6]  DEFAULT ((0)) FOR [CREDIT6]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_DEBIT7]  DEFAULT ((0)) FOR [DEBIT7]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_CREDIT7]  DEFAULT ((0)) FOR [CREDIT7]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_DEBIT8]  DEFAULT ((0)) FOR [DEBIT8]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_CREDIT8]  DEFAULT ((0)) FOR [CREDIT8]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_DEBIT9]  DEFAULT ((0)) FOR [DEBIT9]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_CREDIT9]  DEFAULT ((0)) FOR [CREDIT9]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_DEBIT10]  DEFAULT ((0)) FOR [DEBIT10]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_CREDIT10]  DEFAULT ((0)) FOR [CREDIT10]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_DEBIT11]  DEFAULT ((0)) FOR [DEBIT11]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_CREDIT11]  DEFAULT ((0)) FOR [CREDIT11]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_DEBIT12]  DEFAULT ((0)) FOR [DEBIT12]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_CREDIT12]  DEFAULT ((0)) FOR [CREDIT12]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_Deletable]  DEFAULT ('N') FOR [Deletable]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_subgrp]  DEFAULT ((1)) FOR [subgrp]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_PERMIT]  DEFAULT ('Y') FOR [PERMIT]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_AllowCredit]  DEFAULT ('Y') FOR [AllowCredit]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_email]  DEFAULT ('') FOR [email]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  CONSTRAINT [DF_GLPRIMLD_status]  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  DEFAULT ('') FOR [gstin]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  DEFAULT ('OLD') FOR [usernm]
GO
ALTER TABLE [dbo].[GLPRIMLD] ADD  DEFAULT ('1 Jan 2000') FOR [doo]
GO
ALTER TABLE [dbo].[GPASSPORT] ADD  CONSTRAINT [DF_GPASSPORT_doa]  DEFAULT (getdate()) FOR [doa]
GO
ALTER TABLE [dbo].[GPASSPORT] ADD  CONSTRAINT [DF_GPASSPORT_port]  DEFAULT ('IGIA') FOR [port]
GO
ALTER TABLE [dbo].[GPASSPORT] ADD  CONSTRAINT [DF_GPASSPORT_employed]  DEFAULT ('N') FOR [employed]
GO
ALTER TABLE [dbo].[GPASSPORT] ADD  CONSTRAINT [DF_GPASSPORT_stayduration]  DEFAULT ((1)) FOR [stayduration]
GO
ALTER TABLE [dbo].[GPASSPORT] ADD  CONSTRAINT [DF_GPASSPORT_purpose]  DEFAULT ('Tourist') FOR [purpose]
GO
ALTER TABLE [dbo].[GPASSPORT] ADD  CONSTRAINT [DF_GPASSPORT_cformno]  DEFAULT ((0)) FOR [cformno]
GO
ALTER TABLE [dbo].[GPASSPORT] ADD  CONSTRAINT [DF_GPASSPORT_visalifetime]  DEFAULT ((0)) FOR [visalifetime]
GO
ALTER TABLE [dbo].[GRENT] ADD  CONSTRAINT [DF_GRENT_RENT]  DEFAULT ((0)) FOR [RENT]
GO
ALTER TABLE [dbo].[GRENT] ADD  CONSTRAINT [DF_GRENT_HEAD]  DEFAULT ((1)) FOR [MALE]
GO
ALTER TABLE [dbo].[GRENT] ADD  CONSTRAINT [DF_GRENT_FEMALE]  DEFAULT ((0)) FOR [FEMALE]
GO
ALTER TABLE [dbo].[GRENT] ADD  CONSTRAINT [DF_GRENT_NettRent]  DEFAULT ((0)) FOR [NettRent]
GO
ALTER TABLE [dbo].[GSPLIT] ADD  CONSTRAINT [DF_GSPLIT_SPLIT]  DEFAULT ('N') FOR [SPLIT]
GO
ALTER TABLE [dbo].[GSTACtnum] ADD  DEFAULT (' ') FOR [name]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_ENO]  DEFAULT ((0)) FOR [ENO]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_CI_DATE]  DEFAULT (getdate()) FOR [CI_DATE]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_GRNO]  DEFAULT ((0)) FOR [GRNO]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_FOODPLAN]  DEFAULT ((0)) FOR [FOODPLAN]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_RENT]  DEFAULT ((0)) FOR [RENT]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_DISCOUNT]  DEFAULT ((0)) FOR [DISCOUNT]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_SC]  DEFAULT ((0)) FOR [SC]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_MALE]  DEFAULT ((0)) FOR [MALE]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_FEMALE]  DEFAULT ((0)) FOR [FEMALE]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_CHILD]  DEFAULT ((0)) FOR [CHILD]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_grpname]  DEFAULT (' ') FOR [grpname]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_grpcounter]  DEFAULT ((0)) FOR [grpcounter]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_BNO]  DEFAULT ((0)) FOR [BNO]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_userchkin]  DEFAULT ('') FOR [userchkin]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_userchkout]  DEFAULT ('') FOR [userchkout]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_reserve_ref]  DEFAULT ((0)) FOR [reserve_ref]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_reserve_adv]  DEFAULT ((0)) FOR [reserve_adv]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_reserve_adv_cno]  DEFAULT ((0)) FOR [reserve_adv_cno]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_LT]  DEFAULT ('Y') FOR [LT]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_company]  DEFAULT ((0)) FOR [company]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_FP_details]  DEFAULT ('') FOR [FP_details]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_OMale]  DEFAULT ((0)) FOR [OMale]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_arrivedfrom]  DEFAULT (' ') FOR [arrivedfrom]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_destination]  DEFAULT (' ') FOR [destination]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__guest__qcheck__5B17050E]  DEFAULT ('N') FOR [qcheck]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__GUEST__QNAME__5C0B2947]  DEFAULT ('') FOR [QNAME]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_opentoall]  DEFAULT ('Y') FOR [opentoall]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_AUTOBILL]  DEFAULT ('N') FOR [AUTOBILL]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_AUTOAMT]  DEFAULT ((0)) FOR [AUTOAMT]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_autoitem]  DEFAULT ((0)) FOR [autoitem]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_autoqty]  DEFAULT ((0)) FOR [autoqty]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__guest__cistatus__165D59FD]  DEFAULT (' ') FOR [cistatus]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__guest__wustatus__17517E36]  DEFAULT (' ') FOR [wustatus]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__guest__wutimeset__1845A26F]  DEFAULT (' ') FOR [wutimeset]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_Name]  DEFAULT ('') FOR [Name]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_Add1]  DEFAULT ('') FOR [Add1]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_Add2]  DEFAULT ('') FOR [Add2]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_Add3]  DEFAULT ('') FOR [Add3]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_City]  DEFAULT ('') FOR [City]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_State]  DEFAULT ('''') FOR [State]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_Phone]  DEFAULT ('') FOR [Phone]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_fax]  DEFAULT ('') FOR [fax]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_email]  DEFAULT ('') FOR [email]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_Address]  DEFAULT ('Mr') FOR [Address]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_nationality]  DEFAULT ('Indian') FOR [nationality]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_PIN]  DEFAULT ('') FOR [PIN]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_VoucherNo]  DEFAULT ('') FOR [VoucherNo]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__guest__smssent__5A0D3CDE]  DEFAULT ('N') FOR [smssent]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__guest__tnxemails__72AB068D]  DEFAULT (' ') FOR [tnxemailsent]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__guest__emailtime__739F2AC6]  DEFAULT (getdate()) FOR [emailtime]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__guest__cardsissu__61FA018A]  DEFAULT ((0)) FOR [cardsissued]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__guest__FoodCoupo__60233292]  DEFAULT ((0)) FOR [FoodCoupon]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__guest__GI__7375FE28]  DEFAULT ((0)) FOR [GI]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_AllInclusive]  DEFAULT ('N') FOR [AllInclusive]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_RentType1]  DEFAULT ((1)) FOR [RentType1]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_LTTYpe]  DEFAULT ((0)) FOR [LTTYpe]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_NettRent]  DEFAULT ((0)) FOR [NettRent]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_mktmgr]  DEFAULT ((0)) FOR [mktmgr]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_NettRentExcluingST]  DEFAULT ((0)) FOR [NettRentExcludingST]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF_GUEST_stopextra]  DEFAULT ((0)) FOR [stopextra]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ((0)) FOR [st]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ('') FOR [noshow]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ('') FOR [channel]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ((0)) FOR [ischannel]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ((0)) FOR [channelamt]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ('') FOR [staahid]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ((0)) FOR [channelexbed]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ((0)) FOR [channelexbedok]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__GUEST__dobsmssen__6BBF76C0]  DEFAULT ('1/1/2000') FOR [dobsmssent]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__GUEST__domsmssen__6CB39AF9]  DEFAULT ('1/1/2000') FOR [domsmssent]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__GUEST__dobemails__6DA7BF32]  DEFAULT ('1/1/2000') FOR [dobemailsent]
GO
ALTER TABLE [dbo].[GUEST] ADD  CONSTRAINT [DF__GUEST__domemails__6E9BE36B]  DEFAULT ('1/1/2000') FOR [domemailsent]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ((0)) FOR [ExtraBedCharges]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ((0)) FOR [inetsmssent]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ((0)) FOR [inetemailsent]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ('') FOR [porting]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ('') FOR [gstin]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ((0)) FOR [food]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ((0)) FOR [extrabed]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ((0)) FOR [repup]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ((0)) FOR [stopservice]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ('') FOR [gstinsplit]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ((0)) FOR [otacommctrlno]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ('N') FOR [einvoice]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ('B2B') FOR [TXNCAT]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ('N') FOR [whatsapp]
GO
ALTER TABLE [dbo].[GUEST] ADD  DEFAULT ('N') FOR [whatsappCI]
GO
ALTER TABLE [dbo].[guest2] ADD  CONSTRAINT [DF_guest2_spldiscount]  DEFAULT ((0)) FOR [spldiscount]
GO
ALTER TABLE [dbo].[guest2] ADD  DEFAULT ('') FOR [gstin]
GO
ALTER TABLE [dbo].[guest2] ADD  DEFAULT ('Luxury Tax') FOR [HEADERLT]
GO
ALTER TABLE [dbo].[guest2] ADD  DEFAULT ('Service Chgs') FOR [HEADERSC]
GO
ALTER TABLE [dbo].[guest2] ADD  DEFAULT ('Service Tax') FOR [HEADERST]
GO
ALTER TABLE [dbo].[guest2] ADD  DEFAULT ('CESS') FOR [HEADERCESS]
GO
ALTER TABLE [dbo].[guest2] ADD  DEFAULT ('CESS') FOR [fpname]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_GUESTAD_ADDRESS]  DEFAULT ('') FOR [ADDRESS]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_ADDBK_ADD1]  DEFAULT ('') FOR [ADD1]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_ADDBK_ADD2]  DEFAULT ('') FOR [ADD2]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_ADDBK_ADD3]  DEFAULT ('') FOR [ADD3]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_ADDBK_CITY]  DEFAULT ('') FOR [CITY]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_ADDBK_STATE]  DEFAULT ('') FOR [STATE]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_ADDBK_PIN]  DEFAULT ('') FOR [PIN]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_ADDBK_PHONE]  DEFAULT ('') FOR [PHONE]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_ADDBK_FAX]  DEFAULT ('') FOR [FAX]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_ADDBK_EMAIL]  DEFAULT ('') FOR [EMAIL]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_GUESTAD_COMPANY_NO]  DEFAULT ((0)) FOR [COMPANY]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_GUESTAD_LIKES]  DEFAULT ('') FOR [LIKES]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_GUESTAD_LASTVISIT]  DEFAULT ('1 APR 2002') FOR [LASTVISIT]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_GUESTAD_RENT]  DEFAULT ((0)) FOR [RENT]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_GUESTAD_DISCOUNT]  DEFAULT ((0)) FOR [DISCOUNT]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_GUESTAD_SC]  DEFAULT ((0)) FOR [SC]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_GUESTAD_uniquenetid]  DEFAULT ((0)) FOR [uniquenetid]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  CONSTRAINT [DF_GUESTAD_renttype1]  DEFAULT ((1)) FOR [renttype1]
GO
ALTER TABLE [dbo].[GUESTAD] ADD  DEFAULT ('') FOR [gstin]
GO
ALTER TABLE [dbo].[GuestFP] ADD  CONSTRAINT [DF_GuestFP_txndt]  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[GuestSet] ADD  CONSTRAINT [DF_GuestSet_rent1]  DEFAULT ((0)) FOR [rent1]
GO
ALTER TABLE [dbo].[GuestSet] ADD  CONSTRAINT [DF_GuestSet_rent2]  DEFAULT ((0)) FOR [rent2]
GO
ALTER TABLE [dbo].[GuestSet] ADD  CONSTRAINT [DF_GuestSet_renttype]  DEFAULT ((0)) FOR [renttype]
GO
ALTER TABLE [dbo].[GuestSet] ADD  CONSTRAINT [DF_GuestSet_lttype]  DEFAULT ((0)) FOR [lttype]
GO
ALTER TABLE [dbo].[GuestSet] ADD  CONSTRAINT [DF_GuestSet_discount]  DEFAULT ((0)) FOR [discount]
GO
ALTER TABLE [dbo].[GuestSet] ADD  CONSTRAINT [DF_GuestSet_sc]  DEFAULT ((0)) FOR [sc]
GO
ALTER TABLE [dbo].[GuestSet] ADD  CONSTRAINT [DF_GuestSet_fptype]  DEFAULT ((1)) FOR [fptype]
GO
ALTER TABLE [dbo].[GuestSet] ADD  CONSTRAINT [DF_GuestSet_lastvisit]  DEFAULT (getdate()) FOR [lastvisit]
GO
ALTER TABLE [dbo].[GuestSet] ADD  CONSTRAINT [DF_GuestSet_renttype1]  DEFAULT ((1)) FOR [renttype1]
GO
ALTER TABLE [dbo].[HKHist] ADD  CONSTRAINT [DF_HKHist_rep_doc]  DEFAULT (getdate()) FOR [rep_doc]
GO
ALTER TABLE [dbo].[HKHist] ADD  CONSTRAINT [DF_HKHist_rep_status]  DEFAULT (' ') FOR [rep_status]
GO
ALTER TABLE [dbo].[HmsFolder] ADD  CONSTRAINT [DF_HmsFolder_version_no]  DEFAULT ('3.1.1') FOR [version_no]
GO
ALTER TABLE [dbo].[HmsFolder] ADD  CONSTRAINT [DF__hmsfolder__count__22C19A34]  DEFAULT ((0)) FOR [counter]
GO
ALTER TABLE [dbo].[HmsFolder] ADD  CONSTRAINT [DF__hmsfolder__hitco__23B5BE6D]  DEFAULT ((0)) FOR [hitcounter]
GO
ALTER TABLE [dbo].[HmsFolder] ADD  CONSTRAINT [DF_HmsFolder_usd]  DEFAULT ((0)) FOR [usd]
GO
ALTER TABLE [dbo].[HmsFolder] ADD  DEFAULT ((1)) FOR [cashaccount]
GO
ALTER TABLE [dbo].[HmsFolder] ADD  DEFAULT ((0)) FOR [timer]
GO
ALTER TABLE [dbo].[InetAccess] ADD  CONSTRAINT [DF_InetAccess_txndt]  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[infosent] ADD  DEFAULT ((0)) FOR [Monthly]
GO
ALTER TABLE [dbo].[infosent] ADD  DEFAULT ((0)) FOR [Weekly]
GO
ALTER TABLE [dbo].[infosent] ADD  DEFAULT ((0)) FOR [monthlyrr]
GO
ALTER TABLE [dbo].[infosent] ADD  DEFAULT ((0)) FOR [weeklyrr]
GO
ALTER TABLE [dbo].[infosent] ADD  DEFAULT ((0)) FOR [hotel]
GO
ALTER TABLE [dbo].[infosent] ADD  DEFAULT ((0)) FOR [resto]
GO
ALTER TABLE [dbo].[infosent] ADD  DEFAULT ('N') FOR [whatsappsent]
GO
ALTER TABLE [dbo].[KITGUEST] ADD  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[KITGUEST] ADD  DEFAULT ((0)) FOR [repup]
GO
ALTER TABLE [dbo].[KITHIST] ADD  CONSTRAINT [DF__kithist__prefere__7DF2FF9B]  DEFAULT ('') FOR [preference]
GO
ALTER TABLE [dbo].[KITHIST] ADD  CONSTRAINT [DF_KITHIST_ST]  DEFAULT ((0)) FOR [ST]
GO
ALTER TABLE [dbo].[KITHIST] ADD  CONSTRAINT [DF_KITHIST_CESS]  DEFAULT ((0)) FOR [CESS]
GO
ALTER TABLE [dbo].[KITHIST] ADD  CONSTRAINT [DF_KITHIST_SC]  DEFAULT ((0)) FOR [SC]
GO
ALTER TABLE [dbo].[KITHIST] ADD  DEFAULT ((0)) FOR [cess2]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_DRATE]  DEFAULT ((0)) FOR [DRATE]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_GNO]  DEFAULT ((0)) FOR [GNO]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_RNO]  DEFAULT ((0)) FOR [RNO]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_PMODE]  DEFAULT ((1)) FOR [PMODE]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_SPLIT]  DEFAULT (' ') FOR [SPLIT]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_WNO]  DEFAULT ((0)) FOR [WNO]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_ROAMOUNT]  DEFAULT ((0)) FOR [ROAMT]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_RATETYPE]  DEFAULT ((0)) FOR [RATETYPE]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_SCAMT]  DEFAULT ((0)) FOR [SCAMT]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_SCRATE]  DEFAULT ((0)) FOR [SCRATE]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_STSET]  DEFAULT ((0)) FOR [STSET]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_SCSET]  DEFAULT ((0)) FOR [SCSET]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_CRNAME]  DEFAULT (' ') FOR [CRNAME]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_CRNUM]  DEFAULT (' ') FOR [CRNUM]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_CRTYPE]  DEFAULT (' ') FOR [CRTYPE]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_LUX]  DEFAULT ('N') FOR [LUX]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_usernm]  DEFAULT ('NIL') FOR [usernm]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_txntime]  DEFAULT ('12:00') FOR [txntime]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_FinalAmt]  DEFAULT ((0)) FOR [FinalAmt]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF__kithist1__autopo__19018F22]  DEFAULT ('N') FOR [autoposting]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF__kithist1__strbno__2118119B]  DEFAULT ('') FOR [strbno]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_ndiscount]  DEFAULT ((0)) FOR [ndiscount]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_ServiceTax]  DEFAULT ((0)) FOR [ServiceTax]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_CESS]  DEFAULT ((0)) FOR [CESS]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_vatonst]  DEFAULT ((0)) FOR [vatonst]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF__KITHIST1__vatons__02173585]  DEFAULT ((0)) FOR [vatonsc]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  CONSTRAINT [DF_KITHIST1_packingchgs]  DEFAULT ((0)) FOR [packingchgs]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ((0)) FOR [partpayment]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ((0)) FOR [pmode1]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('') FOR [crname1]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('') FOR [crnum1]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('') FOR [crbank1]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ((0)) FOR [gno1]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('') FOR [gstin]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ((0)) FOR [ndiscgst]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('N') FOR [einvoice]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('') FOR [gstinname]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('') FOR [name]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('') FOR [add1]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('') FOR [add2]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('') FOR [city]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('') FOR [state]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('') FOR [pin]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('') FOR [phone]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('') FOR [email]
GO
ALTER TABLE [dbo].[KITHIST1] ADD  DEFAULT ('B2B') FOR [TXNCAT]
GO
ALTER TABLE [dbo].[KITMAST] ADD  CONSTRAINT [DF_KITMAST_NOTAXCATEGORY]  DEFAULT ((0)) FOR [NOTAXCATEGORY]
GO
ALTER TABLE [dbo].[KITMAST1] ADD  CONSTRAINT [DF_KITMAST1_UNIT]  DEFAULT ('PC') FOR [UNIT]
GO
ALTER TABLE [dbo].[KITMAST1] ADD  CONSTRAINT [DF_KITMAST1_STOCK]  DEFAULT ((0)) FOR [STOCK]
GO
ALTER TABLE [dbo].[KITMAST2] ADD  CONSTRAINT [DF_KITMAST2_otype]  DEFAULT ((1)) FOR [otype]
GO
ALTER TABLE [dbo].[KITMAST2] ADD  CONSTRAINT [DF_KITMAST2_outlet]  DEFAULT ((1)) FOR [outlet]
GO
ALTER TABLE [dbo].[kitprime] ADD  CONSTRAINT [DF_kitprime_subclass]  DEFAULT ((1)) FOR [subclass]
GO
ALTER TABLE [dbo].[kitprime] ADD  CONSTRAINT [DF_kitprime_NoRate]  DEFAULT ('N') FOR [NoRate]
GO
ALTER TABLE [dbo].[kitprime] ADD  CONSTRAINT [DF__kitprime__prefer__7EE723D4]  DEFAULT ('') FOR [preference]
GO
ALTER TABLE [dbo].[kitprime] ADD  CONSTRAINT [DF_kitprime_Unit]  DEFAULT ('PC') FOR [Unit]
GO
ALTER TABLE [dbo].[kitprime] ADD  DEFAULT ((0)) FOR [shcode]
GO
ALTER TABLE [dbo].[kitprime] ADD  DEFAULT ('') FOR [shcodeud]
GO
ALTER TABLE [dbo].[kitprime] ADD  DEFAULT ('') FOR [hsn]
GO
ALTER TABLE [dbo].[kitprime] ADD  DEFAULT ((0)) FOR [taxorgst]
GO
ALTER TABLE [dbo].[KOTCatelog] ADD  CONSTRAINT [DF_KOTCatelog_MOP]  DEFAULT ((0)) FOR [MOP]
GO
ALTER TABLE [dbo].[KOTCatelog] ADD  CONSTRAINT [DF_KOTCatelog_Value]  DEFAULT ((1)) FOR [Value]
GO
ALTER TABLE [dbo].[KOTCatelog] ADD  CONSTRAINT [DF_KOTCatelog_WControl]  DEFAULT ((1)) FOR [WControl]
GO
ALTER TABLE [dbo].[KOTCatelog] ADD  CONSTRAINT [DF_KOTCatelog_DControl]  DEFAULT ((1)) FOR [DControl]
GO
ALTER TABLE [dbo].[KOTCatelog] ADD  CONSTRAINT [DF_KOTCatelog_CodeControl]  DEFAULT ((0)) FOR [CodeControl]
GO
ALTER TABLE [dbo].[KOTCatelog] ADD  CONSTRAINT [DF_KOTCatelog_COutlet]  DEFAULT ((0)) FOR [COutlet]
GO
ALTER TABLE [dbo].[kotconstant] ADD  CONSTRAINT [DF_kotctrlno_ctrlno]  DEFAULT ((0)) FOR [ctrlno]
GO
ALTER TABLE [dbo].[lic] ADD  DEFAULT ('Original for Recipient') FOR [lic3]
GO
ALTER TABLE [dbo].[LTMASTER] ADD  CONSTRAINT [DF_LTMASTER_SDT]  DEFAULT ('1 APR 2001') FOR [SDT]
GO
ALTER TABLE [dbo].[LTMASTER] ADD  CONSTRAINT [DF_LTMASTER_EDT]  DEFAULT ('31 DEC 2999') FOR [EDT]
GO
ALTER TABLE [dbo].[LTMASTER] ADD  DEFAULT ('LUXURY TAX') FOR [ltname]
GO
ALTER TABLE [dbo].[LTMASTER] ADD  DEFAULT ('LT') FOR [ltSHname]
GO
ALTER TABLE [dbo].[LTMASTER] ADD  DEFAULT ((47)) FOR [glactno]
GO
ALTER TABLE [dbo].[LTONTARIFF] ADD  DEFAULT ('N') FOR [ltrateontariff]
GO
ALTER TABLE [dbo].[LTTABLE] ADD  CONSTRAINT [DF_LTTABLE_FAMT]  DEFAULT ((0)) FOR [FAMT]
GO
ALTER TABLE [dbo].[massdel] ADD  DEFAULT ((0)) FOR [amt]
GO
ALTER TABLE [dbo].[massdel] ADD  DEFAULT ((0)) FOR [rent]
GO
ALTER TABLE [dbo].[menusearch] ADD  CONSTRAINT [DF_menusearch_menutype]  DEFAULT ((0)) FOR [menutype]
GO
ALTER TABLE [dbo].[misset] ADD  CONSTRAINT [DF_misset_settings]  DEFAULT ((0)) FOR [settings]
GO
ALTER TABLE [dbo].[misset] ADD  CONSTRAINT [DF_misset_counter]  DEFAULT ((0)) FOR [cnt]
GO
ALTER TABLE [dbo].[MizStock] ADD  CONSTRAINT [DF_MizStock_Opening]  DEFAULT ((0)) FOR [Opening]
GO
ALTER TABLE [dbo].[MizStock] ADD  CONSTRAINT [DF_MizStock_Received]  DEFAULT ((0)) FOR [Received]
GO
ALTER TABLE [dbo].[MizStock] ADD  CONSTRAINT [DF_MizStock_Consumed]  DEFAULT ((0)) FOR [Consumed]
GO
ALTER TABLE [dbo].[MizStock] ADD  CONSTRAINT [DF_MizStock_Closing]  DEFAULT ((0)) FOR [Closing]
GO
ALTER TABLE [dbo].[MizStock] ADD  DEFAULT ((0)) FOR [outlet]
GO
ALTER TABLE [dbo].[mktmgr] ADD  CONSTRAINT [DF_mktmgr_status]  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[mktmgr] ADD  CONSTRAINT [DF_mktmgr_CRS]  DEFAULT ('N') FOR [CRS]
GO
ALTER TABLE [dbo].[msgcount] ADD  CONSTRAINT [DF_msgcount_count]  DEFAULT ((0)) FOR [count]
GO
ALTER TABLE [dbo].[msgcount] ADD  CONSTRAINT [DF_msgcount_countsent]  DEFAULT ((0)) FOR [countsent]
GO
ALTER TABLE [dbo].[msgcount] ADD  CONSTRAINT [DF_msgcount_scnt]  DEFAULT ((0)) FOR [scnt]
GO
ALTER TABLE [dbo].[msgcount] ADD  CONSTRAINT [DF_msgcount_rcnt]  DEFAULT ((0)) FOR [rcnt]
GO
ALTER TABLE [dbo].[MYBILLS] ADD  CONSTRAINT [DF_MYBILLS_AMOUNT]  DEFAULT ((0)) FOR [AMOUNT]
GO
ALTER TABLE [dbo].[MYBILLS] ADD  CONSTRAINT [DF_MYBILLS_btype]  DEFAULT ((0)) FOR [btype]
GO
ALTER TABLE [dbo].[MYBILLS] ADD  CONSTRAINT [DF_MYBILLS_Description]  DEFAULT (' ') FOR [Description]
GO
ALTER TABLE [dbo].[MYCUST] ADD  CONSTRAINT [DF_MYCUST_TYPE]  DEFAULT ((1)) FOR [TYPE]
GO
ALTER TABLE [dbo].[MYCUST] ADD  CONSTRAINT [DF_MYCUST_amount]  DEFAULT ((0)) FOR [amount]
GO
ALTER TABLE [dbo].[necmboutlet] ADD  CONSTRAINT [DF_necmboutlet_items]  DEFAULT ((0)) FOR [items]
GO
ALTER TABLE [dbo].[NECMiniBar] ADD  CONSTRAINT [DF_NECMiniBar_txndt]  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[NECMiniBar] ADD  CONSTRAINT [DF_NECMiniBar_status]  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[NECMiniBar] ADD  CONSTRAINT [DF_NECMiniBar_acctd]  DEFAULT (' ') FOR [acctd]
GO
ALTER TABLE [dbo].[OL24] ADD  CONSTRAINT [DF_OL24_gno]  DEFAULT ((0)) FOR [gno]
GO
ALTER TABLE [dbo].[OL24] ADD  CONSTRAINT [DF_OL24_amount]  DEFAULT ((0)) FOR [amount]
GO
ALTER TABLE [dbo].[OL24] ADD  CONSTRAINT [DF_OL24_SeqNo]  DEFAULT ((0)) FOR [SeqNo]
GO
ALTER TABLE [dbo].[OL24] ADD  CONSTRAINT [DF_OL24_txndt]  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[olstkadj] ADD  CONSTRAINT [DF_olstkadj_usernm]  DEFAULT ('SYS') FOR [usernm]
GO
ALTER TABLE [dbo].[olstkadj] ADD  DEFAULT ((0)) FOR [outlet]
GO
ALTER TABLE [dbo].[olstore] ADD  CONSTRAINT [DF_olstore_stock]  DEFAULT ((0)) FOR [stock]
GO
ALTER TABLE [dbo].[olstore] ADD  CONSTRAINT [DF_olstore_lpdate]  DEFAULT (getdate()) FOR [lpdate]
GO
ALTER TABLE [dbo].[olstore] ADD  CONSTRAINT [DF_olstore_lidate]  DEFAULT (getdate()) FOR [lidate]
GO
ALTER TABLE [dbo].[olstore] ADD  CONSTRAINT [DF_olstore_rate]  DEFAULT ((0)) FOR [rate]
GO
ALTER TABLE [dbo].[olstore] ADD  CONSTRAINT [DF_olstore_indent]  DEFAULT ('Y') FOR [indent]
GO
ALTER TABLE [dbo].[OnAcRc] ADD  CONSTRAINT [DF_OnAcRc_MOP]  DEFAULT ((1)) FOR [MOP]
GO
ALTER TABLE [dbo].[OnAcRc] ADD  CONSTRAINT [DF_OnAcRc_Details]  DEFAULT ('') FOR [Details]
GO
ALTER TABLE [dbo].[OTACommission] ADD  DEFAULT (getdate()) FOR [entrydate]
GO
ALTER TABLE [dbo].[OTACommission] ADD  DEFAULT ((0)) FOR [commission]
GO
ALTER TABLE [dbo].[OTACommission] ADD  DEFAULT ((0)) FOR [GST]
GO
ALTER TABLE [dbo].[OTACommission] ADD  DEFAULT ((0)) FOR [TCS]
GO
ALTER TABLE [dbo].[OTACommission] ADD  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[OTACommission] ADD  DEFAULT ((0)) FOR [tdsrate]
GO
ALTER TABLE [dbo].[OTACommission] ADD  DEFAULT ((0)) FOR [tdsamt]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_CURDATE]  DEFAULT ('1 APR 2000') FOR [CURDATE]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_KOTDATE]  DEFAULT ('1 APRIL 2000') FOR [KOTDATE]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_KOTNO]  DEFAULT ((0)) FOR [KOTNO]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_BILLDATE]  DEFAULT ('1 APRIL 2000') FOR [BILLDATE]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_RO_ACTNUM]  DEFAULT ((0)) FOR [RO_ACTNUM]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_GRNO]  DEFAULT ((0)) FOR [GRNO]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_SELFDEAL]  DEFAULT ('N') FOR [SELFDEAL]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_HOTELACNUM]  DEFAULT ((0)) FOR [HNO_MYBOOK]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_GRNO_TRF]  DEFAULT ((0)) FOR [GRNO_TRF]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_SC_ACTNUM]  DEFAULT ((0)) FOR [SC_ACTNUM]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_STSET]  DEFAULT ((0)) FOR [STSET]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_SCSET]  DEFAULT ((0)) FOR [SCSET]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_HTL_GRNO]  DEFAULT ((0)) FOR [CO1GRNO]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_LUX]  DEFAULT ('N') FOR [LUX]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_SC]  DEFAULT ('N') FOR [SC]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_FREEFOOD_VOUCHING]  DEFAULT ('Y') FOR [FREEFOODVOUCHING]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_AUTOKOT]  DEFAULT ('N') FOR [AUTOKOT]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_SALETAXNO]  DEFAULT ('') FOR [SALETAXNO]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_G_STAXINCL]  DEFAULT ('N') FOR [G_STAXINCL]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_G_cutter]  DEFAULT ((0)) FOR [G_cutter]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_Duplicate]  DEFAULT ((0)) FOR [Duplicate]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_ScRate]  DEFAULT ((0)) FOR [ScRate]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_RoundOff]  DEFAULT ('N') FOR [RoundOff]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF__outlet__sc_table__6EDA75A9]  DEFAULT ((1)) FOR [sc_table]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF__outlet__sc_room__6FCE99E2]  DEFAULT ((1)) FOR [sc_room]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF__outlet__sc_door__70C2BE1B]  DEFAULT ((1)) FOR [sc_door]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_ServiceTax]  DEFAULT ('N') FOR [ServiceTax]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_bno]  DEFAULT ((0)) FOR [bno]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF__outlet__qtyfract__0B7F9651]  DEFAULT ((0)) FOR [qtyfraction]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_guestdetails]  DEFAULT ((0)) FOR [guestdetails]
GO
ALTER TABLE [dbo].[OUTLET] ADD  DEFAULT ((0)) FOR [STTABLENO]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_VATONST]  DEFAULT ((0)) FOR [VATONST]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_coname]  DEFAULT ((0)) FOR [coname]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_chname]  DEFAULT ((1)) FOR [chname]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_olname]  DEFAULT ((0)) FOR [olname]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_infoline]  DEFAULT ((0)) FOR [infoline]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_infolinedetail]  DEFAULT ('') FOR [infolinedetail]
GO
ALTER TABLE [dbo].[OUTLET] ADD  DEFAULT ((0)) FOR [onepercent]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_forstamp]  DEFAULT ((1)) FOR [forstamp]
GO
ALTER TABLE [dbo].[OUTLET] ADD  DEFAULT ('') FOR [greetingline]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_powercaptain]  DEFAULT ((0)) FOR [powercaptain]
GO
ALTER TABLE [dbo].[OUTLET] ADD  DEFAULT ((0)) FOR [NoKOTAddress]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_servicetaxacno]  DEFAULT ((77)) FOR [servicetaxacno]
GO
ALTER TABLE [dbo].[OUTLET] ADD  CONSTRAINT [DF_OUTLET_cessacno]  DEFAULT ((78)) FOR [cessacno]
GO
ALTER TABLE [dbo].[OUTLET] ADD  DEFAULT ('KOT') FOR [billprefix]
GO
ALTER TABLE [dbo].[OUTLET] ADD  DEFAULT ('') FOR [sac]
GO
ALTER TABLE [dbo].[OUTLET] ADD  DEFAULT ((0)) FOR [showsc]
GO
ALTER TABLE [dbo].[OUTLET] ADD  DEFAULT ('VAT on Food') FOR [vatname]
GO
ALTER TABLE [dbo].[OUTLET] ADD  DEFAULT ('VAT on Food') FOR [newcolumn]
GO
ALTER TABLE [dbo].[outletcomputersetting] ADD  CONSTRAINT [DF_outletcomputersetting_duplicate]  DEFAULT ((0)) FOR [duplicate]
GO
ALTER TABLE [dbo].[outletcomputersetting] ADD  CONSTRAINT [DF_outletcomputersetting_g_cutter]  DEFAULT ((0)) FOR [g_cutter]
GO
ALTER TABLE [dbo].[outletcomputersetting] ADD  CONSTRAINT [DF_outletcomputersetting_qtyfraction]  DEFAULT ((0)) FOR [qtyfraction]
GO
ALTER TABLE [dbo].[outletcomputersetting] ADD  CONSTRAINT [DF_outletcomputersetting_guestdetails]  DEFAULT ((0)) FOR [guestdetails]
GO
ALTER TABLE [dbo].[outletcomputersetting] ADD  CONSTRAINT [DF_outletcomputersetting_directtokitchen]  DEFAULT ((0)) FOR [directtokitchen]
GO
ALTER TABLE [dbo].[outletcomputersetting] ADD  DEFAULT ((0)) FOR [KOTTimes]
GO
ALTER TABLE [dbo].[PHHELPER] ADD  CONSTRAINT [DF_PHHELPER_OUTLET]  DEFAULT ((0)) FOR [OUTLET]
GO
ALTER TABLE [dbo].[PHHELPER] ADD  CONSTRAINT [DF_PHHELPER_SDT]  DEFAULT ('1 APR 2002') FOR [SDT]
GO
ALTER TABLE [dbo].[PHHELPER] ADD  CONSTRAINT [DF_PHHELPER_EDT]  DEFAULT ('1 APR 2002') FOR [EDT]
GO
ALTER TABLE [dbo].[PHHIST] ADD  CONSTRAINT [DF_PHHIST_PARTIC]  DEFAULT (' ') FOR [PARTIC]
GO
ALTER TABLE [dbo].[PHHIST] ADD  CONSTRAINT [DF_PHHIST_AMOUNT]  DEFAULT ((0)) FOR [AMOUNT]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_GNO]  DEFAULT ((0)) FOR [GNO]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_DRATE]  DEFAULT ((0)) FOR [DRATE]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_CD_NUM]  DEFAULT (' ') FOR [CD_NUM]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_CD_NAME]  DEFAULT (' ') FOR [CD_NAME]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_CD_TYPE]  DEFAULT (' ') FOR [CD_TYPE]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_DAMT]  DEFAULT ((0)) FOR [DAMT]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_SPLIT]  DEFAULT ('N') FOR [SPLIT]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_SELFDEAL]  DEFAULT ('Y') FOR [SELFDEAL]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_RNO]  DEFAULT ((0)) FOR [RNO]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_CRNAME]  DEFAULT (' ') FOR [CRNAME]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_CRNUM]  DEFAULT (' ') FOR [CRNUM]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_CRTYPE]  DEFAULT (' ') FOR [CRTYPE]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_LUX]  DEFAULT ('N') FOR [LUX]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_txntime]  DEFAULT ('12:00') FOR [txntime]
GO
ALTER TABLE [dbo].[PHONE] ADD  DEFAULT ('System') FOR [usernm]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_SCAMT]  DEFAULT ((0)) FOR [SCAMT]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_SCRate]  DEFAULT ((0)) FOR [SCRate]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_stamt]  DEFAULT ((0)) FOR [stamt]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_strate]  DEFAULT ((0)) FOR [strate]
GO
ALTER TABLE [dbo].[PHONE] ADD  CONSTRAINT [DF_PHONE_finalamt]  DEFAULT ((0)) FOR [finalamt]
GO
ALTER TABLE [dbo].[PHONE] ADD  DEFAULT ('') FOR [gstin]
GO
ALTER TABLE [dbo].[PHONE] ADD  DEFAULT ('N') FOR [einvoice]
GO
ALTER TABLE [dbo].[PHONE] ADD  DEFAULT ('') FOR [gstinname]
GO
ALTER TABLE [dbo].[PHONE] ADD  DEFAULT ('') FOR [name]
GO
ALTER TABLE [dbo].[PHONE] ADD  DEFAULT ('') FOR [add1]
GO
ALTER TABLE [dbo].[PHONE] ADD  DEFAULT ('') FOR [add2]
GO
ALTER TABLE [dbo].[PHONE] ADD  DEFAULT ('') FOR [city]
GO
ALTER TABLE [dbo].[PHONE] ADD  DEFAULT ('') FOR [state]
GO
ALTER TABLE [dbo].[PHONE] ADD  DEFAULT ('') FOR [pin]
GO
ALTER TABLE [dbo].[PHONE] ADD  DEFAULT ('') FOR [phone]
GO
ALTER TABLE [dbo].[PHONE] ADD  DEFAULT ('') FOR [email]
GO
ALTER TABLE [dbo].[PHONE] ADD  DEFAULT ('B2B') FOR [TXNCAT]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  CONSTRAINT [DF_PHOUTLET_SHNAME]  DEFAULT (' ') FOR [SHNAME]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  CONSTRAINT [DF_PHOUTLET_SNO]  DEFAULT ((0)) FOR [SNO]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  CONSTRAINT [DF_PHOUTLET_BILLDATE]  DEFAULT ('1 APR 2002') FOR [BILLDATE]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  CONSTRAINT [DF_PHOUTLET_HTL_GRNO]  DEFAULT ((0)) FOR [CO1GRNO]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  CONSTRAINT [DF_PHOUTLET_LUX]  DEFAULT ('N') FOR [LUX]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  CONSTRAINT [DF_PHOUTLET_SC]  DEFAULT ('N') FOR [SC]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  CONSTRAINT [DF_PHOUTLET_BILLPOSITION]  DEFAULT ((0)) FOR [BILLPOSITION1]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  CONSTRAINT [DF_PHOUTLET_billposition2]  DEFAULT ((0)) FOR [BILLPOSITION2]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  CONSTRAINT [DF_PHOUTLET_SCRate]  DEFAULT ((0)) FOR [SCRate]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  CONSTRAINT [DF_PHOUTLET_STRate]  DEFAULT ((0)) FOR [STRate]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  CONSTRAINT [DF_PHOUTLET_STName]  DEFAULT ('Sale Tax') FOR [STName]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  CONSTRAINT [DF_PHOUTLET_ST_Actnum]  DEFAULT ((55)) FOR [ST_Actnum]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  DEFAULT ((0)) FOR [sttableno]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  DEFAULT ('SRB') FOR [billprefix]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  DEFAULT ('') FOR [sac]
GO
ALTER TABLE [dbo].[PHOUTLET] ADD  DEFAULT ((0)) FOR [running]
GO
ALTER TABLE [dbo].[PowerBrain] ADD  CONSTRAINT [DF_PowerBrain_smstime]  DEFAULT (getdate()) FOR [smstime]
GO
ALTER TABLE [dbo].[PowerBrain] ADD  CONSTRAINT [DF_PowerBrain_smssent]  DEFAULT ('') FOR [smssent]
GO
ALTER TABLE [dbo].[PowerBrain] ADD  CONSTRAINT [DF_PowerBrain_Alert]  DEFAULT ('') FOR [Alert]
GO
ALTER TABLE [dbo].[PowerBrain] ADD  DEFAULT ('N') FOR [IMAGES]
GO
ALTER TABLE [dbo].[PowerBrain] ADD  DEFAULT ('N') FOR [STOREIMAGES]
GO
ALTER TABLE [dbo].[PowerBrain] ADD  DEFAULT ('1/1/2000') FOR [IMAGESTXNDT]
GO
ALTER TABLE [dbo].[PowerBrain] ADD  DEFAULT ('1/1/2000') FOR [STOREIMAGESTXNDT]
GO
ALTER TABLE [dbo].[PowerBrain] ADD  DEFAULT ('N') FOR [Icheck]
GO
ALTER TABLE [dbo].[PowerBrain] ADD  DEFAULT ('1/1/2000') FOR [ichecktxndt]
GO
ALTER TABLE [dbo].[PrePaidCouponMaster] ADD  CONSTRAINT [DF_PrePaidCouponMaster_status]  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[PrePaidCouponMaster] ADD  CONSTRAINT [DF_PrePaidCouponMaster_startdate]  DEFAULT (getdate()) FOR [startdate]
GO
ALTER TABLE [dbo].[PrePaidCouponMaster] ADD  CONSTRAINT [DF_PrePaidCouponMaster_CouponType]  DEFAULT ((0)) FOR [CouponType]
GO
ALTER TABLE [dbo].[puvehicle] ADD  CONSTRAINT [DF_puvehicle_Charges]  DEFAULT ((0)) FOR [Charges]
GO
ALTER TABLE [dbo].[regentvisitor] ADD  CONSTRAINT [DF_regentvisitor_txndt]  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[rentaccount] ADD  CONSTRAINT [DF_rentaccount_lrate]  DEFAULT ((0)) FOR [lrate]
GO
ALTER TABLE [dbo].[rentaccount] ADD  CONSTRAINT [DF_rentaccount_actnum]  DEFAULT ((0)) FOR [actnum]
GO
ALTER TABLE [dbo].[RentType] ADD  DEFAULT ('') FOR [staahcode]
GO
ALTER TABLE [dbo].[resavenuelog] ADD  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[RESTCO] ADD  CONSTRAINT [DF_RESTCO_SHNAME]  DEFAULT (' ') FOR [SHNAME]
GO
ALTER TABLE [dbo].[RESTCO] ADD  CONSTRAINT [DF_RESTCO_billposition]  DEFAULT ((0)) FOR [billposition1]
GO
ALTER TABLE [dbo].[RESTCO] ADD  CONSTRAINT [DF_RESTCO_billposition2]  DEFAULT ((0)) FOR [billposition2]
GO
ALTER TABLE [dbo].[RESTCO] ADD  CONSTRAINT [DF_RESTCO_htl_receivable]  DEFAULT ((24)) FOR [htl_receivable]
GO
ALTER TABLE [dbo].[RESTCO] ADD  CONSTRAINT [DF_RESTCO_self_receivable]  DEFAULT ((24)) FOR [self_receivable]
GO
ALTER TABLE [dbo].[RESTCO] ADD  CONSTRAINT [DF_RESTCO_line1]  DEFAULT ('') FOR [line1]
GO
ALTER TABLE [dbo].[RESTCO] ADD  CONSTRAINT [DF_RESTCO_line2]  DEFAULT ('') FOR [line2]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_GNO]  DEFAULT ((0)) FOR [GNO]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_RENT1]  DEFAULT ((0)) FOR [RENT1]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_RENT2]  DEFAULT ((0)) FOR [RENT2]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_ROOMTYPE]  DEFAULT ('DELUXE') FOR [ROOMTYPE]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_GRPNAME]  DEFAULT (' ') FOR [GRPNAME]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_CI]  DEFAULT (' ') FOR [CI]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_WU]  DEFAULT (' ') FOR [WU]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_TIME]  DEFAULT (' ') FOR [TIME]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_STD]  DEFAULT (' ') FOR [STD]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_EXNT]  DEFAULT (' ') FOR [EXTN]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_CHECKOUT]  DEFAULT (' ') FOR [CHECKOUT]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_HOSTID]  DEFAULT ('') FOR [HOSTID]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_STATUS]  DEFAULT (' ') FOR [STATUS]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_CALLRATE]  DEFAULT ((0)) FOR [CALLRATE]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_INSTANT]  DEFAULT (' ') FOR [INSTANT]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_CAPACITY]  DEFAULT ((1)) FOR [CAPACITY]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_EXBED]  DEFAULT ((0)) FOR [EXBED]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_EVERYEX]  DEFAULT ((0)) FOR [EVERYEX]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_RentRate21]  DEFAULT ((0)) FOR [RentRate21]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_RentRate22]  DEFAULT ((0)) FOR [RentRate22]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_RoomWing]  DEFAULT ((1)) FOR [RoomWing]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_Sendstatus]  DEFAULT (' ') FOR [Sendstatus]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF__room__qcheck__5A22E0D5]  DEFAULT ('N') FOR [qcheck]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_CISTATUS]  DEFAULT (' ') FOR [CISTATUS]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_WUTIMESET]  DEFAULT ('') FOR [WUTIMESET]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_WUSTATUS]  DEFAULT (' ') FOR [WUSTATUS]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_DATAEXCHANGE]  DEFAULT (' ') FOR [DATAEXCHANGE]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF__room__SL__30AC954D]  DEFAULT (' ') FOR [SL]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF__room__SLNO__31A0B986]  DEFAULT (' ') FOR [SLNO]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_OL24]  DEFAULT (' ') FOR [OL24CI]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_OL24GNO]  DEFAULT ((0)) FOR [OL24GNO]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_24OLPW]  DEFAULT ('    ') FOR [OL24PW]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_24OLSMS]  DEFAULT ('N') FOR [OL24SMS]
GO
ALTER TABLE [dbo].[ROOM] ADD  CONSTRAINT [DF_ROOM_24OLCount]  DEFAULT ((0)) FOR [OL24Count]
GO
ALTER TABLE [dbo].[ROOM] ADD  DEFAULT (' ') FOR [HKSMS]
GO
ALTER TABLE [dbo].[ROOM] ADD  DEFAULT ((0)) FOR [CISMSSent]
GO
ALTER TABLE [dbo].[ROOM] ADD  DEFAULT ((1)) FOR [roomsection]
GO
ALTER TABLE [dbo].[ROOM] ADD  DEFAULT ('rno') FOR [rnoa]
GO
ALTER TABLE [dbo].[ROOM] ADD  DEFAULT ((0)) FOR [drent]
GO
ALTER TABLE [dbo].[ROOM] ADD  DEFAULT ((0)) FOR [dset]
GO
ALTER TABLE [dbo].[ROOM] ADD  DEFAULT ((1)) FOR [kavachadd]
GO
ALTER TABLE [dbo].[ROOM] ADD  DEFAULT (' ') FOR [OL24NAME]
GO
ALTER TABLE [dbo].[RoomDues] ADD  CONSTRAINT [DF_RoomDues_split]  DEFAULT (' ') FOR [split]
GO
ALTER TABLE [dbo].[ServiceAGRNO] ADD  CONSTRAINT [DF_ServiceAGRNO_grnocash]  DEFAULT ((0)) FOR [grnocash]
GO
ALTER TABLE [dbo].[ServiceAGRNO] ADD  CONSTRAINT [DF_ServiceAGRNO_grnors]  DEFAULT ((0)) FOR [grnors]
GO
ALTER TABLE [dbo].[ServiceAGRNO] ADD  CONSTRAINT [DF_ServiceAGRNO_grnogl]  DEFAULT ((0)) FOR [grnogl]
GO
ALTER TABLE [dbo].[ServiceAGRNO] ADD  CONSTRAINT [DF_ServiceAGRNO_grnocc]  DEFAULT ((0)) FOR [grnocc]
GO
ALTER TABLE [dbo].[ServiceAGRNO] ADD  CONSTRAINT [DF_ServiceAGRNO_grnobr]  DEFAULT ((0)) FOR [grnobr]
GO
ALTER TABLE [dbo].[ServiceBGRNO] ADD  CONSTRAINT [DF_ServiceBGRNO_grnocash]  DEFAULT ((0)) FOR [grnocash]
GO
ALTER TABLE [dbo].[ServiceBGRNO] ADD  CONSTRAINT [DF_ServiceBGRNO_grnogl]  DEFAULT ((0)) FOR [grnogl]
GO
ALTER TABLE [dbo].[ServiceBGRNO] ADD  CONSTRAINT [DF_ServiceBGRNO_grnocc]  DEFAULT ((0)) FOR [grnocc]
GO
ALTER TABLE [dbo].[ServiceBGRNO] ADD  CONSTRAINT [DF_ServiceBGRNO_grnobr]  DEFAULT ((0)) FOR [grnobr]
GO
ALTER TABLE [dbo].[servicecbill] ADD  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[servicechist] ADD  DEFAULT ((0)) FOR [qty]
GO
ALTER TABLE [dbo].[servicechist] ADD  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[servicepermission] ADD  CONSTRAINT [DF_servicepermission_permission]  DEFAULT ('N') FOR [permission]
GO
ALTER TABLE [dbo].[servicepermission] ADD  CONSTRAINT [DF_servicepermission_outlettype]  DEFAULT ((0)) FOR [outlettype]
GO
ALTER TABLE [dbo].[servicepermission] ADD  CONSTRAINT [DF_servicepermission_outlet]  DEFAULT ((0)) FOR [outlet]
GO
ALTER TABLE [dbo].[servicepermission] ADD  CONSTRAINT [DF__servicepe__prepe__7A77AA6B]  DEFAULT ('N') FOR [preper]
GO
ALTER TABLE [dbo].[servicepermission] ADD  CONSTRAINT [DF__servicepe__usern__7B6BCEA4]  DEFAULT ((0)) FOR [userno1]
GO
ALTER TABLE [dbo].[sessions] ADD  CONSTRAINT [DF_sessions_updated]  DEFAULT ((0)) FOR [updated]
GO
ALTER TABLE [dbo].[sessions] ADD  CONSTRAINT [DF_sessions_mailsent]  DEFAULT ((0)) FOR [mailsent]
GO
ALTER TABLE [dbo].[sessions] ADD  CONSTRAINT [DF_sessions_reservationno]  DEFAULT ((0)) FOR [reservationno]
GO
ALTER TABLE [dbo].[setprinter] ADD  CONSTRAINT [DF__setprinte__Print__744D2AC0]  DEFAULT ((0)) FOR [PrinterType]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_AUTOKOT]  DEFAULT ((0)) FOR [G_AUTOKOT]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_KIT_DISC]  DEFAULT ((0)) FOR [G_KIT_DISC]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_KIT_SC]  DEFAULT ((0)) FOR [G_KIT_SC]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_AUTO_RENT]  DEFAULT ((0)) FOR [G_AUTO_RENT]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_DISC_ALLOW]  DEFAULT ((0)) FOR [G_DISC_ALLOW]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_GUESTDETAILS]  DEFAULT ((0)) FOR [G_GUESTDETAILS]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_BNO_GENERATION]  DEFAULT ((0)) FOR [G_BNO_GENERATION]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_RUNNINGDATE]  DEFAULT (getdate()) FOR [G_RUNNINGDATE]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_VISUALDRIVE]  DEFAULT ('') FOR [G_VISUALDRIVE]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_OCCCOLS]  DEFAULT ((0)) FOR [G_OCCCOLS]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_PaperType]  DEFAULT ((0)) FOR [PaperType]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_g_epbx]  DEFAULT ('Y') FOR [g_epbx]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_ROUNDOFF]  DEFAULT ('N') FOR [G_ROUNDOFF]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_BILLPRINTER]  DEFAULT ((0)) FOR [G_BILLPRINTER]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_EPBXMODEL]  DEFAULT ('USHA') FOR [G_EPBXMODEL]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_STRICTLT]  DEFAULT ('Y') FOR [G_STRICTLT]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_EXBED]  DEFAULT ((0)) FOR [G_EXBED]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_AUTOCUTTER]  DEFAULT ((0)) FOR [G_AUTOCUTTER]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_STOREOUTLET]  DEFAULT ((0)) FOR [G_STOREOUTLET]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_TTMaster]  DEFAULT ((0)) FOR [G_TTMaster]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_FreeLimit]  DEFAULT ((0)) FOR [G_FreeLimit]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_Cashier]  DEFAULT ('Cashier') FOR [G_Cashier]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_ltontariff]  DEFAULT ('N') FOR [G_ltontariff]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_foodbillnarration]  DEFAULT ('Ex.Food Bill') FOR [foodbillnarration]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_Bill_LH]  DEFAULT ('N') FOR [G_Bill_LH]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_Occupancy]  DEFAULT ('N') FOR [G_Occupancy]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_OccRH]  DEFAULT ((500)) FOR [G_OccRH]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_OccRw]  DEFAULT ((700)) FOR [G_OccRw]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_OccWings]  DEFAULT ((0)) FOR [G_OccWings]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_OccNew]  DEFAULT ((0)) FOR [G_OccNew]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_PASSP__5CFF4D80]  DEFAULT ((0)) FOR [G_PASSPORT_COMPEL]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_QUICK__5DF371B9]  DEFAULT ((0)) FOR [G_QUICK]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_PickupComp]  DEFAULT (' ') FOR [G_PickupComp]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_Close__0ECE1543]  DEFAULT ((0)) FOR [G_CloseImmediate]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_BillT__0FC2397C]  DEFAULT ((0)) FOR [G_BillTime]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_EpbxMenu]  DEFAULT ((0)) FOR [G_EpbxMenu]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_g_finalbillul]  DEFAULT (' ') FOR [g_finalbillul]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_g_numbering]  DEFAULT ('Y') FOR [g_numbering]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_billConsolidation]  DEFAULT ('Y') FOR [G_billConsolidation]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_Preprintedfinal]  DEFAULT ('N') FOR [G_Preprintedfinal]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_NewBillModel]  DEFAULT ('Y') FOR [G_NewModelBill]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_CallRate]  DEFAULT ((5)) FOR [G_CallRate]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_PulseRate]  DEFAULT ((1.20)) FOR [G_PulseRate]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_PhoneTax]  DEFAULT ((5)) FOR [G_PhoneTax]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_HotelPhoneHandlinghChgs]  DEFAULT ((2)) FOR [G_HotelPhoneHandlingChgs]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_AutoBillOutlet]  DEFAULT ((0)) FOR [G_AutoBillOutlet]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__g_sc_de__613302A2]  DEFAULT ('N') FOR [g_sc_default]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__g_sc_ra__622726DB]  DEFAULT ((0)) FOR [g_sc_rate]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_g_couponprinter]  DEFAULT ((0)) FOR [g_couponprinter]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_AutoBillShow]  DEFAULT ('Y') FOR [G_AutoBillShow]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_g_kotfinaltime]  DEFAULT ((180)) FOR [g_kotfinaltime]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__g_ltinc__24A9E2A6]  DEFAULT ('Y') FOR [g_ltinclusive]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__AutoBil__7698FF33]  DEFAULT ((0)) FOR [AutoBillOutlet]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_SC_LTRules]  DEFAULT ((0)) FOR [G_SC_LTRules]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_SC_Afterdisc]  DEFAULT ((0)) FOR [G_SC_Afterdisc]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_CIT_Excuse]  DEFAULT ((300)) FOR [G_CIT_Excuse]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_COT_Excuse]  DEFAULT ((240)) FOR [G_COT_Excuse]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_AutoS__589531AE]  DEFAULT ((0)) FOR [G_AutoSplDisc]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_SCEnabled]  DEFAULT ((1)) FOR [G_SCEnabled]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_EPBXCheck]  DEFAULT ('') FOR [G_EPBXWatcher]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_Juri__31F065D9]  DEFAULT ('Under Delhi Jurisdiction') FOR [G_Juri]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_DISC_LTRULES]  DEFAULT ((0)) FOR [G_DISC_LTRULES]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__currenc__02F25272]  DEFAULT ('Rupees') FOR [currency1]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__currenc__03E676AB]  DEFAULT ('Paise') FOR [currency2]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__resadvp__04DA9AE4]  DEFAULT ((0)) FOR [resadvprinter]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__shortcu__05CEBF1D]  DEFAULT ('Rs.') FOR [shortcurrency]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__scforal__08AB2BC8]  DEFAULT ((0)) FOR [scforall]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_Final__2A0C1F93]  DEFAULT ((0)) FOR [G_FinalBillBackColor]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_STDRATE]  DEFAULT ((10)) FOR [G_STDRATE]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_ISDRATE]  DEFAULT ((25)) FOR [G_ISDRATE]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_FIXSTD]  DEFAULT ('N') FOR [G_FIXSTD]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_ISDPULSE]  DEFAULT ((60)) FOR [G_ISDPULSE]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_STDPULSE]  DEFAULT ((60)) FOR [G_STDPULSE]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_COPRINTER]  DEFAULT ((0)) FOR [G_COPRinter]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_AdvPRINTER]  DEFAULT ((0)) FOR [G_AdvPRinter]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_TT_PRINTER]  DEFAULT ((0)) FOR [G_tt_printer]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_COMM_PRINTER]  DEFAULT ((0)) FOR [G_Commnprinter]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_Logo__05D9AC15]  DEFAULT ((0)) FOR [G_Logo]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_HalfD__2CBE6F0C]  DEFAULT ((0)) FOR [G_HalfDayPermit]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_MisEn__7FB6BE6B]  DEFAULT ((0)) FOR [G_MisEno]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_Cform__2942E3E3]  DEFAULT ((0)) FOR [G_Cform_Printer]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_Print__0BE4C15E]  DEFAULT ((0)) FOR [G_PrintAtKitchen]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_vouPr__0CD8E597]  DEFAULT ((0)) FOR [G_vouPrinter]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_ChqPr__0DCD09D0]  DEFAULT ('') FOR [G_ChqPrinter]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_Kit_E__447CBB58]  DEFAULT ((8)) FOR [G_Kit_End_Lines]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_Vouch__4570DF91]  DEFAULT ((0)) FOR [G_Voucher_Eject]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_PWCon__0AFAF090]  DEFAULT ((0)) FOR [G_PWControl]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_PWDay__0BEF14C9]  DEFAULT ((30)) FOR [G_PWDays]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_DOSCh__6FAA3DDB]  DEFAULT ((1)) FOR [G_DOSChqPrinter]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_Guest__7AC94CD1]  DEFAULT ((0)) FOR [G_Guest_Card]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_ShowA__07C4EBEA]  DEFAULT ((0)) FOR [G_ShowAllAc]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_SafeL__2FB87114]  DEFAULT ((0)) FOR [G_SafeLock]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_Defau__5756252C]  DEFAULT ('') FOR [G_DefaultNationality]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__D_color__5FEB6B2D]  DEFAULT ((0)) FOR [D_color]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_LTonS__7F356714]  DEFAULT ((0)) FOR [G_LTonSc]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_CashB__5A00E6D3]  DEFAULT ((0)) FOR [G_CashBox]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_IdleT__5AF50B0C]  DEFAULT ((30)) FOR [G_IdleTime]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_AutoLogoutTime]  DEFAULT ((15)) FOR [G_AutoLogoutTime]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__allowcr__21FD5029]  DEFAULT ((1)) FOR [allowcredit]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_FinAc__5FFA82A2]  DEFAULT ((1)) FOR [G_FinAccount]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_ConRe__7AD96167]  DEFAULT ((0)) FOR [G_ConRent]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__g_bnq_p__610125D4]  DEFAULT ((0)) FOR [g_bnq_printer]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__g_autog__6CF22D37]  DEFAULT ((0)) FOR [g_autoguestad]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__g_autog__6DE65170]  DEFAULT ((0)) FOR [g_autoguestset]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_DonCh__296E3000]  DEFAULT ((0)) FOR [G_DonChangeReservationRent]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_GPDes__2A625439]  DEFAULT ((0)) FOR [G_GPDesignationwise]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_ScNet__515D22EA]  DEFAULT ((0)) FOR [G_ScNettRent]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_PDAWa__6E02E9AC]  DEFAULT ('') FOR [G_PDAWatcher]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_Indic__6EF70DE5]  DEFAULT ((0)) FOR [G_IndicateServiceNo]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_KOT_G__73BBC302]  DEFAULT ((1)) FOR [G_KOT_GUESTSign]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_Foote__1A7A617A]  DEFAULT ((0)) FOR [G_Footer2]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_Disab__4F98352F]  DEFAULT ((0)) FOR [G_DisableSplDiscount]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_KitRo__4021B2CC]  DEFAULT ((0)) FOR [G_KitRoff]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_Store__39398225]  DEFAULT ((0)) FOR [G_Storeminus]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_KOTMe__305A552B]  DEFAULT ((0)) FOR [G_KOTMerge]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__BnoisEn__77E0F1DE]  DEFAULT ((0)) FOR [BnoisEno]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_BillH__1941E5A9]  DEFAULT ((2000)) FOR [G_BillHeaderHeight]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_ShRoo__27900500]  DEFAULT ((1)) FOR [G_ShRooms]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_taxsy__05FA070B]  DEFAULT ((0)) FOR [G_taxsystem]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_Backu__3944A0E7]  DEFAULT ('') FOR [G_BackupComputer]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__setting__G_OnAcP__45AA77CC]  DEFAULT ((0)) FOR [G_OnAcPrintType]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_12Noo__3620E970]  DEFAULT ((0)) FOR [G_12Noon]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_12Noo__37150DA9]  DEFAULT (' ') FOR [G_12NoonStr]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_MakeM__380931E2]  DEFAULT (' ') FOR [G_MakeMyRoomComputer]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_SCVAT__38FD561B]  DEFAULT ((0)) FOR [G_SCVAT]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__CardCha__39F17A54]  DEFAULT ((0)) FOR [CardChargeOutlet]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__CardCha__3AE59E8D]  DEFAULT ((0)) FOR [CardChargeAmt]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_CashE__3BD9C2C6]  DEFAULT ((1)) FOR [G_CashEntries]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_First__3CCDE6FF]  DEFAULT ((240)) FOR [G_FirstHalfCutOffTime]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_Secon__3DC20B38]  DEFAULT ((240)) FOR [G_SecondHalfCutOffTime]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_FoodC__3EB62F71]  DEFAULT ((0)) FOR [G_FoodCouponType]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_Alpha__3FAA53AA]  DEFAULT ((0)) FOR [G_AlphaSet]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_Auto2__409E77E3]  DEFAULT ((0)) FOR [G_Auto24Hour]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_Auto2__41929C1C]  DEFAULT ((0)) FOR [G_Auto24Start]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_Auto2__4286C055]  DEFAULT ((0)) FOR [G_Auto24End]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__g_expsh__437AE48E]  DEFAULT ((0)) FOR [g_expshow]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_Heade__446F08C7]  DEFAULT ((0)) FOR [G_HeaderInAllPages]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_Supre__45632D00]  DEFAULT ((0)) FOR [G_SupressRoomTypesInBills]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_BillF__46575139]  DEFAULT ((0)) FOR [G_BillFormat2]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_BillA__474B7572]  DEFAULT ((0)) FOR [G_BillA5]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_HeadOtherchgs]  DEFAULT ('OtherChgs') FOR [G_HeadOtherchgs]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_TitleOtherChgs]  DEFAULT ('Misc. Charges') FOR [G_TitleOtherChgs]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_FinStart]  DEFAULT ((0)) FOR [G_FinStart]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_LTName]  DEFAULT ('Luxury Tax') FOR [G_LTName]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_G_LTNameSH]  DEFAULT ('LT') FOR [G_LTNameSH]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_LTExe__4D044EC8]  DEFAULT ((0)) FOR [G_LTExemptionVisible]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_INetOutlet]  DEFAULT ((3)) FOR [INetOutlet]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_Early__4EEC973A]  DEFAULT ((0)) FOR [G_Early]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_12_24__4FE0BB73]  DEFAULT ((0)) FOR [G_12_24_Freeze]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_12_24__50D4DFAC]  DEFAULT ((0)) FOR [G_12_24_Index]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__g_email__51C903E5]  DEFAULT ((0)) FOR [g_emailoption]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__g_pemai__52BD281E]  DEFAULT ('') FOR [g_pemail]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__g_pemai__53B14C57]  DEFAULT ('') FOR [g_pemailpw]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__g_pemai__54A57090]  DEFAULT ('') FOR [g_pemailport]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__g_pemai__559994C9]  DEFAULT ('') FOR [g_pemailsmtp]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_STONS__568DB902]  DEFAULT ((0)) FOR [G_STONSC]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__NOOLD__5781DD3B]  DEFAULT ((0)) FOR [NOOLD]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__CODUE__58760174]  DEFAULT ('') FOR [CODUE]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__KOTFont__596A25AD]  DEFAULT ('Arial') FOR [KOTFontName]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__KOTFont__5A5E49E6]  DEFAULT ((8)) FOR [KOTFontSize]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_Block__5B526E1F]  DEFAULT ((0)) FOR [G_BlockRooms]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_TimeC__5C469258]  DEFAULT ((0)) FOR [G_TimeControledQCheck]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_Profo__5D3AB691]  DEFAULT ((0)) FOR [G_ProformaTitle]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_FoodP__5E2EDACA]  DEFAULT ((0)) FOR [G_FoodPlanToPrintInBill]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__SMSWATC__5F22FF03]  DEFAULT ('') FOR [SMSWATCHER]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__NetWidt__6017233C]  DEFAULT ((70)) FOR [NetWidth]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__NetHeig__610B4775]  DEFAULT ((70)) FOR [NetHeight]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__g_guest__61FF6BAE]  DEFAULT ((0)) FOR [g_guestsignature]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__g_BillP__62F38FE7]  DEFAULT ('') FOR [g_BillPrefix]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__G_Confi__63E7B420]  DEFAULT ((1)) FOR [G_ConfirmKOTPrint]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__g_hotel__64DBD859]  DEFAULT ((0)) FOR [g_hotelmaster]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__g_hotel__65CFFC92]  DEFAULT ((0)) FOR [g_hotelratedisplay]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF__SETTING__storeim__2F0AA2E4]  DEFAULT ('powerbrainstoreimages') FOR [storeimagedatabase]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_FBFName]  DEFAULT ('Monotype Corsiva') FOR [FBFName]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_FBFSize]  DEFAULT ((22)) FOR [FBFSize]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_FBFItalic]  DEFAULT ((0)) FOR [FBFItalic]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_FBFBold]  DEFAULT ((0)) FOR [FBFBold]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_FBFColor]  DEFAULT ('Black') FOR [FBFColor]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [G_PhotoOnBill]
GO
ALTER TABLE [dbo].[SETTING] ADD  CONSTRAINT [DF_SETTING_SecretMail]  DEFAULT ('info@powerbrainsoftware.com') FOR [SecretMail]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [G_BillFormat]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [gencrypt]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [manualcode]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [g_postingdate]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [g_fpcheck]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('Beverages') FOR [liquor]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [g_shanti]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((6)) FOR [dmppreprint1space]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((3)) FOR [dmppreprint2space]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((13)) FOR [dmppreprint3space]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('') FOR [keycard]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((10)) FOR [onetimeperiod]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [g_inbuiltsms]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('Advance Receipt') FOR [advancename]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [enoisgno]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [LTSETTING]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [EXBEDSPLIT]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [newbillformat3]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((1100)) FOR [paperheight]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((1000)) FOR [g_redalert]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [g_ethernetprint]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((1)) FOR [G_GSTBILLFORMAT]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('192.168.1.50') FOR [gBuzzerIP]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [sttableno_noshow]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('07-Delhi') FOR [gststate]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('') FOR [mbrprinter]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [g_emailphone]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('GST Paid Bills') FOR [gstpaidbills]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [roomsection]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [showrent]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [billyear]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [AUTOBUNDLEEXBED]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [KOTSettlementBill]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [SSLEnable]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('The following bills are outstanding unpaid in your account for more than xxxxx days. We request you to look into the matter and make the payment at the earliest.') FOR [duelettertext]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [g_travelchalansize]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((1)) FOR [VATONEXCISE]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [VATONTCS]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((1)) FOR [TCSONVAT]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((1)) FOR [TCSONEXCISE]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [G_UC]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('') FOR [EXBEDWatcher]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [stop_roundoff_autobilling]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [cloud]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [doubleyear]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [G_Fullrent]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [G_AUTHORITYFORPURCHASEORDER]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [G_OCCLINE]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT (' ') FOR [G_deletetemptablescomputer]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('Advance') FOR [g_advance]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [G_Advance_With_Chkin]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [shiftrent]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [banqdifferent]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [nohallcharges]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [PRINTDELETED]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [BHAORAO]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('') FOR [MSME]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((1)) FOR [duplicateprint]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('Service Charges') FOR [servicechgs]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((1)) FOR [ReserveEmail]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [GSTCHECK]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [extrarentgracetime]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [manualgno]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [gnomanualsetting]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('') FOR [glchecker]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('Food') FOR [g_foodline]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [checkvalidation]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ((0)) FOR [g_x1space]
GO
ALTER TABLE [dbo].[SETTING] ADD  DEFAULT ('Y') FOR [G_BillConsolidationSplit]
GO
ALTER TABLE [dbo].[SettingCatelog] ADD  CONSTRAINT [DF__settingca__contr__50866244]  DEFAULT ((0)) FOR [controlvalue2]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((150)) FOR [G_SHANTISTART1]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((200)) FOR [G_SHANTISTART2]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((498)) FOR [G_SHANTISTART3]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((0)) FOR [G_SHANTIW1]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((80)) FOR [G_SHANTIW2]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((170)) FOR [G_SHANTIW3]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((286)) FOR [G_SHANTIW4]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((373)) FOR [G_SHANTIW5]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((70)) FOR [G_SHANTIW6]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((40)) FOR [G_SHANTIW7]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((200)) FOR [G_SHANTIQTY]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((284)) FOR [G_SHANTIRATE]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((380)) FOR [G_SHANTIAMT]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((8)) FOR [G_FONT7]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((8)) FOR [G_FONT8]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((8)) FOR [G_FONT9]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((370)) FOR [G_SHANTISTART4]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((11)) FOR [G_FONT10]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((50)) FOR [G_SHANTIW8]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ('') FOR [COMPUTERNAME]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ('') FOR [DESCRIPTION]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((0)) FOR [g_shanti]
GO
ALTER TABLE [dbo].[SHANTIPALACE] ADD  DEFAULT ((1)) FOR [outlet]
GO
ALTER TABLE [dbo].[smscashbal] ADD  CONSTRAINT [DF_smscashbal_txndt]  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[smslink] ADD  DEFAULT ('') FOR [TEMPLATEID]
GO
ALTER TABLE [dbo].[smsreminder] ADD  CONSTRAINT [DF_smsreminder_sentdate]  DEFAULT ('1/1/1900') FOR [sentdate]
GO
ALTER TABLE [dbo].[smsreminder] ADD  CONSTRAINT [DF_smsreminder_status]  DEFAULT (' ') FOR [status]
GO
ALTER TABLE [dbo].[smsreport] ADD  CONSTRAINT [DF_smsreport_usernm]  DEFAULT ('AUTO') FOR [usernm]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ((0)) FOR [MonthlySales]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ((0)) FOR [RestaurantOnly]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ((0)) FOR [RentRevenue]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ((0)) FOR [ol24]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ((0)) FOR [feedback]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ((0)) FOR [hksmsphones]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ((0)) FOR [hksms]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ((0)) FOR [CISMS]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ('') FOR [CISMSphones]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ((0)) FOR [cabready]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ((0)) FOR [smsinfoperiodwise]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ('') FOR [smsinfophonesw]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ('') FOR [smsinfophonesm]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ((0)) FOR [complimentary]
GO
ALTER TABLE [dbo].[smssername] ADD  DEFAULT ((0)) FOR [STOPMAIL]
GO
ALTER TABLE [dbo].[sptbrooms] ADD  CONSTRAINT [DF_sptbrooms_status1]  DEFAULT ('N') FOR [status1]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF_sptbrs_cno]  DEFAULT ((0)) FOR [cno]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF_sptbrs_status]  DEFAULT (' ') FOR [status]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF_sptbrs_advancerecd]  DEFAULT ((0)) FOR [advancerecd]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF_sptbrs_advanceadjd]  DEFAULT ((0)) FOR [advanceadjd]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF_sptbrs_refundamount]  DEFAULT ((0)) FOR [refundamount]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF_sptbrs_pickupreqd]  DEFAULT ((0)) FOR [pickupreqd]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF_sptbrs_net]  DEFAULT ('N') FOR [net]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF_sptbrs_Tetntative]  DEFAULT ('N') FOR [tentative]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF_sptbrs_tent_upto]  DEFAULT ('1 jan 2007') FOR [tent_upto]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__fax__5DA0D232]  DEFAULT (' ') FOR [fax]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__Autobill__5A9A4855]  DEFAULT ((0)) FOR [Autobillamt]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__memorand__0E19EC5B]  DEFAULT ('') FOR [memorandum]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__smssent__5B016117]  DEFAULT ('N') FOR [smssent]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__smssent1__5BF58550]  DEFAULT ('N') FOR [smssent1]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__emailtim__71B6E254]  DEFAULT (getdate()) FOR [emailtime]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__SPTBRS__EMAILSEN__29C6314D]  DEFAULT (' ') FOR [EMAILSENT]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__renttype__20DE6CD3]  DEFAULT ((1)) FOR [renttype1]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF_sptbrs_mktmgr]  DEFAULT ((0)) FOR [mktmgr]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__channel__03605F79]  DEFAULT ('') FOR [channel]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__ischanne__045483B2]  DEFAULT ((0)) FOR [ischannel]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__channela__0548A7EB]  DEFAULT ((0)) FOR [channelamt]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__staahid__063CCC24]  DEFAULT ('') FOR [staahid]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__dobm__1D8BDC7E]  DEFAULT ((0)) FOR [dobm]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__dobd__1E8000B7]  DEFAULT ((0)) FOR [dobd]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__domm__1F7424F0]  DEFAULT ((0)) FOR [domm]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__domd__20684929]  DEFAULT ((0)) FOR [domd]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__dobsmsse__6F9007A4]  DEFAULT ('1/1/2000') FOR [dobsmssent]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__domsmsse__70842BDD]  DEFAULT ('1/1/2000') FOR [domsmssent]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__dobemail__71785016]  DEFAULT ('1/1/2000') FOR [dobemailsent]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF__sptbrs__domemail__726C744F]  DEFAULT ('1/1/2000') FOR [domemailsent]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF_sptbrs_ExtraBeds]  DEFAULT ((0)) FOR [ExtraBeds]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF_sptbrs_ExtraBedCharges]  DEFAULT ((0)) FOR [ExtraBedCharges]
GO
ALTER TABLE [dbo].[sptbrs] ADD  CONSTRAINT [DF_sptbrs_ExtraBedAlloted]  DEFAULT ((0)) FOR [ExtraBedAlloted]
GO
ALTER TABLE [dbo].[sptbrs] ADD  DEFAULT ('') FOR [GSTIN]
GO
ALTER TABLE [dbo].[sptbrs] ADD  DEFAULT ((0)) FOR [commrate]
GO
ALTER TABLE [dbo].[sptbrs] ADD  DEFAULT ((0)) FOR [commgstrate]
GO
ALTER TABLE [dbo].[sptbrs] ADD  DEFAULT ((0)) FOR [commtcsrate]
GO
ALTER TABLE [dbo].[sptbrs] ADD  DEFAULT ((0)) FOR [commission]
GO
ALTER TABLE [dbo].[sptbrs] ADD  DEFAULT ((0)) FOR [commgst]
GO
ALTER TABLE [dbo].[sptbrs] ADD  DEFAULT ((0)) FOR [commtcs]
GO
ALTER TABLE [dbo].[sptbrs] ADD  DEFAULT ((0)) FOR [otacommctrlno]
GO
ALTER TABLE [dbo].[sptbrs] ADD  DEFAULT ((0)) FOR [commtdsrate]
GO
ALTER TABLE [dbo].[sptbrs] ADD  DEFAULT ((0)) FOR [commtds]
GO
ALTER TABLE [dbo].[sptbrs] ADD  DEFAULT ('') FOR [staahstatus]
GO
ALTER TABLE [dbo].[sptbrs] ADD  DEFAULT ('N') FOR [whatsapp]
GO
ALTER TABLE [dbo].[sptbrs_inet] ADD  CONSTRAINT [DF_sptbrs_inet_amt]  DEFAULT ((0)) FOR [amt]
GO
ALTER TABLE [dbo].[sptbrs_inet] ADD  CONSTRAINT [DF_sptbrs_inet_cancelled]  DEFAULT (' ') FOR [cancelled]
GO
ALTER TABLE [dbo].[sptbrs_noshow] ADD  DEFAULT ((0)) FOR [gst]
GO
ALTER TABLE [dbo].[sptbrs_noshow] ADD  DEFAULT ((0)) FOR [noshow]
GO
ALTER TABLE [dbo].[sptbrs_noshow] ADD  DEFAULT ((0)) FOR [sno]
GO
ALTER TABLE [dbo].[sptbrs_noshow] ADD  DEFAULT ('') FOR [einvoice]
GO
ALTER TABLE [dbo].[sptbrs_noshow] ADD  DEFAULT ('B2B') FOR [txncat]
GO
ALTER TABLE [dbo].[sptbrs_rn] ADD  CONSTRAINT [DF_sptbrs_rn_pctrlno]  DEFAULT ((0)) FOR [pctrlno]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  CONSTRAINT [DF_sptbrs1_arrivedrooms]  DEFAULT ((0)) FOR [arrivedrooms]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  CONSTRAINT [DF_sptbrs1_cancelledrooms]  DEFAULT ((0)) FOR [cancelledrooms]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  CONSTRAINT [DF_sptbrs1_discount]  DEFAULT ((0)) FOR [discount]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  CONSTRAINT [DF_sptbrs1_sc]  DEFAULT ((0)) FOR [sc]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  CONSTRAINT [DF_sptbrs1_rent1]  DEFAULT ((0)) FOR [rent1]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  CONSTRAINT [DF_sptbrs1_rent2]  DEFAULT ((0)) FOR [rent2]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  CONSTRAINT [DF_sptbrs1_wingno]  DEFAULT ((1)) FOR [wingno]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  CONSTRAINT [DF_sptbrs1_lttype]  DEFAULT ((0)) FOR [lttype]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  CONSTRAINT [DF_sptbrs1_fptype]  DEFAULT ((1)) FOR [fptype]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  CONSTRAINT [DF_sptbrs1_autobillamt1]  DEFAULT ((0)) FOR [autobillamt]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  DEFAULT ((0)) FOR [channelexbed]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  DEFAULT ((0)) FOR [channelexbedok]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  DEFAULT ((0)) FOR [food]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  DEFAULT ((0)) FOR [extrabed]
GO
ALTER TABLE [dbo].[sptbrs1] ADD  DEFAULT ('') FOR [dummyrentype]
GO
ALTER TABLE [dbo].[sptv] ADD  CONSTRAINT [DF_sptv_C4]  DEFAULT ('') FOR [C4]
GO
ALTER TABLE [dbo].[sptv] ADD  CONSTRAINT [DF_sptv_outlet]  DEFAULT ((0)) FOR [outlet]
GO
ALTER TABLE [dbo].[sptv] ADD  CONSTRAINT [DF_sptv_dept]  DEFAULT ((0)) FOR [dept]
GO
ALTER TABLE [dbo].[sptv] ADD  CONSTRAINT [DF_sptv_IMAGE]  DEFAULT ((1)) FOR [IMAGE]
GO
ALTER TABLE [dbo].[sptv] ADD  CONSTRAINT [DF_sptv_IMAGE1]  DEFAULT ((1)) FOR [IMAGE1]
GO
ALTER TABLE [dbo].[staahchannel] ADD  CONSTRAINT [DF_staahchannel_glactno]  DEFAULT ((0)) FOR [glactno]
GO
ALTER TABLE [dbo].[staahchannel] ADD  CONSTRAINT [DF_staahchannel_discount]  DEFAULT ((0)) FOR [discount]
GO
ALTER TABLE [dbo].[staahchannel] ADD  CONSTRAINT [DF_staahchannel_companycom]  DEFAULT ((0)) FOR [company]
GO
ALTER TABLE [dbo].[staahchannel] ADD  CONSTRAINT [DF_staahchannel_upfront]  DEFAULT ((0)) FOR [upfront]
GO
ALTER TABLE [dbo].[staahchannel] ADD  CONSTRAINT [DF_staahchannel_commissionac]  DEFAULT ((0)) FOR [commissionac]
GO
ALTER TABLE [dbo].[staahchannel] ADD  CONSTRAINT [DF_staahchannel_NettRate]  DEFAULT ((0)) FOR [NettRate]
GO
ALTER TABLE [dbo].[staahINV] ADD  CONSTRAINT [DF_staahINV_status]  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[staahINV] ADD  CONSTRAINT [DF_staahINV_message]  DEFAULT ('') FOR [message]
GO
ALTER TABLE [dbo].[staahINV] ADD  DEFAULT (getdate()) FOR [edt]
GO
ALTER TABLE [dbo].[staahinvstop] ADD  CONSTRAINT [DF_staahinvstop_status]  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[staahRates] ADD  DEFAULT ((0)) FOR [rent2]
GO
ALTER TABLE [dbo].[staahRates] ADD  DEFAULT ((0)) FOR [addl]
GO
ALTER TABLE [dbo].[stchlno] ADD  CONSTRAINT [DF_stchlno_dchlno]  DEFAULT ((0)) FOR [dchlno]
GO
ALTER TABLE [dbo].[stchlno] ADD  CONSTRAINT [DF_stchlno_pchlno]  DEFAULT ((0)) FOR [pchlno]
GO
ALTER TABLE [dbo].[stchlno] ADD  CONSTRAINT [DF_stchlno_Adjcr]  DEFAULT ((0)) FOR [Adjcr]
GO
ALTER TABLE [dbo].[stchlno] ADD  CONSTRAINT [DF_stchlno_adjdr]  DEFAULT ((0)) FOR [Adjdr]
GO
ALTER TABLE [dbo].[stchlno] ADD  DEFAULT ((0)) FOR [pono]
GO
ALTER TABLE [dbo].[stmasterpbacc] ADD  DEFAULT ((0)) FOR [sttableno]
GO
ALTER TABLE [dbo].[stmasterpbacc] ADD  DEFAULT ((0)) FOR [cessonwhat]
GO
ALTER TABLE [dbo].[stmasterpbacc] ADD  DEFAULT ('CESS') FOR [cessname]
GO
ALTER TABLE [dbo].[stmasterpbacc] ADD  DEFAULT ((0)) FOR [cess2]
GO
ALTER TABLE [dbo].[stmasterpbacc] ADD  DEFAULT ((0)) FOR [cessonwhat2]
GO
ALTER TABLE [dbo].[stmasterpbacc] ADD  DEFAULT ('SBC') FOR [cessname2]
GO
ALTER TABLE [dbo].[stmasterpbacc] ADD  DEFAULT ('Service Tax') FOR [taxname]
GO
ALTER TABLE [dbo].[stmasterpbacc] ADD  DEFAULT ('ST') FOR [taxshname]
GO
ALTER TABLE [dbo].[stmasterpbacc] ADD  DEFAULT ((0)) FOR [taxacno]
GO
ALTER TABLE [dbo].[store] ADD  CONSTRAINT [DF_store_CashAcount]  DEFAULT ((1)) FOR [CashAccount]
GO
ALTER TABLE [dbo].[store] ADD  CONSTRAINT [DF_store_fa_posting]  DEFAULT ('Y') FOR [fa_posting]
GO
ALTER TABLE [dbo].[store] ADD  DEFAULT ((54)) FOR [CGSTACNO]
GO
ALTER TABLE [dbo].[store] ADD  DEFAULT ((54)) FOR [SGSTACNO]
GO
ALTER TABLE [dbo].[store] ADD  DEFAULT ((54)) FOR [IGSTACNO]
GO
ALTER TABLE [dbo].[store] ADD  DEFAULT ((54)) FOR [cessacno]
GO
ALTER TABLE [dbo].[store] ADD  DEFAULT ((54)) FOR [EXCISEACNO]
GO
ALTER TABLE [dbo].[store] ADD  DEFAULT ((54)) FOR [TCSACNO]
GO
ALTER TABLE [dbo].[storebills] ADD  CONSTRAINT [DF_storebills_saletax]  DEFAULT ((0)) FOR [saletax]
GO
ALTER TABLE [dbo].[storebills] ADD  CONSTRAINT [DF_storebills_otherchgs]  DEFAULT ((0)) FOR [otherchgs]
GO
ALTER TABLE [dbo].[storebills] ADD  CONSTRAINT [DF_storebills_discount]  DEFAULT ((0)) FOR [discount]
GO
ALTER TABLE [dbo].[storebills] ADD  CONSTRAINT [DF_storebills_stmode]  DEFAULT ((0)) FOR [stmode]
GO
ALTER TABLE [dbo].[storebills] ADD  CONSTRAINT [DF_storebills_issuedto]  DEFAULT ((0)) FOR [issuedtocode]
GO
ALTER TABLE [dbo].[storebills] ADD  CONSTRAINT [DF_storebills_issuedtotype]  DEFAULT ((0)) FOR [issuedtotype]
GO
ALTER TABLE [dbo].[storebills] ADD  CONSTRAINT [DF_storebills_CashType]  DEFAULT ('') FOR [CashType]
GO
ALTER TABLE [dbo].[storebills] ADD  CONSTRAINT [DF_storebills_Adjust]  DEFAULT ('N') FOR [Adjust]
GO
ALTER TABLE [dbo].[storebills] ADD  CONSTRAINT [DF_storebills_Reissue]  DEFAULT ('N') FOR [Reissue]
GO
ALTER TABLE [dbo].[storebills] ADD  CONSTRAINT [DF_storebills_supplier_acno]  DEFAULT ((0)) FOR [supplier_actno]
GO
ALTER TABLE [dbo].[storehist] ADD  CONSTRAINT [DF_storehist_balance]  DEFAULT ((0)) FOR [balance]
GO
ALTER TABLE [dbo].[storehist] ADD  CONSTRAINT [DF_storehist_price]  DEFAULT ((0)) FOR [price]
GO
ALTER TABLE [dbo].[storehist] ADD  CONSTRAINT [DF_storehist_saletax]  DEFAULT ((0)) FOR [saletax]
GO
ALTER TABLE [dbo].[storehist] ADD  CONSTRAINT [DF_storehist_adjust]  DEFAULT ('N') FOR [adjust]
GO
ALTER TABLE [dbo].[storehist] ADD  CONSTRAINT [DF__storehist__forup__4ECA39A4]  DEFAULT ('N') FOR [forupdt]
GO
ALTER TABLE [dbo].[storehist] ADD  CONSTRAINT [DF__storehist__strat__4FBE5DDD]  DEFAULT ((0)) FOR [strate]
GO
ALTER TABLE [dbo].[storehist] ADD  CONSTRAINT [DF_storehist_drate]  DEFAULT ((0)) FOR [drate]
GO
ALTER TABLE [dbo].[storehist] ADD  CONSTRAINT [DF_storehist_damt]  DEFAULT ((0)) FOR [damt]
GO
ALTER TABLE [dbo].[storehist] ADD  CONSTRAINT [DF__storehist__txndt__5753C756]  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[storehist] ADD  CONSTRAINT [DF_storehist_hctrlno2]  DEFAULT ((0)) FOR [hctrlno2]
GO
ALTER TABLE [dbo].[storehist] ADD  DEFAULT ((0)) FOR [cgstrate]
GO
ALTER TABLE [dbo].[storehist] ADD  DEFAULT ((0)) FOR [cgstamt]
GO
ALTER TABLE [dbo].[storehist] ADD  DEFAULT ((0)) FOR [sgstrate]
GO
ALTER TABLE [dbo].[storehist] ADD  DEFAULT ((0)) FOR [sgstamt]
GO
ALTER TABLE [dbo].[storehist] ADD  DEFAULT ((0)) FOR [igstrate]
GO
ALTER TABLE [dbo].[storehist] ADD  DEFAULT ((0)) FOR [igstamt]
GO
ALTER TABLE [dbo].[storehist] ADD  DEFAULT ((0)) FOR [cessrate]
GO
ALTER TABLE [dbo].[storehist] ADD  DEFAULT ((0)) FOR [cessamt]
GO
ALTER TABLE [dbo].[storehist] ADD  DEFAULT ((0)) FOR [EXCISERATE]
GO
ALTER TABLE [dbo].[storehist] ADD  DEFAULT ((0)) FOR [EXCISEAMT]
GO
ALTER TABLE [dbo].[storehist] ADD  DEFAULT ((0)) FOR [TCSRATE]
GO
ALTER TABLE [dbo].[storehist] ADD  DEFAULT ((0)) FOR [TCSAMT]
GO
ALTER TABLE [dbo].[storehist] ADD  DEFAULT ((0)) FOR [qty1]
GO
ALTER TABLE [dbo].[storeitems] ADD  CONSTRAINT [DF_storeitems_stock]  DEFAULT ((0)) FOR [stock]
GO
ALTER TABLE [dbo].[storeitems] ADD  CONSTRAINT [DF_storeitems_lpdate]  DEFAULT (getdate()) FOR [lpdate]
GO
ALTER TABLE [dbo].[storeitems] ADD  CONSTRAINT [DF_storeitems_lidate]  DEFAULT (getdate()) FOR [lidate]
GO
ALTER TABLE [dbo].[storeitems] ADD  CONSTRAINT [DF_storeitems_rate]  DEFAULT ((0)) FOR [rate]
GO
ALTER TABLE [dbo].[storeitems] ADD  CONSTRAINT [DF_storeitems_ratedate]  DEFAULT ('1 april 1998') FOR [ratedate]
GO
ALTER TABLE [dbo].[storeitems] ADD  CONSTRAINT [DF_storeitems_indent]  DEFAULT ('Y') FOR [indent]
GO
ALTER TABLE [dbo].[storeitems] ADD  CONSTRAINT [DF_storeitems_actodt]  DEFAULT (getdate()) FOR [actodt]
GO
ALTER TABLE [dbo].[storeitems] ADD  CONSTRAINT [DF_storeitems_opgstock]  DEFAULT ((0)) FOR [opgstock]
GO
ALTER TABLE [dbo].[storeitems] ADD  CONSTRAINT [DF_storeitems_ltxndt]  DEFAULT ('1 jan 2003') FOR [ltxndt]
GO
ALTER TABLE [dbo].[storeitems] ADD  CONSTRAINT [DF_storeitems_lstock]  DEFAULT ((0)) FOR [lstock]
GO
ALTER TABLE [dbo].[storeitems] ADD  CONSTRAINT [DF_storeitems_strate]  DEFAULT ((0)) FOR [strate]
GO
ALTER TABLE [dbo].[storeitems] ADD  CONSTRAINT [DF_storeitems_forupdt]  DEFAULT ('N') FOR [forupdt]
GO
ALTER TABLE [dbo].[storeitems] ADD  DEFAULT ('') FOR [hsn]
GO
ALTER TABLE [dbo].[storeitems] ADD  DEFAULT ('Y') FOR [ITCEligible]
GO
ALTER TABLE [dbo].[StorePrimary] ADD  CONSTRAINT [DF_StorePrimary_opgbal]  DEFAULT ((0)) FOR [opgbal]
GO
ALTER TABLE [dbo].[StorePrimary] ADD  CONSTRAINT [DF_StorePrimary_balance]  DEFAULT ((0)) FOR [balance]
GO
ALTER TABLE [dbo].[storepurchaseorder] ADD  DEFAULT ((0)) FOR [storeno]
GO
ALTER TABLE [dbo].[storepurchaseorder] ADD  DEFAULT ((0)) FOR [pono]
GO
ALTER TABLE [dbo].[storepurchaseorder] ADD  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[storepurchaseorder] ADD  DEFAULT (' ') FOR [status]
GO
ALTER TABLE [dbo].[storepurchaseorder] ADD  DEFAULT (' ') FOR [usernm]
GO
ALTER TABLE [dbo].[storepurchaseorder] ADD  DEFAULT ((0)) FOR [seller]
GO
ALTER TABLE [dbo].[storepurchaseorder] ADD  DEFAULT ((0)) FOR [saletax]
GO
ALTER TABLE [dbo].[storepurchaseorder] ADD  DEFAULT ((0)) FOR [otherchgs]
GO
ALTER TABLE [dbo].[storepurchaseorder] ADD  DEFAULT ((0)) FOR [discount]
GO
ALTER TABLE [dbo].[storepurchaseorder] ADD  DEFAULT (' ') FOR [approved]
GO
ALTER TABLE [dbo].[storepurchaseorder] ADD  DEFAULT (' ') FOR [approvedby]
GO
ALTER TABLE [dbo].[STTABLE] ADD  DEFAULT ((0)) FOR [STTABLENO]
GO
ALTER TABLE [dbo].[STTABLE] ADD  CONSTRAINT [DF_STTABLE_CessOnWhat]  DEFAULT ((0)) FOR [CessOnWhat]
GO
ALTER TABLE [dbo].[STTABLE] ADD  CONSTRAINT [DF_STTABLE_CessName]  DEFAULT ('SBC') FOR [CessName]
GO
ALTER TABLE [dbo].[STTABLE] ADD  DEFAULT ((0)) FOR [cess2]
GO
ALTER TABLE [dbo].[STTABLE] ADD  DEFAULT ((0)) FOR [cessonwhat2]
GO
ALTER TABLE [dbo].[STTABLE] ADD  DEFAULT ('') FOR [cessname2]
GO
ALTER TABLE [dbo].[STTABLE] ADD  DEFAULT ('Service Tax') FOR [taxname]
GO
ALTER TABLE [dbo].[STTABLE] ADD  DEFAULT ('ST') FOR [taxshname]
GO
ALTER TABLE [dbo].[STTABLE] ADD  DEFAULT ((0)) FOR [taxacno]
GO
ALTER TABLE [dbo].[STTABLER] ADD  DEFAULT ((0)) FOR [STTABLENO]
GO
ALTER TABLE [dbo].[STTABLER] ADD  CONSTRAINT [DF_STTABLER_cessonwhat]  DEFAULT ((0)) FOR [cessonwhat]
GO
ALTER TABLE [dbo].[STTABLER] ADD  CONSTRAINT [DF_STTABLER_cessname]  DEFAULT ('SBC') FOR [cessname]
GO
ALTER TABLE [dbo].[STTABLER] ADD  DEFAULT ((0)) FOR [cess2]
GO
ALTER TABLE [dbo].[STTABLER] ADD  DEFAULT ((0)) FOR [cessonwhat2]
GO
ALTER TABLE [dbo].[STTABLER] ADD  DEFAULT ('') FOR [cessname2]
GO
ALTER TABLE [dbo].[STTABLER] ADD  DEFAULT ('Service Tax') FOR [taxname]
GO
ALTER TABLE [dbo].[STTABLER] ADD  DEFAULT ('ST') FOR [taxshname]
GO
ALTER TABLE [dbo].[STTABLER] ADD  DEFAULT ((0)) FOR [taxacno]
GO
ALTER TABLE [dbo].[STTABLER] ADD  DEFAULT ('Tax Invoice') FOR [invoicename]
GO
ALTER TABLE [dbo].[STTABLER] ADD  DEFAULT ('Packing Charges') FOR [pkgchgsname]
GO
ALTER TABLE [dbo].[STTABLER] ADD  DEFAULT ((0)) FOR [pkgchgsdefaultamt]
GO
ALTER TABLE [dbo].[sttablerNAME] ADD  DEFAULT ((1)) FOR [company]
GO
ALTER TABLE [dbo].[suppliers] ADD  CONSTRAINT [DF_suppliers_ltxndt]  DEFAULT (getdate()) FOR [ltxndt]
GO
ALTER TABLE [dbo].[suppliers] ADD  CONSTRAINT [DF_suppliers_STMode]  DEFAULT ((0)) FOR [STMode]
GO
ALTER TABLE [dbo].[suppliers] ADD  CONSTRAINT [DF__suppliers__compa__566200F3]  DEFAULT ((1)) FOR [company]
GO
ALTER TABLE [dbo].[suppliers] ADD  DEFAULT ('') FOR [GSTIN]
GO
ALTER TABLE [dbo].[suppliers] ADD  DEFAULT ('Y') FOR [registered]
GO
ALTER TABLE [dbo].[systems] ADD  CONSTRAINT [DF_systems_ltxndt]  DEFAULT (getdate()) FOR [ltxndt]
GO
ALTER TABLE [dbo].[systems] ADD  CONSTRAINT [DF_systems_online]  DEFAULT ((0)) FOR [online]
GO
ALTER TABLE [dbo].[TA_Advance] ADD  CONSTRAINT [DF_TA_Advance_status]  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[TA_Chalan] ADD  CONSTRAINT [DF_TA_Chalan_status]  DEFAULT (' ') FOR [status]
GO
ALTER TABLE [dbo].[TA_Chalan] ADD  CONSTRAINT [DF_TA_Chalan_mailsend]  DEFAULT ('') FOR [mailsent]
GO
ALTER TABLE [dbo].[TA_Chalan] ADD  CONSTRAINT [DF_TA_Chalan_advance]  DEFAULT ((0)) FOR [advance]
GO
ALTER TABLE [dbo].[TA_Chalan] ADD  CONSTRAINT [DF_TA_Chalan_advance_t]  DEFAULT ((0)) FOR [advance_t]
GO
ALTER TABLE [dbo].[TA_Chalan] ADD  CONSTRAINT [DF_TA_Chalan_split]  DEFAULT ('') FOR [split]
GO
ALTER TABLE [dbo].[TA_Chalan] ADD  CONSTRAINT [DF__TA_Chalan__notra__05889F0D]  DEFAULT ((0)) FOR [notravelagent]
GO
ALTER TABLE [dbo].[TA_Chalan] ADD  CONSTRAINT [DF__TA_Chalan__trave__067CC346]  DEFAULT ((0)) FOR [travelagent]
GO
ALTER TABLE [dbo].[TA_Chalan] ADD  DEFAULT (' ') FOR [cancelled]
GO
ALTER TABLE [dbo].[TA_Chalan] ADD  CONSTRAINT [DF_TA_Chalan_cess]  DEFAULT ((0)) FOR [cess]
GO
ALTER TABLE [dbo].[TA_Hotel] ADD  CONSTRAINT [DF_TA_Hotel_chkintime]  DEFAULT ('12:00') FOR [chkintime]
GO
ALTER TABLE [dbo].[TA_Hotel] ADD  CONSTRAINT [DF_TA_Hotel_glac]  DEFAULT ((0)) FOR [glac]
GO
ALTER TABLE [dbo].[TA_Hotel] ADD  CONSTRAINT [DF_TA_Hotel_notravelagent]  DEFAULT ((0)) FOR [notravelagent]
GO
ALTER TABLE [dbo].[TA_Hotel] ADD  CONSTRAINT [DF_TA_Hotel_travelagent]  DEFAULT ((0)) FOR [travelagent]
GO
ALTER TABLE [dbo].[TA_Itinerary] ADD  CONSTRAINT [DF_TA_Itinerary_outlet]  DEFAULT ((0)) FOR [outlet]
GO
ALTER TABLE [dbo].[TA_Itinerary] ADD  CONSTRAINT [DF_TA_Itinerary_tc]  DEFAULT ('') FOR [tc]
GO
ALTER TABLE [dbo].[TA_Itinerary] ADD  CONSTRAINT [DF_TA_Itinerary_status]  DEFAULT ('') FOR [status]
GO
ALTER TABLE [dbo].[TA_Itinerary] ADD  CONSTRAINT [DF_TA_Itinerary_TaxInclusive]  DEFAULT ((0)) FOR [TaxInclusive]
GO
ALTER TABLE [dbo].[TA_Itinerary] ADD  CONSTRAINT [DF_TA_Itinerary_servicetax]  DEFAULT ((0)) FOR [servicetax]
GO
ALTER TABLE [dbo].[TA_Itinerary] ADD  CONSTRAINT [DF_TA_Itinerary_spldiscount]  DEFAULT ((0)) FOR [spldiscount]
GO
ALTER TABLE [dbo].[TA_Itinerary] ADD  CONSTRAINT [DF_TA_Itinerary_otherchgs]  DEFAULT ((0)) FOR [otherchgs]
GO
ALTER TABLE [dbo].[TA_Itinerary] ADD  CONSTRAINT [DF_TA_Itinerary_billed]  DEFAULT ('') FOR [billed]
GO
ALTER TABLE [dbo].[TA_Itinerary] ADD  CONSTRAINT [DF_TA_Itinerary_packageamount]  DEFAULT ((0)) FOR [packageamount]
GO
ALTER TABLE [dbo].[TA_Itinerary] ADD  CONSTRAINT [DF_TA_Itinerary_cess]  DEFAULT ((0)) FOR [cess]
GO
ALTER TABLE [dbo].[TA_ITList] ADD  CONSTRAINT [DF_TA_ITList_status]  DEFAULT (' ') FOR [status]
GO
ALTER TABLE [dbo].[TA_PaxDetails] ADD  CONSTRAINT [DF_TA_PaxDetails_age]  DEFAULT ((0)) FOR [age]
GO
ALTER TABLE [dbo].[TA_PaxDetails] ADD  CONSTRAINT [DF_TA_PaxDetails_passportno]  DEFAULT ('') FOR [passportno]
GO
ALTER TABLE [dbo].[TA_PaxDetails] ADD  CONSTRAINT [DF_TA_PaxDetails_idproof]  DEFAULT ('') FOR [idproof]
GO
ALTER TABLE [dbo].[TA_PaxDetails] ADD  CONSTRAINT [DF_TA_PaxDetails_idproofno]  DEFAULT ('') FOR [idproofno]
GO
ALTER TABLE [dbo].[TA_PaxDetails] ADD  CONSTRAINT [DF_TA_PaxDetails_visadetails]  DEFAULT ('') FOR [visadetails]
GO
ALTER TABLE [dbo].[TA_ServiceTaxSetting] ADD  CONSTRAINT [DF_TA_ServiceTaxSetting_method]  DEFAULT ((0)) FOR [method]
GO
ALTER TABLE [dbo].[TempTables] ADD  CONSTRAINT [DF_TempTables_dob]  DEFAULT (getdate()) FOR [dob]
GO
ALTER TABLE [dbo].[TKTmaster] ADD  CONSTRAINT [DF_TKTmaster_TKTtaxrate]  DEFAULT ((0)) FOR [TKTtaxrate]
GO
ALTER TABLE [dbo].[TKTmaster] ADD  CONSTRAINT [DF_TKTmaster_OnDifference]  DEFAULT ('Y') FOR [OnDifference]
GO
ALTER TABLE [dbo].[TKTmaster] ADD  CONSTRAINT [DF_TKTmaster_STTType]  DEFAULT ((0)) FOR [STTType]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_CHLNO]  DEFAULT ((0)) FOR [CHLNO]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_CHLDATE]  DEFAULT ('1/1/1980') FOR [CHLDATE]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_TCHLNO]  DEFAULT ((0)) FOR [TCHLNO]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_TCHLDATE]  DEFAULT ('1/1/80') FOR [TCHLDATE]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_OCHLNO]  DEFAULT ((0)) FOR [OCHLNO]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_OCHLDATE]  DEFAULT ('1/1/80') FOR [OCHLDATE]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_AUTONO]  DEFAULT ((0)) FOR [AUTONO1]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_AUTONO1]  DEFAULT ((0)) FOR [AUTONO2]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_ATUONO2]  DEFAULT ((0)) FOR [AUTONO3]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_PURCHASE1]  DEFAULT ((0)) FOR [PURCHASE1]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_SALES1]  DEFAULT ((0)) FOR [SALES1]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_purchase2]  DEFAULT ((0)) FOR [purchase2]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_sales2]  DEFAULT ((0)) FOR [sales2]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_purchase3]  DEFAULT ((0)) FOR [purchase3]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_sales3]  DEFAULT ((0)) FOR [sales3]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_advancerecd]  DEFAULT ((0)) FOR [advancerecd]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_advancepaid]  DEFAULT ((0)) FOR [advancepaid]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_staxrate]  DEFAULT ((0)) FOR [staxrate]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_selfdeal]  DEFAULT ('Y') FOR [selfdeal]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_billposition1]  DEFAULT ((0)) FOR [billposition1]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_billposition2]  DEFAULT ((0)) FOR [billposition2]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_hno_mybook]  DEFAULT ((0)) FOR [hno_mybook]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_hno_htlbook]  DEFAULT ((0)) FOR [hno_htlbook]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_htl_purchase]  DEFAULT ((0)) FOR [htl_purchase]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_htl_sales]  DEFAULT ((0)) FOR [htl_sales]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_htl_receivable]  DEFAULT ((0)) FOR [htl_receivable]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_lux]  DEFAULT ('N') FOR [lux]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_ano]  DEFAULT ((0)) FOR [ano]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_adate]  DEFAULT ('1/1/80') FOR [adate]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_ano_t]  DEFAULT ((0)) FOR [ano_t]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_adate_t]  DEFAULT ('1/1/80') FOR [adate_t]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_my_receivable]  DEFAULT ((24)) FOR [my_receivable]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF__toutlet__otherch__517A867D]  DEFAULT ((0)) FOR [otherchgsac]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF__toutlet__bataac__526EAAB6]  DEFAULT ((0)) FOR [bataac]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_ServiceTaxAC]  DEFAULT ((0)) FOR [ServiceTaxAC]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_discount]  DEFAULT ((62)) FOR [discount4]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_packageotherchgs]  DEFAULT ((18)) FOR [otherchgs4]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_sales4]  DEFAULT ((0)) FOR [sales4]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_purchase5]  DEFAULT ((0)) FOR [purchase5]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_sales5]  DEFAULT ((0)) FOR [sales5]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_purchase6]  DEFAULT ((0)) FOR [purchase6]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_sales6]  DEFAULT ((0)) FOR [sales6]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_salesreturn1]  DEFAULT ((0)) FOR [salesreturn2]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_purchaseretrun2]  DEFAULT ((0)) FOR [purchasereturn2]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_salesreturn3]  DEFAULT ((0)) FOR [salesreturn3]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_purchasereturn3]  DEFAULT ((0)) FOR [purchasereturn3]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_salesreturn5]  DEFAULT ((0)) FOR [salesreturn5]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_purchasereturn5]  DEFAULT ((0)) FOR [purchasereturn5]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_salereturn6]  DEFAULT ((0)) FOR [salesreturn6]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_purchasereturn6]  DEFAULT ((0)) FOR [purchasereturn6]
GO
ALTER TABLE [dbo].[toutlet] ADD  CONSTRAINT [DF_toutlet_servicetaxreturnac]  DEFAULT ((0)) FOR [servicetaxreturnac]
GO
ALTER TABLE [dbo].[toutlet] ADD  DEFAULT ((0)) FOR [cancellationchgspaidac]
GO
ALTER TABLE [dbo].[toutlet] ADD  DEFAULT ((0)) FOR [cancellationchgsrecdac]
GO
ALTER TABLE [dbo].[toutlet] ADD  DEFAULT ('TTD') FOR [billprefix]
GO
ALTER TABLE [dbo].[toutlet] ADD  DEFAULT ('') FOR [sac]
GO
ALTER TABLE [dbo].[toutlet1] ADD  CONSTRAINT [DF_toutlet1_chlno]  DEFAULT ((0)) FOR [chlno]
GO
ALTER TABLE [dbo].[TRAVELAGENT] ADD  CONSTRAINT [DF_TRAVELAGENT_opgdate]  DEFAULT (getdate()) FOR [opgdate]
GO
ALTER TABLE [dbo].[ttadvance] ADD  CONSTRAINT [DF_ttadvance_ano]  DEFAULT ((0)) FOR [ano]
GO
ALTER TABLE [dbo].[ttadvance] ADD  CONSTRAINT [DF_ttadvance_txndt]  DEFAULT ('1/1/80') FOR [txndt]
GO
ALTER TABLE [dbo].[ttadvance] ADD  CONSTRAINT [DF_ttadvance_amount]  DEFAULT ((0)) FOR [amount]
GO
ALTER TABLE [dbo].[ttadvance] ADD  CONSTRAINT [DF_ttadvance_atype]  DEFAULT ('R') FOR [atype]
GO
ALTER TABLE [dbo].[ttadvance] ADD  CONSTRAINT [DF_ttadvance_tmstmp]  DEFAULT ('time') FOR [tmstmp]
GO
ALTER TABLE [dbo].[ttadvance] ADD  CONSTRAINT [DF_ttadvance_mop]  DEFAULT ((0)) FOR [mop]
GO
ALTER TABLE [dbo].[ttadvance] ADD  CONSTRAINT [DF_ttadvance_crcardnum]  DEFAULT ('') FOR [crcardnum]
GO
ALTER TABLE [dbo].[ttadvance] ADD  CONSTRAINT [DF_ttadvance_crcardname]  DEFAULT ('') FOR [crcardname]
GO
ALTER TABLE [dbo].[ttadvance] ADD  CONSTRAINT [DF_ttadvance_crcardbank]  DEFAULT ('') FOR [crcardbank]
GO
ALTER TABLE [dbo].[ttadvance] ADD  CONSTRAINT [DF_ttadvance_glactnum]  DEFAULT ((0)) FOR [glactnum]
GO
ALTER TABLE [dbo].[ttadvance] ADD  CONSTRAINT [DF_ttadvance_grno]  DEFAULT ((0)) FOR [grno]
GO
ALTER TABLE [dbo].[ttadvance] ADD  DEFAULT ((1)) FOR [tttype]
GO
ALTER TABLE [dbo].[TTMaster] ADD  CONSTRAINT [DF_TTMaster_Basic]  DEFAULT ((0)) FOR [Basic]
GO
ALTER TABLE [dbo].[TTMaster] ADD  CONSTRAINT [DF_TTMaster_Basic_t]  DEFAULT ((0)) FOR [Basic_t]
GO
ALTER TABLE [dbo].[TTMaster] ADD  CONSTRAINT [DF_TTMaster_PerKm]  DEFAULT ((0)) FOR [PerKm]
GO
ALTER TABLE [dbo].[TTMaster] ADD  CONSTRAINT [DF_TTMaster_PerKm_T]  DEFAULT ((0)) FOR [PerKm_T]
GO
ALTER TABLE [dbo].[TTMaster] ADD  CONSTRAINT [DF_TTMaster_PerHour]  DEFAULT ((0)) FOR [PerHour]
GO
ALTER TABLE [dbo].[TTMaster] ADD  CONSTRAINT [DF_TTMaster_PerHour_t]  DEFAULT ((0)) FOR [PerHour_t]
GO
ALTER TABLE [dbo].[TTMaster] ADD  CONSTRAINT [DF_TTMaster_MaxHrs]  DEFAULT ((0)) FOR [MaxHrs]
GO
ALTER TABLE [dbo].[TTMaster] ADD  CONSTRAINT [DF_TTMaster_MaxKm]  DEFAULT ((0)) FOR [MaxKm]
GO
ALTER TABLE [dbo].[TTMaster] ADD  CONSTRAINT [DF_TTMaster_MaxHrs_t]  DEFAULT ((0)) FOR [MaxHrs_t]
GO
ALTER TABLE [dbo].[TTMaster] ADD  CONSTRAINT [DF_TTMaster_MaxKm_t]  DEFAULT ((0)) FOR [MaxKm_t]
GO
ALTER TABLE [dbo].[TTMaster] ADD  CONSTRAINT [DF_TTMaster_Bata]  DEFAULT ((0)) FOR [Bata]
GO
ALTER TABLE [dbo].[TTMaster] ADD  CONSTRAINT [DF_TTMaster_Bata_t]  DEFAULT ((0)) FOR [Bata_t]
GO
ALTER TABLE [dbo].[TTMaster] ADD  CONSTRAINT [DF_TTMaster_minkm]  DEFAULT ((0)) FOR [minkm]
GO
ALTER TABLE [dbo].[TTMaster] ADD  CONSTRAINT [DF_TTMaster_minkm_t]  DEFAULT ((0)) FOR [minkm_t]
GO
ALTER TABLE [dbo].[TTMaster_NT] ADD  CONSTRAINT [DF_TTMaster_NT_Basic]  DEFAULT ((0)) FOR [Basic]
GO
ALTER TABLE [dbo].[TTMaster_NT] ADD  CONSTRAINT [DF_TTMaster_NT_Basic_t]  DEFAULT ((0)) FOR [Basic_t]
GO
ALTER TABLE [dbo].[TTMaster_NT] ADD  CONSTRAINT [DF_TTMaster_NT_PerKm]  DEFAULT ((0)) FOR [PerKm]
GO
ALTER TABLE [dbo].[TTMaster_NT] ADD  CONSTRAINT [DF_TTMaster_NT_PerKm_T]  DEFAULT ((0)) FOR [PerKm_T]
GO
ALTER TABLE [dbo].[TTMaster_NT] ADD  CONSTRAINT [DF_TTMaster_NT_PerHour]  DEFAULT ((0)) FOR [PerHour]
GO
ALTER TABLE [dbo].[TTMaster_NT] ADD  CONSTRAINT [DF_TTMaster_NT_PerHour_t]  DEFAULT ((0)) FOR [PerHour_t]
GO
ALTER TABLE [dbo].[TTMaster_NT] ADD  CONSTRAINT [DF_TTMaster_NT_MaxHrs]  DEFAULT ((0)) FOR [MaxHrs]
GO
ALTER TABLE [dbo].[TTMaster_NT] ADD  CONSTRAINT [DF_TTMaster_NT_MaxKm]  DEFAULT ((0)) FOR [MaxKm]
GO
ALTER TABLE [dbo].[TTMaster_NT] ADD  CONSTRAINT [DF_TTMaster_NT_MaxHrs_t]  DEFAULT ((0)) FOR [MaxHrs_t]
GO
ALTER TABLE [dbo].[TTMaster_NT] ADD  CONSTRAINT [DF_TTMaster_NT_MaxKm_t]  DEFAULT ((0)) FOR [MaxKm_t]
GO
ALTER TABLE [dbo].[TTMaster_NT] ADD  CONSTRAINT [DF_TTMaster_NT_Bata]  DEFAULT ((0)) FOR [Bata]
GO
ALTER TABLE [dbo].[TTMaster_NT] ADD  CONSTRAINT [DF_TTMaster_NT_Bata_t]  DEFAULT ((0)) FOR [Bata_t]
GO
ALTER TABLE [dbo].[TTMaster_NT] ADD  CONSTRAINT [DF_TTMaster_NT_minkm]  DEFAULT ((0)) FOR [minkm]
GO
ALTER TABLE [dbo].[TTMaster_NT] ADD  CONSTRAINT [DF_TTMaster_NT_minkm_t]  DEFAULT ((0)) FOR [minkm_t]
GO
ALTER TABLE [dbo].[ttstaxrate] ADD  CONSTRAINT [DF_ttstaxrate_method]  DEFAULT ((0)) FOR [method]
GO
ALTER TABLE [dbo].[TXNNO2] ADD  DEFAULT ((0)) FOR [otype]
GO
ALTER TABLE [dbo].[VATTABLER] ADD  CONSTRAINT [DF_VATTABLER_VAT]  DEFAULT ((0)) FOR [VAT]
GO
ALTER TABLE [dbo].[vchdeleted] ADD  CONSTRAINT [DF__vchdelete__marke__2D487EF1]  DEFAULT (' ') FOR [markedfordeletion]
GO
ALTER TABLE [dbo].[vchdeleted] ADD  CONSTRAINT [DF__vchdelete__txnno__668FABFF]  DEFAULT ((0)) FOR [txnno2]
GO
ALTER TABLE [dbo].[vchdeleted] ADD  CONSTRAINT [DF__vchdelete__txnty__3233AF94]  DEFAULT ('TRFR') FOR [txntype]
GO
ALTER TABLE [dbo].[vchdeleted] ADD  CONSTRAINT [DF_vchdeleted_recondate]  DEFAULT (getdate()) FOR [recondate]
GO
ALTER TABLE [dbo].[vchdeleted] ADD  DEFAULT ((1)) FOR [EXApproved]
GO
ALTER TABLE [dbo].[vchdeleted] ADD  DEFAULT ('') FOR [sessionid]
GO
ALTER TABLE [dbo].[vchdeleted] ADD  DEFAULT ((0)) FOR [outlet]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_TXNDT]  DEFAULT (getdate()) FOR [TXNDT]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_PARTIC]  DEFAULT ('') FOR [PARTIC]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_BALANCE]  DEFAULT ((0)) FOR [BALANCE]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_RECON]  DEFAULT ('') FOR [RECON]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_GRNO]  DEFAULT ((0)) FOR [GRNO]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_FDRSNO]  DEFAULT ((0.0)) FOR [FDRSNO]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_CHANNELCODE]  DEFAULT (' ') FOR [CHANNELCODE]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_REFNO]  DEFAULT ((0)) FOR [REFNO]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_tmstmp]  DEFAULT (CONVERT([varchar](8),getdate(),(108))) FOR [tmstmp]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_ltxndt]  DEFAULT (getdate()) FOR [ltxndt]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_makedfordeletion]  DEFAULT (' ') FOR [markedfordeletion]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_payee]  DEFAULT ('') FOR [payee]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_TXNNO2]  DEFAULT ((0)) FOR [TXNNO2]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_txntype]  DEFAULT ('TRFR') FOR [txntype]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF_VOUCHERS_recondate]  DEFAULT (getdate()) FOR [recondate]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF__VOUCHERS__EXAppr__4AB1F202]  DEFAULT ((1)) FOR [EXApproved]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  CONSTRAINT [DF__VOUCHERS__sessio__4BA6163B]  DEFAULT ('') FOR [sessionid]
GO
ALTER TABLE [dbo].[VOUCHERS] ADD  DEFAULT ((0)) FOR [outlet]
GO
ALTER TABLE [dbo].[vouhist] ADD  DEFAULT (getdate()) FOR [editdate]
GO
ALTER TABLE [dbo].[WAITER] ADD  CONSTRAINT [DF_WAITER_OUTLET]  DEFAULT ((1)) FOR [OUTLET]
GO
ALTER TABLE [dbo].[WAITER] ADD  CONSTRAINT [DF_WAITER_NAME]  DEFAULT (' ') FOR [NAME]
GO
ALTER TABLE [dbo].[wakeupresults] ADD  CONSTRAINT [DF_wakeupresults_txndt]  DEFAULT (getdate()) FOR [txndt]
GO
ALTER TABLE [dbo].[wakeupresults] ADD  CONSTRAINT [DF_wakeupresults_gno]  DEFAULT ((0)) FOR [gno]
GO
ALTER TABLE [dbo].[whatsappmsg] ADD  DEFAULT ('') FOR [msgtype]
GO
ALTER TABLE [dbo].[whatsappmsg] ADD  DEFAULT ('') FOR [msg]
GO
ALTER TABLE [dbo].[whatsappset] ADD  DEFAULT ('') FOR [url]
GO
ALTER TABLE [dbo].[whatsappset] ADD  DEFAULT ('') FOR [token]
GO
ALTER TABLE [dbo].[Wings] ADD  CONSTRAINT [DF__wings__status__5BD420AC]  DEFAULT (' ') FOR [status]
GO
ALTER TABLE [dbo].[Wings] ADD  DEFAULT ('') FOR [staahcode]
GO
ALTER TABLE [dbo].[BILLHIST]  WITH NOCHECK ADD  CONSTRAINT [FK_BILLHIST_BILLHIST11] FOREIGN KEY([CNO])
REFERENCES [dbo].[BILLHIST1] ([CNO])
ON DELETE CASCADE
GO
ALTER TABLE [dbo].[BILLHIST] CHECK CONSTRAINT [FK_BILLHIST_BILLHIST11]
GO
ALTER TABLE [dbo].[FINYEAR]  WITH NOCHECK ADD  CONSTRAINT [FK_FINYEAR_COMPANY] FOREIGN KEY([COMPANY])
REFERENCES [dbo].[company] ([COMPANY])
GO
ALTER TABLE [dbo].[FINYEAR] CHECK CONSTRAINT [FK_FINYEAR_COMPANY]
GO
ALTER TABLE [dbo].[GLPRIMLD]  WITH CHECK ADD  CONSTRAINT [FK_GLPRIMLD_FINYEAR] FOREIGN KEY([COMPANY], [FY])
REFERENCES [dbo].[FINYEAR] ([COMPANY], [FY])
GO
ALTER TABLE [dbo].[GLPRIMLD] CHECK CONSTRAINT [FK_GLPRIMLD_FINYEAR]
GO
ALTER TABLE [dbo].[GRENT]  WITH NOCHECK ADD  CONSTRAINT [FK_GRENT_GUEST] FOREIGN KEY([GNO])
REFERENCES [dbo].[GUEST] ([GNO])
GO
ALTER TABLE [dbo].[GRENT] CHECK CONSTRAINT [FK_GRENT_GUEST]
GO
ALTER TABLE [dbo].[GROOM]  WITH NOCHECK ADD  CONSTRAINT [FK_GROOM_GUEST] FOREIGN KEY([GNO])
REFERENCES [dbo].[GUEST] ([GNO])
GO
ALTER TABLE [dbo].[GROOM] CHECK CONSTRAINT [FK_GROOM_GUEST]
GO
ALTER TABLE [dbo].[GSPLIT]  WITH NOCHECK ADD  CONSTRAINT [FK_GSPLIT_GUEST] FOREIGN KEY([GNO])
REFERENCES [dbo].[GUEST] ([GNO])
GO
ALTER TABLE [dbo].[GSPLIT] CHECK CONSTRAINT [FK_GSPLIT_GUEST]
GO
ALTER TABLE [dbo].[KITHIST]  WITH NOCHECK ADD  CONSTRAINT [FK_KITHIST_KITHIST1] FOREIGN KEY([BNO])
REFERENCES [dbo].[KITHIST1] ([BNO])
GO
ALTER TABLE [dbo].[KITHIST] CHECK CONSTRAINT [FK_KITHIST_KITHIST1]
GO
ALTER TABLE [dbo].[KITHIST1]  WITH NOCHECK ADD  CONSTRAINT [FK_KITHIST1_OUTLET] FOREIGN KEY([OUTLET])
REFERENCES [dbo].[OUTLET] ([CODE])
GO
ALTER TABLE [dbo].[KITHIST1] CHECK CONSTRAINT [FK_KITHIST1_OUTLET]
GO
ALTER TABLE [dbo].[KITMAST1]  WITH NOCHECK ADD  CONSTRAINT [FK_KITMAST1_OUTLET] FOREIGN KEY([OUTLET])
REFERENCES [dbo].[OUTLET] ([CODE])
GO
ALTER TABLE [dbo].[KITMAST1] CHECK CONSTRAINT [FK_KITMAST1_OUTLET]
GO
ALTER TABLE [dbo].[kitprime]  WITH CHECK ADD  CONSTRAINT [FK_kitprime_KITCLASS] FOREIGN KEY([class])
REFERENCES [dbo].[KITCLASS] ([code])
GO
ALTER TABLE [dbo].[kitprime] CHECK CONSTRAINT [FK_kitprime_KITCLASS]
GO
ALTER TABLE [dbo].[kitprime]  WITH CHECK ADD  CONSTRAINT [FK_kitprime_KITCLASS_2] FOREIGN KEY([subclass])
REFERENCES [dbo].[KITCLASS_2] ([CODE])
GO
ALTER TABLE [dbo].[kitprime] CHECK CONSTRAINT [FK_kitprime_KITCLASS_2]
GO
ALTER TABLE [dbo].[kitprime]  WITH CHECK ADD  CONSTRAINT [FK_kitprime_KITGROUP] FOREIGN KEY([grp])
REFERENCES [dbo].[KITGROUP] ([CODE])
GO
ALTER TABLE [dbo].[kitprime] CHECK CONSTRAINT [FK_kitprime_KITGROUP]
GO
ALTER TABLE [dbo].[LTTABLE]  WITH NOCHECK ADD  CONSTRAINT [FK_LTTABLE_LTMASTER] FOREIGN KEY([TNO])
REFERENCES [dbo].[LTMASTER] ([TNO])
GO
ALTER TABLE [dbo].[LTTABLE] CHECK CONSTRAINT [FK_LTTABLE_LTMASTER]
GO
ALTER TABLE [dbo].[RESTCO]  WITH NOCHECK ADD  CONSTRAINT [FK_RESTCO_COMPANY] FOREIGN KEY([COMPANY])
REFERENCES [dbo].[company] ([COMPANY])
GO
ALTER TABLE [dbo].[RESTCO] CHECK CONSTRAINT [FK_RESTCO_COMPANY]
GO
ALTER TABLE [dbo].[storeitems]  WITH CHECK ADD  CONSTRAINT [FK_storeitems_store] FOREIGN KEY([storeno])
REFERENCES [dbo].[store] ([storeno])
GO
ALTER TABLE [dbo].[storeitems] CHECK CONSTRAINT [FK_storeitems_store]
GO
ALTER TABLE [dbo].[storeitems]  WITH CHECK ADD  CONSTRAINT [FK_storeitems_storedept] FOREIGN KEY([storedept])
REFERENCES [dbo].[storedept] ([ctrlno])
GO
ALTER TABLE [dbo].[storeitems] CHECK CONSTRAINT [FK_storeitems_storedept]
GO
ALTER TABLE [dbo].[cashboxuser]  WITH CHECK ADD  CONSTRAINT [CK_cashboxuser] CHECK  (([USERNO]<>(0)))
GO
ALTER TABLE [dbo].[cashboxuser] CHECK CONSTRAINT [CK_cashboxuser]
GO
ALTER TABLE [dbo].[GLPRIMLD]  WITH CHECK ADD  CONSTRAINT [CK_GLPRIMLD_Blank_Description] CHECK  (([cgp_desc]<>''))
GO
ALTER TABLE [dbo].[GLPRIMLD] CHECK CONSTRAINT [CK_GLPRIMLD_Blank_Description]
GO
/****** Object:  Trigger [dbo].[acclog_insert]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.acclog_insert    Script Date: 21/09/2006 12:14:21 PM ******/ /****** Modified on 06/Oct/2009 : 14 May 2019  Ram *****/  
CREATE  TRIGGER [dbo].[acclog_insert] ON [dbo].[acclog]  FOR INSERT AS declare @ctrlno numeric declare @unm varchar(50) declare @sessionid varchar(100) 
declare @host_name varchar(100) 
declare @username varchar(100)
select top 1 @username=usernm,@host_name=computer from comuser where [host_id]=host_id() 
select @sessionid=isnull(sessionid,''), @ctrlno=ctrlno,@unm=isnull(username,'')  from inserted
--if exists (select top 1 usernm from comuser where [host_id]=host_id()  and usernm is null and isnull(sessionid,'')=@sessionid)     or not exists 
--(select * from comuser where [host_id]=host_id()  and  isnull(sessionid,'')=@sessionid)    
--begin print 'You are not looged in' rollback raiserror('Please loggin and then try',16,-1) return end 	
if ltrim(rtrim(@unm))=''	   
if exists (select top 1 usernm from comuser where [host_id]=host_id()  and isnull(sessionid,'')=@sessionid) 		
begin         		 
update acclog set computer=@host_name, username=(select usernm from comuser where [host_id]=host_id()  and isnull(sessionid,'')=@sessionid) where ctrlno=@ctrlno  
end 		
update acclog set  usernm=@host_name+'-'+(select usernm from comuser where [host_id]=host_id()),computer=@host_name,txndt=getdate() where ctrlno=@ctrlno 		 insert into acclogdup select * from acclog  where ctrlno=@ctrlno     		 if exists (select top 1 usernm from comuser where computer=@host_name and isnull(sessionid,'')=@sessionid)         update acclog set username=(select top 1 usernm from comuser where computer=@host_name and isnull(sessionid,'')=@sessionid) where ctrlno=@ctrlno update acclog set  usernm=@host_name+'-'+username,computer=@host_name,txndt=getdate() where ctrlno=@ctrlno 		 insert into acclogdup select * from acclog  where ctrlno=@ctrlno 
GO
ALTER TABLE [dbo].[acclog] ENABLE TRIGGER [acclog_insert]
GO
/****** Object:  Trigger [dbo].[pwinsert]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[pwinsert] ON [dbo].[BASIC] 
/* with encryption */
FOR INSERT 
AS declare  
@userno numeric declare @ctrlno numeric select @ctrlno = ctrlno,@userno=isnull(userno,0)  from inserted if @userno=0 begin select @userno=max(userno) from basic set @userno = isnull(@userno,0) + 1 update basic set userno=@userno where ctrlno=@ctrlno End
GO
ALTER TABLE [dbo].[BASIC] ENABLE TRIGGER [pwinsert]
GO
/****** Object:  Trigger [dbo].[bhinsert]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.bhinsert    Script Date: 21/09/2006 12:14:20 PM ******/
/****** Object:  Trigger dbo.bhinsert    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.bhinsert    Script Date: 10/08/2004 8:28:15 PM ******/
CREATE TRIGGER [dbo].[bhinsert] ON [dbo].[BILLHIST] 
/* with encryption */
FOR INSERT 
AS
declare @rent money
declare @ctrlno numeric
select @rent=rent,@ctrlno=ctrlno from inserted
update billhist set orent=@rent where ctrlno=@ctrlno
GO
ALTER TABLE [dbo].[BILLHIST] ENABLE TRIGGER [bhinsert]
GO
/****** Object:  Trigger [dbo].[delchal]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.delchal    Script Date: 21/09/2006 12:14:20 PM ******/
/****** Object:  Trigger dbo.delchal    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.delchal    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.delchal    Script Date: 15/02/2004 6:23:01 PM ******/
CREATE TRIGGER [dbo].[delchal] ON [dbo].[CHALAN] 
/* with encryption */
FOR  DELETE 
AS
declare @outlet int
declare @grno int
declare @grno1 int
declare @grno_co1 int
declare @company int
declare @fy int
declare @txndt datetime
declare @retval int
declare @stype int
begin transaction
select @stype=stype,@outlet=outlet,@grno=grno,@grno1=grno_t,@txndt=chldate,@grno_co1=grno_co1 from deleted
select @company=company from toutlet where outlet=@outlet
EXEC  GETFY @TXNDT,@COMPANY,@FY OUT
IF @FY=0 GOTO E_ERROR
if @grno<>0
begin
exec delgrno @company,@fy,@grno,@txndt,@retval out
if @retval<>0  goto e_error
end
if @grno1<>0
begin
exec delgrno @company,@fy,@grno1,@txndt,@retval out
if @retval<>0  goto e_error
end
if @grno_co1<> 0
begin
set @company = 1
EXEC  GETFY @TXNDT,@COMPANY,@FY OUT
IF @FY=0 GOTO E_ERROR
exec delgrno @company,@fy,@grno_co1,@txndt,@retval out
if @retval<>0  goto e_error
end
commit transaction
return
e_error:
rollback transaction
raiserror('deletion problem in TKT chalan',16,-1)
return
GO
ALTER TABLE [dbo].[CHALAN] ENABLE TRIGGER [delchal]
GO
/****** Object:  Trigger [dbo].[INSERTCHALAN]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.INSERTCHALAN    Script Date: 21/09/2006 12:14:20 PM ******/
/****** Object:  Trigger dbo.INSERTCHALAN    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.INSERTCHALAN    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.INSERTCHALAN    Script Date: 15/02/2004 6:23:01 PM ******/
CREATE TRIGGER [dbo].[INSERTCHALAN]  ON [dbo].[CHALAN] 
/* with encryption */
FOR INSERT
AS
declare @usernm varchar(10)
declare @chctrlno numeric
select @usernm=usernm from comuser where [host_id]=host_id()
select @chctrlno=chctrlno from inserted
update chalan set user1=@usernm where chctrlno=@chctrlno
return
GO
ALTER TABLE [dbo].[CHALAN] ENABLE TRIGGER [INSERTCHALAN]
GO
/****** Object:  Trigger [dbo].[updatechalan]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.updatechalan    Script Date: 21/09/2006 12:14:20 PM ******/
/****** Object:  Trigger dbo.updatechalan    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.updatechalan    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.updatechalan    Script Date: 15/02/2004 6:23:01 PM ******/
CREATE TRIGGER [dbo].[updatechalan] ON [dbo].[CHALAN] 
/* with encryption */
FOR  UPDATE
AS
if not update(finaldate) return
declare @usernm varchar(10)
declare @chctrlno numeric
select @usernm=usernm from comuser where [host_id]=host_id()
select @chctrlno=chctrlno from inserted
update chalan set user2=@usernm where chctrlno=@chctrlno
return
GO
ALTER TABLE [dbo].[CHALAN] ENABLE TRIGGER [updatechalan]
GO
/****** Object:  Trigger [dbo].[comlogins]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO











/****** Object:  Trigger dbo.comlogins    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.comlogins    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.comlogins    Script Date: 10/08/2004 8:28:15 PM ******/
CREATE TRIGGER [dbo].[comlogins]  ON [dbo].[comlog] 
/* with encryption */
FOR INSERT
AS
declare @details varchar(50)
declare @ctrlno numeric
declare @txntype tinyint
select @ctrlno=ctrlno,@details=details from inserted
set @txntype =  case 
         when substring(@details,1,9) = 'Logged in'   then 3
         when substring(@details,1,10)='Logged out' then 4
         when substring(@details,1,7)='Started'  then 1
         when substring(@details,1,12)='Disconnected' then  2
     end
update comlog set txntype=@txntype where ctrlno=@ctrlno
delete from comlog where datediff(d,txndt,getdate()) > 30











GO
ALTER TABLE [dbo].[comlog] ENABLE TRIGGER [comlogins]
GO
/****** Object:  Trigger [dbo].[ForCoLogo]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  TRIGGER [dbo].[ForCoLogo] ON [dbo].[company] FOR INSERT AS declare @company int SELECT @COMPANY=COMPANY FROM INSERTED insert into companylogo (company) values (@company)
GO
ALTER TABLE [dbo].[company] ENABLE TRIGGER [ForCoLogo]
GO
/****** Object:  Trigger [dbo].[INSCOMPANY]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.INSCOMPANY    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.INSCOMPANY    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.INSCOMPANY    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.INSCOMPANY    Script Date: 15/02/2004 6:23:01 PM ******/
CREATE TRIGGER [dbo].[INSCOMPANY] ON [dbo].[company] 
/* with encryption */
FOR INSERT
AS
DECLARE @COMPANY INT
DECLARE @X INT
SELECT @COMPANY=COMPANY FROM INSERTED
SET @X = 1
WHILE @X <= 10
BEGIN
   INSERT INTO BILLPOSITION (COMPANY,POSITION) VALUES (@COMPANY,@X)
   SELECT  @X = @X + 1
END
GO
ALTER TABLE [dbo].[company] ENABLE TRIGGER [INSCOMPANY]
GO
/****** Object:  Trigger [dbo].[comuserdel]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.comuserdel    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.comuserdel    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.comuserdel    Script Date: 10/08/2004 8:28:15 PM ******/
CREATE TRIGGER [dbo].[comuserdel]  ON [dbo].[comuser] 
/* with encryption */
FOR  DELETE 
AS
declare @rowcount numeric
set @rowcount=@@rowcount
if @rowcount=0 return
if @rowcount > 1 return
insert into comlog (computer,usernm,details) values (isnull((select computer from comuser where [host_id]=host_id()),''),'','Disconnected at ' + convert(varchar(20),getdate()))
GO
ALTER TABLE [dbo].[comuser] ENABLE TRIGGER [comuserdel]
GO
/****** Object:  Trigger [dbo].[logininsert]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.logininsert    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.logininsert    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.logininsert    Script Date: 10/08/2004 8:28:15 PM ******/
CREATE TRIGGER [dbo].[logininsert]  ON [dbo].[comuser] 
/* with encryption */
FOR INSERT
AS
declare @compname varchar(50)
declare @usernm varchar(50)
select @compname=computer from inserted
update comuser set logintime=getdate() where computer=@compname AND [HOST_ID]=HOST_ID()
delete from comuser where datediff(n,logintime,getdate())  > 120
insert into comlog (computer,usernm,details) values 
(isnull((select top 1 computer from comuser where [host_id]=host_id()),''),'','started at ' + convert(varchar(20),getdate()))
GO
ALTER TABLE [dbo].[comuser] ENABLE TRIGGER [logininsert]
GO
/****** Object:  Trigger [dbo].[loginupd]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.loginupd    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.loginupd    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.loginupd    Script Date: 10/08/2004 8:28:15 PM ******/
CREATE TRIGGER [dbo].[loginupd] ON [dbo].[comuser] 
/* with encryption */
FOR  UPDATE AS
declare @computer varchar(50)
declare @usernmin varchar(50)
declare @usernmout varchar(50)
delete from comuser where datediff(d,logintime,getdate())  >6
if update(usernm) 
begin
select @usernmin=usernm,@computer=computer from inserted
select @usernmout=usernm from deleted
if @usernmout<>'' 
insert into comlog (computer,usernm,details) values ((select top 1 computer from comuser where [host_id]=host_id()),@usernmout,'Logged out at ' + convert(varchar(20),getdate()))
if @usernmin<>''
insert into comlog (computer,usernm,details) values ((select top 1 computer from comuser where [host_id]=host_id()),@usernmin,'Logged in at ' + convert(varchar(20),getdate()))
end
GO
ALTER TABLE [dbo].[comuser] ENABLE TRIGGER [loginupd]
GO
/****** Object:  Trigger [dbo].[deletecasecade]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  TRIGGER [dbo].[deletecasecade] ON [dbo].[GLPRIMLD] 
FOR DELETE 
 AS 
if exists (select * from deleted where deletable='N') 
begin 
rollback 
Print 'The account is linked to some other operation..can not delete'
raiserror('',16,-1) 
end

GO
ALTER TABLE [dbo].[GLPRIMLD] ENABLE TRIGGER [deletecasecade]
GO
/****** Object:  Trigger [dbo].[GLPRIMUSERNM]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE TRIGGER [dbo].[GLPRIMUSERNM]
   ON  [dbo].[GLPRIMLD]
   AFTER INSERT
AS 
BEGIN
SET NOCOUNT ON;
DECLARE @USERNM VARCHAR(100)
DECLARE @CTRLNO NUMERIC
IF EXISTS (select usernm from comuser where [host_id]=host_id()) 
SELECT TOP 1  @USERNM=USERNM FROM COMUSER WHERE [host_id]=host_id()
SELECT @CTRLNO=CTRLNO FROM INSERTED
Update glprimld set usernm=@USERNM,doo=getdate() where ctrlno=@CTRLNO
END
GO
ALTER TABLE [dbo].[GLPRIMLD] ENABLE TRIGGER [GLPRIMUSERNM]
GO
/****** Object:  Trigger [dbo].[glrpimisert]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[glrpimisert]  ON [dbo].[GLPRIMLD]  
/* with encryption */
FOR INSERT 
AS
declare @company int
declare @fy int
declare @newfy int
declare @cgp_Desc varchar(50)
declare @asset char(1)
declare @onac char(1)
declare @tdno int
declare @flag int
declare @cgp_actno int
declare @grp int
declare @add1 varchar(50)
declare @add2 varchar(50)
declare @city varchar(50)
declare @phone varchar(50)
declare @fydate datetime
declare @newactno numeric
declare @msg varchar(500)
declare @deletable char(1)
declare @newglacno numeric
declare @gstin nvarchar(50)
declare @pan nvarchar(50)
declare @ctrlno numeric
declare @nextyearfy numeric
--print 'periya'
select @ctrlno=ctrlno,@deletable=deletable,@company=COMPANY,@fy=FY,@cgp_desc=CGP_DESC,@asset=ASSET,@onac=ONAC,
@tdno=TDNO,@flag=FLAG,@cgp_actno=CGP_ACTNO,@grp=GRP,@add1=add1,@add2=add2,@city=city,@phone=phone ,@nextyearfy=nextyearfy
, @gstin=gstin,@pan=pan from inserted
if @nextyearfy=@fy begin set @msg = 'Error in nextyearfy' goto e_error end
select @fydate=finyear.[date]  from finyear where fy=@fy
set @msg = str(@fy) + str(@company)  + convert(varchar(20),@fydate)
--set @fydate= '1 apr ' + str(datepart(yy,@fydate)+1)
set @fydate = dbo.getbofy(dateadd(yy,1,@fydate))

if exists(select * from finyear where datediff(dd,'1/1/80',finyear.[date])=datediff(dd,'1/1/80',@fydate) and company=@company)
begin
	select @newfy=fy from finyear where datediff(dd,'1/1/80',finyear.[date])=datediff(dd,'1/1/80',@fydate) and company=@company
	set @newactno = 0
	if exists(select * from glprimld where company=@company and fy=@newfy and cgp_actno=@cgp_actno)
	begin
		select @newactno=max(cgp_actno) from glprimld where company=@company and fy = @newfy
		set @newactno = @newactno+1
	end
	else
		set @newactno=@cgp_actno


	if not exists(select * from glprimld where cgp_desc=@cgp_desc and company=@company and fy=@newfy)
		begin
			INSERT GLPRIMLD (COMPANY,FY,CGP_DESC,ASSET,ONAC,TDNO,FLAG,CGP_ACTNO,GRP,add1,add2,city,phone,deletable,gstin,PAN) VALUES 
			(@company,@newfy,@cgp_Desc,@asset,@onac,@tdno,@flag,@newactno,@grp,@add1,@add2,@city,@phone,@deletable,@gstin,@pan)
			if @@error <> 0 goto e_error
			update glprimld set nextyearac=@newactno,nextyearfy=@newfy where company=@company and fy=@fy and cgp_actno=@cgp_actno
			if @@error <> 0 goto e_error
		end 
	else
		begin
		set @msg =  'GL Exists ' + @cgp_desc
		select @newglacno=cgp_actno from glprimld where cgp_desc=@cgp_desc and company=@company and fy=@newfy
		update glprimld set nextyearac=@newglacno,nextyearfy=@newfy where cgp_desc=@cgp_desc and fy=@newfy
		--goto e_error
		end
end

return
e_error:
rollback transaction
set @msg = @msg + ' next year failed'
raiserror(@msg,16,-1)
return
GO
ALTER TABLE [dbo].[GLPRIMLD] ENABLE TRIGGER [glrpimisert]
GO
/****** Object:  Trigger [dbo].[updtbal]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.updtbal    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.updtbal    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.updtbal    Script Date: 04/08/2004 4:42:32 PM ******/
/****** Object:  Trigger dbo.updtbal    Script Date: 15/02/2004 6:23:01 PM ******/
CREATE  TRIGGER [dbo].[updtbal] ON [dbo].[GLPRIMLD] 
/* with encryption */
FOR UPDATE 
AS
declare @company numeric
declare @fy numeric
declare @nextyearac numeric
declare @nextyearfy numeric
declare @grp numeric
declare @balance money
declare @prebalance money
declare @difference money
declare @txndt datetime
declare @oldgrp numeric
declare @actnum numeric
declare @flag numeric
declare @oldflag numeric
declare @oldbal money
declare @detached char(1)
declare @status char(1)
---if not update(balance) and not update(status) and not update(grp) return

select @txndt=ltxndt,@company=company,@fy=fy,@nextyearac=isnull(nextyearac,0),@nextyearfy=isnull(nextyearfy,0),@grp=grp,@balance=balance,@actnum=cgp_actno,@flag=flag,@status=status from inserted
select @oldgrp=grp,@prebalance=balance from deleted

--- This script is created on 22-Mar-2014 @ Kottaiyur (came to collect the Lachu Marriage invitation
if update(status)
if @nextyearac<> 0
update glprimld set status=@status where company=@company and fy=@nextyearfy and cgp_actno = @nextyearac

if update(balance) and not update(status) 
if @balance<>0 
update glprimld set status='' where company=@company and fy=@fy and cgp_actno = @actnum
--- Status update end


	select @detached=detached from finyear where fy=@fy
    if @detached='Y' return

---if update(OPGBAL)
IF UPDATE(balance) ----OR UPDATE(BALANCE)

begin
	if not exists(select * from finyear where fy=@nextyearfy) return
	set @difference=  @balance-@prebalance
	if @nextyearfy<> 0
	begin
		select @txndt=finyear.[date] from finyear where company=@company and fy=@nextyearfy

		if @grp<>7
			begin
--rollback transaction
--declare @retval varchar(100)
--set @retval = str(@difference)
--raiserror(@retval,16,-1)
	
			update glprimld set opgbal=@balance,balance=balance+@difference,ltxndt=@txndt where company=@company and fy=@nextyearfy and cgp_actno = @nextyearac
			end
		else
		begin
			declare @plbal money
			select @plbal=sum(balance) from glprimld where fy=@fy and grp=7
			select @oldbal=balance from glprimld where fy=@fy and cgp_actno=52
			update glprimld set opgbal=@plbal+@OLDBAL,ltxndt=@txndt  where company=@company and fy=@nextyearfy and cgp_actno = 52
			exec fillbal @txndt,@company,52,1
		end
	end
end --ends balance updating

if update(grp) 
begin
 if @nextyearac <>0
    if @oldgrp<>@grp 
       begin
       set @difference=  @balance-@prebalance
       select @txndt=finyear.[date] from finyear where company=@company and fy=@nextyearfy
       if @oldgrp<>7 and @grp=7
           begin
               update glprimld set grp=@grp,flag=@flag,opgbal=opgbal-@balance,balance=balance-@balance,ltxndt=@txndt where company=@company and fy=@nextyearfy and cgp_actno = @nextyearac      
               update glprimld set opgbal=opgbal+@balance ,balance=balance-@balance,ltxndt=@txndt where company=@company and fy=@nextyearfy and cgp_actno = 52
           end
      else if @oldgrp=7 and @grp<>7
           begin
               update glprimld set grp=@grp,flag=@flag,opgbal=opgbal+@balance,balance=balance+@balance,ltxndt=@txndt where company=@company and fy=@nextyearfy and cgp_actno = @nextyearac      
               update glprimld set opgbal=opgbal-@balance,balance=balance-@balance,ltxndt=@txndt where company=@company and fy=@nextyearfy and cgp_actno = 52
           end
         end
end
GO
ALTER TABLE [dbo].[GLPRIMLD] ENABLE TRIGGER [updtbal]
GO
/****** Object:  Trigger [dbo].[gppinsert]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO







CREATE TRIGGER [dbo].[gppinsert] ON [dbo].[GPASSPORT] 
/* with encryption */
FOR INSERT
AS
begin transaction
declare @cformno numeric
declare @ctrlno numeric
select @ctrlno=ctrlno from inserted
select @cformno=max(cformno) from gpassport
update gpassport set cformno=@cformno+1 where ctrlno=@ctrlno
commit transaction








GO
ALTER TABLE [dbo].[GPASSPORT] ENABLE TRIGGER [gppinsert]
GO
/****** Object:  Trigger [dbo].[gnewcidate]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  TRIGGER [dbo].[gnewcidate] ON [dbo].[GUEST] 
/* with encryption */
FOR INSERT  AS declare @cidate datetime declare @gno numeric select * into #gnewcid from inserted select @gno=gno,@cidate=ci_date from #gnewcid if abs(datediff(n,@cidate,getdate())) > 20 begin insert into acclog (narration,txntype,gno) values ('Check-In differs by more than 20 minutes-Current Date & Time ' + convert(varchar(20),getdate(),13) + ' Date & Time Recorded ' +   convert(varchar(20),@cidate,13),73,@gno) end update guest set gi=datediff(s,'1 jan 2000', getdate()) where gno=@gno
GO
ALTER TABLE [dbo].[GUEST] ENABLE TRIGGER [gnewcidate]
GO
/****** Object:  Trigger [dbo].[gst_expecteddep]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[gst_expecteddep] ON [dbo].[GUEST] 
/* with encryption */
FOR  UPDATE 
AS
if not update(expecteddep) return 
declare @expecteddep datetime
declare @expold datetime
declare @expnew datetime 
declare @eno numeric 
declare @rno numeric 
declare @gno numeric 
declare @name varchar(200) 
select @expold=isnull(expecteddep,'1 jan 2010')  from deleted 
select @expnew=isnull(expecteddep,'1 jan 2011') from inserted 
if datediff(n,@expold,@expnew)<>0 
begin 
select @gno=gno,@expecteddep=expecteddep, @eno=eno, @rno=rno,@name=name from inserted 
insert into acclog (narration,gno,txntype) values ('Expected Departure Date extended to ' + convert(varchar(20),@expecteddep) + ' from ' + convert(varchar(20),@expold) + ' Guest Name ' + @name + ' Entry No. ' + ltrim(str(@eno))  + ' Room No.' + ltrim(str(@rno)),@gno,203) 
end
GO
ALTER TABLE [dbo].[GUEST] ENABLE TRIGGER [gst_expecteddep]
GO
/****** Object:  Trigger [dbo].[guestcidate]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  TRIGGER [dbo].[guestcidate] ON [dbo].[GUEST] 
/* with encryption */
FOR  UPDATE
AS
declare @ocid datetime
declare @ncid datetime
declare @gno numeric
declare @ogrpname varchar(50)
declare @ngrpname varchar(50)
declare @rno numeric
declare @guest varchar(100)
if update(ci_date)
begin
select * into #gcid1 from deleted
select * into #gcid2 from inserted
select @gno=gno,@ocid=ci_date from #gcid1
select @gno=gno,@ncid=ci_date from #gcid2
if datediff ( n, @ocid,@ncid) <> 0
begin
select @rno=rno,@guest=name from guest where gno=@gno
insert into acclog(narration,txntype,gno) values ('Check-In Date Changed from ' + convert(varchar(20),@ocid,13) + ' to ' + convert(varchar(20),@ncid,13) +  ' Room No.' + ltrim(str(@rno)) + ' Guest Name : ' +  @guest  ,72,@gno)
 End
End
if update(grpname)
begin
select * into #gcid01 from deleted
select * into #gcid02 from inserted
select @gno=gno,@ogrpname=grpname from #gcid01
select @gno=gno,@ngrpname=grpname from #gcid02
if @ogrpname<>@ngrpname
insert into acclog(narration,txntype,gno) values ('Sys.No.'  + ltrim(str(@gno))  + '-Group ID Changed from ' + @ogrpname + ' to ' + @ngrpname ,74,@gno)
End
GO
ALTER TABLE [dbo].[GUEST] ENABLE TRIGGER [guestcidate]
GO
/****** Object:  Trigger [dbo].[updatecodate]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[updatecodate] ON [dbo].[GUEST] 
/* with encryption */
FOR UPDATE
AS
if not update(co_date) return
declare @co_date datetime
declare @ci_date datetime
declare @gno numeric
select @gno=gno,@co_date=co_date,@ci_date=ci_date from inserted
if datediff(s,@ci_date,@co_date) < 0 begin
insert into acclog (narration) values ('sys.no-' + ltrim(str(@gno) ))
print 'This operation changes the checkout date less than the checkin date...so operation aborted - '
rollback transaction
return
end
--print 'periya'
GO
ALTER TABLE [dbo].[GUEST] ENABLE TRIGGER [updatecodate]
GO
/****** Object:  Trigger [dbo].[smsdelete]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO


CREATE TRIGGER  [dbo].[smsdelete] ON [dbo].[infosent] 
FOR INSERT, UPDATE
AS
delete from infosent where datediff(d,txndt,getdate()) > 20


GO
ALTER TABLE [dbo].[infosent] ENABLE TRIGGER [smsdelete]
GO
/****** Object:  Trigger [dbo].[khupdate]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO













/****** Object:  Trigger dbo.khupdate    Script Date: 21/09/2006 12:14:20 PM ******/
/****** Object:  Trigger dbo.khupdate    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.khupdate    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.khupdate    Script Date: 15/02/2004 6:23:01 PM ******/
CREATE TRIGGER [dbo].[khupdate] ON [dbo].[KITHIST] 
FOR  UPDATE
AS
declare @name varchar(50)
if update(name) return
select  @name=name from kitprime where icode=(select icode from kitmast where code=(select icode from inserted))













GO
ALTER TABLE [dbo].[KITHIST] ENABLE TRIGGER [khupdate]
GO
/****** Object:  Trigger [dbo].[KITHISTDEL]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

/****** Object:  Trigger dbo.KITHISTDEL    Script Date: 21/09/2006 12:14:20 PM ******/
/****** Object:  Trigger dbo.KITHISTDEL    Script Date: 4/14/2005 10:21:49 PM ******/
/****** Object:  Trigger dbo.KITHISTDEL    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.KITHISTDEL    Script Date: 15/02/2004 6:23:01 PM ******/
/****** Object:  Trigger dbo.KITHISTDEL    Script Date: 1/20/03 11:51:49 AM ******/
CREATE TRIGGER [dbo].[KITHISTDEL] ON [dbo].[KITHIST] 
/* with encryption */
FOR DELETE 
AS
--BEGIN TRANSACTION
DECLARE @M_CODE INT
DECLARE @M_OUTLET INT
DECLARE @M_QTY INT
DECLARE @M_CODE1 INT
DECLARE @M_QTY1 INT
DECLARE @ERR INT
declare @curdate datetime
declare @opgbal float
declare @outlet int
declare @txndt datetime
declare @bno numeric
set @ERR = 0
SELECT @bno=bno,@M_CODE=CODE,@M_QTY=QTY FROM DELETED
select @outlet=outlet from kitmast where code =@m_code
--select @curdate=curdate from outlet where code=@outlet
select @txndt=txndt from kithist1 where bno=@bno
DECLARE KM212 CURSOR FOR SELECT scode,qty FROM KITMAST2 WHERE icode=@M_CODE
OPEN KM212
FETCH NEXT FROM KM212 INTO @M_CODE1,@M_QTY1
WHILE @@FETCH_STATUS=0 
  BEGIN 
  if not exists(select * from mizastock where otype=1 and outlet=@outlet and icode=@m_code1) insert into mizastock(otype,outlet,icode,stock,ltxndt) values (1,@outlet,@m_code1,0,getdate())
  update mizastock set stock=stock+(@m_qty1*@m_qty) where icode=@m_code1 and outlet=@outlet and otype=1

  declare @msicode numeric
  select @msicode=ctrlno from mizastock  where icode=@m_code1 and outlet=@outlet and otype=1

  if not exists (select * from mizstock where OUTLET=@OUTLET AND  icode=@msicode and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt)) insert into mizstock (icode,txndt,OUTLET) values (@msicode,@txndt,@OUTLET)
  update mizstock set consumed=consumed - (@m_qty1*@m_qty) where  outlet=@outlet and icode=@msicode and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt)

  IF @@ERROR <> 0 GOTO E_ERROR
  FETCH NEXT FROM KM212 INTO @M_CODE1,@M_QTY1
END
GOTO E_CLOSE
E_CLOSE:
CLOSE KM212
DEALLOCATE KM212
IF @ERR<>0
--COMMIT TRANSACTION
--ELSE
BEGIN
ROLLBACK TRANSACTION
RAISERROR('KITMAST2 DELETION FAILED',16,-1)
END
RETURN
E_ERROR:
SELECT @ERR = 1
GOTO E_CLOSE
GO
ALTER TABLE [dbo].[KITHIST] ENABLE TRIGGER [KITHISTDEL]
GO
/****** Object:  Trigger [dbo].[KITINSERT]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

/****** Object:  Trigger dbo.KITINSERT    Script Date: 21/09/2006 12:14:20 PM ******/
/****** Object:  Trigger dbo.KITINSERT    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.KITINSERT    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.KITINSERT    Script Date: 15/02/2004 6:23:01 PM ******/
/****** Object:  Trigger dbo.KITINSERT    Script Date: 1/20/03 11:51:49 AM ******/
/****** Object:  Trigger dbo.KITINSERT    Script Date: 10/14/02 1:17:58 PM ******/
/*****  Modified on 27-09-2012 - withdrawn OLSTORE table Items Linking etc....... created new table and new logic ***/
CREATE TRIGGER [dbo].[KITINSERT]  ON [dbo].[KITHIST] 
/* with encryption */
FOR INSERT
AS
--if update(name) return
DECLARE @M_CODE INT
DECLARE @M_OUTLET INT
DECLARE @M_QTY float
DECLARE @M_CODE1 INT
DECLARE @M_QTY1 float 
DECLARE @ERR INT
declare @outlet int
declare @curdate datetime
declare @opgbal float
declare @name varchar(50)
declare @ctrlno numeric
declare @txndt datetime
declare @bno numeric
declare @msicode numeric

set @ERR = 0
SELECT @bno=bno,@CTRLNO=CTRLNO,@M_CODE=CODE,@M_QTY=QTY FROM INSERTED
select @name=name from kitprime  where icode=(select icode from kitmast where code=@m_code)
update kithist set name=@name where ctrlno=@ctrlno
select @txndt=txndt from kithist1 where bno=@bno
--PRINT @NAME
--PRINT @M_CODE
select @outlet=outlet from kitmast_v where code =@m_code
select @curdate=curdate from outlet where code=@outlet
DECLARE KM2 CURSOR FOR SELECT scode,qty FROM KITMAST2 WHERE icode=@M_CODE
OPEN KM2
FETCH NEXT FROM KM2 INTO @M_CODE1,@M_QTY1
WHILE @@FETCH_STATUS=0 
BEGIN 
	if not exists(select * from mizastock where otype=1 and outlet=@outlet and icode=@m_code1) insert into mizastock(otype,outlet,icode,stock,ltxndt) values (1,@outlet,@m_code1,0,getdate())
	update mizastock set stock=stock-(@m_qty1*@m_qty),ltxndt=@curdate where otype=1 and outlet=@outlet and icode=@m_code1
	IF @@ERROR <> 0 GOTO E_ERROR
	
	select @msicode=ctrlno from mizastock  where icode=@m_code1 and outlet=@outlet and otype=1
	
	if not exists 
	(select * from mizstock where OUTLET=@OUTLET AND icode=@MSIcode and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt)) 
	insert into mizstock (icode,txndt,OUTLET) values (@msicode,@txndt,@OUTLET)
	update mizstock set consumed=consumed+(@m_qty1*@m_qty) where outlet=@outlet and  icode=@msicode and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt)
	
	FETCH NEXT FROM KM2 INTO @M_CODE1,@M_QTY1
END
GOTO E_CLOSE
E_CLOSE:
CLOSE KM2
DEALLOCATE KM2
IF @ERR<>0
BEGIN
ROLLBACK TRANSACTION
RAISERROR('KITMAST2 UPDATION FAILED',16,-1)
END
RETURN
E_ERROR:
SELECT @ERR = 1
GOTO E_CLOSE
GO
ALTER TABLE [dbo].[KITHIST] ENABLE TRIGGER [KITINSERT]
GO
/****** Object:  Trigger [dbo].[CheckGuest]    Script Date: 07/04/2026 20:30:03 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[CheckGuest]  ON [dbo].[KITHIST1] 
/* with encryption */
FOR INSERT, UPDATE AS 
IF UPDATE(GSTIN) RETURN
IF UPDATE(EINVOICE) RETURN
declare @gno numeric declare @billdt datetime declare @cidate datetime declare @codate datetime declare @mop int select @gno=gno,@billdt=txndt,@mop=pmode from inserted select @cidate=ci_date,@codate=isnull(co_date,getdate()) from guest where gno=@gno if isnull(@gno,0) = 0  return if isnull(@mop,0)<>2 return if     datediff(d,'1/1/90',@billdt) < (datediff(d,'1/1/90',@cidate)+1) and  datediff(d,'1/1/90',@billdt) > datediff(d,'1/1/90',@codate)  begin rollback transaction raiserror('Error in the Bill Date and check-in checkout date - message from kithist1',16,-1) Return End
declare @err varchar(200)
if not exists(select * from hmsfolder where version_no = (select top 1 version_no from comuser where [host_id]=host_id()) ) 
	begin 
	set @err='You are using a wrong version of the Softwre Installed...Please update the version (T1) and try'
	raiserror(@err,16,-1)
	return
	end
GO
ALTER TABLE [dbo].[KITHIST1] ENABLE TRIGGER [CheckGuest]
GO
/****** Object:  Trigger [dbo].[insertkh1]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[insertkh1] ON [dbo].[KITHIST1] /* with encryption */ FOR INSERT AS IF UPDATE(GSTIN) RETURN declare @usernm varchar(10) declare @ctrlno numeric select @usernm=usernm  from comuser where [host_id]=host_id() select @ctrlno=bno  from inserted if isnull(@usernm,'')<>'' update kithist1 set [usernm]=@usernm where bno=@ctrlno
GO
ALTER TABLE [dbo].[KITHIST1] ENABLE TRIGGER [insertkh1]
GO
/****** Object:  Trigger [dbo].[kitprimeins]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE TRIGGER [dbo].[kitprimeins]
   ON  [dbo].[kitprime]
   AFTER INSERT
AS 
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    declare @icode numeric 
declare @chr char(1)  
declare @cnt numeric  
declare @shcode numeric 
select * into #dummykp from inserted select @shcode=shcode,@icode=icode,@chr=substring(name,1,1) from #dummykp  
if isnull(@shcode,0) = 0   
begin
   select @cnt=max(shcode) from kitprime where substring(name,1,1)=@chr  
set @cnt=@cnt+1 	 
update kitprime set shcode=@cnt where icode=@icode  
End


END
GO
ALTER TABLE [dbo].[kitprime] ENABLE TRIGGER [kitprimeins]
GO
/****** Object:  Trigger [dbo].[mizaminus]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE TRIGGER [dbo].[mizaminus]
   ON  [dbo].[MIZASTOCK]
   AFTER UPDATE
AS 
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
if exists(select *  from inserted where  stock< 0 ) 
begin
print 'Miza Stock going Minus....transaction aborted'
rollback transaction
raiserror('Miza Stock going Minus....transaction aborted',16,1)
return
end
END
GO
ALTER TABLE [dbo].[MIZASTOCK] ENABLE TRIGGER [mizaminus]
GO
/****** Object:  Trigger [dbo].[MizUpdate]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO


CREATE   TRIGGER [dbo].[MizUpdate] ON [dbo].[MizStock] 
/* with encryption */
 FOR UPDATE,insert
 AS 
 declare @ctrlno numeric 
 declare @icode numeric 
 declare @closing float 
 declare @txndt datetime 
 declare @dt1 datetime 
 declare @dt2 datetime 
declare @err varchar(2000)
declare @outlet int
 select @ctrlno=ctrlno,@outlet=outlet,@icode=icode,@txndt=txndt,@closing=closing  from inserted 
 if update(received) or update(consumed) 
 begin 
 --update mizstock set opening=isnull((select b.closing from mizstock b where b.icode=@icode and datediff(d,'1/1/90',b.txndt) = datediff(d,'1/1/90',dateadd(d,-1,txndt))),0)
 --,closing=isnull((select b.closing from mizstock b  where b.icode=@icode and datediff(d,'1/1/90',b.txndt) = datediff(d,'1/1/90', dateadd(d,-1,txndt))),0)+received-consumed where ctrlno=@ctrlno 
set @err =  convert(varchar(20),@txndt) + str(@ctrlno) + str(@icode)
--raiserror(@err,16,-1)
 update mizstock set opening=isnull((select b.closing from mizstock b where b.outlet=@outlet and b.icode=@icode and datediff(d,'1/1/90',b.txndt) = datediff(d,'1/1/90',dateadd(d,-1,mizstock.txndt))),0) 
 where ctrlno=@ctrlno 

 update mizstock set closing=opening+received-consumed where ctrlno=@ctrlno

 select @closing=closing from mizstock where ctrlno=@ctrlno 
 set @dt1 = @txndt 
 set @dt2 = dateadd(d,1,@dt1) 
 while @dt2 < @txndt 
 begin 
 if not exists (select * from mizstock where icode=@icode and datediff(d,'1/1/90',txndt) =
  datediff(d,'1/1/90', @dt2)) 
 insert into mizstock (txndt,icode,opening,closing) 
    Values 
    (@dt2,@icode,@closing,@closing) 
     set @dt2 = dateadd(d,1,@dt2)
 End 
 declare c11 cursor for select ctrlno,txndt  from mizstock where icode=@icode and 
 datediff(d,'1/1/90',txndt) > datediff(d,'1/1/90',@txndt) order by datediff(d,'1/1/90',txndt) 
 open c11 
 fetch next from c11 into @ctrlno,@txndt 
 while @@fetch_status=0 
 begin 
 update mizstock  set opening=@closing,closing=@closing+received-consumed where ctrlno=@ctrlno 
 select @closing=closing from mizstock where ctrlno=@ctrlno 
 fetch next from c11 into @ctrlno,@txndt 
 End 
 Close c11 
 deallocate c11 
 End

GO
ALTER TABLE [dbo].[MizStock] ENABLE TRIGGER [MizUpdate]
GO
/****** Object:  Trigger [dbo].[MBInsert]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  TRIGGER [dbo].[MBInsert] ON [dbo].[NECMiniBar]   
FOR INSERT   
AS  
DECLARE @MESSAGE VARCHAR(30)  
declare @extn varchar(20)  
declare @outlet numeric  
declare @items int   
DECLARE @STTABLENO NUMERIC
select @items=items,@outlet=outlet from necmboutlet  
select @STTABLENO=sttableno from outlet where CODE=@outlet
select * into #inserted22 from inserted  
select @message=message,@extn=extn from #inserted22  
set @message=ltrim(rtrim(@message))  
if len(@Message) <> 2  and len(@message) <> 9  and len(@message) <> 6  
	begin  
	update necminibar set acctd ='A' where ctrlno = (select ctrlno from #inserted22)  
	return  
	end  
else
	begin  
	if len(@message)=2  
		begin  
		if @message='00' update room set status=' ' where cast(extn as int)  =  cast(@extn as int)  
		if @message='01' update room set status='A' where cast(extn  as int)  =  cast(@extn  as int)   
		if @message='02' update room set status='B' where cast(extn as int)  =  cast(@extn as int)  
		if @message='03' update room set status='C' where cast(extn as int)  =  cast(@extn as int)  
		if @message='04' update room set status='D' where cast(extn as int)  =  cast(@extn as int)  
		if @message='05' update room set status='E' where cast(extn as int)  =  cast(@extn as int)  
		if @message='06' update room set status='F' where cast(extn as int)  =  cast(@extn as int)  
		if @message='07' update room set status='G' where cast(extn as int)  =  cast(@extn as int) and gno <> 0  
		if @message='11' update room set ci='0' where cast(extn as int)  =  cast(@extn as int)  
		if @message='12' update room set ci='1' where cast(extn as int)  =  cast(@extn as int)  
		if @message='13' update room set ci='5' where cast(extn as int)  = cast(@extn as int)  
		if @message='14' update room set ci='6' where cast(extn as int)  =  cast(@extn as int)  
		update necminibar set acctd ='Y' where ctrlno = (select ctrlno from #inserted22)  
		return  
		end  
	if substring(@message,1,2)='89'  
		begin  
		update room set wu='Y',time=substring(@message,3,4) where cast(extn as int)  =  cast(@extn as int)  
		update necminibar set acctd ='Y' where ctrlno = (select ctrlno from #inserted22)  
		return  
		end  
	if substring(@message,1,2)='99'  
	begin  
		declare @rno numeric  
		declare @gno numeric  
		declare @tax money  

		if not exists(select * from comuser where [host_id]=host_id() and inet=0)
			insert into  comuser (usernm,version_no,userno,control,computer,[host_id]) values ('SYS',(select top 1 version_no from HmsFolder),0,'Y','SYS',host_id())
		else
			update comuser set control='Y' where [host_id]=host_id()

		
		select @rno=rno,@gno=gno from room where cast(extn as int)  =  cast(@extn as int)  
		if  @gno=0  
			update necminibar set acctd ='N' where ctrlno = (select ctrlno from #inserted22)  
		else  
																																									begin                 
			declare @str1 char(7)  
			set @str1 = substring(@message,3,7)  
			select * into #dummykit from dummykit  
			declare @x int  
			declare @ecode int  
			declare @icode numeric  
			declare @rate money  
			declare @qty int  
			DECLARE @GST money
			declare @cess money
			declare @cess2 money
			declare @strate money  
			set @x=1  
			while @x <= @items  
			begin                                 
				set @qty=cast(substring(@message,@x+2,1) as int)                                  
				if @qty<>0  
				begin  
					select @icode=icode from necmbmaster where ecode=@x  
					select @rate=rate,@strate=tax from kitmast_v where code=@icode  
					if @strate <> 0   
						Set @tax = (@rate*@qty)/@strate  
					else  
						set @tax=0  
                                          
					declare @amt money
					declare @bno numeric  
					declare @txndt datetime  
					set  @txndt = getdate()  
					set @amt=@rate*@qty
					exec GetServiceTaxR @amt,@txndt,@gst out,@cess out,@outlet,@sttableno,@cess2 out
					insert into #dummykit values (@icode,@qty,@rate,@strate,@rate*@qty, @tax ,0,1,2,@rno,'',@GST,@cess,0,@cess2)  
				end  
				set @x=@x+1  
			end  
			exec pbpkb1u #dummykit,@outlet,@txndt,2,0,@gno,'','','',@rno,1,0,1,0,0,0,0,@bno out,'EPX',1,0,0 
			insert into necmbrprint (bno,status) values (@bno,'') 
			update necminibar set acctd ='Y' where ctrlno =(select ctrlno from #inserted22)  
		end  --here end
	end  
else  
	update necminibar set acctd ='B' where ctrlno = (select ctrlno from #inserted22)  
end
GO
ALTER TABLE [dbo].[NECMiniBar] ENABLE TRIGGER [MBInsert]
GO
/****** Object:  Trigger [dbo].[check_date]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[check_date] ON [dbo].[PHONE] /* with encryption */
 FOR INSERT, UPDATE, DELETE AS declare @gno numeric declare @billdt datetime declare @cidate datetime declare @codate datetime declare @mop int select @gno=gno,@billdt=txndt,@mop=pmode  from inserted select @cidate=ci_date,@codate=isnull(co_date,getdate()) from guest where gno=@gno if isnull(@gno,0) = 0 return if isnull(@mop,0) <> 2 return if      datediff(d,'1/1/90',@billdt) < (datediff(d,'1/1/90',@cidate)+1) and  datediff(d,'1/1/90',@billdt) > datediff(d,'1/1/90',@codate) begin rollback transaction raiserror('Error in the Bill Date and check-in checkout date - message from Phone',16,-1) Return End
GO
ALTER TABLE [dbo].[PHONE] ENABLE TRIGGER [check_date]
GO
/****** Object:  Trigger [dbo].[chkposition]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE TRIGGER [dbo].[chkposition]
   ON  [dbo].[PHOUTLET]
   AFTER INSERT,UPDATE
AS 
BEGIN
if exists (select billposition1 from inserted where billposition1 > 10) 
begin
print 'exceeds 10 outlets...not allowed'
rollback 
return
end
if exists (select billposition2 from inserted where billposition2 > 10) 
begin
print 'exceeds 10 outlets...not allowed'
rollback 
return
end

END
GO
ALTER TABLE [dbo].[PHOUTLET] ENABLE TRIGGER [chkposition]
GO
/****** Object:  Trigger [dbo].[PHOUTLETINS]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.PHOUTLETINS    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.PHOUTLETINS    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.PHOUTLETINS    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.PHOUTLETINS    Script Date: 15/02/2004 6:23:01 PM ******/
/****** Object:  Trigger dbo.PHOUTLETINS    Script Date: 4/30/2003 4:59:34 PM ******/
/****** Object:  Trigger dbo.PHOUTLETINS    Script Date: 1/20/03 11:51:49 AM ******/
CREATE TRIGGER [dbo].[PHOUTLETINS] ON [dbo].[PHOUTLET] 
/* with encryption */
FOR INSERT
AS
declare @company int
declare @outlet int
declare @selfdeal char(1)
declare @pos int
select @outlet=outlet,@selfdeal=selfdeal,@COMPANY=COMPANY from inserted
if @company=1 begin
    if not exists(select * from billposition where company=1 and servicetype=2 and outlet=@outlet)
BEGIN
		select @pos=position from billposition where company=1 and position=(select max(position) from billposition where company=1 and outlet<>0)
		set @pos=@pos+1
		update billposition set servicetype=2,outlet=@outlet where company=1 and position=@pos
END
    else
	    select @pos=position from billposition where servicetype=2 and outlet=@outlet and company=1

	update phoutlet  set billposition1=@pos where outlet=@outlet
end
else  /* if not company=1*/
if @selfdeal='N'
begin
    if not exists(select * from billposition where company=1 and servicetype=2 and outlet=@outlet)
		BEGIN
		select @pos=position from billposition where company=1 and position=(select max(position) from billposition where company=1 and outlet<>0)
		set @pos=@pos+1
		update billposition set servicetype=2,outlet=@outlet where company=1 and position=@pos
		END
    else
	    select @pos=position from billposition  where servicetype=2 and outlet=@outlet and company=1
	update phoutlet  set billposition1=@pos where outlet=@outlet
end
else
begin

    if not exists(select * from billposition where company=@COMPANY and servicetype=2 and outlet=@outlet)
BEGIN
		select @pos=position from billposition where company=@COMPANY and	position=(select max(position) from billposition where company=1 and outlet<>0)
		set @pos=@pos+1
		update billposition set servicetype=2,outlet=@outlet where company=@COMPANY and position=@pos
END
    else
	    select @pos=position  from billposition where servicetype=2 and outlet=@outlet and company=@COMPANY
	update phoutlet  set billposition2=@pos where outlet=@outlet
end
GO
ALTER TABLE [dbo].[PHOUTLET] ENABLE TRIGGER [PHOUTLETINS]
GO
/****** Object:  Trigger [dbo].[updateposition]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.updateposition    Script Date: 21/09/2006 12:14:21 PM ******/
CREATE TRIGGER [dbo].[updateposition] ON [dbo].[RESTCO] 
/* with encryption */
FOR INSERT
AS
declare @co numeric
declare @channel numeric
declare @pos int
select @co=company , @channel=channel  from INSERTED
if @co=1
	begin
	select @pos=(select max(position) from billposition where company=1 AND outlet<>0)
	set @pos=isnull(@pos,0) + 1
	if @pos > 10 begin print 'The Bill position goes beyond 10... No more inclusions allowed' rollback RAISERROR('ERROR',16,-1) return end
	update billposition set outlet=@channel,servicetype=1 where company=1 and position=@pos
	update restco set billposition1=@pos where channel=@channel
	end
else
	begin
	select @pos=(select max(position) from billposition where company=@co AND outlet<>0)
	set @pos=isnull(@pos,0) + 1
	if @pos > 10 begin print '2-The Bill position goes beyond 10... No more inclusions allowed' +str(@pos)  rollback RAISERROR('ERROR',16,-1) return end
	update billposition set outlet=@channel,servicetype=1 where company=1 and position=@pos
	update restco set billposition1=@pos where channel=@channel
	select @pos=(select max(position) from billposition where company=@co and outlet<>0)
	set @pos=isnull(@pos,0) + 1
	if @pos > 10 begin print '3-The Bill position goes beyond 10... No more inclusions allowed' + str(@pos)  rollback RAISERROR('ERROR',16,-1) return end
	update billposition set outlet=@channel,servicetype=1 where company=@co  and position=@pos
	update restco set billposition2=@pos where channel=@channel
	end











GO
ALTER TABLE [dbo].[RESTCO] ENABLE TRIGGER [updateposition]
GO
/****** Object:  Trigger [dbo].[CI]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE  TRIGGER [dbo].[CI]  ON [dbo].[ROOM] FOR  UPDATE  
AS   
IF NOT UPDATE(GNO)  RETURN  
declare @ogno numeric 
DECLARE @RNO NUMERIC  
DECLARE @GNO NUMERIC 
select @ogno=gno from deleted 
SELECT @GNO=GNO, @RNO=RNO FROM INSERTED  
IF @GNO=0 
begin	 
	UPDATE  ROOM SET CI='N' ,ol24gno=@ogno,cistatus='N',wutimeset='',wustatus=' ',OL24CI='N',cismssent=0 WHERE RNO=@RNO 
	if @ogno<>0 and @gno=0 insert into ol24room (rno,gno,[status]) values (@rno,@ogno,' ') 
end  
Else 
	UPDATE ROOM SET CI='Y',sl='Y',OL24CI='Y',OL24GNO=0  WHERE RNO=@RNO Return
GO
ALTER TABLE [dbo].[ROOM] ENABLE TRIGGER [CI]
GO
/****** Object:  Trigger [dbo].[statusdate]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.statusdate    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.statusdate    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.statusdate    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.statusdate    Script Date: 15/02/2004 6:23:01 PM ******/
CREATE TRIGGER [dbo].[statusdate] ON [dbo].[ROOM] 
/* with encryption */
FOR UPDATE
AS
declare @oldstatus  char(1)
declare @status char(1)
declare @rno int
if update(statusdate) return

if update(status)
   begin
   select @RNO=RNO,@status=status from inserted
   select @oldstatus=status from deleted
   if @status<>' '
      if @oldstatus=' '
          update room set statusdate=getdate(),sendstatus='Y'  WHERE RNO=@RNO
  if @status=' '
      if @oldstatus<>' '
          update room set statusdate=null,SENDSTATUS=' ' where rno=@rno 
   end
 if @status='A' update room set hksms=' ' where rno=@rno
GO
ALTER TABLE [dbo].[ROOM] ENABLE TRIGGER [statusdate]
GO
/****** Object:  Trigger [dbo].[sptbrsUDI]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[sptbrsUDI]   ON  [dbo].[sptbrs]  
 AFTER INSERT,DELETE,UPDATE AS BEGIN		
 SET NOCOUNT ON; 
 declare @host_name varchar(100) 
 select @host_name=computer from comuser where [host_id]=host_id() 
 declare @net char(1) 
 declare @err varchar(200) 
 select @net=net from inserted 
 if @net='N' 
 if not exists(select * from hmsfolder where version_no = (select top 1 version_no from comuser where computer=@host_name AND HOST_ID()=[HOST_ID]) )  	begin  	set @err=@host_name + 'You are using a wrong version of the Softwre Installed...Please update the version (T2) and try' 	raiserror(@err,16,-1) return 	end END
GO
ALTER TABLE [dbo].[sptbrs] ENABLE TRIGGER [sptbrsUDI]
GO
/****** Object:  Trigger [dbo].[updatereservation]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.updatereservation    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.updatereservation    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.updatereservation    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.updatereservation    Script Date: 15/02/2004 6:23:01 PM ******/
CREATE TRIGGER [dbo].[updatereservation] ON [dbo].[sptbrs] 
/* with encryption */
FOR UPDATE
AS
declare @str1 varchar(1000)
if not update(advanceadjd)   return
declare @advr money
declare @adva money
declare @advrf money
select @advr=advancerecd,@adva=advanceadjd ,@advrf=refundamount from inserted
set @str1 = 'Not enough amount for advance adjustment' + char(13) + 'Adjusted Already ' +  convert(varchar(20),@adva)  + ' Refunded (including this) ' + convert(varchar(20),@advrf) + char(13) + 'Updation aborted'
--if @advr < @adva BEGIN  ROLLBACK raiserror ( @str1+ 'ERROR IN ADVANCE ADJUSTMENT',16,-1 ) END
if @advr < (@adva+@advrf) BEGIN  ROLLBACK raiserror ( @str1,16,-1 ) END
return
GO
ALTER TABLE [dbo].[sptbrs] ENABLE TRIGGER [updatereservation]
GO
/****** Object:  Trigger [dbo].[sptbrs1_del]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.sptbrs1_del    Script Date: 21/09/2006 12:14:21 PM ******/
CREATE TRIGGER [dbo].[sptbrs1_del] ON [dbo].[sptbrs1] 
/* with encryption */
FOR  delete
AS
declare @myc numeric
select @myc=myctrlno from deleted
delete from sptbrooms where myctrlno=@myc
GO
ALTER TABLE [dbo].[sptbrs1] ENABLE TRIGGER [sptbrs1_del]
GO
/****** Object:  Trigger [dbo].[sptbrs1_update_wingno]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

/****** Object:  Trigger dbo.sptbrs1_update_wingno    Script Date: 21/09/2006 12:14:21 PM ******/
CREATE TRIGGER [dbo].[sptbrs1_update_wingno] ON [dbo].[sptbrs1] 
/* with encryption */
FOR INSERT, UPDATE
AS
if update(roomtype) 
update sptbrs1  set wingno=(select wingno from wings where description=(select roomtype from inserted)) 
  where myctrlno=(select myctrlno from inserted)

GO
ALTER TABLE [dbo].[sptbrs1] ENABLE TRIGGER [sptbrs1_update_wingno]
GO
/****** Object:  Trigger [dbo].[sptbrs1invalidrooms]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[sptbrs1invalidrooms]  ON [dbo].[sptbrs1] 
/* with encryption */
FOR UPDATE
AS
declare @tr int
declare @cr int
declare @ar int
select @tr=noofrooms,@cr=cancelledrooms,@ar=arrivedrooms from inserted
if @ar+@cr > @tr 
begin
print 'Incorrect number of rooms'
rollback 
end
return
GO
ALTER TABLE [dbo].[sptbrs1] ENABLE TRIGGER [sptbrs1invalidrooms]
GO
/****** Object:  Trigger [dbo].[StockPosting]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[StockPosting]  
   ON  [dbo].[storebills] 
/* with encryption */

   AFTER DELETE,UPDATE 
AS  
BEGIN 
  SET NOCOUNT ON; 
    declare @txndt datetime 
    declare @freezedate datetime 
   declare @storeno numeric 
   select @txndt=txndt,@storeno=storeno from deleted 
  select @freezedate=freeze from store where storeno=@storeno 
    if datediff(d,@freezedate,@txndt) <= 0  
    begin 
      rollback transaction 
       raiserror('The Transaction Period is freezed',16,-1) 
       return 
 end 
END 
GO
ALTER TABLE [dbo].[storebills] ENABLE TRIGGER [StockPosting]
GO
/****** Object:  Trigger [dbo].[forltxndtdelete]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE TRIGGER [dbo].[forltxndtdelete]
   ON  [dbo].[storehist]
   AFTER delete
AS 
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	declare @txndt datetime
	declare @ltxndt datetime
	declare @ctrlno numeric
	select @txndt=txndt,@ctrlno=ctrlno from deleted 
	select @ltxndt=ltxndt from storeitems where ctrlno=@ctrlno
if datediff(d,@ltxndt,@txndt) < 0
update storeitems set ltxndt=@txndt where ctrlno=@ctrlno
END
GO
ALTER TABLE [dbo].[storehist] ENABLE TRIGGER [forltxndtdelete]
GO
/****** Object:  Trigger [dbo].[forltxndtupdate]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE TRIGGER [dbo].[forltxndtupdate]
   ON  [dbo].[storehist]
   AFTER UPDATE
AS 
BEGIN
if exists(select * from inserted where forupdt='Y') return
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	declare @txndt datetime
	declare @ltxndt datetime
	declare @ntxndt datetime
	declare @ctrlno numeric
	select @txndt=txndt,@ctrlno=ctrlno from deleted 
	select @ntxndt=txndt from inserted 
	select @ltxndt=ltxndt from storeitems where ctrlno=@ctrlno
	if datediff(d,@ltxndt,@txndt) < 0
	update storeitems set ltxndt=@txndt where ctrlno=@ctrlno
	if datediff(d,@ltxndt,@ntxndt) < 0
	update storeitems set ltxndt=@txndt where ctrlno=@ctrlno

    -- Insert statements for trigger here

END
GO
ALTER TABLE [dbo].[storehist] ENABLE TRIGGER [forltxndtupdate]
GO
/****** Object:  Trigger [dbo].[shminusbalance]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE TRIGGER [dbo].[shminusbalance]
   ON  [dbo].[storehist]
   AFTER update
AS 
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
declare @cnt numeric    --dummy program
    -- Insert statements for trigger here

END
GO
ALTER TABLE [dbo].[storehist] ENABLE TRIGGER [shminusbalance]
GO
/****** Object:  Trigger [dbo].[spstdelete]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.spstdelete    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.spstdelete    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.spstdelete    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.spstdelete    Script Date: 15/02/2004 6:23:01 PM ******/
CREATE TRIGGER [dbo].[spstdelete] ON [dbo].[storehist] 
/* with encryption */
FOR  DELETE 
AS
declare @ctrlno int
declare @qty float
declare @storeno int
declare @oltype int
declare @outlet int
declare @rate money
declare @amttyp char(1)
declare @olctrlno int
declare @bctrlno int
declare @ltxndt datetime
declare @txndt datetime
declare @forupdt char(1)
select @forupdt=forupdt from deleted  
--print @forupdt
--rollback transaction  raiserror('p.e.r.i.y.a',16,-1) return 
if exists(select * from deleted where forupdt='Y') return
--select  @ctrlno=ctrlno,@qty=qty,@amttyp=amttyp,@rate=rate,@oltype=oltype,@outlet=outlet from deleted
if not exists(select * from deleted) return
select  @bctrlno=bctrlno,@ctrlno=ctrlno,@qty=qty,@amttyp=amttyp,@rate=rate,@forupdt=forupdt from deleted

--select @oltype=grno,@outlet=supplier,@txndt=@txndt from storebills where bctrlno=@bctrlno
select @txndt=txndt,@oltype=issuedtotype,@outlet=issuedtocode from storebills where bctrlno=@bctrlno

declare @fy numeric
declare @company int
declare @sql varchar(2000)

select @storeno=storeno from storeitems where ctrlno=@ctrlno
select @company=company from store where storeno=@storeno
 
exec  getfy @txndt,@company,@fy out

if @amttyp='C'
	begin
		update storeitems set stock=stock-@qty,forupdt=@forupdt where ctrlno=@ctrlno
		if @@error<>0 rollback transaction
		update storeprimary set balance=balance - @qty where @fy=fy and ictrlno=@ctrlno
		if @@error<>0 rollback transaction
	end
else
begin
	update storeitems set stock=stock+@qty where ctrlno=@ctrlno
	if @@error<>0 rollback transaction
	update storeprimary set balance=balance + @qty where @fy=fy and ictrlno=@ctrlno
	if @@error<>0 rollback transaction
	if @oltype=1
	--print str(@ctrlno) rollback transaction  raiserror('p.e.r.i.y.a',16,-1) return 
	if exists (select * from kitmast2 where scode=@ctrlno)
	begin
	--print 'periya' rollback transaction  raiserror('p e r i y a',16,-1) return 
		if not exists (select * from mizastock where icode=@ctrlno and otype=@oltype and outlet=@outlet) insert into mizastock (otype,outlet,icode,stock,ltxndt) values (@oltype,@outlet,@ctrlno,0,getdate())
		update mizastock set stock=stock-@qty,ltxndt=@txndt where otype=@oltype and outlet=@outlet and icode=@ctrlno
		declare @msicode numeric
    	select @msicode=ctrlno from mizastock  where icode=@ctrlno and outlet=@outlet and otype=@oltype
		if not exists(select * from mizstock where outlet=@outlet and icode=@msicode and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) )
		insert into mizstock (icode,txndt,outlet) values (@msicode,@txndt,@outlet)
		update mizstock set received=isnull(received,0)-@qty where outlet=@outlet and  icode=@msicode and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) 
		if @@error<>0 rollback transaction
	end
end

select @ltxndt=txndt from storebills where bctrlno=@bctrlno
GO
ALTER TABLE [dbo].[storehist] ENABLE TRIGGER [spstdelete]
GO
/****** Object:  Trigger [dbo].[spstupdate]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.spstupdate    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.spstupdate    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.spstupdate    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.spstupdate    Script Date: 15/02/2004 6:23:01 PM ******/
CREATE TRIGGER [dbo].[spstupdate] ON [dbo].[storehist] 
/* with encryption */
FOR UPDATE 
AS
IF UPDATE(TXNDT) RETURN
if update(balance) return
if update(forupdt) return
if update(qty1) return
declare @ctrlno int
declare @qty float
declare @storeno int
declare @oltype int
declare @outlet int
declare @rate money
declare @amttyp char(1)
declare @olctrlno int
declare @bctrlno numeric
declare @txndt datetime
declare @ltxndt datetime
declare @forupdt char(1)
declare @balance float
if exists(select * from inserted where forupdt='Y') return
select  @bctrlno=bctrlno,@ctrlno=ctrlno,@qty=qty,@amttyp=amttyp,@rate=rate,@forupdt=forupdt from deleted
select @txndt=txndt,@oltype=issuedtotype,@outlet=issuedtocode from storebills where bctrlno=@bctrlno

declare @fy numeric
declare @company int
select @storeno=storeno from storeitems where ctrlno=@ctrlno
select @company=company from store where storeno=@storeno
exec  getfy @txndt,@company,@fy out

if @amttyp<>'C'
	begin
	update storeprimary set balance=balance + @qty where @fy=fy and ictrlno=@ctrlno
	if @@error<>0 rollback transaction
	if @oltype=1
	if exists (select * from kitmast2 where scode=@ctrlno)
	begin
		if not exists (select * from mizastock where icode=@ctrlno and otype=@oltype and outlet=@outlet) insert into mizastock (otype,outlet,icode,stock,ltxndt) values (@oltype,@outlet,@ctrlno,0,getdate())
		update mizastock set stock=stock-@qty,ltxndt=@txndt where otype=@oltype and outlet=@outlet and icode=@ctrlno
		declare @msicode numeric
    	select @msicode=ctrlno from mizastock  where icode=@ctrlno and outlet=@outlet and otype=@oltype
		if not exists(select * from mizstock where  outlet=@outlet and icode=@msicode and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) )
		insert into mizstock (icode,txndt,outlet) values (@msicode,@txndt,@outlet)
		update mizstock set received=received-@qty where outlet=@outlet and icode=@msicode and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) 
		if @@error<>0 rollback transaction
	end
	 end
else
	begin
		update storeprimary set balance=balance - @qty where @fy=fy and ictrlno=@ctrlno
	             if @@error<>0 rollback transaction
	end


select  @bctrlno=bctrlno,@ctrlno=ctrlno,@qty=qty,@amttyp=amttyp,@rate=rate from inserted
select @txndt=txndt,@oltype=issuedtotype,@outlet=issuedtocode from storebills where bctrlno=@bctrlno


select @storeno=storeno from storeitems where ctrlno=@ctrlno
select @company=company from store where storeno=@storeno
exec  getfy @txndt,@company,@fy out

/* For updating storeprimary table with new records for new financial year */
if not exists (select * from storeprimary where fy=@fy and ictrlno=@ctrlno)
insert into storeprimary (fy,ictrlno) values (@fy,@ctrlno)

if @amttyp='C'
	begin
		 update storeitems set stock=stock+@qty,lpdate=getdate(),rate=case when ratedate <= @txndt then @rate else rate end,ratedate=case when ratedate < @txndt then @txndt else ratedate end where ctrlno=@ctrlno
	             if @@error<>0 rollback transaction
		update storeprimary set balance=balance + @qty where @fy=fy and ictrlno=@ctrlno
	             if @@error<>0 rollback transaction
	end
else
begin
	update storeitems set stock=stock-@qty where ctrlno=@ctrlno
	if @@error<>0 rollback transaction
	update storeprimary set balance=balance - @qty where @fy=fy and ictrlno=@ctrlno
	if @@error<>0 rollback transaction
	if @oltype=1 
	if exists (select * from kitmast2 where scode=@ctrlno)
	begin
		if not exists (select * from mizastock where icode=@ctrlno and otype=@oltype and outlet=@outlet) insert into mizastock (otype,outlet,icode,stock,ltxndt) values (@oltype,@outlet,@ctrlno,0,getdate())
		update mizastock set stock=stock+@qty ,ltxndt=@txndt where otype=@oltype and outlet=@outlet and icode=@ctrlno
		if not exists(select * from mizstock where  outlet=@outlet and icode=@ctrlno and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) )
		insert into mizstock (icode,txndt,outlet) values (@ctrlno,@txndt,@outlet)
		update mizstock set received=received+@qty where outlet=@outlet and  icode=@ctrlno and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) 
		if @@error<>0 rollback transaction
	end
end
select @ltxndt=txndt from storebills where bctrlno=@bctrlno
GO
ALTER TABLE [dbo].[storehist] ENABLE TRIGGER [spstupdate]
GO
/****** Object:  Trigger [dbo].[StorehistQTY1]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE TRIGGER [dbo].[StorehistQTY1]
   ON  [dbo].[storehist]
   AFTER INSERT,UPDATE
AS 
BEGIN
if update(qty1) return
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;
	
	update storehist set qty1=case when amttyp='C' then qty else -qty end where hctrlno2 in (select hctrlno2 from inserted)    
END
GO
ALTER TABLE [dbo].[storehist] ENABLE TRIGGER [StorehistQTY1]
GO
/****** Object:  Trigger [dbo].[stpurinsert]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.stpurinsert    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.stpurinsert    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.stpurinsert    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.stpurinsert    Script Date: 15/02/2004 6:23:01 PM ******/
CREATE TRIGGER [dbo].[stpurinsert] ON [dbo].[storehist] 
/* with encryption */
FOR INSERT 
AS
declare @ctrlno numeric
declare @qty float
declare @storeno int
declare @oltype int
declare @outlet int
declare @rate money
declare @amttyp char(1)
declare @olctrlno int
declare @bctrlno numeric
declare @txndt datetime
declare @ltxndt datetime
declare @forupdt char(1)
declare @hctrlno  numeric
declare @stk float
select  @hctrlno=hctrlno,@bctrlno=bctrlno,@ctrlno=ctrlno,@qty=qty,@amttyp=amttyp,@rate=rate,@forupdt=forupdt from inserted
select @txndt=txndt,@oltype=issuedtotype,@outlet=issuedtocode from storebills where bctrlno=@bctrlno
declare @fy numeric
declare @company int
select @stk=stock,@storeno=storeno from storeitems where ctrlno=@ctrlno
select @company=company from store where storeno=@storeno
exec  getfy @txndt,@company,@fy out
/* For updating storeprimary table with new records for new financial year */
if not exists (select * from storeprimary where fy=@fy and ictrlno=@ctrlno)
insert into storeprimary (fy,ictrlno) values (@fy,@ctrlno)

if @amttyp='C'
	begin
		select @stk=stock from storeitems where ctrlno=@ctrlno
		update storeitems set stock=stock+@qty,forupdt=@forupdt,lpdate=getdate(),rate=case when datediff(d,'1/1/90',ratedate) <= datediff(d,'1/1/90',@txndt) then @rate else rate end,ratedate=case when datediff(d,'1/1/90',ratedate) <= datediff(d,'1/1/90',@txndt) then @txndt else ratedate end,ltxndt=case when datediff(d,'1/1/90',ltxndt) > datediff(d,'1/1/90',@txndt) then @txndt else ltxndt end  where ctrlno=@ctrlno 
		if @@error<>0 rollback transaction
		update storeprimary set balance=balance+@qty where fy=@fy and ictrlno=@ctrlno
		if @@error<>0 rollback transaction
	end
else
	begin
		update storeitems set stock=stock-@qty,ltxndt=case when ltxndt > @txndt then @txndt else ltxndt end where ctrlno=@ctrlno
		if @@error<>0 rollback transaction
		update storeprimary set balance=balance-@qty where fy=@fy and ictrlno=@ctrlno
		if @@error<>0 rollback transaction
		if @oltype=1
		if exists (select * from kitmast2 where scode=@ctrlno)
		begin
			if not exists (select * from mizastock where icode=@ctrlno and otype=@oltype and outlet=@outlet) insert into mizastock (otype,outlet,icode,stock,ltxndt) values (@oltype,@outlet,@ctrlno,0,getdate())
			update mizastock set stock=stock+@qty,ltxndt=@txndt where otype=@oltype and outlet=@outlet and icode=@ctrlno
			declare @msicode numeric
    		select @msicode=ctrlno from mizastock  where icode=@ctrlno and outlet=@outlet and otype=@oltype
			if not exists(select * from mizstock where icode=@msicode and outlet=@outlet and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) )
			insert into mizstock (icode,txndt,outlet) values (@msicode,@txndt,@outlet)
			update mizstock set received=isnull(received,0)+@qty where outlet=@outlet and icode=@msicode and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) 
			if @@error<>0 rollback transaction
		end
	end
GO
ALTER TABLE [dbo].[storehist] ENABLE TRIGGER [stpurinsert]
GO
/****** Object:  Trigger [dbo].[tg_updatehctrlno2]    Script Date: 07/04/2026 20:30:04 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[tg_updatehctrlno2] ON [dbo].[storehist] 
/* with encryption */
FOR INSERT
AS
declare @hctrlno numeric
select @hctrlno=hctrlno from inserted
update storehist set forupdt='N',hctrlno2=case when isnull(hctrlno2,0)=0 then hctrlno else hctrlno2 end  where hctrlno=@hctrlno
GO
ALTER TABLE [dbo].[storehist] ENABLE TRIGGER [tg_updatehctrlno2]
GO
/****** Object:  Trigger [dbo].[CHKStoreMaster]    Script Date: 07/04/2026 20:30:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE TRIGGER [dbo].[CHKStoreMaster] 
   ON  [dbo].[storeitems]
   AFTER UPDATE
AS 
BEGIN
	if not update(luperhu) return
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

	declare @ctrlno numeric
	declare @ovalue numeric
	declare @nvalue numeric
	select @ctrlno=ctrlno,@nvalue=luperhu from inserted
	select @ovalue=luperhu from deleted	
	if @ovalue<>@nvalue
	if exists(select * from storehist where ctrlno=@ctrlno)
		begin
		print 'You can not alter the ''Lower Unit Per Higher Unit Value'' after entering issues and purchases for a Store Item'
		rollback transaction
		raiserror('Error in updating Store Master',16,-1) 
		return
		end
END
GO
ALTER TABLE [dbo].[storeitems] ENABLE TRIGGER [CHKStoreMaster]
GO
/****** Object:  Trigger [dbo].[storeminusbalance]    Script Date: 07/04/2026 20:30:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[storeminusbalance]    ON  [dbo].[storeitems]    AFTER UPDATE AS BEGIN return if not update(stock) return 		SET NOCOUNT ON; declare @stock decimal(18,4) declare @ctrlno numeric declare @iname varchar(200) declare @msg varchar(200) select @stock=stock,@ctrlno=ctrlno from inserted select @iname=iname from storeitems where ctrlno=@ctrlno if @stock < 0 	begin 	set @msg =  'Negative balance in ' + @iname 	rollback transaction  	raiserror (@msg,16,-1) 	return 	end END 
GO
ALTER TABLE [dbo].[storeitems] ENABLE TRIGGER [storeminusbalance]
GO
/****** Object:  Trigger [dbo].[updstbal]    Script Date: 07/04/2026 20:30:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[updstbal]  ON [dbo].[StorePrimary] /* with encryption */
FOR UPDATE 
AS 
if update(opgbal)  return
if update(balance) return
if not update(balance) return declare @fy numeric declare @ictrlno numeric
declare @balance decimal declare @balance1 decimal declare @diff  decimal  declare @ctrlno numeric 
declare @name varchar(200) 

select @fy=fy,@ictrlno=ictrlno,@balance=balance from inserted 
select @balance1=balance from deleted 
select @name=iname from storeitems where ctrlno=@ictrlno 
if @balance < 0 begin print 'Negative Balance-' + rtrim(@name) + ' Deleted ' +  convert(varchar(20),@balance1) + ' updated ' + convert(varchar(20),@balance)
if exists(select * from setting where g_storeminus = 0) begin rollback transaction  return  end end  set @diff = @balance1-@balance  if exists( select ctrlno from storeprimary where ictrlno=@ictrlno and fy=(select min(fy) from storeprimary where ictrlno=@ictrlno and fy > @fy)) begin select @ctrlno=ctrlno from storeprimary where ictrlno=@ictrlno and fy=(select min(fy) from storeprimary where ictrlno=@ictrlno and fy > @fy) update storeprimary set opgbal=@balance,balance=balance-@diff where ctrlno=@ctrlno end 

GO
ALTER TABLE [dbo].[StorePrimary] ENABLE TRIGGER [updstbal]
GO
/****** Object:  Trigger [dbo].[suppcheck]    Script Date: 07/04/2026 20:30:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER OFF
GO











/****** Object:  Trigger dbo.suppcheck    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.suppcheck    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.suppcheck    Script Date: 10/08/2004 8:28:15 PM ******/
CREATE TRIGGER [dbo].[suppcheck] ON [dbo].[suppliers] 
/* with encryption */
FOR DELETE 
AS
if exists (select * from storebills where amttyp='C' and supplier=(select sid from deleted)) 
begin
print 'Supplier can not be deleted...since there are some purchases from this supplier'
rollback
raiserror('',16,-1)
end











GO
ALTER TABLE [dbo].[suppliers] ENABLE TRIGGER [suppcheck]
GO
/****** Object:  Trigger [dbo].[trg_ins_toutlet]    Script Date: 07/04/2026 20:30:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.trg_ins_toutlet    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.trg_ins_toutlet    Script Date: 4/14/2005 10:21:48 PM ******/
/****** Object:  Trigger dbo.trg_ins_toutlet    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.trg_ins_toutlet    Script Date: 15/02/2004 6:23:01 PM ******/
CREATE TRIGGER [dbo].[trg_ins_toutlet] ON [dbo].[toutlet] 
/* with encryption */
FOR INSERT
AS
declare @company int
declare @outlet int
declare @selfdeal char(1)
declare @pos int
--print 'periya'
--if update(billposition1) return
--if update(billposition2) return
select @outlet=outlet,@selfdeal=selfdeal,@COMPANY=COMPANY from inserted
SET @POS = 0
select @outlet=outlet,@selfdeal=selfdeal,@COMPANY=COMPANY from inserted
if @company=1 begin
	select @pos=position from billposition where company=1 and position=(select max(position) from billposition where company=1 and outlet<>0)
	set @pos=@pos+1
	if @pos > 10 begin rollback transaction print 'You have reached the Maximum Number of Outlets for this company' raiserror('Error',16,-1) return end
	update billposition set servicetype=3,outlet=@outlet where company=1 and position=@pos
	update toutlet  set billposition1=@pos where outlet=@outlet
end
else  /* if not company=1*/
if @selfdeal='N'
begin
	select @pos=position from billposition where company=1 and position=(select max(position) from billposition where company=1 and outlet<>0)
	set @pos=@pos+1
	if @pos > 10 begin rollback transaction print 'You have reached the Maximum Number of Outlets for this company' raiserror('Error',16,-1) return end
	update billposition set servicetype=3,outlet=@outlet where company=1 and position=@pos
	update toutlet  set billposition1=@pos where outlet=@outlet
end
else
begin
	select @pos=position from billposition where company=@company and position=(select max(position) from billposition where company=@company and outlet<>0)
	set @pos=@pos+1
	if @pos > 10 begin rollback transaction print 'You have reached the Maximum Number of Outlets for this company' raiserror('Error',16,-1) return end
	update billposition set servicetype=3,outlet=@outlet where company=@company and position=@pos
	update toutlet  set billposition2=@pos where outlet=@outlet
end
GO
ALTER TABLE [dbo].[toutlet] ENABLE TRIGGER [trg_ins_toutlet]
GO
/****** Object:  Trigger [dbo].[CashPermission]    Script Date: 07/04/2026 20:30:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger [dbo].[CashPermission]    Script Date: 12/04/2017 14:37:56 ******/ 
CREATE trigger [dbo].[CashPermission] on [dbo].[VOUCHERS] /* with encryption */ 

FOR INSERT, UPDATE, DELETE  AS  
declare @err varchar(500) 
declare @userno numeric 
 declare @error varchar(1000)  
 declare @control char(1)  
 select @userno=userno,@control=control  from comuser where [host_id]=host_id() 
  if @control<>'Y'  
  if exists(select * from setting where g_cashentries=0)  
  if exists(select * from servicepermission where userno=@userno and permission='N' and serviceno=813)  	
  begin      	
  rollback      	
  set @error =  'You are not permitted to make any CASH Transactions'      	
  raiserror(@error,16,1)      	
  Return  	
  End  
  
  if not update(amt)  return 
  if @control<>'Y'if exists(select * from  comuser where [host_id]=host_id())	
  if not exists(select * from hmsfolder where version_no = (select TOP 1 version_no from comuser where [host_id]=host_id())) 	 	
  begin 	 	
  set @err='Voucher Posting- CashPermission -> You are using a wrong version of the Softwre Installed...Please update the version (T3) and try'	 	
  raiserror(@err,16,-1) 	 	
  return 		
  end
GO
ALTER TABLE [dbo].[VOUCHERS] ENABLE TRIGGER [CashPermission]
GO
/****** Object:  Trigger [dbo].[roomServiceBlobk]    Script Date: 07/04/2026 20:30:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE TRIGGER [dbo].[roomServiceBlobk] 
   ON  [dbo].[VOUCHERS]
   AFTER INSERT,UPDATE
AS 
BEGIN
	SET NOCOUNT ON;
	declare  @company int
	declare @actnum numeric
	declare @amttyp char(1)
	declare @partic varchar(300)
	select @company=company,@actnum=actnum,@amttyp=amttyp,@partic=partic from inserted
	if @actnum=24 and @amttyp='D'
		begin
			if @partic like '%adv.r.no%' 
				begin
					rollback transaction
					raiserror('Error in [Room Service Receivable a/c posting].Entry not allowed',16,-1)
					return
				end
		end
END
GO
ALTER TABLE [dbo].[VOUCHERS] ENABLE TRIGGER [roomServiceBlobk]
GO
/****** Object:  Trigger [dbo].[updatevouhist]    Script Date: 07/04/2026 20:30:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE TRIGGER [dbo].[updatevouhist]
   ON  [dbo].[VOUCHERS]
   AFTER DELETE
AS 
BEGIN
declare @txnno numeric(18,0)
select @txnno=txnno from inserted
declare @flds varchar(5000)
declare @sql varchar(8000)
--set @flds = 'COMPANY,FY,ACTNUM,TXNNO,TXNDT,AMTTYP,PARTIC,AMT,[USER],BALANCE,RECON,GRNO,FDRSNO,CHANNELCODE,REFNO,tmstmp,ltxndt,markedfordeletion,payee,mvchno,TXNNO2,txntype,recondate,EXApproved,EXDate,EXby,sessionid,outlet,seller,billno,billdate,chlno,taxtype,TOTAMT,PERCENTAGE,ACTNO'
--the autoselection of feilds created on 8 April 2020
select @flds=columns from (Select table_SCHEMA, table_name     , Stuff(        (        Select ', [' +  C.COLUMN_NAME + ']'       From INFORMATION_SCHEMA.COLUMNS As C        Where C.TABLE_SCHEMA = T.TABLE_SCHEMA            And C.TABLE_NAME = T.TABLE_NAME        Order By C.ORDINAL_POSITION        For Xml Path('')        ), 1, 2, '') As Columns From INFORMATION_SCHEMA.TABLES as T  where table_name='vouchers' ) a
select * into #dum from deleted
set @sql = 'insert into vouhist (' + @flds + ') select top 1 ' + @flds + ' from #dum'
--insert into vouhist (COMPANY,FY,ACTNUM,TXNNO,TXNDT,AMTTYP,PARTIC,AMT,[USER],BALANCE,RECON,GRNO,FDRSNO,CHANNELCODE,REFNO,tmstmp,ltxndt,markedfordeletion,payee,mvchno,TXNNO2,txntype,recondate,EXApproved,EXDate,EXby,sessionid,outlet,seller,billno,billdate,chlno,taxtype,TOTAMT,PERCENTAGE,ACTNO) select top 1 COMPANY,FY,ACTNUM,TXNNO,TXNDT,AMTTYP,PARTIC,AMT,[USER],BALANCE,RECON,GRNO,FDRSNO,CHANNELCODE,REFNO,tmstmp,ltxndt,markedfordeletion,payee,mvchno,TXNNO2,txntype,recondate,EXApproved,EXDate,EXby,sessionid,outlet,seller,billno,billdate,chlno,taxtype,TOTAMT,PERCENTAGE,ACTNO from deleted
exec(@sql)
END
GO
ALTER TABLE [dbo].[VOUCHERS] ENABLE TRIGGER [updatevouhist]
GO
/****** Object:  Trigger [dbo].[updltxndt]    Script Date: 07/04/2026 20:30:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.updltxndt    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.updltxndt    Script Date: 4/14/2005 10:21:49 PM ******/
/****** Object:  Trigger dbo.updltxndt    Script Date: 10/08/2004 8:28:15 PM ******/
CREATE  TRIGGER [dbo].[updltxndt] ON [dbo].[VOUCHERS] 
/* with encryption */
FOR INSERT, UPDATE,delete 
AS
IF UPDATE(PAYEE) RETURN
IF UPDATE(BALANCE) RETURN
if update(recon) return
if update(recondate) return
IF UPDATE(FDRSNO) RETURN
IF UPDATE(TOTAMT_BALANCE) RETURN
declare @txndt datetime
declare @actnum numeric
declare @company int
declare @fy int
declare @userno numeric
declare @vpdays numeric
declare @vpdays2 numeric
declare @control char(1)
declare @error varchar(2000)
declare @sessionid varchar(200)
declare @host_name varchar(200)
declare @totamt_balance money
declare @amt money
declare @amttyp char(1)
declare @txnno numeric
declare @seller varchar(100)
declare @billdate_closedate datetime
declare @taxtype int
select @host_name=computer from comuser where [host_id]=host_id() 
select @txnno=txnno,@amttyp=amttyp, @sessionid=sessionid,@txndt=txndt,@actnum=actnum,@company=company,@fy=fy,@amt=amt,@totamt_balance=TOTAMT_BALANCE,@seller=seller,@billdate_closedate=billdate_closedate,@taxtype=taxtype  from inserted


if exists (select * from inserted where (actnum >=104 and actnum <110 ) and (amttyp='D') and (seller is null  or billno is null or billdate_closedate is null or taxtype is null))
	begin
	print 'Input Tax Details not given - updltxndt'
	rollback 
	return
	end
	

if exists (select * from inserted where actnum =104 and (amttyp='C') and (seller is null  or billno is null or billdate_closedate is null or taxtype is null))
	begin
	print 'TDS Details not given - updltxndt'  + @seller  + ' ' + convert(varchar(20),@billdate_closedate)
	rollback 
	return
	end


select @host_name=computer from comuser where [host_id]=host_id() 
select @txnno=txnno,@amttyp=amttyp, @sessionid=sessionid,@txndt=txndt,@actnum=actnum,@company=company,@fy=fy,@amt=amt,@totamt_balance=TOTAMT_BALANCE  from inserted
declare @asset char(1)

--select @asset=asset from glprimld where fy=@fy and cgp_actno=@actnum
--if (@asset='D' and @amttyp='D')  or (@asset='C' and @amttyp='C')
--if  not @totamt_balance=@amt
--begin
--print 'SUB-GL Account Reverese exceeds the Original Amount  1 '  + str(@totamt_balance) + ' ' + str(@amt)  + str(@totamt_balance-@amt)
--rollback 
--return
--end 



if exists(select * from glprimld where fy=@fy and cgp_actno=@actnum and asset='D')
if  @totamt_balance < 0   OR @TOTAMT_BALANCE > @AMT 
begin
print 'SUB-GL Account Reverese exceeds the Original Amount  1 '  + str(@totamt_balance) + ' ' + str(@amt)  + str(@totamt_balance-@amt)
rollback 
return
end 

if exists(select * from glprimld where fy=@fy and cgp_actno=@actnum and asset='C')
if (@totamt_balance > @amt  or @totamt_balance  < 0 )  
begin
print 'SUB-GL Account Reverse exceeds the Original Amount  2  '  + convert(varchar(20),@totamt_balance) + '  ' + convert(varchar(20),@amt)
rollback 
return
end 


set @sessionid=isnull(@sessionid,'')
select @userno=userno,@control=control from comuser where [host_id]=host_id() and sessionid=@sessionid
set @control = isnull(@control,'Y')
if isnull(@control,'Y')<>'Y' 
begin
	if isnull(@userno,0)=0 begin rollback set @error = '33Invalid User Info (User Number)' + str(isnull(@userno,0)) +  @host_name + @sessionid +  '  Found..Please Login Again Control ' + @control + ' sessionid=' + @sessionid raiserror(@error,16,-1) return end
	select @vpdays=vpdays,@vpdays2=vpdays from basic where userno=@userno
	if @vpdays=null begin rollback set @error = 'Invalid User Info (Days) Found' raiserror(@error,16,-1) return end
	---if @vpdays<>0 
	begin
		if exists (select * from inserted)
			begin
			select @txndt=txndt  from inserted
			end
		if  datediff(d,@txndt,getdate())  > @vpdays  begin rollback set @error= 'You dont have permission to delete/modfy transactions beyond ' + ltrim(str(@vpdays)) +  ' day(s) (1)' + convert(varchar(20),@txndt)  raiserror(@error,16,-1) return end
		if exists (select * from deleted)
			begin
			select @txndt=txndt from deleted
			end
		if datediff(d,@txndt,getdate()) > @vpdays  begin rollback set @error =  'You dont have permission to delete/modfy transactions beyond ' + ltrim(str(@vpdays)) + ' days (2)' + convert(varchar(20),@txndt)  raiserror(@error,16,1)   return end
	end
end
if update(balance) return
if update(txnno2) return
if update(fdrsno) return
if update([user]) return
if update(payee) return
if exists (select * from inserted)
begin
select @txndt=txndt,@actnum=actnum,@company=company,@fy=fy from inserted
update glprimld set ltxndt= case when datediff(d,'1/1/90',ltxndt) >= datediff(d,'1/1/90',@txndt) then @txndt else ltxndt end where cgp_actno=@actnum and company=@company and fy=@fy
end
if exists (select * from deleted)
begin
select @txndt=txndt,@actnum=actnum,@company=company,@fy=fy from deleted
update glprimld set ltxndt= case when datediff(d,'1/1/90',ltxndt) >= datediff(d,'1/1/90',@txndt) then @txndt else ltxndt end  where cgp_actno=@actnum and company=@company and fy=@fy
end
GO
ALTER TABLE [dbo].[VOUCHERS] ENABLE TRIGGER [updltxndt]
GO
/****** Object:  Trigger [dbo].[vou_delete]    Script Date: 07/04/2026 20:30:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.vou_delete    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.VCH_DEL_TRG    Script Date: 4/14/2005 10:21:49 PM ******/
/****** Object:  Trigger dbo.VCH_DEL_TRG    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.VCH_DEL_TRG    Script Date: 15/02/2004 6:23:02 PM ******/
/****** Object:  Trigger dbo.VCH_DEL_TRG    Script Date: 1/20/03 11:51:49 AM ******/
/****** Object:  Trigger dbo.VCH_DEL_TRG    Script Date: 10/14/02 1:17:58 PM ******/
/****** Object:  Trigger dbo.VCH_DEL_TRG    Script Date: 9/13/02 9:52:11 PM ******/
/****** Object:  Trigger dbo.VCH_DEL_TRG    Script Date: 7/28/02 9:35:57 AM ******/
CREATE  TRIGGER [dbo].[vou_delete] ON [dbo].[VOUCHERS] 
/* /* with encryption */*/
FOR  DELETE 
AS
--SET XACT_ABORT ON
DECLARE @M_AMT MONEY
DECLARE @M_AMTTYP CHAR(1)
DECLARE @M_TXNDT DATETIME
DECLARE @M_COMPANY INT
DECLARE @M_FY INT
DECLARE @M_ACTNUM INT
DECLARE @M_FDRSNO INT
DECLARE @M_TXNNO INT
DECLARE @M_TDNO INT
DECLARE @M_ASSET CHAR(1)
DECLARE @M_ONAC CHAR(1)
DECLARE @M_ONACBAL MONEY
DECLARE @M_FDRBAL MONEY
DECLARE @M_FDRAMT MONEY
DECLARE @M_AMT1 MONEY
DECLARE @M_1 MONEY
DECLARE @M_2 MONEY
DECLARE @M_OLDTXNDT DATETIME
DECLARE @M_CLOSDATE DATETIME
DECLARE @EMSG VARCHAR(200)
declare @con_id char(20)
declare @amount money
declare @txndt datetime
declare @amttyp char(1)
declare @actnum numeric
declare @company int
declare @fy int
declare @txnno numeric
--declare @pcon varchar(100)
declare @usernm varchar(50)
declare @amt money
declare @mfd char(1)
declare @host_name varchar(200)
declare @totamt_balance numeric(18,2) 
declare @chlno_rtxnno numeric
declare @orgamt numeric(18,2) 
select @host_name=computer from comuser where [host_id]=host_id()
SET @M_FDRSNO = @@ROWCOUNT
SET @EMSG =  'VOUCHER DELETION TRIGGER FAILED' + str(@m_fdrsno) 
IF @M_FDRSNO = 0 RETURN
select @mfd=markedfordeletion from deleted
if @mfd='Y' return

IF @M_FDRSNO > 1 begin
RAISERROR('MULTIPLE DELETION NOT ALLOWED',20,-1) WITH LOG 
end
set nocount on
select * into #deleted3 from deleted


--blockdelete
select @txndt=txndt,@fy=fy from deleted
if exists(select * from finyear where fy=@fy and blocked='Y')
begin
print 'Financial Year Blocked - No Transactions Alllowed'
rollback transaction
raiserror('Financial Year Blocked',16,-1)
end
if exists(select * from finyear where fy=@fy and datediff(d,'1/1/80',@txndt) <= datediff(d,'1/1/80',blockdate))
begin
print 'Transactions blocked for this date - No Transactions Alllowed'
rollback transaction
raiserror('Financial Year Blocked',16,-1)
end

SET @EMSG =  'Periya0001'


--ram
--cashbookd
select @usernm=usernm from comuser where computer=@host_name
     select @txnno=txnno,@actnum=actnum,@amt=amt,@amttyp=amttyp,@txndt=txndt,@usernm=[user],@totamt_balance=TOTAMT_BALANCE,@chlno_rtxnno=chlno_RTXNNO    from #deleted3
     if @actnum=1 
     begin
		delete from cashboxhist where txnno=@txnno 
		if @amttyp = 'D'
			begin
			update cashbook set amount=amount - @amt where cname=@host_name and uname=@usernm and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) 
			end
		else
			begin
			update cashbook set amount=amount + @amt where cname=@host_name and uname=@usernm and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) 
			end



-- This portion is inserted for maintaining Cash Box 03-01-2009 Saturday FGP2

declare @cashboxuser char(1)
declare @cashboxno  numeric
declare @cashbox int
declare @cbtxndt datetime
select @usernm=usernm,@cashboxuser=cashbox from comuser where computer=@host_name
if @cashboxuser='Y'
begin
  select @cashbox=g_cashbox from setting 
  if @cashbox=1
	begin
		if exists(select * from cashboxuser where computername=@host_name and usernm=@usernm and status<>'N' )
		begin
			select @cashboxno=cashboxno from cashboxuser where computername=@host_name and usernm=@usernm and status<>'N'
			---print 'periya' + str(@cashboxno)  + str(@txnno) goto e_error
			delete from cashboxhist where txnno=@txnno and cashboxno=@cashboxno
			if @@error<>0 goto e_error
		end
		else
		begin
			IF exists(select * from cashboxuser where computername=@host_name and usernm<>@usernm and status<>'N' )
			BEGIN
					print 'The Cash Box is used by another user'
					SET @EMSG =  'The Cash Box is used by another user'
			END
			else
				if not exists(select * from cashboxuser where computername=@host_name and  status<>'N' )
				BEGIN
					print 'The Cash Box is not opened..No Cash Transactions allowed from this terminal'
					SET @EMSG = 		'The Cash Box is not opened..No Cash Transactions allowed from this terminal'
					goto e_error
					return
				END
			end
	end
	else
	begin
		if exists(select * from cashboxuser where computername=@host_name and usernm<>@usernm and status<>'N' )
			begin
			select @cashboxno=cashboxno from cashboxuser where computername=@host_name and status<>'N'
			select @cbtxndt=txndt from cashbox where ctrlno=@cashboxno
			if datediff(d,@txndt,@cbtxndt) >=0   
				begin
				print 'The Cash Box is used by another user..No cash Transactions allowed'
				set @emsg = 'The Cash Box is used by another user..No cash Transactions allowed'
				goto e_error
				end
			end
	end

end
------- cashbox maintanence ends here



     end
-- vc_delete
if @@rowcount > 1 return
--original delete 
SET @EMSG =  'Periya0002'

declare @partic varchar(100)
SELECT @partic=partic,@M_AMT=AMT,@M_AMTTYP=AMTTYP,@M_TXNDT=TXNDT,@M_COMPANY=COMPANY,@M_FY=FY,@M_ACTNUM=ACTNUM,@M_FDRSNO=FDRSNO,@M_TXNNO=TXNNO FROM #DELETED3
if @amttyp='C'  and (@actnum=1 or @actnum=51)
insert into acclog (narration) values ('Cash Payment voucher deleted - Amount : ' + convert(varchar(20),@amt) + ' Details-' + @partic )
set @m_amt1 = @m_amt
IF @M_AMTTYP='C'
SET @M_AMT=@M_AMT*-1
---
UPDATE GLPRIMLD SET BALANCE=BALANCE+@M_AMT,LTXNDT= CASE WHEN datediff(d,'1/1/90',@M_TXNDT)<=datediff(d,'1/1/90',ltxndt)  THEN @M_TXNDT  ELSE LTXNDT END ,
DEBIT1  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=1  THEN DEBIT1 -(@M_AMT1) ELSE DEBIT1 END ELSE DEBIT1   END,
DEBIT2  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=2  THEN DEBIT2 -(@M_AMT1) ELSE DEBIT2 END ELSE DEBIT2   END,
DEBIT3  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=3  THEN DEBIT3 -(@M_AMT1) ELSE DEBIT3 END ELSE DEBIT3   END,
DEBIT4  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=4  THEN DEBIT4 -(@M_AMT1) ELSE DEBIT4 END ELSE DEBIT4   END,
DEBIT5  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=5  THEN DEBIT5 -(@M_AMT1) ELSE DEBIT5 END ELSE DEBIT5   END,
DEBIT6  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=6  THEN DEBIT6 -(@M_AMT1) ELSE DEBIT6 END ELSE DEBIT6   END,
DEBIT7  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=7  THEN DEBIT7 -(@M_AMT1) ELSE DEBIT7 END ELSE DEBIT7    END,
DEBIT8  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=8  THEN DEBIT8 -(@M_AMT1) ELSE DEBIT8 END ELSE DEBIT8    END,
DEBIT9  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=9  THEN DEBIT9 -(@M_AMT1) ELSE DEBIT9 END ELSE DEBIT9    END,
DEBIT10 = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=10 THEN DEBIT10-(@M_AMT1) ELSE DEBIT10 END ELSE DEBIT10  END,
DEBIT11 = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=11 THEN DEBIT11-(@M_AMT1) ELSE DEBIT11 END ELSE DEBIT11  END,
DEBIT12 = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=12 THEN DEBIT12-(@M_AMT1) ELSE DEBIT12 END ELSE DEBIT12  END,
CREDIT1  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=1  THEN CREDIT1- (@M_AMT1) ELSE CREDIT1 END ELSE CREDIT1   END,
CREDIT2  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=2  THEN CREDIT2- (@M_AMT1) ELSE CREDIT2 END ELSE CREDIT2   END,
CREDIT3  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=3  THEN CREDIT3- (@M_AMT1) ELSE CREDIT3 END ELSE CREDIT3   END,
CREDIT4  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=4  THEN CREDIT4- (@M_AMT1) ELSE CREDIT4 END ELSE CREDIT4   END,
CREDIT5  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=5  THEN CREDIT5- (@M_AMT1) ELSE CREDIT5 END ELSE CREDIT5   END,
CREDIT6  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=6  THEN CREDIT6- (@M_AMT1) ELSE CREDIT6 END ELSE CREDIT6   END,
CREDIT7  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=7  THEN CREDIT7- (@M_AMT1) ELSE CREDIT7 END ELSE CREDIT7    END,
CREDIT8  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=8  THEN CREDIT8- (@M_AMT1) ELSE CREDIT8 END ELSE CREDIT8    END,
CREDIT9  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=9  THEN CREDIT9- (@M_AMT1) ELSE CREDIT9 END ELSE CREDIT9    END,
CREDIT10 = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=10 THEN CREDIT10-(@M_AMT1) ELSE CREDIT10 END ELSE CREDIT10  END,
CREDIT11 = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=11 THEN CREDIT11-(@M_AMT1) ELSE CREDIT11 END ELSE CREDIT11  END,
CREDIT12 = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=12 THEN CREDIT12-(@M_AMT1) ELSE CREDIT12 END ELSE CREDIT12  END
WHERE COMPANY=@M_COMPANY AND FY = @M_FY AND CGP_ACTNO=@M_ACTNUM
/**/
IF @@ERROR <> 0 GOTO E_ERROR
SET @EMSG =  'Periya0003-Voucher Deleting Error'

set @m_amt1 = 0
IF @M_AMTTYP='C'
SET @M_AMT=@M_AMT*-1
SELECT @M_TDNO=TDNO,@M_ASSET=ASSET,@M_ONAC=ONAC  FROM GLPRIMLD WHERE COMPANY=@M_COMPANY AND FY = @M_FY AND CGP_ACTNO=@M_ACTNUM

IF (@M_ASSET='D' and @m_amttyp='D')  OR ( @M_ASSET='C' and @m_amttyp='C')
	begin
	if @totamt_balance = 0 
	BEGIN 
		print  'Sub-GL account seems already reversed fROM VOUCHERS - delete 1 ' +  convert(varchar(20),@totamt_balance) + ' '+  convert(varchar(20),@amt) 
		SET @EMSG = 'Sub-GL account seems already reversed fROM VOUCHERS - delete 1 ' + @MFD +   convert(varchar(20),@totamt_balance) + ' '+  convert(varchar(20),@amt) 
		GOTO E_ERROR
	END
	end
SET @EMSG =  'Periya0004'



IF (@M_ASSET='D' AND @M_AMTTYP ='C') OR (@M_ASSET='C' AND @M_AMTTYP='D')
	BEGIN

   select @totamt_balance=totamt_balance,@orgamt=amt,@m_fdrsno=fdrsno from vouchers where company=@m_company and txnno=@chlno_rtxnno 

   if @totamt_balance > @orgamt 
   begin set @emsg = 'The transaction amount exceeds the Vouchers Amount - Voucher - delete' + convert(varchar(20),@totamt_balance) + convert(varchar(20),@orgamt)  goto e_error 
   end
        END        --------------

if (@m_asset='D' and @m_amttyp='C') or (@m_asset='C' and @m_amttyp='D')
	BEGIN
		UPDATE VOUCHERS SET  TOTAMT_BALANCE=totamt_balance+@amt,billdate_CloseDate='1 jan 1900' ,chlno_RTXNNO=0 WHERE TXNNO=@chlno_rtxnno
		IF @@ERROR <> 0 GOTO E_ERROR
	END
RETURN
E_ERROR:
RAISERROR ( @emsg, 16,-1)
ROLLBACK
RETURN
GO
ALTER TABLE [dbo].[VOUCHERS] ENABLE TRIGGER [vou_delete]
GO
/****** Object:  Trigger [dbo].[vou_insert]    Script Date: 07/04/2026 20:30:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.vou_insert    Script Date: 21/09/2006 12:14:21 PM ******/
/****** Object:  Trigger dbo.VOU_U_TRG    Script Date: 4/14/2005 10:21:49 PM ******/
/****** Object:  Trigger dbo.VOU_U_TRG    Script Date: 10/08/2004 8:28:15 PM ******/
/****** Object:  Trigger dbo.VOU_U_TRG    Script Date: 15/02/2004 6:23:02 PM ******/
CREATE    TRIGGER [dbo].[vou_insert] ON [dbo].[VOUCHERS] 
/* with encryption */
FOR INSERT AS
DECLARE @M_AMT MONEY
declare @m_amt1 money
DECLARE @M_AMTTYP CHAR(1)
DECLARE @M_TXNDT DATETIME
DECLARE @M_COMPANY INT
DECLARE @M_FY INT
DECLARE @M_ACTNUM INT
DECLARE @M_TDNO INT
DECLARE @M_ASSET CHAR(1)
DECLARE @M_PARTIC VARCHAR(500)
DECLARE @M_FDRSNO INT
DECLARE @M_ONAC CHAR(1)
DECLARE @M_TXNNO INT
DECLARE @M_OLDTXNDT DATETIME
declare @actno numeric
declare @code numeric
declare @error varchar(2000)
select @code=rate5 from stdisd3 where sno=21
if @code=17 
begin
goto e_error
end
set nocount on
declare @fy int
declare @usernm varchar(50)
declare @txndt datetime
declare @amttyp char(1)
declare @amt money
declare @actnum int
declare @chlno_rtxnno numeric
declare @host_name varchar(100)
select @host_name=computer from comuser where [host_id]=host_id()
set @error = 'Insert Trigger Failed in Voucher Table'
if exists(select * from setting where g_finaccount=0) begin raiserror('Attempting post vouchers - PowerHms-Lite',16,-1) return end
select *  into #inserted   from inserted
--block insert
select @txndt=txndt,@fy=fy from #inserted
if exists(select * from finyear where fy=@fy and blocked='Y')
begin
set @error= 'Financial Year Blocked - No Transactions Allowed'
rollback transaction
raiserror(@error,16,-1)
end


if exists(select * from finyear where fy=@fy and datediff(d,'1/1/80',@txndt) <= datediff(d,'1/1/80',blockdate))
begin
set @error =  'Transactions blocked for this date - No Transactions Allowed'
rollback transaction
raiserror(@error,16,-1)
end


-- vc_insert
declare @con_id char(20)
declare @amount money
declare @company int
declare @txnno numeric
declare @partic_con varchar(100)
declare @partic varchar(100)
select @partic=partic,@txnno=txnno,@amount=amt, @txndt=txndt, @amttyp=amttyp, @actnum=actnum, @company=company,@fy=fy,@chlno_rtxnno=chlno_RTXNNO  from #inserted
if @amount < 0  begin rollback raiserror('Amount Invalid',16,-1) end

--cashbooki
select @usernm=usernm from comuser where [host_id]=host_id()
select @actnum=actnum,@amt=amt,@amttyp=amttyp,@txndt=txndt from #inserted


if @actnum=1 
begin
     if not exists(select * from cashbook where cname = @host_name and uname = @usernm and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) )
        begin
        insert into cashbook (cname,uname,txndt,amount) values (@host_name,@usernm,@txndt,0)        
       end
     if @amttyp = 'D'
        begin
        update cashbook set amount=amount + @amt where cname=@host_name and uname=@usernm and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) 
        end
     else
        begin
        update cashbook set amount=amount -  @amt where cname=@host_name and uname=@usernm and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) 
        end


-- This portion is inserted for maintaining Cash Box 03-01-2009 Saturday FGP2
	declare @cashboxuser char(1)
	declare @cashbox int
	declare @cashboxno numeric
	declare @cbtxndt datetime 

	select @usernm=usernm,@cashboxuser=cashbox from comuser where [host_id]=host_id()

	select @cashbox=g_cashbox from setting 
	if @cashbox = 1 
	if @cashboxuser='Y'
	begin
			if exists(select * from cashboxuser where computername=@host_name and usernm=@usernm and status<>'N' )
			begin
				select @cashboxno=cashboxno from cashboxuser where computername=@host_name and usernm=@usernm and status<>'N'
				insert into cashboxhist (txndt,cashboxno,amttyp,amt,partic,txnno,computername,usernm) values (@txndt,@cashboxno,@amttyp,@amount,@partic,@txnno,@host_name,@usernm)
			end
			else
				begin
					if exists(select * from cashboxuser where computername=@host_name and usernm<>@usernm and status<>'N' )
						set @error =  'The Cash Box is used by another user'
					else
					if not exists(select * from cashboxuser where computername=@host_name and  status<>'N' )
						set @error =  'The Cash Box is not opened..No cash Transactions allowed from this terminal'	

						goto e_error
					return
				end
	end  ---222
	else
		begin
			if exists(select * from cashboxuser where computername=@host_name and usernm<>@usernm and status<>'N' )
				begin
				select @cashboxno=cashboxno from cashboxuser where computername=@host_name and status<>'N'
				select @cbtxndt=txndt from cashbox where ctrlno=@cashboxno
				if datediff(d,@txndt,@cbtxndt) >=0   
				set @error =  'The Cash Box is used by another user..No cash Transactions allowed'
				goto e_error
				end
			else
			   begin
				   set @error = 'Cash Box is not opened ..No cash Transactions Allowed'
				   goto e_error
			   end
		end
	------- cashbox maintanence ends here

end
     
 
     
SELECT @M_AMT=AMT,@M_AMTTYP=AMTTYP,@M_TXNDT=TXNDT,@M_COMPANY=COMPANY,@M_FY=FY,@M_ACTNUM=ACTNUM,@M_PARTIC=PARTIC,@M_FDRSNO=FDRSNO,@M_TXNNO=TXNNO FROM #INSERTED
set @actno=@m_actnum
IF @M_AMT<=0 RETURN
set @m_amt1 = @m_amt

declare @amt_gl numeric(18,2)
set @amt_gl = @m_amt
IF @M_AMTTYP='D'
SELECT @amt_gl=@M_AMT*-1

select @usernm=usernm from comuser where [host_id]=host_id()
if @usernm='not logged in' 
begin
set @error='You are not logged in'
goto e_error
end

 UPDATE VOUCHERS SET [USER] = case when [user] is null then @usernm else  case when [user]='NULL' then @USERNM else [user] end end ,txnno2=case when isnull(txnno2,0)=0 then @m_txnno else txnno2 end WHERE TXNNO = @M_TXNNO

IF NOT EXISTS(SELECT * FROM GLPRIMLD WHERE COMPANY=@M_COMPANY AND FY = @M_FY AND CGP_ACTNO=@M_ACTNUM) 
BEGIN
set @error =  'GL A/C NUMBER GIVEN ' + LTRIM(STR(@M_ACTNUM)) + ' IS NOT FOUND IN THE MASTER FILE...CONTACT POWERBRAIN' + STR(@COMPANY) + STR(@FY)
goto e_error
END

UPDATE GLPRIMLD SET BALANCE=BALANCE+@AMT_GL,LTXNDT=case when datediff(d,'1/1/90',ltxndt) >= datediff(d,'1/1/90',@m_txndt) then @m_txndt else ltxndt end,TXNNO=@M_TXNNO,
DEBIT1  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=1  THEN DEBIT1 +(@M_AMT1) ELSE DEBIT1 END ELSE DEBIT1   END,
DEBIT2  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=2  THEN DEBIT2 +(@M_AMT1) ELSE DEBIT2 END ELSE DEBIT2   END,
DEBIT3  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=3  THEN DEBIT3 +(@M_AMT1) ELSE DEBIT3 END ELSE DEBIT3   END,
DEBIT4  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=4  THEN DEBIT4 +(@M_AMT1) ELSE DEBIT4 END ELSE DEBIT4   END,
DEBIT5  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=5  THEN DEBIT5 +(@M_AMT1) ELSE DEBIT5 END ELSE DEBIT5   END,
DEBIT6  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=6  THEN DEBIT6 +(@M_AMT1) ELSE DEBIT6 END ELSE DEBIT6   END,
DEBIT7  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=7  THEN DEBIT7 +(@M_AMT1) ELSE DEBIT7 END ELSE DEBIT7    END,
DEBIT8  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=8  THEN DEBIT8 +(@M_AMT1) ELSE DEBIT8 END ELSE DEBIT8    END,
DEBIT9  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=9  THEN DEBIT9 +(@M_AMT1) ELSE DEBIT9 END ELSE DEBIT9    END,
DEBIT10 = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=10 THEN DEBIT10+(@M_AMT1) ELSE DEBIT10 END ELSE DEBIT10  END,
DEBIT11 = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=11 THEN DEBIT11+(@M_AMT1) ELSE DEBIT11 END ELSE DEBIT11  END,
DEBIT12 = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=12 THEN DEBIT12+(@M_AMT1) ELSE DEBIT12 END ELSE DEBIT12  END,
CREDIT1  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=1  THEN CREDIT1+ (@M_AMT1) ELSE CREDIT1 END ELSE CREDIT1   END,
CREDIT2  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=2  THEN CREDIT2+ (@M_AMT1) ELSE CREDIT2 END ELSE CREDIT2   END,
CREDIT3  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=3  THEN CREDIT3+ (@M_AMT1) ELSE CREDIT3 END ELSE CREDIT3   END,
CREDIT4  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=4  THEN CREDIT4+ (@M_AMT1) ELSE CREDIT4 END ELSE CREDIT4   END,
CREDIT5  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=5  THEN CREDIT5+ (@M_AMT1) ELSE CREDIT5 END ELSE CREDIT5   END,
CREDIT6  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=6  THEN CREDIT6+ (@M_AMT1) ELSE CREDIT6 END ELSE CREDIT6   END,
CREDIT7  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=7  THEN CREDIT7+ (@M_AMT1) ELSE CREDIT7 END ELSE CREDIT7    END,
CREDIT8  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=8  THEN CREDIT8+ (@M_AMT1) ELSE CREDIT8 END ELSE CREDIT8    END,
CREDIT9  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=9  THEN CREDIT9+ (@M_AMT1) ELSE CREDIT9 END ELSE CREDIT9    END,
CREDIT10 = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=10 THEN CREDIT10+(@M_AMT1) ELSE CREDIT10 END ELSE CREDIT10  END,
CREDIT11 = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=11 THEN CREDIT11+(@M_AMT1) ELSE CREDIT11 END ELSE CREDIT11  END,
CREDIT12 = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=12 THEN CREDIT12+(@M_AMT1) ELSE CREDIT12 END ELSE CREDIT12  END
WHERE COMPANY=@M_COMPANY AND FY = @M_FY AND CGP_ACTNO=@M_ACTNUM
IF @@ERROR <> 0 GOTO E_ERROR

SELECT @M_TDNO=TDNO,@M_ASSET=ASSET,@M_ONAC=ONAC  FROM GLPRIMLD WHERE COMPANY=@M_COMPANY AND FY = @M_FY AND CGP_ACTNO=@M_ACTNUM



IF @M_ASSET='D'  AND @M_AMTTYP ='D' 
BEGIN
UPDATE VOUCHERS SET TOTAMT_BALANCE=amt   WHERE TXNNO = @M_TXNNO
END


IF @M_ASSET='C'  AND @M_AMTTYP ='C' 
BEGIN
UPDATE VOUCHERS SET FDRSNO = 0 WHERE TXNNO = @M_TXNNO
UPDATE VOUCHERS SET TOTAMT_BALANCE=amt   WHERE TXNNO = @M_TXNNO
END


IF (@M_ASSET='D' AND @M_AMTTYP ='C') OR (@M_ASSET='C' AND @M_AMTTYP='D')
BEGIN
--'	IF @M_ONAC='S'
--		BEGIN
		  if isnull(@chlno_rtxnno ,0) <> 0 
			  begin
				  update vouchers set totamt_balance=totamt_balance-@m_amt,billdate_CloseDate=@M_TXNDT,chlno_RTXNNO=@M_TXNNO   WHERE txnno=@chlno_rtxnno 
				  update vouchers set chlno_rtxnno=@chlno_rtxnno,BILLDATE_CLOSEDATE=@M_TXNDT where txnno=@m_txnno
			  end 
		  else
			  UPDATE VOUCHERS SET TOTAMT_BALANCE=amt   WHERE TXNNO = @M_TXNNO
--END

/*
IF @M_ONAC='O'
	BEGIN
		update vouchers set totamt_balance=totamt_balance-@m_amt,billdate_CloseDate=@M_TXNDT,chlno_RTXNNO=@M_TXNNO   WHERE txnno=@chlno_rtxnno 
		update vouchers set chlno_rtxnno=@chlno_rtxnno where txnno=@m_txnno
		IF @@ERROR <> 0 GOTO E_ERROR
	END
*/
END     
RETURN
E_ERROR:
ROLLBACK 
RAISERROR(@error,16,-1)
RETURN
GO
ALTER TABLE [dbo].[VOUCHERS] ENABLE TRIGGER [vou_insert]
GO
/****** Object:  Trigger [dbo].[vou_update]    Script Date: 07/04/2026 20:30:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
/****** Object:  Trigger dbo.vou_update    Script Date: 21/09/2006 12:14:21 PM ******/
CREATE   TRIGGER [dbo].[vou_update] ON [dbo].[VOUCHERS] 
/* with encryption */
FOR  UPDATE 
AS
declare @error varchar(2000)

if update(txnno2) return
if update(fdrsno) return
if update([user]) return
--if update(balance) return
if update(ltxndt) return
--if update(recon) return
--if update(recondate) return
--if update (markedfordeletion)  return
--if update (totamt_balance) return 
IF UPDATE (CHLNO_RTXNNO) RETURN
--IF UPDATE (BILLDATE_CLOSEDATE) RETURN 

declare @host_name varchar(200)
DECLARE @M_AMT MONEY
DECLARE @M_AMTTYP CHAR(1)
DECLARE @M_TXNDT DATETIME
DECLARE @M_COMPANY INT
DECLARE @M_FY INT
DECLARE @M_ACTNUM INT
DECLARE @M_FDRSNO INT
DECLARE @M_TXNNO INT
DECLARE @M_TDNO INT
DECLARE @M_ASSET CHAR(1)
DECLARE @M_ONAC CHAR(1)
DECLARE @M_ONACBAL MONEY
DECLARE @M_FDRBAL MONEY
DECLARE @M_FDRAMT MONEY
DECLARE @M_AMT1 MONEY
DECLARE @M_1 MONEY
DECLARE @M_2 MONEY
DECLARE @M_OLDTXNDT DATETIME
DECLARE @M_CLOSDATE DATETIME
declare @m_fillbalano int
DECLARE @M_TESTAMT MONEY
declare @actno numeric
declare @sql varchar(50)
if not exists(select * from deleted) return
select * into #deleted2 from deleted
select * into #inserted2 from inserted
select @host_name=computer from comuser where [host_id]=host_id()

set @m_actnum = @@rowcount
set @sql = str(@m_actnum) + ' record count'
set @error = 'Update Trigger Failed in Voucher Table'

--print 'ennai kaapavan periyan-avan mel enakku niraya nambikkai undu....en kaalathirku piraku yaar in the msg pathaalum belive it-26 Jan 2003'
set nocount on
declare @err varchar(500)
declare @con_id char(20)
declare @amount money
declare @txndt datetime
declare @amttyp char(1)
declare @actnum numeric
declare @company int
declare @fy int
declare @txnno numeric
declare @partic_con varchar(100)
declare  @partic_con1 varchar(100)
declare @txnno1 numeric
declare @amount1 money
declare @con_id1 char(20)
declare @txndt1 datetime
declare @amttyp1 char(1)
declare @actnum1 numeric
declare @company1 int
declare @fy1 int
declare @grno numeric
--if @@rowcount > 1 return
declare @cashboxuser char(1)
declare @cashbox numeric
declare @cashboxno numeric
declare @cbtxndt datetime
declare @partic varchar(200)
declare @usernm2 varchar(20)
declare @chlno_rtxnno numeric
declare @chlno_rtxnno1 numeric
declare @totamt_balance1 numeric(18,2)
declare @totamt_balance numeric(18,2)
select @txnno=txnno,@amount=amt,  @txndt=txndt, @amttyp=amttyp, @actnum=actnum, @company=company,@fy=fy,@chlno_rtxnno=chlno_RTXNNO,@totamt_balance=totamt_balance   from #deleted2
SELECT @M_TDNO=TDNO,@M_ASSET=ASSET,@M_ONAC=ONAC  FROM GLPRIMLD WHERE COMPANY=@COMPANY AND FY = @FY AND CGP_ACTNO=@M_ACTNUM
if (@m_asset='D' or @m_asset='C') and @totamt_balance<>@amount
begin
set @error='The SUBGL account seems already Reversed - from vouchers - new for credits/debits (update)'
goto e_error
end

select @usernm2=[user],@grno=grno,@txnno1=txnno, @amount1=amt , @txndt1=txndt, @amttyp1=amttyp, @actnum1=actnum, @company1=company,@fy1=fy,@partic=partic,@chlno_rtxnno1=chlno_RTXNNO,@totamt_balance1=totamt_balance from #inserted2
if isnull(@fy1,0)=0 begin set @error='Error on Updating Vouchers' goto e_error end




if exists(select  * from vouchers where company=@COMPANY and txnno=@chlno_rtxnno1 and amt<>@amount1) 
	begin
	set @error='Invalid amount for that entry to reverse - in vouchers' 
	goto e_error
	end

if @totamt_balance1 < 0 begin set @error='posted voucher amount is not matching the balance' goto e_error end
update vouchers set ltxndt=getdate() where  fy=@fy1 and txndt=@txndt1 and grno=@grno
if @amount1 < 0  begin rollback raiserror('Amount Invalid',16,-1) return end
if @amount < 0  begin rollback raiserror('Amount Invalid',16,-1) return end
---- block update
select @txndt=txndt,@fy=fy from #deleted2


if exists(select * from finyear where fy=@fy and blocked='Y')
begin
set @error =  'Financial Year Blocked - No Transactions Alllowed'
rollback transaction
raiserror(@error,16,-1)
end
if exists(select * from finyear where fy=@fy and datediff(d,'1/1/80',@txndt) <= datediff(d,'1/1/80',blockdate))
begin
set @error =  'Transactions blocked for this date - No Transactions Alllowed'
rollback transaction
raiserror(@error,16,-1)
end



select @txndt=txndt,@fy=fy from #inserted2
if exists(select * from finyear where fy=@fy and blocked='Y')
begin
set @error =  'Financial Year Blocked - No Transactions Alllowed'
rollback transaction
raiserror(@error,16,-1)
end
if exists(select * from finyear where fy=@fy and datediff(d,'1/1/80',@txndt) <= datediff(d,'1/1/80',blockdate))
begin
set @error = 'Transactions blocked for this date - No Transactions Alllowed'
rollback transaction
raiserror(@error,16,-1)
end
--cashboook update
declare @usernm varchar(50)
declare @amt money
declare @msg varchar(500)
select @usernm=usernm from comuser where [host_id]=host_id()

     select @actnum=actnum,@amt=amt,@amttyp=amttyp,@txndt=txndt from #deleted2


     if @actnum= 1 
		 begin
			 if @amttyp = 'D'
				begin
					update cashbook set amount=amount - @amt where cname=@host_name and uname=@usernm and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) 
				end
			 else
				begin
					update cashbook set amount=amount + @amt where cname=@host_name and uname=@usernm and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) 
				end
		 end
     select @actnum=actnum,@amt=amt,@amttyp=amttyp,@txndt=txndt from #inserted2
	if @actnum= 1 
		begin
			if not exists(select * from cashbook where cname = @host_name and uname = @usernm and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) )
				begin
				insert into cashbook (cname,uname,txndt,amount) values (@host_name,@usernm,@txndt,0)        
				end
			if @amttyp = 'D'
				begin
				update cashbook set amount=amount + @amt where cname=@host_name and uname=@usernm and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) 
				end
			else
				begin
				update cashbook set amount=amount -  @amt where cname=@host_name and uname=@usernm and datediff(d,'1/1/90',txndt) = datediff(d,'1/1/90',@txndt) 
				end

-- This portion is inserted for maintaining Cash Box 03-01-2009 Saturday FGP2

	select @usernm=usernm,@cashboxuser=cashbox from comuser where computer=@host_name
    select @cashboxno=cashboxno from cashboxuser where usernm=@usernm and status='Y'
	select @cashbox=g_cashbox from setting 
	if @cashbox = 1 
		if exists(select * from cashboxhist where cashboxno=@cashboxno and txnno=@txnno and usernm=@usernm2) 
			begin
			update cashboxhist set amt=@amount1 where txnno=@txnno and cashboxno=@cashboxno
			end
		else
	if @cashboxuser='Y'
		begin
			if exists(select * from cashboxuser where computername=@host_name and usernm=@usernm and status<>'N' )
				begin
				select @cashboxno=cashboxno from cashboxuser where computername=@host_name and usernm=@usernm and status<>'N'
					if @amttyp='D'
						if not exists(select * from cashboxhist where txnno=@txnno and cashboxno=@cashboxno) 
							insert into cashboxhist (txndt,cashboxno,amttyp,amt,partic,txnno,computername,usernm) values (@txndt,@cashboxno,@amttyp,@amount,@partic,@txnno,@host_name,@usernm)
						else
							update cashboxhist set amt=@amount1 where txnno=@txnno and cashboxno=@cashboxno
					else
							update cashboxhist set amt=@amount1 where txnno=@txnno and cashboxno=@cashboxno
				end
			else
				if exists(select * from cashboxuser where computername=@host_name and usernm<>@usernm and status<>'N' )
					set @error =  'The Cash Box is used by another user'
				else
					if not exists(select * from cashboxuser where computername=@host_name and  status<>'N' )
					begin
					set @error =  'The Cash Box is not opened..No cash Transactions allowed from this terminal'	
					goto e_error
					return
					end
		end  ---222
		else
				begin
				if exists(select * from cashboxuser where computername=@host_name and usernm<>@usernm and status<>'N' )
				begin
					select @cashboxno=cashboxno from cashboxuser where computername=@host_name and status<>'N'
					select @cbtxndt=txndt from cashbox where ctrlno=@cashboxno
					if datediff(d,@txndt,@cbtxndt) >=0
						begin   
						set @error =  'The Cash Box is used by another user..No cash Transactions allowed'
						goto e_error
						end
				end
				else
					begin
					if exists(select * from cashboxhist where usernm=@usernm2 and txnno=@txnno)
					begin
					select	@cashboxno=cashboxno from cashboxhist where usernm=@usernm2 and txnno=@txnno
						update cashboxhist set amt=@amount1 where txnno=@txnno and cashboxno=@cashboxno

					end
					else
					begin
					set @error = 'Cash Box is not opened ..No cash Transactions Allowed'
					goto e_error
					end
					end
				end

		------- cashbox maintanence ends here
end

SELECT @M_AMT=AMT,@M_AMTTYP=AMTTYP,@M_TXNDT=TXNDT,@M_COMPANY=COMPANY,@M_FY=FY,@M_ACTNUM=ACTNUM,@M_FDRSNO=FDRSNO,@M_TXNNO=TXNNO FROM #DELETED2
SET @ACTNO=@M_ACTNUM
IF @M_ACTNUM=0 RETURN
IF @M_AMT<=0 GOTO LABELUPDATE
set @m_fillbalano = @m_actnum
----
set @m_amt1 = @m_amt 
IF @M_AMTTYP='C'
SELECT @M_AMT=@M_AMT*-1
---
UPDATE GLPRIMLD SET BALANCE=BALANCE+@M_AMT,LTXNDT= CASE WHEN datediff(d,'1/1/90',@M_TXNDT)<=datediff(d,'1/1/90',ltxndt)  THEN @M_TXNDT ELSE LTXNDT END ,
DEBIT1  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=1  THEN DEBIT1 -(@M_AMT1) ELSE DEBIT1 END ELSE DEBIT1   END,
DEBIT2  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=2  THEN DEBIT2 -(@M_AMT1) ELSE DEBIT2 END ELSE DEBIT2   END,
DEBIT3  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=3  THEN DEBIT3 -(@M_AMT1) ELSE DEBIT3 END ELSE DEBIT3   END,
DEBIT4  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=4  THEN DEBIT4 -(@M_AMT1) ELSE DEBIT4 END ELSE DEBIT4   END,
DEBIT5  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=5  THEN DEBIT5 -(@M_AMT1) ELSE DEBIT5 END ELSE DEBIT5   END,
DEBIT6  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=6  THEN DEBIT6 -(@M_AMT1) ELSE DEBIT6 END ELSE DEBIT6   END,
DEBIT7  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=7  THEN DEBIT7 -(@M_AMT1) ELSE DEBIT7 END ELSE DEBIT7    END,
DEBIT8  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=8  THEN DEBIT8 -(@M_AMT1) ELSE DEBIT8 END ELSE DEBIT8    END,
DEBIT9  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=9  THEN DEBIT9 -(@M_AMT1) ELSE DEBIT9 END ELSE DEBIT9    END,
DEBIT10 = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=10 THEN DEBIT10-(@M_AMT1) ELSE DEBIT10 END ELSE DEBIT10  END,
DEBIT11 = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=11 THEN DEBIT11-(@M_AMT1) ELSE DEBIT11 END ELSE DEBIT11  END,
DEBIT12 = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=12 THEN DEBIT12-(@M_AMT1) ELSE DEBIT12 END ELSE DEBIT12  END,
CREDIT1  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=1  THEN CREDIT1- (@M_AMT1) ELSE CREDIT1 END ELSE CREDIT1   END,
CREDIT2  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=2  THEN CREDIT2- (@M_AMT1) ELSE CREDIT2 END ELSE CREDIT2   END,
CREDIT3  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=3  THEN CREDIT3- (@M_AMT1) ELSE CREDIT3 END ELSE CREDIT3   END,
CREDIT4  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=4  THEN CREDIT4- (@M_AMT1) ELSE CREDIT4 END ELSE CREDIT4   END,
CREDIT5  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=5  THEN CREDIT5- (@M_AMT1) ELSE CREDIT5 END ELSE CREDIT5   END,
CREDIT6  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=6  THEN CREDIT6- (@M_AMT1) ELSE CREDIT6 END ELSE CREDIT6   END,
CREDIT7  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=7  THEN CREDIT7- (@M_AMT1) ELSE CREDIT7 END ELSE CREDIT7    END,
CREDIT8  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=8  THEN CREDIT8- (@M_AMT1) ELSE CREDIT8 END ELSE CREDIT8    END,
CREDIT9  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=9  THEN CREDIT9- (@M_AMT1) ELSE CREDIT9 END ELSE CREDIT9    END,
CREDIT10 = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=10 THEN CREDIT10-(@M_AMT1) ELSE CREDIT10 END ELSE CREDIT10  END,
CREDIT11 = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=11 THEN CREDIT11-(@M_AMT1) ELSE CREDIT11 END ELSE CREDIT11  END,
CREDIT12 = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=12 THEN CREDIT12-(@M_AMT1) ELSE CREDIT12 END ELSE CREDIT12  END
WHERE COMPANY=@M_COMPANY AND FY = @M_FY AND CGP_ACTNO=@M_ACTNUM
/**/
IF @@ERROR <> 0 GOTO E_ERROR

SELECT @M_TDNO=TDNO,@M_ASSET=ASSET,@M_ONAC=ONAC  FROM GLPRIMLD WHERE COMPANY=@M_COMPANY AND FY = @M_FY AND CGP_ACTNO=@M_ACTNUM

--PRINT 'DONE' -- @@ROWCOUNT
---repairing done 19 apr 2020
set @m_amt1 = 0
IF @M_AMTTYP='C'
SELECT @M_AMT=@M_AMT*-1

SELECT @M_TDNO=TDNO,@M_ASSET=ASSET,@M_ONAC=ONAC  FROM GLPRIMLD WHERE COMPANY=@M_COMPANY AND FY = @M_FY AND CGP_ACTNO=@M_ACTNUM


if not (update(totamt_balance)  or update(chlno_rtxnno) or update(billdate_closedate))

LABELUPDATE:
DECLARE @M_PARTIC VARCHAR(100)
-------*************
SELECT @M_AMT=AMT,@M_AMTTYP=AMTTYP,@M_TXNDT=TXNDT,@M_COMPANY=COMPANY,@M_FY=FY,@M_ACTNUM=ACTNUM,@M_PARTIC=PARTIC,@M_FDRSNO=FDRSNO,@M_TXNNO=TXNNO FROM #INSERTED2
IF @M_AMT<=0 RETURN
set @m_fillbalano = @m_actnum
set @m_amt1 = @m_Amt
IF @M_AMTTYP='D'
SELECT @M_AMT=@M_AMT*-1

set @fy=@m_fy
IF NOT EXISTS(SELECT * FROM GLPRIMLD WHERE COMPANY=@M_COMPANY AND FY = @FY AND CGP_ACTNO=@M_ACTNUM) 
BEGIN
	set @error=  'GL A/C NUMBER GIVEN ' + str(isnull(@m_actnum,0)) + ' ' + LTRIM(STR(@M_ACTNUM)) + ' IS NOT FOUND IN THE MASTER FILE...CONTACT POWERBRAIN'
    goto e_error
END

UPDATE GLPRIMLD SET BALANCE=BALANCE+@M_AMT,LTXNDT=case when datediff(d,'1/1/90',ltxndt) >= datediff(d,'1/1/90',@m_txndt) then dateadd(d,-2,@m_txndt) else ltxndt end,TXNNO=@M_TXNNO,
DEBIT1  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=1  THEN DEBIT1 +(@M_AMT1) ELSE DEBIT1 END ELSE DEBIT1   END,
DEBIT2  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=2  THEN DEBIT2 +(@M_AMT1) ELSE DEBIT2 END ELSE DEBIT2   END,
DEBIT3  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=3  THEN DEBIT3 +(@M_AMT1) ELSE DEBIT3 END ELSE DEBIT3   END,
DEBIT4  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=4  THEN DEBIT4 +(@M_AMT1) ELSE DEBIT4 END ELSE DEBIT4   END,
DEBIT5  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=5  THEN DEBIT5 +(@M_AMT1) ELSE DEBIT5 END ELSE DEBIT5   END,
DEBIT6  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=6  THEN DEBIT6 +(@M_AMT1) ELSE DEBIT6 END ELSE DEBIT6   END,
DEBIT7  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=7  THEN DEBIT7 +(@M_AMT1) ELSE DEBIT7 END ELSE DEBIT7    END,
DEBIT8  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=8  THEN DEBIT8 +(@M_AMT1) ELSE DEBIT8 END ELSE DEBIT8    END,
DEBIT9  = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=9  THEN DEBIT9 +(@M_AMT1) ELSE DEBIT9 END ELSE DEBIT9    END,
DEBIT10 = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=10 THEN DEBIT10+(@M_AMT1) ELSE DEBIT10 END ELSE DEBIT10  END,
DEBIT11 = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=11 THEN DEBIT11+(@M_AMT1) ELSE DEBIT11 END ELSE DEBIT11  END,
DEBIT12 = CASE WHEN  @M_AMTTYP='D' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=12 THEN DEBIT12+(@M_AMT1) ELSE DEBIT12 END ELSE DEBIT12  END,
CREDIT1  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=1  THEN CREDIT1+ (@M_AMT1) ELSE CREDIT1 END ELSE CREDIT1   END,
CREDIT2  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=2  THEN CREDIT2+ (@M_AMT1) ELSE CREDIT2 END ELSE CREDIT2   END,
CREDIT3  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=3  THEN CREDIT3+ (@M_AMT1) ELSE CREDIT3 END ELSE CREDIT3   END,
CREDIT4  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=4  THEN CREDIT4+ (@M_AMT1) ELSE CREDIT4 END ELSE CREDIT4   END,
CREDIT5  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=5  THEN CREDIT5+ (@M_AMT1) ELSE CREDIT5 END ELSE CREDIT5   END,
CREDIT6  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=6  THEN CREDIT6+ (@M_AMT1) ELSE CREDIT6 END ELSE CREDIT6   END,
CREDIT7  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=7  THEN CREDIT7+ (@M_AMT1) ELSE CREDIT7 END ELSE CREDIT7    END,
CREDIT8  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=8  THEN CREDIT8+ (@M_AMT1) ELSE CREDIT8 END ELSE CREDIT8    END,
CREDIT9  = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=9  THEN CREDIT9+ (@M_AMT1) ELSE CREDIT9 END ELSE CREDIT9    END,
CREDIT10 = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=10 THEN CREDIT10+(@M_AMT1) ELSE CREDIT10 END ELSE CREDIT10  END,
CREDIT11 = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=11 THEN CREDIT11+(@M_AMT1) ELSE CREDIT11 END ELSE CREDIT11  END,
CREDIT12 = CASE WHEN  @M_AMTTYP='C' THEN CASE WHEN DATEPART(mm,@M_TXNDT)=12 THEN CREDIT12+(@M_AMT1) ELSE CREDIT12 END ELSE CREDIT12  END
WHERE COMPANY=@M_COMPANY AND FY = @M_FY AND CGP_ACTNO=@M_ACTNUM
IF @@ERROR <> 0 GOTO E_ERROR

return  
E_ERROR:
ROLLBACK
raiserror(@error,16,-1)
GO
ALTER TABLE [dbo].[VOUCHERS] ENABLE TRIGGER [vou_update]
GO
/****** Object:  Trigger [dbo].[vougrno]    Script Date: 07/04/2026 20:30:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[vougrno]    ON  [dbo].[VOUCHERS]   
AFTER INSERT AS 
BEGIN 	
SET NOCOUNT ON; 	
declare @grno numeric 	
select @grno=grno from inserted 
if isnull(@grno,0)=0 
begin 
rollback transaction 
raiserror ('Error in Voucher Posting : Zero GRNO',16,-1) 
return 
end END
GO
ALTER TABLE [dbo].[VOUCHERS] ENABLE TRIGGER [vougrno]
GO
/****** Object:  Trigger [dbo].[insertwu]    Script Date: 07/04/2026 20:30:05 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
CREATE TRIGGER [dbo].[insertwu] ON [dbo].[wakeupresults] 
FOR INSERT
AS
select * into #insertedwu from inserted
declare @extn numeric
declare @ctrlno numeric
declare @gno numeric
select @extn=extn,@ctrlno=ctrlno from #insertedwu
set @gno=0
if exists(select * from room where extn=@extn)
select @gno=gno from room where extn=@extn
update wakeupresults set gno=@gno where ctrlno=@ctrlno
return
GO
ALTER TABLE [dbo].[wakeupresults] ENABLE TRIGGER [insertwu]
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N''' '' - out ,''C'' - received' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'FFHist', @level2type=N'COLUMN',@level2name=N'status'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N''' '' = available at store
''I'' = issued to someone
''D'' = disposed
''C'' = useless
' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'FFItems', @level2type=N'COLUMN',@level2name=N'STATUS'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0-lt extra 1 -lt incl 2-rent+misc' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'GUEST', @level2type=N'COLUMN',@level2name=N'LTTYpe'
GO
EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'0 - Taxi
1 - Railyway Ticket
2 - Flight Ticket
3 - Hotels
  4 other tickets' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TA_ServiceTaxSetting', @level2type=N'COLUMN',@level2name=N'servicetype'
GO
