feat(basicdata): tambahkan helper untuk penghitungan hari kerja dan pembaruan format mata uang

- Menambahkan helper `workingDays` untuk menghitung jumlah hari kerja antara dua tanggal.
- Menambahkan helper `holidays` untuk mendapatkan daftar tanggal libur.
- Memperbarui fungsi `format_currency` menjadi `currencyFormat` dengan menambahkan dokumentasi yang lebih jelas.
- Mengubah format desimal mata uang IDR menjadi 2 desimal di `CurrencySeeder`.
- Menambahkan file `HolidayCalendar.php` ke dalam daftar autoload di `module.json`.
- Menambahkan proses truncate sebelum insert data di seeder `CurrencySeeder`.
This commit is contained in:
Daeng Deni Mardaeni
2025-05-04 19:17:04 +07:00
parent 9049075b0f
commit 3a4c5bf4ca
4 changed files with 70 additions and 4 deletions

View File

@@ -2,8 +2,18 @@
use Modules\Basicdata\Models\Currency;
if(!function_exists('format_currency')) {
function format_currency($number, $currency = 'IDR') {
/**
* Format a number as a currency string with appropriate symbol and formatting.
*
* This function retrieves currency information from the database and formats
* the provided number according to the currency's specifications.
*
* @param float|int $number The number to be formatted as currency
* @param string $currency The currency code (default: 'IDR')
* @return string The formatted currency string with symbol and proper number formatting
*/
if(!function_exists('currencyFormat')) {
function currencyFormat($number, $currency = 'IDR') {
$currency = Currency::where('code', $currency)->first();
$symbol = $currency->symbol?? '';