perbaikan on possale string 1
This commit is contained in:
@@ -23,6 +23,7 @@ import '../../Const/api_config.dart';
|
||||
import '../../GlobalComponents/glonal_popup.dart';
|
||||
import '../../Repository/API/future_invoice.dart';
|
||||
import '../../constant.dart';
|
||||
import '../../currency.dart';
|
||||
import '../../model/add_to_cart_model.dart';
|
||||
import '../../model/sale_transaction_model.dart';
|
||||
import '../../widgets/multipal payment mathods/multi_payment_widget.dart';
|
||||
@@ -36,12 +37,8 @@ import '../vat_&_tax/provider/text_repo.dart';
|
||||
|
||||
/// 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';
|
||||
String _formatWithCurrency(num value) {
|
||||
return '$currency${formatWithSeparator(value)}';
|
||||
}
|
||||
|
||||
class AddSalesScreen extends ConsumerStatefulWidget {
|
||||
@@ -311,8 +308,8 @@ class AddSalesScreenState extends ConsumerState<AddSalesScreen> {
|
||||
Text(lang.S.of(context).dueAmount),
|
||||
Text(
|
||||
widget.customerModel?.due == null
|
||||
? _formatRupiah(0)
|
||||
: _formatRupiah(widget.customerModel!.due ?? 0),
|
||||
? _formatWithCurrency(0)
|
||||
: _formatWithCurrency(widget.customerModel!.due ?? 0),
|
||||
style: const TextStyle(color: Color(0xFFFF8C34)),
|
||||
),
|
||||
],
|
||||
@@ -405,7 +402,7 @@ class AddSalesScreenState extends ConsumerState<AddSalesScreen> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
_formatRupiah(providerData.totalAmount),
|
||||
_formatWithCurrency(providerData.totalAmount),
|
||||
style: _theme.textTheme.titleSmall?.copyWith(
|
||||
fontWeight: FontWeight.w500,
|
||||
),
|
||||
@@ -611,7 +608,7 @@ class AddSalesScreenState extends ConsumerState<AddSalesScreen> {
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
_formatRupiah(num.tryParse(providerData.vatAmountController.text) ?? 0),
|
||||
_formatWithCurrency(num.tryParse(providerData.vatAmountController.text) ?? 0),
|
||||
style: _theme.textTheme.titleSmall,
|
||||
textAlign: TextAlign.right,
|
||||
),
|
||||
@@ -670,7 +667,7 @@ class AddSalesScreenState extends ConsumerState<AddSalesScreen> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
_formatRupiah(providerData.actualTotalAmount),
|
||||
_formatWithCurrency(providerData.actualTotalAmount),
|
||||
style: _theme.textTheme.titleSmall?.copyWith(
|
||||
fontWeight: FontWeight.w600,
|
||||
),
|
||||
@@ -697,7 +694,7 @@ class AddSalesScreenState extends ConsumerState<AddSalesScreen> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
_formatRupiah(providerData.roundingAmount),
|
||||
_formatWithCurrency(providerData.roundingAmount),
|
||||
style: _theme.textTheme.titleSmall?.copyWith(
|
||||
color: kPeraColor,
|
||||
),
|
||||
@@ -717,7 +714,7 @@ class AddSalesScreenState extends ConsumerState<AddSalesScreen> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
_formatRupiah(providerData.totalPayableAmount),
|
||||
_formatWithCurrency(providerData.totalPayableAmount),
|
||||
style: _theme.textTheme.titleSmall?.copyWith(
|
||||
color: kPeraColor,
|
||||
),
|
||||
@@ -751,7 +748,7 @@ class AddSalesScreenState extends ConsumerState<AddSalesScreen> {
|
||||
child: Align(
|
||||
alignment: Alignment.centerRight,
|
||||
child: Text(
|
||||
_formatRupiah(num.tryParse(recevedAmountController.text) ?? 0),
|
||||
_formatWithCurrency(num.tryParse(recevedAmountController.text) ?? 0),
|
||||
style: _theme.textTheme.titleSmall,
|
||||
textAlign: TextAlign.right,
|
||||
),
|
||||
@@ -799,7 +796,7 @@ class AddSalesScreenState extends ConsumerState<AddSalesScreen> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
_formatRupiah(providerData.changeAmount),
|
||||
_formatWithCurrency(providerData.changeAmount),
|
||||
style: _theme.textTheme.titleSmall?.copyWith(
|
||||
color: kPeraColor,
|
||||
),
|
||||
@@ -825,7 +822,7 @@ class AddSalesScreenState extends ConsumerState<AddSalesScreen> {
|
||||
),
|
||||
),
|
||||
Text(
|
||||
_formatRupiah(providerData.dueAmount),
|
||||
_formatWithCurrency(providerData.dueAmount),
|
||||
style: _theme.textTheme.titleSmall?.copyWith(
|
||||
color: kPeraColor,
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user