Está en la página 1de 2

Private Sub DRAW_MY_GRID()

'~~~~~~~~~~~~~~~~ LO QUE COLOREAREMOS ~~~~~~~~~~~~~~~'


'PRODUCTO
'SERVICIO
'VENTA DIRECTA
'ETIQUETAS
'~~~~~~~~~~~~~~~ CAMPOS QUE NOS AYUDARA A DETERMINAR EL COLOR ~~~~~~~~~~
~~~~~'
'CANTIDAD
'PRODUCTO
'DESCRIPCION
'PRECIO

Column1
Column2
Column4
Column7

'~~~~~~~~~~~~~~~ REQUERIMIENTOS DE LOS CAMPOS QUE ASOCIARE ~~~~~~~~~~~~~


~~'
'PRODUCTO
--> NECESITA QUE
'SERVICIO
--> NECESITA QUE
'VENTA DIRECTA --> NECESITA QUE
CTO) Y NOT ISNULLOREMPTY(DESCRIPCION) Y
'ETIQUETAS
--> NECESITA QUE
CTO) Y NOT ISNULLOREMPTY(DESCRIPCION) Y

LA CANTIDAD >
LA CANTIDAD >
LA CANTIDAD >
PRECIO > 0.00
LA CANTIDAD =
PRECIO = 0.00

0 Y EL PRODUCTO <> "S-"


0 Y EL PRODUCTO = "S-"
0 Y EL ISNULLOREMPTY(PRODU
0 Y EL ISNULLOREMPTY(PRODU

If Me.grdDetalle.Rows.Count > 0 Then


Dim Fanterior As String = "NO", colorsito As Integer = 1
For Each fila As DataGridViewRow In grdDetalle.Rows
If fila.Cells("Column1").Value = 0 Then 'SI LA CANTIDAD ES 0
'ETIQUETAS
--> NECESITA QUE LA CANTIDAD = 0 Y EL ISNULLO
REMPTY(PRODUCTO) Y NOT ISNULLOREMPTY(DESCRIPCION) Y PRECIO = 0.00
If String.IsNullOrEmpty(fila.Cells("Column2").Value) And Not
(String.IsNullOrEmpty(fila.Cells("Column4").Value)) Then
If Fanterior = "ETIQUETA" And colorsito = 1 Then
colorsito = 2
fila.DefaultCellStyle.BackColor = Color.FromArgb(243
, 252, 234)
Else
colorsito = 1
fila.DefaultCellStyle.BackColor = Color.FromArgb(237
, 249, 227)
End If
Fanterior = "ETIQUETA"
End If
ElseIf fila.Cells("Column1").Value <> 0 Then ' SI LA CANTIDAD >
0
'VENTA DIRECTA --> NECESITA QUE LA CANTIDAD > 0 Y EL ISNULLO
REMPTY(PRODUCTO) Y NOT ISNULLOREMPTY(DESCRIPCION) Y PRECIO > 0.00
If String.IsNullOrEmpty(fila.Cells("Column2").Value) And Not
(String.IsNullOrEmpty(fila.Cells("Column4").Value)) Then
If Fanterior = "VENTA DIRECTA" And colorsito = 1 Then
colorsito = 2
fila.DefaultCellStyle.BackColor = Color.FromArgb(254
, 216, 214)
Else
colorsito = 1
fila.DefaultCellStyle.BackColor = Color.FromArgb(254
, 204, 202)
End If
Fanterior = "VENTA DIRECTA"

'SERVICIO

--> NECESITA QUE LA CANTIDAD > 0 Y EL PRO

DUCTO = "S-"
ElseIf fila.Cells("Column2").Value.ToString.Substring(0, 2)
= "S-" Then
If Fanterior = "SERVICIO" And colorsito = 1 Then
colorsito = 2
fila.DefaultCellStyle.BackColor = Color.FromArgb(197
, 232, 237)
Else
colorsito = 2
fila.DefaultCellStyle.BackColor = Color.FromArgb(176
, 224, 230)
End If
Fanterior = "SERVICIO"
'PRODUCTO
--> NECESITA QUE LA CANTIDAD > 0 Y EL PRO
DUCTO <> "S-"
ElseIf fila.Cells("Column2").Value.ToString.Substring(0, 2)
<> "S-" Then
fila.DefaultCellStyle.BackColor = Color.FromArgb(255, 25
5, 255)
End If
End If
Next
End If

También podría gustarte