



SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

/****** Object:  StoredProcedure [dbo].[QSubPFrm_ListTafsiliHesab]    Script Date: 10/31/2023 15:21:56 ******/
IF  EXISTS (SELECT * FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[QSubPFrm_ListTafsiliHesab]') AND type in (N'P', N'PC'))
DROP PROCEDURE [dbo].[QSubPFrm_ListTafsiliHesab]
GO

USE [AC_444_1]
GO

/****** Object:  StoredProcedure [dbo].[QSubPFrm_ListTafsiliHesab]    Script Date: 10/31/2023 15:21:56 ******/
SET ANSI_NULLS ON
GO

SET QUOTED_IDENTIFIER ON
GO

 CREATE PROCEDURE [dbo].[QSubPFrm_ListTafsiliHesab] AS  
 SELECT     T_T_Heasb.THESABID, T_T_Heasb.THESABNumber AS CodeH, T_T_Heasb.DateCreate, T_T_Heasb.DateModified, T_T_Heasb.HESABID, T_T_Heasb.NameHesabT, T_T_Heasb.GOID,                        T_T_Heasb.TextName, T_T_Heasb.KolID, T_T_Heasb.Address, T_T_Heasb.Note, T_T_Heasb.Address2, T_T_Heasb.Telex, T_T_Heasb.Shahr, T_T_Heasb.CodPosti, T_T_Heasb.Ostan,                        T_T_Heasb.CodEghtesdi, T_T_Heasb.Keshvar, T_T_Heasb.BankHesab, T_T_Heasb.Mob, T_T_Heasb.Websit, T_T_Heasb.Phone1, T_T_Heasb.Phone2, T_T_Heasb.Email, T_T_Heasb.Active,                        T_T_Heasb.SaghfBed, T_T_Heasb.SaghfBes, T_T_Heasb.Commision, T_T_Heasb.UnitPriceFo, T_KolHesab.NameHesab AS KolName, T_Heasb.NameHesab AS MoinName,                        T_T_Heasb.THESABNumber, CASE WHEN Active = 0 THEN N'فعال' ELSE N'غیر فعال' END AS VAShESAB FROM         T_T_Heasb LEFT OUTER JOIN                       T_Heasb ON T_T_Heasb.HESABID = T_Heasb.HESABID LEFT OUTER JOIN                       T_KolHesab ON T_T_Heasb.KolID = T_KolHesab.KOLID ORDER BY  T_T_Heasb.THESABNumber DESC
GO


        ALTER PROCEDURE [dbo].[QSubPFrm_ListTafsiliHesabSF3] AS 
        
SELECT  T_T_HeasbSath2.THESABID, T_T_HeasbSath2.THESABNumber AS CodeH, T_T_HeasbSath2.NameHesabT, T_T_HeasbSath2.TextName, T_T_HeasbSath2.Address, T_T_HeasbSath2.Address2, 
               T_T_HeasbSath2.Telex, T_T_HeasbSath2.Shahr, T_T_HeasbSath2.CodPosti, T_T_HeasbSath2.Ostan, T_T_HeasbSath2.CodEghtesdi, T_T_HeasbSath2.Keshvar, T_T_HeasbSath2.BankHesab, 
               T_T_HeasbSath2.Mob, T_T_HeasbSath2.Websit, T_T_HeasbSath2.Phone1, T_T_HeasbSath2.Phone2, T_T_HeasbSath2.Email, T_T_HeasbSath2.Active, T_T_HeasbSath2.SaghfBed, T_T_HeasbSath2.SaghfBes, 
               T_T_HeasbSath2.Commision, T_T_HeasbSath2.UnitPriceFo, T_T_HeasbSath2.THESABNumber, T_T_Heasb.NameHesabT AS NameHesabTs1, T_T_Heasb.THESABNumber AS THESABNumbers1, 
               T_Heasb.NameHesab AS NameHesabm1
FROM     T_T_HeasbSath2 INNER JOIN
               [T_RelateTafSiliSath1-2] ON T_T_HeasbSath2.THESABID = [T_RelateTafSiliSath1-2].THesabIDSath2 INNER JOIN
               T_T_Heasb ON [T_RelateTafSiliSath1-2].THesabIDSath1 = T_T_Heasb.THESABID INNER JOIN
               T_Heasb ON T_T_Heasb.HESABID = T_Heasb.HESABID INNER JOIN
               T_KolHesab ON T_Heasb.KolID = T_KolHesab.KOLID
GROUP BY T_T_HeasbSath2.THESABID, T_T_HeasbSath2.THESABNumber, T_T_HeasbSath2.NameHesabT, T_T_HeasbSath2.TextName, T_T_HeasbSath2.Address, T_T_HeasbSath2.Address2, T_T_HeasbSath2.Telex, 
               T_T_HeasbSath2.Shahr, T_T_HeasbSath2.CodPosti, T_T_HeasbSath2.Ostan, T_T_HeasbSath2.CodEghtesdi, T_T_HeasbSath2.Keshvar, T_T_HeasbSath2.BankHesab, T_T_HeasbSath2.Mob, 
               T_T_HeasbSath2.Websit, T_T_HeasbSath2.Phone1, T_T_HeasbSath2.Phone2, T_T_HeasbSath2.Email, T_T_HeasbSath2.Active, T_T_HeasbSath2.SaghfBed, T_T_HeasbSath2.SaghfBes, 
               T_T_HeasbSath2.Commision, T_T_HeasbSath2.UnitPriceFo, T_T_Heasb.NameHesabT, T_T_Heasb.THESABNumber, T_Heasb.NameHesab
ORDER BY CodeH DESC
GO

BEGIN TRANSACTION
SET QUOTED_IDENTIFIER ON
SET ARITHABORT ON
SET NUMERIC_ROUNDABORT OFF
SET CONCAT_NULL_YIELDS_NULL ON
SET ANSI_NULLS ON
SET ANSI_PADDING ON
SET ANSI_WARNINGS ON
COMMIT
BEGIN TRANSACTION
GO
ALTER TABLE dbo.T_T_Heasb ADD
	CodeMelli nvarchar(255) NULL
GO
ALTER TABLE dbo.T_T_Heasb SET (LOCK_ESCALATION = TABLE)
GO
COMMIT
