private void Copy2NyFakturaToolStripButton_Click(object sender, EventArgs e) { bool bVareforbrug = true; Tblactebisfaktura recActebisfaktura = tblactebisfakturaBindingSource.Current as Tblactebisfaktura; if (recActebisfaktura.Leveringsadresse.ToUpper().Contains("HAFSJOLD")) { DialogResult result = DotNetPerls.BetterDialog.ShowDialog( "TransSumma", //titleString " JA: Dette er en Hafsjold Data ApS anskaffelse.\nNEJ: Dette et vareforbrug.", //bigString null, //smallString "JA", //leftButton == OK "NEJ", //rightButton == Cancel global::nsPuls3060.Properties.Resources.Message_info); //iconSet if (result == DialogResult.OK) { bVareforbrug = false; } } Tblwfak recWfak = new Tblwfak { Sk = "K", Dato = recActebisfaktura.Ordredato, Konto = 200064, Kreditorbilagsnr = recActebisfaktura.Fakturanr }; foreach (Tblactebisordre recActebisordre in recActebisfaktura.Tblactebisordre) { Tblwfaklin recWfaklin = new Tblwfaklin { Antal = recActebisordre.Antal, Enhed = "stk", Pris = recActebisordre.Stkpris, Varenr = recActebisordre.Varenr.ToString(), Nettobelob = recActebisordre.Antal * recActebisordre.Stkpris, Tekst = getVaretekst(recActebisfaktura, recActebisordre, bVareforbrug), Konto = getVarenrKonto(recActebisordre.Varenr, bVareforbrug), Momskode = KarKontoplan.getMomskode(getVarenrKonto(recActebisordre.Varenr, bVareforbrug)) }; recWfak.Tblwfaklin.Add(recWfaklin); } FrmMain frmMain = this.ParentForm as FrmMain; try { FrmNyfaktura frmNyfaktura = frmMain.GetChild("Ny faktura") as FrmNyfaktura; frmNyfaktura.AddNyActebisFaktura(recWfak); } catch { Program.dbDataTransSumma.Tblwfak.InsertOnSubmit(recWfak); Program.dbDataTransSumma.SubmitChanges(); } }
private void nyFakturaToolStripMenuItem1_Click(object sender, EventArgs e) { if (!FocusChild("Ny faktura")) { FrmNyfaktura m_Nyfaktura = new FrmNyfaktura(); m_Nyfaktura.MdiParent = this; m_Nyfaktura.Show(); } }
private void cmdKopier_Click(object sender, EventArgs e) { FrmMain frmMain = this.ParentForm as FrmMain; try { FrmNyfaktura frmNyfaktura = frmMain.GetChild("Ny faktura") as FrmNyfaktura; Tblfak recFak = this.tblfakBindingSource.Current as Tblfak; frmNyfaktura.AddNyFaktura(recFak); } catch { } }