I have a stored procedure each and every column has its own datatype.
Every column which has int as a datatype, the final total of that column needs to be calculated and displayed using angularjs or c#.
Stored_Procedure :
USE [ERPT]
GO
/****** Object: StoredProcedure [dbo].[GET_WH_RECEIPT] Script Date: 6/13/2019 11:55:28 AM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
--EXEC GET_WH_RECEIPT @INVOICENO = '211'
ALTER PROCEDURE [dbo].[GET_WH_RECEIPT]
@INVOICENO VARCHAR(50)=NULL
AS
BEGIN
DECLARE @STARTDATE DATETIME,@ENDDATE DATETIME
SELECT @STARTDATE = DATEADD(MONTH,-7,STARTDATE),@ENDDATE = ENDDATE FROM FINANCIALYEAR where getdate() between startdate and enddate
SELECT
DD.DISPATCHID,
DD.PARTID,
DD.CUSTOMERID,
PART.PARTNAME,
REPLACE(REPLACE(PART.PARTNO,'-',''),'.','') PARTNO,
CONVERT(VARCHAR(10), DD.DISPATCHTIME, 103) 'InvoiceDate',
DD.NUMBERS,
DC.CURRENCYRATE,
DC.CURRENCYAMOUNT,
DC.INRRATE 'ExchangeRate',
DC.INRAMOUNT,
CAST((Dc.INRAMOUNT/DD.NUMBERS) AS DECIMAL(18,2)) 'UNITAMT',
isnull(PALLETQTY,0)'PalletCapacity',
isnull(DD.NUMBERS/NULLIF(PALLETQTY,0),0) 'NoofPallets',
DISPATCH.INVOICEID,
WAREHOUSE.ISSUEDQTY,
WAREHOUSE.STOCK,
WAREHOUSE.STATUS
INTO #TEMPWH
FROM DISPATCH_DAILY DD
INNER JOIN DISPATCH_CURRENCY DC ON DC.DISPATCHID = DD.DISPATCHID
INNER JOIN PART ON PART.PARTID = DD.PARTID
LEFT JOIN part_pallet_master PPM ON PPM.PARTID = DD.PARTID AND PPM.CUSTOMERID = DD.CUSTOMERID
LEFT JOIN DISPATCH ON DISPATCH.INVOICEno = DD.INVOICEno AND DISPATCH.CREATEDDATE >= @STARTDATE
LEFT JOIN WAREHOUSE ON WAREHOUSE.DISPATCHID = DD.DISPATCHID
WHERE DD.INVOICENO = @INVOICENO AND DISPATCHTIME >= @STARTDATE AND DISPATCHTIME <= @ENDDATE
ORDER BY WAREHOUSE.STOCK DESC
SELECT * FROM #TEMPWH
end
I need it in dynamic method i.e. retrieving the total from the api or in stored procedure.