Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void _tesPrint(
- {Pam? pam,
- TransactionAllModel? tm,
- List<CostDetail>? result,
- int? totalPrice,
- int? fee}) async {
- //SIZE
- // 0- normal size text
- // 1- only bold text
- // 2- bold with medium text
- // 3- bold with large texts
- //ALIGN
- // 0- ESC_ALIGN_LEFT
- // 1- ESC_ALIGN_CENTER
- // 2- ESC_ALIGN_RIGHT
- bluetooth.isConnected.then((isConnected) {
- if (isConnected!) {
- if (pam != null) {
- if (pam.name != null && pam.name!.isNotEmpty) {
- bluetooth.printCustom("${pam.name}", 0, 1);
- }
- if (pam.detailAddress != null && pam.detailAddress!.isNotEmpty) {
- bluetooth.printCustom("${pam.detailAddress}", 0, 1);
- }
- }
- bluetooth.printCustom("================================", 1, 1);
- bluetooth.printCustom("Di tagihkan Kepada", 0, 1);
- if (tm != null) {
- if (tm.name != null && tm.name!.isNotEmpty) {
- bluetooth.printNewLine();
- bluetooth.printNewLine();
- bluetooth.printCustom("${tm.name}", 0, 1);
- }
- if (tm.address != null && tm.address!.isNotEmpty) {
- bluetooth.printCustom("${tm.address}", 0, 1);
- }
- if (tm.uniqueId != null && tm.uniqueId!.isNotEmpty) {
- bluetooth.printCustom("${tm.uniqueId}", 0, 1);
- }
- }
- bluetooth.printCustom("================================", 1, 1);
- bluetooth.printCustom("RINCIAN PEMAKAIAN", 0, 1);
- if (tm != null) {
- if (tm.starMeter != null && tm.starMeter!.isNotEmpty) {
- bluetooth.printLeftRight("METER AWAL", "${tm.starMeter}", 0);
- } else {
- bluetooth.printLeftRight("METER AWAL", " ", 0);
- }
- if (tm.meterLast != null && tm.meterLast!.isNotEmpty) {
- bluetooth.printLeftRight("METER AKHIR", "${tm.meterLast}", 0);
- } else {
- bluetooth.printLeftRight("METER AKHIR", " ", 0);
- }
- if (tm.meterNow != null && tm.meterNow!.isNotEmpty) {
- bluetooth.printLeftRight("VOLUME", "${tm.meterNow}", 0);
- } else {
- bluetooth.printLeftRight("VOLUME", " ", 0);
- }
- }
- bluetooth.printCustom("================================", 1, 1);
- bluetooth.printCustom("RINCIAN BIAYA", 0, 1);
- result!.map((product) {
- String qtyBrg = product.meter.toString();
- String hrgBrg = rupiah(product.cost?.toInt());
- // double subtotal = product.transactionQuantity *
- // product.transactionSinglePrice.toDouble();
- String subtotal = rupiah(int.parse(product.total!));
- // String subtot = rupiah(subtotal.toInt());
- bluetooth.printLeftRight("$qtyBrg x $hrgBrg", subtotal, 1);
- }).toList();
- bluetooth.printCustom("--------------------------------", 1, 1);
- bluetooth.printLeftRight("Subtotal Rp", "$totalPrice", 1);
- bluetooth.printLeftRight("Biaya Admi Rp", "$fee", 1);
- bluetooth.printNewLine();
- bluetooth.printNewLine();
- }
- });
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement