private void tsmiPrint_Click(object sender, EventArgs e) { if (current == null) return; if(current.LdtBills == null || current.LdtBills.Count == 0) { MsgBox.Info("没有明细,不可打印。"); return; } if (!MsgBox.Ask(string.Format("您确定要打印[{1}-{0}]长话清单?", current.PhoneNo, current.Name))) return; LdtPrintBiz biz = new LdtPrintBiz(cmbPrinters.Text, CfgParam.FrontOffset, CfgParam.BackOffset, CfgParam.MaxPrintBills); biz.Print(current, dtpFrom.Checked ? dtpFrom.Value : (DateTime?)null, dtpTo.Checked ? dtpTo.Value : (DateTime?)null); }
private void btnPrint_Click(object sender, EventArgs e) { dgvCust.EndEdit(); if(ldtCustomerList == null || ldtCustomerList.Count == 0 || !ldtCustomerList.Any(c=>c.Checked)) { MsgBox.Info("没有要打印的数据。"); return; } if (!MsgBox.Ask("您确定要打印所选数据?")) return; IList<LdtCustomerInfo> printList = new List<LdtCustomerInfo>(); for(int i=0;i<ldtCustomerInfoBindingSource.Count;i++) { LdtCustomerInfo cust = ldtCustomerInfoBindingSource[i] as LdtCustomerInfo; if(cust == null) continue; if(!cust.Checked) continue; printList.Add(cust); cust.Checked = false; ldtCustomerInfoBindingSource.ResetBindings(false); } LdtPrintBiz biz = new LdtPrintBiz(cmbPrinters.Text, CfgParam.FrontOffset, CfgParam.BackOffset, CfgParam.MaxPrintBills); biz.Print(printList, dtpFrom.Checked?dtpFrom.Value:(DateTime?) null, dtpTo.Checked ? dtpTo.Value : (DateTime?)null); CfgParam.DefaultPrinter = cmbPrinters.Text; }