private void txtWarehouseRef_Leave(object sender, EventArgs e)
        {
            txtWarehouseRef.Text = clsWarehouse.ChangeCase(txtWarehouseRef.Text, 1);
            clsShop warehouse = new clsShop()
            {
                ShopRef = txtWarehouseRef.Text.TrimEnd()
            };

            txtWarehouseName.Text = warehouse.GetShopName();
        }
        private void TxtToShopRef_Leave(object sender, EventArgs e)
        {
            TxtToShopRef.Text = clsShop.ChangeCase(TxtToShopRef.Text, 1);
            clsShop Shop = new clsShop()
            {
                ShopRef = TxtToShopRef.Text.TrimEnd()
            };

            txtToShopName.Text = Shop.GetShopName();
        }
        private void TxtFromShopRef_Leave(object sender, EventArgs e)
        {
            TxtFromShopRef.Text = clsShop.ChangeCase(TxtFromShopRef.Text, 1);
            clsShop Shop = new clsShop()
            {
                ShopRef = TxtFromShopRef.Text.TrimEnd()
            };

            txtFromShopName.Text = Shop.GetShopName();
            LoadShopsIntoForm_ToBox();
        }
        private void txtShopRef_Leave(object sender, EventArgs e)
        {
            txtShopRef.Text = clsShop.ChangeCase(txtShopRef.Text, 1);
            clsShop Shop = new clsShop()
            {
                ShopRef = txtShopRef.Text.TrimEnd()
            };

            lblShopName.Text = Shop.GetShopName();
            LoadSalesGrid();
        }
 private void TxtWarehouseRef_Leave(object sender, EventArgs e)
 {
     TxtWarehouseRef.Text = clsUtils.ChangeCase(TxtWarehouseRef.Text, 1);
     if (CheckBox1.Checked != true)
     {
         clsWarehouse warehouse = new clsWarehouse(0)
         {
             WarehouseRef = TxtWarehouseRef.Text
         };
         TxtWarehouseName.Text = warehouse.GetWarehouseName();
     }
     else
     {
         clsShop shop = new clsShop
         {
             ShopRef = TxtWarehouseRef.Text
         };
         TxtWarehouseName.Text = shop.GetShopName();
     }
 }
        private void LoadData()
        {
            int ShopTransferID = Convert.ToInt32(TxtTransferID.Text.TrimEnd());

            using (SqlConnection conn = new SqlConnection())
            {
                conn.ConnectionString = clsUtils.GetConnString(1);
                conn.Open();
                DataTable      ShopTransferHead        = new DataTable();
                SqlDataAdapter ShopTransferDataAdapter = new SqlDataAdapter();
                using (SqlCommand SelectCmd = new SqlCommand())
                {
                    SelectCmd.Connection  = conn;
                    SelectCmd.CommandText = "SELECT * from tblShopTransfers WHERE ShopTransferID = @ShopTransferID";
                    SelectCmd.Parameters.AddWithValue("@ShopTransferID", ShopTransferID);
                    ShopTransferDataAdapter.SelectCommand = SelectCmd;
                    ShopTransferDataAdapter.Fill(ShopTransferHead);
                }
                TxtTFNote.Text      = ShopTransferHead.Rows[0][1].ToString();
                DtpDate.Value       = Convert.ToDateTime(ShopTransferHead.Rows[0][2]);
                olddate             = DtpDate.Value;
                TxtFromShopRef.Text = ShopTransferHead.Rows[0][3].ToString();
                clsShop shop = new clsShop();
                shop.ShopRef            = TxtFromShopRef.Text.TrimEnd();
                txtFromShopName.Text    = shop.GetShopName();
                TxtToShopRef.Text       = ShopTransferHead.Rows[0][4].ToString();
                shop.ShopRef            = TxtToShopRef.Text.TrimEnd();
                txtToShopName.Text      = shop.GetShopName();
                txtTotalTransferTo.Text = ShopTransferHead.Rows[0][6].ToString();
            }
            DgvRecords.Columns.Clear();
            using (SqlConnection conn = new SqlConnection())
            {
                conn.ConnectionString = clsUtils.GetConnString(1);
                conn.Open();
                DataTable      ShopAdjustLine            = new DataTable();
                SqlDataAdapter ShopAdjustLineDataAdapter = new SqlDataAdapter();
                using (SqlCommand SelectCmd = new SqlCommand())
                {
                    SelectCmd.Connection  = conn;
                    SelectCmd.CommandText = "SELECT StockCode,CurrentQty,Qty from tblShopTranferLines WHERE ShopTransferID = @ShopTransferID";
                    SelectCmd.Parameters.AddWithValue("@ShopTransferID", ShopTransferID);
                    ShopAdjustLineDataAdapter.SelectCommand = SelectCmd;
                    ShopAdjustLineDataAdapter.Fill(ShopAdjustLine);
                    DgvRecords.DataSource          = ShopAdjustLine;
                    DgvRecords.AutoGenerateColumns = true;
                    DgvRecords.CellBorderStyle     = DataGridViewCellBorderStyle.None;
                    DgvRecords.BackgroundColor     = Color.LightCoral;
                    DgvRecords.DefaultCellStyle.SelectionBackColor     = Color.Red;
                    DgvRecords.DefaultCellStyle.SelectionForeColor     = Color.Yellow;
                    DgvRecords.ColumnHeadersDefaultCellStyle.BackColor = Color.Black;
                    DgvRecords.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
                    DgvRecords.DefaultCellStyle.WrapMode                 = DataGridViewTriState.True;
                    DgvRecords.SelectionMode                             = DataGridViewSelectionMode.FullRowSelect;
                    DgvRecords.AllowUserToResizeColumns                  = false;
                    DgvRecords.AutoSizeColumnsMode                       = DataGridViewAutoSizeColumnsMode.Fill;
                    DgvRecords.RowsDefaultCellStyle.BackColor            = Color.LightSkyBlue;
                    DgvRecords.AlternatingRowsDefaultCellStyle.BackColor = Color.LightYellow;
                    DgvRecords.Columns[0].HeaderText                     = "Stock Code";
                    DgvRecords.Columns[1].HeaderText                     = "Current Qty";
                    DgvRecords.Columns[2].HeaderText                     = "Transfer Qty";
                }
            }
        }
        private void LoadData()
        {
            int ShopReturnID = Convert.ToInt32(txtReturnID.Text.TrimEnd());

            using (SqlConnection conn = new SqlConnection())
            {
                conn.ConnectionString = clsUtils.GetConnString(1);
                conn.Open();
                DataTable      ShopReturnHead        = new DataTable();
                SqlDataAdapter ShopReturnDataAdapter = new SqlDataAdapter();
                using (SqlCommand SelectCmd = new SqlCommand())
                {
                    SelectCmd.Connection  = conn;
                    SelectCmd.CommandText = "SELECT * from tblShopReturns WHERE ShopReturnsID = @ShopReturnsID";
                    SelectCmd.Parameters.AddWithValue("@ShopReturnsID", ShopReturnID);
                    ShopReturnDataAdapter.SelectCommand = SelectCmd;
                    ShopReturnDataAdapter.Fill(ShopReturnHead);
                }
                txtShopRef.Text = ShopReturnHead.Rows[0][1].ToString();
                clsShop Shop = new clsShop();
                Shop.ShopRef         = txtShopRef.Text;
                txtShopName.Text     = Shop.GetShopName();
                txtWarehouseRef.Text = ShopReturnHead.Rows[0][2].ToString();
                clsWarehouse warehouse = new clsWarehouse(0);
                warehouse.WarehouseRef = txtWarehouseRef.Text.TrimEnd();
                txtWarehouseName.Text  = warehouse.GetWarehouseName();
                txtReference.Text      = ShopReturnHead.Rows[0][3].ToString();
                txtTotalItems.Text     = ShopReturnHead.Rows[0][4].ToString();
                DtpDate.Value          = Convert.ToDateTime(ShopReturnHead.Rows[0][5]);
                oldDate = DtpDate.Value;
            }
            DgvRecords.Columns.Clear();
            using (SqlConnection conn = new SqlConnection())
            {
                conn.ConnectionString = clsUtils.GetConnString(1);
                conn.Open();
                DataTable      ShopReturnLine            = new DataTable();
                SqlDataAdapter ShopReturnLineDataAdapter = new SqlDataAdapter();
                using (SqlCommand SelectCmd = new SqlCommand())
                {
                    SelectCmd.Connection  = conn;
                    SelectCmd.CommandText = "SELECT StockCode,Qty from tblShopReturnLines WHERE ShopReturnID = @ShopReturnID";
                    SelectCmd.Parameters.AddWithValue("@ShopReturnID", ShopReturnID);
                    ShopReturnLineDataAdapter.SelectCommand = SelectCmd;
                    ShopReturnLineDataAdapter.Fill(ShopReturnLine);
                    DgvRecords.DataSource          = ShopReturnLine;
                    DgvRecords.AutoGenerateColumns = true;
                    DgvRecords.CellBorderStyle     = DataGridViewCellBorderStyle.None;
                    DgvRecords.BackgroundColor     = Color.LightCoral;
                    DgvRecords.DefaultCellStyle.SelectionBackColor     = Color.Red;
                    DgvRecords.DefaultCellStyle.SelectionForeColor     = Color.Yellow;
                    DgvRecords.ColumnHeadersDefaultCellStyle.BackColor = Color.Black;
                    DgvRecords.ColumnHeadersDefaultCellStyle.ForeColor = Color.White;
                    DgvRecords.DefaultCellStyle.WrapMode                 = DataGridViewTriState.True;
                    DgvRecords.SelectionMode                             = DataGridViewSelectionMode.FullRowSelect;
                    DgvRecords.AllowUserToResizeColumns                  = false;
                    DgvRecords.AutoSizeColumnsMode                       = DataGridViewAutoSizeColumnsMode.Fill;
                    DgvRecords.RowsDefaultCellStyle.BackColor            = Color.LightSkyBlue;
                    DgvRecords.AlternatingRowsDefaultCellStyle.BackColor = Color.LightYellow;
                    DgvRecords.Columns[0].HeaderText                     = "Stock Code";
                    DgvRecords.Columns[1].HeaderText                     = "Qty";
                }
                Totals();
            }
        }