private void Preisberechen(object sender, KeyPressEventArgs e)
{
if (e.KeyChar == (Char)Keys.Enter)
{
if (weiter == "1")
{
myMenge = Convert.ToInt16(txtMenge.Text);
myRabatt = Convert.ToInt16(txtRabatt.Text);
myEPreis = Convert.ToDecimal(txtEPreis.Text);
// Gesamtpreis Artikel
myGesPreis = myMenge * myEPreis;
myProzent = (myGesPreis / 100) * myRabatt;
myGesSum = myGesPreis - myProzent;
txtRBSum.Text = String.Format("{0:c}", myProzent);
txtGesPreis.Text = String.Format("{0:c}", myGesSum);
// MwSt berechnen
myMwSt = (myGesPreis / 100) * MwSt;
myZwSum = myGesPreis;
txtZWSumme.Text = String.Format("{0:c}", myGesSum);
txtMwSt.Text = String.Format("{0:c}", myMwSt);
//Endpreis
myEndPreis = myGesPreis + myMwSt;
txtEndPreis.Text = String.Format("{0:c}", myEndPreis);
//strSQL Insert-Datem
strSQL = "insert into Rechnung (jahr, kdnr, renr, lfnr, artnr, bestnr, liefDatum, redatum, menge, epreis) values ( " + myNJahr + ", '" + txtKdNr.Text + "', '" + txtReNr.Text + "', '" + txtLfNr.Text + "', ";
strSQL += " '" + txtArtNr.Text + "', '" + txtBestNr.Text + "', '" + txtLfDatum.Text + "', '" + lblReDatum.Text + "',";
strSQL += " " + myMenge + ", " + myEPreis + ")";
txtEPreis2.Focus();
weiter = "2";
}