public bool PrintQRCodeWarehouse(WMS.Model.WarehouseInfor infor)
        {
            try
            {
                if (!ConnectPrinter())
                {
                    return(false);
                }

                int multiplier = 1;
                // 203 DPI : 1mm is about 7.99 dots
                // 300 DPI : 1mm is about 11.81 dots
                // 600 DPI : 1mm is about 23.62 dots
                int resolution = BXLLApi.GetPrinterDPI();
                int dotsPer1mm = (int)Math.Round((float)resolution / 25.4f);
                if (resolution >= 600)
                {
                    multiplier = 3;
                }

                SendPrinterSettingCommand();


                BXLLApi.PrintTrueFontW(2 * dotsPer1mm, 3 * dotsPer1mm, "Arial", 24, 0, true, true, false, "Warehouse: " + infor.Warehouse, false);

                BXLLApi.PrintBlock(1 * dotsPer1mm, 6 * dotsPer1mm, 45 * dotsPer1mm, 7 * dotsPer1mm, (int)SLCS_BLOCK_OPTION.LINE_OVER_WRITING, 0);
                BXLLApi.PrintDeviceFont(6 * dotsPer1mm, 10 * dotsPer1mm, (int)SLCS_DEVICE_FONT.ENG_24X38, multiplier, multiplier, (int)SLCS_ROTATION.ROTATE_0, false, "Material: " + infor.Material);
                BXLLApi.PrintDeviceFont(6 * dotsPer1mm, 14 * dotsPer1mm, (int)SLCS_DEVICE_FONT.ENG_24X38, multiplier, multiplier, (int)SLCS_ROTATION.ROTATE_0, false, "Lot: " + infor.Lot);
                BXLLApi.PrintDeviceFont(6 * dotsPer1mm, 18 * dotsPer1mm, (int)SLCS_DEVICE_FONT.ENG_24X38, multiplier, multiplier, (int)SLCS_ROTATION.ROTATE_0, false, "Quantity: " + infor.quantity.ToString("N3") + " " + infor.Unit);
                BXLLApi.PrintDeviceFont(6 * dotsPer1mm, 22 * dotsPer1mm, (int)SLCS_DEVICE_FONT.ENG_24X38, multiplier, multiplier, (int)SLCS_ROTATION.ROTATE_0, false, "Expiry Date: " + infor.expiryDate.ToString("dd/MM/yyyy"));

                string QRCode_data = infor.Warehouse + ";" + infor.Material + ";" + infor.Lot + ";" + infor.quantity + ";" + infor.ImportDate.ToString("ddMMyyyy") + ";" + infor.expiryDate.ToString("ddMMyyyy");
                BXLLApi.PrintQRCode(47 * dotsPer1mm, 25 * dotsPer1mm, (int)SLCS_QRCODE_MODEL.QRMODEL_2, (int)SLCS_QRCODE_ECC_LEVEL.QRECCLEVEL_H, (int)SLCS_QRCODE_SIZE.QRSIZE_9, (int)SLCS_ROTATION.ROTATE_0, QRCode_data);


                //	Print Command
                BXLLApi.Prints(1, 1);

                // Disconnect printer
                BXLLApi.DisconnectPrinter();
                return(true);
            }
            catch (Exception ex)
            {
                SystemLog.Output(SystemLog.MSG_TYPE.Err, "print label fail", ex.Message);
                return(false);
            }
        }
 private void btn_PrintForm2_Click(object sender, EventArgs e)
 {
     try
     {
         WMS.Model.WarehouseInfor warehouseInfor = new WMS.Model.WarehouseInfor();
         warehouseInfor.Material   = txt_partno2.Text.Trim();
         warehouseInfor.Lot        = txt_lot2.Text.Trim();
         warehouseInfor.quantity   = nmr_quantity2.Value;
         warehouseInfor.Unit       = cb_unit2.SelectedItem.ToString();
         warehouseInfor.ImportDate = dtpk_import2.Value;
         warehouseInfor.expiryDate = dtpk_expiry2.Value;
         Device.Printer.PritingLabel pritingLabel = new Device.Printer.PritingLabel();
         pritingLabel.PrintQRCodeWarehouse(warehouseInfor);
     }
     catch (Exception ex)
     {
         SystemLog.Output(SystemLog.MSG_TYPE.Err, "btn_printForm1_Click(object sender, EventArgs e)", ex.Message);
     }
 }