Beispiel #1
0
        private void button8_Click(object sender, EventArgs e)
        {
            sc.tabcontrol1.SelectedIndex = 1;
            sc.tabcontrol1.Size          = new Size(1267, 582);
            sc.resetBeginPurchase();
            printForm pf = new printForm();

            pf.Show();
            this.Dispose();
        }
Beispiel #2
0
        private void button5_Click(object sender, EventArgs e)
        {
            if (Double.Parse(tbxAmtPaid_Payment.Text) >= Double.Parse(lblTotal_Payment.Text))
            {
                if (GlobalVariables.TransactionType.Equals("Store"))
                {
                    if (GlobalVariables.isMemeber)
                    {
                        orderTblTableAdapter.Insert(Decimal.Parse(GlobalVariables.cartTotal.ToString()), GlobalVariables.TransactionType, null, null, GlobalVariables.StaffID, GlobalVariables.MemberID);
                    }
                    else
                    {
                        orderTblTableAdapter.Insert(Decimal.Parse(GlobalVariables.cartTotal.ToString()), GlobalVariables.TransactionType, null, null, GlobalVariables.StaffID, null);
                    }
                    GlobalVariables.orderNo = int.Parse(globalOrdeNoGrid.Rows[globalOrdeNoGrid.Rows.Count - 2].Cells[0].Value.ToString());
                }
                else
                {
                    if (GlobalVariables.isMemeber)
                    {
                        orderTblTableAdapter.Insert(Decimal.Parse(GlobalVariables.cartTotal.ToString()), "Phone", GlobalVariables.customerName_Order, GlobalVariables.customerCellNo_Order, GlobalVariables.StaffID, GlobalVariables.MemberID);
                    }
                    else
                    {
                        orderTblTableAdapter.Insert(Decimal.Parse(GlobalVariables.cartTotal.ToString()), "Phone", GlobalVariables.customerName_Order, GlobalVariables.customerCellNo_Order, GlobalVariables.StaffID, null);
                    }
                }
                int maxOrderID = int.Parse(orderTblTableAdapter.getMaxID().ToString());

                for (int i = 0; i < GlobalVariables.productCart_ProductID.Count(); i++)
                {
                    orderLineTblTableAdapter.Insert(maxOrderID, int.Parse(GlobalVariables.productCart_ProductID.ElementAt(i)), Decimal.Parse(GlobalVariables.productCart_UnitPrice.ElementAt(i).ToString()), GlobalVariables.productCart_Quantity.ElementAt(i));
                    int productQuantity = int.Parse(updateProduantity1.getQuanity(int.Parse(GlobalVariables.productCart_ProductID.ElementAt(i))).ToString());
                    updateProduantity1.updateProductQuantity(productQuantity - GlobalVariables.productCart_Quantity.ElementAt(i), int.Parse(GlobalVariables.productCart_ProductID.ElementAt(i)));
                }


                this.orderLineTblTableAdapter.Fill(this.productDS.OrderLineTbl);
                this.orderTblTableAdapter.Fill(this.productDS.OrderTbl);
                //Non Member
                GlobalVariables.orderNo    = int.Parse(globalOrdeNoGrid.Rows[globalOrdeNoGrid.Rows.Count - 2].Cells[0].Value.ToString());
                sc.tabcontrol1.SelectedTab = sc.purchase;
                sc.tabcontrol1.Size        = new Size(1267, 582);
                sc.resetBeginPurchase();
                printForm pf = new printForm();

                pf.Show();
                this.Dispose();
            }
            else
            {
                MessageBox.Show("Outstanding Amount R" + (Double.Parse(lblTotal_Payment.Text) - Double.Parse(tbxAmtPaid_Payment.Text)));
            }
        }
Beispiel #3
0
        private void btnProcess_Return_Click(object sender, EventArgs e)
        {
            if (!tbxReason_Return.Text.Equals("") && tbxCellNo_Return.Text.Length == 10 && !tbxCellNo_Return.Text.Equals(""))
            {
                DialogResult confirm = MessageBox.Show("Are You Sure", "Confirm Return", MessageBoxButtons.YesNo);
                if (confirm == DialogResult.Yes)
                {
                    returnTblTableAdapter.Insert(tbxReason_Return.Text, tbxCellNo_Return.Text);

                    int maxID = int.Parse(returnTblTableAdapter.getMaxID().ToString());
                    for (int i = 0; i < GlobalVariables.Return_OrderNum.Count; i++)
                    {
                        returnProductTblTableAdapter.Insert(int.Parse(GlobalVariables.productCart_ProductID.ElementAt(i)), maxID, dtpReturnDate_Returns.Value, GlobalVariables.Return_OrderNum.ElementAt(i));
                    }

                    for (int i = 0; i < GlobalVariables.Return_OrderNum.Count; i++)
                    {
                        updateProduantity1.DeleteOrderProduct(int.Parse(GlobalVariables.Return_OrderNum.ElementAt(i).ToString()), int.Parse(GlobalVariables.productCart_ProductID.ElementAt(i).ToString()));
                        this.orderLineTblTableAdapter.Fill(this.productDS.OrderLineTbl);

                        if (!bool.Parse(updateProduantity1.CheckOrderNumExists(int.Parse(GlobalVariables.Return_OrderNum.ElementAt(i).ToString())).ToString()))
                        {
                            updateProduantity1.DeleteOrder(int.Parse(GlobalVariables.Return_OrderNum.ElementAt(i).ToString()));
                            this.orderTblTableAdapter.Fill(this.productDS.OrderTbl);
                        }
                    }
                    sc.tabcontrol1.SelectedIndex = 1;
                    sc.tabcontrol1.Size          = new Size(1267, 582);
                    sc.resetBeginPurchase();
                    printForm pf = new printForm();

                    pf.Show();
                    this.Dispose();
                }
                else
                {
                    sc.tabcontrol1.SelectedIndex = 1;
                    sc.tabcontrol1.Size          = new Size(1267, 582);
                    sc.resetBeginPurchase();
                    printForm pf = new printForm();

                    pf.Show();
                    this.Dispose();
                }
            }
            else
            {
                MessageBox.Show("Please Re-Enter Details for Return ");
            }
        }