Skip to content

Instantly share code, notes, and snippets.

View hasokeric's full-sized avatar
👋

Haso Keric hasokeric

👋
View GitHub Profile
@hasokeric
hasokeric / MS SQL JSON Schema.sql
Created August 28, 2024 15:14
MS SQL JSON Schema
WITH fk_info AS (
SELECT
JSON_QUERY(
'[' + STRING_AGG(
CONVERT(nvarchar(max),
JSON_QUERY(N'{"schema": "' + COALESCE(REPLACE(kcu.CONSTRAINT_SCHEMA, '"', ''), '') COLLATE SQL_Latin1_General_CP1_CI_AS +
'", "table": "' + COALESCE(REPLACE(kcu.TABLE_NAME, '"', ''), '') COLLATE SQL_Latin1_General_CP1_CI_AS +
'", "column": "' + COALESCE(REPLACE(kcu.COLUMN_NAME, '"', ''), '') COLLATE SQL_Latin1_General_CP1_CI_AS +
'", "foreign_key_name": "' + COALESCE(REPLACE(kcu.CONSTRAINT_NAME, '"', ''), '') COLLATE SQL_Latin1_General_CP1_CI_AS +
'", "reference_table": "' + COALESCE(REPLACE(rcu.TABLE_NAME, '"', ''), '') COLLATE SQL_Latin1_General_CP1_CI_AS +
@hasokeric
hasokeric / ACH-File-ASCII.txt
Last active June 11, 2024 16:01
Epicor NACHA File
+----------------------------+
| File Transmission Record |
+----------------------------+
|
v
+----------------------------+ <--------- First physical record(s) on file
| File Header Record | <--------- Type 1 - File Header Record
+----------------------------+ <--------- One per file - first logical record on file
|
v
@hasokeric
hasokeric / NACHA-CheckDigit-ExampleFuncs.cs
Last active June 3, 2024 12:11
NACHA Check Digit Validation and Extraction
using System;
using System.Linq;
public class Program
{
public static void Main()
{
Func<string, int> GetCheckDigit = _routingNumber =>
(10 - _routingNumber.Where(char.IsDigit)
.Select((digit, index) => (digit - '0') * new[] { 3, 7, 1 }[index % 3])
@hasokeric
hasokeric / Epicor Kinetic Dashboard Problems.md
Last active May 30, 2024 17:26
Epicor Kinetic Dashboard Problems
@hasokeric
hasokeric / Epicor-Part-Number-Standards-Example2.md
Last active May 30, 2024 11:28
Part Numbering Standards for Epicor

ERP Part Numbering Standards for Manufacturing

Epicor Recommendations: Part Numbering

Introduction

This document serves as a guideline for developing and using good part numbering techniques within a manufacturing company. It addresses accidental and overly complex part numbering schemes which may become unmanageable and highlights that a part number is generally NOT a description of the part.

Definition

A part number should not attempt to be descriptive as it could lead to complications over time, such as changes in manufacturing or purchasing processes. The focus is on using the part number as a primary index within an ERP system.

@hasokeric
hasokeric / test.sh
Created November 27, 2023 12:59
test
#!/bin/bash
# We don't need return codes for "$(command)", only stdout is needed.
# Allow `[[ -n "$(command)" ]]`, `func "$(command)"`, pipes, etc.
# shellcheck disable=SC2312
set -u
abort() {
printf "%s\n" "$@" >&2
@hasokeric
hasokeric / UnderIssuedBPMCustShipUpdate.cs
Last active May 29, 2024 20:03
Under Issued Material on CustShip Count
// Count up the UnderIssuedMtls and UnderReportedOprs to show in the ShipDtl grid on Summary Tab
foreach (var row in ttShipDtl.Where(x => x.OurJobShipQty > 0).ToList())
{
// Get all the UnderIssuedMtl Count
int UnderIssuedMtlCount = (from jp in Db.JobPart
join jm in Db.JobMtl on new { jp.Company, jp.JobNum } equals new { jm.Company, jm.JobNum }
where jp.Company == row.Company &&
jp.JobNum == row.JobNum &&
jp.PartNum == row.PartNum &&
@hasokeric
hasokeric / GetNewUBAQExample.cs
Created August 30, 2023 13:35
GetNewBase UBAQ
//var x = defaultImpl.CreateEmpty(result);
//this.resultHolder.Attach(QueryResultDataSetUbaqTableset.FromDataSet(result));
ResultsUbaqRow row = (ResultsUbaqRow)result.Results.NewRow();
row.SysRowID = Guid.NewGuid();
row.Calculated_RowStatus = "Meow";
row.RowIdent = row.SysRowID.ToString();
row.RowMod = "A";
var z = ((ResultsUbaqTable)result.Results);
@hasokeric
hasokeric / swa.txt
Created August 16, 2023 12:55
swa deploy to azure static web apps
swa deploy .\build\ --env production --app-name swa
@hasokeric
hasokeric / JoinsAndResourceCalTests.cs
Created May 17, 2023 14:19
Messing Around with JOINs ResourceCal
var resourceGroupRows = Db.ResourceGroup.Where(x => x.Company == Session.CompanyID
&& x.Inactive == false
&&
).ToList();
var resourceCalRows = Db.ResourceCal.Where(x => x.Company == Session.CompanyID
&& x.SpecialDay >= DateTime.Today
).Join(Db.ResourceGroup,
rc => new { rc.Company, rc.ResourceGrpID, Inactive = false },
rg => new { rg.Company, rg.ResourceGrpID, rg.Inactive },