Click here to Skip to main content
15,889,767 members

Comments by iAnkitBhatt (Top 6 by date)

iAnkitBhatt 28-Oct-21 2:50am View    
Thanks for quick reply.using EPPLUS only.

Exporting + formatting all things works fine.
BUT Formatting on data is issue after certain rows to excel.

i am doing the same with EPPLUS and exporting it including formatting when data is within one page. but when data is large formatting is not working proper.

issue is with "cell-style" which is not copying after certain rows let say 50.
all looping and execution logic is correct.datagrid is formatting all rows. data is also exporting with color formatting for rows which are visible on screen. the issue is when next rows required scroll that are not formatting at Excel side.
iAnkitBhatt 5-May-19 23:42pm View    
Gerry thanks for responding.

yes i am calculating however the period is open or closed for every fiscal year because.

in my application, there is a product table with different Invoice date and its age define audit report to government about depreciation.

and my requirement is not only between fiscal year period. sometime we need to calculate depreciation based on date of invoice or date of use which may be middle of the year. and as it seems like to calculate the straight line depreciation calculation i need to change product values next time/Fiscal year. the same can be possible at end date(Age) which may be middle of the year. so simply i need date ranges and day differences to calculate it.

and there is restriction to define any table for fiscal date range and the above solution query will be join of other query once i achieve this




but whatever you provide is correct logic flow ,if in case we want to manage a series table inside database server.

iAnkitBhatt 3-May-19 5:42am View    
One more try given but somehow not able to generate date range properly: Day difference is correct.

SQL QUERY:
DECLARE
@MinDate DATE = '2015-12-12',
@MaxDate DATE = '2018-12-12';

SELECT PT.* from (
SELECT FT.*,DATEADD(DAY, DayDifference-1, FT.StartDate) as EndDate from
(SELECT FiscalYear,Count(UT.dt) as DayDifference ,@MinDate as StartDate
from (select st.dt,year(dateadd(month, -3, st.dt)) as fiscalyear
from(SELECT TOP (DATEDIFF(DAY, @MinDate, @MaxDate) + 1)
DATEADD(DAY, ROW_NUMBER() OVER(ORDER BY a.object_id) - 1, @MinDate) as dt
FROM sys.all_objects a CROSS JOIN sys.all_objects b) as st) as UT
Group BY fiscalyear) as FT ) PT


OUTPUT:
FiscalYear DayDifference StartDate EndDate
2015 111 2015-12-12 2016-03-31
2016 365 2015-12-12 2016-12-10
2017 365 2015-12-12 2016-12-10
2018 256 2015-12-12 2016-08-23
iAnkitBhatt 2-May-19 23:44pm View    
there is no data. i need the expected output to perform further operation based on "Expected output" from provided two dates. simplifying my question again.

1. two dates as input.
2. the date range will be classified as per Indian financial years (April to march)
3. first range will start from start date. and last generated range willbe till End date only.
4. the day difference for each ranges generated.

future use:
5. further i can use that every day difference for financial application for Assets depreciation for each year
iAnkitBhatt 2-May-19 23:43pm View    
i am aware about date difference function between dates .
but unable to generate series as per requirement(eg. shown in "Expected output") so that further can use that range for calculation.