05-01-23, 07:23 PM
السلام عليكم عندما اقوم بعملية حفظ تظهر رسالة تاليه في صوره
هدا كود الحفظ
هدا كود الحفظ
PHP كود :
Try
If labell.Text = "" Then
MessageBox.Show("الرجاء ادخال اسم المنتج", "رساله تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
labell.Select()
Exit Sub
End If
If Qty.Text = "" Then
MessageBox.Show("الرجاء ادخال الكمية", "رساله تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Asterisk)
Qty.Select()
Exit Sub
End If
If Val(TKLFA.Text) > Val(Price.Text) Then
MessageBox.Show("سعر التكلفة اكبر من سعر البيع", "رساله تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
If Val(TKLFA.Text) = Val(Price.Text) Then
MessageBox.Show("سعر تكلفة يساوي سعر البيع", "رساله تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Error)
Exit Sub
End If
Dim DT As New DataTable
Dim DA As New SqlDataAdapter("select *from products where label= '" & labell.Text & "'", Module1.con)
DA.Fill(DT)
If DT.Rows.Count > 0 Then
MessageBox.Show("الصنف موجود مسبقا يرجي التاكد", "رساله تنبيه", MessageBoxButtons.OK, MessageBoxIcon.Exclamation)
Else
Dim DR = DT.NewRow
DR!product_code = product_code.Text
DR!label = labell.Text
DR!label_product = label_product.Text
DR!unit = UNIT.Text
DR!date = DateTimePicker1.Value
DR!qty = Val(Qty.Text)
DR!tklfa = Val(TKLFA.Text)
DR!price = Val(Price.Text)
DR!total = Val(Qty.Text) * Val(Price.Text)
DT.Rows.Add(DR)
Dim SAVE As New SqlCommandBuilder(DA)
DA.Update(DT)
MessageBox.Show("تم حفظ الصنف بنجاح", "رساله تاكيد", MessageBoxButtons.OK, MessageBoxIcon.Information)
End If
cl()
Btn_del.Enabled = False
Btn_edit.Enabled = False
Btn_save.Enabled = True
Button3_Click(sender, e)
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try