示例#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 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();
         }
     }
 }
示例#3
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.RowHeader)
         {
             this.contextMenuLineCopyPaste.Show(this.tblwkladderDataGridView, new Point(e.X, e.Y));
         }
     }
 }
示例#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));
         }
     }
 }