Пример #1
0
 private void kontoTextBox_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         Point     startPoint = kontoTextBox.PointToScreen(new Point(e.X, e.Y));
         KontoType ktp        = KontoType.None;
         if (skComboBox.Text == "K")
         {
             ktp = KontoType.Kreditor;
         }
         if (skComboBox.Text == "S")
         {
             ktp = KontoType.Debitor;
         }
         FrmKontoplanList m_frmKontoplanList = new FrmKontoplanList(startPoint, ktp);
         m_frmKontoplanList.ShowDialog();
         int?selectedKontonr = m_frmKontoplanList.SelectedKontonr;
         m_frmKontoplanList.Close();
         if (selectedKontonr != null)
         {
             kontoTextBox.Focus();
             kontoTextBox.Text = selectedKontonr.ToString();
         }
     }
 }
Пример #2
0
        private void tblwkladderDataGridView_MouseDown(object sender, MouseEventArgs e)
        {
            if (e.Button == System.Windows.Forms.MouseButtons.Right)
            {
                DataGridView.HitTestInfo hit = tblwkladderDataGridView.HitTest(e.X, e.Y);
                int hitcol = hit.ColumnIndex;
                if (hit.Type == DataGridViewHitTestType.Cell && hit.ColumnIndex == 4)
                {
                    tblwkladderDataGridView.ClearSelection();
                    tblwkladderDataGridView.Rows[hit.RowIndex].Cells[hit.ColumnIndex].Selected = true;
                    this.contextMenuMoms.Show(this.tblwkladderDataGridView, new Point(e.X, e.Y));
                }
                else if (hit.Type == DataGridViewHitTestType.Cell && hit.ColumnIndex == 5)
                {
                    tblwkladderDataGridView.ClearSelection();
                    tblwkladderDataGridView.Rows[hit.RowIndex].Cells[hit.ColumnIndex].Selected = true;
                    Point            startPoint         = tblwkladderDataGridView.PointToScreen(new Point(e.X, e.Y));
                    FrmKontoplanList m_frmKontoplanList = new FrmKontoplanList(startPoint, KontoType.Drift | KontoType.Status | KontoType.Debitor | KontoType.Kreditor);
                    m_frmKontoplanList.ShowDialog();
                    int?   selectedKontonr  = m_frmKontoplanList.SelectedKontonr;
                    string selectedMomskode = m_frmKontoplanList.SelectedMomskode;
                    m_frmKontoplanList.Close();
                    if (selectedKontonr != null)
                    {
                        tblwkladder recWkladder = ((DataGridView)sender).Rows[hit.RowIndex].DataBoundItem as tblwkladder;
                        if (recWkladder != null)
                        {
                            recWkladder.konto    = selectedKontonr;
                            recWkladder.momskode = selectedMomskode;
                        }
                    }
                }
                else if (hit.Type == DataGridViewHitTestType.Cell && hit.ColumnIndex == 8)
                {
                    tblwkladderDataGridView.ClearSelection();
                    tblwkladderDataGridView.Rows[hit.RowIndex].Cells[hit.ColumnIndex].Selected = true;
                    Point      startPoint   = tblwkladderDataGridView.PointToScreen(new Point(e.X, e.Y));
                    FrmSagList m_frmSagList = new FrmSagList(startPoint);
                    m_frmSagList.ShowDialog();
                    int?selectedSagnr = m_frmSagList.SelectedSagnr;
                    m_frmSagList.Close();
                    if (selectedSagnr != null)
                    {
                        tblwkladder recWkladder = ((DataGridView)sender).Rows[hit.RowIndex].DataBoundItem as tblwkladder;
                        if (recWkladder != null)
                        {
                            recWkladder.sag = selectedSagnr;
                        }
                    }
                }

                else if (hit.Type == DataGridViewHitTestType.RowHeader)
                {
                    this.contextMenuLineCopyPaste.Show(this.tblwkladderDataGridView, new Point(e.X, e.Y));
                }
            }
        }
Пример #3
0
 private void kontonrTextBox_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         Point            startPoint         = kontonrTextBox.PointToScreen(new Point(e.X, e.Y));
         FrmKontoplanList m_frmKontoplanList = new FrmKontoplanList(startPoint, KontoType.Drift);
         m_frmKontoplanList.ShowDialog();
         int?selectedKontonr = m_frmKontoplanList.SelectedKontonr;
         m_frmKontoplanList.Close();
         if (selectedKontonr != null)
         {
             kontonrTextBox.Text = selectedKontonr.ToString();
         }
     }
 }
Пример #4
0
 private void tblwfaklinDataGridView1_MouseDown(object sender, MouseEventArgs e)
 {
     if (e.Button == System.Windows.Forms.MouseButtons.Right)
     {
         DataGridView.HitTestInfo hit = tblwfaklinDataGridView.HitTest(e.X, e.Y);
         int hitcol = hit.ColumnIndex;
         if (hit.Type == DataGridViewHitTestType.Cell && hit.ColumnIndex == 2)
         {
             tblwfaklinDataGridView.ClearSelection();
             DataGridViewCell cellVarenr = tblwfaklinDataGridView.Rows[hit.RowIndex].Cells[hit.ColumnIndex];
             cellVarenr.Selected = true;
             Point       startPoint    = tblwfaklinDataGridView.PointToScreen(new Point(e.X, e.Y));
             FrmVareList m_frmVareList = new FrmVareList(startPoint);
             m_frmVareList.ShowDialog();
             int?selectedVarenr = m_frmVareList.SelectedVarenr;
             m_frmVareList.Close();
             if (selectedVarenr != null)
             {
                 tblwfak    recWfak    = tblwfakBindingSource.Current as tblwfak;
                 tblwfaklin recWfaklin = ((DataGridView)sender).Rows[hit.RowIndex].DataBoundItem as tblwfaklin;
                 if (recWfaklin != null)
                 {
                     try
                     {
                         recVarer rec = (from k in Program.karVarer where k.Varenr == selectedVarenr select k).First();
                         recWfaklin.varenr = rec.Varenr.ToString();
                         recWfaklin.tekst  = rec.Varenavn;
                         recWfaklin.enhed  = rec.Enhed;
                         if (recWfak.sk == "S")
                         {
                             recWfaklin.konto    = rec.Salgskonto;
                             recWfaklin.momskode = KarKontoplan.getMomskode(rec.Salgskonto);
                             recWfaklin.pris     = rec.Salgspris;
                         }
                         if (recWfak.sk == "K")
                         {
                             recWfaklin.konto    = rec.Kobskonto;
                             recWfaklin.momskode = KarKontoplan.getMomskode(rec.Kobskonto);
                             recWfaklin.pris     = rec.Kobspris;
                         }
                     }
                     catch { }
                 }
             }
         }
         else if (hit.Type == DataGridViewHitTestType.Cell && hit.ColumnIndex == 4)
         {
             tblwfaklinDataGridView.ClearSelection();
             tblwfaklinDataGridView.Rows[hit.RowIndex].Cells[hit.ColumnIndex].Selected = true;
             Point            startPoint         = tblwfaklinDataGridView.PointToScreen(new Point(e.X, e.Y));
             FrmKontoplanList m_frmKontoplanList = new FrmKontoplanList(startPoint, KontoType.Drift | KontoType.Status);
             m_frmKontoplanList.ShowDialog();
             int?   selectedKontonr  = m_frmKontoplanList.SelectedKontonr;
             string selectedMomskode = m_frmKontoplanList.SelectedMomskode;
             m_frmKontoplanList.Close();
             if (selectedKontonr != null)
             {
                 tblwfaklin recWfaklin = ((DataGridView)sender).Rows[hit.RowIndex].DataBoundItem as tblwfaklin;
                 if (recWfaklin != null)
                 {
                     recWfaklin.konto    = selectedKontonr;
                     recWfaklin.momskode = selectedMomskode;
                 }
             }
         }
         else if (hit.Type == DataGridViewHitTestType.RowHeader)
         {
             this.contextMenuLineCopyPaste.Show(this.tblwfaklinDataGridView, new Point(e.X, e.Y));
         }
     }
 }