示例#1
0
        private void AddItemToGrid(clsGCashTransaction 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 = clsGCashTransaction.GetTransType(hist.TransactionType);
            dgvTrans.Rows[rowidx].Cells[6].Value = hist.TransAmount;
            dgvTrans.Rows[rowidx].Cells[7].Value = hist.SvcFeeAmount;
            dgvTrans.Rows[rowidx].Cells[8].Value = hist.RecipientName;

            double transamt = GetTransAmount(hist.TransactionType, hist.TransAmount, hist.SvcFeeAmount);

            if (transamt < 0)
            {
                dgvTrans.Rows[rowidx].Cells[9].Value = string.Format("({0})", Decimal.Negate(Decimal.Parse(transamt.ToString())));
            }
            else
            {
                dgvTrans.Rows[rowidx].Cells[9].Value = string.Format("{0}", transamt);
            }

            dgvTrans.Rows[rowidx].Cells[10].Value = hist.UserName;
        }
示例#2
0
        private void btnProcessGCash_Click(object sender, EventArgs e)
        {
            if (ValidateInput())
            {
                double amountdue = 0;

                clsGCashTransaction gc = new clsGCashTransaction();
                gc.SenderName       = txtSenderName.Text;
                gc.SenderContact    = txtSenderNum.Text;
                gc.RecipientName    = txtRecipientName.Text;
                gc.RecipientContact = txtRecipientNum.Text;
                gc.GCashNumber      = txtGCashMobNum.Text;
                gc.TransDate        = DateTime.Now;
                gc.Country          = "";

                if (tabCtrl.SelectedIndex == 0)
                {
                    if (optCashIn.Checked)
                    {
                        gc.TransactionType = GCashTransType.CashIn;
                    }
                    else if (optCashOut.Checked)
                    {
                        gc.TransactionType = GCashTransType.CashOut;
                    }
                    else if (optSendOthers.Checked)
                    {
                        gc.TransactionType = GCashTransType.SendToOthers;
                    }

                    gc.RefNum       = txtRefNum1.Text;
                    gc.TransAmount  = Convert.ToDouble(txtAmount1.Text);
                    gc.SvcFeeAmount = Convert.ToDouble(txtSvcFee1.Text);
                    gc.Rebate       = Convert.ToDouble(txtRebate1.Text);
                }
                else if (tabCtrl.SelectedIndex == 1)
                {
                    if (optRecInt.Checked)
                    {
                        gc.TransactionType = GCashTransType.IntCashPickUp;
                        gc.Country         = txtCountry.Text;
                    }
                    else if (optRecDom.Checked)
                    {
                        gc.TransactionType = GCashTransType.DomCashPickup;
                    }

                    gc.RefNum       = txtRefNum2.Text;
                    gc.TransAmount  = Convert.ToDouble(txtAmount2.Text);
                    gc.SvcFeeAmount = Convert.ToDouble(txtSvcFee2.Text);
                    gc.Rebate       = Convert.ToDouble(txtRebate2.Text);
                }
                else if (tabCtrl.SelectedIndex == 2)
                {
                    if (optSendP2P.Checked)
                    {
                        gc.TransactionType = GCashTransType.RemitSend;
                        gc.TransAmount     = Convert.ToDouble(txtAmount3.Text);
                        gc.SvcFeeAmount    = Convert.ToDouble(txtSvcFee3.Text);
                        gc.Rebate          = Convert.ToDouble(txtRebate3.Text);
                    }
                    else if (optCancelP2P.Checked)
                    {
                        gc.TransactionType = GCashTransType.RemitCancel;
                        gc.TransAmount     = Convert.ToDouble(txtAmount3.Text);
                        gc.SvcFeeAmount    = Convert.ToDouble(txtSvcFee3.Text);
                        gc.Rebate          = Convert.ToDouble(txtRebate3.Text);
                    }
                    gc.RefNum = "";
                }
                amountdue   = gc.TransAmount + gc.SvcFeeAmount;
                gc.UserId   = myPosWide.m_user.UserId;
                gc.UserName = myPosWide.m_user.UserName;
                gc.Remarks  = clsGCashTransaction.GetTransType(gc.TransactionType);
                gc.Load_Id  = m_LoadAccount.LoadId;

                if (tabCtrl.SelectedIndex == 2 && optCancelP2P.Checked)
                {
                    amountdue = gc.SvcFeeAmount;
                    if (MessageBox.Show(string.Format("Amount: {0:0.00}\nService Fee: {1:0.00}\nPayout Amount: {2:0.00}\n\nAre you sure this is correct?", gc.TransAmount, gc.SvcFeeAmount, gc.TransAmount - gc.SvcFeeAmount), "Cancel Remittance", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        if (gc.Save())
                        {
                            MessageBox.Show("Transaction completed", "Payment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Clear();
                            string  ret = "";
                            Receipt or  = new Receipt();
                            or.InitializePrinter();
                            List <string> strmsg = new List <string>();
                            ret += or.PrintCompanyHeader();
                            strmsg.Add("G-CASH");
                            strmsg.Add(gc.Remarks);
                            ret += or.PrintAppend(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}", gc.GCashtTransId));
                            strmsg.Add("");
                            strmsg.Add(string.Format("{0}", gc.Remarks));
                            strmsg.Add(string.Format("Sender: {0:0.00}", gc.SenderName));
                            strmsg.Add(string.Format("Recipient: {0:0.00}", gc.RecipientName));
                            strmsg.Add(string.Format("RefNum: {0:0.00}", gc.RefNum));
                            strmsg.Add(string.Format("Trans Amount: P {0:0.00}", gc.TransAmount));
                            strmsg.Add(string.Format("Service Fee: P {0:0.00}", gc.SvcFeeAmount));
                            strmsg.Add(string.Format("Payout Amount: P {0:0.00}", gc.TransAmount - gc.SvcFeeAmount));
                            strmsg.Add("");
                            strmsg.Add("");
                            ret += or.PrintAppend(strmsg, PrintFontAlignment.Left, PrintFontSize.Regular);
                            or.FormFeed();
                            or.OpenDrawer();
                            or.ExecPrint(ret);
                            strmsg.Clear();

                            m_LoadAccount = clsLoadAccount.GetLoadAccount(m_LoadAccount.LoadId);
                            RefreshAccount();
                        }
                    }
                }
                else if (tabCtrl.SelectedIndex == 0 && optCashOut.Checked)
                {
                    amountdue = gc.SvcFeeAmount;
                    if (MessageBox.Show(string.Format("Amount: {0:0.00}\nService Fee: {1:0.00}\nPayout Amount: {2:0.00}\n\nAre you sure this is correct?", gc.TransAmount, gc.SvcFeeAmount, gc.TransAmount - gc.SvcFeeAmount), "Cash Out", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        if (gc.Save())
                        {
                            Clear();
                            string  ret = "";
                            Receipt or  = new Receipt();
                            or.InitializePrinter();
                            List <string> strmsg = new List <string>();
                            ret += or.PrintCompanyHeader();
                            strmsg.Add("G-CASH");
                            strmsg.Add(gc.Remarks);
                            ret += or.PrintAppend(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}", gc.GCashtTransId));
                            strmsg.Add("");
                            strmsg.Add(string.Format("{0}", gc.Remarks));
                            strmsg.Add(string.Format("Sender: {0:0.00}", gc.SenderName));
                            strmsg.Add(string.Format("Recipient: {0:0.00}", gc.RecipientName));
                            strmsg.Add(string.Format("RefNum: {0:0.00}", gc.RefNum));
                            strmsg.Add(string.Format("Trans Amount: P {0:0.00}", gc.TransAmount));
                            strmsg.Add(string.Format("Service Fee: P {0:0.00}", gc.SvcFeeAmount));
                            strmsg.Add(string.Format("Payout Amount: P {0:0.00}", gc.TransAmount - gc.SvcFeeAmount));
                            strmsg.Add("");
                            strmsg.Add("");
                            ret += or.PrintAppend(strmsg, PrintFontAlignment.Left, PrintFontSize.Regular);
                            or.FormFeed();
                            or.OpenDrawer();
                            or.ExecPrint(ret);
                            strmsg.Clear();

                            m_LoadAccount = clsLoadAccount.GetLoadAccount(m_LoadAccount.LoadId);
                            RefreshAccount();
                        }
                    }
                }
                else if (tabCtrl.SelectedIndex == 1)
                {
                    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?", gc.TransAmount), "Receive Remittance", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)
                    {
                        if (gc.Save())
                        {
                            Clear();
                            string  ret = "";
                            Receipt or  = new Receipt();
                            or.InitializePrinter();
                            List <string> strmsg = new List <string>();
                            ret += or.PrintCompanyHeader();
                            strmsg.Add("G-CASH");
                            strmsg.Add(gc.Remarks);
                            ret += or.PrintAppend(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}", gc.GCashtTransId));
                            strmsg.Add("");
                            strmsg.Add(string.Format("Sender: {0:0.00}", gc.SenderName));
                            strmsg.Add(string.Format("Recipient: {0:0.00}", gc.RecipientName));
                            strmsg.Add(string.Format("RefNum: {0:0.00}", gc.RefNum));
                            strmsg.Add(string.Format("Trans Amount: P {0:0.00}", gc.TransAmount));
                            strmsg.Add(string.Format("Service Fee: P {0:0.00}", gc.SvcFeeAmount));
                            strmsg.Add(string.Format("Payout Amount: P {0:0.00}", gc.TransAmount - gc.SvcFeeAmount));
                            ret += or.PrintAppend(strmsg, PrintFontAlignment.Left, PrintFontSize.Regular);
                            or.FormFeed();
                            or.OpenDrawer();
                            or.ExecPrint(ret);
                            strmsg.Clear();

                            m_LoadAccount = clsLoadAccount.GetLoadAccount(m_LoadAccount.LoadId);
                            RefreshAccount();
                        }
                    }
                }
                else
                {
                    frmInput input = new frmInput();
                    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)
                        {
                            gc.TenderedAmount = Convert.ToDouble(input.Value);
                            gc.Save();
                            MessageBox.Show("Transaction completed", "Payment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                            Clear();
                            string  ret = "";
                            Receipt or  = new Receipt();
                            or.InitializePrinter();
                            List <string> strmsg = new List <string>();
                            ret += or.PrintCompanyHeader();
                            strmsg.Add("");
                            strmsg.Add("G-CASH");
                            strmsg.Add(gc.Remarks);
                            ret += or.PrintAppend(strmsg, PrintFontAlignment.Center, PrintFontSize.UnderlineBold); strmsg.Clear();
                            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}", gc.GCashtTransId));
                            strmsg.Add("");
                            strmsg.Add(string.Format("Sender: {0:0.00}", gc.SenderName));
                            strmsg.Add(string.Format("Recepient: {0:0.00}", gc.RecipientName));
                            strmsg.Add(string.Format("Recepient Number: {0:0.00}", gc.RecipientContact));

                            strmsg.Add(string.Format("Trans Amount: P {0:0.00}", gc.TransAmount));
                            strmsg.Add(string.Format("Service Fee: P {0:0.00}", gc.SvcFeeAmount));
                            strmsg.Add(string.Format("Tendered Amount: P {0:0.00}", gc.TenderedAmount));
                            strmsg.Add(string.Format("Change: P {0:0.00}", gc.TenderedAmount - (gc.TransAmount + gc.SvcFeeAmount)));
                            strmsg.Add("");
                            strmsg.Add("");
                            ret += or.PrintAppend(strmsg, PrintFontAlignment.Left, PrintFontSize.Regular);
                            or.FormFeed();
                            or.OpenDrawer();
                            or.ExecPrint(ret);
                            strmsg.Clear();


                            m_LoadAccount = clsLoadAccount.GetLoadAccount(m_LoadAccount.LoadId);
                            RefreshAccount();
                        }
                        else
                        {
                            MessageBox.Show("Amount entered is less than the Amount Due", "Payment", MessageBoxButtons.OK, MessageBoxIcon.Information);
                        }
                    }
                }
            }
            else
            {
                MessageBox.Show("Kindly fill-out required fields", "Process", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
        }