23-11-19, 09:21 PM
23-11-19, 10:40 PM
[ تمّ الحل ] : إظهار التاريخ من اليمين إلى اليسار على الداتا جريد فيو
PHP كود :
Private Sub DGV_STUDENT_CellFormatting(sender As Object, e As DataGridViewCellFormattingEventArgs) Handles DGV_STUDENT.CellFormatting
If e.ColumnIndex = 0 Then
If e.RowIndex = DGV_STUDENT.Rows.Count - 1 Then Exit Sub
e.Value = CDbl(e.Value)
e.CellStyle.Format = "0.00"
End If
End Sub
23-11-19, 10:59 PM
كود :
Private Sub CalcTot()
Dim totpurch As Double = 0
Dim totsale As Double = 0
Dim totquan As Double = 0
Dim totpurchafterdisc As Double = 0
Dim totsaleafterdisc As Double = 0
Dim totdiff As Double = 0
Dim sumtax As Double = 0
Dim sumdiscount As Double = 0
For i = 0 To dgvItems.Rows.Count - 1
Dim dgvCellProc As DataGridViewComboBoxCell = CType(dgvItems.Rows(i).Cells(1), DataGridViewCell)
If dgvCellProc.Value = "شراء" Then
totpurch += Convert.ToDouble(dgvItems.Rows(i).Cells(8).Value)
totpurchafterdisc += Convert.ToDouble(dgvItems.Rows(i).Cells(13).Value)
Else
totsale += Convert.ToDouble(dgvItems.Rows(i).Cells(8).Value)
totsaleafterdisc += Convert.ToDouble(dgvItems.Rows(i).Cells(13).Value)
End If
totquan += Convert.ToDouble(dgvItems.Rows(i).Cells(4).Value)
sumdiscount += Convert.ToDouble(dgvItems.Rows(i).Cells(11).Value)
sumtax += Convert.ToDouble(dgvItems.Rows(i).Cells(15).Value)
Next
If totpurch <> 0 Then
totdiff = totpurch - totsale
Else
totdiff = totsale
End If
txtTotQuan.Text = "" & totquan
txtTotPurch.Text = String.Format("{0:0.#,##.##}", totpurch)
txtTotSale.Text = String.Format("{0:0.#,##.##}", totsale)
txtDiff.Text = String.Format("{0:0.#,##.##}", totdiff)
txtMinusVal.Text = "" & sumdiscount
If InvProc = 1 Then
txtTotAfterDisc.Text = String.Format("{0:0.#,##.##}", totpurchafterdisc)
Else
txtTotAfterDisc.Text = String.Format("{0:0.#,##.##}", totsaleafterdisc)
End If
If InvProc = 1 Then
'Dim _val As Double = Math.Round((Val(txtTax.Text) / 100) * Convert.ToDouble(txtTotPurch.Text), 2)
Dim _val As Double = "" & sumtax
lblTaxVal.Text = "" & _val
txtDiff.Text = Convert.ToDouble(txtTotPurch.Text) + _val - Val(txtMinusVal.Text)
Else
'Dim _val As Double = Math.Round((Val(txtTax.Text) / 100) * Convert.ToDouble(txtTotSale.Text), 2)
Dim _val As Double = "" & sumtax
lblTaxVal.Text = "" & _val
txtDiff.Text = Convert.ToDouble(txtTotSale.Text) + _val - Val(txtMinusVal.Text)
End If
End Sub(23-11-19, 10:59 PM)ahmedramzyaish كتب : [ -> ]كود :
Private Sub CalcTot()
Dim totpurch As Double = 0
Dim totsale As Double = 0
Dim totquan As Double = 0
Dim totpurchafterdisc As Double = 0
Dim totsaleafterdisc As Double = 0
Dim totdiff As Double = 0
Dim sumtax As Double = 0
Dim sumdiscount As Double = 0
For i = 0 To dgvItems.Rows.Count - 1
Dim dgvCellProc As DataGridViewComboBoxCell = CType(dgvItems.Rows(i).Cells(1), DataGridViewCell)
If dgvCellProc.Value = "شراء" Then
totpurch += Convert.ToDouble(dgvItems.Rows(i).Cells(8).Value)
totpurchafterdisc += Convert.ToDouble(dgvItems.Rows(i).Cells(13).Value)
Else
totsale += Convert.ToDouble(dgvItems.Rows(i).Cells(8).Value)
totsaleafterdisc += Convert.ToDouble(dgvItems.Rows(i).Cells(13).Value)
End If
totquan += Convert.ToDouble(dgvItems.Rows(i).Cells(4).Value)
sumdiscount += Convert.ToDouble(dgvItems.Rows(i).Cells(11).Value)
sumtax += Convert.ToDouble(dgvItems.Rows(i).Cells(15).Value)
Next
If totpurch <> 0 Then
totdiff = totpurch - totsale
Else
totdiff = totsale
End If
txtTotQuan.Text = "" & totquan
txtTotPurch.Text = String.Format("{0:0.#,##.##}", totpurch)
txtTotSale.Text = String.Format("{0:0.#,##.##}", totsale)
txtDiff.Text = String.Format("{0:0.#,##.##}", totdiff)
txtMinusVal.Text = "" & sumdiscount
If InvProc = 1 Then
txtTotAfterDisc.Text = String.Format("{0:0.#,##.##}", totpurchafterdisc)
Else
txtTotAfterDisc.Text = String.Format("{0:0.#,##.##}", totsaleafterdisc)
End If
If InvProc = 1 Then
'Dim _val As Double = Math.Round((Val(txtTax.Text) / 100) * Convert.ToDouble(txtTotPurch.Text), 2)
Dim _val As Double = "" & sumtax
lblTaxVal.Text = "" & _val
txtDiff.Text = Convert.ToDouble(txtTotPurch.Text) + _val - Val(txtMinusVal.Text)
Else
'Dim _val As Double = Math.Round((Val(txtTax.Text) / 100) * Convert.ToDouble(txtTotSale.Text), 2)
Dim _val As Double = "" & sumtax
lblTaxVal.Text = "" & _val
txtDiff.Text = Convert.ToDouble(txtTotSale.Text) + _val - Val(txtMinusVal.Text)
End If
End Sub
المطلوب اظهار القيم فى اجمالى المستند بعد العلامة العشرية 3 أرقام
24-11-19, 03:24 PM
PHP كود :
Txt_Form_Name.Text = Format(10.2, "0.000")
26-11-19, 03:00 AM
هل يمكن التطبيق على الداتا جريد وكيفية نعديل الكود التالى
كما تعديل الكود التالى ايضا
لانى عندما عدلت كما موضح باشرح لم ينجح معى
مع العلم انه المطلوب اظهار الرقم 2.200 وليس 2.2 او 2.20
للتعامل مع الدينار الكويتى
اى رقم يظهر يجب ان يكون بعد العلامة يكون 3 ارقام دائما
حتى ولو 1.1 يكون 1.100
وشكراااا
كود :
dgvItems.Rows(_rowinx).Cells(7).Value = String.Format("{0:0.#,##.##}", Convert.ToDouble(dt1.Rows(0)("sale_price")))كود :
txtTotSale.Text = String.Format("{0:0.#,##.##}", totsale)مع العلم انه المطلوب اظهار الرقم 2.200 وليس 2.2 او 2.20
للتعامل مع الدينار الكويتى
اى رقم يظهر يجب ان يكون بعد العلامة يكون 3 ارقام دائما
حتى ولو 1.1 يكون 1.100
وشكراااا
26-11-19, 02:53 PM
PHP كود :
Txt_Form_Name.Text = Format(totsale, "0.000")
26-11-19, 04:51 PM
26-11-19, 09:12 PM
(26-11-19, 04:51 PM)asemshahen5 كتب : [ -> ]هذا مثال عن تنسيق التكست بوكس و الداتاغريد فيو :
الكود على فورم 2
27-11-19, 09:11 AM
اختصارا لكل الاكواد دى
خلى حقل الرقم decimal
هى افتراضى decimal(18, 0)
هتخليه decimal(18, 3)
خلى حقل الرقم decimal
هى افتراضى decimal(18, 0)
هتخليه decimal(18, 3)