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:
@@ -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?? '';
|
||||
|
||||
|
||||
Reference in New Issue
Block a user