Commit 7410f941 by Wyh

3-14 打印結賬單,金額錯誤問題

parent f03728f5
...@@ -129,7 +129,7 @@ public class PrintUtils { ...@@ -129,7 +129,7 @@ public class PrintUtils {
} }
} }
} }
} else if(type == 4){ } else if (type == 4) {
//清機報表 //清機報表
bitmaps.add(getReportBitmap(mContext)); bitmaps.add(getReportBitmap(mContext));
} }
...@@ -270,7 +270,7 @@ public class PrintUtils { ...@@ -270,7 +270,7 @@ public class PrintUtils {
BigDecimal totalAmount = new BigDecimal(0); BigDecimal totalAmount = new BigDecimal(0);
for (OrderDetail OrderDetail : MyOrderManage.getInstance().getOrderFoodList()) { for (OrderDetail OrderDetail : MyOrderManage.getInstance().getOrderFoodList()) {
totalAmount = MoneyUtil.sum(totalAmount, MoneyUtil.priceCalculation(OrderDetail.getPrice(), OrderDetail.getNumber())); totalAmount = MoneyUtil.sum(totalAmount, OrderDetail.getPrice());
} }
//總金額 //總金額
mTvTotalAmount.setText(totalAmount + ""); mTvTotalAmount.setText(totalAmount + "");
...@@ -332,6 +332,7 @@ public class PrintUtils { ...@@ -332,6 +332,7 @@ public class PrintUtils {
/** /**
* 獲取測試打印bitmap * 獲取測試打印bitmap
*
* @param context * @param context
* @return * @return
*/ */
...@@ -340,16 +341,15 @@ public class PrintUtils { ...@@ -340,16 +341,15 @@ public class PrintUtils {
return viewToBitmap(context, view); return viewToBitmap(context, view);
} }
private static Bitmap getReportBitmap(Context mContext){ private static Bitmap getReportBitmap(Context mContext) {
View view = PrintTransitUtils.getInstance().getPrintView(); View view = PrintTransitUtils.getInstance().getPrintView();
if(view != null){ if (view != null) {
return viewToBitmap(mContext, view); return viewToBitmap(mContext, view);
} }
return null; return null;
} }
public static Bitmap viewToBitmap(Context context, View view) { public static Bitmap viewToBitmap(Context context, View view) {
LayoutToBitmapUtils.layoutView(context, view);//先测量view LayoutToBitmapUtils.layoutView(context, view);//先测量view
//580為程序支持的打印紙最大寬度 //580為程序支持的打印紙最大寬度
......
package com.joe.print.mvp.ui.adapter; package com.joe.print.mvp.ui.adapter;
import android.content.Context; import android.content.Context;
import android.util.Log;
import android.widget.RadioButton; import android.widget.RadioButton;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
...@@ -94,7 +93,6 @@ public class PrinterListAdapter extends BaseQuickAdapter<PrinterDeviceBean, Base ...@@ -94,7 +93,6 @@ public class PrinterListAdapter extends BaseQuickAdapter<PrinterDeviceBean, Base
* @param isChecked * @param isChecked
*/ */
private void setSelectPrint(BaseViewHolder helper, PrinterDeviceBean item, boolean isChecked) { private void setSelectPrint(BaseViewHolder helper, PrinterDeviceBean item, boolean isChecked) {
Log.e("error", "是否選中:" + isChecked + item.getIp() + "端口號:" + item.getPort() + "紙張:" + item.getType());
if (isChecked) { if (isChecked) {
SPUtils.put(mContext, PrintConstans.DEFAULT_PRINT_IP, item.getIp()); SPUtils.put(mContext, PrintConstans.DEFAULT_PRINT_IP, item.getIp());
SPUtils.put(mContext, PrintConstans.DEFAULT_PRINT_PORT, item.getPort()); SPUtils.put(mContext, PrintConstans.DEFAULT_PRINT_PORT, item.getPort());
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment