Another feature i hope there was shortcut to, but it seems i need to write it myself.
Just wanted to share it here
Coffee Cup
VFROM = VYEAR || '-1-1';
VTO = VYEAR || '-1-31';
SELECT SUM(Z.PAMT)
FROM PAYSLIP Z
WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
INTO :VAMT;
IF (VAMT IS NULL) THEN
PAMT1 = 0;
ELSE PAMT1 = VAMT;
/* /////////////////////////////// */
/* IF FEB LESS THAN MARCH 1 - THERE IS FEB 28 AND FEB 29 */
VFROM = VYEAR || '-2-1';
VTO = VYEAR || '-3-1';
SELECT SUM(Z.PAMT)
FROM PAYSLIP Z
WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO < :VTO AND Z.EID = :VEID
INTO :VAMT;
IF (VAMT IS NULL) THEN
PAMT2 = 0;
ELSE PAMT2 = VAMT;
/* /////////////////////////////// */
VFROM = VYEAR || '-3-1';
VTO = VYEAR || '-3-31';
SELECT SUM(Z.PAMT)
FROM PAYSLIP Z
WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
INTO :VAMT;
IF (VAMT IS NULL) THEN
PAMT3 = 0;
ELSE PAMT3 = VAMT;
/* /////////////////////////////// */
VFROM = VYEAR || '-4-1';
VTO = VYEAR || '-4-30';
SELECT SUM(Z.PAMT)
FROM PAYSLIP Z
WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
INTO :VAMT;
IF (VAMT IS NULL) THEN
PAMT4 = 0;
ELSE PAMT4 = VAMT;
/* /////////////////////////////// */
VFROM = VYEAR || '-5-1';
VTO = VYEAR || '-5-31';
SELECT SUM(Z.PAMT)
FROM PAYSLIP Z
WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
INTO :VAMT;
IF (VAMT IS NULL) THEN
PAMT5 = 0;
ELSE PAMT5 = VAMT;
/* /////////////////////////////// */
VFROM = VYEAR || '-6-1';
VTO = VYEAR || '-6-30';
SELECT SUM(Z.PAMT)
FROM PAYSLIP Z
WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
INTO :VAMT;
IF (VAMT IS NULL) THEN
PAMT6 = 0;
ELSE PAMT6 = VAMT;
/* /////////////////////////////// */
VFROM = VYEAR || '-7-1';
VTO = VYEAR || '-7-31';
SELECT SUM(Z.PAMT)
FROM PAYSLIP Z
WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
INTO :VAMT;
IF (VAMT IS NULL) THEN
PAMT7 = 0;
ELSE PAMT7 = VAMT;
/* /////////////////////////////// */
VFROM = VYEAR || '-8-1';
VTO = VYEAR || '-8-31';
SELECT SUM(Z.PAMT)
FROM PAYSLIP Z
WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
INTO :VAMT;
IF (VAMT IS NULL) THEN
PAMT8 = 0;
ELSE PAMT8 = VAMT;
/* /////////////////////////////// */
VFROM = VYEAR || '-9-1';
VTO = VYEAR || '-9-30';
SELECT SUM(Z.PAMT)
FROM PAYSLIP Z
WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
INTO :VAMT;
IF (VAMT IS NULL) THEN
PAMT9 = 0;
ELSE PAMT9 = VAMT;
/* /////////////////////////////// */
VFROM = VYEAR || '-10-1';
VTO = VYEAR || '-10-31';
SELECT SUM(Z.PAMT)
FROM PAYSLIP Z
WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
INTO :VAMT;
IF (VAMT IS NULL) THEN
PAMT10 = 0;
ELSE PAMT10 = VAMT;
/* /////////////////////////////// */
VFROM = VYEAR || '-11-1';
VTO = VYEAR || '-11-30';
SELECT SUM(Z.PAMT)
FROM PAYSLIP Z
WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
INTO :VAMT;
IF (VAMT IS NULL) THEN
PAMT11 = 0;
ELSE PAMT11 = VAMT;
/* /////////////////////////////// */
VFROM = VYEAR || '-12-1';
VTO = VYEAR || '-12-31';
SELECT SUM(Z.PAMT)
FROM PAYSLIP Z
WHERE Z.PDATE_COMPUTE_FROM >= :VFROM AND Z.PDATE_COMPUTE_TO <= :VTO AND Z.EID = :VEID
INTO :VAMT;
IF (VAMT IS NULL) THEN
PAMT12 = 0;
ELSE PAMT12 = VAMT;
/* /////////////////////////////// */
Thought of saving this one here. For those who still use delphi in 2023, here are the features you can access. Just in case you have questions or issues encountered, just drop me a line
Coffee Cup
...control Excel with OLE?
Autor: Thomas Stutz
[ Print tip ]
Tip Rating (503):
uses
ComObj;
var
ExcelApp: OleVariant;
implementation
procedure TForm1.Button1Click(Sender: TObject);
const
// SheetType
xlChart = -4109;
xlWorksheet = -4167;
// WBATemplate
xlWBATWorksheet = -4167;
xlWBATChart = -4109;
// Page Setup
xlPortrait = 1;
xlLandscape = 2;
xlPaperA4 = 9;
// Format Cells
xlBottom = -4107;
xlLeft = -4131;
xlRight = -4152;
xlTop = -4160;
// Text Alignment
xlHAlignCenter = -4108;
xlVAlignCenter = -4108;
// Cell Borders
xlThick = 4;
xlThin = 2;
var
ColumnRange: OleVariant;
// Function to get the number of Rows in a Certain column
function GetLastLine(AColumn: Integer): Integer;
const
xlUp = 3;
begin
Result := ExcelApp.Range[Char(96 + AColumn) + IntToStr(65536)].end[xlUp].Rows.Row;
end;
begin
{ Start Excel }
// By using GetActiveOleObject, you use an instance of Word that's already running,
// if there is one.
try
ExcelApp := GetActiveOleObject('Excel.Application');
except
try
// If no instance of Word is running, try to Create a new Excel Object
ExcelApp := CreateOleObject('Excel.Application');
except
ShowMessage('Cannot start Excel/Excel not installed ?');
Exit;
end;
end;
// Add a new Workbook, Neue Arbeitsmappe ?ffnen
ExcelApp.Workbooks.Add(xlWBatWorkSheet);
// Open a Workbook, Arbeitsmappe ?ffnen
ExcelApp.Workbooks.Open('c:\YourFileName.xls');
// Rename the active Sheet
ExcelApp.ActiveSheet.Name := 'This is Sheet 1';
// Rename
ExcelApp.Workbooks[1].WorkSheets[1].Name := 'This is Sheet 1';
// Insert some Text in some Cells[Row,Col]
ExcelApp.Cells[1, 1].Value := 'SwissDelphiCenter.ch';
ExcelApp.Cells[2, 1].Value := 'http://www.swissdelphicenter.ch';
ExcelApp.Cells[3, 1].Value := FormatDateTime('dd-mmm-yyyy', Now);
// Setting a row of data with one call
ExcelApp.Range['A2', 'D2'].Value := VarArrayOf([1, 10, 100, 1000]);
// Setting a formula
ExcelApp.Range['A11', 'A11'].Formula := '=Sum(A1:A10)';
// Change Cell Alignement
ExcelApp.Cells[2, 1].HorizontalAlignment := xlright;
// Change the Column Width.
ColumnRange := ExcelApp.Workbooks[1].WorkSheets[1].Columns;
ColumnRange.Columns[1].ColumnWidth := 20;
ColumnRange.Columns[2].ColumnWidth := 40;
// Change Rowheight / Zeilenh?he ?ndern:
ExcelApp.Rows[1].RowHeight := 15.75;
// Merge cells, Zellen verbinden:
ExcelApp.Range['B3:D3'].Mergecells := True;
// Apply borders to cells, Zellen umrahmen:
ExcelApp.Range['A14:M14'].Borders.Weight := xlThick; // Think line/ Dicke Linie
ExcelApp.Range['A14:M14'].Borders.Weight := xlThin; // Thin line D邦nne Linie
// Set Bold Font in cells, Fettdruck in den Zellen
ExcelApp.Range['B16:M26'].Font.Bold := True;
// Set Font Size, Schriftgr??e setzen
ExcelApp.Range['B16:M26'].Font.Size := 12;
//right-aligned Text, rechtsb邦ndige Textausrichtung
ExcelApp.Cells[9, 6].HorizontalAlignment := xlright;
// horizontal-aligned text, horizontale Zentrierung
ExcelApp.Range['B14:M26'].HorizontalAlignment := xlHAlignCenter;
// left-aligned Text, vertikale Zentrierung
ExcelApp.Range['B14:M26'].VerticallyAlignment := xlVAlignCenter;
{ Page Setup }
ExcelApp.ActiveSheet.PageSetup.Orientation := xlLandscape;
// Left, Right Margin (Seitenr?nder)
ExcelApp.ActiveSheet.PageSetup.LeftMargin := 35;
ExcelApp.ActiveSheet.PageSetup.RightMargin := -15;
// Set Footer Margin
ExcelApp.ActiveSheet.PageSetup.FooterMargin := ExcelApp.InchesToPoints(0);
// Fit to X page(s) wide by Y tall
ExcelApp.ActiveSheet.PageSetup.FitToPagesWide := 1; // Y
ExcelApp.ActiveSheet.PageSetup.FitToPagesTall := 3; // Y
// Zoom
ExcelApp.ActiveSheet.PageSetup.Zoom := 95;
// Set Paper Size:
ExcelApp.PageSetup.PaperSize := xlPaperA4;
// Show/Hide Gridlines:
ExcelApp.ActiveWindow.DisplayGridlines := False;
// Set Black & White
ExcelApp.ActiveSheet.PageSetup.BlackAndWhite := False;
// footers
ExcelApp.ActiveSheet.PageSetup.RightFooter := 'Right Footer / Rechte Fu?zeile';
ExcelApp.ActiveSheet.PageSetup.LeftFooter := 'Left Footer / Linke Fu?zeile';
// Show Excel Version:
ShowMessage(Format('Excel Version %s: ', [ExcelApp.Version]));
// Show Excel:
ExcelApp.Visible := True;
// Save the Workbook
ExcelApp.SaveAs('c:\filename.xls');
// Save the active Workbook:
ExcelApp.ActiveWorkBook.SaveAs('c:\filename.xls');
end;
procedure TForm1.FormDestroy(Sender: TObject);
begin
// Quit Excel
if not VarIsEmpty(ExcelApp) then
begin
ExcelApp.DisplayAlerts := False; // Discard unsaved files....
ExcelApp.Quit;
end;
end;
I have done a lot of contact us page in websites before and this one, i had to add email attachments as well. The secret to it was to upload it to your website before you can send it as an email attachment.
I had a case recently about their server that have zero 0 space remaining in their drive C. i have seen this issue before and it involves the dump files collected every time the server is restarted.
The path to the dump files can be “C:\Program Files\Microsoft SQL Server\MSSQL15.MSSQLSERVER\MSSQL\Log\Polybase\dump”
Another path is “X:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\Log”
Recently i have searched if there was a way to turn it off
Some have version folders
Version
Path
SQL Server 2019
C:\Windows\SysWOW64\SQLServerManager15.msc
SQL Server 2017
C:\Windows\SysWOW64\SQLServerManager14.msc
SQL Server 2016
C:\Windows\SysWOW64\SQLServerManager13.msc
SQL Server 2014
C:\Windows\SysWOW64\SQLServerManager12.msc
SQL Server 2012
C:\Windows\SysWOW64\SQLServerManager11.msc
net start “SQL Server (MSSQLSERVER)”
next i found is the data collector
USE msdb; GO EXEC dbo.sp_syscollector_disable_collector;
Instead of -password: Fetch password from the file so it is not visible in the command line. When <filename> is stdin, the user will be prompted for the password. [Firebird 2.5]
Database Shutdown
When a database has been shut down, only SYSDBA and the database owner are able to connect to the database in order to perform administrative tasks.
Options
-at[tach] <seconds>
Used with the -shut option. Waits <seconds> seconds for all current connections to end. If after <seconds> seconds there are still connections open, the shutdown will be cancelled and return an error.
-f[orce] <seconds>
Used with the -shut option. Waits <seconds> seconds for all connections and transactions to end. After this time, all connections and transactions are cancelled and the database is shut down. Use with caution.
-o[nline]
If a -shut operation is pending, it is cancelled. Otherwise, takes a database back online
-sh[ut]
Shut down database. Must be used together with -attach, -force or -tran
-shut {normal | multi | single | full}-online {normal | multi | single | full}
Firebird 2.0 and later: New shutdown modes:NORMAL: Database is active and online MULTI: Only connection from SYSDBA and the Database Owner will be allowed (compatible mode with Firebird 1.0/1.5) SINGLE: Only one SYSDBA or Database Owner connection will be allowed FULL: Exclusive shutdown: Database is completely offline, no connections will be allowed (it is now possible to access the database file safely on a file basis, e.g. for backups)Use -shut to “go down” the scale of shutting down and -online to “go up” that scale.
-tr[an] <seconds>
Used with the -shut option. Waits <seconds> seconds for all running transactions to end. If after <seconds> seconds there are still running transactions, the shutdown will be cancelled.
Examples
Shut down database, wait 60 seconds until all connections are closed
Recently i encountered a problem that doesn’t allow me to add a shared printer. It seems to be new so it might have something to do with the windows update.
Then i found the solutions. Its to add a registry entry. here it is :
HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Print\RpcAuthnLevelPrivacyEnabled to 0