private void AddItemToGrid(clsSmartCashTransaction hist) { int rowidx = dgvTrans.Rows.Add(); dgvTrans.Rows[rowidx].Cells[0].Value = hist.TransDate; dgvTrans.Rows[rowidx].Cells[1].Value = hist.AccountName; dgvTrans.Rows[rowidx].Cells[2].Value = hist.RefNum; dgvTrans.Rows[rowidx].Cells[3].Value = hist.SenderName; dgvTrans.Rows[rowidx].Cells[4].Value = hist.SenderContact; dgvTrans.Rows[rowidx].Cells[5].Value = hist.RecipientName; dgvTrans.Rows[rowidx].Cells[6].Value = clsSmartCashTransaction.GetTransType(hist.TransType); dgvTrans.Rows[rowidx].Cells[7].Value = clsSmartCashTransaction.GetPaymentMode(hist.PaymentMode); dgvTrans.Rows[rowidx].Cells[8].Value = hist.TransAmount; dgvTrans.Rows[rowidx].Cells[9].Value = hist.SvcFeeAmount; double transamt = clsSmartCashTransaction.GetTransAmount(hist.TransType, hist.PaymentMode, hist.TransAmount, hist.SvcFeeAmount); if (transamt < 0) { dgvTrans.Rows[rowidx].Cells[10].Value = string.Format("({0})", Decimal.Negate(Decimal.Parse(transamt.ToString()))); } else { dgvTrans.Rows[rowidx].Cells[10].Value = string.Format("{0}", transamt); } dgvTrans.Rows[rowidx].Cells[11].Value = hist.UserName; }
private void btnProcessSend_Click(object sender, EventArgs e) { if (ValidateInput()) { clsSmartCashTransaction sc = new clsSmartCashTransaction(); sc.TransDate = DateTime.Now; sc.SenderName = txtSenderName.Text.Trim(); sc.SenderContact = txtSenderNum.Text.Trim(); sc.Load_Id = m_LoadAccount.LoadId; sc.Remarks = " "; sc.RecepientAccNum = " "; sc.UserId = myPosWide.m_user.UserId; if (tabCtrl.SelectedIndex == 0) { sc.TransType = SCashTranstype.SEND; sc.RecipientName = txtSSRecipientName.Text.Trim(); sc.RecipientContact = txtSSRecipientNum.Text.Trim(); sc.RecepientAccNum = txtSSSmartMoney.Text.Trim(); sc.RefNum = txtSSRefNum.Text; sc.TransAmount = double.Parse(txtSSAmount.Text.Trim()); sc.SvcFeeAmount = double.Parse(txtSSSvcFee.Text.Trim()); sc.Rebate = double.Parse(txtSSCommission.Text.Trim()); sc.Remarks = clsSmartCashTransaction.GetTransType(sc.TransType); frmInput input = new frmInput(); double amountdue = sc.TransAmount + sc.SvcFeeAmount; input.Title = "Payment"; input.Value = amountdue.ToString("0.00"); input.Caption = "Enter Tendered Amount"; if (input.ShowDialog() == System.Windows.Forms.DialogResult.OK) { if (Convert.ToDouble(input.Value) >= amountdue) { sc.TenderedAmount = Convert.ToDouble(input.Value); if (sc.Save()) { string ret = ""; Receipt or = new Receipt(); or.InitializePrinter(); List <string> strmsg = new List <string>(); ret += or.PrintCompanyHeader(); strmsg.Add("SMART MONEY"); strmsg.Add(sc.Remarks); ret += or.PrintHeader(strmsg, PrintFontAlignment.Center, PrintFontSize.UnderlineBold); strmsg.Clear(); strmsg.Add(string.Format("Cashier: {0}", myPosWide.m_user.UserName.ToUpper())); strmsg.Add(string.Format("Date: {0}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))); strmsg.Add(string.Format("TransId: {0}", sc.SCashTransId)); strmsg.Add(""); strmsg.Add(string.Format("Sender: {0:0.00}", sc.SenderName)); strmsg.Add(string.Format("Contact Num: {0:0.00}", sc.SenderContact)); strmsg.Add(string.Format("Recipient: {0:0.00}", sc.RecipientName)); strmsg.Add(string.Format("Contact: {0:0.00}", sc.RecipientContact)); strmsg.Add(string.Format("Smart Money: {0:0.00}", sc.RecepientAccNum)); strmsg.Add(string.Format("RefNum: {0:0.00}", sc.RefNum)); strmsg.Add(string.Format("Trans Amount: P {0:0.00}", sc.TransAmount)); strmsg.Add(string.Format("Service Fee: P {0:0.00}", sc.SvcFeeAmount)); strmsg.Add(string.Format("Total Amount: P {0:0.00}", amountdue)); strmsg.Add(string.Format("Tendered Amount: P {0:0.00}", sc.TenderedAmount)); strmsg.Add(string.Format("Change Amount: P {0:0.00}", sc.TenderedAmount - amountdue)); strmsg.Add(""); strmsg.Add(""); ret += or.PrintAppend(strmsg, PrintFontAlignment.Left, PrintFontSize.Regular); or.FormFeed(); or.OpenDrawer(); or.ExecPrint(ret); strmsg.Clear(); Clear(); m_LoadAccount = clsLoadAccount.GetLoadAccount(m_LoadAccount.LoadId); RefreshAccount(); } else { MessageBox.Show("Saving failed", "Save", MessageBoxButtons.OK, MessageBoxIcon.Error); } } else { MessageBox.Show("Amount entered is less than the Amount Due", "Payment", MessageBoxButtons.OK, MessageBoxIcon.Information); } } } else if (tabCtrl.SelectedIndex == 1) { sc.TransType = SCashTranstype.ENCASH; if (optCash.Checked) { sc.PaymentMode = SCashPaymentMode.CASH; } else if (optSmartMoney.Checked) { sc.PaymentMode = SCashPaymentMode.SMARTMONEY; } sc.SenderAccnum = txtCSSmartMoney.Text; sc.RefNum = txtCSRefNum.Text; sc.TransAmount = double.Parse(txtCSAmount.Text.Trim()); sc.SvcFeeAmount = double.Parse(txtCSSvcFee.Text.Trim()); sc.Rebate = 0; // double.Parse(txtCSCommission.Text.Trim()); sc.TotalAmtTransfered = double.Parse(txtCSTotalAmtTrans.Text); if (MessageBox.Show(string.Format("You are about to deduct {0:0.00} from your actual cash on hand.\n\nAre you sure this is correct?", sc.TransAmount - sc.SvcFeeAmount), "Payment", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes) { if (sc.Save()) { if (clsUnclaimedCash.ClaimCash(sc.RefNum)) { UpdateList(); } string ret = ""; Receipt or = new Receipt(); or.InitializePrinter(); List <string> strmsg = new List <string>(); ret += or.PrintCompanyHeader(); strmsg.Add("SMART MONEY"); strmsg.Add(sc.Remarks); ret += or.PrintHeader(strmsg, PrintFontAlignment.Center, PrintFontSize.UnderlineBold); strmsg.Clear(); strmsg.Add(string.Format("Cashier: {0}", myPosWide.m_user.UserName.ToUpper())); strmsg.Add(string.Format("Date: {0}", DateTime.Now.ToString("yyyy-MM-dd HH:mm:ss"))); strmsg.Add(string.Format("TransId: {0}", sc.SCashTransId)); strmsg.Add(""); strmsg.Add(string.Format("Sender: {0:0.00}", sc.SenderName)); strmsg.Add(string.Format("Contact Num: {0:0.00}", sc.SenderContact)); strmsg.Add(string.Format("Smart Money: {0:0.00}", sc.RecepientAccNum)); strmsg.Add(string.Format("RefNum: {0:0.00}", sc.RefNum)); strmsg.Add(string.Format("Trans Amount: P {0:0.00}", sc.TransAmount)); strmsg.Add(string.Format("Service Fee: P {0:0.00}", sc.SvcFeeAmount)); strmsg.Add(string.Format("Payout Amount: P {0:0.00}", sc.TransAmount - sc.SvcFeeAmount)); strmsg.Add(""); strmsg.Add(""); ret += or.PrintAppend(strmsg, PrintFontAlignment.Left, PrintFontSize.Regular); or.FormFeed(); or.OpenDrawer(); or.ExecPrint(ret); strmsg.Clear(); Clear(); RefreshAccount(); } } } } }