Skip to content

Instantly share code, notes, and snippets.

View nikolasd's full-sized avatar
🏠
Working from home

Nikolas Demiridis nikolasd

🏠
Working from home
View GitHub Profile
find /my/folder/subfolder/ -type f -exec du -Sh {} + | sort -rh | head -n 5
@nikolasd
nikolasd / change_client_supplier_codes.sql
Last active August 23, 2023 10:53
Pylon SQL - Αλλαγή κωδικών πελατών και προμηθευτών σε αύξουσα αρίθμηση, διατηρώντας το πρόθεμα ΠΕΛΑ- και ΠΡΟΜ-
UPDATE hecustomers
SET hecode = a.newcode
FROM (SELECT
heid,
concat(LEFT(hecode, 5), RIGHT(concat('00000000', ROW_NUMBER() OVER (ORDER BY hecode)), 8)) AS newcode
FROM hecustomers) AS a
INNER JOIN hecustomers
ON hecustomers.heid = a.heid
UPDATE hesuppliers
@nikolasd
nikolasd / find_accounting_template_by_docseries.sql
Last active March 8, 2019 12:17
Pylon SQL - Εύρεση όλων των εισπρακτικών παραστατικών που χρησιμοποιούν συγκεκριμένη γέφυρα
SELECT
ser.heCode AS DOCSERIES,
ser.heShortcut AS DOCSERIESSHORTCUT,
ser.heName AS DOCSERIESNAME,
typ.heCode AS DOCTYPE,
typ.heName AS DOCTYPENAME,
acc.heCode AS ACCTMP,
acc.heName AS ACCTPMNAME,
cmp.heName AS CMP
FROM heDocSeries AS ser
@nikolasd
nikolasd / update-reference-number
Last active October 23, 2018 12:57
Όταν μας βγάζει σφάλμα ότι δεν μπορεί να αποθηκευθεί μία εγγραφή, γιατί η τιμή υπάρχει είδη και αναφέρετε στο Unique Index του ReferenceNumber.
-- Update sequence current value with max reference number
-- example is for HEITEMS sequence
DECLARE @refno int = (SELECT
CAST(MAX(HEITEMS.herefnumber) AS int)
FROM HEITEMS)
DECLARE @inc int = (SELECT
CAST(current_value AS int)
FROM sys.sequences
WHERE name LIKE 'HEITEMS%')
@nikolasd
nikolasd / multiple_dbs_backup
Last active October 23, 2018 12:19
Backup multiple DBs at once. Exclude specific DBs
-- Check DBs
/*
DECLARE @pylonVer varchar(20) -- current pylon ver
-- specify current pylon version
SET @pylonVer = '170432'
SELECT
name
FROM master.dbo.sysdatabases
@nikolasd
nikolasd / convert_str_to_datetime.js
Last active October 23, 2018 13:56
Pylon Script - Convert String to DateTime
// Convert String to DateTime with ParseExact
docEntry.SetValue("OfficialDate", DateTime.ParseExact(Convert.ToString(listDic[0]["OfficialDate"]), "yyyy-MM-dd hh:mm:ss", System.Globalization.CultureInfo.InvariantCulture))
@nikolasd
nikolasd / sales.sql
Last active January 6, 2020 18:39
Pylon SQL - Λίστα πωλήσεων
SELECT
DOCENTRIES.HEID,
DOCENTRIES.HEENTRYDATE,
DOCENTRIES.HEOFFICIALDATE,
DOCENTRIES.HEDOCCODE,
DOCENTRIES.HESTATUS,
DOCENTRIES.HEDOCNUM,
DOCENTRIES.HESOURCETYPE,
DOCENTRIES.HEDCSRID,
DOCENTRIES.HEDCSRTYPE,
@nikolasd
nikolasd / find_db_version.sql
Last active October 23, 2018 13:01
Pylon SQL - Εύρεση της έκδοσης της βάσης
SELECT
POVALSTR
FROM POSYS
WHERE POKEY = 'Application Version'
@nikolasd
nikolasd / find_hotel_creditors.sql
Last active October 23, 2018 13:35
Pylon SQL - Εύρεση των χρεωστών του Ξενοδοχείου
SELECT
*
FROM HECUSTOMERS
INNER JOIN HEHOTELCUSTOMERS
ON HEHOTELCUSTOMERS.HECSTMID = HECUSTOMERS.HEID
WHERE HEHOTELCUSTOMERS.HECUSTTYPE = '1'
@nikolasd
nikolasd / find_docseries_with_scaffold.sql
Last active October 23, 2018 13:36
Pylon SQL - Εύρεση όλων των εμπορικών παραστατικών που χρησιμοποιούν συγκεκριμένη γέφυρα
SELECT
ser.heCode AS DOCSERIES,
ser.heShortcut AS DOCSERIESSHORTCUT,
ser.heName AS DOCSERIESNAME,
typ.heCode AS DOCTYPE,
typ.heName AS DOCTYPENAME,
acc.heCode AS ACCTMP,
acc.heName AS ACCTPMNAME,
cmp.heName AS CMP
FROM heDocSeries AS ser