@ECHO ON
::ECHO ON
:: Find WeekNumber
SET /a D=1%DATE:~0,2% - 100
SET /a M=1%DATE:~3,2% - 100
SET /a Y=%DATE:~6,4%
SET /a N=(1461 * (%Y% + 4800 + (%M% - 14) / 12)) / 4 + (367 * (%M% - 2 - 12 * ((%M% - 14) / 12))) / 12 - (3 * ((%Y% + 4900 + (%M% - 14) / 12) / 100)) / 4 + %D% - 32075
SET /a T=(%N% + 31741 -(%N% %% 7)) %% 146097 %% 36524 %% 1461
SET /a W=((((%T% - (%T% / 1460)) %% 365) + (%T% / 1460)) / 7) + 1
SET WeekNumber=WEEK %W%
:: Format Date
SET Fdate=%date:~-4,4%.%date:~-7,2%.%date:~-10,2%
:: Input file
SET Sales=Sales ver5.0.xlsx
:: Set paths
SET ReportPath=\\mydomain.com\share\finance\JetReport
SET AutoPilot="%ProgramFiles(x86)%\JetReports\AutoPilot.exe"
SET path2=%ReportPath%\reportset\AutoUpdate
SET Output=%ReportPath%\AutoOutput
SET logfile=%ReportPath%\reportset\Script\log\logfile_week_%W%.log
echo %DATE% %TIME% Generate Report daily starts >> %logfile%
::@ECHO %W% - %fdate%
:: Create output folder
IF exist "%output%\%WeekNumber%" (Echo folder exist) else (mkdir "%output%\%WeekNumber%")
:: Create Excel
::@ECHO on
echo %DATE% %TIME% %WeekNumber%\Sales %Fdate%.xlsx >> %logfile%
%AutoPilot% /M "VALUES" /I "%path2%\%Sales%" /O "%Output%\%WeekNumber%\Sales %Fdate%.xlsx" >> %logfile%
IF %ERRORLEVEL% neq 0 echo %DATE% %TIME% Error Level is %ERRORLEVEL% >> %logfile%
:: Create PDF
echo %DATE% %TIME% %WeekNumber%\Sales %Fdate%.pdf >> %logfile%
%AutoPilot% /M "PDF" /I "%path2%\%Sales%" /O "%Output%\%WeekNumber%\Sales %Fdate%.pdf" >> %logfile%
IF %ERRORLEVEL% neq 0 echo %DATE% %TIME% Error Level is %ERRORLEVEL% >> %logfile%
echo %DATE% %TIME% Generate Report daily ends >> %logfile%
EXIT
27.04.2015 11:44:16,46 WEEK 18\Sales 2015.04.27.xlsx
27.04.2015 11:44:17,55 WEEK 18\Sales 2015.04.27.pdf
27.04.2015 11:44:18,38 Generate Report daily ends
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE