perbaikan on possale string 1

This commit is contained in:
2026-04-18 22:45:08 +07:00
parent d912b1f63a
commit b1781625f2
2693 changed files with 366 additions and 6459 deletions

View File

@@ -1,5 +1,6 @@
class APIConfig {
static String domain = 'https://kulakpos.id/';
static String domain = 'http://localhost:8000/';
//static String domain = 'https://dev.kulakpos.id/';
static String url = '${domain}api/v1';
static String registerUrl = '/sign-up';
static String businessCategoriesUrl = '/business-categories';

View File

@@ -116,7 +116,7 @@ Widget salesTransactionWidget({
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'${lang.S.of(context).total} : $currency${formatPointNumber(sale.totalAmount ?? 0)}',
'${lang.S.of(context).total} : $currency${formatWithSeparator(sale.totalAmount ?? 0)}',
style: theme.textTheme.titleSmall?.copyWith(
color: kPeraColor,
fontWeight: FontWeight.w500,
@@ -125,7 +125,7 @@ Widget salesTransactionWidget({
const SizedBox(width: 4),
if (sale.dueAmount!.toInt() != 0)
Text(
'${lang.S.of(context).paid} : $currency${formatPointNumber(
'${lang.S.of(context).paid} : $currency${formatWithSeparator(
(sale.totalAmount!.toDouble() - sale.dueAmount!.toDouble()),
)}',
style: theme.textTheme.titleSmall?.copyWith(
@@ -143,7 +143,7 @@ Widget salesTransactionWidget({
if (fromLossProfit ?? false) ...{
Flexible(
child: Text(
'${lang.S.of(context).profit} : $currency ${formatPointNumber(sale.detailsSumLossProfit ?? 0)}',
'${lang.S.of(context).profit} : $currency ${formatWithSeparator(sale.detailsSumLossProfit ?? 0)}',
style: theme.textTheme.titleSmall?.copyWith(
color: Colors.green,
fontWeight: FontWeight.w500,
@@ -152,7 +152,7 @@ Widget salesTransactionWidget({
),
Flexible(
child: Text(
'${lang.S.of(context).loss}: $currency ${formatPointNumber(sale.detailsSumLossProfit!.abs())}',
'${lang.S.of(context).loss}: $currency ${formatWithSeparator(sale.detailsSumLossProfit!.abs())}',
style: theme.textTheme.titleSmall?.copyWith(
color: Colors.redAccent,
fontWeight: FontWeight.w500,
@@ -164,8 +164,8 @@ Widget salesTransactionWidget({
Flexible(
child: Text(
(returnAmount != null)
? '${_lang.returnedAmount}: $currency${formatPointNumber(returnAmount)}'
: '${lang.S.of(context).paid} : $currency${formatPointNumber((sale.totalAmount!.toDouble() - sale.dueAmount!.toDouble()))}',
? '${_lang.returnedAmount}: $currency${formatWithSeparator(returnAmount)}'
: '${lang.S.of(context).paid} : $currency${formatWithSeparator((sale.totalAmount!.toDouble() - sale.dueAmount!.toDouble()))}',
style: theme.textTheme.titleSmall?.copyWith(fontWeight: FontWeight.w500),
maxLines: 2,
),
@@ -174,8 +174,8 @@ Widget salesTransactionWidget({
Flexible(
child: Text(
(returnAmount != null)
? '${_lang.returnedAmount}: $currency${formatPointNumber(returnAmount)}'
: '${lang.S.of(context).due}: $currency${formatPointNumber(sale.dueAmount ?? 0)}',
? '${_lang.returnedAmount}: $currency${formatWithSeparator(returnAmount)}'
: '${lang.S.of(context).due}: $currency${formatWithSeparator(sale.dueAmount ?? 0)}',
maxLines: 2,
style: theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w500,

View File

@@ -5,6 +5,7 @@ import 'package:nb_utils/nb_utils.dart';
import '../Screens/Purchase/Repo/purchase_repo.dart';
import '../Screens/vat_&_tax/model/vat_model.dart';
import '../constant.dart';
final cartNotifierPurchaseNew = ChangeNotifierProvider((ref) => CartNotifierPurchase());
@@ -102,7 +103,7 @@ class CartNotifierPurchase extends ChangeNotifier {
}
if (selectedVat?.rate != null) {
vatAmount = (totalPayableAmount * selectedVat!.rate!) / 100;
vatAmountController.text = vatAmount.toStringAsFixed(2);
vatAmountController.text = formatWithSeparator(vatAmount);
}
totalPayableAmount += vatAmount;

View File

@@ -2,7 +2,8 @@ import 'package:flutter/cupertino.dart';
import 'package:flutter_easyloading/flutter_easyloading.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:http/http.dart' as http;
import 'package:restart_app/restart_app.dart';
import '../../../constant.dart';
import 'package:shared_preferences/shared_preferences.dart';
import '../../../Const/api_config.dart';
@@ -10,22 +11,33 @@ import '../../../Repository/constant_functions.dart';
import '../../../currency.dart';
class LogOutRepo {
Future<void> signOut() async {
Future<void> signOut({BuildContext? context}) async {
final prefs = await SharedPreferences.getInstance();
await prefs.remove("token");
await prefs.remove("hasShownExpiredDialog");
CurrencyMethods().removeCurrencyFromLocalDatabase();
EasyLoading.showSuccess('Successfully Logged Out');
Restart.restartApp();
try {
restartApp();
} catch (e) {
debugPrint('Error restarting app: $e');
}
if (context != null && context.mounted) {
Navigator.pushNamedAndRemoveUntil(context, '/signIn', (route) => false);
}
}
Future<void> signOutApi() async {
Future<void> signOutApi({BuildContext? context}) async {
final uri = Uri.parse('${APIConfig.url}/sign-out');
await http.get(uri, headers: {
'Accept': 'application/json',
'Authorization': await getAuthToken(),
});
await signOut();
try {
await http.get(uri, headers: {
'Accept': 'application/json',
'Authorization': await getAuthToken(),
});
} catch (e) {
debugPrint('Error during sign-out API call: $e');
}
await signOut(context: context);
}
}

View File

@@ -239,8 +239,8 @@ class _CustomerDetailsState extends ConsumerState<CustomerDetails> {
lang.S.of(context).type: widget.party.type,
lang.S.of(context).phoneNumber: widget.party.phone,
lang.S.of(context).email: widget.party.email ?? "n/a",
lang.S.of(context).dueBalance: "$currency${(widget.party.due ?? "0")}",
lang.S.of(context).walletBalance: "$currency${(widget.party.wallet ?? "0")}",
lang.S.of(context).dueBalance: "$currency${formatWithSeparator(widget.party.due ?? 0)}",
lang.S.of(context).walletBalance: "$currency${formatWithSeparator(widget.party.wallet ?? 0)}",
lang.S.of(context).address: widget.party.address ?? "n/a",
// "Party Credit Limit": widget.party.creditLimit ?? "0",
// "Party GST": widget.party.creditLimit ?? "0",

View File

@@ -392,7 +392,7 @@ class _PartyListScreenState extends State<PartyListScreen> {
),
const SizedBox(width: 4),
Text(
statusAmount != null ? '$currency${statusAmount.toStringAsFixed(2)}' : '',
statusAmount != null ? '$currency${formatWithSeparator(statusAmount)}' : '',
style: _theme.textTheme.bodyMedium?.copyWith(fontSize: 16.0),
),
],

View File

@@ -237,7 +237,7 @@ class _DueCollectionScreenState extends State<DueCollectionScreen> {
TextSpan(
text: widget.customerModel.due == null
? '$currency${0}'
: '$currency${widget.customerModel.due!}',
: '$currency${formatWithSeparator(widget.customerModel.due!)}',
style: const TextStyle(color: Color(0xFFFF8C34)),
),
]),
@@ -292,7 +292,7 @@ class _DueCollectionScreenState extends State<DueCollectionScreen> {
style: const TextStyle(fontSize: 16),
),
Text(
dueAmount.toStringAsFixed(2),
formatWithSeparator(dueAmount),
style: const TextStyle(fontSize: 16),
),
],
@@ -339,7 +339,7 @@ class _DueCollectionScreenState extends State<DueCollectionScreen> {
style: const TextStyle(fontSize: 16),
),
Text(
calculateDueAmount(total: paidAmount).toStringAsFixed(2),
formatWithSeparator(calculateDueAmount(total: paidAmount)),
style: const TextStyle(fontSize: 16),
),
],

View File

@@ -131,7 +131,7 @@ class _DueCalculationContactScreenState extends State<DueCalculationContactScree
),
const SizedBox(width: 4),
Text(
'$currency ${dueCustomerList[index].due}',
'$currency ${formatWithSeparator(dueCustomerList[index].due ?? 0)}',
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: 16.0,
),

View File

@@ -105,7 +105,7 @@ class _HomeScreenState extends ConsumerState<HomeScreen> {
await BranchRepo().exitBranch(id: details.data?.user?.activeBranchId.toString() ?? '');
if (switched) {
Restart.restartApp();
restartApp();
}
EasyLoading.dismiss();
}

View File

@@ -206,15 +206,15 @@ class _ProductDetailsState extends ConsumerState<ProductDetails> {
: '0'),
_lang.mrpOrSalePrice: (snapshot.stocks?.isNotEmpty == true &&
snapshot.stocks!.first.productSalePrice != null
? '$currency${snapshot.stocks!.first.productSalePrice}'
? '$currency${formatWithSeparator(snapshot.stocks!.first.productSalePrice!)}'
: '0'),
_lang.wholeSalePrice: (snapshot.stocks?.isNotEmpty == true &&
snapshot.stocks!.first.productWholeSalePrice != null
? '$currency${snapshot.stocks!.first.productWholeSalePrice}'
? '$currency${formatWithSeparator(snapshot.stocks!.first.productWholeSalePrice!)}'
: '0'),
_lang.dealerPrice: (snapshot.stocks?.isNotEmpty == true &&
snapshot.stocks!.first.productDealerPrice != null
? '$currency${snapshot.stocks?.first.productDealerPrice}'
? '$currency${formatWithSeparator(snapshot.stocks!.first.productDealerPrice!)}'
: '0'),
_lang.manufactureDate:
(snapshot.stocks?.isNotEmpty == true && snapshot.stocks!.first.mfgDate != null)
@@ -279,7 +279,7 @@ class _ProductDetailsState extends ConsumerState<ProductDetails> {
.toStringAsFixed(2)
: 'n/a',
'${_lang.profitMargin} (%)': '${snapshot.profitPercent ?? 0}%',
_lang.sellingPrice: '$currency${snapshot.productSalePrice ?? 0}',
_lang.sellingPrice: '$currency${formatWithSeparator(snapshot.productSalePrice ?? 0)}',
_lang.warranty:
'${snapshot.warrantyGuaranteeInfo?.warrantyDuration?.toString() ?? ''} ${snapshot.warrantyGuaranteeInfo?.warrantyUnit?.toString() ?? 'n/a'}',
_lang.guarantee:
@@ -337,7 +337,7 @@ class _ProductDetailsState extends ConsumerState<ProductDetails> {
),
Flexible(
child: Text(
'${_lang.sale}: $currency${snapshot.stocks?[index].productSalePrice ?? '0'}',
'${_lang.sale}: $currency${formatWithSeparator(snapshot.stocks?[index].productSalePrice ?? 0)}',
style: theme.textTheme.bodyMedium?.copyWith(
color: kTitleColor,
fontWeight: FontWeight.w400,
@@ -511,7 +511,7 @@ class _ProductDetailsState extends ConsumerState<ProductDetails> {
),
),
Text(
'$currency${combo.stock?.productSalePrice ?? 0}',
'$currency${formatWithSeparator(combo.stock?.productSalePrice ?? 0)}',
style: theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w500,
),

View File

@@ -345,8 +345,8 @@ class _ProductListState extends ConsumerState<ProductList> {
),
Text(
product.productType == 'combo'
? '$currency${product.productSalePrice.toString()}'
: "$currency${product.stocks != null && product.stocks!.isNotEmpty && product.stocks!.first.productSalePrice != null ? product.stocks!.first.productSalePrice : '0'}",
? '$currency${formatWithSeparator(product.productSalePrice ?? 0)}'
: "$currency${formatWithSeparator(product.stocks != null && product.stocks!.isNotEmpty && product.stocks!.first.productSalePrice != null ? product.stocks!.first.productSalePrice : 0)}",
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: _theme.textTheme.titleMedium?.copyWith(

View File

@@ -177,14 +177,14 @@ class PurchaseReportState extends State<PurchaseListScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'${lang.S.of(context).total} : $currency ${purchaseTransactions[index].totalAmount.toString()}',
'${lang.S.of(context).total} : $currency${formatWithSeparator(purchaseTransactions[index].totalAmount ?? 0)}',
style: _theme.textTheme.bodyMedium
?.copyWith(fontSize: 14, color: DAppColors.kSecondary),
),
const SizedBox(width: 4),
if (purchaseTransactions[index].dueAmount!.toInt() != 0)
Text(
'${lang.S.of(context).paid} : $currency ${purchaseTransactions[index].totalAmount!.toDouble() - purchaseTransactions[index].dueAmount!.toDouble()}',
'${lang.S.of(context).paid} : $currency ${formatWithSeparator(purchaseTransactions[index].totalAmount!.toDouble() - purchaseTransactions[index].dueAmount!.toDouble())}',
style: _theme.textTheme.bodyMedium
?.copyWith(fontSize: 14, color: DAppColors.kSecondary),
),
@@ -198,7 +198,7 @@ class PurchaseReportState extends State<PurchaseListScreen> {
if (purchaseTransactions[index].dueAmount!.toInt() == 0)
Flexible(
child: Text(
'${lang.S.of(context).paid} : $currency ${purchaseTransactions[index].totalAmount!.toDouble() - purchaseTransactions[index].dueAmount!.toDouble()}',
'${lang.S.of(context).paid} : $currency${formatWithSeparator(purchaseTransactions[index].totalAmount!.toDouble() - purchaseTransactions[index].dueAmount!.toDouble())}',
style: _theme.textTheme.bodyMedium?.copyWith(fontSize: 16),
maxLines: 2,
),
@@ -206,7 +206,7 @@ class PurchaseReportState extends State<PurchaseListScreen> {
if (purchaseTransactions[index].dueAmount!.toInt() != 0)
Flexible(
child: Text(
'${lang.S.of(context).due}: $currency ${purchaseTransactions[index].dueAmount.toString()}',
'${lang.S.of(context).due}: $currency${formatWithSeparator(purchaseTransactions[index].dueAmount ?? 0)}',
maxLines: 2,
overflow: TextOverflow.ellipsis,
style: _theme.textTheme.bodyMedium?.copyWith(fontSize: 16),

View File

@@ -264,7 +264,9 @@ class AddSalesScreenState extends ConsumerState<AddAndUpdatePurchaseScreen> {
children: [
Text(lang.S.of(context).dueAmount),
Text(
widget.customerModel?.due == null ? '$currency 0' : '$currency${widget.customerModel?.due}',
widget.customerModel?.due == null
? '$currency${formatWithSeparator(0)}'
: '$currency${formatWithSeparator(widget.customerModel?.due ?? 0)}',
style: const TextStyle(color: Color(0xFFFF8C34)),
),
],
@@ -348,7 +350,7 @@ class AddSalesScreenState extends ConsumerState<AddAndUpdatePurchaseScreen> {
title: Text(providerData.cartItemList[index].productName.toString()),
subtitle: permissionService.hasPermission(Permit.purchasesPriceView.value)
? Text(
'${providerData.cartItemList[index].quantities} X ${providerData.cartItemList[index].productPurchasePrice} = ${formatPointNumber((providerData.cartItemList[index].quantities ?? 0) * (providerData.cartItemList[index].productPurchasePrice ?? 0))} ${providerData.cartItemList[index].productType == ProductType.variant.name ? "[${providerData.cartItemList[index].batchNumber.isEmptyOrNull ? 'N/A' : providerData.cartItemList[index].batchNumber}]" : ''}')
'${providerData.cartItemList[index].quantities} X $currency${formatWithSeparator(providerData.cartItemList[index].productPurchasePrice ?? 0)} = $currency${formatWithSeparator((providerData.cartItemList[index].quantities ?? 0) * (providerData.cartItemList[index].productPurchasePrice ?? 0))} ${providerData.cartItemList[index].productType == ProductType.variant.name ? "[${providerData.cartItemList[index].batchNumber.isEmptyOrNull ? 'N/A' : providerData.cartItemList[index].batchNumber}]" : ''}')
: null,
trailing: Row(
mainAxisSize: MainAxisSize.min,
@@ -626,7 +628,7 @@ class AddSalesScreenState extends ConsumerState<AddAndUpdatePurchaseScreen> {
),
),
Text(
formatPointNumber(providerData.totalAmount),
'$currency${formatWithSeparator(providerData.totalAmount)}',
style: _theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w500,
),
@@ -716,6 +718,7 @@ class AddSalesScreenState extends ConsumerState<AddAndUpdatePurchaseScreen> {
hintStyle: _theme.textTheme.titleMedium?.copyWith(
color: kPeraColor,
),
prefixText: discountType == 'Flat' ? '$currency ' : null,
border: UnderlineInputBorder(borderSide: BorderSide(color: kBorder)),
enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: kBorder)),
focusedBorder: UnderlineInputBorder(),
@@ -832,6 +835,7 @@ class AddSalesScreenState extends ConsumerState<AddAndUpdatePurchaseScreen> {
hintStyle: _theme.textTheme.titleSmall?.copyWith(
color: kPeraColor,
),
prefixText: '$currency ',
border: UnderlineInputBorder(borderSide: BorderSide(color: kBorder)),
enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: kBorder)),
focusedBorder: UnderlineInputBorder(),
@@ -870,6 +874,7 @@ class AddSalesScreenState extends ConsumerState<AddAndUpdatePurchaseScreen> {
hintStyle: _theme.textTheme.titleSmall?.copyWith(
color: kPeraColor,
),
prefixText: '$currency ',
border: UnderlineInputBorder(borderSide: BorderSide(color: kBorder)),
enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: kBorder)),
focusedBorder: UnderlineInputBorder(),
@@ -894,7 +899,7 @@ class AddSalesScreenState extends ConsumerState<AddAndUpdatePurchaseScreen> {
),
),
Text(
formatPointNumber(providerData.totalPayableAmount),
'$currency${formatWithSeparator(providerData.totalPayableAmount)}',
style: _theme.textTheme.titleSmall?.copyWith(
color: kPeraColor,
),
@@ -930,6 +935,7 @@ class AddSalesScreenState extends ConsumerState<AddAndUpdatePurchaseScreen> {
hintStyle: _theme.textTheme.titleSmall?.copyWith(
color: kPeraColor,
),
prefixText: '$currency ',
border: UnderlineInputBorder(borderSide: BorderSide(color: kBorder)),
enabledBorder: UnderlineInputBorder(borderSide: BorderSide(color: kBorder)),
focusedBorder: UnderlineInputBorder(),
@@ -956,7 +962,7 @@ class AddSalesScreenState extends ConsumerState<AddAndUpdatePurchaseScreen> {
),
),
Text(
formatPointNumber(providerData.changeAmount),
'$currency${formatWithSeparator(providerData.changeAmount)}',
style: _theme.textTheme.titleSmall?.copyWith(
color: kPeraColor,
),
@@ -982,7 +988,7 @@ class AddSalesScreenState extends ConsumerState<AddAndUpdatePurchaseScreen> {
),
),
Text(
formatPointNumber(providerData.dueAmount),
'$currency${formatWithSeparator(providerData.dueAmount)}',
style: _theme.textTheme.titleSmall?.copyWith(
color: kPeraColor,
),

View File

@@ -31,9 +31,11 @@ class _BulkPurchaseUploaderState extends ConsumerState<BulkPurchaseUploader> {
}
Future<void> createExcelFile() async {
if (!await Permission.storage.request().isDenied) {
EasyLoading.showError('Storage permission is required to create Excel file!');
return;
if (Platform.isAndroid || Platform.isIOS) {
if (!await Permission.storage.request().isDenied) {
EasyLoading.showError('Storage permission is required to create Excel file!');
return;
}
}
EasyLoading.show();
final List<e.CellValue> excelData = [

View File

@@ -9,7 +9,7 @@ import 'package:mobile_pos/generated/l10n.dart' as lang;
import 'package:nb_utils/nb_utils.dart';
import '../../GlobalComponents/glonal_popup.dart';
import '../../constant.dart';
import '../../constant.dart' as mainConstant;
import '../../currency.dart';
import '../../widgets/empty_widget/_empty_widget.dart';
import '../Customers/Provider/customer_provider.dart';
@@ -35,7 +35,7 @@ class _PurchaseContactsState extends State<PurchaseContacts> {
return businessInfo.when(data: (details) {
return GlobalPopup(
child: Scaffold(
backgroundColor: kWhite,
backgroundColor: mainConstant.kWhite,
resizeToAvoidBottomInset: true,
appBar: AppBar(
backgroundColor: Colors.white,
@@ -60,7 +60,7 @@ class _PurchaseContactsState extends State<PurchaseContacts> {
hintText: lang.S.of(context).search,
prefixIcon: Icon(
Icons.search,
color: kGreyTextColor.withOpacity(0.5),
color: mainConstant.kGreyTextColor.withOpacity(0.5),
),
),
onChanged: (value) {
@@ -116,7 +116,7 @@ class _PurchaseContactsState extends State<PurchaseContacts> {
),
const SizedBox(width: 4),
Text(
'$currency${customer[index].due}',
'$currency${mainConstant.formatWithSeparator(customer[index].due ?? 0)}',
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: 16.0,
),
@@ -178,13 +178,13 @@ class _PurchaseContactsState extends State<PurchaseContacts> {
}),
),
floatingActionButton: FloatingActionButton(
backgroundColor: kMainColor,
backgroundColor: mainConstant.kMainColor,
shape: RoundedRectangleBorder(
borderRadius: BorderRadius.circular(100),
),
child: const Icon(
Icons.add,
color: kWhite,
color: mainConstant.kWhite,
),
onPressed: () async {
const AddParty().launch(context);

View File

@@ -367,7 +367,7 @@ class _CashflowScreenState extends ConsumerState<CashflowScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(tx.cashIn ?? 0)}",
"$currency${formatWithSeparator(tx.cashIn ?? 0)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
),
@@ -397,7 +397,7 @@ class _CashflowScreenState extends ConsumerState<CashflowScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(tx.cashOut ?? 0)}",
"$currency${formatWithSeparator(tx.cashOut ?? 0)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
),
@@ -427,7 +427,7 @@ class _CashflowScreenState extends ConsumerState<CashflowScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(tx.runningCash ?? 0)}",
"$currency${formatWithSeparator(tx.runningCash ?? 0)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
),
@@ -571,7 +571,7 @@ class _CashflowScreenState extends ConsumerState<CashflowScreen> {
Expanded(
flex: 2,
child: Text(
"$currency${formatPointNumber(_transaction.amount ?? 0, addComma: true)}",
"$currency${formatWithSeparator(_transaction.amount ?? 0)}",
textAlign: TextAlign.end,
),
),

View File

@@ -349,7 +349,7 @@ class DayBookReportState extends ConsumerState<DayBookReport> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(transactions.totalAmount ?? 0, addComma: true)}",
"$currency${formatWithSeparator(transactions.totalAmount ?? 0)}",
style: _theme.textTheme.titleLarge?.copyWith(fontWeight: FontWeight.w600),
),
const SizedBox(height: 4),
@@ -375,7 +375,7 @@ class DayBookReportState extends ConsumerState<DayBookReport> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(transactions.moneyIn ?? 0, addComma: true)}",
"$currency${formatWithSeparator(transactions.moneyIn ?? 0)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
color: DAppColors.kSuccess,
@@ -404,7 +404,7 @@ class DayBookReportState extends ConsumerState<DayBookReport> {
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(transactions.moneyOut ?? 0, addComma: true)}",
"$currency${formatWithSeparator(transactions.moneyOut ?? 0)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
color: DAppColors.kError,
@@ -565,7 +565,7 @@ class DayBookReportState extends ConsumerState<DayBookReport> {
Expanded(
flex: 2,
child: Text(
"$currency${formatPointNumber(t.amount ?? 0, addComma: true)}",
"$currency${formatWithSeparator(t.amount ?? 0)}",
textAlign: TextAlign.end,
style: TextStyle(
color: selectedTransactionType == 'credit'

View File

@@ -434,7 +434,7 @@ class _DueReportScreenState extends ConsumerState<DueReportScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(totalReceiveDue)}",
"$currency${formatWithSeparator(totalReceiveDue)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
),
@@ -469,7 +469,7 @@ class _DueReportScreenState extends ConsumerState<DueReportScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(totalPaidDue)}",
"$currency${formatWithSeparator(totalPaidDue)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
),
@@ -597,13 +597,13 @@ class _DueReportScreenState extends ConsumerState<DueReportScreen> {
mainAxisAlignment: MainAxisAlignment.spaceBetween,
children: [
Text(
'${l.S.of(context).total} : $currency${formatPointNumber(totalDue)}',
'${l.S.of(context).total} : $currency${formatWithSeparator(totalDue)}',
style: _theme.textTheme.titleSmall?.copyWith(
color: kPeraColor,
),
),
Text(
'${l.S.of(context).paid} : $currency${formatPointNumber(paidAmount)}',
'${l.S.of(context).paid} : $currency${formatWithSeparator(paidAmount)}',
style: _theme.textTheme.titleSmall?.copyWith(
color: kPeraColor,
),
@@ -617,7 +617,7 @@ class _DueReportScreenState extends ConsumerState<DueReportScreen> {
children: [
// if (dueAmount > 0)
Text(
'${l.S.of(context).due}: $currency${formatPointNumber(dueAmount)}',
'${l.S.of(context).due}: $currency${formatWithSeparator(dueAmount)}',
style: _theme.textTheme.titleMedium?.copyWith(
color: kPeraColor,
),

View File

@@ -465,7 +465,7 @@ class _ExpenseReportState extends ConsumerState<ExpenseReport> {
),
Expanded(
child: Text(
'$currency${expense.amount?.toStringAsFixed(2)}',
'$currency${formatWithSeparator(expense.amount ?? 0)}',
textAlign: TextAlign.end,
),
)
@@ -503,8 +503,8 @@ class _ExpenseReportState extends ConsumerState<ExpenseReport> {
fontWeight: FontWeight.w600,
),
),
Text(
'$currency${totalExpense.toStringAsFixed(2)}',
Text(
'$currency${formatWithSeparator(totalExpense)}',
style: _theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w600,
),
@@ -535,8 +535,8 @@ class _ExpenseReportState extends ConsumerState<ExpenseReport> {
fontWeight: FontWeight.w600,
),
),
Text(
'$currency${totalExpense.toStringAsFixed(2)}',
Text(
'$currency${formatWithSeparator(totalExpense)}',
style: _theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w600,
),

View File

@@ -423,7 +423,7 @@ class PurchaseReportState extends ConsumerState<PurchaseReportScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(totalPurchase)}",
"$currency${formatWithSeparator(totalPurchase)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
),
@@ -456,7 +456,7 @@ class PurchaseReportState extends ConsumerState<PurchaseReportScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(totalDues)}",
"$currency${formatWithSeparator(totalDues)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
),
@@ -573,7 +573,7 @@ class PurchaseReportState extends ConsumerState<PurchaseReportScreen> {
crossAxisAlignment: CrossAxisAlignment.start,
children: [
Text(
'${l.S.of(context).total} : $currency ${filteredTransactions[index].totalAmount.toString()}',
'${l.S.of(context).total} : $currency ${formatWithSeparator(filteredTransactions[index].totalAmount ?? 0)}',
style: _theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w500,
color: kPeraColor,
@@ -582,7 +582,7 @@ class PurchaseReportState extends ConsumerState<PurchaseReportScreen> {
const SizedBox(width: 4),
if (filteredTransactions[index].dueAmount!.toInt() != 0)
Text(
'${l.S.of(context).paid} : $currency ${filteredTransactions[index].totalAmount!.toDouble() - filteredTransactions[index].dueAmount!.toDouble()}',
'${l.S.of(context).paid} : $currency ${formatWithSeparator(filteredTransactions[index].totalAmount!.toDouble() - filteredTransactions[index].dueAmount!.toDouble())}',
style: _theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w500,
color: kPeraColor,
@@ -596,14 +596,14 @@ class PurchaseReportState extends ConsumerState<PurchaseReportScreen> {
children: [
if (filteredTransactions[index].dueAmount!.toInt() == 0)
Text(
'${l.S.of(context).paid} : $currency ${filteredTransactions[index].totalAmount!.toDouble() - filteredTransactions[index].dueAmount!.toDouble()}',
'${l.S.of(context).paid} : $currency ${formatWithSeparator(filteredTransactions[index].totalAmount!.toDouble() - filteredTransactions[index].dueAmount!.toDouble())}',
style: _theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w500,
),
),
if (filteredTransactions[index].dueAmount!.toInt() != 0)
Text(
'${l.S.of(context).due}: $currency ${filteredTransactions[index].dueAmount.toString()}',
'${l.S.of(context).due}: $currency ${formatWithSeparator(filteredTransactions[index].dueAmount ?? 0)}',
style: _theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w500,
),

View File

@@ -418,7 +418,7 @@ class SalesReportScreenState extends ConsumerState<SalesReportScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(totalSales)}",
"$currency${formatWithSeparator(totalSales)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
),
@@ -451,7 +451,7 @@ class SalesReportScreenState extends ConsumerState<SalesReportScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(totalDue)}",
"$currency${formatWithSeparator(totalDue)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
),

View File

@@ -387,7 +387,7 @@ class _TaxReportScreenState extends ConsumerState<TaxReportScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(_overview.totalAmount, addComma: true)}",
"$currency${formatWithSeparator(_overview.totalAmount)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
),
@@ -417,7 +417,7 @@ class _TaxReportScreenState extends ConsumerState<TaxReportScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(_overview.totalDiscount, addComma: true)}",
"$currency${formatWithSeparator(_overview.totalDiscount)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
),
@@ -447,7 +447,7 @@ class _TaxReportScreenState extends ConsumerState<TaxReportScreen> {
crossAxisAlignment: CrossAxisAlignment.center,
children: [
Text(
"$currency${formatPointNumber(_overview.totalVat, addComma: true)}",
"$currency${formatWithSeparator(_overview.totalVat)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
),
@@ -552,13 +552,13 @@ class _TaxReportScreenState extends ConsumerState<TaxReportScreen> {
spacing: 2,
children: [
Text(
'${_lang.amount}: $currency${formatPointNumber(_transaction.amount ?? 0, addComma: true)}',
'${_lang.amount}: $currency${formatWithSeparator(_transaction.amount ?? 0)}',
),
Text(
'${_lang.discount}: $currency${formatPointNumber(_transaction.discountAmount ?? 0, addComma: true)}',
'${_lang.discount}: $currency${formatWithSeparator(_transaction.discountAmount ?? 0)}',
),
Text(
'${_transaction.vatName ?? _lang.vat}: $currency${formatPointNumber(_transaction.vatAmount ?? 0, addComma: true)}',
'${_transaction.vatName ?? _lang.vat}: $currency${formatWithSeparator(_transaction.vatAmount ?? 0)}',
),
],
),

View File

@@ -221,7 +221,7 @@ class _CustomerLedgerReportState extends ConsumerState<CustomerLedgerReport> {
),
),
Text(
'${_lang.due}: $currency${formatPointNumber(party.due ?? 0, addComma: true)}',
'${_lang.due}: $currency${formatWithSeparator(party.due ?? 0)}',
style: _theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w500,
),
@@ -251,7 +251,7 @@ class _CustomerLedgerReportState extends ConsumerState<CustomerLedgerReport> {
style: _theme.textTheme.bodyMedium,
),
Text(
'${_lang.paidAmount} : $currency${formatPointNumber(party.totalSalePaid ?? 0, addComma: true)}',
'${_lang.paidAmount} : $currency${formatWithSeparator(party.totalSalePaid ?? 0)}',
style: _theme.textTheme.bodyMedium,
),
],

View File

@@ -232,7 +232,7 @@ class _CustomerLedgerReportState extends ConsumerState<SupplierLedger> {
),
),
Text(
'${_lang.due}: $currency${formatPointNumber(party.due ?? 0, addComma: true)}',
'${_lang.due}: $currency${formatWithSeparator(party.due ?? 0)}',
style: _theme.textTheme.titleSmall?.copyWith(
fontWeight: FontWeight.w500,
),
@@ -262,7 +262,7 @@ class _CustomerLedgerReportState extends ConsumerState<SupplierLedger> {
style: _theme.textTheme.bodyMedium,
),
Text(
'${_lang.paidAmount} : $currency${formatPointNumber(party.totalPurchasePaid ?? 0, addComma: true)}',
'${_lang.paidAmount} : $currency${formatWithSeparator(party.totalPurchasePaid ?? 0)}',
style: _theme.textTheme.bodyMedium,
),
],

View File

@@ -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,
),

View File

@@ -317,7 +317,7 @@ class _ProductCardState extends State<ProductCard> {
),
// if (permissionService.hasPermission(Permit.salesPriceView.value))
Text(
'$currency ${formatPointNumber(widget.productPrice, addComma: true)}',
'$currency ${formatWithSeparator(widget.productPrice)}',
style: theme.textTheme.titleMedium!.copyWith(fontSize: 18),
),
],

View File

@@ -82,7 +82,7 @@ void showDeleteAccountDialog(BuildContext context, WidgetRef ref) {
.deleteAccount(businessId: businessId, password: passwordController.text);
if (isDeleted) {
await LogOutRepo().signOut();
await LogOutRepo().signOut(context: context);
if (context.mounted) Navigator.of(context).pop();
}
}

View File

@@ -159,7 +159,7 @@ class SettingScreenState extends ConsumerState<SettingScreen> {
ref.invalidate(businessInfoProvider);
EasyLoading.show(status: lang.S.of(context).logOut);
LogOutRepo repo = LogOutRepo();
await repo.signOutApi();
await repo.signOutApi(context: context);
}
if (value.value == 'delete_account') {
showDeleteAccountDialog(context, ref);

View File

@@ -29,10 +29,12 @@ class SplashScreen extends ConsumerStatefulWidget {
class SplashScreenState extends ConsumerState<SplashScreen> {
void getPermission() async {
Map<Permission, PermissionStatus> statuses = await [
Permission.bluetoothScan,
Permission.bluetoothConnect,
].request();
if (Platform.isAndroid || Platform.isIOS) {
Map<Permission, PermissionStatus> statuses = await [
Permission.bluetoothScan,
Permission.bluetoothConnect,
].request();
}
}
int retryCount = 0;

View File

@@ -5,7 +5,7 @@ import 'package:flutter_svg/svg.dart';
import 'package:mobile_pos/Screens/branch/provider/branch_list_provider.dart';
import 'package:mobile_pos/Screens/branch/repo/branch_repo.dart';
import 'package:mobile_pos/constant.dart';
import 'package:restart_app/restart_app.dart';
import 'package:mobile_pos/generated/l10n.dart' as l;
import '../../Provider/profile_provider.dart';
import '../../widgets/empty_widget/_empty_widget.dart';
@@ -313,7 +313,7 @@ class BranchListWidget extends ConsumerWidget {
if (switched) {
ref.refresh(branchListProvider);
ref.refresh(businessInfoProvider);
Restart.restartApp();
restartApp();
}
EasyLoading.dismiss();
}
@@ -333,7 +333,7 @@ class BranchListWidget extends ConsumerWidget {
if (switched) {
ref.refresh(branchListProvider);
ref.refresh(businessInfoProvider);
Restart.restartApp();
restartApp();
}
EasyLoading.dismiss();
}

View File

@@ -1,6 +1,4 @@
import 'package:barcode_widget/barcode_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_long_screenshot/flutter_long_screenshot.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/svg.dart';
import 'package:intl/intl.dart';
@@ -13,7 +11,6 @@ import 'package:provider/provider.dart' as pro;
import '../../GlobalComponents/glonal_popup.dart';
import '../../constant.dart' as mainConstant;
import '../../constant.dart';
import '../../currency.dart';
import '../../model/business_info_model.dart' as binfo;
import '../../thermal priting invoices/model/print_transaction_model.dart';
@@ -185,7 +182,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
Text(
'${widget.businessInfo.data?.companyName}',
style: _theme.textTheme.titleLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontWeight: FontWeight.w700,
),
),
@@ -198,13 +195,13 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
TextSpan(
text: widget.transitionModel.branch?.name.toString() ?? 'n/a',
style: _theme.textTheme.bodyLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
],
style: _theme.textTheme.bodyLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -214,7 +211,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
Text(
'${_lang.address}: ${widget.businessInfo.data?.address ?? ''}',
style: _theme.textTheme.bodyLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -223,7 +220,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
Text(
'${_lang.mobile} ${(widget.transitionModel.branch?.phone?.isNotEmpty ?? false) ? widget.transitionModel.branch?.phone ?? 'n/a' : widget.businessInfo.data?.phoneNumber?.toString() ?? 'n/a'}',
style: _theme.textTheme.bodyLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -232,7 +229,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
Text(
'${_lang.email}: ${widget.businessInfo.data?.user?.email ?? ''}',
style: _theme.textTheme.bodyLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
textAlign: TextAlign.center,
@@ -341,12 +338,12 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
TextSpan(
text: widget.transitionModel.invoiceNumber ?? '',
style: _theme.textTheme.titleSmall?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontWeight: FontWeight.w500,
))
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
)),
),
@@ -358,11 +355,11 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
TextSpan(
text: widget.transitionModel.party?.name ?? '',
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor))
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -375,13 +372,13 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
TextSpan(
text: widget.transitionModel.party?.phone,
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -398,7 +395,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
),
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -415,7 +412,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
)
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -432,7 +429,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
)
],
style: _theme.textTheme.titleSmall?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontWeight: FontWeight.w500,
),
),
@@ -450,7 +447,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
)
],
style: _theme.textTheme.bodyLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -478,7 +475,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
),
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -495,7 +492,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
)
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -512,7 +509,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
)
],
style: _theme.textTheme.titleSmall?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontWeight: FontWeight.w500,
),
),
@@ -530,7 +527,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
)
],
style: _theme.textTheme.bodyLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -561,7 +558,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
textAlign: TextAlign.start,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w500,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -573,7 +570,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
textAlign: TextAlign.start,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w500,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -585,7 +582,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
textAlign: TextAlign.center,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w500,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -598,7 +595,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
textAlign: TextAlign.center,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w500,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -611,7 +608,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
textAlign: TextAlign.end,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w500,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -636,7 +633,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
(i + 1).toString(),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
textAlign: TextAlign.start,
),
@@ -651,7 +648,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
'${detail.product?.productName ?? ''}${detail.product?.productType == ProductType.variant.name ? ' [${detail.stock?.batchNo ?? ''}]' : ''}',
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
textAlign: TextAlign.start,
),
@@ -678,7 +675,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
quantity.toString(),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
textAlign: TextAlign.center,
),
@@ -687,10 +684,10 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
Expanded(
flex: 3,
child: Text(
'$currency $unitPrice',
'$currency${mainConstant.formatWithSeparator(unitPrice)}',
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
// '$currency${formatPointNumber(saleDetail.price)}',
textAlign: TextAlign.center,
@@ -700,10 +697,10 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
Expanded(
flex: 3,
child: Text(
'$currency $totalPrice',
'$currency${mainConstant.formatWithSeparator(totalPrice)}',
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
textAlign: TextAlign.end,
),
@@ -722,13 +719,13 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
text: '${lang.S.of(context).subTotal} : ',
children: [
TextSpan(
text: '$currency ${mainConstant.formatPointNumber(getTotalForOldInvoice())}',
text: '$currency${mainConstant.formatWithSeparator(getTotalForOldInvoice())}',
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -743,13 +740,13 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
children: [
TextSpan(
text:
'$currency ${mainConstant.formatPointNumber((widget.transitionModel.discountAmount ?? 0) + getReturndDiscountAmount())}',
'$currency${mainConstant.formatWithSeparator((widget.transitionModel.discountAmount ?? 0) + getReturndDiscountAmount())}',
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -764,13 +761,13 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
children: [
TextSpan(
text:
'$currency ${mainConstant.formatPointNumber((widget.transitionModel.vatAmount ?? 0))}',
'$currency${mainConstant.formatWithSeparator((widget.transitionModel.vatAmount ?? 0))}',
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -786,13 +783,13 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
children: [
TextSpan(
text:
'$currency ${mainConstant.formatPointNumber(widget.transitionModel.shippingCharge ?? 0)}',
'$currency${mainConstant.formatWithSeparator(widget.transitionModel.shippingCharge ?? 0)}',
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -807,13 +804,13 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
children: [
TextSpan(
text:
'$currency ${mainConstant.formatPointNumber((widget.transitionModel.totalAmount ?? 0) + getTotalReturndAmount())}',
'$currency${mainConstant.formatWithSeparator((widget.transitionModel.totalAmount ?? 0) + getTotalReturndAmount())}',
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -835,7 +832,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
textAlign: TextAlign.start,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -847,7 +844,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
textAlign: TextAlign.center,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -859,7 +856,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
textAlign: TextAlign.start,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -871,7 +868,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
textAlign: TextAlign.center,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -883,7 +880,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
textAlign: TextAlign.end,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -907,7 +904,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
(serialNumber++).toString(),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
textAlign: TextAlign.start,
),
@@ -922,7 +919,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
textAlign: TextAlign.start,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -935,7 +932,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
textAlign: TextAlign.start,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -950,18 +947,18 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
textAlign: TextAlign.center,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
Expanded(
flex: 2,
child: Text(
'$currency ${(widget.transitionModel.purchaseReturns?[i].purchaseReturnDetails?[detailIndex].returnAmount ?? 0)}',
'$currency${mainConstant.formatWithSeparator(widget.transitionModel.purchaseReturns?[i].purchaseReturnDetails?[detailIndex].returnAmount ?? 0)}',
textAlign: TextAlign.end,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -981,13 +978,13 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
text: '${lang.S.of(context).totalReturnAmount} : ',
children: [
TextSpan(
text: '$currency ${getTotalReturndAmount()}',
text: '$currency${mainConstant.formatWithSeparator(getTotalReturndAmount())}',
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -1002,13 +999,13 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
children: [
TextSpan(
text:
'$currency ${mainConstant.formatPointNumber(widget.transitionModel.totalAmount ?? 0)}',
'$currency${mainConstant.formatWithSeparator(widget.transitionModel.totalAmount ?? 0)}',
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -1023,13 +1020,13 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
children: [
TextSpan(
text:
'$currency ${mainConstant.formatPointNumber(((widget.transitionModel.totalAmount ?? 0) - (widget.transitionModel.dueAmount ?? 0)) + (widget.transitionModel.changeAmount ?? 0))}',
'$currency${mainConstant.formatWithSeparator(((widget.transitionModel.totalAmount ?? 0) - (widget.transitionModel.dueAmount ?? 0)) + (widget.transitionModel.changeAmount ?? 0))}',
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -1046,13 +1043,13 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
children: [
TextSpan(
text:
'$currency ${mainConstant.formatPointNumber(widget.transitionModel.dueAmount ?? 0)}',
'$currency${mainConstant.formatWithSeparator(widget.transitionModel.dueAmount ?? 0)}',
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -1070,13 +1067,13 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
children: [
TextSpan(
text:
'$currency${mainConstant.formatPointNumber(widget.transitionModel.changeAmount ?? 0)}',
'$currency${mainConstant.formatWithSeparator(widget.transitionModel.changeAmount ?? 0)}',
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -1091,7 +1088,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
'${_lang.paidVia} :',
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
...?(widget.transitionModel.transactions?.asMap().entries.map((entry) {
@@ -1123,7 +1120,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
text,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
);
}).toList()),
@@ -1135,7 +1132,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
'${widget.businessInfo.data?.invoiceNoteLevel ?? ''}: ${widget.businessInfo.data?.invoiceNote ?? ''}',
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
SizedBox(height: 8),
@@ -1147,7 +1144,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
maxLines: 3,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
textAlign: TextAlign.center,
),
@@ -1170,7 +1167,7 @@ class _PurchaseInvoiceDetailsState extends State<PurchaseInvoiceDetails> {
'${widget.businessInfo.data?.developByLevel ?? ''} ${widget.businessInfo.data?.developBy ?? ''}',
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),

View File

@@ -1,10 +1,8 @@
import 'package:barcode_widget/barcode_widget.dart';
import 'package:flutter/material.dart';
import 'package:flutter_long_screenshot/flutter_long_screenshot.dart';
import 'package:flutter_riverpod/flutter_riverpod.dart';
import 'package:flutter_svg/flutter_svg.dart';
import 'package:flutter_svg/svg.dart';
import 'package:intl/intl.dart';
import 'package:mobile_pos/PDF%20Invoice/universal_image_widget.dart';
import 'package:mobile_pos/Const/api_config.dart';
import 'package:mobile_pos/Provider/profile_provider.dart';
import 'package:mobile_pos/Screens/invoice_details/components/common_image_builder.dart';
import 'package:mobile_pos/generated/l10n.dart' as lang;
@@ -12,10 +10,9 @@ import 'package:nb_utils/nb_utils.dart';
import 'package:provider/provider.dart' as pro;
import 'package:screenshot/screenshot.dart';
import '../../Const/api_config.dart';
import '../../GlobalComponents/glonal_popup.dart';
import '../../constant.dart' as mainConstant;
import '../../constant.dart';
import '../../currency.dart';
import '../../model/business_info_model.dart' as binfo;
import '../../model/sale_transaction_model.dart';
import '../../thermal priting invoices/model/print_transaction_model.dart';
@@ -29,12 +26,8 @@ import '../Home/home.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${mainConstant.formatWithSeparator(value)}';
}
class SalesInvoiceDetails extends StatefulWidget {
@@ -204,7 +197,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
Text(
'${widget.businessInfo.data?.companyName}',
style: _theme.textTheme.titleLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontWeight: FontWeight.w700,
),
),
@@ -217,13 +210,13 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
TextSpan(
text: widget.saleTransaction.branch?.name.toString() ?? 'n/a',
style: _theme.textTheme.bodyLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
],
style: _theme.textTheme.bodyLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -233,7 +226,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
Text(
'${_lang.address}: ${widget.businessInfo.data?.address ?? ''}',
style: _theme.textTheme.bodyLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -242,7 +235,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
Text(
'${_lang.mobile} ${(widget.saleTransaction.branch?.phone?.isNotEmpty ?? false) ? widget.saleTransaction.branch?.phone ?? 'n/a' : widget.businessInfo.data?.phoneNumber?.toString() ?? 'n/a'}',
style: _theme.textTheme.bodyLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -251,7 +244,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
Text(
'${_lang.email}: ${widget.businessInfo.data?.user?.email ?? ''}',
style: _theme.textTheme.bodyLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
textAlign: TextAlign.center,
@@ -284,12 +277,12 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
TextSpan(
text: widget.saleTransaction.invoiceNumber ?? '',
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontWeight: FontWeight.w500,
))
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
)),
),
@@ -303,7 +296,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
)
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -319,7 +312,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
),
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -336,7 +329,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
),
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -353,7 +346,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
)
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -368,7 +361,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
)
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontWeight: FontWeight.w500,
),
),
@@ -386,7 +379,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
)
],
style: _theme.textTheme.bodyLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -414,7 +407,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
),
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -431,7 +424,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
)
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -446,7 +439,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
)
],
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontWeight: FontWeight.w500,
),
),
@@ -464,7 +457,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
)
],
style: _theme.textTheme.bodyLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
color: mainConstant.kTextColor,
),
),
@@ -495,7 +488,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
textAlign: TextAlign.start,
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w500,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -507,7 +500,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
textAlign: TextAlign.start,
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w500,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -519,7 +512,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
textAlign: TextAlign.center,
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w500,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -531,7 +524,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
textAlign: TextAlign.center,
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w500,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -544,7 +537,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
// textAlign: TextAlign.center,
// style: _theme.textTheme.titleLarge?.copyWith(
// fontWeight: FontWeight.w500,
// fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
// fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
// ),
// ),
// ),
@@ -556,7 +549,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
textAlign: TextAlign.end,
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w500,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -581,7 +574,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
(widget.saleTransaction.salesDetails!.indexOf(saleDetail) + 1).toString(),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
textAlign: TextAlign.start,
),
@@ -596,7 +589,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
saleDetail.product?.productName ?? '',
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
textAlign: TextAlign.start,
),
@@ -606,7 +599,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
'${_lang.warranty} : ${saleDetail.warrantyInfo?.warrantyDuration} ${saleDetail.warrantyInfo?.warrantyUnit}',
style: _theme.textTheme.bodySmall?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize) - 6,
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize) - 6,
),
),
if (saleDetail.warrantyInfo?.guaranteeDuration != null &&
@@ -615,7 +608,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
'${_lang.guarantee} : ${saleDetail.warrantyInfo?.guaranteeDuration} ${saleDetail.warrantyInfo?.guaranteeUnit}',
style: _theme.textTheme.bodySmall?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize) - 6,
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize) - 6,
),
),
],
@@ -654,7 +647,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
quantity.toString(),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
textAlign: TextAlign.center,
),
@@ -663,11 +656,11 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
Expanded(
flex: 2,
child: Text(
_formatRupiah(saleDetail.discount ?? 0),
_formatWithCurrency(saleDetail.discount ?? 0),
textAlign: TextAlign.center,
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w500,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -678,7 +671,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
// '$currency${mainConstant.formatPointNumber(saleDetail.price ?? 0, addComma: true)}',
// style: _theme.textTheme.bodyLarge?.copyWith(
// fontWeight: FontWeight.w600,
// fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
// fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
// ),
// // '$currency${formatPointNumber(saleDetail.price)}',
// textAlign: TextAlign.center,
@@ -687,10 +680,10 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
Expanded(
flex: 2,
child: Text(
_formatRupiah(totalPrice),
_formatWithCurrency(totalPrice),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
textAlign: TextAlign.end,
),
@@ -711,13 +704,13 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
text: '${lang.S.of(context).subTotal} : ',
children: [
TextSpan(
text: _formatRupiah(getTotalForOldInvoice()),
text: _formatWithCurrency(getTotalForOldInvoice()),
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -731,11 +724,11 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
text: '${lang.S.of(context).discount} : ',
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
children: [
TextSpan(
text: _formatRupiah(
text: _formatWithCurrency(
(widget.saleTransaction.discountAmount ?? 0) +
getReturndDiscountAmount() +
getTotalItemDiscount(),
@@ -745,7 +738,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -759,17 +752,17 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
text: '${widget.saleTransaction.vat?.name ?? lang.S.of(context).vat} : ',
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
children: [
TextSpan(
text: _formatRupiah(widget.saleTransaction.vatAmount ?? 0),
text: _formatWithCurrency(widget.saleTransaction.vatAmount ?? 0),
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -783,17 +776,17 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
text: '${lang.S.of(context).shippingCharge} : ',
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
children: [
TextSpan(
text: _formatRupiah(widget.saleTransaction.shippingCharge ?? 0),
text: _formatWithCurrency(widget.saleTransaction.shippingCharge ?? 0),
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -812,17 +805,17 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
text: '${_lang.total} :',
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
children: [
TextSpan(
text: _formatRupiah(widget.saleTransaction.actualTotalAmount ?? 0),
text: _formatWithCurrency(widget.saleTransaction.actualTotalAmount ?? 0),
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -836,18 +829,18 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
text: '${_lang.rounding} : ',
style: TextStyle(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
children: [
TextSpan(
text:
'${!(widget.saleTransaction.roundingAmount?.isNegative ?? true) ? '+' : ''}${_formatRupiah(widget.saleTransaction.roundingAmount ?? 0)}',
'${!(widget.saleTransaction.roundingAmount?.isNegative ?? true) ? '+' : ''}${_formatWithCurrency(widget.saleTransaction.roundingAmount ?? 0)}',
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -864,13 +857,13 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
text: '${lang.S.of(context).totalAmount} : ',
children: [
TextSpan(
text: _formatRupiah(getTotalReturndAmount() + (widget.saleTransaction.totalAmount ?? 0)),
text: _formatWithCurrency(getTotalReturndAmount() + (widget.saleTransaction.totalAmount ?? 0)),
),
],
),
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -891,7 +884,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
textAlign: TextAlign.start,
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w500,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -903,7 +896,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
textAlign: TextAlign.start,
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w400,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -915,7 +908,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
textAlign: TextAlign.start,
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w400,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -927,7 +920,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
textAlign: TextAlign.center,
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w400,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -939,7 +932,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
textAlign: TextAlign.end,
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w400,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -963,7 +956,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
textAlign: TextAlign.start,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -977,7 +970,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
textAlign: TextAlign.start,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -992,7 +985,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
textAlign: TextAlign.start,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
// if (hasWarranty)
@@ -1022,18 +1015,18 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
textAlign: TextAlign.center,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
Expanded(
flex: 2,
child: Text(
_formatRupiah(widget.saleTransaction.salesReturns?[i].salesReturnDetails?[detailIndex].returnAmount ?? 0),
_formatWithCurrency(widget.saleTransaction.salesReturns?[i].salesReturnDetails?[detailIndex].returnAmount ?? 0),
textAlign: TextAlign.end,
style: _theme.textTheme.bodyLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -1054,13 +1047,13 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
text: '${lang.S.of(context).totalReturnAmount} : ',
children: [
TextSpan(
text: _formatRupiah(getTotalReturndAmount()),
text: _formatWithCurrency(getTotalReturndAmount()),
),
],
),
style: _theme.textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -1075,13 +1068,13 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
style: const TextStyle(fontWeight: FontWeight.w600),
children: [
TextSpan(
text: _formatRupiah(widget.saleTransaction.totalAmount ?? 0),
text: _formatWithCurrency(widget.saleTransaction.totalAmount ?? 0),
),
],
),
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w500,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -1095,7 +1088,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
text: '${lang.S.of(context).receivedAmount} : ',
children: [
TextSpan(
text: _formatRupiah(
text: _formatWithCurrency(
((widget.saleTransaction.totalAmount ?? 0) -
(widget.saleTransaction.dueAmount ?? 0)) +
(widget.saleTransaction.changeAmount ?? 0),
@@ -1105,7 +1098,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
),
style: _theme.textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -1121,13 +1114,13 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
text: '${lang.S.of(context).due} : ',
children: [
TextSpan(
text: _formatRupiah(widget.saleTransaction.dueAmount ?? 0),
text: _formatWithCurrency(widget.saleTransaction.dueAmount ?? 0),
),
],
),
style: _theme.textTheme.bodyMedium?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -1143,12 +1136,12 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
text: '${_lang.changeAmount} : ',
children: [
TextSpan(
text: _formatRupiah(widget.saleTransaction.changeAmount ?? 0),
text: _formatWithCurrency(widget.saleTransaction.changeAmount ?? 0),
),
],
),
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),
@@ -1163,7 +1156,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
Text(
'${_lang.paidVia} :',
style: _theme.textTheme.titleLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontWeight: FontWeight.w500,
),
),
@@ -1195,7 +1188,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
return Text(
text,
style: _theme.textTheme.titleLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontWeight: FontWeight.w500,
),
);
@@ -1211,7 +1204,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
Text(
_lang.attachment,
style: _theme.textTheme.titleLarge?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontWeight: FontWeight.w600,
),
),
@@ -1236,7 +1229,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
Text(
'${widget.businessInfo.data?.invoiceNoteLevel ?? ''}: ${widget.businessInfo.data?.invoiceNote ?? ''}',
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
SizedBox(height: 8),
@@ -1249,7 +1242,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
maxLines: 3,
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
textAlign: TextAlign.center,
),
@@ -1273,7 +1266,7 @@ class _SalesInvoiceDetailsState extends State<SalesInvoiceDetails> {
child: Text(
'${widget.businessInfo.data?.developByLevel ?? ''} ${widget.businessInfo.data?.developBy ?? ''}',
style: _theme.textTheme.bodyMedium?.copyWith(
fontSize: fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
fontSize: mainConstant.fontSizeForPrinter(widget.businessInfo.data?.invoiceSize),
),
),
),

View File

@@ -329,7 +329,7 @@ class _LedgerPartyListScreenState extends State<LedgerPartyListScreen> {
child: Column(
mainAxisAlignment: MainAxisAlignment.center,
children: [
Text("$currency${summaryDue.toStringAsFixed(0)}",
Text("$currency${formatWithSeparator(summaryDue)}",
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
)),
@@ -361,7 +361,7 @@ class _LedgerPartyListScreenState extends State<LedgerPartyListScreen> {
),
child: Column(
children: [
Text('$currency${totalCustomerDue.toStringAsFixed(2)}',
Text('$currency${formatWithSeparator(totalCustomerDue)}',
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: 18,
@@ -391,7 +391,7 @@ class _LedgerPartyListScreenState extends State<LedgerPartyListScreen> {
child: Column(
children: [
Text(
'$currency${totalSupplierDue.toStringAsFixed(2)}',
'$currency${formatWithSeparator(totalSupplierDue)}',
style: _theme.textTheme.titleLarge?.copyWith(
fontWeight: FontWeight.w600,
fontSize: 18,
@@ -612,7 +612,7 @@ class _LedgerPartyListScreenState extends State<LedgerPartyListScreen> {
children: [
if (statusAmount != null)
Text(
'$currency${statusAmount.toStringAsFixed(0)}',
'$currency${formatWithSeparator(statusAmount)}',
style: _theme.textTheme.titleMedium?.copyWith(
fontWeight: FontWeight.w500,
),

View File

@@ -25,11 +25,15 @@ const String failureUrl = 'order-status?status=failed';
class PaymentScreenState extends State<PaymentScreen> {
late WebViewController controller;
final ImagePicker _imagePicker = ImagePicker();
late bool isSupportedPlatform;
@override
void initState() {
// TODO: implement initState
super.initState();
isSupportedPlatform = Platform.isAndroid || Platform.isIOS;
if (!isSupportedPlatform) return;
paymentUrl = paymentUrl.replaceAll(APIConfig.domain, APIConfig.domain).replaceAll('plan_id', widget.planId).replaceAll('business_id', widget.businessId);
controller = WebViewController()
@@ -72,6 +76,24 @@ class PaymentScreenState extends State<PaymentScreen> {
@override
Widget build(BuildContext context) {
if (!isSupportedPlatform) {
return Scaffold(
appBar: AppBar(
title: Text(lang.S.of(context).paymentGateway),
),
body: Center(
child: Padding(
padding: const EdgeInsets.all(20.0),
child: Text(
'Payment Gateway is not supported on this device. Please use an Android or iOS device to complete the subscription.',
textAlign: TextAlign.center,
style: TextStyle(fontSize: 18),
),
),
),
);
}
return Scaffold(
appBar: AppBar(
title: Text(

View File

@@ -1245,7 +1245,7 @@ class _PosSaleScreenState extends ConsumerState<PosSaleScreen> {
}
// Navigate to the next screen if permission is granted
bool result = await Navigator.push(
bool? result = await Navigator.push(
context,
MaterialPageRoute(
builder: (context) => AddSalesScreen(
@@ -1256,7 +1256,7 @@ class _PosSaleScreenState extends ConsumerState<PosSaleScreen> {
);
// Handle result after returning from AddSalesScreen
if (result) {
if (result == true) {
_searchController.clear();
selectedCustomer = null;
setState(() {});

View File

@@ -268,12 +268,12 @@ class StockListState extends ConsumerState<LowStock> {
DataCell(
onTap: () => navigateNextScreen(),
Text(
'$currency${formatPointNumber(lastStock?.productPurchasePrice ?? 0)}',
'$currency${formatWithSeparator(lastStock?.productPurchasePrice ?? 0)}',
style: theme.textTheme.bodyMedium?.copyWith())),
DataCell(
onTap: () => navigateNextScreen(),
Text(
'$currency${formatPointNumber(lastStock?.productSalePrice ?? 0)}',
'$currency${formatWithSeparator(lastStock?.productSalePrice ?? 0)}',
)),
],
);
@@ -306,7 +306,7 @@ class StockListState extends ConsumerState<LowStock> {
),
),
Text(
'$currency${formatPointNumber(totalStockValue)}',
'$currency${formatWithSeparator(totalStockValue)}',
style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w600),
),
],

View File

@@ -4,6 +4,7 @@ import 'package:intl/intl.dart';
import 'package:mobile_pos/generated/l10n.dart' as l;
import 'package:mobile_pos/Screens/Products/Model/product_model.dart';
import '../../constant.dart';
import '../../currency.dart';
import '../../service/check_user_role_permission_provider.dart';
class StockInVarriantList extends ConsumerStatefulWidget {
@@ -105,7 +106,7 @@ class _StockInBatchListState extends ConsumerState<StockInVarriantList> {
),
if (permissionService.hasPermission(Permit.stocksPriceView.value))
_buildCell(
widget.product.stocks![index].productPurchasePrice.toString(),
'$currency${formatWithSeparator(widget.product.stocks![index].productPurchasePrice ?? 0)}',
4,
theme,
TextAlign.center,

View File

@@ -636,7 +636,7 @@ class StockListState extends ConsumerState<StockList> {
DataCell(
onTap: () => navigateNextScreen(),
Text(
'$currency${formatPointNumber(lastStock?.productPurchasePrice ?? 0)}',
'$currency${formatWithSeparator(lastStock?.productPurchasePrice ?? 0)}',
textAlign: TextAlign.center,
style: theme.textTheme.bodyMedium?.copyWith(),
),
@@ -644,7 +644,7 @@ class StockListState extends ConsumerState<StockList> {
DataCell(
onTap: () => navigateNextScreen(),
Text(
'$currency${formatPointNumber(lastStock?.productSalePrice ?? 0)}',
'$currency${formatWithSeparator(lastStock?.productSalePrice ?? 0)}',
textAlign: TextAlign.center,
)),
],
@@ -681,7 +681,7 @@ class StockListState extends ConsumerState<StockList> {
),
),
Text(
'$currency${formatPointNumber(displayedStockValue)}',
'$currency${formatWithSeparator(displayedStockValue)}',
style: theme.textTheme.titleMedium?.copyWith(fontWeight: FontWeight.w600),
),
],

View File

@@ -770,7 +770,7 @@ class _SubscriptionPlanScreenState extends ConsumerState<PurchasePremiumPlanScre
SizedBox(height: 10),
// Horizontal Plan List
SizedBox(
height: 165,
height: 185,
child: ListView.builder(
scrollDirection: Axis.horizontal,
itemCount: plans.length,
@@ -792,7 +792,7 @@ class _SubscriptionPlanScreenState extends ConsumerState<PurchasePremiumPlanScre
children: [
// Main card container (single instance now)
Container(
height: 145,
height: 165,
width: 115,
decoration: BoxDecoration(
color: isSelected

View File

@@ -1,7 +1,10 @@
import 'dart:io';
import 'package:bijoy_helper/bijoy_helper.dart';
import 'package:flutter/material.dart';
import 'package:intl/intl.dart';
import 'package:pdf/widgets.dart' as pw;
import 'package:restart_app/restart_app.dart';
import 'generated/l10n.dart' as lang;
import 'currency.dart';
@@ -49,7 +52,8 @@ const String onboard2 = 'images/onbord2.png';
const String onboard3 = 'images/onbord3.png';
const String logo = 'images/logokulakpos.png';
const String appsName = 'KULAKPOS';
const String companyWebsite = 'https://kulakpos.id';
const String companyWebsite = 'http://localhost:8000/';
// const String companyWebsite = 'https://dev.kulakpos.id/';
const String companyName = 'ONE TEKNOLOGI';
bool connected = false;
@@ -242,6 +246,15 @@ String formatPointNumber(num value, {bool addComma = false}) {
return formatted;
}
String formatWithSeparator(num value) {
try {
final formatter = NumberFormat.decimalPattern(getLocaleFromCurrency());
return formatter.format(value);
} catch (e) {
return value.toStringAsFixed(0);
}
}
// String formatPointNumber(num value) {
// if (value % 1 == 0) {
// return value.toInt().toString();
@@ -330,13 +343,19 @@ Widget getFieldLabelText({required String label, required BuildContext context})
final theme = Theme.of(context);
return label.contains('*')
? RichText(
text: TextSpan(text: label.replaceAll('*', ''), style: theme.textTheme.bodyLarge, children: [
TextSpan(
text: '*',
style: theme.textTheme.bodyLarge?.copyWith(
color: Color(0xffF68A3D),
))
]))
text: TextSpan(
text: label.replaceAll('*', ''),
style: theme.textTheme.bodyLarge,
children: [
TextSpan(
text: '*',
style: theme.textTheme.bodyLarge?.copyWith(
color: Color(0xffF68A3D),
),
),
],
),
)
: Text(label);
}
@@ -346,3 +365,9 @@ double fontSizeForPrinter(String? printerSize) {
if (printerSize != "3_inch_80mm") return 17;
return 17;
}
void restartApp() {
if (Platform.isAndroid || Platform.isIOS) {
Restart.restartApp();
}
}

View File

@@ -15,6 +15,7 @@ import 'package:mobile_pos/Screens/SplashScreen/on_board.dart';
import 'package:mobile_pos/Screens/SplashScreen/splash_screen.dart';
import 'package:mobile_pos/Screens/pos_sale/pos_sale.dart';
import 'package:mobile_pos/Screens/vat_&_tax/tax_report.dart';
import 'package:mobile_pos/Screens/Authentication/Sign%20In/sign_in_screen.dart';
import 'package:provider/provider.dart' as pro;
import 'Screens/Due Calculation/due_list_screen.dart';
@@ -65,6 +66,7 @@ class MyApp extends StatelessWidget {
'/': (context) => const SplashScreen(),
'/onBoard': (context) => const OnBoard(),
'/loginForm': (context) => const LoginForm(isEmailLogin: true),
'/signIn': (context) => const SignIn(),
'/signup': (context) => const RegisterScreen(),
'/forgotPassword': (context) => const ForgotPassword(),
'/home': (context) => const Home(),