DataPaymentInvoice constructor
DataPaymentInvoice({
- required int partnerId,
- String? companyName,
- String? address,
- String? phoneNumber,
- String? invoiceTitle,
- required String invoiceNumber,
- required String date,
- required String recipientName,
- required String amount,
- required String note,
- required String totalAccount,
- required String totalPaid,
- required String authorizedSignature,
- String language = 'fa',
Implementation
DataPaymentInvoice({
required this.partnerId,
this.companyName,
this.address,
this.phoneNumber,
this.invoiceTitle,
required this.invoiceNumber,
required this.date,
required this.recipientName,
required this.amount,
required this.note,
required this.totalAccount,
required this.totalPaid,
required this.authorizedSignature,
this.language = 'fa',
}) {
amountInWords = language == 'en'
? convertNumberToEnglishWords(double.parse(cleanString(amount)).toInt())
: (language == 'ar'
? convertNumberToArabicWords(
double.parse(cleanString(amount)).toInt())
: convertNumberToKurdishWords(
double.parse(cleanString(amount)).toInt()));
var suffix = '';
if (amount.trim().endsWith('\$')) {
suffix = language == 'en'
? 'dollar'
: (language == 'ar' ? 'الدولار' : 'دۆلار');
} else {
suffix =
language == 'en' ? 'dinar' : (language == 'ar' ? 'دینار' : 'دینار');
}
amountInWords = '${amountInWords!} $suffix';
companyName = partners[partnerId]?.getCompanyName(language) ??
'Kurdish Voice Casting';
address = partners[partnerId]?.getAddress(language) ?? 'Sulaimanya';
phoneNumber =
partners[partnerId]?.getPhoneNumber(language) ?? '07748133883';
invoiceTitle =
partners[partnerId]?.getInvoiceTitle(language) ?? 'Contact Invoice';
}