コード例 #1
0
        private void ADD_DATA(string PRODUCT_NAME, int PRODUCT_PRICE, int PRODUCT_QUANTITY, int PRODUCT_TOTAL)
        {
            bool Product_Found = false;

            int Row_Number = 0;

            foreach (POS_TRANSACTION TRANSACTION_ITEM in PUYO_FUNCTION.POS_TRANSACTIONS)
            {
                if (TRANSACTION_ITEM.PRODUCT_NAME.Equals(PRODUCT_NAME))
                {
                    TRANSACTION_ITEM.PRODUCT_QUANTITY += PRODUCT_QUANTITY;
                    TRANSACTION_ITEM.TOTAL_PRICE       = TRANSACTION_ITEM.PRODUCT_PRICE * TRANSACTION_ITEM.PRODUCT_QUANTITY;
                    TransactionData.Rows[Row_Number].Cells[2].Value = TRANSACTION_ITEM.PRODUCT_QUANTITY;
                    TransactionData.Rows[Row_Number].Cells[3].Value = TRANSACTION_ITEM.TOTAL_PRICE;
                    Product_Found = true;
                }

                Row_Number = Row_Number + 1;
            }

            if (Product_Found == false)
            {
                TransactionData.Rows.Add(PRODUCT_NAME, PRODUCT_PRICE, PRODUCT_QUANTITY, PRODUCT_TOTAL);
                POS_TRANSACTION NEW_ITEM = new POS_TRANSACTION(PRODUCT_NAME, PRODUCT_PRICE, PRODUCT_QUANTITY, PRODUCT_TOTAL);
                PUYO_FUNCTION.POS_TRANSACTIONS.Add(NEW_ITEM);
            }

            int sum = PUYO_FUNCTION.GET_SUM();

            UPDATE_TOTAL(sum);
        }
コード例 #2
0
        private void Save_Data_Button_Click(object sender, EventArgs e)
        {
            PUYO_FUNCTION.SUBMIT_RESTOCKING();

            REFRESH_STOCKDATA();

            MessageBox.Show("Data Successfully Added", "Info",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.None);
        }
コード例 #3
0
        private void Save_Data_Button_Click(object sender, EventArgs e)
        {
            PUYO_FUNCTION.SUBMIT_TRANSACTION(PUYO_FUNCTION.GET_MASTER_TRANSACTION_ID(), "EXPIRED");

            TransactionData.Rows.Clear();
            TransactionData.Refresh();

            REFRESH_STOCKDATA();

            INVENTORY_ALERT();

            MessageBox.Show("Data Successfully Added", "Info",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.None);
        }
コード例 #4
0
        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            int rowindex    = TransactionData.CurrentCell.RowIndex;
            int columnindex = TransactionData.CurrentCell.ColumnIndex;

            if (columnindex == 4)
            {
                TransactionData.Rows.RemoveAt(rowindex);

                PUYO_FUNCTION.POS_TRANSACTIONS.RemoveAt(rowindex);

                int sum = PUYO_FUNCTION.GET_SUM();

                UPDATE_TOTAL(sum);
            }
        }
コード例 #5
0
        private void button1_Click(object sender, EventArgs e)
        {
            PUYOWAREHOUSEDataContext a = new PUYOWAREHOUSEDataContext();

            string Master_Transaction_ID;

            var Get_Last_Master_Transaction = from Master_Transaction in a.Warehouse_Master_Transactions
                                              orderby Master_Transaction.Master_Transaction_ID descending
                                              select Master_Transaction.Master_Transaction_ID;

            int Count_Master_Transaction = Get_Last_Master_Transaction.Count();

            if (Count_Master_Transaction == 0)
            {
                Master_Transaction_ID = "MT00001";
            }
            else
            {
                var    Get_Last_Master_Transaction_ID = Get_Last_Master_Transaction.First().ToString();
                string New_Master_Transaction_ID      = PUYO_FUNCTION.ID_PADDING(Get_Last_Master_Transaction_ID);
                Master_Transaction_ID = New_Master_Transaction_ID;
            }

            DateTime Now_Date = DateTime.Now;

            Warehouse_Master_Transaction New_Master_Transaction = new Warehouse_Master_Transaction();

            New_Master_Transaction.Master_Transaction_ID   = Master_Transaction_ID;
            New_Master_Transaction.Master_Transaction_Date = Now_Date;

            //This will change depending on the ID of the cashier
            New_Master_Transaction.Store_ID = Store_Combo.Text;

            a.Warehouse_Master_Transactions.InsertOnSubmit(New_Master_Transaction);
            a.SubmitChanges();

            int Data_Row_Number = 0;

            foreach (DataGridViewRow row in dataGridView1.Rows)
            {
                Warehouse_Transaction New_Transaction = new Warehouse_Transaction();

                //This is the data of the name of the product
                string Product_ID_Single = (dataGridView1.Rows[Data_Row_Number].Cells[3].Value).ToString();

                //This is the data of the price of the product
                var Get_Product_Id = from Product_Get in a.Warehouse_Products
                                     where Product_Get.Product_ID.Equals(Product_ID_Single)
                                     select Product_Get.Product_ID;

                string Price_Single = Get_Product_Id.First().ToString();

                //This is the data of the quantity of the product
                string Product_Quantity_Single = (dataGridView1.Rows[Data_Row_Number].Cells[4].Value).ToString();

                //This is the data of the total price of the product
                string Total_Price_Single = (dataGridView1.Rows[Data_Row_Number].Cells[5].Value).ToString();

                //This is the data of the status of the product
                string Status_Single = (dataGridView1.Rows[Data_Row_Number].Cells[6].Value.ToString());

                string Transaction_ID;

                var Get_Last_Transaction = from Transaction in a.Warehouse_Transactions
                                           orderby Transaction.Transaction_ID descending
                                           select Transaction.Transaction_ID;

                int Count_Transaction = Get_Last_Transaction.Count();

                if (Count_Transaction == 0)
                {
                    Transaction_ID = "TI00001";
                }
                else
                {
                    var    Get_Last_Transaction_ID = Get_Last_Transaction.First().ToString();
                    string New_Transaction_ID      = PUYO_FUNCTION.ID_PADDING(Get_Last_Transaction_ID);
                    Transaction_ID = New_Transaction_ID;
                }

                New_Transaction.Master_Transaction_ID = Master_Transaction_ID;
                New_Transaction.Product_ID            = Product_ID_Single;
                New_Transaction.Quantity       = Convert.ToInt32(Product_Quantity_Single);
                New_Transaction.Transaction_ID = Transaction_ID;
                New_Transaction.Total_Price    = Convert.ToInt32(Total_Price_Single);
                New_Transaction.Status         = Status_Single;

                a.Warehouse_Transactions.InsertOnSubmit(New_Transaction);
                a.SubmitChanges();

                Data_Row_Number += 1;
            }
            MessageBox.Show("Data Successfully Sent To Warehouse", "Info",
                            MessageBoxButtons.OK,
                            MessageBoxIcon.None);
        }