This commit is contained in:
2019-10-16 19:29:52 -07:00

View File

@@ -801,7 +801,9 @@ Partial Class General_SaldosIniciales
ObjClientes.IniciaTransacSQL()
For Each Row As DataRow In dt.FiltraParametros("RFC <> ''").Rows
NumRow = NumRow + 1
NumRow = NumRow + 1
Dim Codigo As String = Row("Codigo").ToString
Dim RazonSocial As String = Row("RazonSocial").ToString
Dim RFC As String = Row("RFC").ToString.Trim
@@ -812,36 +814,148 @@ Partial Class General_SaldosIniciales
Dim Poblacion As String = Row("Población").ToString
Dim Estado As String = Row("Estado").ToString
Dim Pais As String = Row("Pais").ToString
Dim Telefono As String = Row("Teléfono").ToString
Dim Contacto As String = Row("Contacto").ToString
Dim CelularContacto As String = Row("Celular Contacto").ToString
Dim Telefono As String = Row("Teléfono").ToString.Replace("-", "").Replace(" ", "").Replace("(", "").Replace(")", "")
Dim Contacto As String = Row("Contacto").ToString
Dim Vendedor As String = Row("Vendedor").ToString
Dim Clasificacion As String = Row("Clasificación").ToString
Dim CveCliente As Integer = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveCliente", $"RFC = '{RFC}'").ToString.ToEntero
Dim CveVendedor As Integer = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveVendedor", $"Vendedor = '{Vendedor}'").ToString.ToEntero
Dim CveClasificación As Integer = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveClasificacion", $"Clasificacion = '{Clasificacion}'").ToString.ToEntero
Dim EsDistribuidor As Boolean = If(Row("Es distribuidor").ToString = "si", True, False)
Dim CargoUsado As Boolean = If(Row("CargoUsado").ToString = "si", True, False)
Dim BonificacionUsado As Boolean = If(Row("BonificacionUsado").ToString = "si", True, False)
Dim EsDistribuidor As Boolean = If(Row("Es distribuidor").ToString.ToUpper = "SI", True, False)
Dim CargoUsado As Boolean = If(Row("Cargo Usados").ToString.ToUpper = "SI", True, False)
Dim BonificacionUsado As Boolean = If(Row("EmitirBon Usado").ToString.ToUpper = "SI", True, False)
Dim LimiteCredito As Decimal = Row("Limite Credito").ToString.ToDecimal
Dim CobranzaCorreo As String = Row("CorreoPago").ToString
Dim PlazoCobranza As Integer = Row("Plazo Cobranza").ToString.ToEntero
Dim DìaVisita As String = Row("Dia Pago").ToString
Dim DiasPagoEspecifico As String = Row("Dìa Visita").ToString
Dim CobranzaContacto As String = Row("Encargado Pago").ToString
Dim CobranzaTelefono As String = Row("Celular Contacto").ToString.Replace("-", "").Replace(" ", "").Replace("(", "").Replace(")", "")
' CobranzaContacto = Regex.Replace(CobranzaContacto, "[^0-9]", "")
'Telefono
If Telefono.Trim.Length > 10 Then
Telefono = ""
End If
If CobranzaTelefono.Trim.Length > 10 Then
CobranzaTelefono = ""
End If
Dim FormaPago As String = Row("Forma Pago").ToString
Dim CveFormaPago33 As Integer = 99
Select Case FormaPago
Case "01"
CveFormaPago33 = 1
Exit Select
Case "02"
CveFormaPago33 = 2
Exit Select
Case "03"
CveFormaPago33 = 3
Exit Select
Case "04"
CveFormaPago33 = 4
Exit Select
Case "05"
CveFormaPago33 = 5
Exit Select
Case "06"
CveFormaPago33 = 6
Exit Select
Case "08"
CveFormaPago33 = 7
Exit Select
Case "12"
CveFormaPago33 = 8
Exit Select
Case "13"
CveFormaPago33 = 9
Exit Select
Case "14"
CveFormaPago33 = 10
Exit Select
Case "15"
CveFormaPago33 = 11
Exit Select
Case "17"
CveFormaPago33 = 12
Exit Select
Case "23"
CveFormaPago33 = 13
Exit Select
Case "24"
CveFormaPago33 = 14
Exit Select
Case "25"
CveFormaPago33 = 15
Exit Select
Case "26"
CveFormaPago33 = 16
Exit Select
Case "27"
CveFormaPago33 = 17
Exit Select
Case "28"
CveFormaPago33 = 18
Exit Select
Case "29"
CveFormaPago33 = 19
Exit Select
Case "99"
CveFormaPago33 = 20
Exit Select
Case "30"
CveFormaPago33 = 21
Exit Select
Case "31"
CveFormaPago33 = 22
Exit Select
Case Else
CveFormaPago33 = 99
End Select
'Dim RazonSocial As String = Row("RazonSocial").ToString
'Contacto
If CveCliente > 0 Then
ExisteCliente = True
Contador = Contador + 1
'If Not ObjClientes.UpdateCliente(RazonSocial, RazonSocial, Calle, "", "", Colonia, "", "", Estado, RFC, CodigoPostal, "", "", Contacto, "", "", "", "", -1, False, 1, -1, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", -1, -1, -1,
' "-1", -1, -1, -1, -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", "", 0, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, 0, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", "", False, -1) Then
' ErrorClientes = True
' RFC.GuardaLog
' Exit For
'End If
Contador = Contador + 1
'If Not ObjClientes.UpdateCliente(RazonSocial, RazonSocial, Calle, "", "", Colonia, "", "", Estado, RFC, CodigoPostal, "", "", Contacto, "", "", "", "", -1, False, 1, -1, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", -1, -1, -1,
' "-1", -1, -1, -1, -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", "", 0, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, 0, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", "", False, -1) Then
' ErrorClientes = True
' RFC.GuardaLog
' Exit For
'End If
Else
If Not ObjClientes.AddCliente(RazonSocial, RazonSocial, Calle, "", "", Colonia, "", "", Estado, Pais, RFC, CodigoPostal, "", "", Contacto, "", "", "", "", -1, False, 0, 0, False, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", CveVendedor, -1, -1,
"-1", "-1", -1, "-1", -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", Codigo, 0, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, 0, -1, EsDistribuidor:=EsDistribuidor, CveClienteClasificacion:=CveClasificación, CargoUsado:=CargoUsado, BonificacionUsado:=BonificacionUsado) Then
If Not ObjClientes.AddCliente(RazonSocial, RazonSocial, Calle, NumExt.ToString, "", Colonia, Poblacion, Poblacion, Estado, Pais, RFC, CodigoPostal, Telefono, Contacto, "", "", "", "", "", -1, False, 0, 0, False, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, "", CveVendedor, PlazoCobranza, -1,
"-1", "-1", -1, "-1", -1, "0", -1, "0", 0, "", 0, "", 0, "", 0, "", "", "", Codigo, LimiteCredito, "", 1, False, "", "", "", False, "", "", "", "", "", False, "", "", "", False, 0, -1, EsDistribuidor:=EsDistribuidor, CveClienteClasificacion:=CveClasificación, CargoUsado:=CargoUsado,
BonificacionUsado:=BonificacionUsado, CobranzaContacto:=CobranzaContacto, CobranzaCorreo:=CobranzaCorreo, DiasEspecifico:=DiasPagoEspecifico, DiasRevision:=DìaVisita, CobranzaTelefono:=CobranzaTelefono, CveFormaPago33:=CveFormaPago33) Then
ErrorClientes = True
RFC.GuardaLog
Exit For
End If
End If
Next
@@ -1713,7 +1827,7 @@ Partial Class General_SaldosIniciales
If firstRowHasHeaders Then
If worksheet.Rows(0).Cells(cols).Value IsNot Nothing Then
dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString())
dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString().Trim)
Else
dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed)))
End If
@@ -1722,9 +1836,11 @@ Partial Class General_SaldosIniciales
Else
dataTable.Columns.Add("Column " & (cols + 1))
End If
Next
While curRow < worksheet.Rows.Count
While curRow < worksheet.Rows.Count
columns = New String(cols - 1) {}
For curCol = 0 To cols - 1
@@ -1734,13 +1850,16 @@ Partial Class General_SaldosIniciales
Else
columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString()
End If
Next
dataTable.Rows.Add(columns)
curRow += 1
End While
Return dataTable
End Function
End Class