예제 #1
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     if (_dicItemPriceByGroup.Count > 0)
     {
         List<String> printData = new List<String>();
         printData.Add(GetDataType2("店铺名称:", ConstantValuePool.CurrentShop.ShopName));
         printData.Add(GetDataType2("店铺编号:", ConstantValuePool.CurrentShop.ShopNo));
         printData.Add(GetDataType2("营业日:", DateTime.Now.ToString("yyyy-MM-dd")));
         printData.Add("  ");
         foreach (KeyValuePair<string, List<GroupPrice>> item in _dicItemPriceByGroup)
         {
             printData.Add("[" + item.Key + "]");
             foreach (GroupPrice groupPrice in item.Value)
             {
                 printData.Add(GetDataType3(groupPrice.ItemsName, groupPrice.ItemsTotalQty.ToString("f1"), groupPrice.ItemsTotalPrice.ToString("f2")));
             }
             printData.Add("  ");
         }
         printData.Add("       合计数量:" + txtTotalQty.Text + "  合计金额:" + txtTotalAmount.Text);
         if (ConstantValuePool.BizSettingConfig.printConfig.PrinterPort == PortType.DRIVER)
         {
             string printerName = ConstantValuePool.BizSettingConfig.printConfig.Name;
             string paperName = ConstantValuePool.BizSettingConfig.printConfig.PaperName;
             DriverSinglePrint driverPrint = new DriverSinglePrint(printerName, paperName);
             driverPrint.DoPrint(printData, new Font("simsun", 9F));
         }
     }
 }
예제 #2
0
 private void btnPrint_Click(object sender, EventArgs e)
 {
     if (dgvSalesReport.Rows.Count > 0)
     {
         List<String> printData = new List<String>();
         foreach (DataGridViewRow dgr in dgvSalesReport.Rows)
         {
             if (dgr.Cells[0].Value != null && !string.IsNullOrEmpty(dgr.Cells[0].Value.ToString().Trim()))
             {
                 printData.Add(dgr.Cells[0].Value.ToString());
             }
             else
             {
                 printData.Add("  ");
             }
         }
         if (ConstantValuePool.BizSettingConfig.printConfig.PrinterPort == PortType.DRIVER)
         {
             string printerName = ConstantValuePool.BizSettingConfig.printConfig.Name;
             string paperName = ConstantValuePool.BizSettingConfig.printConfig.PaperName;
             DriverSinglePrint driverPrint = new DriverSinglePrint(printerName, paperName);
             driverPrint.DoPrint(printData);
         }
     }
 }