Repository navigation
Expand file tree
/
Copy pathProgram.cs
More file actions
32 lines (25 loc) · 1.6 KB
/
Copy pathProgram.cs
File metadata and controls
32 lines (25 loc) · 1.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
using System;
using IndiaKit.Dates;
using IndiaKit.Gst;
using IndiaKit.Identifiers;
using IndiaKit.Money;
Console.OutputEncoding = System.Text.Encoding.UTF8;
// Identifiers: precise reasons, not just true/false
Console.WriteLine(Gstin.Check("27AAPFU0939F1ZV")); // Valid
Console.WriteLine(Gstin.Check("27AAPFU0939F1ZX")); // Invalid check digit: expected 'V', got 'X'. Check for a typo.
var gstin = Gstin.Parse("27 aapfu 0939f 1zv");
Console.WriteLine($"{gstin} -> {gstin.State.Name}, PAN {gstin.Pan} ({gstin.Pan.HolderType})");
Console.WriteLine(Aadhaar.Mask("2341 2341 2346")); // XXXX XXXX 2346
Console.WriteLine(IndianMobile.ToE164("098765 43210")); // +919876543210
Console.WriteLine(Ifsc.BankCode("HDFC0001234")); // HDFC
// Money: Indian grouping, compact and in words
Console.WriteLine(Rupees.Format(12345678.9m)); // ₹1,23,45,678.90
Console.WriteLine(Rupees.FormatCompact(4_250_000m)); // ₹42.5 L
Console.WriteLine(Rupees.ToWords(118000m)); // Rupees One Lakh Eighteen Thousand Only
// GST: place of supply decides CGST+SGST or IGST
var interState = GstCalculator.IsInterState(supplierStateCode: "27", placeOfSupplyStateCode: gstin.StateCode);
Console.WriteLine(GstCalculator.Calculate(100_000m, 18m, interState));
Console.WriteLine(GstCalculator.FromInclusive(1180m, 18m, interState: true));
// Financial years
var fy = FinancialYear.For(new DateTime(2026, 10, 12));
Console.WriteLine($"{fy} | {fy.AssessmentYear.ToAssessmentYearString()} | Q{FinancialYear.QuarterOf(new DateTime(2026, 10, 12))} | invoice prefix INV/{fy.ToShortString()}/");