AutomatedBilling/MonthEndScript
From MikroTik Wiki
Revision as of 13:52, 26 October 2007 by Krigevr (talk | contribs) (New page: This is the Month End script attached to the Automated Billing System. :local date :local day :local month :local year :local yeardiv :local yearmult :l...)
This is the Month End script attached to the Automated Billing System.
:local date
:local day
:local month
:local year
:local yeardiv
:local yearmult
:local leapyear
:local lastday
:global found
:set date [system clock get date]
:set month [:pick $date 0 3]
:set day [:pick $date 4 6]
:set year [:pick $date 7 11]
:set yeardiv ($year / 4)
:set yearmult ($yeardiv * 4)
:if ([$yearmult] = $year) do={ :set leapyear true } else={ :set leapyear false }
:if ([$month] = jan) do={ :set lastday 31 }
:if ([$month] = feb) do={
:if ($leapyear = true) do={ :set lastday 29 }
:if ($leapyear = false) do={ :set lastday 28 } }
:if ([$month] = mar) do={ :set lastday 31 }
:if ([$month] = apr) do={ :set lastday 30 }
:if ([$month] = may) do={ :set lastday 31 }
:if ([$month] = jun) do={ :set lastday 30 }
:if ([$month] = jul) do={ :set lastday 31 }
:if ([$month] = aug) do={ :set lastday 31 }
:if ([$month] = sep) do={ :set lastday 30 }
:if ([$month] = oct) do={ :set lastday 31 }
:if ([$month] = nov) do={ :set lastday 30 }
:if ([$month] = dec) do={ :set lastday 31 }
:if ([$lastday] = $day) do={ :set found true } else={ :set found false }