تقييم الموضوع :
  • 0 أصوات - بمعدل 0
  • 1
  • 2
  • 3
  • 4
  • 5
اظهار 3 ارقام بعد العلامة العشرية
#3
كود :
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 أرقام


الملفات المرفقة صورة/صور
   
الرد }}}
تم الشكر بواسطة: حريف برمجة , 3booody , 3booody


الردود في هذا الموضوع
RE: اظهار 3 ارقام بعد العلامة العشرية - بواسطة ahmedramzyaish - 23-11-19, 10:59 PM


التنقل السريع :


يقوم بقرائة الموضوع: