private void MBtnApplyFilter_Click(object sender, EventArgs e)
 {
     if (mIsApplyButtonEnabled)
     {
         var result = new Intent();
         result.PutExtra("isFiltered", IsFiltered());
         result.PutExtra("isCancelled", false);
         result.PutExtra("isCleared", false);
         result.PutExtra("filterText", FilterText());
         result.PutExtra("isDateRangeUsed", mIsDateRangeUsed);
         result.PutExtra("startDate", mCurrentSelectedStartDate.Ticks);
         result.PutExtra("endDate", mCurrentSelectedEndDate.Ticks);
         result.PutExtra("selectedFilterDateRange", mIsDateRangeUsed ? "" : mSelectedFilterText);
         result.PutExtra("isCustomerSalesFilterChecked", mCbCustomerSales.Checked);
         result.PutExtra("isPaylaterUnpaidFilterChecked", mCbPayLaterUnpaid.Checked);
         result.PutExtra("isPaylaterPaidFilterChecked", mCbPayLaterPaid.Checked);
         result.PutExtra("isCashFilterChecked", mCbCash.Checked);
         result.PutExtra("isCheckFilterChecked", mCbCheck.Checked);
         result.PutExtra("isShowCancelledSalesChecked", mCbShowCancelSalesOnly.Checked);
         SetResult(Result.Ok, result);
         Finish();
     }
     else
     {
         DialogMessageService.MessageBox(this, "Incomplete fields", "Please set a period first");
     }
 }
Esempio n. 2
0
 private void MImgPrint_Click(object sender, EventArgs e)
 {
     using (var mBluetoothAdapter = BluetoothAdapter.DefaultAdapter)
     {
         if (mBluetoothAdapter == null)
         {
             DialogMessageService.MessageBox(this, "Attention", "This device does not support bluetooth");
         }
         else if (mBluetoothAdapter.IsEnabled)
         {
             BluetoothDevice     printer             = mBluetoothAdapter.GetRemoteDevice(mReceiptSettings.ReceiptPrinterAddress);
             PrintReceiptService printReceiptService = new PrintReceiptService();
             if (mIsMultipay)
             {
                 string idString       = "#47, #46";
                 int[]  transactionIds = idString.Replace("#", "").Replace(" ", "").Split(',').Select(int.Parse).ToArray();
                 var    receiptList    = printReceiptService.GetMultipayStringPrintList(
                     mReceiptSettings.ReceiptCompanyName,
                     mReceiptSettings.ReceiptAddressLine1,
                     mReceiptSettings.ReceiptAddressLine2,
                     mReceiptSettings.ReceiptContactNumber,
                     mReceiptSettings.ReceiptFooterNote,
                     mTransactionItemsDataAccess.SelectTable()
                     .OrderBy(x => x.Id).Where(x => transactionIds.Contains(x.TransactionId)).ToList(),
                     mTransactionsDataAccess.SelectTable()
                     .OrderByDescending(x => x.id).Where(x => transactionIds.Contains(x.id)).ToList(),
                     mSelectedMultipayRecord,
                     mRunnersDataAccess);
                 printReceiptService.PrintText(printer, receiptList);
             }
             else
             {
                 printReceiptService.PrintText(printer,
                                               printReceiptService.toPrint(
                                                   mSelectedTransaction.id.ToString(),
                                                   GetFormattedDateTimeString(mSelectedTransaction.TransactionDateTime),
                                                   mReceiptSettings.ReceiptCompanyName,
                                                   mReceiptSettings.ReceiptAddressLine1,
                                                   mReceiptSettings.ReceiptAddressLine2,
                                                   mReceiptSettings.ReceiptContactNumber,
                                                   mSelectedTransaction.CashierName,
                                                   mSelectedTransaction.TransactionType == "PAYLATER" ? "Runner:" : "Customer:",
                                                   GetCustomerOrRunnerName(mSelectedTransaction.TransactionType == "PAYLATER", mSelectedTransaction.CustomerOrRunnerId),
                                                   mReceiptSettings.ReceiptFooterNote,
                                                   mTransactionItemsDataAccess.SelectRecord(mSelectedTransactionId))
                                               );
             }
         }
         else
         {
             DialogMessageService.MessageBox(this, "Attention", "Please turn on your Bluetooth to connect the printer to your phone.");
         }
     }
 }