Answer the question
In order to leave comments, you need to log in
Why doesn't it count?
why is this request not getting a price?
private void button1_Click(object sender, EventArgs e)
{
string ConnectionString = @"Data Source=" + sPath + ";New=False;Version=3";
// находим максимальное значение кода проводок для записи первичного ключа
String mValue = "select MAX(idhurnProv) from ZhurnProvodok";
object maxValue = selectValue(ConnectionString, mValue);
if (Convert.ToString(maxValue) == "")
maxValue = 0;
// Обнулить значения переменных
string sum = "0";
string count = "0";
string Value1 = null;
string Value2 = null;
string Value3 = null;
if (comboBox1.Text != "")
{
//ОС
Value1 = comboBox1.SelectedValue.ToString();
}
if (comboBox2.Text != "")
{
//Подразделение
Value2 = comboBox2.SelectedValue.ToString();
}
if (comboBox3.Text != "")
{
//МОЛ
Value3 = comboBox3.SelectedValue.ToString();
}
ConnectionString = @"Data Source=" + sPath + ";New=False;Version=3";
// находим максимальное значение кода проводок для записи первичного ключа
mValue = "select MAX(idhurnProv) from ZhurnProvodok";
maxValue = selectValue(ConnectionString, mValue);
if (Convert.ToString(maxValue) == "")
maxValue = 0;
// Обнулить значения переменных
sum = "0";
count = "0";
Value1 = null;
Value2 = null;
Value3 = null;
if (comboBox1.Text != "")
{
//ОС
Value1 = comboBox1.SelectedValue.ToString();
}
if (comboBox2.Text != "")
{
//Подразделение
Value2 = comboBox2.SelectedValue.ToString();
}
if (comboBox3.Text != "")
{
//МОЛ
Value3 = comboBox3.SelectedValue.ToString();
}
//Поле количество
if (textBox2.Text != "")
{
count = textBox2.Text;
}
//Поиск по базе данных значений
String selectCost = "select Cena from Mater where IdMat ='" + Value1 + "'";
double Summa = Convert.ToDouble(selectCost) * Convert.ToDouble(count);
String selectDT = "select idPlSch from planSchetov where schet = '''10'''";
object DT = selectValue(ConnectionString, selectDT);
String selectKT = "select idPlSch from planSchetov where schet = '''60'''";
object KT = selectValue(ConnectionString, selectKT);
string add = "INSERT INTO ZhurnProvodok (idhurnProv, date, DB, "
+ "subDB1, subDB2, subDB3, KR, kolVO, sum, vidOper) VALUES(" + (Convert.ToInt32(maxValue) + 1)
+ dateTimePicker1.Text + "'," + DT.ToString() + "," + Convert.ToInt32(Value1)
+ "," + Convert.ToInt32(Value2) + "," + Convert.ToInt32(Value3) + ","
+ KT.ToString() + "," + Convert.ToDouble(count) + "," + Summa + ", "
+ Convert.ToInt32(textBox1.Text) + ", " + ",'Поступление материалов','" + ")";
ExecuteQuery(add);
selectTable(ConnectionString);
}
Answer the question
In order to leave comments, you need to log in
String selectCost = "select Cena from Mater where IdMat ='" + Value1 + "'";
double Summa = Convert.ToDouble(selectCost) * Convert.ToDouble(count);
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question