perbaikan on possale string 1
This commit is contained in:
@@ -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),
|
||||
),
|
||||
),
|
||||
),
|
||||
|
||||
Reference in New Issue
Block a user