You are on page 1of 4

seguimiento de gps

receptor de GPS

modulo gps y gsm


gsm

USE [FinancialSwitch]
GO
/****** Object: StoredProcedure [dbo].[sp_GetDistributionChargesDeviceNetwork]
Script Date: 1/9/2022 09:16:21 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--exec [sp_GetDistributionChargesDeviceNetwork]
'10000009,10000008,10000003,10000001,10000000', '2022-07-31','2022-08-
02','2990000000002380700000','0099118822773366445555';

alter procedure [dbo].[sp_GetDistributionChargesExternalNetworkPartakers]


(
@DeviceAccountPartakerID VARCHAR(MAX),
@LastDayPreviusPeriod DATE,
@ProcessDate DATE,
@StartDate DATE,
@EndDate DATE
)
as
begin

if(@ProcessDate <> (SELECT dbo.[GetAccumulatedBusinessDays]


(@LastDayPreviusPeriod,2,1)))
BEGIN
return
END

select SettlementDate, TotalInterchange, PerceivedInterchange, AppliedPercentage,


DeviceID, DeviceAccountPartakerID
from DetailedInterchangeDistribution
inner join Clients as client on client.Id = 166
where --DeviceAccountPartakerID = 193
--''@DeviceAccountPartakerID
SettlementDate >= '2022-07-01' and SettlementDate <=
'2022-07-31';

END

select SettlementDate, TotalInterchange, PerceivedInterchange, AppliedPercentage,


detail.DeviceID, DeviceAccountPartakerID
from DetailedInterchangeDistribution AS detail
inner join DeviceAccountsPartakers as partaker on partaker.ClientID =
156
inner join DeviceAccounts as account on account.DeviceID =
detail.DeviceID
where detail.SettlementDate >= '2022-07-01' and detail.SettlementDate
<= '2022-07-31'

--18-17-13-3-10-14-2-9-19-7-16-21-48-69-76
select * from Devices where ID = 18

select * from DeviceAccountsPartakers --WHERE ClientID = 4 AND Discriminator =


'Interchange'
inner JOIN DetailedInterchangeDistribution AS detail ON detail.DeviceID =
DeviceAccountsPartakers.
select * from DeviceAccounts WHERE DeviceID = 17

USE [FinancialSwitch]
GO
/****** Object: StoredProcedure [dbo].[sp_GetCollaboratorsEmailsByCommunicationID]
Script Date: 2/9/2022 15:12:06 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

ALTER PROCEDURE [dbo].[sp_GetCollaboratorsEmailsByCommunicationID]


(
@communicationID BIGINT
)
AS
BEGIN
SELECT collaboratorUser.Email as Emails
FROM Communications communication
INNER JOIN ClientsCommunication clientsCommunication ON
clientsCommunication.CommunicationID = communication.ID
INNER JOIN Clients client ON client.ID = clientsCommunication.ClientID
INNER JOIN ClientsCollaborators clientsCollaborators ON
clientsCollaborators.ClientID = client.ID
INNER JOIN ClientCollaborators collaborator ON collaborator.ID =
clientsCollaborators.ClientCollaboratorID
INNER JOIN Users collaboratorUser ON
collaboratorUser.ClientCollaboratorID = collaborator.ID
WHERE Communication.ID = @communicationID
AND client.IsActive = 1
AND clientsCollaborators.IsActive = 1
AND collaborator.IsActive = 1
AND collaboratorUser.IsActive = 1
AND (clientsCommunication.MailSent = null OR
clientsCommunication.MailSent = 0)
GROUP BY collaboratorUser.Email
END

ALTER procedure [dbo].[sp_GetDistributionChargesExternalNetworkPartakers]


(
@ClientID VARCHAR(MAX),
@LastDayPreviusPeriod DATE,
@ProcessDate DATE,
@StartDate DATE,
@EndDate DATE,
@OctagonBankAccountARGCode VARCHAR(22),
@OctagonBankAccountEXTCode VARCHAR(22)
)
as
begin

if(@ProcessDate <> (SELECT dbo.[GetAccumulatedBusinessDays]


(@LastDayPreviusPeriod,2,1)))
BEGIN
return
END

/*select CreationDate , SettlementDate, TotalInterchange, PerceivedInterchange,


AppliedPercentage, DeviceID, DeviceAccountPartakerID
from DetailedInterchangeDistribution
where DeviceAccountPartakerID = @DeviceAccountPartakerID
and SettlementDate >= @StartDate and SettlementDate <=
@EndDate;
*/

select SettlementDate, TotalInterchange, PerceivedInterchange, AppliedPercentage,


DetailInterchangeDistribution.DeviceID, DeviceAccountPartakerID
FROM DetailedInterchangeDistribution DetailInterchangeDistribution
INNER JOIN DeviceAccountsPartakers DeviceAccountsPartaker ON
DetailInterchangeDistribution.DeviceAccountPartakerID = DeviceAccountsPartaker.ID
INNER JOIN SettlementRecords record ON record.ID =
DetailInterchangeDistribution.settlementRecordID
INNER JOIN NetworkEndpoints networkEndpoint ON networkEndpoint.NetworkEndpointID =
DetailInterchangeDistribution.SettlementProcessorID
INNER JOIN Devices device ON device.ID = DetailInterchangeDistribution.DeviceID
INNER JOIN Locations location ON location.ID = device.LocationID
INNER JOIN ClientsLocations as clientLocation ON clientLocation.LocationID =
location.ID
INNER JOIN Clients as client ON client.ID = clientLocation.ClientID
WHERE MONTH(DetailInterchangeDistribution.SettlementDate) =
MONTH(@LastDayPreviusPeriod)
AND YEAR(DetailInterchangeDistribution.SettlementDate) =
YEAR(@LastDayPreviusPeriod)
--PARA Q NO SALGA LA CUENTA DE OCTAGON
AND DeviceAccountsPartaker.BankAccountID not in (select ID from BankAccounts where
BankAccountCode in (@OctagonBankAccountARGCode,@OctagonBankAccountEXTCode))

--where DetailInterchangeDistribution.SettlementDate >= '2022-07-01' and


DetailInterchangeDistribution.SettlementDate <= '2022-07-31'
AND client.ID = @ClientID --32 --156 --166
ORDER BY DetailInterchangeDistribution.SettlementDate,
record.LocalTransactionDate ,record.LocalTransactionTime

END

You might also like