private void PrintTape_PrintPage(object sender, System.Drawing.Printing.PrintPageEventArgs e) { Font font = new Font("Courier New", 12, FontStyle.Bold, GraphicsUnit.Pixel); int vertical = 10; if (batches.Count > 0) { e.Graphics.DrawString(BatchTextBox.Text, font, Brushes.Black, new Point(10, vertical)); vertical += 15; e.Graphics.DrawString(batches[0].BatchCmnt, font, Brushes.Black, new Point(10, vertical)); vertical += 25; } decimal total = 0; foreach (var item in tapes) { string textToPrint = string.Format("{0, 10}", item.Amount) + " " + item.Symbol; e.Graphics.DrawString(textToPrint, font, Brushes.Black, new Point(10, vertical)); vertical += 15; total += item.Amount; } e.Graphics.DrawString("---------------", font, Brushes.Black, new Point(10, vertical)); vertical += 15; e.Graphics.DrawString(string.Format("{0:n}", total), font, Brushes.Black, new Point(10, vertical)); UserAmountTextBox.Focus(); }
private async void LoadButton_Click(object sender, EventArgs e) { BatchDGV.Rows.Clear(); //test #: ARCR-0050090 var userInput = BatchTextBox.Text.TrimEnd(); batches = await service.GetARBatchesAsync(userInput); var batchWithNullTranAmt = batches.FirstOrDefault(c => c.TranAmt == null); if (batchWithNullTranAmt != null) { return; //exit } decimal total = 0; foreach (var batch in batches) { total += (decimal)batch.TranAmt; var index = BatchDGV.Rows.Add(); var row = BatchDGV.Rows[index]; row.Cells["Description"].Value = batch.TranNo; row.Cells["Amount"].Value = batch.TranAmt; } BatchTotalTextBox.Text = total.ToString("N2"); UserAmountTextBox.Focus(); }
private void BatchTextBox_KeyUp(object sender, KeyEventArgs e) { if (e.KeyCode == Keys.Enter) { LoadButton.PerformClick(); UserAmountTextBox.Focus(); } }
private void ClearButton_Click(object sender, EventArgs e) { tapes.Clear(); TapeDGV.Rows.Clear(); TapeTotalTextBox.Clear(); UserAmountTextBox.Focus(); }
private void ReconcileButton_Click(object sender, EventArgs e) { //Batch DGV columns - description 170 width, amount 80 width, total size 253 //Tape DGV columns - symbol 30 width, amount 155 width, total 200 if (BatchDGV.Columns["BatchAsterisk"] == null) { // add asterisk columns to both dgv var batchColIndex = BatchDGV.Columns.Add("BatchAsterisk", ""); var tapeColIndex = TapeDGV.Columns.Add("TapeAsterisk", ""); // resize columns to fit without scroll BatchDGV.Columns[batchColIndex].Width = 20; BatchDGV.Columns[batchColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; BatchDGV.Columns["Description"].Width = 145; TapeDGV.Columns[tapeColIndex].Width = 20; TapeDGV.Columns[tapeColIndex].DefaultCellStyle.Alignment = DataGridViewContentAlignment.MiddleCenter; TapeDGV.Columns["TapeAmount"].Width = 130; } else { //clear out * foreach (DataGridViewRow row in BatchDGV.Rows) { row.Cells["BatchAsterisk"].Value = ""; } foreach (DataGridViewRow row in TapeDGV.Rows) { row.Cells["TapeAsterisk"].Value = ""; } } // mark with asterisk where match values between both for (int i = 0; i < batches.Count; i++) { var match = tapes.FirstOrDefault(c => c.Amount == batches[i].TranAmt); if (match != null) { BatchDGV.Rows[i].Cells["BatchAsterisk"].Value = "*"; var tapeIndex = tapes.FindIndex(c => c == match); TapeDGV.Rows[tapeIndex].Cells["TapeAsterisk"].Value = "*"; } else { BatchDGV.Rows[i].Cells["BatchAsterisk"].Value = ""; } } UserAmountTextBox.Focus(); }
private void FocusUserAmountTextBox(object sender, KeyEventArgs e) { if (sender is TextBox && (sender as TextBox).Name == "BatchTextBox") { return; } switch (e.KeyCode) { case Keys.Back: SendKeys.Send("{BACKSPACE}"); break; case Keys.Enter: SendKeys.Send("{ENTER}"); break; case Keys.Add: SendKeys.Send("{ADD}"); break; case Keys.Subtract: SendKeys.Send("{SUBTRACT}"); break; case Keys.NumPad0: SendKeys.Send("0"); break; case Keys.NumPad1: SendKeys.Send("1"); break; case Keys.NumPad2: SendKeys.Send("2"); break; case Keys.NumPad3: SendKeys.Send("3"); break; case Keys.NumPad4: SendKeys.Send("4"); break; case Keys.NumPad5: SendKeys.Send("5"); break; case Keys.NumPad6: SendKeys.Send("6"); break; case Keys.NumPad7: SendKeys.Send("7"); break; case Keys.NumPad8: SendKeys.Send("8"); break; case Keys.NumPad9: SendKeys.Send("9"); break; case Keys.Decimal: SendKeys.Send("."); break; case Keys.Tab: return; default: break; } UserAmountTextBox.Focus(); }
private void BackspaceButton_Click(object sender, EventArgs e) { UserAmountTextBox.Focus(); SendKeys.Send("{BACKSPACE}"); }
private void AddButton_Click(object sender, EventArgs e) { UserAmountTextBox.Focus(); SendKeys.Send("{ADD}"); }
private void SubtractionButton_Click(object sender, EventArgs e) { UserAmountTextBox.Focus(); SendKeys.Send("{SUBTRACT}"); }
private void EightButton_Click(object sender, EventArgs e) { UserAmountTextBox.Focus(); SendKeys.Send("8"); }
private void DecimalButton_Click(object sender, EventArgs e) { UserAmountTextBox.Focus(); SendKeys.Send("."); }