EXEC PROC_REMIT_INBOUND_EXRATE @Flag = 'EXRATE'	,@UserName = 'abcremit'	,@SendingCountryCode = 'AU'
	,@SendingCurrencyCode = 'AUD'	,@PayoutCountryCode = 'UK'	,@PayoutCurrencyCode = 'GBP'
	,@CollectionAmount = '4900'	,@PayoutAmount = '0'	,@PaymentTypeCode = 'CP'	,@AgentId = '394479'
	,@CalcBy = 'C'


EXEC PROC_REMIT_INBOUND_EXRATE @Flag = 'EXRATE', @UserName= 'abcremit', @SendingCountryCode = 'AU', @SendingCurrencyCode = 'AUD', @PayoutCountryCode = 'UK', @PayoutCurrencyCode = 'GBP', @CollectionAmount = '0', @PayoutAmount = '700',
@PaymentTypeCode = 'CP', @AgentId = '394479', @CalcBy = 'P'

EXEC PROC_REMIT_INBOUND_EXRATE @Flag = 'EXRATE', @UserName= 'sendkoreaapi', 
@SendingCountryCode = 'KR', @SendingCurrencyCode = 'KRW', @PayoutCountryCode = 'UK', @PayoutCurrencyCode = 'GBP', @CollectionAmount = '0', @PayoutAmount = '1000',
@PaymentTypeCode = 'CP', @AgentId = '394483', @CalcBy = 'P'

	select dbo.decryptdb(pwd), * FROM applicationUsers
select * FROM TBL_API_SECRET_KEY where userid='52925'

		SELECT a.*
			FROM TblPartnerwiseCountry t (NOLOCK)
			INNER JOIN agentmaster a on t.agentid= a.agentid
			WHERE CountryId = 233
			AND t.IsActive = 1
			--AND ISNULL(PaymentMethod, @DeliveryMethodId) = @DeliveryMethodId

			select  ISSETTLINGAGENT,* FROM agentmaster where agentid in('394483','394481','394478');
				select  ISSETTLINGAGENT,* FROM agentmaster where parentid ='394480'

				UPDATE agentmaster  SET ISSETTLINGAGENT='Y' Where parentid ='394480'

			select * FROM dbo.FNAGetBranchFullDetails(394483)

			SELECT * 
			FROM SERVICETYPEMASTER (NOLOCK)
			WHERE serviceCode = 'CP';

	SELECT  dbo.FNAGetCustomerRate(12, '', NULL, 'AUD', 233, 394480, 'GBP',2 )

	select * FROM defExRate where defExRateId=8
	select * FROM exRateTreasury where ccountry='118'
	--update exRateTreasury set isActive='Y' where ccountry='12'
	select * FROM dbo.FNAGetExRate(118, '', '', 'KRW', 233, 394480, 'GBP', 2)


	select * FROM agentCommissionRule where ruleid='16'
	select groupDetail, * FROM agentGroupMaping where agentid='394483'
		SELECT packageId ,* FROM commissionGroup WITH(NOLOCK) WHERE groupId = 11197
	select * FROM commissionPackage where packageid in
	(SELECT packageId  FROM commissionGroup WITH(NOLOCK) WHERE groupId = 11197)
	 AND ruleType = 'sc'
	-- and  ruleId='16'


	 SELECT * FROM sscMaster sm WITH(NOLOCK) 
			INNER JOIN (	select * FROM commissionPackage where packageid in
	(SELECT packageId  FROM commissionGroup WITH(NOLOCK) WHERE groupId = 11197)
	 AND ruleType = 'sc') cr ON sm.sscMasterId = cr.ruleId
			INNER JOIN sscDetail sd WITH(NOLOCK) ON sm.sscMasterId = sd.sscMasterId
			WHERE 
				ISNULL(sm.isActive, 'N') = 'Y'
			AND ISNULL(sm.isDeleted, 'N') = 'N'
			and sm.sCountry = '118'
			and sm.rCountry = '233'
			AND			 
				  (ssAgent = 394482 OR ssAgent IS NULL)
				 AND (sAgent = 394481 OR sAgent IS NULL) AND
			 baseCurrency = 'GBP'
			--AND (tranType = @serviceType OR tranType IS NULL)
			AND ISNULL(sd.isActive, 'N') = 'Y'
			AND ISNULL(sd.isDeleted, 'N') = 'N'		
			AND 1000 BETWEEN fromAmt and toAmt
			AND getdate() BETWEEN ISNULL(effectiveFrom, '1900-01-01') AND ISNULL(effectiveTo, '2100-12-31')

	select * from staticDataValue where valueid='11197'
	select * FROm sscMaster where  ssagent='394482'
		select * FROm sscMaster where  sagent='394481'
	SELECT *
			FROM exRateTreasury WITH(NOLOCK) 
			WHERE ISNULL(isActive, 'N') = 'Y' AND cCurrency = 'AUD' AND pCurrency = 'GBP' AND cCountry = 12 
			AND cAgent IS NULL AND pCountry = 233 AND pAgent IS NULL AND tranType IS NULL


SELECT * FROM dbo.FNAGetServiceCharge(12, 394478, 394479, NULL, 233, 394480, NULL, NULL, null, 100.00, 'AUD')

SELECT * FROM dbo.FNAGetServiceCharge(118, 394483, 394482, NULL, 233, 394480, NULL, NULL, null, 1000.00, 'GBP')

select * FROM countryMaster where countryid='118'
	SELECT  *
		FROM sendTranLimit (NOLOCK)
		WHERE countryId = 12 and receivingcountry='233'

		update sendTranLimit set isActive='Y' WHERE countryId = 12 and receivingcountry='233'
		 SELECT  * 
					FROM    sendTranLimit WITH ( NOLOCK )
					WHERE   countryId = 118
					AND agentId IS NULL
					--AND ( collMode = @collMode OR collMode IS NULL )
					AND ( tranType = 1 OR tranType IS NULL )
					
					AND ( receivingCountry = 233 OR receivingCountry IS NULL )
					--AND ISNULL(minLimitAmt, 0) <= 4900
					--AND ISNULL(maxLimitAmt, 0) >= 4900
					AND ISNULL(isActive, 'N') = 'Y'
					AND ISNULL(isDeleted, 'N') = 'N'

					[proc_sendTranLimit] @flag = 's', @countryId = '233'  ,@pageNumber='1', @pageSize='20',
					@sortBy='stlId', @sortOrder='ASC', @user = 'admin'