printReceiptTransaction method

dynamic printReceiptTransaction(
  1. dynamic appData,
  2. dynamic context
)

Implementation

printReceiptTransaction(appData, context) {
  var dataRow = getTableRowByID(_mFocusNode[gName], _mFocusNode[gId]);
  if (!isNull(dataRow)) {
    return;
  }
  //print('printReceiptTransaction dataRow: $dataRow');
  var isUser = appData[0][gIsselected];
  //var lengthbefore = _requestList!.length;
  //print('---- invokeMethod');
  dataRow[gIsselected] = isUser.toString();
  try {
    nativeChannel.invokeMethod('print', dataRow);
  } catch (e) {
    myLog(e);
  } finally {}

  //save to DB
  //
  if (!isUser) {
    finishme([], context);
    invoke(
        gTableAddNewCommon,
        [
          [
            {
              gTableID: gZzytransaction,
              gType: gTable,
              gLabel: gPay,
              gWhere:
                  "parentid='${_globalParam[gGlobalCompanyid]}' and transtype='$gCustomer' and targettype='$gCustomer' and action='$gConsume' and targetid='targetfakeid'",
            }
          ],
          context
        ],
        context);

    /*actions.add({
                gAction:gTableAddNewCommon,
                gData:[{gTableID:gZzytransaction,
                gType:gTable,
                gLabel:gPay,
                gWhere:"parentid='17' and transtype='$gCustomer' and targettype='$gCustomer' and action='$gConsume' and targetid='targetfakeid'",
                }]


              });*/

    return;
  }
  int backcolor = Colors.white.value;
  Map itemList = getMerchantPrint(dataRow, false);

  Widget w =
      getBodyStack(true, getEmptyWidget(), itemList, backcolor, [], context);

  AlertDialog alert = AlertDialog(
    title: MyLabel(
        const {gLabel: 'Print merchant copy?', gFontWeight: FontWeight.bold},
        backcolor),
    content: w,
  );
  // show the dialog
  showDialog(
    context: context,
    builder: (BuildContext context) {
      return alert;
    },
  );
}