perubahan denomuretor on pos sale
This commit is contained in:
@@ -4,9 +4,18 @@ import 'package:hugeicons/hugeicons.dart';
|
||||
import 'package:mobile_pos/Screens/Sales/provider/sales_cart_provider.dart';
|
||||
import 'package:mobile_pos/Screens/Sales/sales_add_to_cart_sales_widget.dart';
|
||||
import 'package:mobile_pos/constant.dart';
|
||||
import 'package:mobile_pos/currency.dart';
|
||||
import 'package:mobile_pos/generated/l10n.dart' as lang;
|
||||
|
||||
/// Format a number as Indonesian Rupiah for display only.
|
||||
/// Example: 12500.75 → "Rp 12.500"
|
||||
String _formatRupiah(num value) {
|
||||
final intStr = value.round().toString().replaceAllMapped(
|
||||
RegExp(r'(\d)(?=(\d{3})+(?!\d))'),
|
||||
(m) => '${m[1]}.',
|
||||
);
|
||||
return 'Rp $intStr';
|
||||
}
|
||||
|
||||
class SalesCartListWidget extends ConsumerWidget {
|
||||
const SalesCartListWidget({super.key});
|
||||
|
||||
@@ -137,7 +146,7 @@ class SalesCartListWidget extends ConsumerWidget {
|
||||
|
||||
// 3. Qty Order
|
||||
Text(
|
||||
formatPointNumber(quantity),
|
||||
formatPointNumber(quantity, addComma: true),
|
||||
style: const TextStyle(fontWeight: FontWeight.bold),
|
||||
),
|
||||
const SizedBox(width: 8),
|
||||
@@ -158,7 +167,7 @@ class SalesCartListWidget extends ConsumerWidget {
|
||||
|
||||
// 5. Value Original
|
||||
Text(
|
||||
'$currency${formatPointNumber(originalTotal)}',
|
||||
_formatRupiah(originalTotal),
|
||||
style: TextStyle(
|
||||
color: kPeraColor,
|
||||
fontSize: 12,
|
||||
@@ -169,7 +178,7 @@ class SalesCartListWidget extends ConsumerWidget {
|
||||
// 6. Value VAT/Tax
|
||||
if (itemVAT > 0) ...[
|
||||
Text(
|
||||
'VAT: $currency${formatPointNumber(itemVAT)}',
|
||||
'VAT: ${_formatRupiah(itemVAT)}',
|
||||
style: TextStyle(
|
||||
color: kPeraColor,
|
||||
fontSize: 10,
|
||||
@@ -180,7 +189,7 @@ class SalesCartListWidget extends ConsumerWidget {
|
||||
|
||||
// 7. Sum (Value Original + VAT/Tax)
|
||||
Text(
|
||||
'$currency${formatPointNumber(finalTotal)}',
|
||||
_formatRupiah(finalTotal),
|
||||
style: _theme.textTheme.titleSmall?.copyWith(
|
||||
color: kMainColor,
|
||||
fontWeight: FontWeight.bold,
|
||||
|
||||
Reference in New Issue
Block a user