private void btnPrint_Click(object sender, EventArgs e) { if (this.RefreshData()) { string strSelBatchNo = this.cmbBatchNo.Text; int count = 1; Dictionary<int, ChequeItem> pDicPrintItem = new Dictionary<int, ChequeItem>(); DataTable dtBatchDetail = this.dgvResult.DataSource as DataTable; foreach (DataRow dr in dtBatchDetail.Rows) { string pTxNo = dr["TX_ref_no"].ToString(); string pChequeNo = dr["ChequeNo"].ToString(); string pBatchNo = dr["C_BatchNo"].ToString(); double pTotalAmt = Convert.ToDouble(dr["Amount"]); List<string> pListDetail = new List<string>(); string[] strDetail = dr["Detail"].ToString().Split(new string[] { "INV@" }, StringSplitOptions.None); foreach (var item in strDetail) { pListDetail.Add(item); } ChequeItem checkItemIns = new ChequeItem(pTxNo, pChequeNo, pBatchNo, pTotalAmt, pListDetail); pDicPrintItem.Add(count++, checkItemIns); } using (var dlg = new frmPrintChequeView(strSelBatchNo, pDicPrintItem)) { if (dlg.ShowDialog(this) == DialogResult.OK) this.InitData(); } } }
/// <summary> /// Initializes a new instance of a <see cref="frmPrintCheque"/>. /// </summary> public frmPrintChequeView(string strBatchNo, ChequeItem pPrintItem) { this.InitForm(); this.strBatchNo = strBatchNo; this.dicPrintItem = new Dictionary<int, ChequeItem>(); this.dicPrintItem.Add(1, pPrintItem); }