Example #1
0
        /// <summary>
        /// Handles the Load event of the CashWithdraw control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void CashWithdraw_Load(object sender, EventArgs e)
        {
            SqlDataReader dReader;
            SqlCommand    cmd = new SqlCommand("Get_User_Level", parentForm.conn);

            cmd.CommandType = CommandType.StoredProcedure;

            parentForm.conn.Open();
            dReader = cmd.ExecuteReader();
            if (dReader.HasRows == true)
            {
                while (dReader.Read())
                {
                    namesCollection.Add(dReader["empLoginID"].ToString());
                }
            }
            else
            {
                MyMessageBox.ShowBox("USER DATA NOT FOUND", "ERROR");
                //MessageBox.Show("Data not found");
            }

            dReader.Close();
            parentForm.conn.Close();

            txtManagerID.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
            txtManagerID.AutoCompleteSource       = AutoCompleteSource.CustomSource;
            txtManagerID.AutoCompleteCustomSource = namesCollection;

            Int32  retVal;
            String errMsg;

            apiAlias.StatusMonitoring pMonitorCB = new apiAlias.StatusMonitoring(StatusMonitoring);

            pdPrint = new PrintDocument();
            //pdPrint.PrintPage += new PrintPageEventHandler(pdPrint_PrintPage);
            pdPrint.PrinterSettings.PrinterName = parentForm.PRINTER_NAME;

            try
            {
                // Open Printer Monitor of Status API.
                mpHandle = apiAlias.BiOpenMonPrinter(apiAlias.TYPE_PRINTER, pdPrint.PrinterSettings.PrinterName);
                if (mpHandle < 0)
                {
                    MessageBox.Show("Failed to open printer status monitor.", "Printing error", MessageBoxButtons.OK);
                }
                else
                {
                    //isFinish = false;
                    cancelErr = false;

                    // Set the callback function that will monitor printer status.
                    retVal = apiAlias.BiSetStatusBackFunction(mpHandle, pMonitorCB);

                    if (retVal != apiAlias.SUCCESS)
                    {
                        MessageBox.Show("Failed to set callback function.", "Printing error", MessageBoxButtons.OK);
                    }
                    else
                    {
                        // Start printing.
                        //pdPrint.Print();

                        // Wait until callback function will say that the task is done.
                        // When done, end the monitoring of printer status.
                        //do
                        //{
                        //    if (isFinish)
                        //        retVal = apiAlias.BiCancelStatusBack(mpHandle);
                        //} while (!isFinish);

                        // Display the status/error message.
                        DisplayStatusMessage();

                        // If an error occurred, restore the recoverable error.
                        if (cancelErr)
                        {
                            retVal = apiAlias.BiCancelError(mpHandle);
                        }
                        else
                        {
                            // Call the function to open cash drawer.
                            OpenDrawer(pdPrint.PrinterSettings.PrinterName);
                        }
                    }
                }
            }
            catch (Exception ex)
            {
                errMsg = ex.Message;
                MessageBox.Show("Failed to open StatusAPI.", "Printing error", MessageBoxButtons.OK);
            }
            finally
            {
                // Close Printer Monitor.
                if (mpHandle > 0)
                {
                    if (apiAlias.BiCloseMonPrinter(mpHandle) != apiAlias.SUCCESS)
                    {
                        MessageBox.Show("Failed to close printer status monitor.", "Printing error", MessageBoxButtons.OK);
                    }
                }
            }

            txtAmount.SelectAll();
            txtAmount.Focus();
        }
Example #2
0
        /// <summary>
        /// Handles the Click event of the btnLatest control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnLatest_Click(object sender, EventArgs e)
        {
            DateTime currentTime = DateTime.Now;

            rsDate = string.Format("{0:MM/dd/yyyy}", currentTime);
            rsTime = string.Format("{0:T}", currentTime);

            SqlCommand cmd_StoreCreditID = new SqlCommand("Get_Latest_StoreCreditID", parentForm.conn);

            cmd_StoreCreditID.CommandType = CommandType.StoredProcedure;
            cmd_StoreCreditID.Parameters.Add("@RegisterNum", SqlDbType.NVarChar).Value = parentForm.cashRegisterNum;
            SqlParameter Latest_Param = cmd_StoreCreditID.Parameters.Add("@StoreCreditID", SqlDbType.BigInt);

            Latest_Param.Direction = ParameterDirection.Output;

            parentForm.conn.Open();
            cmd_StoreCreditID.ExecuteNonQuery();
            parentForm.conn.Close();

            if (cmd_StoreCreditID.Parameters["@StoreCreditID"].Value == DBNull.Value)
            {
                MyMessageBox.ShowBox("NO DATA", "ERROR");
                txtStoreCreditID.Select();
                txtStoreCreditID.Focus();
            }
            else
            {
                rrStoreCreditID = Convert.ToInt64(cmd_StoreCreditID.Parameters["@StoreCreditID"].Value);

                SqlCommand cmd_StoreCreditInfo = new SqlCommand("Get_StoreCredit_Info2", parentForm.conn);
                cmd_StoreCreditInfo.CommandType = CommandType.StoredProcedure;
                cmd_StoreCreditInfo.Parameters.Add("@StoreCreditID", SqlDbType.BigInt).Value = rrStoreCreditID;
                SqlParameter Amount_Param    = cmd_StoreCreditInfo.Parameters.Add("@Amount", SqlDbType.Money);
                SqlParameter Balance_Param   = cmd_StoreCreditInfo.Parameters.Add("@Balance", SqlDbType.Money);
                SqlParameter StartDate_Param = cmd_StoreCreditInfo.Parameters.Add("@StartDate", SqlDbType.NVarChar, 20);
                SqlParameter ExpDate_Param   = cmd_StoreCreditInfo.Parameters.Add("@ExpDate", SqlDbType.NVarChar, 20);
                Amount_Param.Direction    = ParameterDirection.Output;
                Balance_Param.Direction   = ParameterDirection.Output;
                StartDate_Param.Direction = ParameterDirection.Output;
                ExpDate_Param.Direction   = ParameterDirection.Output;

                parentForm.conn.Open();
                cmd_StoreCreditInfo.ExecuteNonQuery();
                parentForm.conn.Close();

                rrAmount    = Convert.ToDouble(cmd_StoreCreditInfo.Parameters["@Amount"].Value);
                rrBalance   = Convert.ToDouble(cmd_StoreCreditInfo.Parameters["@Balance"].Value);
                rrStartDate = cmd_StoreCreditInfo.Parameters["@StartDate"].Value.ToString();
                rrExpDate   = cmd_StoreCreditInfo.Parameters["@ExpDate"].Value.ToString();

                Int32  retVal;
                String errMsg;
                apiAlias.StatusMonitoring pMonitorCB = new apiAlias.StatusMonitoring(StatusMonitoring);

                pdPrint            = new PrintDocument();
                pdPrint.PrintPage += new PrintPageEventHandler(pdPrint_PrintPage);
                pdPrint.PrinterSettings.PrinterName = parentForm.PRINTER_NAME;

                try
                {
                    // Open Printer Monitor of Status API.
                    mpHandle = apiAlias.BiOpenMonPrinter(apiAlias.TYPE_PRINTER, parentForm.PRINTER_NAME);
                    if (mpHandle < 0)
                    {
                        MessageBox.Show("Failed to open printer status monitor.", "Printing error", MessageBoxButtons.OK);
                    }
                    else
                    {
                        isFinish  = false;
                        cancelErr = false;

                        // Set the callback function that will monitor printer status.
                        retVal = apiAlias.BiSetStatusBackFunction(mpHandle, pMonitorCB);

                        if (retVal != apiAlias.SUCCESS)
                        {
                            MessageBox.Show("Failed to set callback function.", "Printing error", MessageBoxButtons.OK);
                        }
                        else
                        {
                            // Wait until callback function will say that the task is done.
                            // When done, end the monitoring of printer status.
                            //do
                            //{
                            //    if (isFinish)
                            //        retVal = apiAlias.BiCancelStatusBack(mpHandle);
                            //} while (!isFinish);

                            // Display the status/error message.
                            //DisplayStatusMessage();

                            // If an error occurred, restore the recoverable error.
                            if (cancelErr)
                            {
                                retVal = apiAlias.BiCancelError(mpHandle);
                            }
                            else
                            {
                                pdPrint.Print();
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    errMsg = ex.Message;
                    MessageBox.Show("Failed to open StatusAPI. Printing error.", errMsg, MessageBoxButtons.OK);
                }
                finally
                {
                    // Close Printer Monitor.
                    if (mpHandle > 0)
                    {
                        if (apiAlias.BiCloseMonPrinter(mpHandle) != apiAlias.SUCCESS)
                        {
                            MessageBox.Show("Failed to close printer status monitor.", "Printing error", MessageBoxButtons.OK);
                        }
                    }
                }

                txtStoreCreditID.Select();
                txtStoreCreditID.Focus();
            }
        }
Example #3
0
        /// <summary>
        /// Handles the Click event of the btnRedeem control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnRedeem_Click(object sender, EventArgs e)
        {
            if (txtCouponNum.Text.Trim().ToString() == "")
            {
                return;
            }
            else
            {
                cmd             = new SqlCommand("Get_Coupon", parentForm.conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Clear();
                cmd.Parameters.Add("@CpNum", SqlDbType.NVarChar).Value = txtCouponNum.Text.Trim().ToUpper().ToString();
                SqlParameter CheckNum_Param = cmd.Parameters.Add("@CheckNum", SqlDbType.Int);
                CheckNum_Param.Direction = ParameterDirection.Output;

                parentForm.conn.Open();
                cmd.ExecuteNonQuery();
                parentForm.conn.Close();

                if (Convert.ToInt16(cmd.Parameters["@CheckNum"].Value) == 1)
                {
                    cpCategory1 = txtCouponNum.Text.Substring(2, 1);
                    cptype      = txtCouponNum.Text.Substring(3, 1);
                    cpAmt       = Convert.ToDouble(txtCouponNum.Text.Substring(4, 2));

                    if (cpCategory1 == "G")
                    {
                    }
                    else if (cpCategory1 == "H")
                    {
                        if (Convert.ToString(parentForm.dataGridView1.SelectedCells[8].Value) == "3")
                        {
                            if (Convert.ToDouble(parentForm.dataGridView1.SelectedCells[4].Value) > 0)
                            {
                                MyMessageBox.ShowBox("SELECTED ITEM IS ALREADY DISCOUNTED", "ERROR");
                                txtCouponNum.SelectAll();
                                txtCouponNum.Focus();
                                return;
                            }
                            else if (Convert.ToDouble(parentForm.dataGridView1.SelectedCells[5].Value) < 0)
                            {
                                MyMessageBox.ShowBox("NOT DISCOUNTABLE ITEM", "ERROR");
                                txtCouponNum.SelectAll();
                                txtCouponNum.Focus();
                                return;
                            }
                            else
                            {
                                if (cptype == "P")
                                {
                                    qty     = Convert.ToInt16(parentForm.dataGridView1.SelectedCells[2].Value);
                                    discPrc = Convert.ToDouble(parentForm.dataGridView1.SelectedCells[3].Value) * (1 - (cpAmt / 100));
                                    prc     = qty * Math.Round(discPrc, 2, MidpointRounding.AwayFromZero);
                                    parentForm.dataGridView1.SelectedCells[4].Value = Math.Round(discPrc, 2, MidpointRounding.AwayFromZero);
                                    parentForm.dataGridView1.SelectedCells[5].Value = prc;
                                    parentForm.dataGridView1.SelectedCells[6].Value = Math.Round(prc * parentForm.storeTaxRate, 2, MidpointRounding.AwayFromZero);

                                    parentForm.cpRedeem         = true;
                                    parentForm.wp_cpNum         = txtCouponNum.Text.Trim().ToUpper().ToString();
                                    parentForm.wp_cpTargetItem  = Convert.ToString(parentForm.dataGridView1.SelectedCells[7].Value);
                                    parentForm.wp_cpDescription = "HAIR " + Convert.ToString(cpAmt) + "% OFF COUPON (T:" + parentForm.wp_cpTargetItem + ")";
                                    parentForm.richTxtUpc.Text  = "000000999112";
                                    parentForm.btnInput_Click(null, null);

                                    this.Close();
                                    parentForm.Enabled = true;
                                    parentForm.richTxtUpc.Select();
                                    parentForm.richTxtUpc.Focus();
                                }
                                else
                                {
                                    MyMessageBox.ShowBox("NOT AVAILABLE COUPON", "ERROR");
                                    txtCouponNum.SelectAll();
                                    txtCouponNum.Focus();
                                    return;
                                }
                            }
                        }
                        else
                        {
                            MyMessageBox.ShowBox("THIS COUPON IS VALID FOR WIG ITEM ONLY", "ERROR");
                            txtCouponNum.SelectAll();
                            txtCouponNum.Focus();
                            return;
                        }
                    }
                    else if (cpCategory1 == "W")
                    {
                        if (Convert.ToString(parentForm.dataGridView1.SelectedCells[8].Value) == "2")
                        {
                            if (Convert.ToDouble(parentForm.dataGridView1.SelectedCells[4].Value) > 0)
                            {
                                MyMessageBox.ShowBox("SELECTED ITEM IS ALREADY DISCOUNTED", "ERROR");
                                txtCouponNum.SelectAll();
                                txtCouponNum.Focus();
                                return;
                            }
                            else if (Convert.ToDouble(parentForm.dataGridView1.SelectedCells[5].Value) < 0)
                            {
                                MyMessageBox.ShowBox("NOT DISCOUNTABLE ITEM", "ERROR");
                                txtCouponNum.SelectAll();
                                txtCouponNum.Focus();
                                return;
                            }
                            else
                            {
                                if (cptype == "P")
                                {
                                    qty     = Convert.ToInt16(parentForm.dataGridView1.SelectedCells[2].Value);
                                    discPrc = Convert.ToDouble(parentForm.dataGridView1.SelectedCells[3].Value) * (1 - (cpAmt / 100));
                                    prc     = qty * Math.Round(discPrc, 2, MidpointRounding.AwayFromZero);
                                    parentForm.dataGridView1.SelectedCells[4].Value = Math.Round(discPrc, 2, MidpointRounding.AwayFromZero);
                                    parentForm.dataGridView1.SelectedCells[5].Value = prc;
                                    parentForm.dataGridView1.SelectedCells[6].Value = Math.Round(prc * parentForm.storeTaxRate, 2, MidpointRounding.AwayFromZero);

                                    parentForm.cpRedeem         = true;
                                    parentForm.wp_cpNum         = txtCouponNum.Text.Trim().ToUpper().ToString();
                                    parentForm.wp_cpTargetItem  = Convert.ToString(parentForm.dataGridView1.SelectedCells[7].Value);
                                    parentForm.wp_cpDescription = "WIG " + Convert.ToString(cpAmt) + "% OFF COUPON (T:" + parentForm.wp_cpTargetItem + ")";
                                    parentForm.richTxtUpc.Text  = "000000999112";
                                    parentForm.btnInput_Click(null, null);

                                    this.Close();
                                    parentForm.Enabled = true;
                                    parentForm.richTxtUpc.Select();
                                    parentForm.richTxtUpc.Focus();
                                }
                                else
                                {
                                    MyMessageBox.ShowBox("NOT AVAILABLE COUPON", "ERROR");
                                    txtCouponNum.SelectAll();
                                    txtCouponNum.Focus();
                                    return;
                                }
                            }
                        }
                        else
                        {
                            MyMessageBox.ShowBox("THIS COUPON IS VALID FOR WIG ITEM ONLY", "ERROR");
                            txtCouponNum.SelectAll();
                            txtCouponNum.Focus();
                            return;
                        }
                    }
                    else
                    {
                        MyMessageBox.ShowBox("INVALID COUPON", "ERROR");
                        txtCouponNum.SelectAll();
                        txtCouponNum.Focus();
                        return;
                    }
                }
                else
                {
                    MyMessageBox.ShowBox("INVALID COUPON", "ERROR");
                    txtCouponNum.SelectAll();
                    txtCouponNum.Focus();
                    return;
                }
            }
        }
Example #4
0
        /// <summary>
        /// Handles the Click event of the txtWithdraw control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void txtWithdraw_Click(object sender, EventArgs e)
        {
            if (txtManagerID.Text == "")
            {
                MyMessageBox.ShowBox("INPUT MANAGER ID", "ERROR");
                //MessageBox.Show("Input Manager ID", "Error");
                return;
            }

            if (txtPsw.Text == "")
            {
                MyMessageBox.ShowBox("INPUT PASSWORD", "ERROR");
                //MessageBox.Show("Input password", "Error");
                return;
            }

            managerID       = txtManagerID.Text.Trim().ToString().ToUpper();
            managerPassword = txtPsw.Text.Trim().ToString().ToUpper();
            SqlCommand cmd1 = new SqlCommand("Get_ManagerID", parentForm.conn);

            cmd1.CommandType = CommandType.StoredProcedure;
            cmd1.Parameters.Add("@LoginID", SqlDbType.NVarChar).Value  = managerID.ToUpper().ToString();
            cmd1.Parameters.Add("@Password", SqlDbType.NVarChar).Value = managerPassword;
            SqlParameter UserName_Param = cmd1.Parameters.Add("@FirstName", SqlDbType.NVarChar, 50);

            UserName_Param.Direction = ParameterDirection.Output;

            parentForm.conn.Open();
            cmd1.ExecuteNonQuery();
            parentForm.conn.Close();

            if (cmd1.Parameters["@FirstName"].Value == DBNull.Value)
            {
                MyMessageBox.ShowBox("AUTHENTICATION FAILED", "ERROR");
                return;
            }


            DateTime currentTime = DateTime.Now;

            string withDrawDate = string.Format("{0:MM/dd/yyyy}", currentTime);
            string withDrawTime = string.Format("{0:T}", currentTime);

            if (double.TryParse(txtAmount.Text, out amount))
            {
                SqlCommand cmd = new SqlCommand("Create_CashWithdraw", parentForm.conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@RegisterNum", SqlDbType.NVarChar).Value       = parentForm.cashRegisterNum;
                cmd.Parameters.Add("@TransactionStatus", SqlDbType.NVarChar).Value = "WITHDRAW";
                cmd.Parameters.Add("@RegWithdrawAmount", SqlDbType.Money).Value    = amount;
                cmd.Parameters.Add("@RegDate", SqlDbType.NVarChar).Value           = withDrawDate;
                cmd.Parameters.Add("@RegTime", SqlDbType.NVarChar).Value           = withDrawTime;
                cmd.Parameters.Add("@RegCashierID", SqlDbType.NVarChar).Value      = cashierID;
                cmd.Parameters.Add("@RegManagerID", SqlDbType.NVarChar).Value      = txtManagerID.Text.Trim().ToString().ToUpper();

                parentForm.conn.Open();
                cmd.ExecuteNonQuery();
                parentForm.conn.Close();

                SqlCommand cmd_TransactionID = new SqlCommand("Get_TransactionID", parentForm.conn);
                cmd_TransactionID.CommandType = CommandType.StoredProcedure;
                cmd_TransactionID.Parameters.Add("@RegisterNum", SqlDbType.NVarChar).Value       = parentForm.cashRegisterNum;
                cmd_TransactionID.Parameters.Add("@RegDate", SqlDbType.NVarChar).Value           = withDrawDate;
                cmd_TransactionID.Parameters.Add("@TransactionStatus", SqlDbType.NVarChar).Value = "WITHDRAW";
                SqlParameter TransactionID_Param = cmd_TransactionID.Parameters.Add("@TransactionID", SqlDbType.BigInt);
                TransactionID_Param.Direction = ParameterDirection.Output;
                parentForm.conn.Open();
                cmd_TransactionID.ExecuteNonQuery();
                parentForm.conn.Close();

                transactionID = Convert.ToInt64(cmd_TransactionID.Parameters["@TransactionID"].Value);

                Int32  retVal;
                String errMsg;
                apiAlias.StatusMonitoring pMonitorCB = new apiAlias.StatusMonitoring(StatusMonitoring);

                pdPrint            = new PrintDocument();
                pdPrint.PrintPage += new PrintPageEventHandler(pdPrint_PrintPage);
                pdPrint.PrinterSettings.PrinterName = parentForm.PRINTER_NAME;

                try
                {
                    // Open Printer Monitor of Status API.
                    mpHandle = apiAlias.BiOpenMonPrinter(apiAlias.TYPE_PRINTER, pdPrint.PrinterSettings.PrinterName);
                    if (mpHandle < 0)
                    {
                        MessageBox.Show("Failed to open printer status monitor.", "Printing error", MessageBoxButtons.OK);
                    }
                    else
                    {
                        isFinish  = false;
                        cancelErr = false;

                        // Set the callback function that will monitor printer status.
                        retVal = apiAlias.BiSetStatusBackFunction(mpHandle, pMonitorCB);

                        if (retVal != apiAlias.SUCCESS)
                        {
                            MessageBox.Show("Failed to set callback function.", "Printing error", MessageBoxButtons.OK);
                        }
                        else
                        {
                            // Start printing.
                            //pdPrint.Print();

                            // Wait until callback function will say that the task is done.
                            // When done, end the monitoring of printer status.
                            //do
                            //{
                            //    if (isFinish)
                            //        retVal = apiAlias.BiCancelStatusBack(mpHandle);
                            //} while (!isFinish);

                            // Display the status/error message.
                            //DisplayStatusMessage();

                            // If an error occurred, restore the recoverable error.
                            if (cancelErr)
                            {
                                retVal = apiAlias.BiCancelError(mpHandle);
                            }
                            else
                            {
                                pdPrint.Print();
                            }
                        }
                    }
                }
                catch (Exception ex)
                {
                    errMsg = ex.Message;
                    MessageBox.Show("Failed to open StatusAPI.", "Printing error", MessageBoxButtons.OK);
                }
                finally
                {
                    // Close Printer Monitor.
                    if (mpHandle > 0)
                    {
                        if (apiAlias.BiCloseMonPrinter(mpHandle) != apiAlias.SUCCESS)
                        {
                            MessageBox.Show("Failed to close printer status monitor.", "Printing error", MessageBoxButtons.OK);
                        }
                    }
                }

                MyMessageBox.ShowBox("SUCCESSFULLY WITHDRAWN", "INFORMATION");
                //MessageBox.Show("Successfully withdrawn", "Info");
                this.Close();
            }
            else
            {
                MyMessageBox.ShowBox("INVALID AMOUNT", "ERROR");
                //MessageBox.Show("Invalid amount", "Error");
                return;
            }
        }
Example #5
0
        /// <summary>
        /// Handles the Click event of the btnCheckOut control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnCheckOut_Click(object sender, EventArgs e)
        {
            if (cmbTerminalType.Text == "")
            {
                MyMessageBox.ShowBox("PLEASE SELECT CARD TYPE", "ERROR");
                return;
            }

            terminalType = cmbTerminalType.Text.Trim().ToUpper();

            if (cmbTerminalType.SelectedIndex == 2)
            {
                if (txtCardNum.Text.Length == 17)
                {
                    RefCardNum = txtCardNum.Text.Substring(txtCardNum.Text.Length - 4, 4);

                    if (int.TryParse(RefCardNum, out nRefCardNum))
                    {
                    }
                    else
                    {
                        MyMessageBox.ShowBox("INVALID LAST 4 DIGIT", "ERROR");
                        txtCardNum.Select(13, txtCardNum.Text.Length - 12);
                        txtCardNum.Focus();
                        return;
                    }
                }
                else
                {
                    MyMessageBox.ShowBox("INPUT LAST 4 DIGIT", "ERROR");
                    txtCardNum.Select(13, txtCardNum.Text.Length - 12);
                    txtCardNum.Focus();
                    return;
                }
            }
            else
            {
                if (txtCardNum.Text.Length == 19)
                {
                    RefCardNum = txtCardNum.Text.Substring(txtCardNum.Text.Length - 4, 4);

                    if (int.TryParse(RefCardNum, out nRefCardNum))
                    {
                    }
                    else
                    {
                        MyMessageBox.ShowBox("INVALID LAST 4 DIGIT", "ERROR");
                        txtCardNum.Select(15, txtCardNum.Text.Length - 15);
                        txtCardNum.Focus();
                        return;
                    }
                }
                else
                {
                    MyMessageBox.ShowBox("INPUT LAST 4 DIGIT", "ERROR");
                    txtCardNum.Select(15, txtCardNum.Text.Length - 15);
                    txtCardNum.Focus();
                    return;
                }
            }

            SellDate = string.Format("{0:MM/dd/yyyy}", DateTime.Now);
            SellTime = string.Format("{0:T}", DateTime.Now);

            SqlCommand cmd_RefCreditTransaction = new SqlCommand("Create_RefCreditTransaction", parentForm.parentForm.conn);

            cmd_RefCreditTransaction.CommandType = CommandType.StoredProcedure;
            cmd_RefCreditTransaction.Parameters.Add("@ReceiptID", SqlDbType.BigInt).Value    = 99;
            cmd_RefCreditTransaction.Parameters.Add("@TroutD", SqlDbType.NVarChar).Value     = "TERMINAL";
            cmd_RefCreditTransaction.Parameters.Add("@AuthNum", SqlDbType.NVarChar).Value    = "CREDIT";
            cmd_RefCreditTransaction.Parameters.Add("@RefCardNum", SqlDbType.NVarChar).Value = RefCardNum;
            cmd_RefCreditTransaction.Parameters.Add("@CardType", SqlDbType.NVarChar).Value   = TerminalCreditType(cmbTerminalType.SelectedIndex);
            cmd_RefCreditTransaction.Parameters.Add("@Amount", SqlDbType.Money).Value        = terminalPayAmount;
            cmd_RefCreditTransaction.Parameters.Add("@IssueDate", SqlDbType.NVarChar).Value  = SellDate;
            cmd_RefCreditTransaction.Parameters.Add("@IssueTime", SqlDbType.NVarChar).Value  = SellTime;

            parentForm.parentForm.conn.Open();
            cmd_RefCreditTransaction.ExecuteNonQuery();
            parentForm.parentForm.conn.Close();

            parentForm.dt.Rows.Add("TERMINAL", 3, terminalPayAmount, parentForm.parentForm.storeCode);
            parentForm.Binding_dataGridView1();

            parentForm.Check_RemainingAmount();
            this.Close();
        }
Example #6
0
        /// <summary>
        /// Handles the Click event of the btnOK control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            managerID       = txtManagerID.Text.Trim().ToString().ToUpper();
            managerPassword = txtPsw.Text.Trim().ToString().ToUpper();

            if (managerID == parentForm1.parentForm.SystemMasterUserName & managerPassword == parentForm1.parentForm.SystemMasterPassword)
            {
                //parentForm2.auth = true;
                if (seq == 0)
                {
                }
                else if (seq == 1)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnReturnByReceipt_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 2)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnReturnByItem_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 3)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnSpecialDiscount_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 4)
                {
                    parentForm3.auth = true;
                    this.Close();
                    parentForm3.btnUpdateCustomer_Click(null, null);
                }
                else if (seq == 6)
                {
                    parentForm4.auth = true;
                    this.Close();
                    parentForm4.btnInput_Click(null, null);
                }
                else if (seq == 7)
                {
                    parentForm5.auth = true;
                    this.Close();
                    parentForm5.btnInput_Click(null, null);
                }
                else if (seq == 8)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnStartRegister_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 9)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnClosingRegister_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 10)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnCashWithdraw_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 11)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnOpenCashDrawer_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 12)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnBasicSetup_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 13)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnLineNoTax_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 14)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnAllNoTax_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 15)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnDiscount_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 16)
                {
                    parentForm9.auth = true;
                    this.Close();
                    parentForm9.btnInput_Click(null, null);
                }
                else if (seq == 17)
                {
                    //parentForm10.auth = true;
                    //this.Close();
                    //parentForm10.btnInput_Click(null, null);
                }
                else if (seq == 18)
                {
                    parentForm3.auth = true;
                    this.Close();
                    parentForm3.btnDeleteCustomer_Click(null, null);
                }
                else if (seq == 19)
                {
                    this.Close();

                    CouponGenerate couponGenerateForm = new CouponGenerate(managerID);
                    couponGenerateForm.parentForm = this.parentForm1;
                    couponGenerateForm.ShowDialog();
                }
                else if (seq == 20)
                {
                    parentForm3.auth  = true;
                    parentForm3.mgrID = managerID;
                    this.Close();
                    parentForm3.btnMerge_Click(null, null);
                }
                else if (seq == 21)
                {
                    parentForm1.NoBarcodeButtonAuth = true;
                    this.Close();
                    parentForm1.btnNoBarcodeItem_Click(null, null);
                    parentForm1.NoBarcodeButtonAuth = false;
                }
                else if (seq == 22)
                {
                    parentForm3.MemberTransactionAuth = true;
                    this.Close();
                    parentForm3.btnSelectCustomer_Click(null, null);
                }
                else if (seq == 23)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnCloverSettlement_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 24)
                {
                    parentForm12.BeauticianAuth = true;
                    this.Close();
                    parentForm12.btnRegister_Click(null, null);
                }
                else if (seq == 25)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnReprintReceipt_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 26)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnReprintStoreCredit_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 27)
                {
                    parentForm2.auth  = true;
                    parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm2.btnCoupon_Click(null, null);
                    parentForm2.auth = false;
                }
                else if (seq == 28)
                {
                    parentForm1.CouponMgrID = txtManagerID.Text.Trim().ToUpper();
                    this.Close();
                    parentForm1.btnSecondVisitCoupon_Click(null, null);
                }
                else
                {
                    this.Close();
                }
            }
            else
            {
                SqlCommand cmd = new SqlCommand("Get_ManagerID", parentForm1.conn);
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@LoginID", SqlDbType.NVarChar).Value  = managerID.ToUpper().ToString();
                cmd.Parameters.Add("@Password", SqlDbType.NVarChar).Value = managerPassword;
                SqlParameter UserName_Param = cmd.Parameters.Add("@FirstName", SqlDbType.NVarChar, 50);
                UserName_Param.Direction = ParameterDirection.Output;

                parentForm1.conn.Open();
                cmd.ExecuteNonQuery();
                parentForm1.conn.Close();

                if (cmd.Parameters["@FirstName"].Value == DBNull.Value)
                {
                    MyMessageBox.ShowBox("AUTHENTICATION FAILED", "ERROR");
                    txtPsw.SelectAll();
                    txtPsw.Focus();
                    return;
                }
                else
                {
                    //parentForm2.auth = true;
                    if (seq == 0)
                    {
                    }
                    else if (seq == 1)
                    {
                        parentForm2.auth  = true;
                        parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm2.btnReturnByReceipt_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 2)
                    {
                        parentForm2.auth  = true;
                        parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm2.btnReturnByItem_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 3)
                    {
                        parentForm2.auth  = true;
                        parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm2.btnSpecialDiscount_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 4)
                    {
                        parentForm3.auth = true;
                        this.Close();
                        parentForm3.btnUpdateCustomer_Click(null, null);
                    }
                    else if (seq == 6)
                    {
                        parentForm4.auth = true;
                        this.Close();
                        parentForm4.btnInput_Click(null, null);
                    }
                    else if (seq == 7)
                    {
                        parentForm5.auth = true;
                        this.Close();
                        parentForm5.btnInput_Click(null, null);
                    }
                    else if (seq == 8)
                    {
                        parentForm2.auth = true;
                        this.Close();
                        parentForm2.btnStartRegister_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 9)
                    {
                        parentForm2.auth  = true;
                        parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm2.btnClosingRegister_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 10)
                    {
                        parentForm2.auth  = true;
                        parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm2.btnCashWithdraw_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 11)
                    {
                        parentForm2.auth  = true;
                        parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm2.btnOpenCashDrawer_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 12)
                    {
                        parentForm2.auth  = true;
                        parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm2.btnBasicSetup_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 13)
                    {
                        parentForm2.auth  = true;
                        parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm2.btnLineNoTax_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 14)
                    {
                        parentForm2.auth  = true;
                        parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm2.btnAllNoTax_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 15)
                    {
                        parentForm2.auth  = true;
                        parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm2.btnDiscount_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 16)
                    {
                        parentForm9.auth = true;
                        this.Close();
                        parentForm9.btnInput_Click(null, null);
                    }
                    else if (seq == 17)
                    {
                        //parentForm10.auth = true;
                        //this.Close();
                        //parentForm10.btnInput_Click(null, null);
                    }
                    else if (seq == 18)
                    {
                        parentForm3.auth = true;
                        this.Close();
                        parentForm3.btnDeleteCustomer_Click(null, null);
                    }
                    else if (seq == 19)
                    {
                        this.Close();

                        CouponGenerate couponGenerateForm = new CouponGenerate(managerID);
                        couponGenerateForm.parentForm = this.parentForm1;
                        couponGenerateForm.ShowDialog();
                    }
                    else if (seq == 20)
                    {
                        parentForm3.auth  = true;
                        parentForm3.mgrID = managerID;
                        this.Close();
                        parentForm3.btnMerge_Click(null, null);
                    }
                    else if (seq == 21)
                    {
                        parentForm1.NoBarcodeButtonAuth = true;
                        this.Close();
                        parentForm1.btnNoBarcodeItem_Click(null, null);
                        parentForm1.NoBarcodeButtonAuth = false;
                    }
                    else if (seq == 22)
                    {
                        parentForm3.MemberTransactionAuth = true;
                        this.Close();
                        parentForm3.btnSelectCustomer_Click(null, null);
                    }
                    else if (seq == 23)
                    {
                        parentForm2.auth  = true;
                        parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm2.btnCloverSettlement_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 24)
                    {
                        parentForm12.BeauticianAuth = true;
                        this.Close();
                        parentForm12.btnRegister_Click(null, null);
                    }
                    else if (seq == 25)
                    {
                        parentForm2.auth  = true;
                        parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm2.btnReprintReceipt_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 26)
                    {
                        parentForm2.auth  = true;
                        parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm2.btnReprintStoreCredit_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 27)
                    {
                        parentForm2.auth  = true;
                        parentForm2.mgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm2.btnCoupon_Click(null, null);
                        parentForm2.auth = false;
                    }
                    else if (seq == 28)
                    {
                        parentForm1.CouponMgrID = txtManagerID.Text.Trim().ToUpper();
                        this.Close();
                        parentForm1.btnSecondVisitCoupon_Click(null, null);
                    }
                    else
                    {
                        this.Close();
                    }
                }
            }
        }
Example #7
0
        /// <summary>
        /// Handles the Click event of the btnOK control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnOK_Click(object sender, EventArgs e)
        {
            employeeID       = txtEmployeeID.Text.Trim().ToString().ToUpper();
            employeePassword = txtPsw.Text.Trim().ToString().ToUpper();

            if (parentForm2.managerID.ToUpper() == employeeID.ToUpper())
            {
                MyMessageBox.ShowBox("WITNESS ID CAN NOT BE SAME WITH MANAGER ID", "ERROR");
                return;
            }

            SqlCommand cmd = new SqlCommand("Get_User", parentForm1.conn);

            cmd.CommandType = CommandType.StoredProcedure;
            cmd.Parameters.Add("@empLoginID", SqlDbType.NVarChar).Value  = employeeID.ToUpper().ToString();
            cmd.Parameters.Add("@empPassword", SqlDbType.NVarChar).Value = employeePassword;
            SqlParameter UserFirstName_Param = cmd.Parameters.Add("@empFirstName", SqlDbType.NVarChar, 50);
            SqlParameter UserLastName_Param  = cmd.Parameters.Add("@empLastName", SqlDbType.NVarChar, 50);

            UserFirstName_Param.Direction = ParameterDirection.Output;
            UserLastName_Param.Direction  = ParameterDirection.Output;

            parentForm1.conn.Open();
            cmd.ExecuteNonQuery();
            parentForm1.conn.Close();

            if (cmd.Parameters["@empFirstName"].Value == DBNull.Value)
            {
                MyMessageBox.ShowBox("AUTHENTICATION FAILED", "ERROR");
                txtPsw.SelectAll();
                txtPsw.Focus();
                return;
            }
            else
            {
                if (option == 0)
                {
                    parentForm2.boolSecondAuthentication = true;
                    parentForm2.witnessID = employeeID.Trim().ToUpper().ToString();
                    this.Close();
                    parentForm2.btnRefund_Click(null, null);
                    parentForm2.boolSecondAuthentication = false;
                }
                else if (option == 1)
                {
                    parentForm2.boolSecondAuthentication = true;
                    parentForm2.witnessID = employeeID.Trim().ToUpper().ToString();
                    this.Close();
                    parentForm2.btnVoid_Click(null, null);
                    parentForm2.boolSecondAuthentication = false;
                }
                else if (option == 2)
                {
                    parentForm2.boolSecondAuthentication = true;
                    parentForm2.witnessID = employeeID.Trim().ToUpper().ToString();
                    this.Close();
                    parentForm2.btnStoreCredit_Click(null, null);
                    parentForm2.boolSecondAuthentication = false;
                }
            }
        }
Example #8
0
        /// <summary>
        /// Handles the Click event of the btnRegister control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        public void btnRegister_Click(object sender, EventArgs e)
        {
            if (txtFirstName.Text.Trim() == "")
            {
                MyMessageBox.ShowBox("INPUT FIRST NAME", "ERROR");
                txtFirstName.Select();
                txtFirstName.Focus();
                return;
            }

            if (txtLastName.Text.Trim() == "")
            {
                MyMessageBox.ShowBox("INPUT LAST NAME", "ERROR");
                txtLastName.Select();
                txtLastName.Focus();
                return;
            }

            /*if (DateTime.TryParse(txtDateOfBirth.Text, out d1))
             * {
             *  dob = string.Format("{0:MM/dd/yyyy}", d1);
             * }
             * else
             * {
             *  MyMessageBox.ShowBox("INVALID DATE", "ERROR");
             *  txtDateOfBirth.SelectAll();
             *  txtDateOfBirth.Focus();
             *  return;
             * }*/

            if (ValidateDate(txtDateOfBirth.Text) == true)
            {
                dob = txtDateOfBirth.Text;
            }
            else
            {
                MyMessageBox.ShowBox("INVALID DATE", "ERROR");
                txtDateOfBirth.SelectAll();
                txtDateOfBirth.Focus();
                return;
            }

            if (txtAddress.Text.Trim() == "")
            {
                MyMessageBox.ShowBox("INPUT ADDRESS", "ERROR");
                txtAddress.SelectAll();
                txtAddress.Focus();
                return;
            }

            if (txtCity.Text.Trim() == "")
            {
                MyMessageBox.ShowBox("INPUT CITY", "ERROR");
                txtCity.SelectAll();
                txtCity.Focus();
                return;
            }

            if (txtState.Text.Trim() == "")
            {
                MyMessageBox.ShowBox("INPUT STATE", "ERROR");
                txtState.Select();
                txtState.Focus();
                return;
            }
            else if (txtState.Text.Trim().Length != 2)
            {
                MyMessageBox.ShowBox("INPUT USPS FORMAT (TWO LETTERS ONLY)", "ERROR");
                txtState.SelectAll();
                txtState.Focus();
                return;
            }

            if (txtZipCode.Text.Trim() == "")
            {
                MyMessageBox.ShowBox("INPUT ZIP CODE", "ERROR");
                txtZipCode.Select();
                txtZipCode.Focus();
                return;
            }
            else if (txtZipCode.Text.Trim().Length != 5)
            {
                MyMessageBox.ShowBox("FIVE DIGIT ONLY", "ERROR");
                txtZipCode.SelectAll();
                txtZipCode.Focus();
                return;
            }
            else
            {
                if (Int64.TryParse(txtZipCode.Text, out zipCode))
                {
                }
                else
                {
                    MyMessageBox.ShowBox("INVALID ZIPCODE", "ERROR");
                    txtZipCode.SelectAll();
                    txtZipCode.Focus();
                    return;
                }
            }

            if (txtHomePhone.Text.Trim() != "")
            {
                if (txtHomePhone.Text.Trim().Length != 10)
                {
                    MyMessageBox.ShowBox("INVALID HOME PHONE NUMBER (INPUT 10 DIGIT ONLY)", "ERROR");
                    txtHomePhone.SelectAll();
                    txtHomePhone.Focus();
                    return;
                }
                else
                {
                    if (Int64.TryParse(txtHomePhone.Text, out homePhone))
                    {
                    }
                    else
                    {
                        MyMessageBox.ShowBox("INVALID HOME PHONE NUMBER (INPUT 10 DIGIT ONLY)", "ERROR");
                        txtHomePhone.SelectAll();
                        txtHomePhone.Focus();
                        return;
                    }
                }
            }

            if (txtCellPhone.Text.Trim() != "")
            {
                if (txtCellPhone.Text.Trim().Length != 10)
                {
                    MyMessageBox.ShowBox("INVALID CELL PHONE NUMBER (INPUT 10 DIGIT ONLY)", "ERROR");
                    txtCellPhone.SelectAll();
                    txtCellPhone.Focus();
                    return;
                }
                else
                {
                    if (Int64.TryParse(txtCellPhone.Text, out cellPhone))
                    {
                    }
                    else
                    {
                        MyMessageBox.ShowBox("INVALID CELL PHONE NUMBER (INPUT 10 DIGIT ONLY)", "ERROR");
                        txtCellPhone.SelectAll();
                        txtCellPhone.Focus();
                        return;
                    }
                }
            }

            if (txtMemberCode.Text.Trim() == "")
            {
                MyMessageBox.ShowBox("INPUT MEMBER CODE", "ERROR");
                txtMemberCode.SelectAll();
                txtMemberCode.Focus();
                return;
            }

            if (cmbMemberType.SelectedIndex == 1)
            {
                if (txtLicenseNumber.Text == "")
                {
                    MyMessageBox.ShowBox("INPUT LICENSE NUMBER", "ERROR");
                    txtLicenseNumber.Select();
                    txtLicenseNumber.Focus();
                    return;
                }
            }

            if (double.TryParse(txtMemberPoints.Text, out memberPoints))
            {
            }
            else
            {
                MyMessageBox.ShowBox("INPUT VALID MEMBER POINTS", "ERROR");
                txtMemberPoints.SelectAll();
                txtMemberPoints.Focus();
                return;
            }

            if (ValidateDate(txtStartDate.Text) == true)
            {
                startDate = txtStartDate.Text;
            }
            else
            {
                MyMessageBox.ShowBox("INVALID START DATE", "ERROR");
                txtStartDate.SelectAll();
                txtStartDate.Focus();
                return;
            }

            if (ValidateDate(txtExpirationDate.Text) == true)
            {
                expDate = txtExpirationDate.Text;
            }
            else
            {
                MyMessageBox.ShowBox("INVALID EXPIRATION DATE", "ERROR");
                txtExpirationDate.SelectAll();
                txtExpirationDate.Focus();
                return;
            }

            if (cmbMemberType.SelectedIndex == 1)
            {
                if (BeauticianAuth == true)
                {
                    try
                    {
                        btnRegister.Enabled = false;

                        cmd.CommandText = "Create_New_Member";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Connection  = parentForm.connHQ;
                        cmd.Parameters.Clear();
                        cmd.Parameters.Add("@StoreCode", SqlDbType.NVarChar).Value     = parentForm.storeCode;
                        cmd.Parameters.Add("@FirstName", SqlDbType.NVarChar).Value     = txtFirstName.Text.Trim().ToUpper();
                        cmd.Parameters.Add("@LastName", SqlDbType.NVarChar).Value      = txtLastName.Text.Trim().ToUpper();
                        cmd.Parameters.Add("@DateOfBirth", SqlDbType.DateTime).Value   = Convert.ToDateTime(dob);
                        cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value       = txtAddress.Text.Trim().ToUpper();
                        cmd.Parameters.Add("@City", SqlDbType.NVarChar).Value          = txtCity.Text.Trim().ToUpper();
                        cmd.Parameters.Add("@State", SqlDbType.NVarChar).Value         = txtState.Text.Trim().ToUpper();
                        cmd.Parameters.Add("@ZipCode", SqlDbType.NVarChar).Value       = Convert.ToString(zipCode);
                        cmd.Parameters.Add("@HomePhone", SqlDbType.NVarChar).Value     = txtHomePhone.Text.Trim();
                        cmd.Parameters.Add("@CellPhone", SqlDbType.NVarChar).Value     = txtCellPhone.Text.Trim();
                        cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value         = txtEmail.Text.Trim();
                        cmd.Parameters.Add("@MemberCode", SqlDbType.BigInt).Value      = memberCode;
                        cmd.Parameters.Add("@MemberType", SqlDbType.NVarChar).Value    = cmbMemberType.Text.Trim().ToUpper();
                        cmd.Parameters.Add("@LicenseNumber", SqlDbType.NVarChar).Value = txtLicenseNumber.Text.Trim();
                        //cmd.Parameters.Add("@DiscountOption", SqlDbType.Money).Value = Convert.ToDouble(lblDiscountOption.Text.Substring(0, lblDiscountOption.Text.Length - 1));
                        cmd.Parameters.Add("@DiscountOption", SqlDbType.Money).Value     = discRate;
                        cmd.Parameters.Add("@MemberPoints", SqlDbType.Money).Value       = memberPoints;
                        cmd.Parameters.Add("@StartDate", SqlDbType.DateTime).Value       = Convert.ToDateTime(startDate);
                        cmd.Parameters.Add("@ExpirationDate", SqlDbType.DateTime).Value  = Convert.ToDateTime(expDate);
                        cmd.Parameters.Add("@SchoolGraduated", SqlDbType.NVarChar).Value = txtSchoolGraduated.Text.Trim().ToUpper();
                        cmd.Parameters.Add("@Memo", SqlDbType.NVarChar).Value            = txtMemo.Text.Trim().ToUpper();
                        if (rdoBtnSETrue.Checked == true)
                        {
                            cmd.Parameters.Add("@StoreEmployee", SqlDbType.Bit).Value = true;
                        }
                        else
                        {
                            cmd.Parameters.Add("@StoreEmployee", SqlDbType.Bit).Value = false;
                        }
                        cmd.Parameters.Add("@UpdateStoreCode", SqlDbType.NVarChar).Value = parentForm.storeCode.ToUpper().ToString();
                        cmd.Parameters.Add("@UpdateID", SqlDbType.NVarChar).Value        = parentForm.employeeID.ToUpper().ToString();
                        cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value      = DateTime.Now;


                        parentForm.connHQ.Open();
                        cmd.ExecuteNonQuery();
                        parentForm.connHQ.Close();

                        MyMessageBox.ShowBox("SUCCESSFULLY REGISTERED", "INFORMATION");

                        Resetting();
                    }
                    catch
                    {
                        MyMessageBox.ShowBox("UPDATE FAILED ERROR", "ERROR");
                        parentForm.connHQ.Close();
                        return;
                    }
                }
                else
                {
                    MyMessageBox.ShowBox("PLEASE PASS THE AUTHENTICATION BY MANAGER TO REGISTER A BEAUTICAIN MEMBER.", "WARNING");

                    Authentication authenticationForm = new Authentication(24);
                    authenticationForm.parentForm1  = this.parentForm;
                    authenticationForm.parentForm12 = this;
                    authenticationForm.ShowDialog();
                }
            }
            else
            {
                try
                {
                    btnRegister.Enabled = false;

                    cmd.CommandText = "Create_New_Member";
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Connection  = parentForm.connHQ;
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("@StoreCode", SqlDbType.NVarChar).Value     = parentForm.storeCode;
                    cmd.Parameters.Add("@FirstName", SqlDbType.NVarChar).Value     = txtFirstName.Text.Trim().ToUpper();
                    cmd.Parameters.Add("@LastName", SqlDbType.NVarChar).Value      = txtLastName.Text.Trim().ToUpper();
                    cmd.Parameters.Add("@DateOfBirth", SqlDbType.DateTime).Value   = Convert.ToDateTime(dob);
                    cmd.Parameters.Add("@Address", SqlDbType.NVarChar).Value       = txtAddress.Text.Trim().ToUpper();
                    cmd.Parameters.Add("@City", SqlDbType.NVarChar).Value          = txtCity.Text.Trim().ToUpper();
                    cmd.Parameters.Add("@State", SqlDbType.NVarChar).Value         = txtState.Text.Trim().ToUpper();
                    cmd.Parameters.Add("@ZipCode", SqlDbType.NVarChar).Value       = Convert.ToString(zipCode);
                    cmd.Parameters.Add("@HomePhone", SqlDbType.NVarChar).Value     = txtHomePhone.Text.Trim();
                    cmd.Parameters.Add("@CellPhone", SqlDbType.NVarChar).Value     = txtCellPhone.Text.Trim();
                    cmd.Parameters.Add("@Email", SqlDbType.NVarChar).Value         = txtEmail.Text.Trim();
                    cmd.Parameters.Add("@MemberCode", SqlDbType.BigInt).Value      = memberCode;
                    cmd.Parameters.Add("@MemberType", SqlDbType.NVarChar).Value    = cmbMemberType.Text.Trim().ToUpper();
                    cmd.Parameters.Add("@LicenseNumber", SqlDbType.NVarChar).Value = txtLicenseNumber.Text.Trim();
                    //cmd.Parameters.Add("@DiscountOption", SqlDbType.Money).Value = Convert.ToDouble(lblDiscountOption.Text.Substring(0, lblDiscountOption.Text.Length - 1));
                    cmd.Parameters.Add("@DiscountOption", SqlDbType.Money).Value     = discRate;
                    cmd.Parameters.Add("@MemberPoints", SqlDbType.Money).Value       = memberPoints;
                    cmd.Parameters.Add("@StartDate", SqlDbType.DateTime).Value       = Convert.ToDateTime(startDate);
                    cmd.Parameters.Add("@ExpirationDate", SqlDbType.DateTime).Value  = Convert.ToDateTime(expDate);
                    cmd.Parameters.Add("@SchoolGraduated", SqlDbType.NVarChar).Value = txtSchoolGraduated.Text.Trim().ToUpper();
                    cmd.Parameters.Add("@Memo", SqlDbType.NVarChar).Value            = txtMemo.Text.Trim().ToUpper();
                    if (rdoBtnSETrue.Checked == true)
                    {
                        cmd.Parameters.Add("@StoreEmployee", SqlDbType.Bit).Value = true;
                    }
                    else
                    {
                        cmd.Parameters.Add("@StoreEmployee", SqlDbType.Bit).Value = false;
                    }
                    cmd.Parameters.Add("@UpdateStoreCode", SqlDbType.NVarChar).Value = parentForm.storeCode.ToUpper().ToString();
                    cmd.Parameters.Add("@UpdateID", SqlDbType.NVarChar).Value        = parentForm.employeeID.ToUpper().ToString();
                    cmd.Parameters.Add("@UpdateDate", SqlDbType.DateTime).Value      = DateTime.Now;


                    parentForm.connHQ.Open();
                    cmd.ExecuteNonQuery();
                    parentForm.connHQ.Close();

                    MyMessageBox.ShowBox("SUCCESSFULLY REGISTERED", "INFORMATION");

                    Resetting();
                }
                catch
                {
                    MyMessageBox.ShowBox("UPDATE FAILED ERROR", "ERROR");
                    parentForm.connHQ.Close();
                    return;
                }
            }
        }
Example #9
0
        /// <summary>
        /// Handles the Click event of the cmdOK control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void cmdOK_Click(object sender, EventArgs e)
        {
            if (option == 0)
            {
                cashierID       = txtCashierID.Text.Trim().ToString().ToUpper();
                cashierPassword = txtPsw.Text.Trim().ToString().ToUpper();
                SqlCommand cmd = new SqlCommand("Get_User_LogIn_Info", parentForm1.conn);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@empLoginID", SqlDbType.NVarChar).Value  = cashierID.ToUpper().ToString();
                cmd.Parameters.Add("@empPassword", SqlDbType.NVarChar).Value = cashierPassword;
                SqlParameter UserName_Param  = cmd.Parameters.Add("@empFirstName", SqlDbType.NVarChar, 50);
                SqlParameter UserLevel_Param = cmd.Parameters.Add("@empAccessLv", SqlDbType.TinyInt);
                UserName_Param.Direction  = ParameterDirection.Output;
                UserLevel_Param.Direction = ParameterDirection.Output;

                parentForm1.conn.Open();
                cmd.ExecuteNonQuery();
                parentForm1.conn.Close();

                if (cmd.Parameters["@empFirstName"].Value == DBNull.Value)
                {
                    MyMessageBox.ShowBox("INVALID ACCOUNT", "ERROR");
                    txtPsw.SelectAll();
                    txtPsw.Focus();
                    //MessageBox.Show("Invalid account", "Error");
                }
                else
                {
                    parentForm1.smDiscount  = true;
                    parentForm1.smCashierID = cashierID;
                    this.Close();
                    parentForm2.btnSocialMediaDiscount_Click(null, null);
                }
            }
            else if (option == 1)
            {
                cashierID       = txtCashierID.Text.Trim().ToString().ToUpper();
                cashierPassword = txtPsw.Text.Trim().ToString().ToUpper();
                SqlCommand cmd = new SqlCommand("Get_User_LogIn_Info", parentForm1.conn);

                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Parameters.Add("@empLoginID", SqlDbType.NVarChar).Value  = cashierID.ToUpper().ToString();
                cmd.Parameters.Add("@empPassword", SqlDbType.NVarChar).Value = cashierPassword;
                SqlParameter UserName_Param  = cmd.Parameters.Add("@empFirstName", SqlDbType.NVarChar, 50);
                SqlParameter UserLevel_Param = cmd.Parameters.Add("@empAccessLv", SqlDbType.TinyInt);
                UserName_Param.Direction  = ParameterDirection.Output;
                UserLevel_Param.Direction = ParameterDirection.Output;

                parentForm1.conn.Open();
                cmd.ExecuteNonQuery();
                parentForm1.conn.Close();

                if (cmd.Parameters["@empFirstName"].Value == DBNull.Value)
                {
                    MyMessageBox.ShowBox("INVALID ACCOUNT", "ERROR");
                    txtPsw.SelectAll();
                    txtPsw.Focus();
                    //MessageBox.Show("Invalid account", "Error");
                }
                else
                {
                    parentForm1.eDiscount1 = true;
                    parentForm1.eCashierID = cashierID;
                    this.Close();
                    parentForm2.btn25OFF_Click(null, null);
                }
            }
        }
Example #10
0
        /// <summary>
        /// Handles the Click event of the btnLineNoTax control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        public void btnLineNoTax_Click(object sender, EventArgs e)
        {
            if (parentForm.dataGridView1.RowCount == 0)
            {
                MyMessageBox.ShowBox("NO ITEM", "ERROR");
                //MessageBox.Show("No Item", "Error");
                return;
            }

            if (auth == true)
            {
                /*if (Convert.ToDouble(parentForm.dataGridView1.SelectedCells[6].Value) != 0)
                 * {
                 *  if (Convert.ToDouble(parentForm.dataGridView1.SelectedCells[4].Value) == 0)
                 *  {
                 *      qty = Convert.ToInt16(parentForm.dataGridView1.SelectedCells[2].Value);
                 *      unitPrice = Convert.ToDouble(parentForm.dataGridView1.SelectedCells[3].Value);
                 *      price = qty * unitPrice;
                 *      parentForm.dataGridView1.SelectedCells[5].Value = Math.Round(price, 2);
                 *      parentForm.dataGridView1.SelectedCells[6].Value = price * 0;
                 *
                 *      double subTotal = 0;
                 *      double tax = 0;
                 *      for (int i = 0; i < parentForm.dataGridView1.RowCount; i++)
                 *      {
                 *          subTotal = subTotal + Convert.ToDouble(parentForm.dataGridView1.Rows[i].Cells[5].Value);
                 *          tax = tax + Convert.ToDouble(parentForm.dataGridView1.Rows[i].Cells[6].Value);
                 *      }
                 *      //double tax = subTotal * parentForm.storeTaxRate;
                 *      double grandTotal = subTotal + tax;
                 *      parentForm.lblSubTotal.Text = string.Format("{0:$0.00}", (Math.Round(subTotal, 2)));
                 *      parentForm.lblTax.Text = string.Format("{0:$0.00}", (Math.Round(tax, 2)));
                 *      parentForm.lblGrandTotal.Text = string.Format("{0:$0.00}", grandTotal);
                 *
                 *      discountPrice = 0;
                 *      price = 0;
                 *
                 *      parentForm.Enabled = true;
                 *      this.Close();
                 *      parentForm.richTxtUpc.Focus();
                 *      parentForm.richTxtUpc.Select();
                 *  }
                 *  else
                 *  {
                 *      qty = Convert.ToInt16(parentForm.dataGridView1.SelectedCells[2].Value);
                 *      discountPrice = Convert.ToDouble(parentForm.dataGridView1.SelectedCells[4].Value);
                 *      price = qty * discountPrice;
                 *      parentForm.dataGridView1.SelectedCells[4].Value = discountPrice;
                 *      parentForm.dataGridView1.SelectedCells[5].Value = Math.Round(price, 2);
                 *      parentForm.dataGridView1.SelectedCells[6].Value = price * 0;
                 *
                 *      double subTotal = 0;
                 *      double tax = 0;
                 *      for (int i = 0; i < parentForm.dataGridView1.RowCount; i++)
                 *      {
                 *          subTotal = subTotal + Convert.ToDouble(parentForm.dataGridView1.Rows[i].Cells[5].Value);
                 *          tax = tax + Convert.ToDouble(parentForm.dataGridView1.Rows[i].Cells[6].Value);
                 *      }
                 *      //double tax = subTotal * parentForm.storeTaxRate;
                 *      double grandTotal = subTotal + tax;
                 *      parentForm.lblSubTotal.Text = string.Format("{0:$0.00}", (Math.Round(subTotal, 2)));
                 *      parentForm.lblTax.Text = string.Format("{0:$0.00}", (Math.Round(tax, 2)));
                 *      parentForm.lblGrandTotal.Text = string.Format("{0:$0.00}", grandTotal);
                 *
                 *      discountPrice = 0;
                 *      price = 0;
                 *
                 *      parentForm.Enabled = true;
                 *      this.Close();
                 *      parentForm.richTxtUpc.Focus();
                 *      parentForm.richTxtUpc.Select();
                 *  }
                 * }
                 * else
                 * {
                 *  MyMessageBox.ShowBox("ALREADY NO TAX ITEM", "ERROR");
                 *  //MessageBox.Show("It is already no tax item", "Error");
                 *  return;
                 * }*/


                parentForm.dataGridView1.SelectedCells[11].Value = false;

                parentForm.Calculation();

                parentForm.Enabled = true;
                this.Close();
                parentForm.richTxtUpc.Focus();
                parentForm.richTxtUpc.Select();
            }
            else
            {
                Authentication authenticationForm = new Authentication(13);
                authenticationForm.parentForm1 = this.parentForm;
                authenticationForm.parentForm2 = this;
                authenticationForm.ShowDialog();
            }
        }
Example #11
0
        /// <summary>
        /// Handles the Click event of the btnSearch control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        public void btnSearch_Click(object sender, EventArgs e)
        {
            if (rdoBtnFirstName.Checked == true)
            {
                cmd.CommandText = "Show_Customer_With_Keyword";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = parentForm.conn;
                cmd.Parameters.Clear();
                cmd.Parameters.Add("@Index", SqlDbType.Int).Value        = 1;
                cmd.Parameters.Add("@Keyword", SqlDbType.NVarChar).Value = txtSearchKeyword.Text.ToUpper() + "%";
                SqlDataAdapter adapt = new SqlDataAdapter();
                adapt.SelectCommand = cmd;

                parentForm.conn.Open();
                dt.Clear();
                adapt.Fill(dt);
                parentForm.conn.Close();

                BindingData();
            }
            else if (rdoBtnLastName.Checked == true)
            {
                cmd.CommandText = "Show_Customer_With_Keyword";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = parentForm.conn;
                cmd.Parameters.Clear();
                cmd.Parameters.Add("@Index", SqlDbType.Int).Value        = 2;
                cmd.Parameters.Add("@Keyword", SqlDbType.NVarChar).Value = txtSearchKeyword.Text.ToUpper() + "%";
                SqlDataAdapter adapt = new SqlDataAdapter();
                adapt.SelectCommand = cmd;

                parentForm.conn.Open();
                dt.Clear();
                adapt.Fill(dt);
                parentForm.conn.Close();

                BindingData();
            }
            else if (rdoBtnHomePhone.Checked == true)
            {
                cmd.CommandText = "Show_Customer_With_Keyword";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = parentForm.conn;
                cmd.Parameters.Clear();
                cmd.Parameters.Add("@Index", SqlDbType.Int).Value        = 3;
                cmd.Parameters.Add("@Keyword", SqlDbType.NVarChar).Value = txtSearchKeyword.Text.ToUpper() + "%";
                SqlDataAdapter adapt = new SqlDataAdapter();
                adapt.SelectCommand = cmd;

                parentForm.conn.Open();
                dt.Clear();
                adapt.Fill(dt);
                parentForm.conn.Close();

                BindingData();
            }
            else if (rdoBtnCellPhone.Checked == true)
            {
                cmd.CommandText = "Show_Customer_With_Keyword";
                cmd.CommandType = CommandType.StoredProcedure;
                cmd.Connection  = parentForm.conn;
                cmd.Parameters.Clear();
                cmd.Parameters.Add("@Index", SqlDbType.Int).Value        = 4;
                cmd.Parameters.Add("@Keyword", SqlDbType.NVarChar).Value = txtSearchKeyword.Text.ToUpper() + "%";
                SqlDataAdapter adapt = new SqlDataAdapter();
                adapt.SelectCommand = cmd;

                parentForm.conn.Open();
                dt.Clear();
                adapt.Fill(dt);
                parentForm.conn.Close();

                BindingData();
            }
            else if (rdoBtnMemberCode.Checked == true)
            {
                if (Int64.TryParse(txtSearchKeyword.Text, out memberCode))
                {
                    cmd.CommandText = "Show_Customer_With_Keyword";
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Connection  = parentForm.conn;
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("@Index", SqlDbType.Int).Value        = 5;
                    cmd.Parameters.Add("@Keyword", SqlDbType.NVarChar).Value = Convert.ToString(memberCode);
                    SqlDataAdapter adapt = new SqlDataAdapter();
                    adapt.SelectCommand = cmd;

                    parentForm.conn.Open();
                    dt.Clear();
                    adapt.Fill(dt);
                    parentForm.conn.Close();

                    BindingData();
                }
                else
                {
                    MyMessageBox.ShowBox("INPUT VALID MEMBER CODE", "ERROR");
                    txtSearchKeyword.SelectAll();
                    txtSearchKeyword.Focus();
                    return;
                }
            }

            lblNumberOfMembers.Text = Convert.ToString(dataGridView1.RowCount);
        }
Example #12
0
        /// <summary>
        /// Handles the Click event of the btnInput control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        public void btnInput_Click(object sender, EventArgs e)
        {
            if (richtxtStoreCreditID.Text == "")
            {
                MyMessageBox.ShowBox("INPUT STORECREDIT ID", "ERROR");
                richtxtStoreCreditID.Select();
                richtxtStoreCreditID.Focus();
            }
            else
            {
                lblCurrentBalance.Text   = "";
                lblRemainingBalance.Text = "";

                if (parentForm.StoreCode != cmbStoreCode.Text)
                {
                    if (auth == false)
                    {
                        Authentication authenticationForm = new Authentication(7);
                        authenticationForm.parentForm1 = this.parentForm.parentForm;
                        authenticationForm.parentForm5 = this;
                        authenticationForm.ShowDialog();
                    }
                    else
                    {
                        try
                        {
                            parentForm.newConn_StoreCredit = new SqlConnection(parentForm.parentForm.parentForm.OtherStoreConnectionString(cmbStoreCode.Text));

                            if (Int64.TryParse(richtxtStoreCreditID.Text, out storeCreditID))
                            {
                                //Store Credit Double Check
                                for (int i = 0; i < parentForm.dataGridView1.RowCount; i++)
                                {
                                    if (Convert.ToInt16(parentForm.dataGridView1.Rows[i].Cells[1].Value) == 88)
                                    {
                                        if (Convert.ToString(parentForm.dataGridView1.Rows[i].Cells[3].Value) == cmbStoreCode.Text & Convert.ToInt64(parentForm.dataGridView1.Rows[i].Cells[4].Value) == Convert.ToInt64(richtxtStoreCreditID.Text.Trim()))
                                        {
                                            MyMessageBox.ShowBox("DUPLICATED STORE CREDIT ID", "ERROR");
                                            richtxtStoreCreditID.SelectAll();
                                            richtxtStoreCreditID.Focus();
                                            return;
                                        }
                                    }
                                }

                                cmd.Connection  = parentForm.newConn_StoreCredit;
                                cmd.CommandText = "Show_StoreCredit_Balance";
                                cmd.CommandType = CommandType.StoredProcedure;
                                cmd.Parameters.Clear();
                                cmd.Parameters.Add("@StoreCreditID", SqlDbType.BigInt).Value = storeCreditID;
                                cmd.Parameters.Add("@StoreCode", SqlDbType.NVarChar).Value   = cmbStoreCode.Text;
                                SqlParameter Balance_Param = cmd.Parameters.Add("@Balance", SqlDbType.Money);
                                Balance_Param.Direction = ParameterDirection.Output;

                                parentForm.newConn_StoreCredit.Open();
                                cmd.ExecuteNonQuery();
                                parentForm.newConn_StoreCredit.Close();

                                if (cmd.Parameters["@Balance"].Value == DBNull.Value)
                                {
                                    MyMessageBox.ShowBox("COULD NOT FOUND STORE CREDIT ID", "ERROR");
                                    richtxtStoreCreditID.SelectAll();
                                    richtxtStoreCreditID.Focus();
                                }
                                else if (Convert.ToDouble(cmd.Parameters["@Balance"].Value) <= 0)
                                {
                                    MyMessageBox.ShowBox("YOUR BALANCE IS 0", "ERROR");
                                    richtxtStoreCreditID.SelectAll();
                                    richtxtStoreCreditID.Focus();
                                }
                                else
                                {
                                    balance = Convert.ToDouble(cmd.Parameters["@Balance"].Value);
                                    lblCurrentBalance.Text = string.Format("{0:c}", balance);

                                    if (balance >= storeCreditPayAmount)
                                    {
                                        richtxtStoreCreditID.Enabled = false;
                                        cmbStoreCode.Enabled         = false;
                                        btnCheckOut.Enabled          = true;
                                    }
                                    else
                                    {
                                        MyMessageBox.ShowBox("NOT ENOUGH STORE CREDIT", "ERROR");
                                        return;
                                    }
                                }
                            }
                            else
                            {
                                MyMessageBox.ShowBox("INVALID STORE CREDIT ID", "ERROR");
                                richtxtStoreCreditID.SelectAll();
                                richtxtStoreCreditID.Focus();
                            }
                        }
                        catch
                        {
                            if (parentForm.newConn_StoreCredit.State == ConnectionState.Open)
                            {
                                parentForm.newConn_StoreCredit.Close();
                            }

                            MyMessageBox.ShowBox(cmbStoreCode.Text + " CONNECTION", "ERROR");
                            richtxtStoreCreditID.SelectAll();
                            richtxtStoreCreditID.Focus();
                        }
                    }
                }
                else
                {
                    if (Int64.TryParse(richtxtStoreCreditID.Text, out storeCreditID))
                    {
                        //Store Credit Double Check
                        for (int i = 0; i < parentForm.dataGridView1.RowCount; i++)
                        {
                            if (Convert.ToInt16(parentForm.dataGridView1.Rows[i].Cells[1].Value) == 88)
                            {
                                if (Convert.ToString(parentForm.dataGridView1.Rows[i].Cells[3].Value) == cmbStoreCode.Text & Convert.ToInt64(parentForm.dataGridView1.Rows[i].Cells[4].Value) == Convert.ToInt64(richtxtStoreCreditID.Text.Trim()))
                                {
                                    MyMessageBox.ShowBox("DUPLICATED STORE CREDIT ID", "ERROR");
                                    richtxtStoreCreditID.SelectAll();
                                    richtxtStoreCreditID.Focus();
                                    return;
                                }
                            }
                        }

                        cmd.Connection  = parentForm.parentForm.conn;
                        cmd.CommandText = "Show_StoreCredit_Balance";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Clear();
                        cmd.Parameters.Add("@StoreCreditID", SqlDbType.BigInt).Value = storeCreditID;
                        cmd.Parameters.Add("@StoreCode", SqlDbType.NVarChar).Value   = parentForm.parentForm.storeCode;
                        SqlParameter Balance_Param = cmd.Parameters.Add("@Balance", SqlDbType.Money);
                        Balance_Param.Direction = ParameterDirection.Output;

                        parentForm.parentForm.conn.Open();
                        cmd.ExecuteNonQuery();
                        parentForm.parentForm.conn.Close();

                        if (cmd.Parameters["@Balance"].Value == DBNull.Value)
                        {
                            MyMessageBox.ShowBox("COULD NOT FOUND STORE CREDIT ID", "ERROR");
                            richtxtStoreCreditID.SelectAll();
                            richtxtStoreCreditID.Focus();
                        }
                        else if (Convert.ToDouble(cmd.Parameters["@Balance"].Value) <= 0)
                        {
                            MyMessageBox.ShowBox("YOUR BALANCE IS 0", "ERROR");
                            richtxtStoreCreditID.SelectAll();
                            richtxtStoreCreditID.Focus();
                        }
                        else
                        {
                            balance = Convert.ToDouble(cmd.Parameters["@Balance"].Value);
                            lblCurrentBalance.Text = "$" + Convert.ToString(balance);

                            if (balance >= storeCreditPayAmount)
                            {
                                richtxtStoreCreditID.Enabled = false;
                                cmbStoreCode.Enabled         = false;
                                btnCheckOut.Enabled          = true;
                            }
                            else
                            {
                                MyMessageBox.ShowBox("NOT ENOUGH STORE CREDIT", "ERROR");
                                return;
                            }
                        }
                    }
                    else
                    {
                        MyMessageBox.ShowBox("INVALID STORE CREDIT ID", "ERROR");
                        richtxtStoreCreditID.SelectAll();
                        richtxtStoreCreditID.Focus();
                    }
                }
            }
        }
Example #13
0
        /// <summary>
        /// Handles the Click event of the btnLogin control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnLogin_Click(object sender, EventArgs e)
        {
            string        sDirPath = Application.StartupPath;
            DirectoryInfo dir      = new DirectoryInfo(sDirPath);

            FileInfo[] files;

            files = dir.GetFiles("*.temp", SearchOption.AllDirectories);

            foreach (FileInfo file in files)
            {
                if (file.Attributes == FileAttributes.ReadOnly)
                {
                    file.Attributes = FileAttributes.Normal;
                }
                file.Delete();
            }

            if (cmbStoreName.Text == "" | cmbCashRegister.Text == "" | txtEmployeeID.Text == "" | txtPsw.Text == "")
            {
                return;
            }
            else
            {
                employeeID = txtEmployeeID.Text.Trim().ToString().ToUpper();
                password   = txtPsw.Text.Trim().ToString().ToUpper();

                if (employeeID == SystemMasterUserName & password == SystemMasterPassword)
                {
                    userLevel = 7;

                    storeName    = cmbStoreName.Text.Trim().ToString().ToUpper();
                    cashRegister = cmbCashRegister.Text.Trim().ToString().ToUpper();

                    this.Hide();
                    this.Visible = false;

                    MyMessageBox.ShowBox("CURRENT SYSTEM CLOCK\n" + DateTime.Now.ToString(), "INFORMATION");

                    MainForm mainForm = new MainForm(cashRegister, employeeID, serverConnectionString);
                    mainForm.parentForm = this;
                    mainForm.ShowDialog();
                }
                else
                {
                    SqlCommand cmd = new SqlCommand("Get_User_LogIn_Info", conn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Add("@empLoginID", SqlDbType.NVarChar).Value  = employeeID.ToUpper().ToString();
                    cmd.Parameters.Add("@empPassword", SqlDbType.NVarChar).Value = password;
                    SqlParameter UserName_Param  = cmd.Parameters.Add("@empFirstName", SqlDbType.NVarChar, 50);
                    SqlParameter UserLevel_Param = cmd.Parameters.Add("@empAccessLv", SqlDbType.TinyInt);
                    UserName_Param.Direction  = ParameterDirection.Output;
                    UserLevel_Param.Direction = ParameterDirection.Output;

                    conn.Open();
                    cmd.ExecuteNonQuery();
                    conn.Close();

                    if (cmd.Parameters["@empFirstName"].Value == DBNull.Value)
                    {
                        MyMessageBox.ShowBox("INVALID ACCOUNT", "ERROR");
                        txtPsw.SelectAll();
                        txtPsw.Focus();
                    }
                    else
                    {
                        userLevel = Convert.ToInt16(cmd.Parameters["@empAccessLv"].Value);

                        storeName    = cmbStoreName.Text.Trim().ToString().ToUpper();
                        cashRegister = cmbCashRegister.Text.Trim().ToString().ToUpper();

                        this.Hide();
                        this.Visible = false;

                        MyMessageBox.ShowBox("CURRENT SYSTEM CLOCK\n" + DateTime.Now.ToString(), "INFORMATION");

                        MainForm mainForm = new MainForm(cashRegister, employeeID, serverConnectionString);
                        mainForm.parentForm = this;
                        mainForm.ShowDialog();
                    }
                }
            }
        }
Example #14
0
        /// <summary>
        /// Handles the SelectedIndexChanged event of the cmbStoreName control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void cmbStoreName_SelectedIndexChanged(object sender, EventArgs e)
        {
            try
            {
                if (cmbStoreName.Text == "TEMPLE HILLS")
                {
                    serverConnectionString = "";
                    conn = new SqlConnection(serverConnectionString);
                }
                else if (cmbStoreName.Text == "OXON HILL")
                {
                    serverConnectionString = "";
                    conn = new SqlConnection(serverConnectionString);
                }
                else if (cmbStoreName.Text == "UPPER MARLBORO")
                {
                    serverConnectionString = "";
                    conn = new SqlConnection(serverConnectionString);
                }
                else if (cmbStoreName.Text == "CAPITOL HEIGHTS")
                {
                    serverConnectionString = "";
                    conn = new SqlConnection(serverConnectionString);
                }
                else if (cmbStoreName.Text == "WINDSOR MILL")
                {
                    serverConnectionString = "";
                    conn = new SqlConnection(serverConnectionString);
                }
                else if (cmbStoreName.Text == "CATONSVILLE")
                {
                    serverConnectionString = "";
                    conn = new SqlConnection(serverConnectionString);
                }
                else if (cmbStoreName.Text == "PRINCE WILLIAM")
                {
                    serverConnectionString = "";
                    conn = new SqlConnection(serverConnectionString);
                }
                else if (cmbStoreName.Text == "WOODBRIDGE")
                {
                    serverConnectionString = "";
                    conn = new SqlConnection(serverConnectionString);
                }
                else if (cmbStoreName.Text == "WALDORF")
                {
                    serverConnectionString = "";
                    conn = new SqlConnection(serverConnectionString);
                }

                else if (cmbStoreName.Text == "GAITHERSBURG")
                {
                    serverConnectionString = "";
                    conn = new SqlConnection(serverConnectionString);
                }
                else if (cmbStoreName.Text == "BOWIE")
                {
                    serverConnectionString = "";
                    conn = new SqlConnection(serverConnectionString);
                }
                else if (cmbStoreName.Text == "TEST")
                {
                    serverConnectionString = "";
                    conn = new SqlConnection(serverConnectionString);
                }
                else
                {
                    MyMessageBox.ShowBox("INVALID STORE NAME", "ERROR");
                    return;
                }

                SqlDataReader  dReader;
                SqlDataAdapter adapt1 = new SqlDataAdapter();
                SqlDataAdapter adapt2 = new SqlDataAdapter();
                SqlDataAdapter adapt3 = new SqlDataAdapter();
                SqlDataAdapter adapt4 = new SqlDataAdapter();
                SqlDataAdapter adapt5 = new SqlDataAdapter();
                SqlDataAdapter adapt6 = new SqlDataAdapter();
                SqlDataAdapter adapt7 = new SqlDataAdapter();
                DataTable      dt1    = new DataTable();
                DataTable      dt2    = new DataTable();
                DataTable      dt3    = new DataTable();
                DataTable      dt4    = new DataTable();
                DataTable      dt5    = new DataTable();
                DataTable      dt6    = new DataTable();
                DataTable      dt7    = new DataTable();
                cmd1             = new SqlCommand("Select Distinct empLoginID From Employee Where empStatus='True' Order By empLoginID Asc", conn);
                cmd1.CommandType = CommandType.Text;
                cmd2             = new SqlCommand("Loading_StoreBasicSetup", conn);
                cmd2.CommandType = CommandType.StoredProcedure;
                cmd2.Parameters.Add("@StoreName", SqlDbType.NVarChar).Value = cmbStoreName.Text.Trim().ToUpper();
                cmd3             = new SqlCommand("Loading_ShortcutKey", conn);
                cmd3.CommandType = CommandType.StoredProcedure;
                cmd4             = new SqlCommand("Loading_HardwareSetup", conn);
                cmd4.CommandType = CommandType.StoredProcedure;
                cmd5             = new SqlCommand("Loading_CompanySetup", conn);
                cmd5.CommandType = CommandType.StoredProcedure;
                cmd6             = new SqlCommand("Loading_CustomerDisplayMsg", conn);
                cmd6.CommandType = CommandType.StoredProcedure;
                cmd7             = new SqlCommand("Loading_ConnectionInfo", conn);
                cmd7.CommandType = CommandType.StoredProcedure;
                cmd8             = new SqlCommand("Loading_AdminOption", conn);
                cmd8.CommandType = CommandType.StoredProcedure;

                conn.Open();
                dReader = cmd1.ExecuteReader();
                if (dReader.HasRows == true)
                {
                    while (dReader.Read())
                    {
                        namesCollection.Add(dReader["empLoginID"].ToString());
                    }
                }
                else
                {
                    MyMessageBox.ShowBox("ACTIVE EMPLOYEE NOT FOUND", "ERROR");
                }
                dReader.Close();
                adapt1.SelectCommand = cmd2;
                adapt2.SelectCommand = cmd3;
                adapt3.SelectCommand = cmd4;
                adapt4.SelectCommand = cmd5;
                adapt5.SelectCommand = cmd6;
                adapt6.SelectCommand = cmd7;
                adapt7.SelectCommand = cmd8;
                adapt1.Fill(dt1);
                adapt2.Fill(dt2);
                adapt3.Fill(dt3);
                adapt4.Fill(dt4);
                adapt5.Fill(dt5);
                adapt6.Fill(dt6);
                adapt7.Fill(dt7);
                conn.Close();

                txtEmployeeID.AutoCompleteMode         = AutoCompleteMode.SuggestAppend;
                txtEmployeeID.AutoCompleteSource       = AutoCompleteSource.CustomSource;
                txtEmployeeID.AutoCompleteCustomSource = namesCollection;

                dataGridView1.DataSource = dt1;
                dataGridView2.DataSource = dt2;
                dataGridView3.DataSource = dt3;
                dataGridView4.DataSource = dt4;
                dataGridView5.DataSource = dt5;
                dataGridView6.DataSource = dt6;
                dataGridView7.DataSource = dt7;

                storeName               = cmbStoreName.Text.Trim().ToUpper();
                LRStoreCode             = Convert.ToString(dataGridView1.Rows[0].Cells[1].Value);
                LRStoreStreet           = Convert.ToString(dataGridView1.Rows[0].Cells[2].Value);
                LRStoreCity             = Convert.ToString(dataGridView1.Rows[0].Cells[3].Value);
                LRStoreState            = Convert.ToString(dataGridView1.Rows[0].Cells[4].Value);
                LRStoreZipCode          = Convert.ToString(dataGridView1.Rows[0].Cells[5].Value);
                LRStoreTelephone        = Convert.ToString(dataGridView1.Rows[0].Cells[6].Value);
                LRStoreStreetMargin     = Convert.ToInt16(dataGridView1.Rows[0].Cells[7].Value);
                LRStoreCityStateMargin  = Convert.ToInt16(dataGridView1.Rows[0].Cells[8].Value);
                LRStoreTelephoneMargin  = Convert.ToInt16(dataGridView1.Rows[0].Cells[9].Value);
                LRStoreTaxRate          = Convert.ToDouble(dataGridView1.Rows[0].Cells[10].Value);
                LRStorePcChargePath     = Convert.ToString(dataGridView1.Rows[0].Cells[11].Value);
                LRStoreProcessor        = Convert.ToString(dataGridView1.Rows[0].Cells[12].Value);
                LRStoreMerchantNum      = Convert.ToString(dataGridView1.Rows[0].Cells[13].Value);
                LRStorePcChargeUser1    = Convert.ToString(dataGridView1.Rows[0].Cells[14].Value);
                LRStorePcChargeUser2    = Convert.ToString(dataGridView1.Rows[0].Cells[15].Value);
                LRStorePcChargeUser3    = Convert.ToString(dataGridView1.Rows[0].Cells[16].Value);
                LRStorePcChargeUser4    = Convert.ToString(dataGridView1.Rows[0].Cells[17].Value);
                LRStorePcChargeLoginID  = Convert.ToString(dataGridView1.Rows[0].Cells[18].Value).Trim();
                LRStorePcChargePassword = Convert.ToString(dataGridView1.Rows[0].Cells[19].Value).Trim();

                LRF1  = Convert.ToString(dataGridView2.Rows[0].Cells[0].Value);
                LRF2  = Convert.ToString(dataGridView2.Rows[0].Cells[1].Value);
                LRF3  = Convert.ToString(dataGridView2.Rows[0].Cells[2].Value);
                LRF4  = Convert.ToString(dataGridView2.Rows[0].Cells[3].Value);
                LRF5  = Convert.ToString(dataGridView2.Rows[0].Cells[4].Value);
                LRF6  = Convert.ToString(dataGridView2.Rows[0].Cells[5].Value);
                LRF7  = Convert.ToString(dataGridView2.Rows[0].Cells[6].Value);
                LRF8  = Convert.ToString(dataGridView2.Rows[0].Cells[7].Value);
                LRF9  = Convert.ToString(dataGridView2.Rows[0].Cells[8].Value);
                LRF10 = Convert.ToString(dataGridView2.Rows[0].Cells[9].Value);
                LRF11 = Convert.ToString(dataGridView2.Rows[0].Cells[10].Value);
                LRF12 = Convert.ToString(dataGridView2.Rows[0].Cells[11].Value);

                HWReceiptPrinterName = Convert.ToString(dataGridView3.Rows[0].Cells[2].Value);
                HWVFDCmdType         = Convert.ToString(dataGridView3.Rows[0].Cells[4].Value);
                HWVFDPort            = Convert.ToString(dataGridView3.Rows[0].Cells[6].Value);
                HWVFDBaudRate        = Convert.ToInt16(dataGridView3.Rows[0].Cells[7].Value);

                CSComapnyName        = Convert.ToString(dataGridView4.Rows[0].Cells[0].Value);
                CSReceiptLastComment = Convert.ToString(dataGridView4.Rows[0].Cells[1].Value);

                CDMOpeningMsg1 = Convert.ToString(dataGridView5.Rows[0].Cells[0].Value);
                CDMOpeningMsg2 = Convert.ToString(dataGridView5.Rows[0].Cells[1].Value);
                CDMClosingMsg1 = Convert.ToString(dataGridView5.Rows[0].Cells[2].Value);
                CDMClosingMSG2 = Convert.ToString(dataGridView5.Rows[0].Cells[3].Value);

                B4UHQIP = Convert.ToString(dataGridView6.Rows[0].Cells[4].Value);
                //B4UWHIP = Convert.ToString(dataGridView6.Rows[1].Cells[4].Value);
                THIP = Convert.ToString(dataGridView6.Rows[2].Cells[4].Value);
                OHIP = Convert.ToString(dataGridView6.Rows[3].Cells[4].Value);
                UMIP = Convert.ToString(dataGridView6.Rows[4].Cells[4].Value);
                CHIP = Convert.ToString(dataGridView6.Rows[5].Cells[4].Value);
                WMIP = Convert.ToString(dataGridView6.Rows[6].Cells[4].Value);
                CVIP = Convert.ToString(dataGridView6.Rows[7].Cells[4].Value);
                PWIP = Convert.ToString(dataGridView6.Rows[8].Cells[4].Value);
                WBIP = Convert.ToString(dataGridView6.Rows[9].Cells[4].Value);
                WDIP = Convert.ToString(dataGridView6.Rows[10].Cells[4].Value);
                GBIP = Convert.ToString(dataGridView6.Rows[11].Cells[4].Value);
                BWIP = Convert.ToString(dataGridView6.Rows[12].Cells[4].Value);

                B4UHQDB = Convert.ToString(dataGridView6.Rows[0].Cells[5].Value);
                //B4UWHDB = Convert.ToString(dataGridView6.Rows[1].Cells[5].Value);
                THDB = Convert.ToString(dataGridView6.Rows[2].Cells[5].Value);
                OHDB = Convert.ToString(dataGridView6.Rows[3].Cells[5].Value);
                UMDB = Convert.ToString(dataGridView6.Rows[4].Cells[5].Value);
                CHDB = Convert.ToString(dataGridView6.Rows[5].Cells[5].Value);
                WMDB = Convert.ToString(dataGridView6.Rows[6].Cells[5].Value);
                CVDB = Convert.ToString(dataGridView6.Rows[7].Cells[5].Value);
                PWDB = Convert.ToString(dataGridView6.Rows[8].Cells[5].Value);
                WBDB = Convert.ToString(dataGridView6.Rows[9].Cells[5].Value);
                WDDB = Convert.ToString(dataGridView6.Rows[10].Cells[5].Value);
                GBDB = Convert.ToString(dataGridView6.Rows[11].Cells[5].Value);
                BWDB = Convert.ToString(dataGridView6.Rows[12].Cells[5].Value);

                DBUID   = Convert.ToString(dataGridView6.Rows[0].Cells[6].Value);
                DBPSW   = Convert.ToString(dataGridView6.Rows[0].Cells[7].Value);
                sqlPort = Convert.ToString(dataGridView6.Rows[0].Cells[8].Value);

                SystemMasterUserName = Convert.ToString(dataGridView7.Rows[0].Cells[6].Value);
                SystemMasterPassword = Convert.ToString(dataGridView7.Rows[0].Cells[7].Value);

                B4UHQCS = "Data Source=" + B4UHQIP + ", " + sqlPort + ";Network Library=DBMSSOCN;Initial Catalog=" + B4UHQDB + ";User ID=" + DBUID + ";Password="******"CAN NOT CONNECT THE SERVER...", "ERROR");
                cmbStoreName.SelectAll();
                cmbStoreName.Focus();
            }
        }
        /// <summary>
        /// Handles the Click event of the btnPrintClosingRegister control.
        /// </summary>
        /// <param name="sender">The source of the event.</param>
        /// <param name="e">The <see cref="EventArgs"/> instance containing the event data.</param>
        private void btnPrintClosingRegister_Click(object sender, EventArgs e)
        {
            if (txtDate.Text == "")
            {
                MyMessageBox.ShowBox("INPUT DATE", "ERROR");
                txtDate.Select();
                txtDate.Focus();
                return;
            }
            else
            {
                if (DateTime.TryParse(txtDate.Text.Trim(), out d))
                {
                    cmd             = new SqlCommand("Get_ClosingRegister_Information", parentForm.conn);
                    cmd.CommandType = CommandType.StoredProcedure;
                    cmd.Parameters.Clear();
                    cmd.Parameters.Add("@RegisterNum", SqlDbType.NVarChar).Value = parentForm.cashRegisterNum.ToUpper();
                    cmd.Parameters.Add("@RegDate", SqlDbType.NVarChar).Value     = string.Format("{0:MM/dd/yyyy}", d);
                    SqlParameter CheckNum_Param           = cmd.Parameters.Add("@CheckNum", SqlDbType.TinyInt);
                    SqlParameter TransactionID_Param      = cmd.Parameters.Add("@TransactionID", SqlDbType.BigInt);
                    SqlParameter RegStartAmount_Param     = cmd.Parameters.Add("@RegStartAmount", SqlDbType.Money);
                    SqlParameter RegCashSalesAmount_Param = cmd.Parameters.Add("@RegCashSalesAmount", SqlDbType.Money);
                    SqlParameter RegCashRealAmount_Param  = cmd.Parameters.Add("@RegCashRealAmount", SqlDbType.Money);
                    SqlParameter RegWithdrawAmount_Param  = cmd.Parameters.Add("@RegWithdrawAmount", SqlDbType.Money);
                    SqlParameter RegShortageAmount_Param  = cmd.Parameters.Add("@RegShortageAmount", SqlDbType.Money);
                    SqlParameter RegTime_Param            = cmd.Parameters.Add("@RegTime", SqlDbType.NVarChar, 50);
                    SqlParameter RegCashierID_Param       = cmd.Parameters.Add("@RegCashierID", SqlDbType.NVarChar, 50);
                    SqlParameter RegManagerID_Param       = cmd.Parameters.Add("@RegManagerID", SqlDbType.NVarChar, 50);
                    CheckNum_Param.Direction           = ParameterDirection.Output;
                    TransactionID_Param.Direction      = ParameterDirection.Output;
                    RegStartAmount_Param.Direction     = ParameterDirection.Output;
                    RegCashSalesAmount_Param.Direction = ParameterDirection.Output;
                    RegCashRealAmount_Param.Direction  = ParameterDirection.Output;
                    RegWithdrawAmount_Param.Direction  = ParameterDirection.Output;
                    RegShortageAmount_Param.Direction  = ParameterDirection.Output;
                    RegTime_Param.Direction            = ParameterDirection.Output;
                    RegCashierID_Param.Direction       = ParameterDirection.Output;
                    RegManagerID_Param.Direction       = ParameterDirection.Output;

                    parentForm.conn.Open();
                    cmd.ExecuteNonQuery();
                    parentForm.conn.Close();

                    if (Convert.ToInt16(cmd.Parameters["@CheckNum"].Value) != 0)
                    {
                        TransactionID      = Convert.ToInt64(cmd.Parameters["@TransactionID"].Value);
                        regStartAmount     = Convert.ToDouble(cmd.Parameters["@RegStartAmount"].Value);
                        regCashSalesAmount = Convert.ToDouble(cmd.Parameters["@RegCashSalesAmount"].Value);
                        regCashRealAmount  = Convert.ToDouble(cmd.Parameters["@RegCashRealAmount"].Value);
                        regWithdrawAmount  = Convert.ToDouble(cmd.Parameters["@RegWithdrawAmount"].Value);
                        regShortageAmount  = Convert.ToDouble(cmd.Parameters["@RegShortageAmount"].Value);
                        regDate            = string.Format("{0:MM/dd/yyyy}", d);
                        regTime            = Convert.ToString(cmd.Parameters["@RegTime"].Value);
                        regCashierID       = Convert.ToString(cmd.Parameters["@RegCashierID"].Value);
                        regManagerID       = Convert.ToString(cmd.Parameters["@RegManagerID"].Value);

                        Int32  retVal;
                        String errMsg;
                        apiAlias.StatusMonitoring pMonitorCB = new apiAlias.StatusMonitoring(StatusMonitoring);

                        pdPrint            = new PrintDocument();
                        pdPrint.PrintPage += new PrintPageEventHandler(pdPrint_PrintPage);
                        pdPrint.PrinterSettings.PrinterName = parentForm.PRINTER_NAME;

                        try
                        {
                            // Open Printer Monitor of Status API.
                            mpHandle = apiAlias.BiOpenMonPrinter(apiAlias.TYPE_PRINTER, pdPrint.PrinterSettings.PrinterName);
                            if (mpHandle < 0)
                            {
                                MessageBox.Show("Failed to open printer status monitor.", "", MessageBoxButtons.OK);
                            }
                            else
                            {
                                isFinish  = false;
                                cancelErr = false;

                                // Set the callback function that will monitor printer status.
                                retVal = apiAlias.BiSetStatusBackFunction(mpHandle, pMonitorCB);

                                if (retVal != apiAlias.SUCCESS)
                                {
                                    MessageBox.Show("Failed to set callback function.", "", MessageBoxButtons.OK);
                                }
                                else
                                {
                                    // Start printing.
                                    //pdPrint1.Print();
                                    //pdPrint2.Print();

                                    // Wait until callback function will say that the task is done.
                                    // When done, end the monitoring of printer status.
                                    //do
                                    //{
                                    //    if (isFinish)
                                    //        retVal = apiAlias.BiCancelStatusBack(mpHandle);
                                    //} while (!isFinish);

                                    // Display the status/error message.
                                    //DisplayStatusMessage();

                                    // If an error occurred, restore the recoverable error.
                                    if (cancelErr)
                                    {
                                        retVal = apiAlias.BiCancelError(mpHandle);
                                    }
                                    else
                                    {
                                        pdPrint.Print();
                                    }
                                }
                            }
                        }
                        catch (Exception ex)
                        {
                            errMsg = ex.Message;
                            MessageBox.Show("Failed to open StatusAPI.", "", MessageBoxButtons.OK);
                        }
                        finally
                        {
                            // Close Printer Monitor.
                            if (mpHandle > 0)
                            {
                                if (apiAlias.BiCloseMonPrinter(mpHandle) != apiAlias.SUCCESS)
                                {
                                    MessageBox.Show("Failed to close printer status monitor.", "", MessageBoxButtons.OK);
                                }
                            }
                        }
                    }
                    else
                    {
                        MyMessageBox.ShowBox("NOT YET CLOSED", "ERROR");
                        txtDate.SelectAll();
                        txtDate.Focus();
                        return;
                    }
                }
                else
                {
                    MyMessageBox.ShowBox("INVALID DATE", "ERROR");
                    txtDate.SelectAll();
                    txtDate.Focus();
                    return;
                }
            }
        }