From d587f72ca634e8a30259bc0056a1c909959eec71 Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 4 May 2020 14:33:04 -0700 Subject: [PATCH 1/7] - mensaje de bloqueo --- Contabilidad/CatPeriodosBloqueo.aspx.vb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Contabilidad/CatPeriodosBloqueo.aspx.vb b/Contabilidad/CatPeriodosBloqueo.aspx.vb index 41dbb72f0..1b3707231 100644 --- a/Contabilidad/CatPeriodosBloqueo.aspx.vb +++ b/Contabilidad/CatPeriodosBloqueo.aspx.vb @@ -140,7 +140,7 @@ Partial Class Contabilidad_CatPeriodosBloqueo Alert("Bloqueo Actualizado Correctamente", TipoMensaje.MsgInformacion) Else Dim mensajeAlerta As String = AplicarBloqueso.Replace(";", Environment.NewLine) - Alert("Ocurrió un error al Actualizar el Periodo de Bloqueo " & Environment.NewLine & mensajeAlerta, TipoMensaje.MsgError) + Alert(String.Format("No se puede bloquear el periodo por:
{0} ", mensajeAlerta), TipoMensaje.MsgError) End If End If From e80335be56153e378a8713bf46c06c94302542d1 Mon Sep 17 00:00:00 2001 From: rrene Date: Mon, 4 May 2020 16:07:16 -0700 Subject: [PATCH 2/7] -- simplificacion prepoliza al aplicar NC posterior --- Ventas/Ventas.aspx.vb | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 861a5605a..1c08e740c 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -12583,7 +12583,14 @@ Partial Class Ventas ErrorConta = True End If - If ObjConta.ValidacionPrePolizaCuadre(CvePrepoliza, 3) Then + 'Simplificacion de PrePolizas + If Not ErrorConta AndAlso ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then + If Not ObjConta.PrePolizaSimplificacion(CvePrepoliza, UsuarioActual.CveEmpresa) Then + Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError) + End If + End If + + If Not ErrorConta AndAlso ObjConta.ValidacionPrePolizaCuadre(CvePrepoliza, 3) Then If ObjConta.ValorPolizaDescuadre > 0 Then GuardaLogAD($"Ventas/Ventas-Anticipos | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{CvePrepoliza}", "LogPrePolizas") ErrorConta = True From acf231d10cf5676e127856dea0d34c2788abada3 Mon Sep 17 00:00:00 2001 From: Jonathan Alexis Perez Morales Date: Wed, 13 May 2020 12:00:28 -0700 Subject: [PATCH 3/7] API KEY DE GOOGLE MAPS CENTRALIZADA --- App_Code/modExtensiones.vb | 28 +- GPS/Busqueda.aspx | 4 +- GPS/CatRemisionesVehiculos.aspx | 4 +- GPS/EntradasSalidasGR.aspx | 7 +- GPS/GeoReferencias.aspx | 7 +- GPS/GeoReferencias.aspx.vb | 3 +- GPS/PuntosDeInteres.aspx | 8 +- GPS/Rastreo.aspx | 4 +- GPS/Rastreo.aspx.vb | 2 +- GPS/RastreoTrayectos.aspx | 2 +- GPS/RepGeoReferencias.aspx | 291 +- GPS/RepPuntosDeInteres.aspx | 7 +- GPS/Shipments.aspx | 4 +- GPS/TrayectoDetalle.aspx | 4 +- GPS/Trayectos.aspx | 4 +- GPS/data.txt | 17504 ------------------------------ PortalGPS/InicioGPS.aspx | 8 +- 17 files changed, 177 insertions(+), 17714 deletions(-) delete mode 100644 GPS/data.txt diff --git a/App_Code/modExtensiones.vb b/App_Code/modExtensiones.vb index e9e3f36b6..7f7473927 100644 --- a/App_Code/modExtensiones.vb +++ b/App_Code/modExtensiones.vb @@ -29,12 +29,10 @@ Imports System.Web.Http.Controllers Imports System.Net.Http Imports System.Net -Namespace Extensiones - +Namespace Extensiones + #Region "E X T E N S I O N E S" Public Module ModExtensiones - - 'Public Const DirectorioBaseEmpresas As String = "C:\inetpub\" Public ReadOnly Property DirectorioBaseEmpresas As String Get If IsNothing(System.Configuration.ConfigurationManager.AppSettings("DirectorioBaseEmpresas")) Then @@ -44,13 +42,23 @@ Namespace Extensiones End If End Get End Property - Public ReadOnly DirectorioEmpresas As String = String.Format("{0}Empresas\", DirectorioBaseEmpresas) + Public ReadOnly DirectorioEmpresas As String = String.Format("{0}Empresas\", DirectorioBaseEmpresas) + + Public ReadOnly Property GOOGLE_MAPS_API_KEY As String + Get + If IsNothing(System.Configuration.ConfigurationManager.AppSettings("GOOGLE_MAPS_API_KEY")) Then + Return "" + Else + Return System.Configuration.ConfigurationManager.AppSettings("GOOGLE_MAPS_API_KEY").ToString() + End If + End Get + End Property Public Const IMEI As String = "IMEISISTEMAGERENCIAL" Public Const MinFecha As Date = #1/1/1900# Public Const MaxFecha As Date = #1/1/9999# - Public Const GlobalRowVersion As Integer = 555555 - + Public Const GlobalRowVersion As Integer = 555555 + #Region "PropiedadesEncriptación" Private _Key() As Byte = {} Private ReadOnly _IV() As Byte = {&H12, &H34, &H56, &H78, &H90, &HAB, &HCD, &HEF} @@ -90,10 +98,10 @@ Namespace Extensiones Else Return Valor End If - End Function - + End Function + #Region "Log" - + Public Sub GuardaLog(Str As String) Dim ArchivoW As StreamWriter diff --git a/GPS/Busqueda.aspx b/GPS/Busqueda.aspx index b6ef976d9..0a1433bfc 100644 --- a/GPS/Busqueda.aspx +++ b/GPS/Busqueda.aspx @@ -513,9 +513,7 @@ } - + diff --git a/GPS/CatRemisionesVehiculos.aspx b/GPS/CatRemisionesVehiculos.aspx index f60e75505..8bdf451b1 100644 --- a/GPS/CatRemisionesVehiculos.aspx +++ b/GPS/CatRemisionesVehiculos.aspx @@ -266,8 +266,6 @@ - + diff --git a/GPS/EntradasSalidasGR.aspx b/GPS/EntradasSalidasGR.aspx index 37d683f60..0c472d751 100644 --- a/GPS/EntradasSalidasGR.aspx +++ b/GPS/EntradasSalidasGR.aspx @@ -632,11 +632,6 @@ } - - <%----%> + diff --git a/GPS/GeoReferencias.aspx b/GPS/GeoReferencias.aspx index eda63fbc8..f370c259d 100644 --- a/GPS/GeoReferencias.aspx +++ b/GPS/GeoReferencias.aspx @@ -769,12 +769,7 @@ } - - <%-- --%> + diff --git a/GPS/GeoReferencias.aspx.vb b/GPS/GeoReferencias.aspx.vb index e14d3e9a8..9b898f0e8 100644 --- a/GPS/GeoReferencias.aspx.vb +++ b/GPS/GeoReferencias.aspx.vb @@ -157,7 +157,8 @@ Partial Class GPS_GeoReferencias Finally If TieneError Then - ObjGPS.RollBack() + ObjGPS.RollBack() + Alert("Ocurrió un error al agregar la georeferencia", TipoMensaje.MsgError) Else ObjGPS.Commit() Alert("Se agregó correctamente la Ruta", TipoMensaje.MsgInformacion) diff --git a/GPS/PuntosDeInteres.aspx b/GPS/PuntosDeInteres.aspx index 06a1fd834..bd1f058dc 100644 --- a/GPS/PuntosDeInteres.aspx +++ b/GPS/PuntosDeInteres.aspx @@ -754,11 +754,7 @@ } - - <%-- --%> + + diff --git a/GPS/Rastreo.aspx b/GPS/Rastreo.aspx index ffa349c1b..2e9dae495 100644 --- a/GPS/Rastreo.aspx +++ b/GPS/Rastreo.aspx @@ -3130,9 +3130,7 @@ } - + diff --git a/GPS/Rastreo.aspx.vb b/GPS/Rastreo.aspx.vb index 3d48426b6..ebed128cf 100644 --- a/GPS/Rastreo.aspx.vb +++ b/GPS/Rastreo.aspx.vb @@ -1495,7 +1495,7 @@ Partial Class GPS_Rastreo End If 'RegistraScript("CreaRuta();") ElseIf HdnTipo.Value = "Geocerca" Then - GeoRefString = $"POLYGON(({GeoCerca.Value}))" + GeoRefString = $"POLYGON(({GeoCerca.Value} {CommandArg.Value}))" If ObjGPS.GeoReferenciaAdd(TxtNombre.Text, -1, GeoRefString, "Geocerca", True, TxtFechaIG.Text.ToDate, TxtFechaFG.Text.ToDate, chkLunes.Checked, chkMartes.Checked, chkMiercoles.Checked, chkJueves.Checked, chkViernes.Checked, chkSabado.Checked, chkDomingo.Checked, MinFecha, MaxFecha, TxtColor.Text, TxtTolerancia.Text.ToEntero, UsuarioActual.CveCliente) Then For Each Dr As GridViewRow In GvEquiposDetalle.Rows If Dr.RowType = DataControlRowType.DataRow Then diff --git a/GPS/RastreoTrayectos.aspx b/GPS/RastreoTrayectos.aspx index 320c1d054..91db7fd2a 100644 --- a/GPS/RastreoTrayectos.aspx +++ b/GPS/RastreoTrayectos.aspx @@ -234,7 +234,7 @@ - + diff --git a/GPS/RepGeoReferencias.aspx b/GPS/RepGeoReferencias.aspx index 37376ddfe..f4de37b90 100644 --- a/GPS/RepGeoReferencias.aspx +++ b/GPS/RepGeoReferencias.aspx @@ -3,47 +3,47 @@ - @@ -332,10 +332,10 @@ - - <%----%> + diff --git a/GPS/RepPuntosDeInteres.aspx b/GPS/RepPuntosDeInteres.aspx index 094b21a00..5aed250b6 100644 --- a/GPS/RepPuntosDeInteres.aspx +++ b/GPS/RepPuntosDeInteres.aspx @@ -356,11 +356,6 @@ } - - <%-- --%> + diff --git a/GPS/Shipments.aspx b/GPS/Shipments.aspx index 9a6391624..4dd237032 100644 --- a/GPS/Shipments.aspx +++ b/GPS/Shipments.aspx @@ -731,8 +731,6 @@ } - + diff --git a/GPS/TrayectoDetalle.aspx b/GPS/TrayectoDetalle.aspx index 3c05926d2..1721b3034 100644 --- a/GPS/TrayectoDetalle.aspx +++ b/GPS/TrayectoDetalle.aspx @@ -725,8 +725,6 @@ - + diff --git a/GPS/Trayectos.aspx b/GPS/Trayectos.aspx index 1b36ffa8d..5d38ea4e7 100644 --- a/GPS/Trayectos.aspx +++ b/GPS/Trayectos.aspx @@ -1333,8 +1333,6 @@ }); } - + diff --git a/GPS/data.txt b/GPS/data.txt deleted file mode 100644 index a9c8a58b3..000000000 --- a/GPS/data.txt +++ /dev/null @@ -1,17504 +0,0 @@ -{ - "aaData": [ - [ - "1", - "Armand", - "Warren", - "56045", - "Taiwan, Province of China" - ], - [ - "2", - "Xenos", - "Salas", - "71090", - "Liberia" - ], - [ - "3", - "Virginia", - "Whitaker", - "62723", - "Nicaragua" - ], - [ - "4", - "Kato", - "Patrick", - "97662", - "Palau" - ], - [ - "5", - "Penelope", - "Hensley", - "76634", - "Greenland" - ], - [ - "6", - "Georgia", - "Erickson", - "81358", - "Bolivia" - ], - [ - "7", - "Shad", - "Pena", - "20600", - "Palestinian Territory, Occupied" - ], - [ - "8", - "Tanisha", - "Humphrey", - "93371", - "Kenya" - ], - [ - "9", - "Claire", - "Espinoza", - "I8S 2S8", - "Panama" - ], - [ - "10", - "Raya", - "Tucker", - "O8D 8W7", - "Botswana" - ], - [ - "11", - "Otto", - "Briggs", - "57590", - "Anguilla" - ], - [ - "12", - "Logan", - "Burt", - "53041", - "Venezuela" - ], - [ - "13", - "Cooper", - "Pennington", - "36994", - "France" - ], - [ - "14", - "Kristen", - "Peterson", - "52917", - "Sao Tome and Principe" - ], - [ - "15", - "Jordan", - "Velasquez", - "08884", - "Switzerland" - ], - [ - "16", - "Zelda", - "Freeman", - "F9H 1J9", - "Holy See (Vatican City State)" - ], - [ - "17", - "Mary", - "Pacheco", - "A7Y 6X9", - "Niger" - ], - [ - "18", - "Tiger", - "Robles", - "44533", - "Malaysia" - ], - [ - "19", - "Zelenia", - "Buckner", - "Q8N 6E5", - "Malawi" - ], - [ - "20", - "Coby", - "Johnston", - "N6I 2O9", - "Rwanda" - ], - [ - "21", - "Gillian", - "Strickland", - "12258", - "Cook Islands" - ], - [ - "22", - "Alfreda", - "Mcbride", - "K5A 3B6", - "Nigeria" - ], - [ - "23", - "Laith", - "Ford", - "19072", - "Czech Republic" - ], - [ - "24", - "Autumn", - "Barton", - "U9D 9F4", - "Angola" - ], - [ - "25", - "Nadine", - "Britt", - "G4U 8L0", - "Liechtenstein" - ], - [ - "26", - "Xaviera", - "Hart", - "T1N 7D2", - "Mali" - ], - [ - "27", - "Neil", - "Page", - "T3E 9F4", - "Korea" - ], - [ - "28", - "Rose", - "French", - "B7T 8M2", - "French Polynesia" - ], - [ - "29", - "Alyssa", - "Poole", - "S1L 2T5", - "Yemen" - ], - [ - "30", - "Chantale", - "Lynch", - "97316", - "United States" - ], - [ - "31", - "Jermaine", - "Dawson", - "A3H 7A1", - "American Samoa" - ], - [ - "32", - "Ann", - "Giles", - "54258", - "Korea" - ], - [ - "33", - "Jerry", - "Carr", - "04901", - "South Georgia and The South Sandwich Islands" - ], - [ - "34", - "Lionel", - "Hooper", - "67970", - "Bahrain" - ], - [ - "35", - "Alyssa", - "Hewitt", - "R3K 2V8", - "Paraguay" - ], - [ - "36", - "Lisandra", - "Sheppard", - "71886", - "Seychelles" - ], - [ - "37", - "Kylan", - "Harrison", - "96763", - "Italy" - ], - [ - "38", - "Kaitlin", - "Montgomery", - "V5K 5U8", - "Niger" - ], - [ - "39", - "Heidi", - "Boyd", - "B3C 8M9", - "Papua New Guinea" - ], - [ - "40", - "Rinah", - "Case", - "W7M 5K1", - "Mali" - ], - [ - "41", - "Thaddeus", - "Maynard", - "E4V 6W6", - "Egypt" - ], - [ - "42", - "Lacota", - "Ray", - "T3J 8D8", - "United Kingdom" - ], - [ - "43", - "Olympia", - "Cortez", - "F8C 7I5", - "Palau" - ], - [ - "44", - "Wendy", - "Rojas", - "N8T 4K6", - "Cook Islands" - ], - [ - "45", - "Arden", - "Kelley", - "V9N 2T6", - "India" - ], - [ - "46", - "Colorado", - "Lindsey", - "96703", - "Chad" - ], - [ - "47", - "Alika", - "Weaver", - "F6V 1I1", - "Bulgaria" - ], - [ - "48", - "Phoebe", - "Mack", - "E4B 1X2", - "El Salvador" - ], - [ - "49", - "Sybill", - "Bridges", - "Z2G 6A2", - "Somalia" - ], - [ - "50", - "Trevor", - "Larsen", - "K1R 3B9", - "United Arab Emirates" - ], - [ - "51", - "Maya", - "Battle", - "70881", - "Australia" - ], - [ - "52", - "Charity", - "Walton", - "I4I 5R9", - "Swaziland" - ], - [ - "53", - "Lane", - "Sloan", - "79076", - "Nauru" - ], - [ - "54", - "Christopher", - "Watson", - "35116", - "Suriname" - ], - [ - "55", - "Clementine", - "Shelton", - "98232", - "Venezuela" - ], - [ - "56", - "Basil", - "Hood", - "J9I 1R2", - "Tonga" - ], - [ - "57", - "Meghan", - "Pacheco", - "H5Z 6B1", - "Dominican Republic" - ], - [ - "58", - "Brennan", - "Potts", - "51743", - "Turkey" - ], - [ - "59", - "Lawrence", - "Duran", - "63266", - "Uruguay" - ], - [ - "60", - "Ina", - "Head", - "S8P 9J5", - "Romania" - ], - [ - "61", - "Castor", - "Jacobson", - "C9F 6C9", - "Albania" - ], - [ - "62", - "Daquan", - "Holden", - "38571", - "Ireland" - ], - [ - "63", - "Donna", - "Valencia", - "J7B 3I0", - "Portugal" - ], - [ - "64", - "Kessie", - "Phelps", - "61063", - "Georgia" - ], - [ - "65", - "Dillon", - "Garcia", - "13652", - "Holy See (Vatican City State)" - ], - [ - "66", - "Russell", - "Sweeney", - "T8P 2O6", - "Saint Kitts and Nevis" - ], - [ - "67", - "Zelda", - "Berg", - "84946", - "Afghanistan" - ], - [ - "68", - "Dexter", - "Mann", - "73596", - "Thailand" - ], - [ - "69", - "Maisie", - "Miller", - "X3M 6C1", - "Seychelles" - ], - [ - "70", - "Lynn", - "Mitchell", - "N5B 3Z9", - "Wallis and Futuna" - ], - [ - "71", - "Gay", - "Medina", - "66692", - "Germany" - ], - [ - "72", - "Olga", - "Clark", - "M6B 7B6", - "Kuwait" - ], - [ - "73", - "Brianna", - "Obrien", - "Z6Z 5R3", - "Bahrain" - ], - [ - "74", - "Daria", - "Byers", - "R9T 4N7", - "Ghana" - ], - [ - "75", - "Chiquita", - "Barker", - "28435", - "Ireland" - ], - [ - "76", - "Gray", - "Salazar", - "58618", - "Chile" - ], - [ - "77", - "Delilah", - "Kirby", - "42811", - "Oman" - ], - [ - "78", - "Xanthus", - "Holland", - "B8Q 9C4", - "Antigua and Barbuda" - ], - [ - "79", - "Reuben", - "Brennan", - "44693", - "Czech Republic" - ], - [ - "80", - "Alden", - "Long", - "94236", - "Slovakia" - ], - [ - "81", - "Blythe", - "Bender", - "04812", - "Guam" - ], - [ - "82", - "Aileen", - "Burgess", - "47942", - "Djibouti" - ], - [ - "83", - "Zeus", - "Craig", - "43002", - "Nicaragua" - ], - [ - "84", - "Jade", - "Garza", - "F2X 8F3", - "New Zealand" - ], - [ - "85", - "Noah", - "Barrera", - "K9C 8U0", - "Malawi" - ], - [ - "86", - "Quyn", - "Robertson", - "H3X 6J9", - "Bosnia and Herzegovina" - ], - [ - "87", - "Serena", - "Cabrera", - "83671", - "Slovenia" - ], - [ - "88", - "Charity", - "Chase", - "T9Q 7C4", - "Solomon Islands" - ], - [ - "89", - "Athena", - "Grimes", - "62801", - "Aruba" - ], - [ - "90", - "Mallory", - "Middleton", - "D2V 1M5", - "Italy" - ], - [ - "91", - "Xenos", - "Jones", - "46642", - "Singapore" - ], - [ - "92", - "Tate", - "Gregory", - "66538", - "Zimbabwe" - ], - [ - "93", - "Blaze", - "Taylor", - "70282", - "Paraguay" - ], - [ - "94", - "Jena", - "Duncan", - "63057", - "Cambodia" - ], - [ - "95", - "Thaddeus", - "Chase", - "66762", - "Netherlands Antilles" - ], - [ - "96", - "Guinevere", - "Mcgee", - "O9G 4S2", - "Lebanon" - ], - [ - "97", - "Kermit", - "Ramsey", - "41214", - "Dominican Republic" - ], - [ - "98", - "Josephine", - "Gallagher", - "04960", - "French Southern Territories" - ], - [ - "99", - "Amela", - "Morales", - "M9I 1X5", - "Sudan" - ], - [ - "100", - "Rina", - "Yates", - "G3T 7M9", - "Dominica" - ], - [ - "101", - "Orson", - "Norris", - "21660", - "Sierra Leone" - ], - [ - "102", - "Graiden", - "Silva", - "98191", - "Saint Lucia" - ], - [ - "103", - "Amaya", - "Hood", - "45779", - "India" - ], - [ - "104", - "Fatima", - "Fitzpatrick", - "I4R 9Q8", - "Viet Nam" - ], - [ - "105", - "Judith", - "Stokes", - "97596", - "Sudan" - ], - [ - "106", - "Jared", - "Vaughn", - "75521", - "Benin" - ], - [ - "107", - "Mira", - "Morgan", - "35169", - "Martinique" - ], - [ - "108", - "Walter", - "Perkins", - "28618", - "San Marino" - ], - [ - "109", - "Megan", - "Maxwell", - "K6X 3J4", - "Oman" - ], - [ - "110", - "Christine", - "Christensen", - "M7S 8G8", - "Netherlands Antilles" - ], - [ - "111", - "Tanner", - "Guerra", - "S3K 6Y5", - "Finland" - ], - [ - "112", - "Meghan", - "Rowland", - "K7U 3A1", - "Rwanda" - ], - [ - "113", - "Patrick", - "Mitchell", - "V3F 5C4", - "Oman" - ], - [ - "114", - "Jackson", - "Sanders", - "83229", - "Greenland" - ], - [ - "115", - "Omar", - "Savage", - "14082", - "Korea" - ], - [ - "116", - "Ulla", - "Larsen", - "Q2P 4L8", - "French Southern Territories" - ], - [ - "117", - "Hop", - "Gates", - "D9G 9J4", - "Poland" - ], - [ - "118", - "Astra", - "Mendoza", - "R3D 2H9", - "Saint Vincent and The Grenadines" - ], - [ - "119", - "Denise", - "Cardenas", - "73138", - "Sao Tome and Principe" - ], - [ - "120", - "Melodie", - "Roberts", - "L1G 4H2", - "India" - ], - [ - "121", - "Cedric", - "Joseph", - "M4V 8O9", - "Korea, Republic of" - ], - [ - "122", - "Linda", - "Horn", - "24465", - "Bosnia and Herzegovina" - ], - [ - "123", - "Mary", - "Lyons", - "22324", - "Norfolk Island" - ], - [ - "124", - "Ciara", - "Mcknight", - "30784", - "Anguilla" - ], - [ - "125", - "Vaughan", - "Santiago", - "65037", - "Guyana" - ], - [ - "126", - "Lamar", - "Shepherd", - "58040", - "France" - ], - [ - "127", - "Xavier", - "Webster", - "68321", - "Afghanistan" - ], - [ - "128", - "Ainsley", - "Banks", - "46902", - "Pakistan" - ], - [ - "129", - "Alika", - "Love", - "L5O 4B3", - "Iran, Islamic Republic of" - ], - [ - "130", - "Maite", - "Dickson", - "37405", - "Saint Kitts and Nevis" - ], - [ - "131", - "Kimberley", - "Morrow", - "F7C 7J0", - "Lebanon" - ], - [ - "132", - "Eugenia", - "Stafford", - "36282", - "Nicaragua" - ], - [ - "133", - "Mira", - "Gill", - "K1T 8U1", - "Uruguay" - ], - [ - "134", - "Herman", - "Francis", - "C2G 8G9", - "Northern Mariana Islands" - ], - [ - "135", - "Veronica", - "Peters", - "74146", - "Cook Islands" - ], - [ - "136", - "Axel", - "Cochran", - "32240", - "Central African Republic" - ], - [ - "137", - "Edan", - "Howe", - "51862", - "Mali" - ], - [ - "138", - "Ignacia", - "Bruce", - "Q8T 5Q1", - "Sao Tome and Principe" - ], - [ - "139", - "Jana", - "Mcguire", - "89412", - "Czech Republic" - ], - [ - "140", - "Alice", - "Underwood", - "74535", - "Slovakia" - ], - [ - "141", - "Tobias", - "Kent", - "33601", - "South Georgia and The South Sandwich Islands" - ], - [ - "142", - "Nasim", - "Coleman", - "19377", - "United States Minor Outlying Islands" - ], - [ - "143", - "Geoffrey", - "Byers", - "85753", - "Netherlands Antilles" - ], - [ - "144", - "Odette", - "Sawyer", - "55418", - "Tunisia" - ], - [ - "145", - "Chaney", - "Flowers", - "F4W 7O7", - "Maldives" - ], - [ - "146", - "Shelly", - "Glover", - "M5Y 4A6", - "Taiwan, Province of China" - ], - [ - "147", - "Uriel", - "Thornton", - "Z6Q 5B7", - "Myanmar" - ], - [ - "148", - "Clio", - "Nicholson", - "Y8S 7P2", - "Martinique" - ], - [ - "149", - "Jana", - "Foley", - "B1O 9J5", - "United Arab Emirates" - ], - [ - "150", - "Fulton", - "Rasmussen", - "39194", - "Solomon Islands" - ], - [ - "151", - "Lisandra", - "Boyd", - "J2Z 2V7", - "French Guiana" - ], - [ - "152", - "Brennan", - "Lopez", - "Q4M 7Y4", - "Burkina Faso" - ], - [ - "153", - "Martha", - "Washington", - "M7S 4U6", - "Iran, Islamic Republic of" - ], - [ - "154", - "Dara", - "Ramos", - "07799", - "Portugal" - ], - [ - "155", - "Virginia", - "Harris", - "01246", - "Bermuda" - ], - [ - "156", - "Maryam", - "Patrick", - "Y3J 4Y0", - "Rwanda" - ], - [ - "157", - "Shana", - "Mullen", - "61169", - "Togo" - ], - [ - "158", - "Rowan", - "Hahn", - "K6D 5T4", - "Guinea-bissau" - ], - [ - "159", - "Hermione", - "Shepherd", - "M4F 7T6", - "Ireland" - ], - [ - "160", - "Jada", - "Bright", - "P1Z 7E6", - "French Southern Territories" - ], - [ - "161", - "Scarlet", - "Bray", - "57161", - "Austria" - ], - [ - "162", - "Haviva", - "Conner", - "M4T 8O4", - "Bermuda" - ], - [ - "163", - "Myra", - "Briggs", - "Q4B 6L7", - "Kenya" - ], - [ - "164", - "Hall", - "Floyd", - "40411", - "Bangladesh" - ], - [ - "165", - "Kyle", - "Marquez", - "J4T 7C6", - "Djibouti" - ], - [ - "166", - "Claudia", - "Long", - "R7B 1T6", - "Macedonia" - ], - [ - "167", - "Hasad", - "Clemons", - "94009", - "Bosnia and Herzegovina" - ], - [ - "168", - "Kameko", - "Reeves", - "G4V 6D5", - "Singapore" - ], - [ - "169", - "Angelica", - "Bailey", - "Z3Y 7I0", - "Micronesia" - ], - [ - "170", - "Shelley", - "Jennings", - "O3A 9H0", - "Christmas Island" - ], - [ - "171", - "Rafael", - "Randolph", - "Y4L 8B5", - "Germany" - ], - [ - "172", - "Winter", - "Kinney", - "A3K 9A7", - "Saint Lucia" - ], - [ - "173", - "Brian", - "Larsen", - "53752", - "Comoros" - ], - [ - "174", - "Melvin", - "Cooper", - "72416", - "Czech Republic" - ], - [ - "175", - "Gil", - "Valencia", - "95798", - "Uganda" - ], - [ - "176", - "Uma", - "Cummings", - "84649", - "Jordan" - ], - [ - "177", - "Micah", - "Shannon", - "H9L 8R6", - "Ghana" - ], - [ - "178", - "Ahmed", - "Weiss", - "05291", - "American Samoa" - ], - [ - "179", - "Hop", - "Foster", - "W9C 7J7", - "Panama" - ], - [ - "180", - "Todd", - "Barnett", - "T9R 7J4", - "Seychelles" - ], - [ - "181", - "Byron", - "Meyers", - "J4G 9P2", - "Congo" - ], - [ - "182", - "Hadassah", - "Barnett", - "U1A 8V3", - "Paraguay" - ], - [ - "183", - "Hermione", - "Luna", - "L4G 2E5", - "New Zealand" - ], - [ - "184", - "Marsden", - "Alvarado", - "U1V 1Y4", - "Aruba" - ], - [ - "185", - "Britanni", - "Gregory", - "C8O 2T4", - "Kazakhstan" - ], - [ - "186", - "Brenda", - "Oneil", - "R9Q 9B7", - "Gibraltar" - ], - [ - "187", - "Reuben", - "Hopkins", - "C2D 9D0", - "Bhutan" - ], - [ - "188", - "Sonia", - "Sandoval", - "Y2G 5I0", - "Guatemala" - ], - [ - "189", - "Yasir", - "Holcomb", - "A1H 6Y3", - "Angola" - ], - [ - "190", - "Aristotle", - "Rosa", - "51870", - "Indonesia" - ], - [ - "191", - "Uriah", - "Blair", - "X8K 1B9", - "Suriname" - ], - [ - "192", - "Vaughan", - "Sharp", - "L2F 5N8", - "Faroe Islands" - ], - [ - "193", - "Cooper", - "Beard", - "80399", - "United States Minor Outlying Islands" - ], - [ - "194", - "Riley", - "Greene", - "44728", - "Russian Federation" - ], - [ - "195", - "Rashad", - "Flowers", - "L6N 8U7", - "Mongolia" - ], - [ - "196", - "Yvonne", - "Wilson", - "18599", - "Svalbard and Jan Mayen" - ], - [ - "197", - "Martena", - "Ayers", - "A8Z 5F7", - "Oman" - ], - [ - "198", - "Eagan", - "Cline", - "T9P 4L4", - "Solomon Islands" - ], - [ - "199", - "Dawn", - "Carrillo", - "T6O 6E5", - "Malawi" - ], - [ - "200", - "Ali", - "Singleton", - "G6F 3B4", - "Italy" - ], - [ - "201", - "Christopher", - "Beach", - "01655", - "Palau" - ], - [ - "202", - "Emma", - "Cummings", - "W1B 4R6", - "Dominica" - ], - [ - "203", - "Ishmael", - "Gray", - "76928", - "Egypt" - ], - [ - "204", - "Megan", - "Hines", - "F7X 2X5", - "New Zealand" - ], - [ - "205", - "Emmanuel", - "Steele", - "09729", - "Netherlands" - ], - [ - "206", - "Alea", - "Burris", - "08485", - "Guatemala" - ], - [ - "207", - "Martina", - "Todd", - "46863", - "Christmas Island" - ], - [ - "208", - "Len", - "Valentine", - "S6Z 5S8", - "Slovenia" - ], - [ - "209", - "Jorden", - "Salazar", - "U4D 8H6", - "Austria" - ], - [ - "210", - "Yvette", - "Bradford", - "17275", - "Heard Island and Mcdonald Islands" - ], - [ - "211", - "Elvis", - "Mcmahon", - "27586", - "Marshall Islands" - ], - [ - "212", - "Gray", - "Bonner", - "N4V 3U9", - "Moldova" - ], - [ - "213", - "Yoshi", - "Singleton", - "86603", - "United Kingdom" - ], - [ - "214", - "Amena", - "Burks", - "93820", - "Reunion" - ], - [ - "215", - "Ocean", - "Maldonado", - "72026", - "Ireland" - ], - [ - "216", - "Allen", - "Foley", - "75363", - "Kiribati" - ], - [ - "217", - "Duncan", - "Jimenez", - "H3H 3G6", - "Oman" - ], - [ - "218", - "Ira", - "Maxwell", - "53136", - "French Polynesia" - ], - [ - "219", - "Astra", - "Moon", - "D7W 8G2", - "Dominican Republic" - ], - [ - "220", - "Orson", - "Myers", - "06049", - "Mali" - ], - [ - "221", - "Brandon", - "Estes", - "D2B 7P2", - "Kenya" - ], - [ - "222", - "Halee", - "Luna", - "54733", - "Moldova" - ], - [ - "223", - "Jillian", - "Gonzalez", - "E8W 3L9", - "Ecuador" - ], - [ - "224", - "Julie", - "Acosta", - "X7M 1T2", - "Equatorial Guinea" - ], - [ - "225", - "Quemby", - "Foster", - "48596", - "Eritrea" - ], - [ - "226", - "Erich", - "Chavez", - "W4P 7G8", - "Mayotte" - ], - [ - "227", - "Roary", - "Mcknight", - "K9K 2K4", - "Chile" - ], - [ - "228", - "Mufutau", - "Henderson", - "81377", - "Mayotte" - ], - [ - "229", - "Herman", - "Ferguson", - "69405", - "Japan" - ], - [ - "230", - "Abdul", - "Franks", - "L1V 8X2", - "Portugal" - ], - [ - "231", - "Dominic", - "Logan", - "98770", - "Saint Lucia" - ], - [ - "232", - "Isadora", - "Solis", - "Y3A 6H5", - "Portugal" - ], - [ - "233", - "Lester", - "Davis", - "30339", - "British Indian Ocean Territory" - ], - [ - "234", - "Joel", - "Rojas", - "N8E 5T9", - "Bahrain" - ], - [ - "235", - "Quinlan", - "Carroll", - "55785", - "Australia" - ], - [ - "236", - "Guinevere", - "Pickett", - "A7Y 3V3", - "Netherlands Antilles" - ], - [ - "237", - "Nita", - "Hopkins", - "88370", - "Albania" - ], - [ - "238", - "Hayley", - "Buckley", - "F1V 7P5", - "Togo" - ], - [ - "239", - "Colorado", - "Reyes", - "18798", - "Congo" - ], - [ - "240", - "Tashya", - "Bartlett", - "48537", - "Sierra Leone" - ], - [ - "241", - "Isabella", - "Keith", - "48878", - "Kiribati" - ], - [ - "242", - "Jessica", - "Noble", - "D6C 9T9", - "Svalbard and Jan Mayen" - ], - [ - "243", - "Cairo", - "Edwards", - "40598", - "Nepal" - ], - [ - "244", - "Camille", - "Bradley", - "I4U 8F6", - "Fiji" - ], - [ - "245", - "Quin", - "Mcgee", - "O5D 2P0", - "Poland" - ], - [ - "246", - "Rina", - "Guzman", - "44940", - "Bahrain" - ], - [ - "247", - "Glenna", - "Kirkland", - "Z1L 4W2", - "San Marino" - ], - [ - "248", - "Tarik", - "Todd", - "77228", - "Turks and Caicos Islands" - ], - [ - "249", - "Yardley", - "Burris", - "M6U 9D7", - "New Caledonia" - ], - [ - "250", - "Hashim", - "Casey", - "17722", - "Lesotho" - ], - [ - "251", - "Maggie", - "Raymond", - "62540", - "Uganda" - ], - [ - "252", - "Christian", - "Mcdonald", - "R8K 2M1", - "United Arab Emirates" - ], - [ - "253", - "Colt", - "Cobb", - "75393", - "Moldova" - ], - [ - "254", - "Aline", - "Graves", - "I1C 9I6", - "Holy See (Vatican City State)" - ], - [ - "255", - "Farrah", - "Cannon", - "H5W 2Y0", - "Bhutan" - ], - [ - "256", - "Wynne", - "Ayers", - "B6X 6Y8", - "Western Sahara" - ], - [ - "257", - "Teegan", - "Avery", - "33643", - "San Marino" - ], - [ - "258", - "Shana", - "Sloan", - "K9P 9V7", - "Gabon" - ], - [ - "259", - "Britanney", - "Cook", - "Y5D 6K7", - "Romania" - ], - [ - "260", - "Kuame", - "Schroeder", - "12859", - "Syrian Arab Republic" - ], - [ - "261", - "Valentine", - "Joseph", - "P2S 6T6", - "Mayotte" - ], - [ - "262", - "Joelle", - "Keller", - "U6F 3T7", - "Fiji" - ], - [ - "263", - "Elaine", - "Hickman", - "28056", - "Tuvalu" - ], - [ - "264", - "Ivor", - "Malone", - "H2Z 5X5", - "Virgin Islands, British" - ], - [ - "265", - "Maris", - "Jefferson", - "12474", - "Czech Republic" - ], - [ - "266", - "Josephine", - "Zimmerman", - "Z5J 2I4", - "Angola" - ], - [ - "267", - "Baker", - "Wooten", - "X4K 2L8", - "Austria" - ], - [ - "268", - "Alyssa", - "Mitchell", - "97712", - "Antarctica" - ], - [ - "269", - "Carlos", - "Pearson", - "85838", - "Gambia" - ], - [ - "270", - "Luke", - "Richardson", - "73867", - "Christmas Island" - ], - [ - "271", - "Davis", - "Gardner", - "U2E 4D9", - "Chile" - ], - [ - "272", - "Thomas", - "Conner", - "92487", - "Mozambique" - ], - [ - "273", - "Kieran", - "Baird", - "X9G 6G1", - "Iceland" - ], - [ - "274", - "Cheyenne", - "Morris", - "F5V 4S2", - "Greece" - ], - [ - "275", - "Hillary", - "Reeves", - "89804", - "Slovakia" - ], - [ - "276", - "Ryder", - "Long", - "32725", - "New Caledonia" - ], - [ - "277", - "Ariel", - "Colon", - "50675", - "Estonia" - ], - [ - "278", - "Vanna", - "Hess", - "79057", - "Saudi Arabia" - ], - [ - "279", - "Hayley", - "Cherry", - "B5E 9X4", - "United States Minor Outlying Islands" - ], - [ - "280", - "Knox", - "Blair", - "75626", - "Central African Republic" - ], - [ - "281", - "Astra", - "Mcdaniel", - "24493", - "Bermuda" - ], - [ - "282", - "Teegan", - "Ford", - "A8U 1K9", - "Iran, Islamic Republic of" - ], - [ - "283", - "Harrison", - "Jackson", - "43519", - "Marshall Islands" - ], - [ - "284", - "Melyssa", - "Lawson", - "O7E 8E6", - "Belize" - ], - [ - "285", - "Shaine", - "Francis", - "Q5K 5I4", - "India" - ], - [ - "286", - "August", - "Reed", - "S9R 1O8", - "Ghana" - ], - [ - "287", - "Aphrodite", - "Zimmerman", - "28336", - "Lesotho" - ], - [ - "288", - "Declan", - "Walters", - "08662", - "Rwanda" - ], - [ - "289", - "Brody", - "Pate", - "G2G 9D9", - "Serbia and Montenegro" - ], - [ - "290", - "Bradley", - "Odom", - "L2R 6Z9", - "Jordan" - ], - [ - "291", - "Phillip", - "Cleveland", - "E4D 1B7", - "Paraguay" - ], - [ - "292", - "Silas", - "Wiggins", - "F9F 5X3", - "Bahrain" - ], - [ - "293", - "Keely", - "Donaldson", - "B5H 7F2", - "Vanuatu" - ], - [ - "294", - "Hammett", - "Lancaster", - "H2P 4E6", - "Svalbard and Jan Mayen" - ], - [ - "295", - "Kiara", - "Clarke", - "50885", - "Thailand" - ], - [ - "296", - "Ayanna", - "Wiley", - "20773", - "Morocco" - ], - [ - "297", - "Tashya", - "Stanley", - "F5J 5R9", - "New Caledonia" - ], - [ - "298", - "Margaret", - "Barker", - "J5A 9N8", - "Marshall Islands" - ], - [ - "299", - "Xandra", - "English", - "92299", - "Korea, Republic of" - ], - [ - "300", - "Jane", - "Brock", - "86140", - "Yemen" - ], - [ - "301", - "Lunea", - "Garrett", - "96730", - "New Caledonia" - ], - [ - "302", - "Slade", - "Everett", - "16105", - "Malawi" - ], - [ - "303", - "Scott", - "Booker", - "G8V 2R4", - "Macedonia" - ], - [ - "304", - "Candice", - "Decker", - "E5R 2D4", - "China" - ], - [ - "305", - "Armando", - "Bridges", - "87959", - "Falkland Islands (Malvinas)" - ], - [ - "306", - "Clayton", - "Whitley", - "Q6O 4M7", - "British Indian Ocean Territory" - ], - [ - "307", - "Driscoll", - "Duncan", - "M2J 9V5", - "Argentina" - ], - [ - "308", - "Devin", - "Stafford", - "L8F 2V7", - "Svalbard and Jan Mayen" - ], - [ - "309", - "Bell", - "York", - "E5B 7X5", - "Lebanon" - ], - [ - "310", - "Haley", - "Becker", - "19759", - "Bhutan" - ], - [ - "311", - "Chava", - "Santiago", - "04396", - "Israel" - ], - [ - "312", - "David", - "Mccall", - "62087", - "Norfolk Island" - ], - [ - "313", - "Clinton", - "Jacobson", - "06168", - "Guam" - ], - [ - "314", - "Melvin", - "Kaufman", - "C4E 9N6", - "Gambia" - ], - [ - "315", - "Dai", - "Shepherd", - "37490", - "Saudi Arabia" - ], - [ - "316", - "Zahir", - "Chase", - "44340", - "Turkey" - ], - [ - "317", - "Leilani", - "Parrish", - "62576", - "Cocos (Keeling) Islands" - ], - [ - "318", - "Oleg", - "Wilkins", - "Z7S 8Z4", - "Latvia" - ], - [ - "319", - "Pearl", - "Pena", - "82526", - "Saudi Arabia" - ], - [ - "320", - "Kelly", - "Moody", - "W7U 5Y3", - "Burundi" - ], - [ - "321", - "Marcia", - "Kennedy", - "85952", - "Panama" - ], - [ - "322", - "Cailin", - "Burnett", - "M2Z 3L5", - "Guyana" - ], - [ - "323", - "Ciara", - "Small", - "X6C 6M6", - "Tanzania, United Republic of" - ], - [ - "324", - "Lillian", - "Massey", - "Z8A 5U5", - "Algeria" - ], - [ - "325", - "Garrett", - "Elliott", - "R5P 6T0", - "Canada" - ], - [ - "326", - "Inga", - "Daniels", - "40156", - "Cocos (Keeling) Islands" - ], - [ - "327", - "Barry", - "Pena", - "03593", - "Tonga" - ], - [ - "328", - "Penelope", - "Mcintyre", - "29293", - "Burkina Faso" - ], - [ - "329", - "Dante", - "Kirk", - "74038", - "Lesotho" - ], - [ - "330", - "Owen", - "Cole", - "17968", - "Rwanda" - ], - [ - "331", - "Brittany", - "Edwards", - "24507", - "Paraguay" - ], - [ - "332", - "Zeph", - "Bentley", - "12000", - "Guam" - ], - [ - "333", - "Ruth", - "Palmer", - "E8V 9A5", - "Ghana" - ], - [ - "334", - "Driscoll", - "Ellis", - "X1X 2N5", - "Angola" - ], - [ - "335", - "Mohammad", - "Guerra", - "Y9N 3Y5", - "Mongolia" - ], - [ - "336", - "Clio", - "Baldwin", - "67557", - "Morocco" - ], - [ - "337", - "Virginia", - "Duncan", - "J8D 4T2", - "Haiti" - ], - [ - "338", - "Dieter", - "Sanchez", - "H7E 2H4", - "Romania" - ], - [ - "339", - "Quinn", - "Hurst", - "K4E 2X6", - "Reunion" - ], - [ - "340", - "Coby", - "Kelly", - "S1H 8N0", - "Equatorial Guinea" - ], - [ - "341", - "Raja", - "Solis", - "S5G 9T5", - "Grenada" - ], - [ - "342", - "Jordan", - "Riddle", - "J7M 5X3", - "Svalbard and Jan Mayen" - ], - [ - "343", - "Dora", - "Knox", - "25054", - "Libyan Arab Jamahiriya" - ], - [ - "344", - "Brendan", - "Reilly", - "U9U 3F7", - "Armenia" - ], - [ - "345", - "Melyssa", - "Reyes", - "11285", - "Viet Nam" - ], - [ - "346", - "Knox", - "Rivera", - "N8Z 7J0", - "Nepal" - ], - [ - "347", - "Quynn", - "Irwin", - "26524", - "Chile" - ], - [ - "348", - "Colin", - "Coleman", - "22833", - "United Arab Emirates" - ], - [ - "349", - "Sybil", - "Delgado", - "99947", - "Belize" - ], - [ - "350", - "Macaulay", - "Salinas", - "48521", - "Heard Island and Mcdonald Islands" - ], - [ - "351", - "Garrison", - "Hogan", - "68950", - "India" - ], - [ - "352", - "Ronan", - "Guerra", - "55445", - "Angola" - ], - [ - "353", - "Regina", - "Andrews", - "H3E 3T0", - "Central African Republic" - ], - [ - "354", - "Colorado", - "Joyce", - "V6X 5K8", - "Anguilla" - ], - [ - "355", - "Basia", - "Banks", - "85049", - "Grenada" - ], - [ - "356", - "Adena", - "Berg", - "04135", - "New Caledonia" - ], - [ - "357", - "Wade", - "Richardson", - "C8M 9J3", - "Dominican Republic" - ], - [ - "358", - "Cody", - "Montoya", - "22018", - "Solomon Islands" - ], - [ - "359", - "Faith", - "Barnett", - "61475", - "China" - ], - [ - "360", - "Cody", - "Witt", - "C8I 2Q8", - "Congo" - ], - [ - "361", - "Brenden", - "Carlson", - "74007", - "Marshall Islands" - ], - [ - "362", - "Gil", - "Brooks", - "U4S 5N1", - "Saint Vincent and The Grenadines" - ], - [ - "363", - "Kirestin", - "Watts", - "H8I 1D5", - "Myanmar" - ], - [ - "364", - "Amelia", - "Gilliam", - "11461", - "Chile" - ], - [ - "365", - "Noelani", - "Rhodes", - "83320", - "Cuba" - ], - [ - "366", - "Len", - "Trevino", - "W9F 2U5", - "Armenia" - ], - [ - "367", - "Galvin", - "Middleton", - "86707", - "Thailand" - ], - [ - "368", - "Germaine", - "Bridges", - "90283", - "Japan" - ], - [ - "369", - "Rose", - "Hines", - "W7L 7Q6", - "Congo" - ], - [ - "370", - "Hop", - "Mueller", - "I3E 2X8", - "Angola" - ], - [ - "371", - "Iliana", - "Williamson", - "56758", - "Lebanon" - ], - [ - "372", - "Raja", - "Price", - "49603", - "Armenia" - ], - [ - "373", - "Jeanette", - "Hatfield", - "E3K 5N5", - "India" - ], - [ - "374", - "Brittany", - "Christensen", - "04750", - "Uruguay" - ], - [ - "375", - "Inga", - "Prince", - "D4X 6J5", - "Switzerland" - ], - [ - "376", - "Cherokee", - "Ballard", - "U1O 1M0", - "Rwanda" - ], - [ - "377", - "Deirdre", - "Watson", - "46983", - "Sri Lanka" - ], - [ - "378", - "Amanda", - "Parrish", - "99838", - "Hong Kong" - ], - [ - "379", - "Leo", - "Shannon", - "L3N 3J0", - "Brunei Darussalam" - ], - [ - "380", - "Kimberly", - "Clemons", - "88734", - "South Africa" - ], - [ - "381", - "Seth", - "Langley", - "D6A 1Q9", - "Guyana" - ], - [ - "382", - "Carol", - "Blankenship", - "X5N 2A7", - "Angola" - ], - [ - "383", - "Dora", - "Flores", - "F8F 1O5", - "Poland" - ], - [ - "384", - "Chava", - "Dickson", - "P8B 6W6", - "Comoros" - ], - [ - "385", - "Trevor", - "Mcdowell", - "31382", - "Solomon Islands" - ], - [ - "386", - "Alec", - "Valentine", - "P2R 4K7", - "Greenland" - ], - [ - "387", - "Philip", - "Jenkins", - "Q7X 5U5", - "Aruba" - ], - [ - "388", - "Kim", - "Bowen", - "69873", - "Saint Kitts and Nevis" - ], - [ - "389", - "Allegra", - "Oconnor", - "X3Y 1X3", - "Holy See (Vatican City State)" - ], - [ - "390", - "Daria", - "Briggs", - "A7Z 7P4", - "Serbia and Montenegro" - ], - [ - "391", - "Amelia", - "Wiley", - "D4S 1G5", - "Montserrat" - ], - [ - "392", - "Erica", - "Aguirre", - "H5L 2O3", - "Andorra" - ], - [ - "393", - "Kibo", - "Sawyer", - "30638", - "Guyana" - ], - [ - "394", - "Jackson", - "Meyers", - "P4N 9D6", - "Bangladesh" - ], - [ - "395", - "Kirk", - "Baxter", - "F3M 7S6", - "Estonia" - ], - [ - "396", - "Sybil", - "Christian", - "B3Q 2X0", - "South Georgia and The South Sandwich Islands" - ], - [ - "397", - "Ina", - "Mercer", - "N4S 1K8", - "Korea" - ], - [ - "398", - "Kiara", - "Whitehead", - "86023", - "Nicaragua" - ], - [ - "399", - "Vielka", - "Hays", - "29845", - "Malta" - ], - [ - "400", - "Stacey", - "Carlson", - "53218", - "Cook Islands" - ], - [ - "401", - "Selma", - "Lloyd", - "78256", - "Turkey" - ], - [ - "402", - "Rhoda", - "Mcintosh", - "G8X 1C8", - "Guatemala" - ], - [ - "403", - "Teagan", - "Ochoa", - "99752", - "Barbados" - ], - [ - "404", - "Rebecca", - "Carver", - "82661", - "Saint Kitts and Nevis" - ], - [ - "405", - "Yael", - "Woodward", - "66095", - "Niger" - ], - [ - "406", - "Calvin", - "Huffman", - "82172", - "Somalia" - ], - [ - "407", - "Sopoline", - "Walters", - "K5L 3I7", - "Spain" - ], - [ - "408", - "Hollee", - "Powell", - "05572", - "Samoa" - ], - [ - "409", - "Fiona", - "Frank", - "74456", - "Timor-leste" - ], - [ - "410", - "Alana", - "Hubbard", - "76011", - "Lithuania" - ], - [ - "411", - "Lillian", - "Garcia", - "J5Z 2O5", - "Sierra Leone" - ], - [ - "412", - "Tad", - "Mcleod", - "B6A 8Z4", - "Australia" - ], - [ - "413", - "Hadassah", - "Hall", - "47417", - "China" - ], - [ - "414", - "Regan", - "Summers", - "X4L 4I6", - "Honduras" - ], - [ - "415", - "Herrod", - "Erickson", - "R8G 3V0", - "Israel" - ], - [ - "416", - "Autumn", - "Rojas", - "31205", - "Cocos (Keeling) Islands" - ], - [ - "417", - "Castor", - "Mooney", - "92737", - "Grenada" - ], - [ - "418", - "Wesley", - "Holman", - "57125", - "Greenland" - ], - [ - "419", - "Kitra", - "Wooten", - "Q6X 4Y0", - "Mongolia" - ], - [ - "420", - "Buckminster", - "Rice", - "U8B 7B8", - "Tokelau" - ], - [ - "421", - "Xavier", - "Hardin", - "18280", - "Iran, Islamic Republic of" - ], - [ - "422", - "Sopoline", - "Fleming", - "78437", - "Singapore" - ], - [ - "423", - "Sydney", - "Salinas", - "23801", - "Cook Islands" - ], - [ - "424", - "Bethany", - "Rosales", - "89650", - "United States" - ], - [ - "425", - "Deirdre", - "Hensley", - "F3X 1B7", - "Micronesia" - ], - [ - "426", - "Bernard", - "Vargas", - "S4D 9T0", - "Uzbekistan" - ], - [ - "427", - "Merrill", - "Compton", - "17713", - "Suriname" - ], - [ - "428", - "Carly", - "Baird", - "D3H 5G3", - "United States Minor Outlying Islands" - ], - [ - "429", - "Grace", - "Phelps", - "64695", - "Nauru" - ], - [ - "430", - "Kareem", - "Stone", - "65572", - "Netherlands" - ], - [ - "431", - "Susan", - "Newton", - "04627", - "Anguilla" - ], - [ - "432", - "Laura", - "Miranda", - "E1G 2R7", - "Finland" - ], - [ - "433", - "Madaline", - "Pugh", - "J9A 9M5", - "Senegal" - ], - [ - "434", - "Sophia", - "Mendez", - "33789", - "Timor-leste" - ], - [ - "435", - "Roary", - "Greene", - "61774", - "Canada" - ], - [ - "436", - "Amos", - "Gilliam", - "94933", - "Sri Lanka" - ], - [ - "437", - "Ivory", - "Joyner", - "15379", - "San Marino" - ], - [ - "438", - "Jorden", - "Robbins", - "43400", - "Russian Federation" - ], - [ - "439", - "Merritt", - "Holcomb", - "R1I 3C7", - "Brazil" - ], - [ - "440", - "Iliana", - "Johnston", - "U9W 8N2", - "Trinidad and Tobago" - ], - [ - "441", - "Ivana", - "Patterson", - "G5O 6A5", - "Georgia" - ], - [ - "442", - "Sydney", - "Mccullough", - "W9M 2H5", - "American Samoa" - ], - [ - "443", - "Alvin", - "Fulton", - "X8A 8R5", - "Antigua and Barbuda" - ], - [ - "444", - "Alfreda", - "Lopez", - "42499", - "Montserrat" - ], - [ - "445", - "Ethan", - "Bird", - "W9A 8M1", - "British Indian Ocean Territory" - ], - [ - "446", - "Zeus", - "Logan", - "01682", - "San Marino" - ], - [ - "447", - "Nehru", - "Andrews", - "W8J 3C8", - "Dominican Republic" - ], - [ - "448", - "Donna", - "Booth", - "64754", - "Nepal" - ], - [ - "449", - "Cruz", - "Bruce", - "17429", - "Burundi" - ], - [ - "450", - "Ronan", - "Saunders", - "69957", - "South Africa" - ], - [ - "451", - "Jordan", - "Barnes", - "D8K 9L8", - "Dominica" - ], - [ - "452", - "Carly", - "Love", - "D8Z 3P4", - "Mauritania" - ], - [ - "453", - "Mari", - "George", - "60260", - "Japan" - ], - [ - "454", - "Karly", - "Hodges", - "15790", - "South Georgia and The South Sandwich Islands" - ], - [ - "455", - "Rana", - "Logan", - "M1R 6Y6", - "Bosnia and Herzegovina" - ], - [ - "456", - "Theodore", - "Sims", - "C7A 8T2", - "Barbados" - ], - [ - "457", - "Quin", - "Thompson", - "26884", - "Bouvet Island" - ], - [ - "458", - "Kimberley", - "Sloan", - "S5T 8E3", - "Costa Rica" - ], - [ - "459", - "Upton", - "Valenzuela", - "Z6J 6Q1", - "Macao" - ], - [ - "460", - "Clinton", - "Williams", - "Z3O 7C4", - "Germany" - ], - [ - "461", - "Samson", - "Mathis", - "G1T 1V9", - "Senegal" - ], - [ - "462", - "Michelle", - "Frost", - "87113", - "Serbia and Montenegro" - ], - [ - "463", - "Tyrone", - "Coffey", - "80705", - "Albania" - ], - [ - "464", - "Alea", - "Delaney", - "E4S 4K4", - "Guyana" - ], - [ - "465", - "Dominique", - "Schwartz", - "81368", - "Falkland Islands (Malvinas)" - ], - [ - "466", - "Benedict", - "Norton", - "D1C 9C8", - "Cyprus" - ], - [ - "467", - "Vaughan", - "Stein", - "R7K 1L8", - "Egypt" - ], - [ - "468", - "Charles", - "Foley", - "20434", - "Anguilla" - ], - [ - "469", - "Arden", - "Ramos", - "54065", - "Gibraltar" - ], - [ - "470", - "Dillon", - "Patel", - "L6H 1H6", - "Liberia" - ], - [ - "471", - "Gretchen", - "Davenport", - "57188", - "Equatorial Guinea" - ], - [ - "472", - "Ivy", - "Randall", - "52617", - "Costa Rica" - ], - [ - "473", - "Brett", - "Baird", - "45791", - "Hungary" - ], - [ - "474", - "Wyoming", - "Sparks", - "11266", - "Luxembourg" - ], - [ - "475", - "Rashad", - "Roy", - "47012", - "Guam" - ], - [ - "476", - "Sopoline", - "Le", - "M1G 2P8", - "United Arab Emirates" - ], - [ - "477", - "Ursa", - "Haynes", - "53774", - "British Indian Ocean Territory" - ], - [ - "478", - "Maia", - "Vincent", - "26773", - "New Caledonia" - ], - [ - "479", - "Salvador", - "Pace", - "S9E 2C4", - "Egypt" - ], - [ - "480", - "Bethany", - "Wilcox", - "F2H 7N0", - "Uzbekistan" - ], - [ - "481", - "Sara", - "Brooks", - "08176", - "Holy See (Vatican City State)" - ], - [ - "482", - "Lillith", - "Sampson", - "75576", - "British Indian Ocean Territory" - ], - [ - "483", - "Brynne", - "Browning", - "N4K 7P6", - "Peru" - ], - [ - "484", - "Beck", - "Tran", - "06815", - "Cambodia" - ], - [ - "485", - "Peter", - "Hurley", - "05770", - "Rwanda" - ], - [ - "486", - "Buffy", - "Sharpe", - "H8F 8G6", - "Georgia" - ], - [ - "487", - "Harrison", - "Cross", - "Y1A 1R8", - "United Kingdom" - ], - [ - "488", - "Ursa", - "Wolf", - "J8C 9Q8", - "French Polynesia" - ], - [ - "489", - "Nayda", - "Vasquez", - "05523", - "Taiwan, Province of China" - ], - [ - "490", - "Gretchen", - "Walters", - "28628", - "Seychelles" - ], - [ - "491", - "Adrian", - "Hickman", - "17956", - "El Salvador" - ], - [ - "492", - "Laura", - "Moon", - "32103", - "Myanmar" - ], - [ - "493", - "Kellie", - "Barnett", - "L5Z 2U8", - "Saint Helena" - ], - [ - "494", - "Illana", - "Stanton", - "Z5D 2G0", - "Australia" - ], - [ - "495", - "Jescie", - "Santiago", - "D9L 4B5", - "Cambodia" - ], - [ - "496", - "Laura", - "Hopkins", - "X6V 9S5", - "Netherlands Antilles" - ], - [ - "497", - "Vielka", - "Harding", - "U6A 9T2", - "Cambodia" - ], - [ - "498", - "Walter", - "Gentry", - "L3X 9Q9", - "Slovenia" - ], - [ - "499", - "Sara", - "Atkinson", - "67146", - "Guinea" - ], - [ - "500", - "Yolanda", - "Chambers", - "Q8D 3W0", - "Zimbabwe" - ], - [ - "501", - "Josiah", - "Villarreal", - "I1V 6Y7", - "Burkina Faso" - ], - [ - "502", - "Hayfa", - "Bowman", - "77148", - "Saudi Arabia" - ], - [ - "503", - "Colette", - "Conley", - "41232", - "Estonia" - ], - [ - "504", - "Lana", - "Doyle", - "32962", - "Cuba" - ], - [ - "505", - "Keegan", - "Goodwin", - "M2P 1X3", - "Cocos (Keeling) Islands" - ], - [ - "506", - "Nina", - "Cross", - "49580", - "Germany" - ], - [ - "507", - "Xenos", - "Cervantes", - "K6X 7W8", - "Mauritius" - ], - [ - "508", - "Jared", - "Hester", - "30156", - "Uzbekistan" - ], - [ - "509", - "Damon", - "Curry", - "U2J 2D8", - "Pitcairn" - ], - [ - "510", - "Amery", - "Savage", - "O1S 2Z4", - "Turkmenistan" - ], - [ - "511", - "Brian", - "Wilkinson", - "J6O 4T0", - "Luxembourg" - ], - [ - "512", - "Ivory", - "Mckinney", - "L3E 8M2", - "Lithuania" - ], - [ - "513", - "Eric", - "Dalton", - "Y1L 6F4", - "Ethiopia" - ], - [ - "514", - "Brandon", - "Callahan", - "K6Q 9B4", - "Haiti" - ], - [ - "515", - "Phillip", - "Mclean", - "18836", - "Ethiopia" - ], - [ - "516", - "Carly", - "Greer", - "16811", - "Mayotte" - ], - [ - "517", - "Stone", - "Ware", - "58795", - "Moldova" - ], - [ - "518", - "Xena", - "Hayden", - "97158", - "Chad" - ], - [ - "519", - "Catherine", - "Leonard", - "77868", - "Azerbaijan" - ], - [ - "520", - "Bernard", - "Horton", - "04270", - "Yemen" - ], - [ - "521", - "Olga", - "Richmond", - "89169", - "Lebanon" - ], - [ - "522", - "Iris", - "Cummings", - "78836", - "Falkland Islands (Malvinas)" - ], - [ - "523", - "Beau", - "Mccall", - "78638", - "Monaco" - ], - [ - "524", - "Michael", - "Humphrey", - "Q1A 2W9", - "Tokelau" - ], - [ - "525", - "Oren", - "Stevens", - "F4V 9G7", - "Heard Island and Mcdonald Islands" - ], - [ - "526", - "Ima", - "Shelton", - "19295", - "Mozambique" - ], - [ - "527", - "Merritt", - "Morrison", - "K6W 5R0", - "Georgia" - ], - [ - "528", - "Vera", - "Cherry", - "54993", - "Angola" - ], - [ - "529", - "Grant", - "Turner", - "B4V 2J0", - "Saint Helena" - ], - [ - "530", - "Odette", - "Snyder", - "N9L 2V8", - "Chad" - ], - [ - "531", - "Uma", - "Stewart", - "E9A 6X9", - "Bhutan" - ], - [ - "532", - "Kylee", - "Best", - "11393", - "Malaysia" - ], - [ - "533", - "Nicholas", - "Mercado", - "85179", - "Switzerland" - ], - [ - "534", - "Nathaniel", - "Stuart", - "M1Q 6Z6", - "Mongolia" - ], - [ - "535", - "Ruth", - "Conrad", - "T7G 9V6", - "Guadeloupe" - ], - [ - "536", - "Deanna", - "Dudley", - "79721", - "Kiribati" - ], - [ - "537", - "David", - "Thornton", - "C6R 2G3", - "Netherlands Antilles" - ], - [ - "538", - "Jane", - "Ashley", - "48711", - "Rwanda" - ], - [ - "539", - "Nero", - "Curry", - "20590", - "Denmark" - ], - [ - "540", - "Kellie", - "Poole", - "46053", - "Martinique" - ], - [ - "541", - "Freya", - "Burch", - "W5R 8Y5", - "Northern Mariana Islands" - ], - [ - "542", - "Maxwell", - "Mcbride", - "D4W 4M3", - "Paraguay" - ], - [ - "543", - "Dawn", - "Sargent", - "85956", - "Gibraltar" - ], - [ - "544", - "Lilah", - "Matthews", - "J4D 8A9", - "Montserrat" - ], - [ - "545", - "Salvador", - "Burns", - "28067", - "Bhutan" - ], - [ - "546", - "Ezekiel", - "Ayala", - "67153", - "Wallis and Futuna" - ], - [ - "547", - "Evan", - "Barker", - "83026", - "Puerto Rico" - ], - [ - "548", - "Jemima", - "Case", - "U3S 7N6", - "Georgia" - ], - [ - "549", - "Belle", - "Mcconnell", - "H4S 9F8", - "Angola" - ], - [ - "550", - "Doris", - "Mays", - "57387", - "Tonga" - ], - [ - "551", - "Carson", - "Buchanan", - "20457", - "Guatemala" - ], - [ - "552", - "Calista", - "Lamb", - "26851", - "Gibraltar" - ], - [ - "553", - "Remedios", - "Haley", - "A9K 5M1", - "Tokelau" - ], - [ - "554", - "Odette", - "Mccarty", - "Y8B 3V4", - "Marshall Islands" - ], - [ - "555", - "Libby", - "Pugh", - "93261", - "Netherlands" - ], - [ - "556", - "Bo", - "Maldonado", - "C1H 1K7", - "Oman" - ], - [ - "557", - "Cameron", - "Beasley", - "41821", - "Northern Mariana Islands" - ], - [ - "558", - "Chadwick", - "Crosby", - "62855", - "New Caledonia" - ], - [ - "559", - "Steven", - "Barrett", - "92102", - "Pakistan" - ], - [ - "560", - "Jonas", - "Valdez", - "N3V 4R9", - "Bulgaria" - ], - [ - "561", - "Harlan", - "Larsen", - "Z8F 6A0", - "Cayman Islands" - ], - [ - "562", - "Iola", - "Joyner", - "D1J 4C3", - "Italy" - ], - [ - "563", - "Abra", - "Medina", - "Q9O 5J2", - "Cambodia" - ], - [ - "564", - "Solomon", - "Davidson", - "91317", - "Turkmenistan" - ], - [ - "565", - "Alisa", - "Kim", - "33036", - "Austria" - ], - [ - "566", - "Deacon", - "Silva", - "Z5L 6M0", - "Djibouti" - ], - [ - "567", - "Bree", - "Landry", - "43135", - "Czech Republic" - ], - [ - "568", - "Molly", - "Leach", - "71714", - "Botswana" - ], - [ - "569", - "Idona", - "Cain", - "A2J 1R8", - "South Georgia and The South Sandwich Islands" - ], - [ - "570", - "Aileen", - "Salinas", - "90344", - "Uzbekistan" - ], - [ - "571", - "Dominique", - "Cooper", - "31803", - "Sao Tome and Principe" - ], - [ - "572", - "Lunea", - "Pollard", - "S9R 7B0", - "Sweden" - ], - [ - "573", - "Leo", - "Combs", - "W7E 8T4", - "Ukraine" - ], - [ - "574", - "Illiana", - "Donovan", - "D8K 3R4", - "Palau" - ], - [ - "575", - "Orlando", - "Vaughan", - "Q4I 3E3", - "Bosnia and Herzegovina" - ], - [ - "576", - "Yuri", - "Blake", - "I9W 5U5", - "Seychelles" - ], - [ - "577", - "Amanda", - "Baldwin", - "19752", - "Turkmenistan" - ], - [ - "578", - "Hanna", - "Emerson", - "73316", - "Antigua and Barbuda" - ], - [ - "579", - "Xyla", - "Atkins", - "11151", - "Uganda" - ], - [ - "580", - "Nathaniel", - "Patterson", - "00391", - "Portugal" - ], - [ - "581", - "Naida", - "Cote", - "17484", - "Mauritius" - ], - [ - "582", - "Scarlett", - "Little", - "V8N 8A6", - "Sao Tome and Principe" - ], - [ - "583", - "Odessa", - "Kerr", - "56456", - "Sweden" - ], - [ - "584", - "Kamal", - "Richardson", - "F6S 4I1", - "Algeria" - ], - [ - "585", - "Griffith", - "Morton", - "I5H 2Z0", - "Vanuatu" - ], - [ - "586", - "Orli", - "Santana", - "48213", - "Burundi" - ], - [ - "587", - "Courtney", - "Cook", - "R3O 3A9", - "Cape Verde" - ], - [ - "588", - "Jolene", - "Wallace", - "F6Q 7W8", - "Zambia" - ], - [ - "589", - "Bert", - "Sharp", - "X7T 7Z8", - "Paraguay" - ], - [ - "590", - "Ila", - "Carver", - "E4M 7P4", - "Paraguay" - ], - [ - "591", - "Merrill", - "Wall", - "49416", - "Fiji" - ], - [ - "592", - "Hanae", - "Espinoza", - "Y6D 6K8", - "Turkey" - ], - [ - "593", - "Stephanie", - "Bond", - "Z1Q 3P3", - "Algeria" - ], - [ - "594", - "Lionel", - "Leonard", - "U8O 7G6", - "Nauru" - ], - [ - "595", - "Faith", - "Ramirez", - "75181", - "Slovakia" - ], - [ - "596", - "Fritz", - "Glass", - "62878", - "El Salvador" - ], - [ - "597", - "Raya", - "Gardner", - "L3E 2C7", - "India" - ], - [ - "598", - "Brynne", - "Price", - "W1S 6O9", - "Lithuania" - ], - [ - "599", - "Karen", - "Gray", - "O4X 8F6", - "Albania" - ], - [ - "600", - "Perry", - "Goodwin", - "44266", - "Libyan Arab Jamahiriya" - ], - [ - "601", - "Dylan", - "Glover", - "76573", - "Estonia" - ], - [ - "602", - "Melinda", - "Holloway", - "07861", - "Grenada" - ], - [ - "603", - "Rahim", - "Robinson", - "D7M 1E8", - "Madagascar" - ], - [ - "604", - "Ori", - "Oconnor", - "10386", - "Antarctica" - ], - [ - "605", - "Candace", - "Preston", - "03610", - "Denmark" - ], - [ - "606", - "Wing", - "Howe", - "E6U 3H2", - "Burundi" - ], - [ - "607", - "Lucy", - "Eaton", - "26436", - "Guinea" - ], - [ - "608", - "Ignatius", - "Blevins", - "93597", - "Serbia and Montenegro" - ], - [ - "609", - "Nadine", - "Franco", - "80096", - "Tonga" - ], - [ - "610", - "Shoshana", - "Walters", - "S4F 5O8", - "Micronesia" - ], - [ - "611", - "Remedios", - "Buckner", - "29213", - "Antigua and Barbuda" - ], - [ - "612", - "Adam", - "Horne", - "F8V 1V8", - "Oman" - ], - [ - "613", - "Kieran", - "Saunders", - "I7A 7Y5", - "Japan" - ], - [ - "614", - "Isabelle", - "Fletcher", - "K2K 3K5", - "Norway" - ], - [ - "615", - "Ryder", - "Ballard", - "38518", - "Tanzania, United Republic of" - ], - [ - "616", - "Nina", - "Guerrero", - "61142", - "Saint Kitts and Nevis" - ], - [ - "617", - "Sheila", - "Poole", - "E2H 6I6", - "Denmark" - ], - [ - "618", - "Melyssa", - "Mcdaniel", - "08247", - "Netherlands Antilles" - ], - [ - "619", - "Leila", - "Vang", - "Q5Z 3S1", - "United States Minor Outlying Islands" - ], - [ - "620", - "Grady", - "Aguilar", - "R1I 8I8", - "Slovenia" - ], - [ - "621", - "Plato", - "Terrell", - "23916", - "Kuwait" - ], - [ - "622", - "Rama", - "Perkins", - "56506", - "Russian Federation" - ], - [ - "623", - "Boris", - "Chaney", - "66737", - "Antigua and Barbuda" - ], - [ - "624", - "Edward", - "Clarke", - "30722", - "Iraq" - ], - [ - "625", - "Skyler", - "Wise", - "53248", - "Taiwan, Province of China" - ], - [ - "626", - "Uta", - "Cox", - "85242", - "Malawi" - ], - [ - "627", - "Lesley", - "Watkins", - "26710", - "Estonia" - ], - [ - "628", - "Gray", - "Harrison", - "C5L 9Y7", - "Nepal" - ], - [ - "629", - "Joan", - "Flores", - "J5Q 2B9", - "Tajikistan" - ], - [ - "630", - "Reece", - "Lott", - "85152", - "Algeria" - ], - [ - "631", - "Jerome", - "Faulkner", - "V1K 3N2", - "Kiribati" - ], - [ - "632", - "Jackson", - "Hudson", - "85932", - "Botswana" - ], - [ - "633", - "Uma", - "Booker", - "79755", - "Senegal" - ], - [ - "634", - "Katelyn", - "Gillespie", - "Q8P 4V9", - "Eritrea" - ], - [ - "635", - "Clio", - "Tillman", - "67552", - "Liberia" - ], - [ - "636", - "Anjolie", - "Nixon", - "36615", - "Botswana" - ], - [ - "637", - "Nell", - "Lee", - "T9S 4R3", - "French Southern Territories" - ], - [ - "638", - "Anthony", - "Aguirre", - "85443", - "Morocco" - ], - [ - "639", - "Aaron", - "Green", - "90326", - "Faroe Islands" - ], - [ - "640", - "Galvin", - "Yang", - "A4X 8H6", - "Ukraine" - ], - [ - "641", - "Yoshi", - "Strickland", - "52538", - "Brazil" - ], - [ - "642", - "Brenden", - "Kirkland", - "X7P 8V9", - "Turks and Caicos Islands" - ], - [ - "643", - "Bree", - "Stone", - "U4L 2H2", - "Hong Kong" - ], - [ - "644", - "Quin", - "Tanner", - "U4A 1X4", - "Faroe Islands" - ], - [ - "645", - "Camilla", - "Heath", - "91749", - "Andorra" - ], - [ - "646", - "Xaviera", - "Bullock", - "I4U 7W0", - "Libyan Arab Jamahiriya" - ], - [ - "647", - "Kay", - "Rowe", - "59689", - "Iceland" - ], - [ - "648", - "Lance", - "Bond", - "66558", - "Spain" - ], - [ - "649", - "Fredericka", - "Langley", - "48782", - "Cayman Islands" - ], - [ - "650", - "Charles", - "Avila", - "42037", - "Papua New Guinea" - ], - [ - "651", - "Ramona", - "Rios", - "T5M 3E1", - "Argentina" - ], - [ - "652", - "Ezekiel", - "Young", - "W8X 4S7", - "French Polynesia" - ], - [ - "653", - "Celeste", - "Dodson", - "19140", - "Benin" - ], - [ - "654", - "Frances", - "Mcintosh", - "91246", - "Swaziland" - ], - [ - "655", - "Deanna", - "Hyde", - "J8P 3T5", - "Croatia" - ], - [ - "656", - "Dahlia", - "Blair", - "45364", - "Kazakhstan" - ], - [ - "657", - "Jade", - "Hayes", - "I5Q 3S9", - "Malawi" - ], - [ - "658", - "Robin", - "Bullock", - "G9Q 2P8", - "Ireland" - ], - [ - "659", - "Nasim", - "Bond", - "I2V 8N4", - "Macedonia" - ], - [ - "660", - "Axel", - "Pickett", - "18370", - "Saint Vincent and The Grenadines" - ], - [ - "661", - "Pearl", - "Lee", - "G1R 3R8", - "Poland" - ], - [ - "662", - "Garth", - "Meyers", - "90308", - "Georgia" - ], - [ - "663", - "Ivory", - "Rios", - "S8F 8R5", - "Mexico" - ], - [ - "664", - "Jerome", - "Lambert", - "N1Q 6R8", - "Saint Lucia" - ], - [ - "665", - "Meredith", - "Clark", - "27720", - "Cocos (Keeling) Islands" - ], - [ - "666", - "Armando", - "Holcomb", - "M6D 4X0", - "Oman" - ], - [ - "667", - "Rowan", - "Page", - "00307", - "Nauru" - ], - [ - "668", - "Kyla", - "Brown", - "F4W 4C5", - "Holy See (Vatican City State)" - ], - [ - "669", - "Leigh", - "Sosa", - "28499", - "Uruguay" - ], - [ - "670", - "Shafira", - "Forbes", - "26526", - "Honduras" - ], - [ - "671", - "Maxine", - "Mueller", - "90923", - "Kazakhstan" - ], - [ - "672", - "Joy", - "Sargent", - "K6T 3W5", - "Malawi" - ], - [ - "673", - "Lamar", - "Roberts", - "R5F 9C8", - "Poland" - ], - [ - "674", - "Madonna", - "Love", - "15514", - "Cyprus" - ], - [ - "675", - "Uriel", - "Ware", - "Z6V 5J1", - "Singapore" - ], - [ - "676", - "Bevis", - "Erickson", - "M3X 9M8", - "Brunei Darussalam" - ], - [ - "677", - "Grant", - "Velasquez", - "96942", - "Antarctica" - ], - [ - "678", - "Lars", - "Bullock", - "14772", - "Guyana" - ], - [ - "679", - "Maryam", - "Jones", - "01854", - "Togo" - ], - [ - "680", - "Blythe", - "Goodwin", - "51731", - "New Caledonia" - ], - [ - "681", - "Kane", - "Wiggins", - "55727", - "Kiribati" - ], - [ - "682", - "Brian", - "Rosales", - "25896", - "Cape Verde" - ], - [ - "683", - "Blaze", - "Leach", - "P6J 3E5", - "Northern Mariana Islands" - ], - [ - "684", - "Cameron", - "Neal", - "82248", - "Marshall Islands" - ], - [ - "685", - "Lydia", - "Cunningham", - "Q1V 8P7", - "San Marino" - ], - [ - "686", - "Troy", - "Cook", - "32106", - "British Indian Ocean Territory" - ], - [ - "687", - "Alexander", - "Valenzuela", - "S8Z 6B2", - "Guadeloupe" - ], - [ - "688", - "Garth", - "Beck", - "46344", - "Cook Islands" - ], - [ - "689", - "Hillary", - "Nunez", - "29462", - "Sri Lanka" - ], - [ - "690", - "Hunter", - "Sawyer", - "W9M 6T4", - "Saint Lucia" - ], - [ - "691", - "Jaquelyn", - "Everett", - "T1X 2U2", - "Guinea-bissau" - ], - [ - "692", - "Indira", - "Ortega", - "43047", - "Italy" - ], - [ - "693", - "Josiah", - "Hinton", - "N5F 5Y8", - "Andorra" - ], - [ - "694", - "Bruno", - "Gay", - "E3U 3D9", - "Palau" - ], - [ - "695", - "Melissa", - "Blackburn", - "S4V 1K2", - "Virgin Islands, U.S." - ], - [ - "696", - "Zeus", - "Dawson", - "K5S 6Z6", - "Belgium" - ], - [ - "697", - "Castor", - "Mcmahon", - "H3R 1O8", - "Cambodia" - ], - [ - "698", - "Elizabeth", - "Beasley", - "98178", - "Northern Mariana Islands" - ], - [ - "699", - "Jescie", - "Lee", - "08056", - "Eritrea" - ], - [ - "700", - "Dennis", - "Chapman", - "T4O 1Q2", - "Bangladesh" - ], - [ - "701", - "Basia", - "Wallace", - "U3Y 7C1", - "Pitcairn" - ], - [ - "702", - "Dante", - "Brewer", - "53544", - "Bosnia and Herzegovina" - ], - [ - "703", - "Adrienne", - "Glenn", - "32378", - "Austria" - ], - [ - "704", - "Kellie", - "Acevedo", - "51723", - "Italy" - ], - [ - "705", - "Scarlet", - "Mclaughlin", - "43509", - "Kiribati" - ], - [ - "706", - "Lillith", - "Mullins", - "S6L 4Y6", - "Kyrgyzstan" - ], - [ - "707", - "Maxine", - "Atkins", - "Z5T 5R5", - "Denmark" - ], - [ - "708", - "Nicholas", - "Rose", - "40286", - "Macedonia" - ], - [ - "709", - "Zenia", - "Pugh", - "28682", - "Venezuela" - ], - [ - "710", - "Keely", - "Turner", - "34939", - "New Zealand" - ], - [ - "711", - "Maisie", - "Walton", - "S6M 5C5", - "Cameroon" - ], - [ - "712", - "Michelle", - "Salinas", - "T7A 9N6", - "Nicaragua" - ], - [ - "713", - "Reece", - "Clements", - "73923", - "Austria" - ], - [ - "714", - "Eliana", - "Fox", - "V3Y 5T4", - "Denmark" - ], - [ - "715", - "Kennedy", - "Mullins", - "43213", - "Virgin Islands, British" - ], - [ - "716", - "Alea", - "Glover", - "M6P 3Z5", - "Turkmenistan" - ], - [ - "717", - "Scarlett", - "Hunt", - "41461", - "Montserrat" - ], - [ - "718", - "Rooney", - "Kane", - "T8A 3E2", - "Madagascar" - ], - [ - "719", - "Cairo", - "Ray", - "L6M 1E7", - "Canada" - ], - [ - "720", - "Wendy", - "Burks", - "R8V 8F5", - "Virgin Islands, U.S." - ], - [ - "721", - "Christine", - "Suarez", - "67369", - "Georgia" - ], - [ - "722", - "Graiden", - "Le", - "K4M 9V5", - "New Caledonia" - ], - [ - "723", - "Zane", - "Nunez", - "60548", - "Haiti" - ], - [ - "724", - "Ali", - "Bell", - "U4Y 4C3", - "Togo" - ], - [ - "725", - "Marsden", - "Leon", - "39374", - "Venezuela" - ], - [ - "726", - "Holmes", - "Kidd", - "B6K 7Q9", - "Iraq" - ], - [ - "727", - "Cameron", - "Gardner", - "88627", - "Brazil" - ], - [ - "728", - "Ava", - "George", - "K1Z 7Y2", - "Monaco" - ], - [ - "729", - "Chantale", - "Holland", - "H1B 9L8", - "Afghanistan" - ], - [ - "730", - "Alika", - "Middleton", - "W8X 7O1", - "Korea" - ], - [ - "731", - "Cameran", - "Zimmerman", - "78576", - "Benin" - ], - [ - "732", - "Barrett", - "Blair", - "51161", - "Virgin Islands, U.S." - ], - [ - "733", - "Brielle", - "Ballard", - "59538", - "Iceland" - ], - [ - "734", - "Teagan", - "Morales", - "40107", - "Kenya" - ], - [ - "735", - "Lunea", - "Cantu", - "14690", - "Oman" - ], - [ - "736", - "Robin", - "Gilmore", - "17972", - "Nauru" - ], - [ - "737", - "Hall", - "Mccarty", - "86141", - "China" - ], - [ - "738", - "Olga", - "Rasmussen", - "58309", - "Virgin Islands, British" - ], - [ - "739", - "Mark", - "Griffin", - "51542", - "Argentina" - ], - [ - "740", - "Medge", - "Carrillo", - "23192", - "Pitcairn" - ], - [ - "741", - "Susan", - "Mosley", - "32128", - "Turkmenistan" - ], - [ - "742", - "Zelda", - "Valdez", - "46831", - "New Caledonia" - ], - [ - "743", - "Ruth", - "Donaldson", - "F9I 7G7", - "Ukraine" - ], - [ - "744", - "Kirby", - "Workman", - "36679", - "Rwanda" - ], - [ - "745", - "Alexa", - "King", - "66513", - "Liberia" - ], - [ - "746", - "Ronan", - "Gross", - "K2S 6D0", - "Saint Lucia" - ], - [ - "747", - "Kylee", - "Dillon", - "P7Y 1I5", - "Faroe Islands" - ], - [ - "748", - "Brenda", - "Weaver", - "99365", - "Uzbekistan" - ], - [ - "749", - "Aristotle", - "Orr", - "43451", - "Canada" - ], - [ - "750", - "Jaquelyn", - "Tyler", - "B9Q 7P5", - "Brunei Darussalam" - ], - [ - "751", - "Madeline", - "Stewart", - "D4D 2J4", - "Zimbabwe" - ], - [ - "752", - "Lacota", - "Glass", - "89124", - "Israel" - ], - [ - "753", - "Adrian", - "Ashley", - "N8M 4L1", - "Sri Lanka" - ], - [ - "754", - "Ignatius", - "Waller", - "12053", - "Thailand" - ], - [ - "755", - "Raven", - "Stevens", - "88768", - "Estonia" - ], - [ - "756", - "Carly", - "Camacho", - "27075", - "Vanuatu" - ], - [ - "757", - "Lee", - "Calderon", - "19501", - "Pitcairn" - ], - [ - "758", - "Amos", - "Briggs", - "I6A 3L8", - "Saint Kitts and Nevis" - ], - [ - "759", - "Cheryl", - "Valencia", - "90517", - "Denmark" - ], - [ - "760", - "Kenyon", - "Franco", - "B2S 2E2", - "Western Sahara" - ], - [ - "761", - "Damian", - "Acosta", - "A2S 6D0", - "Bahamas" - ], - [ - "762", - "Brenda", - "Zamora", - "T9E 7L3", - "Finland" - ], - [ - "763", - "Connor", - "Atkinson", - "03975", - "Sierra Leone" - ], - [ - "764", - "Kaseem", - "Waters", - "A2K 2X0", - "China" - ], - [ - "765", - "Zephania", - "Whitfield", - "A4Z 9P7", - "Eritrea" - ], - [ - "766", - "Emmanuel", - "Ballard", - "G1M 6Y2", - "Finland" - ], - [ - "767", - "Amos", - "Walters", - "43184", - "Oman" - ], - [ - "768", - "Urielle", - "Browning", - "19959", - "Panama" - ], - [ - "769", - "TaShya", - "Summers", - "B9V 3Y3", - "Micronesia" - ], - [ - "770", - "Jermaine", - "Mcgee", - "X8A 4E1", - "Cape Verde" - ], - [ - "771", - "Chaney", - "Berry", - "G2H 2C8", - "Uganda" - ], - [ - "772", - "Jaime", - "May", - "49723", - "Eritrea" - ], - [ - "773", - "Olga", - "Cohen", - "13403", - "Macao" - ], - [ - "774", - "Jacob", - "Vaughn", - "U7G 1V5", - "Greece" - ], - [ - "775", - "Kelly", - "Mcdonald", - "Z3B 5G7", - "Kiribati" - ], - [ - "776", - "Emi", - "Gilbert", - "W1L 2M4", - "Nicaragua" - ], - [ - "777", - "Francis", - "Nunez", - "K4U 6M5", - "Lithuania" - ], - [ - "778", - "Noel", - "Nelson", - "Z5T 1Y0", - "Nauru" - ], - [ - "779", - "Ora", - "Ellison", - "Y5I 4R8", - "Burundi" - ], - [ - "780", - "Kirby", - "Glass", - "J5X 2E3", - "Argentina" - ], - [ - "781", - "Hayley", - "Tate", - "V1T 6B6", - "Greece" - ], - [ - "782", - "Mohammad", - "Leblanc", - "E3S 5R3", - "Oman" - ], - [ - "783", - "Lionel", - "Todd", - "A1Z 9E1", - "Macedonia" - ], - [ - "784", - "Courtney", - "Mckay", - "D4I 8Z3", - "Fiji" - ], - [ - "785", - "Reagan", - "West", - "84159", - "Equatorial Guinea" - ], - [ - "786", - "Noel", - "Strickland", - "Q7K 6S3", - "Mozambique" - ], - [ - "787", - "Lara", - "Porter", - "49872", - "Nigeria" - ], - [ - "788", - "Kyra", - "Haley", - "I9E 2K3", - "Dominican Republic" - ], - [ - "789", - "Wynter", - "Beasley", - "66330", - "Heard Island and Mcdonald Islands" - ], - [ - "790", - "Vladimir", - "Briggs", - "99538", - "Burkina Faso" - ], - [ - "791", - "Rafael", - "Campbell", - "V8L 2S6", - "Algeria" - ], - [ - "792", - "Buffy", - "Wilder", - "N3U 2X0", - "Bahrain" - ], - [ - "793", - "Nyssa", - "Dawson", - "38434", - "Spain" - ], - [ - "794", - "Sylvia", - "Swanson", - "39714", - "Azerbaijan" - ], - [ - "795", - "Jolie", - "Diaz", - "A1J 5I1", - "Cuba" - ], - [ - "796", - "Rosalyn", - "Mcdaniel", - "F3T 6E2", - "Benin" - ], - [ - "797", - "Nelle", - "Prince", - "K1M 4U6", - "Maldives" - ], - [ - "798", - "Luke", - "Knight", - "05930", - "Seychelles" - ], - [ - "799", - "Macaulay", - "Conway", - "79707", - "American Samoa" - ], - [ - "800", - "Freya", - "Webb", - "U2H 2D7", - "Ireland" - ], - [ - "801", - "Clinton", - "Meyers", - "S9I 7N2", - "Malta" - ], - [ - "802", - "Rudyard", - "Chandler", - "40347", - "Bahrain" - ], - [ - "803", - "Courtney", - "Hoover", - "12325", - "French Polynesia" - ], - [ - "804", - "Melissa", - "Davenport", - "K7P 1S8", - "Canada" - ], - [ - "805", - "Noelle", - "Nieves", - "87427", - "Martinique" - ], - [ - "806", - "Myles", - "Hart", - "V6T 1W0", - "Niue" - ], - [ - "807", - "Jasper", - "Campos", - "78143", - "Faroe Islands" - ], - [ - "808", - "Ariana", - "Valentine", - "J4X 2D4", - "Ecuador" - ], - [ - "809", - "Vanna", - "Fletcher", - "M4Z 1F9", - "Faroe Islands" - ], - [ - "810", - "Elijah", - "Harper", - "Y1B 7E4", - "New Zealand" - ], - [ - "811", - "Leilani", - "Nunez", - "K9W 4F0", - "United Arab Emirates" - ], - [ - "812", - "Maia", - "Huber", - "V4L 8M6", - "United Kingdom" - ], - [ - "813", - "Richard", - "Riddle", - "U8C 8Q2", - "Niue" - ], - [ - "814", - "Harper", - "Blanchard", - "10904", - "Cameroon" - ], - [ - "815", - "Aurelia", - "Trujillo", - "01646", - "Dominican Republic" - ], - [ - "816", - "Anthony", - "Owen", - "J2I 2B4", - "Palestinian Territory, Occupied" - ], - [ - "817", - "Kelsie", - "Roy", - "M3J 6K3", - "Maldives" - ], - [ - "818", - "James", - "Pearson", - "94810", - "Mexico" - ], - [ - "819", - "Igor", - "Marshall", - "Y8M 2D6", - "Palau" - ], - [ - "820", - "Aquila", - "Willis", - "20354", - "Samoa" - ], - [ - "821", - "Randall", - "Sheppard", - "73577", - "Sierra Leone" - ], - [ - "822", - "Gray", - "Myers", - "53651", - "Gibraltar" - ], - [ - "823", - "Dana", - "Camacho", - "89571", - "Reunion" - ], - [ - "824", - "Berk", - "Hopper", - "17794", - "Cook Islands" - ], - [ - "825", - "Shannon", - "Barry", - "70536", - "Bouvet Island" - ], - [ - "826", - "Dahlia", - "Herman", - "F8L 1Q3", - "Lesotho" - ], - [ - "827", - "Gillian", - "Hayes", - "O2C 7X8", - "Tajikistan" - ], - [ - "828", - "Leo", - "Bolton", - "P6V 6E1", - "Dominica" - ], - [ - "829", - "Vivien", - "Best", - "E5E 6N8", - "Cuba" - ], - [ - "830", - "Clayton", - "Bradley", - "E7R 3M5", - "Zimbabwe" - ], - [ - "831", - "Lesley", - "Collins", - "16592", - "Mali" - ], - [ - "832", - "Holly", - "Hensley", - "49080", - "Tunisia" - ], - [ - "833", - "Larissa", - "Velazquez", - "41068", - "Haiti" - ], - [ - "834", - "Delilah", - "Mejia", - "A5I 9Q9", - "Croatia" - ], - [ - "835", - "Drew", - "Roberson", - "U7E 3R1", - "Somalia" - ], - [ - "836", - "Jenette", - "Patel", - "64084", - "Denmark" - ], - [ - "837", - "Gillian", - "Cleveland", - "05659", - "Syrian Arab Republic" - ], - [ - "838", - "Noelle", - "Lara", - "U1N 6V6", - "Sri Lanka" - ], - [ - "839", - "Celeste", - "Rollins", - "26590", - "Mayotte" - ], - [ - "840", - "Elvis", - "Fletcher", - "M8V 6J4", - "Bahamas" - ], - [ - "841", - "Caesar", - "Hays", - "E3D 3T7", - "Malta" - ], - [ - "842", - "Rama", - "Weber", - "25880", - "Malta" - ], - [ - "843", - "Lael", - "Page", - "57135", - "Anguilla" - ], - [ - "844", - "Omar", - "Hammond", - "90213", - "Belarus" - ], - [ - "845", - "Simone", - "Mcintosh", - "L5P 1S0", - "Bhutan" - ], - [ - "846", - "Gay", - "Harper", - "56404", - "Virgin Islands, U.S." - ], - [ - "847", - "Joel", - "Holman", - "C1F 1C4", - "Saint Lucia" - ], - [ - "848", - "Clayton", - "Pennington", - "57003", - "Kazakhstan" - ], - [ - "849", - "Susan", - "Mckee", - "I5U 8F2", - "Taiwan, Province of China" - ], - [ - "850", - "Jenna", - "Stein", - "P2K 6L4", - "Reunion" - ], - [ - "851", - "Madonna", - "Joyner", - "Q4Q 4K6", - "Guadeloupe" - ], - [ - "852", - "Deirdre", - "Ingram", - "N7U 3N9", - "Monaco" - ], - [ - "853", - "Juliet", - "Hodges", - "U2Q 2T0", - "Uzbekistan" - ], - [ - "854", - "Naomi", - "Rice", - "O6T 2Z1", - "Nicaragua" - ], - [ - "855", - "Leila", - "Alvarado", - "Z2V 7L3", - "Suriname" - ], - [ - "856", - "George", - "Leon", - "L6M 1V2", - "Norway" - ], - [ - "857", - "Rama", - "Cruz", - "Y2S 7K6", - "Kenya" - ], - [ - "858", - "Clarke", - "Mckinney", - "34622", - "Viet Nam" - ], - [ - "859", - "Savannah", - "Bailey", - "L3O 1U6", - "Solomon Islands" - ], - [ - "860", - "Maxwell", - "Gibson", - "R9K 9Q1", - "Virgin Islands, British" - ], - [ - "861", - "Devin", - "Humphrey", - "74821", - "Costa Rica" - ], - [ - "862", - "Kadeem", - "Larsen", - "43178", - "Luxembourg" - ], - [ - "863", - "Elvis", - "Todd", - "O3O 3G9", - "Azerbaijan" - ], - [ - "864", - "Levi", - "Montoya", - "G1Y 1N8", - "Venezuela" - ], - [ - "865", - "Risa", - "Barnes", - "86118", - "Benin" - ], - [ - "866", - "Dillon", - "Riggs", - "O3Y 8V2", - "Greenland" - ], - [ - "867", - "Stewart", - "Marshall", - "V8G 8S2", - "Mexico" - ], - [ - "868", - "Camden", - "Goff", - "N3W 2L0", - "Bahrain" - ], - [ - "869", - "Sheila", - "Meadows", - "T6K 7M2", - "Yemen" - ], - [ - "870", - "Hop", - "Berger", - "Q8B 9R7", - "Germany" - ], - [ - "871", - "Charissa", - "Wilkerson", - "08090", - "Burundi" - ], - [ - "872", - "Raphael", - "Carey", - "03667", - "United Kingdom" - ], - [ - "873", - "Micah", - "Hood", - "T9N 4T5", - "Georgia" - ], - [ - "874", - "Cathleen", - "Mccall", - "N6H 6N3", - "Tanzania, United Republic of" - ], - [ - "875", - "Lisandra", - "Poole", - "S7O 1J1", - "Greece" - ], - [ - "876", - "Stone", - "Blackwell", - "90654", - "Serbia and Montenegro" - ], - [ - "877", - "Serena", - "Mann", - "32305", - "Trinidad and Tobago" - ], - [ - "878", - "Scarlet", - "Turner", - "D7Y 8N4", - "Oman" - ], - [ - "879", - "Zenaida", - "Carrillo", - "60361", - "Montserrat" - ], - [ - "880", - "Jaime", - "Dalton", - "F4E 6R5", - "Iraq" - ], - [ - "881", - "Wesley", - "Drake", - "D8J 9U2", - "Bulgaria" - ], - [ - "882", - "Armand", - "Chandler", - "X8Z 9E6", - "Saint Kitts and Nevis" - ], - [ - "883", - "Inez", - "Dillard", - "59975", - "Eritrea" - ], - [ - "884", - "Roanna", - "Floyd", - "65958", - "Bolivia" - ], - [ - "885", - "Timon", - "Dalton", - "O3Q 5B5", - "Colombia" - ], - [ - "886", - "Ifeoma", - "Lamb", - "J9A 9X0", - "Papua New Guinea" - ], - [ - "887", - "Brody", - "Cash", - "75525", - "Kazakhstan" - ], - [ - "888", - "Dawn", - "Wise", - "G7X 5J3", - "Samoa" - ], - [ - "889", - "Chaney", - "Bartlett", - "11112", - "Ecuador" - ], - [ - "890", - "Galvin", - "Merritt", - "59635", - "Bahrain" - ], - [ - "891", - "Cynthia", - "Nash", - "U5P 1H4", - "Switzerland" - ], - [ - "892", - "Tara", - "Austin", - "Q6X 8U0", - "Burundi" - ], - [ - "893", - "Roanna", - "Petty", - "28524", - "Northern Mariana Islands" - ], - [ - "894", - "Palmer", - "Mcdowell", - "78234", - "United States Minor Outlying Islands" - ], - [ - "895", - "Sade", - "Patton", - "28984", - "Czech Republic" - ], - [ - "896", - "Yoko", - "Compton", - "62165", - "Saint Kitts and Nevis" - ], - [ - "897", - "Regan", - "Mccarthy", - "C5D 6G0", - "Lebanon" - ], - [ - "898", - "Norman", - "Nixon", - "E4C 4G0", - "Virgin Islands, U.S." - ], - [ - "899", - "Jocelyn", - "Baldwin", - "X9R 2B3", - "Macedonia" - ], - [ - "900", - "Jaquelyn", - "Berg", - "N6X 6E1", - "Saint Lucia" - ], - [ - "901", - "Zane", - "Nelson", - "G9P 4J8", - "Macao" - ], - [ - "902", - "Judith", - "Elliott", - "R4I 4O3", - "Iraq" - ], - [ - "903", - "Maia", - "Ellis", - "S9V 6P0", - "Bahrain" - ], - [ - "904", - "Mechelle", - "Stevens", - "43406", - "Bouvet Island" - ], - [ - "905", - "Sylvester", - "Duran", - "K5D 8W5", - "Costa Rica" - ], - [ - "906", - "Unity", - "Cooke", - "64362", - "Ecuador" - ], - [ - "907", - "Karly", - "Velazquez", - "43286", - "Guam" - ], - [ - "908", - "Damian", - "Yates", - "84910", - "Thailand" - ], - [ - "909", - "Linus", - "Gross", - "31808", - "Israel" - ], - [ - "910", - "Cooper", - "Franco", - "36700", - "Yemen" - ], - [ - "911", - "Gail", - "Jones", - "09157", - "Turkey" - ], - [ - "912", - "Hayfa", - "Bennett", - "59422", - "France" - ], - [ - "913", - "Hermione", - "Barber", - "I6W 8Z5", - "Mozambique" - ], - [ - "914", - "Hedy", - "Stevens", - "35535", - "Cuba" - ], - [ - "915", - "Galvin", - "Frederick", - "J2W 9A3", - "Virgin Islands, British" - ], - [ - "916", - "Lamar", - "Rush", - "P4O 3H4", - "Austria" - ], - [ - "917", - "Brenda", - "Walter", - "K8Q 9H9", - "Tajikistan" - ], - [ - "918", - "Ria", - "Guy", - "12801", - "Gibraltar" - ], - [ - "919", - "Bruno", - "Lynch", - "I6U 7D0", - "Greenland" - ], - [ - "920", - "Kirk", - "Pearson", - "66242", - "Falkland Islands (Malvinas)" - ], - [ - "921", - "Owen", - "Sosa", - "61483", - "Martinique" - ], - [ - "922", - "Rajah", - "Mccarty", - "G9K 6L2", - "Faroe Islands" - ], - [ - "923", - "Erasmus", - "Malone", - "D6H 7H5", - "Sierra Leone" - ], - [ - "924", - "Raja", - "Hale", - "85590", - "Guadeloupe" - ], - [ - "925", - "Logan", - "Christensen", - "Y6L 8Z0", - "Guatemala" - ], - [ - "926", - "Kirestin", - "Griffith", - "47900", - "Micronesia" - ], - [ - "927", - "Kato", - "Reeves", - "93779", - "Uruguay" - ], - [ - "928", - "Jonah", - "Suarez", - "13708", - "Spain" - ], - [ - "929", - "Adam", - "Lynn", - "E1P 1L3", - "Indonesia" - ], - [ - "930", - "Quinn", - "Mckinney", - "99683", - "Faroe Islands" - ], - [ - "931", - "Whilemina", - "Macias", - "32145", - "Iceland" - ], - [ - "932", - "Gillian", - "Osborne", - "L3L 6G0", - "Italy" - ], - [ - "933", - "Venus", - "Zamora", - "28318", - "Comoros" - ], - [ - "934", - "Allegra", - "Eaton", - "P5X 9S0", - "Antarctica" - ], - [ - "935", - "Driscoll", - "Preston", - "R3L 9R0", - "Niue" - ], - [ - "936", - "Joel", - "Spencer", - "12006", - "Monaco" - ], - [ - "937", - "Lucius", - "Sharp", - "B8V 6U7", - "Dominica" - ], - [ - "938", - "Curran", - "Robinson", - "82216", - "Romania" - ], - [ - "939", - "Kerry", - "Espinoza", - "N4B 7Q1", - "Guatemala" - ], - [ - "940", - "Isaac", - "Kline", - "85674", - "Costa Rica" - ], - [ - "941", - "Neil", - "Harrison", - "I5A 2S2", - "Greenland" - ], - [ - "942", - "Ezra", - "Rodriguez", - "D6P 5Q3", - "Angola" - ], - [ - "943", - "Galvin", - "Jefferson", - "D6H 7G0", - "Macedonia" - ], - [ - "944", - "Joseph", - "Hahn", - "Z8V 9B5", - "Uganda" - ], - [ - "945", - "Naida", - "Hammond", - "40105", - "Philippines" - ], - [ - "946", - "Brenna", - "Everett", - "41704", - "Indonesia" - ], - [ - "947", - "Rae", - "Parks", - "79077", - "Sweden" - ], - [ - "948", - "Jessica", - "Richard", - "Y3I 5R3", - "Uganda" - ], - [ - "949", - "Rachel", - "Marks", - "16157", - "Cameroon" - ], - [ - "950", - "Maxwell", - "Ferguson", - "V6A 6M0", - "Ukraine" - ], - [ - "951", - "Alyssa", - "Beard", - "13936", - "Antarctica" - ], - [ - "952", - "Camille", - "Gill", - "V9Q 9P7", - "New Caledonia" - ], - [ - "953", - "Cora", - "Bond", - "M9X 1A4", - "Seychelles" - ], - [ - "954", - "Peter", - "Acosta", - "07937", - "Chile" - ], - [ - "955", - "Ella", - "Poole", - "A3F 9Z1", - "Panama" - ], - [ - "956", - "Ashely", - "Guerrero", - "37436", - "Central African Republic" - ], - [ - "957", - "Mikayla", - "Johnston", - "L9W 5T8", - "Cameroon" - ], - [ - "958", - "Ora", - "Weaver", - "65897", - "Turks and Caicos Islands" - ], - [ - "959", - "Timon", - "Barnes", - "R6J 1J7", - "Djibouti" - ], - [ - "960", - "Jamalia", - "Wade", - "22211", - "United States" - ], - [ - "961", - "Bradley", - "Haney", - "K1H 1Q1", - "Western Sahara" - ], - [ - "962", - "Lance", - "Le", - "H4R 9T7", - "Botswana" - ], - [ - "963", - "Ethan", - "Rich", - "T8N 1C6", - "Netherlands" - ], - [ - "964", - "Jeanette", - "Carver", - "G1E 5C8", - "Cook Islands" - ], - [ - "965", - "Ocean", - "Marquez", - "15084", - "Pakistan" - ], - [ - "966", - "Ifeoma", - "Cleveland", - "R9D 6M1", - "French Guiana" - ], - [ - "967", - "Sylvia", - "Herring", - "U4R 8P1", - "Thailand" - ], - [ - "968", - "Clare", - "Huffman", - "Q5G 2Q0", - "Niger" - ], - [ - "969", - "Colton", - "Leach", - "V3F 9W6", - "Syrian Arab Republic" - ], - [ - "970", - "Maryam", - "Hoover", - "Y7U 6N3", - "Slovakia" - ], - [ - "971", - "Nola", - "Snider", - "54275", - "Bosnia and Herzegovina" - ], - [ - "972", - "Kameko", - "Cote", - "M3C 8N0", - "Cambodia" - ], - [ - "973", - "Julian", - "Pugh", - "B6E 7J7", - "Mauritania" - ], - [ - "974", - "Xena", - "Lott", - "52294", - "Estonia" - ], - [ - "975", - "Fuller", - "Kirk", - "65396", - "Qatar" - ], - [ - "976", - "Lance", - "Knox", - "78074", - "Serbia and Montenegro" - ], - [ - "977", - "Hedwig", - "Beck", - "T5P 4C8", - "Dominican Republic" - ], - [ - "978", - "Martena", - "Diaz", - "65420", - "Saint Pierre and Miquelon" - ], - [ - "979", - "Shafira", - "David", - "74843", - "Senegal" - ], - [ - "980", - "Shafira", - "Clark", - "T6F 5C7", - "Mongolia" - ], - [ - "981", - "Georgia", - "Booth", - "28183", - "Japan" - ], - [ - "982", - "Cameron", - "Austin", - "I2J 1R1", - "Bahrain" - ], - [ - "983", - "Vanna", - "Hyde", - "82434", - "Croatia" - ], - [ - "984", - "Deanna", - "Park", - "68486", - "Zimbabwe" - ], - [ - "985", - "Grady", - "Freeman", - "U4O 1Q9", - "Belarus" - ], - [ - "986", - "Sandra", - "Knapp", - "31413", - "Sudan" - ], - [ - "987", - "Dorian", - "Joseph", - "90768", - "Lithuania" - ], - [ - "988", - "Adria", - "Bonner", - "15899", - "Mongolia" - ], - [ - "989", - "Sebastian", - "Guzman", - "G9L 9G5", - "Yemen" - ], - [ - "990", - "Angelica", - "Puckett", - "W8D 8W8", - "Virgin Islands, U.S." - ], - [ - "991", - "Connor", - "Parks", - "26175", - "Virgin Islands, U.S." - ], - [ - "992", - "Yardley", - "Griffith", - "H3L 2U3", - "Saint Pierre and Miquelon" - ], - [ - "993", - "Charissa", - "Beck", - "30611", - "Zambia" - ], - [ - "994", - "Calvin", - "Russo", - "79906", - "Chile" - ], - [ - "995", - "Yoshi", - "Durham", - "N2J 8M8", - "China" - ], - [ - "996", - "Finn", - "Buck", - "Q9F 9Z8", - "Iraq" - ], - [ - "997", - "Kessie", - "Holden", - "C4A 1J0", - "Syrian Arab Republic" - ], - [ - "998", - "Chloe", - "Richards", - "63091", - "Canada" - ], - [ - "999", - "Uriel", - "Snyder", - "95487", - "Pakistan" - ], - [ - "1000", - "Maite", - "Cash", - "90705", - "Syrian Arab Republic" - ], - [ - "1001", - "Cameron", - "Schwartz", - "82778", - "Taiwan, Province of China" - ], - [ - "1002", - "Faith", - "Jimenez", - "J6K 2P9", - "Saint Pierre and Miquelon" - ], - [ - "1003", - "Otto", - "Hancock", - "34535", - "Andorra" - ], - [ - "1004", - "Harlan", - "Blackwell", - "N8Y 4E6", - "Qatar" - ], - [ - "1005", - "Fitzgerald", - "Gilliam", - "Y9J 6J5", - "Burkina Faso" - ], - [ - "1006", - "Lev", - "Ballard", - "01956", - "American Samoa" - ], - [ - "1007", - "Freya", - "Brown", - "01190", - "Portugal" - ], - [ - "1008", - "Harding", - "Osborn", - "14814", - "San Marino" - ], - [ - "1009", - "Alexander", - "Howard", - "81842", - "Reunion" - ], - [ - "1010", - "Ori", - "Marsh", - "77738", - "Saint Helena" - ], - [ - "1011", - "Brennan", - "Rich", - "18690", - "Cambodia" - ], - [ - "1012", - "Dawn", - "Christensen", - "Y8F 7R3", - "Mali" - ], - [ - "1013", - "Ahmed", - "Pearson", - "62230", - "Sudan" - ], - [ - "1014", - "Tanek", - "Head", - "25744", - "Kiribati" - ], - [ - "1015", - "Meredith", - "Cantu", - "E6X 2L1", - "Kenya" - ], - [ - "1016", - "Levi", - "Fisher", - "I9Y 9G2", - "Djibouti" - ], - [ - "1017", - "Katell", - "Cameron", - "10278", - "Denmark" - ], - [ - "1018", - "Ina", - "Orr", - "P7H 2O3", - "Congo" - ], - [ - "1019", - "Beck", - "Hayden", - "15115", - "Saint Lucia" - ], - [ - "1020", - "Cassady", - "Wagner", - "R9H 8C5", - "Estonia" - ], - [ - "1021", - "Amena", - "Herrera", - "13286", - "Bahrain" - ], - [ - "1022", - "Tarik", - "Gross", - "C3X 3W0", - "Azerbaijan" - ], - [ - "1023", - "Marshall", - "Collier", - "13416", - "Dominica" - ], - [ - "1024", - "Kirestin", - "Callahan", - "15429", - "Micronesia" - ], - [ - "1025", - "Sasha", - "Rice", - "O6H 6X2", - "Denmark" - ], - [ - "1026", - "Ross", - "Gonzalez", - "D3B 3R5", - "Sudan" - ], - [ - "1027", - "Veda", - "Arnold", - "56611", - "Swaziland" - ], - [ - "1028", - "Ferdinand", - "Macias", - "P1Q 3I2", - "Colombia" - ], - [ - "1029", - "Mohammad", - "Reed", - "74005", - "Bhutan" - ], - [ - "1030", - "Reagan", - "Sandoval", - "19275", - "Pitcairn" - ], - [ - "1031", - "Debra", - "Nelson", - "85945", - "Ukraine" - ], - [ - "1032", - "Cleo", - "Robertson", - "84072", - "Guadeloupe" - ], - [ - "1033", - "Tanya", - "Vance", - "C1F 7F1", - "Romania" - ], - [ - "1034", - "Desirae", - "Wooten", - "74659", - "Mongolia" - ], - [ - "1035", - "Hiram", - "Estes", - "Q5Z 5A0", - "Namibia" - ], - [ - "1036", - "Medge", - "Weiss", - "67079", - "Azerbaijan" - ], - [ - "1037", - "Hu", - "Chase", - "87562", - "Cuba" - ], - [ - "1038", - "Shafira", - "Everett", - "18983", - "Georgia" - ], - [ - "1039", - "Mannix", - "Lamb", - "45542", - "Venezuela" - ], - [ - "1040", - "Germaine", - "Harvey", - "I9G 1U0", - "Falkland Islands (Malvinas)" - ], - [ - "1041", - "Brenna", - "Leonard", - "55573", - "New Zealand" - ], - [ - "1042", - "Kylie", - "Rivas", - "U9J 3O9", - "Djibouti" - ], - [ - "1043", - "Alexandra", - "Rich", - "T4O 6S6", - "Cuba" - ], - [ - "1044", - "Dorian", - "Spears", - "00456", - "Brazil" - ], - [ - "1045", - "Laurel", - "Abbott", - "45449", - "Switzerland" - ], - [ - "1046", - "Gabriel", - "Drake", - "U1S 5O2", - "Trinidad and Tobago" - ], - [ - "1047", - "Priscilla", - "Mercer", - "01401", - "Serbia and Montenegro" - ], - [ - "1048", - "Darius", - "Hoffman", - "49694", - "Greece" - ], - [ - "1049", - "Caesar", - "Patton", - "42322", - "Suriname" - ], - [ - "1050", - "Susan", - "Clayton", - "W1G 5C3", - "Maldives" - ], - [ - "1051", - "Zane", - "Dunlap", - "73722", - "Oman" - ], - [ - "1052", - "Leah", - "Fuentes", - "60412", - "Luxembourg" - ], - [ - "1053", - "Yardley", - "Hansen", - "03194", - "Mauritius" - ], - [ - "1054", - "Ingrid", - "Talley", - "37315", - "Solomon Islands" - ], - [ - "1055", - "Demetria", - "Evans", - "30587", - "Tajikistan" - ], - [ - "1056", - "Ignacia", - "Alford", - "01282", - "Bouvet Island" - ], - [ - "1057", - "Destiny", - "Wade", - "L5R 3V3", - "Uganda" - ], - [ - "1058", - "Alden", - "Mason", - "V7D 2V6", - "Dominican Republic" - ], - [ - "1059", - "Pamela", - "Wilcox", - "L1I 6I1", - "Canada" - ], - [ - "1060", - "Melvin", - "Buckley", - "05478", - "Hungary" - ], - [ - "1061", - "Eve", - "Holcomb", - "B6B 8T1", - "Cook Islands" - ], - [ - "1062", - "Arthur", - "Weeks", - "R5P 7U2", - "Bangladesh" - ], - [ - "1063", - "Marah", - "Levine", - "10075", - "Somalia" - ], - [ - "1064", - "Keiko", - "Freeman", - "90950", - "Faroe Islands" - ], - [ - "1065", - "Dorian", - "Rose", - "T5M 4Z0", - "Fiji" - ], - [ - "1066", - "Desirae", - "Velez", - "T4E 8K2", - "Afghanistan" - ], - [ - "1067", - "Rebekah", - "Lucas", - "T9A 8V5", - "Tunisia" - ], - [ - "1068", - "Sylvester", - "Copeland", - "W6R 3B6", - "Jamaica" - ], - [ - "1069", - "Alea", - "Preston", - "31050", - "Netherlands Antilles" - ], - [ - "1070", - "Aphrodite", - "Gordon", - "T7C 6T8", - "Sao Tome and Principe" - ], - [ - "1071", - "Yael", - "Delaney", - "G9W 9P1", - "Mexico" - ], - [ - "1072", - "Sierra", - "Perez", - "R3O 8H0", - "Slovenia" - ], - [ - "1073", - "Avram", - "Briggs", - "05221", - "Norfolk Island" - ], - [ - "1074", - "Troy", - "Poole", - "W7Q 8O5", - "Malta" - ], - [ - "1075", - "Gavin", - "Sandoval", - "37352", - "Greece" - ], - [ - "1076", - "Nerea", - "Stokes", - "N2Q 6S9", - "United States" - ], - [ - "1077", - "Genevieve", - "Ramirez", - "53829", - "Mali" - ], - [ - "1078", - "Oliver", - "Boone", - "M1Q 8V9", - "Bolivia" - ], - [ - "1079", - "Lars", - "Ramirez", - "L2R 6V2", - "Bosnia and Herzegovina" - ], - [ - "1080", - "Abbot", - "Horton", - "R1R 1V8", - "Netherlands Antilles" - ], - [ - "1081", - "Abra", - "Avila", - "41608", - "Congo" - ], - [ - "1082", - "Candice", - "Christian", - "13930", - "Faroe Islands" - ], - [ - "1083", - "Flavia", - "Miranda", - "93964", - "Estonia" - ], - [ - "1084", - "Medge", - "Drake", - "Q7C 2E2", - "Belize" - ], - [ - "1085", - "Lee", - "Montgomery", - "H3T 4Q6", - "Costa Rica" - ], - [ - "1086", - "Aline", - "Ratliff", - "99839", - "Macao" - ], - [ - "1087", - "Shafira", - "Fox", - "A9S 7C8", - "Palestinian Territory, Occupied" - ], - [ - "1088", - "Orson", - "Greene", - "K9L 7R8", - "Myanmar" - ], - [ - "1089", - "Henry", - "Joyner", - "55853", - "South Africa" - ], - [ - "1090", - "Keely", - "Boyer", - "08996", - "Liberia" - ], - [ - "1091", - "Jerome", - "Jones", - "31770", - "Saint Lucia" - ], - [ - "1092", - "Hermione", - "Dunlap", - "U2R 7R2", - "Moldova" - ], - [ - "1093", - "Lenore", - "Powers", - "73772", - "Tunisia" - ], - [ - "1094", - "Alden", - "Newman", - "V4C 3O8", - "Bhutan" - ], - [ - "1095", - "Jasper", - "Blevins", - "K2H 5W0", - "Paraguay" - ], - [ - "1096", - "Robert", - "Bender", - "R5F 1H9", - "Philippines" - ], - [ - "1097", - "Bo", - "Richard", - "N5R 6T2", - "Trinidad and Tobago" - ], - [ - "1098", - "Iliana", - "Mcpherson", - "23758", - "Bangladesh" - ], - [ - "1099", - "Alfreda", - "Camacho", - "35387", - "Saint Helena" - ], - [ - "1100", - "Kirsten", - "Giles", - "14079", - "Romania" - ], - [ - "1101", - "Harlan", - "Crawford", - "84847", - "French Polynesia" - ], - [ - "1102", - "Wynne", - "Bauer", - "W9D 6F6", - "Kazakhstan" - ], - [ - "1103", - "Connor", - "Melton", - "E2F 4Q2", - "Angola" - ], - [ - "1104", - "Evelyn", - "Barry", - "I9H 8W7", - "Turkmenistan" - ], - [ - "1105", - "Barry", - "Stephens", - "07823", - "Gibraltar" - ], - [ - "1106", - "Ferris", - "Farrell", - "I7H 5Z6", - "Saint Vincent and The Grenadines" - ], - [ - "1107", - "Ursa", - "Carr", - "31124", - "Chad" - ], - [ - "1108", - "Laith", - "Johnson", - "10428", - "Cyprus" - ], - [ - "1109", - "Harlan", - "Frank", - "J6K 7I6", - "Gambia" - ], - [ - "1110", - "Gregory", - "Ratliff", - "P1C 8H2", - "Chile" - ], - [ - "1111", - "Rina", - "Holloway", - "Y7N 1E7", - "Estonia" - ], - [ - "1112", - "Maris", - "Joyner", - "T6R 2H9", - "France" - ], - [ - "1113", - "Galvin", - "Webster", - "V8E 9U4", - "Croatia" - ], - [ - "1114", - "Farrah", - "Bean", - "H2B 8E2", - "Palestinian Territory, Occupied" - ], - [ - "1115", - "Martha", - "Schroeder", - "14485", - "Georgia" - ], - [ - "1116", - "Mari", - "Boone", - "D4C 1Q0", - "Comoros" - ], - [ - "1117", - "Nadine", - "Mercado", - "35046", - "Syrian Arab Republic" - ], - [ - "1118", - "Isadora", - "Keith", - "R5H 8Y7", - "Mayotte" - ], - [ - "1119", - "Quinn", - "William", - "V8Q 3Y6", - "India" - ], - [ - "1120", - "Justina", - "Gilbert", - "11271", - "Yemen" - ], - [ - "1121", - "Jordan", - "Hull", - "F4Z 7R8", - "Lesotho" - ], - [ - "1122", - "Mechelle", - "Davenport", - "A9Z 8P2", - "Bermuda" - ], - [ - "1123", - "Isabelle", - "Webster", - "60972", - "Zimbabwe" - ], - [ - "1124", - "Armand", - "Butler", - "Y3F 4H9", - "Nicaragua" - ], - [ - "1125", - "Herman", - "Beach", - "Q8N 6V3", - "Cape Verde" - ], - [ - "1126", - "Brianna", - "Love", - "D9B 2W8", - "Sierra Leone" - ], - [ - "1127", - "Joy", - "Brown", - "O7V 7C1", - "Djibouti" - ], - [ - "1128", - "Amena", - "Moss", - "P8D 1L9", - "Andorra" - ], - [ - "1129", - "Zeph", - "Whitehead", - "01513", - "Tanzania, United Republic of" - ], - [ - "1130", - "Logan", - "Matthews", - "73541", - "Finland" - ], - [ - "1131", - "Amela", - "Gregory", - "65323", - "Swaziland" - ], - [ - "1132", - "Zoe", - "Owen", - "V5L 5O6", - "Zambia" - ], - [ - "1133", - "September", - "Hewitt", - "R8K 4G9", - "Congo" - ], - [ - "1134", - "Holly", - "Walter", - "S2E 3M4", - "Serbia and Montenegro" - ], - [ - "1135", - "Zeph", - "Beach", - "J6Z 8B5", - "Ecuador" - ], - [ - "1136", - "Morgan", - "Decker", - "M9H 8I5", - "Uruguay" - ], - [ - "1137", - "Malcolm", - "Maldonado", - "S6F 8X6", - "Netherlands" - ], - [ - "1138", - "Fay", - "Day", - "B9R 1U7", - "Seychelles" - ], - [ - "1139", - "Charles", - "Juarez", - "62791", - "Virgin Islands, U.S." - ], - [ - "1140", - "Amery", - "Stout", - "L9A 1F8", - "Central African Republic" - ], - [ - "1141", - "Irene", - "Ferrell", - "52649", - "Norway" - ], - [ - "1142", - "Dean", - "Stout", - "N5C 2S8", - "Uruguay" - ], - [ - "1143", - "Eric", - "Baxter", - "82082", - "Chile" - ], - [ - "1144", - "Shelley", - "Larsen", - "Y4T 4P3", - "Antarctica" - ], - [ - "1145", - "Rigel", - "Ellis", - "E3S 6K8", - "Zimbabwe" - ], - [ - "1146", - "Maite", - "Rosa", - "F6C 5Q9", - "Zambia" - ], - [ - "1147", - "Serena", - "Blanchard", - "99373", - "Estonia" - ], - [ - "1148", - "Melanie", - "Berger", - "C5P 4E2", - "Mozambique" - ], - [ - "1149", - "Noah", - "Spence", - "B8H 7X7", - "Martinique" - ], - [ - "1150", - "Elliott", - "Pierce", - "W5B 8V7", - "Swaziland" - ], - [ - "1151", - "Ahmed", - "Chang", - "E9X 7J0", - "Bulgaria" - ], - [ - "1152", - "Ross", - "Figueroa", - "22458", - "China" - ], - [ - "1153", - "Gary", - "Calderon", - "V3C 4J8", - "Algeria" - ], - [ - "1154", - "Montana", - "Franklin", - "94093", - "Haiti" - ], - [ - "1155", - "Rae", - "Curry", - "45477", - "Morocco" - ], - [ - "1156", - "Jillian", - "Hogan", - "N8L 4B5", - "Iceland" - ], - [ - "1157", - "Mia", - "Kaufman", - "54758", - "Burkina Faso" - ], - [ - "1158", - "Remedios", - "Wilkerson", - "75420", - "Saint Vincent and The Grenadines" - ], - [ - "1159", - "Xanthus", - "Baldwin", - "13961", - "Congo" - ], - [ - "1160", - "Madeline", - "Gates", - "76351", - "Saint Helena" - ], - [ - "1161", - "Leroy", - "Craig", - "12770", - "Finland" - ], - [ - "1162", - "Melanie", - "Carpenter", - "C3B 8L4", - "Mayotte" - ], - [ - "1163", - "Ashely", - "Mcneil", - "E7E 9K5", - "French Southern Territories" - ], - [ - "1164", - "Karina", - "Mcneil", - "39956", - "United Arab Emirates" - ], - [ - "1165", - "Nina", - "Mills", - "92913", - "Saint Kitts and Nevis" - ], - [ - "1166", - "Ashton", - "Singleton", - "73890", - "Libyan Arab Jamahiriya" - ], - [ - "1167", - "Meghan", - "Black", - "31814", - "Armenia" - ], - [ - "1168", - "Jolene", - "Pope", - "U6K 7O6", - "Venezuela" - ], - [ - "1169", - "Abel", - "Boyd", - "37110", - "Botswana" - ], - [ - "1170", - "Tiger", - "Coffey", - "Y6P 3S4", - "Faroe Islands" - ], - [ - "1171", - "Aileen", - "Rowe", - "F7G 8D9", - "Netherlands Antilles" - ], - [ - "1172", - "Bryar", - "Forbes", - "T2N 5H6", - "Saint Vincent and The Grenadines" - ], - [ - "1173", - "Vera", - "Hoffman", - "36299", - "Guadeloupe" - ], - [ - "1174", - "Hadassah", - "Wright", - "S8J 5B2", - "Peru" - ], - [ - "1175", - "Bruce", - "Blair", - "Q8E 7K6", - "Cape Verde" - ], - [ - "1176", - "Brianna", - "Wolf", - "V8S 5A6", - "Bahamas" - ], - [ - "1177", - "Kimberley", - "Reed", - "17652", - "Tajikistan" - ], - [ - "1178", - "Colin", - "Phelps", - "42334", - "Brunei Darussalam" - ], - [ - "1179", - "Gil", - "Britt", - "U3N 6C2", - "Swaziland" - ], - [ - "1180", - "Hasad", - "Pena", - "09526", - "United States" - ], - [ - "1181", - "Violet", - "Dixon", - "48691", - "Micronesia" - ], - [ - "1182", - "Uriel", - "Bowen", - "Z7F 7A7", - "Uzbekistan" - ], - [ - "1183", - "Madeline", - "Keller", - "18227", - "Iran, Islamic Republic of" - ], - [ - "1184", - "Buffy", - "Mckee", - "23861", - "Ethiopia" - ], - [ - "1185", - "Doris", - "Martin", - "V8N 8O7", - "Liberia" - ], - [ - "1186", - "Mia", - "Burke", - "64582", - "Virgin Islands, British" - ], - [ - "1187", - "William", - "Kemp", - "63587", - "Tuvalu" - ], - [ - "1188", - "Stacy", - "Quinn", - "01390", - "Nauru" - ], - [ - "1189", - "Halla", - "Solomon", - "31138", - "Pakistan" - ], - [ - "1190", - "Kasimir", - "Rodriguez", - "67823", - "Costa Rica" - ], - [ - "1191", - "Davis", - "Lawrence", - "27918", - "Rwanda" - ], - [ - "1192", - "Nigel", - "Bryan", - "L5U 2U9", - "Seychelles" - ], - [ - "1193", - "Ivana", - "Stone", - "94862", - "Niue" - ], - [ - "1194", - "Naomi", - "Yang", - "68985", - "Haiti" - ], - [ - "1195", - "Roanna", - "Brown", - "51196", - "India" - ], - [ - "1196", - "Colorado", - "Chavez", - "45634", - "Brazil" - ], - [ - "1197", - "Illana", - "Levy", - "V1A 7R8", - "Jordan" - ], - [ - "1198", - "Ali", - "Lowe", - "N8K 1Y5", - "Hungary" - ], - [ - "1199", - "Virginia", - "Witt", - "Y3O 5W8", - "Azerbaijan" - ], - [ - "1200", - "Howard", - "Flores", - "I9C 3Q7", - "Fiji" - ], - [ - "1201", - "Walter", - "Odom", - "78418", - "Thailand" - ], - [ - "1202", - "Thor", - "Craig", - "00935", - "Jamaica" - ], - [ - "1203", - "Petra", - "Barry", - "E5L 5K5", - "Finland" - ], - [ - "1204", - "Lev", - "Ellison", - "I6S 1K1", - "Mongolia" - ], - [ - "1205", - "Roth", - "Osborne", - "15014", - "Swaziland" - ], - [ - "1206", - "Lucius", - "Baldwin", - "12766", - "China" - ], - [ - "1207", - "Candice", - "Hyde", - "B5E 4B8", - "Bahamas" - ], - [ - "1208", - "Maggy", - "Bailey", - "76781", - "Northern Mariana Islands" - ], - [ - "1209", - "Beatrice", - "Gregory", - "S5S 8S4", - "Rwanda" - ], - [ - "1210", - "Adrian", - "Bowman", - "58500", - "Vanuatu" - ], - [ - "1211", - "Brenden", - "Chandler", - "50326", - "Thailand" - ], - [ - "1212", - "Jada", - "Richmond", - "15990", - "Saint Vincent and The Grenadines" - ], - [ - "1213", - "Sawyer", - "Page", - "G2W 7R7", - "Somalia" - ], - [ - "1214", - "Haley", - "Jordan", - "U7X 4U2", - "Equatorial Guinea" - ], - [ - "1215", - "Ruby", - "Watson", - "30990", - "Romania" - ], - [ - "1216", - "Jocelyn", - "Knowles", - "78987", - "Lebanon" - ], - [ - "1217", - "Preston", - "Stevenson", - "F3L 9B3", - "Mali" - ], - [ - "1218", - "Kimberly", - "Merritt", - "38779", - "Venezuela" - ], - [ - "1219", - "Herrod", - "Burke", - "56225", - "French Guiana" - ], - [ - "1220", - "Solomon", - "Shannon", - "67980", - "Cape Verde" - ], - [ - "1221", - "Bradley", - "Stokes", - "10213", - "Botswana" - ], - [ - "1222", - "Grace", - "Kinney", - "67923", - "Montserrat" - ], - [ - "1223", - "Celeste", - "Clark", - "S7M 6I2", - "Guatemala" - ], - [ - "1224", - "Patricia", - "Frank", - "05615", - "Venezuela" - ], - [ - "1225", - "Madonna", - "Alford", - "10878", - "Brunei Darussalam" - ], - [ - "1226", - "May", - "Rios", - "N7O 2L0", - "Georgia" - ], - [ - "1227", - "Driscoll", - "Roach", - "Y7F 9F8", - "Palestinian Territory, Occupied" - ], - [ - "1228", - "Idona", - "Cruz", - "T6Q 8L4", - "Iraq" - ], - [ - "1229", - "Sydney", - "Delacruz", - "69511", - "United Arab Emirates" - ], - [ - "1230", - "Gillian", - "Huff", - "52624", - "French Southern Territories" - ], - [ - "1231", - "Minerva", - "Rosario", - "29195", - "Andorra" - ], - [ - "1232", - "Kerry", - "Alvarado", - "L3Q 2V5", - "Portugal" - ], - [ - "1233", - "Amos", - "Bass", - "26389", - "Holy See (Vatican City State)" - ], - [ - "1234", - "Deanna", - "Parks", - "57376", - "Estonia" - ], - [ - "1235", - "Fitzgerald", - "Green", - "M3P 9N2", - "Slovenia" - ], - [ - "1236", - "Sade", - "Hinton", - "35561", - "Barbados" - ], - [ - "1237", - "Suki", - "Parsons", - "44591", - "Syrian Arab Republic" - ], - [ - "1238", - "Orli", - "Weeks", - "K2W 9L4", - "Peru" - ], - [ - "1239", - "Nicholas", - "Copeland", - "I5W 7A4", - "French Guiana" - ], - [ - "1240", - "Guy", - "Vang", - "22277", - "Pitcairn" - ], - [ - "1241", - "Hunter", - "Goodman", - "72290", - "Malaysia" - ], - [ - "1242", - "Noble", - "Rich", - "I3B 6T9", - "Gibraltar" - ], - [ - "1243", - "Delilah", - "Zamora", - "96328", - "New Zealand" - ], - [ - "1244", - "Sybil", - "Mercer", - "93665", - "Namibia" - ], - [ - "1245", - "Scarlett", - "Brock", - "Z2E 3J2", - "Central African Republic" - ], - [ - "1246", - "Channing", - "Alexander", - "W5V 8D2", - "San Marino" - ], - [ - "1247", - "Carolyn", - "Boyle", - "Q5Z 9E6", - "Gabon" - ], - [ - "1248", - "Irene", - "Jennings", - "F3H 4O6", - "Saint Helena" - ], - [ - "1249", - "Bianca", - "Pratt", - "66354", - "Malaysia" - ], - [ - "1250", - "Dexter", - "Cole", - "56106", - "French Southern Territories" - ], - [ - "1251", - "Berk", - "Velez", - "26759", - "Lesotho" - ], - [ - "1252", - "Barrett", - "Richardson", - "59446", - "Cocos (Keeling) Islands" - ], - [ - "1253", - "Scarlet", - "Jacobs", - "G9A 7L6", - "Dominica" - ], - [ - "1254", - "Aiko", - "Brooks", - "R6R 9E4", - "Liberia" - ], - [ - "1255", - "Jacob", - "Moore", - "P2Y 6P3", - "Cambodia" - ], - [ - "1256", - "Madeline", - "Bishop", - "D4I 2E7", - "Dominican Republic" - ], - [ - "1257", - "Jarrod", - "Evans", - "C9O 7V7", - "Taiwan, Province of China" - ], - [ - "1258", - "Beverly", - "Witt", - "64850", - "Denmark" - ], - [ - "1259", - "Karyn", - "Rhodes", - "D6G 5Z3", - "Cape Verde" - ], - [ - "1260", - "Imani", - "Quinn", - "01897", - "Macao" - ], - [ - "1261", - "Athena", - "Eaton", - "03568", - "Syrian Arab Republic" - ], - [ - "1262", - "Raymond", - "Valdez", - "21037", - "Romania" - ], - [ - "1263", - "Christopher", - "Ferguson", - "64945", - "Indonesia" - ], - [ - "1264", - "Latifah", - "Harris", - "91381", - "Suriname" - ], - [ - "1265", - "Dacey", - "Wagner", - "81483", - "Qatar" - ], - [ - "1266", - "Summer", - "Myers", - "H6A 1G5", - "Angola" - ], - [ - "1267", - "Jasmine", - "Rivera", - "Y4W 8P2", - "Virgin Islands, British" - ], - [ - "1268", - "Cairo", - "Massey", - "Q6Y 7A7", - "Poland" - ], - [ - "1269", - "Jena", - "Hill", - "89480", - "United States Minor Outlying Islands" - ], - [ - "1270", - "Ava", - "Benson", - "L9H 8V1", - "Sri Lanka" - ], - [ - "1271", - "Gillian", - "Mercado", - "A9W 6V5", - "Norway" - ], - [ - "1272", - "Peter", - "Marquez", - "I5B 3W9", - "Guyana" - ], - [ - "1273", - "Price", - "Coleman", - "X8G 2S0", - "Burkina Faso" - ], - [ - "1274", - "Shana", - "Harper", - "L2B 3U9", - "Malaysia" - ], - [ - "1275", - "Serina", - "Matthews", - "58061", - "Lithuania" - ], - [ - "1276", - "Aretha", - "Bryant", - "Y8J 7A5", - "Tonga" - ], - [ - "1277", - "Wesley", - "Craig", - "20141", - "Australia" - ], - [ - "1278", - "Martena", - "Mercer", - "P6X 2L9", - "Sudan" - ], - [ - "1279", - "Tamara", - "Dennis", - "D3H 9R0", - "Mali" - ], - [ - "1280", - "Phelan", - "Pena", - "D2H 2H7", - "United States Minor Outlying Islands" - ], - [ - "1281", - "Rebecca", - "Kinney", - "B5Z 9S4", - "Antarctica" - ], - [ - "1282", - "Josephine", - "Delgado", - "81010", - "Algeria" - ], - [ - "1283", - "Kieran", - "Estes", - "70093", - "Bermuda" - ], - [ - "1284", - "Tamara", - "Williamson", - "90905", - "French Guiana" - ], - [ - "1285", - "Dora", - "Serrano", - "W8K 6R5", - "Nauru" - ], - [ - "1286", - "Morgan", - "Bass", - "B6F 8R2", - "Madagascar" - ], - [ - "1287", - "Margaret", - "Austin", - "D2C 2C1", - "Belgium" - ], - [ - "1288", - "Nasim", - "Berry", - "J9X 7M5", - "Heard Island and Mcdonald Islands" - ], - [ - "1289", - "Jelani", - "Rutledge", - "34552", - "Bolivia" - ], - [ - "1290", - "Cassady", - "Hardin", - "I2K 4H6", - "Hong Kong" - ], - [ - "1291", - "Jenette", - "Thornton", - "44943", - "Uganda" - ], - [ - "1292", - "Alexandra", - "Sims", - "93937", - "Australia" - ], - [ - "1293", - "Ross", - "Higgins", - "61993", - "Nicaragua" - ], - [ - "1294", - "Penelope", - "Henson", - "90344", - "Trinidad and Tobago" - ], - [ - "1295", - "Yoshi", - "Blackwell", - "C8D 1T4", - "Costa Rica" - ], - [ - "1296", - "Daria", - "Rodriquez", - "X3C 6L0", - "Iceland" - ], - [ - "1297", - "Wesley", - "Waller", - "43947", - "Myanmar" - ], - [ - "1298", - "Adam", - "Hayden", - "88969", - "Italy" - ], - [ - "1299", - "Charity", - "William", - "46439", - "Greece" - ], - [ - "1300", - "Ronan", - "Hopper", - "51955", - "Zambia" - ], - [ - "1301", - "Geraldine", - "Hatfield", - "W9S 7T5", - "Luxembourg" - ], - [ - "1302", - "Barry", - "Nicholson", - "79625", - "Liechtenstein" - ], - [ - "1303", - "Donovan", - "Ortiz", - "68119", - "Macao" - ], - [ - "1304", - "Jeanette", - "Cooper", - "D5P 9L2", - "Sri Lanka" - ], - [ - "1305", - "Isadora", - "Stephenson", - "P4X 4H5", - "Mauritania" - ], - [ - "1306", - "Hall", - "Hays", - "J2Z 2H1", - "Svalbard and Jan Mayen" - ], - [ - "1307", - "Idola", - "Roberson", - "89249", - "Niue" - ], - [ - "1308", - "Olympia", - "Dennis", - "69498", - "Guinea" - ], - [ - "1309", - "Naida", - "Palmer", - "19840", - "Gambia" - ], - [ - "1310", - "Maxine", - "Rollins", - "87856", - "Belize" - ], - [ - "1311", - "Rooney", - "Phelps", - "48424", - "Italy" - ], - [ - "1312", - "Shelly", - "Edwards", - "O7O 1U4", - "Mali" - ], - [ - "1313", - "Cassidy", - "Holcomb", - "98785", - "Colombia" - ], - [ - "1314", - "Sybil", - "Moran", - "F3C 6E4", - "Switzerland" - ], - [ - "1315", - "Mufutau", - "Larson", - "00276", - "British Indian Ocean Territory" - ], - [ - "1316", - "Fiona", - "Bryant", - "U7Y 7N6", - "Cocos (Keeling) Islands" - ], - [ - "1317", - "Lenore", - "Boyle", - "H5G 6P9", - "Sudan" - ], - [ - "1318", - "Ignacia", - "Avila", - "Y5M 1S2", - "Romania" - ], - [ - "1319", - "Wendy", - "Stein", - "25422", - "Taiwan, Province of China" - ], - [ - "1320", - "Garrison", - "Bass", - "B9J 6D9", - "Romania" - ], - [ - "1321", - "Curran", - "Roy", - "X2F 4P2", - "Taiwan, Province of China" - ], - [ - "1322", - "Oliver", - "Beach", - "N6J 1C5", - "Kazakhstan" - ], - [ - "1323", - "Bo", - "Duran", - "D5C 5C2", - "Eritrea" - ], - [ - "1324", - "Tashya", - "Morrow", - "N2J 7O9", - "Rwanda" - ], - [ - "1325", - "Cheryl", - "Powell", - "72413", - "Niger" - ], - [ - "1326", - "Justin", - "Roth", - "18779", - "Brunei Darussalam" - ], - [ - "1327", - "Nathaniel", - "Foster", - "04955", - "Bermuda" - ], - [ - "1328", - "Candace", - "Nunez", - "G7Z 1N2", - "Moldova" - ], - [ - "1329", - "Nero", - "West", - "K3Q 6B3", - "Myanmar" - ], - [ - "1330", - "Brendan", - "Mcintyre", - "C4E 5H7", - "Argentina" - ], - [ - "1331", - "Chaney", - "Stafford", - "V3X 8J4", - "Benin" - ], - [ - "1332", - "Sylvia", - "Velez", - "95851", - "Iraq" - ], - [ - "1333", - "Azalia", - "Castro", - "55986", - "Israel" - ], - [ - "1334", - "Emily", - "Hogan", - "74667", - "Botswana" - ], - [ - "1335", - "Buckminster", - "Hurst", - "N9C 2X6", - "Reunion" - ], - [ - "1336", - "Rinah", - "Rodriquez", - "31896", - "Guinea-bissau" - ], - [ - "1337", - "Nash", - "Barnett", - "Y8X 7H5", - "China" - ], - [ - "1338", - "Xanthus", - "Barker", - "11212", - "Trinidad and Tobago" - ], - [ - "1339", - "Minerva", - "Huber", - "M6M 9U3", - "Equatorial Guinea" - ], - [ - "1340", - "Kaseem", - "Tillman", - "86565", - "Bulgaria" - ], - [ - "1341", - "Cassidy", - "Dejesus", - "93205", - "Sierra Leone" - ], - [ - "1342", - "Sheila", - "Munoz", - "26473", - "Benin" - ], - [ - "1343", - "Florence", - "Yates", - "M5O 1J1", - "Russian Federation" - ], - [ - "1344", - "Isadora", - "Wagner", - "88381", - "Philippines" - ], - [ - "1345", - "Hilel", - "Kramer", - "E5D 4F5", - "Lebanon" - ], - [ - "1346", - "Stewart", - "Lawson", - "67313", - "Malaysia" - ], - [ - "1347", - "Ira", - "Duffy", - "52841", - "Greece" - ], - [ - "1348", - "Ignatius", - "Robinson", - "10035", - "Russian Federation" - ], - [ - "1349", - "Baxter", - "Carroll", - "92288", - "Albania" - ], - [ - "1350", - "Palmer", - "James", - "N5X 5B1", - "Germany" - ], - [ - "1351", - "Ava", - "Eaton", - "76497", - "Egypt" - ], - [ - "1352", - "Kiona", - "Smith", - "09402", - "Belize" - ], - [ - "1353", - "Brian", - "Barlow", - "00156", - "Panama" - ], - [ - "1354", - "Nolan", - "Rosa", - "J2O 9W2", - "Uruguay" - ], - [ - "1355", - "Teegan", - "Burnett", - "02401", - "Italy" - ], - [ - "1356", - "Erin", - "Knox", - "95496", - "Egypt" - ], - [ - "1357", - "Amela", - "Sanford", - "59890", - "Virgin Islands, U.S." - ], - [ - "1358", - "Quemby", - "Hensley", - "17698", - "Tuvalu" - ], - [ - "1359", - "Ava", - "York", - "J1M 1A0", - "Nigeria" - ], - [ - "1360", - "Vivien", - "Ware", - "N9S 1W6", - "Bahamas" - ], - [ - "1361", - "Nyssa", - "Lamb", - "97964", - "Estonia" - ], - [ - "1362", - "Brenna", - "Slater", - "L4P 5V6", - "British Indian Ocean Territory" - ], - [ - "1363", - "Kennan", - "Larsen", - "M2A 4X0", - "Angola" - ], - [ - "1364", - "Linda", - "Luna", - "P8C 4S8", - "Gambia" - ], - [ - "1365", - "Boris", - "Poole", - "U7J 4G1", - "Aruba" - ], - [ - "1366", - "Lyle", - "Cote", - "F5J 3Y2", - "Somalia" - ], - [ - "1367", - "Oleg", - "Knapp", - "K4C 5T8", - "Guinea" - ], - [ - "1368", - "Hanae", - "Brown", - "51395", - "Nepal" - ], - [ - "1369", - "India", - "Hyde", - "E8P 7E8", - "Belize" - ], - [ - "1370", - "Madeson", - "Hodge", - "23265", - "Gambia" - ], - [ - "1371", - "Thaddeus", - "Hester", - "Y7S 5W1", - "Saint Helena" - ], - [ - "1372", - "Aaron", - "Kemp", - "A1Q 8R3", - "Albania" - ], - [ - "1373", - "Aurelia", - "Thornton", - "P8T 9D4", - "Swaziland" - ], - [ - "1374", - "Preston", - "Sharpe", - "97472", - "Niue" - ], - [ - "1375", - "Grace", - "Gregory", - "51767", - "Burkina Faso" - ], - [ - "1376", - "Nicole", - "Hicks", - "81040", - "Burkina Faso" - ], - [ - "1377", - "Hall", - "Randall", - "X1C 7A8", - "Cambodia" - ], - [ - "1378", - "Burke", - "Silva", - "57219", - "Romania" - ], - [ - "1379", - "Talon", - "Kline", - "28200", - "Argentina" - ], - [ - "1380", - "Cassady", - "Duncan", - "Y2M 8F5", - "Kenya" - ], - [ - "1381", - "Brielle", - "Reed", - "06254", - "Greece" - ], - [ - "1382", - "Claire", - "Stein", - "50289", - "Viet Nam" - ], - [ - "1383", - "Fleur", - "Cabrera", - "30131", - "Indonesia" - ], - [ - "1384", - "Ella", - "Ellison", - "Q7Q 4R2", - "Netherlands Antilles" - ], - [ - "1385", - "Zachery", - "Wolf", - "A9Q 6A8", - "Jamaica" - ], - [ - "1386", - "Emerson", - "Brewer", - "Y4R 9M9", - "Bosnia and Herzegovina" - ], - [ - "1387", - "Sarah", - "Brooks", - "27281", - "Pitcairn" - ], - [ - "1388", - "Kylan", - "Garrison", - "S8E 7L8", - "Djibouti" - ], - [ - "1389", - "Guinevere", - "Mills", - "75612", - "Comoros" - ], - [ - "1390", - "Claudia", - "Stevenson", - "73390", - "Colombia" - ], - [ - "1391", - "Valentine", - "Burton", - "Z9P 7R8", - "Nauru" - ], - [ - "1392", - "Raymond", - "Mclean", - "L8W 2K5", - "Brunei Darussalam" - ], - [ - "1393", - "Juliet", - "Combs", - "88712", - "Samoa" - ], - [ - "1394", - "Lawrence", - "Williamson", - "32528", - "Netherlands Antilles" - ], - [ - "1395", - "Inga", - "Rivers", - "12850", - "Kuwait" - ], - [ - "1396", - "Mira", - "Zimmerman", - "D1I 1W2", - "Ireland" - ], - [ - "1397", - "Hilda", - "Stafford", - "11054", - "Cuba" - ], - [ - "1398", - "Tanek", - "Kim", - "88590", - "Cayman Islands" - ], - [ - "1399", - "Bryar", - "Mcintyre", - "H6F 4S5", - "Russian Federation" - ], - [ - "1400", - "Sean", - "Reed", - "P2V 8J9", - "Malta" - ], - [ - "1401", - "Serena", - "Henderson", - "Z5C 8A0", - "Madagascar" - ], - [ - "1402", - "Hedley", - "Parks", - "L8S 6F4", - "Angola" - ], - [ - "1403", - "Alice", - "Quinn", - "06084", - "Senegal" - ], - [ - "1404", - "Linda", - "Burgess", - "H1E 7C0", - "Turkmenistan" - ], - [ - "1405", - "Hilda", - "Burns", - "Q9Q 4S2", - "Kyrgyzstan" - ], - [ - "1406", - "Griffith", - "Watts", - "D4J 7N2", - "United States Minor Outlying Islands" - ], - [ - "1407", - "Camden", - "Glenn", - "12939", - "Russian Federation" - ], - [ - "1408", - "Tallulah", - "Rush", - "G9V 3N2", - "Turkey" - ], - [ - "1409", - "Hasad", - "Salinas", - "H3F 7P9", - "Cameroon" - ], - [ - "1410", - "Violet", - "Chavez", - "T2H 9C6", - "Virgin Islands, U.S." - ], - [ - "1411", - "Declan", - "Hurley", - "32614", - "Iran, Islamic Republic of" - ], - [ - "1412", - "Robin", - "Dean", - "34266", - "Northern Mariana Islands" - ], - [ - "1413", - "Mariko", - "Avila", - "B8F 8Y5", - "Burundi" - ], - [ - "1414", - "Bradley", - "Pugh", - "11453", - "Sri Lanka" - ], - [ - "1415", - "Herman", - "Hernandez", - "F3C 6S2", - "Chile" - ], - [ - "1416", - "Montana", - "Wynn", - "B3M 8M2", - "Aruba" - ], - [ - "1417", - "Erin", - "Melton", - "17022", - "France" - ], - [ - "1418", - "Zachery", - "Small", - "L5O 7O1", - "French Southern Territories" - ], - [ - "1419", - "Melanie", - "Rivera", - "07922", - "Korea" - ], - [ - "1420", - "Blossom", - "Chase", - "75493", - "Mauritius" - ], - [ - "1421", - "Stephanie", - "Taylor", - "U8K 3I9", - "Bahamas" - ], - [ - "1422", - "Carter", - "Fulton", - "T4F 8D1", - "Turks and Caicos Islands" - ], - [ - "1423", - "Celeste", - "Medina", - "75629", - "Lebanon" - ], - [ - "1424", - "Katell", - "Guzman", - "15409", - "United Arab Emirates" - ], - [ - "1425", - "Howard", - "Rowland", - "29003", - "Liberia" - ], - [ - "1426", - "Reece", - "Taylor", - "W8G 7P7", - "Samoa" - ], - [ - "1427", - "Bradley", - "Peterson", - "52568", - "Singapore" - ], - [ - "1428", - "Ulric", - "Hancock", - "07437", - "Bolivia" - ], - [ - "1429", - "Francis", - "Rogers", - "15904", - "Albania" - ], - [ - "1430", - "Tatiana", - "Mccray", - "19604", - "Belize" - ], - [ - "1431", - "Merrill", - "Rowe", - "68539", - "Ethiopia" - ], - [ - "1432", - "Kiara", - "Taylor", - "F6D 8V7", - "Burkina Faso" - ], - [ - "1433", - "Buffy", - "Shannon", - "61880", - "Kiribati" - ], - [ - "1434", - "Amber", - "Farmer", - "K5F 1J7", - "Barbados" - ], - [ - "1435", - "Blake", - "Wilkins", - "O1L 2G2", - "Virgin Islands, U.S." - ], - [ - "1436", - "Aimee", - "Fulton", - "18626", - "Chad" - ], - [ - "1437", - "Kai", - "Montgomery", - "U6S 4W7", - "Costa Rica" - ], - [ - "1438", - "Latifah", - "Bell", - "74589", - "Chad" - ], - [ - "1439", - "Ronan", - "Herring", - "01710", - "Palestinian Territory, Occupied" - ], - [ - "1440", - "Macy", - "Skinner", - "78054", - "Gibraltar" - ], - [ - "1441", - "Ignatius", - "Berg", - "59756", - "Liechtenstein" - ], - [ - "1442", - "Prescott", - "Pratt", - "V6H 6P4", - "Kuwait" - ], - [ - "1443", - "Deborah", - "Hebert", - "11480", - "Liberia" - ], - [ - "1444", - "Quentin", - "Jones", - "G8W 8U6", - "Slovenia" - ], - [ - "1445", - "Duncan", - "Parsons", - "Z9F 5G8", - "Cambodia" - ], - [ - "1446", - "Sheila", - "George", - "18033", - "Trinidad and Tobago" - ], - [ - "1447", - "Alyssa", - "Padilla", - "V3O 6C3", - "Qatar" - ], - [ - "1448", - "Amelia", - "Orr", - "51943", - "Canada" - ], - [ - "1449", - "Bethany", - "Thomas", - "33451", - "Liberia" - ], - [ - "1450", - "Kellie", - "Pitts", - "G4S 1Q3", - "Panama" - ], - [ - "1451", - "Stone", - "Stout", - "L4C 9N0", - "Latvia" - ], - [ - "1452", - "Brynne", - "Bailey", - "B1M 4O0", - "Ukraine" - ], - [ - "1453", - "Aquila", - "Hurley", - "41312", - "United Kingdom" - ], - [ - "1454", - "David", - "Bradshaw", - "11152", - "Denmark" - ], - [ - "1455", - "Ryan", - "Gates", - "Z7O 1U0", - "Austria" - ], - [ - "1456", - "Kyle", - "Weber", - "39871", - "Guyana" - ], - [ - "1457", - "Declan", - "Moore", - "K3B 6L2", - "Gibraltar" - ], - [ - "1458", - "Theodore", - "Hickman", - "W8E 6K1", - "Mauritius" - ], - [ - "1459", - "Rebekah", - "Merritt", - "44042", - "Mauritania" - ], - [ - "1460", - "Meredith", - "Powell", - "98238", - "Bhutan" - ], - [ - "1461", - "Paki", - "Simmons", - "34122", - "Norway" - ], - [ - "1462", - "Carissa", - "Ballard", - "20095", - "Antarctica" - ], - [ - "1463", - "James", - "Wilson", - "96376", - "Venezuela" - ], - [ - "1464", - "Pamela", - "Gamble", - "U7F 7B6", - "Turkmenistan" - ], - [ - "1465", - "Rogan", - "Davenport", - "E6S 4R7", - "French Polynesia" - ], - [ - "1466", - "Daphne", - "Pearson", - "G2H 9M0", - "American Samoa" - ], - [ - "1467", - "Maxwell", - "Nash", - "87205", - "Guadeloupe" - ], - [ - "1468", - "Hayes", - "Salazar", - "55712", - "American Samoa" - ], - [ - "1469", - "Justin", - "Conner", - "03924", - "United Kingdom" - ], - [ - "1470", - "Blythe", - "Joyner", - "T6H 3M0", - "Montserrat" - ], - [ - "1471", - "Herrod", - "Spears", - "19474", - "Philippines" - ], - [ - "1472", - "Yvette", - "Joyce", - "R7Y 7B8", - "Botswana" - ], - [ - "1473", - "Chloe", - "Reid", - "K4Y 1R2", - "Philippines" - ], - [ - "1474", - "MacKensie", - "Branch", - "J5E 3X8", - "Saint Kitts and Nevis" - ], - [ - "1475", - "Nasim", - "Buchanan", - "M4E 4D2", - "Portugal" - ], - [ - "1476", - "Aileen", - "Rasmussen", - "H2V 3F4", - "Dominica" - ], - [ - "1477", - "Nicole", - "Mullins", - "U6Q 9X5", - "New Caledonia" - ], - [ - "1478", - "David", - "Luna", - "11935", - "Svalbard and Jan Mayen" - ], - [ - "1479", - "Germaine", - "Massey", - "G3N 4C7", - "Colombia" - ], - [ - "1480", - "Matthew", - "Knowles", - "V4D 4Z0", - "Turkey" - ], - [ - "1481", - "Timon", - "Rowe", - "14024", - "Morocco" - ], - [ - "1482", - "Gail", - "Young", - "68293", - "Bhutan" - ], - [ - "1483", - "Mariam", - "Mejia", - "O3P 4Q7", - "Singapore" - ], - [ - "1484", - "Carla", - "Norris", - "D7A 3F1", - "Liberia" - ], - [ - "1485", - "Ainsley", - "Donaldson", - "H4Z 1Q8", - "Tanzania, United Republic of" - ], - [ - "1486", - "Avye", - "Raymond", - "44808", - "Namibia" - ], - [ - "1487", - "Amanda", - "Sargent", - "O7F 3S4", - "Afghanistan" - ], - [ - "1488", - "Tiger", - "Chambers", - "I3K 7H4", - "United States" - ], - [ - "1489", - "Dylan", - "Ford", - "04043", - "Solomon Islands" - ], - [ - "1490", - "Kaitlin", - "Franklin", - "99451", - "Namibia" - ], - [ - "1491", - "Hayes", - "Craft", - "D6H 4Y6", - "Christmas Island" - ], - [ - "1492", - "Nolan", - "Sullivan", - "31246", - "United States Minor Outlying Islands" - ], - [ - "1493", - "Jennifer", - "Romero", - "E7I 1R7", - "Latvia" - ], - [ - "1494", - "Deanna", - "Wall", - "36109", - "Nepal" - ], - [ - "1495", - "Dara", - "Valenzuela", - "18359", - "Martinique" - ], - [ - "1496", - "Iris", - "Blanchard", - "84392", - "Turks and Caicos Islands" - ], - [ - "1497", - "Rhea", - "Burgess", - "T7Y 7C5", - "Liberia" - ], - [ - "1498", - "Karina", - "Small", - "B2F 2X5", - "Bermuda" - ], - [ - "1499", - "Victor", - "Case", - "49492", - "Vanuatu" - ], - [ - "1500", - "Rose", - "Terry", - "B4G 8I0", - "Timor-leste" - ], - [ - "1501", - "Wyatt", - "Berg", - "K3B 5N2", - "Vanuatu" - ], - [ - "1502", - "Zephania", - "Herrera", - "E6R 2A5", - "Romania" - ], - [ - "1503", - "Felix", - "Johns", - "X8U 2P1", - "Angola" - ], - [ - "1504", - "Melyssa", - "George", - "M4J 5X8", - "Uzbekistan" - ], - [ - "1505", - "Robert", - "Spears", - "61322", - "Papua New Guinea" - ], - [ - "1506", - "Myra", - "Wood", - "50638", - "Afghanistan" - ], - [ - "1507", - "Sean", - "Kerr", - "40094", - "Guadeloupe" - ], - [ - "1508", - "Wesley", - "Mcclain", - "H7F 1H3", - "Mongolia" - ], - [ - "1509", - "Ishmael", - "Hoover", - "42503", - "Czech Republic" - ], - [ - "1510", - "Ocean", - "Parker", - "L3Z 8G0", - "Guyana" - ], - [ - "1511", - "Berk", - "Clay", - "B6Q 7V7", - "Botswana" - ], - [ - "1512", - "Daquan", - "Harrison", - "78004", - "Niger" - ], - [ - "1513", - "Ramona", - "Burris", - "66986", - "Palau" - ], - [ - "1514", - "Jaden", - "Miranda", - "80086", - "Madagascar" - ], - [ - "1515", - "Solomon", - "Kirk", - "R7M 3M3", - "Slovenia" - ], - [ - "1516", - "Tanek", - "Rosales", - "X5B 5D0", - "Tonga" - ], - [ - "1517", - "Jack", - "Cooke", - "46356", - "French Southern Territories" - ], - [ - "1518", - "Naomi", - "Sykes", - "76541", - "Marshall Islands" - ], - [ - "1519", - "Moana", - "Vinson", - "K4R 3U7", - "Saint Pierre and Miquelon" - ], - [ - "1520", - "Kaye", - "Sweet", - "S6S 2G0", - "Dominican Republic" - ], - [ - "1521", - "Bruno", - "Beard", - "20686", - "Israel" - ], - [ - "1522", - "Helen", - "Richards", - "66393", - "Argentina" - ], - [ - "1523", - "Gisela", - "Owens", - "S8Q 4L3", - "Haiti" - ], - [ - "1524", - "Ivy", - "Garrett", - "P6G 8S8", - "United Arab Emirates" - ], - [ - "1525", - "Malik", - "Osborne", - "78332", - "Tajikistan" - ], - [ - "1526", - "Whoopi", - "Franco", - "T3T 5Y1", - "Serbia and Montenegro" - ], - [ - "1527", - "Basil", - "Baker", - "61233", - "Cuba" - ], - [ - "1528", - "Linda", - "King", - "31410", - "Falkland Islands (Malvinas)" - ], - [ - "1529", - "Allegra", - "Hobbs", - "F2C 9M8", - "Andorra" - ], - [ - "1530", - "Kirsten", - "Elliott", - "T8C 4X3", - "Haiti" - ], - [ - "1531", - "Joseph", - "Ortiz", - "40165", - "Falkland Islands (Malvinas)" - ], - [ - "1532", - "Pearl", - "Mccormick", - "93914", - "Falkland Islands (Malvinas)" - ], - [ - "1533", - "Fritz", - "Austin", - "A3S 7C8", - "Canada" - ], - [ - "1534", - "Lunea", - "Hickman", - "25676", - "Cameroon" - ], - [ - "1535", - "Inga", - "Cortez", - "14707", - "Comoros" - ], - [ - "1536", - "Claudia", - "Long", - "74877", - "Tokelau" - ], - [ - "1537", - "Judah", - "Williamson", - "S9N 6F0", - "Paraguay" - ], - [ - "1538", - "Eve", - "Beasley", - "K8Z 5H7", - "Honduras" - ], - [ - "1539", - "Tad", - "Lang", - "29577", - "Equatorial Guinea" - ], - [ - "1540", - "Jack", - "Lawson", - "46631", - "Costa Rica" - ], - [ - "1541", - "Vaughan", - "Barron", - "N9L 9T4", - "Chile" - ], - [ - "1542", - "Solomon", - "Bowman", - "05734", - "Cocos (Keeling) Islands" - ], - [ - "1543", - "Nash", - "Giles", - "64600", - "Denmark" - ], - [ - "1544", - "Xander", - "Eaton", - "84933", - "Bosnia and Herzegovina" - ], - [ - "1545", - "Hanna", - "Hull", - "61062", - "Namibia" - ], - [ - "1546", - "Lee", - "Gaines", - "V7H 6H7", - "Suriname" - ], - [ - "1547", - "Brian", - "Sutton", - "60055", - "Timor-leste" - ], - [ - "1548", - "Azalia", - "Henson", - "D9J 8E4", - "Antarctica" - ], - [ - "1549", - "Russell", - "Avila", - "01774", - "China" - ], - [ - "1550", - "Marsden", - "Leblanc", - "30201", - "New Caledonia" - ], - [ - "1551", - "Tad", - "Nichols", - "K5V 6N1", - "Monaco" - ], - [ - "1552", - "Eliana", - "Savage", - "06807", - "Central African Republic" - ], - [ - "1553", - "Madeline", - "Conway", - "83513", - "Latvia" - ], - [ - "1554", - "Kai", - "Caldwell", - "S1K 2Q2", - "Indonesia" - ], - [ - "1555", - "Wynne", - "Goodman", - "U9Y 8P7", - "Gibraltar" - ], - [ - "1556", - "Nora", - "Dudley", - "52688", - "Netherlands Antilles" - ], - [ - "1557", - "Anastasia", - "Gates", - "T7T 8C8", - "Morocco" - ], - [ - "1558", - "Lester", - "Good", - "76376", - "Heard Island and Mcdonald Islands" - ], - [ - "1559", - "Craig", - "Skinner", - "S7B 3Z6", - "Madagascar" - ], - [ - "1560", - "Kibo", - "Craft", - "M5C 2I9", - "Hong Kong" - ], - [ - "1561", - "Carlos", - "Buck", - "89343", - "Northern Mariana Islands" - ], - [ - "1562", - "Ivor", - "Mooney", - "M9D 2Y3", - "Korea" - ], - [ - "1563", - "Armand", - "Shields", - "E8O 7X6", - "Uzbekistan" - ], - [ - "1564", - "Grace", - "Weeks", - "G5B 3W5", - "Nicaragua" - ], - [ - "1565", - "Reagan", - "Mann", - "J2E 5I1", - "San Marino" - ], - [ - "1566", - "Quin", - "Nolan", - "Q9E 2Q0", - "Turkey" - ], - [ - "1567", - "Kareem", - "Jefferson", - "91393", - "Zambia" - ], - [ - "1568", - "Erica", - "Mccoy", - "C3P 3L0", - "Viet Nam" - ], - [ - "1569", - "Sybill", - "Larsen", - "J3U 3L9", - "Sierra Leone" - ], - [ - "1570", - "Angela", - "Weber", - "46559", - "Croatia" - ], - [ - "1571", - "Mannix", - "Noel", - "94029", - "Belgium" - ], - [ - "1572", - "Martina", - "Travis", - "20063", - "Solomon Islands" - ], - [ - "1573", - "Dominic", - "Whitehead", - "83547", - "Gibraltar" - ], - [ - "1574", - "Vladimir", - "Hunter", - "L3I 4G7", - "Reunion" - ], - [ - "1575", - "Farrah", - "Alexander", - "18538", - "Croatia" - ], - [ - "1576", - "Hop", - "Burns", - "X1C 7J6", - "Saint Lucia" - ], - [ - "1577", - "Zelda", - "Trevino", - "L8P 7E9", - "Guinea" - ], - [ - "1578", - "Nehru", - "Decker", - "Q1P 4Q9", - "Western Sahara" - ], - [ - "1579", - "Shay", - "Goff", - "68576", - "Sweden" - ], - [ - "1580", - "Dominic", - "Martin", - "C1M 9P2", - "Denmark" - ], - [ - "1581", - "Heather", - "Doyle", - "Y7R 9H1", - "Iran, Islamic Republic of" - ], - [ - "1582", - "Honorato", - "Rojas", - "29414", - "India" - ], - [ - "1583", - "Florence", - "England", - "64669", - "China" - ], - [ - "1584", - "Zane", - "Reyes", - "84771", - "Heard Island and Mcdonald Islands" - ], - [ - "1585", - "Scarlett", - "Poole", - "36928", - "Algeria" - ], - [ - "1586", - "Dieter", - "Brennan", - "Y8V 5L2", - "Colombia" - ], - [ - "1587", - "Jamal", - "Whitney", - "33428", - "Turkey" - ], - [ - "1588", - "Evan", - "Guy", - "72119", - "Slovakia" - ], - [ - "1589", - "Candace", - "Bauer", - "C8L 1P2", - "Macedonia" - ], - [ - "1590", - "Naomi", - "Pennington", - "17350", - "Tonga" - ], - [ - "1591", - "Celeste", - "Banks", - "R8R 4C8", - "Anguilla" - ], - [ - "1592", - "Basil", - "Elliott", - "80065", - "Singapore" - ], - [ - "1593", - "Darryl", - "Wise", - "33140", - "Brunei Darussalam" - ], - [ - "1594", - "Marny", - "Walls", - "S1K 4V1", - "Western Sahara" - ], - [ - "1595", - "Anastasia", - "Meyer", - "Z1F 8C2", - "El Salvador" - ], - [ - "1596", - "Brynne", - "Rivera", - "48070", - "Mexico" - ], - [ - "1597", - "Macey", - "Johnston", - "X9E 9J5", - "Guadeloupe" - ], - [ - "1598", - "Bethany", - "Marks", - "46648", - "Bhutan" - ], - [ - "1599", - "Kiayada", - "Glass", - "13661", - "Christmas Island" - ], - [ - "1600", - "Veda", - "Bowers", - "D7S 1S9", - "Korea" - ], - [ - "1601", - "Dante", - "Kirk", - "58404", - "Guinea" - ], - [ - "1602", - "Judah", - "Sloan", - "04528", - "Andorra" - ], - [ - "1603", - "Serena", - "Giles", - "12139", - "Papua New Guinea" - ], - [ - "1604", - "Chase", - "Hull", - "27203", - "Guinea-bissau" - ], - [ - "1605", - "Wallace", - "Poole", - "58919", - "Christmas Island" - ], - [ - "1606", - "Deacon", - "Lynn", - "Z1H 9G4", - "Kenya" - ], - [ - "1607", - "Igor", - "Duncan", - "X2V 2X1", - "Christmas Island" - ], - [ - "1608", - "Walker", - "Hopkins", - "67256", - "Bosnia and Herzegovina" - ], - [ - "1609", - "Serena", - "Burnett", - "Q4C 7Q0", - "Canada" - ], - [ - "1610", - "Hedwig", - "Burgess", - "O2J 7A5", - "Rwanda" - ], - [ - "1611", - "Amal", - "Richmond", - "34506", - "Australia" - ], - [ - "1612", - "Rhona", - "Gomez", - "W2C 3I7", - "Oman" - ], - [ - "1613", - "Kai", - "Acosta", - "N2O 7M2", - "Uganda" - ], - [ - "1614", - "Henry", - "Roman", - "78113", - "Guadeloupe" - ], - [ - "1615", - "Chester", - "Good", - "88809", - "Norway" - ], - [ - "1616", - "Cleo", - "Tanner", - "73924", - "Uganda" - ], - [ - "1617", - "Emi", - "Lloyd", - "59746", - "South Africa" - ], - [ - "1618", - "Christopher", - "Lopez", - "76264", - "Libyan Arab Jamahiriya" - ], - [ - "1619", - "Yvonne", - "Mathews", - "68655", - "Saint Lucia" - ], - [ - "1620", - "Kimberly", - "Mullen", - "D6J 9G3", - "Virgin Islands, British" - ], - [ - "1621", - "Hanna", - "Slater", - "F8F 9K5", - "Montserrat" - ], - [ - "1622", - "Laura", - "Dennis", - "J6U 2G3", - "Viet Nam" - ], - [ - "1623", - "Rogan", - "Richards", - "R1D 1B3", - "Argentina" - ], - [ - "1624", - "Mira", - "Rodriquez", - "C3D 3E5", - "Guinea" - ], - [ - "1625", - "Ezra", - "Myers", - "Y7Z 7X2", - "Kuwait" - ], - [ - "1626", - "Jocelyn", - "Martin", - "E2F 3F2", - "Algeria" - ], - [ - "1627", - "Denton", - "Lee", - "80903", - "Congo" - ], - [ - "1628", - "Grace", - "Leach", - "86865", - "Spain" - ], - [ - "1629", - "Clark", - "Morrow", - "12834", - "Northern Mariana Islands" - ], - [ - "1630", - "Armando", - "Calhoun", - "I3I 1D4", - "Spain" - ], - [ - "1631", - "George", - "Decker", - "R1B 6Q9", - "Mali" - ], - [ - "1632", - "Jerome", - "Salazar", - "03831", - "Faroe Islands" - ], - [ - "1633", - "Logan", - "Santiago", - "46269", - "Hungary" - ], - [ - "1634", - "Gavin", - "Tate", - "Y3L 6G5", - "Italy" - ], - [ - "1635", - "Chloe", - "Jennings", - "D9B 2H9", - "Cambodia" - ], - [ - "1636", - "Rashad", - "Knox", - "T1V 4G5", - "Germany" - ], - [ - "1637", - "Jin", - "Roberts", - "82928", - "Azerbaijan" - ], - [ - "1638", - "Amity", - "Guerrero", - "F4G 2L4", - "Viet Nam" - ], - [ - "1639", - "Carter", - "Roberson", - "53651", - "Niue" - ], - [ - "1640", - "Slade", - "Carson", - "H9E 1G1", - "Guyana" - ], - [ - "1641", - "Buckminster", - "Christensen", - "F5J 6T5", - "Algeria" - ], - [ - "1642", - "Fallon", - "Peters", - "D9Y 5Q4", - "Ethiopia" - ], - [ - "1643", - "Amy", - "Barry", - "D6F 3R4", - "New Caledonia" - ], - [ - "1644", - "Calvin", - "Buck", - "18354", - "Macedonia" - ], - [ - "1645", - "Kaye", - "Haynes", - "D9K 1X8", - "Italy" - ], - [ - "1646", - "Shea", - "Hammond", - "R7P 3X8", - "Guam" - ], - [ - "1647", - "Kiara", - "Franks", - "01185", - "Mozambique" - ], - [ - "1648", - "Armando", - "Oneil", - "88972", - "Bahrain" - ], - [ - "1649", - "Lesley", - "Allen", - "05171", - "Belgium" - ], - [ - "1650", - "Ignatius", - "Barrett", - "94084", - "Georgia" - ], - [ - "1651", - "Graham", - "Maldonado", - "76354", - "Dominican Republic" - ], - [ - "1652", - "Briar", - "Roman", - "P9M 3A9", - "Cayman Islands" - ], - [ - "1653", - "Germane", - "Colon", - "U3X 7S9", - "Brazil" - ], - [ - "1654", - "Alvin", - "Mcpherson", - "58411", - "Guinea" - ], - [ - "1655", - "Belle", - "Sandoval", - "87172", - "Cyprus" - ], - [ - "1656", - "Eric", - "Caldwell", - "63246", - "Guinea" - ], - [ - "1657", - "Nadine", - "Dale", - "T6E 4B0", - "Denmark" - ], - [ - "1658", - "Dora", - "Jimenez", - "85463", - "Nauru" - ], - [ - "1659", - "Mohammad", - "Strickland", - "H8B 9G2", - "Japan" - ], - [ - "1660", - "Reagan", - "Preston", - "G5E 8S5", - "Honduras" - ], - [ - "1661", - "Tamekah", - "Daniel", - "Z3X 6Q6", - "Belarus" - ], - [ - "1662", - "Halee", - "Mills", - "23332", - "Mayotte" - ], - [ - "1663", - "Courtney", - "England", - "09751", - "Saint Kitts and Nevis" - ], - [ - "1664", - "Dai", - "Arnold", - "A2N 9J4", - "Argentina" - ], - [ - "1665", - "Priscilla", - "Reyes", - "G2B 5M4", - "Azerbaijan" - ], - [ - "1666", - "Brenda", - "Stanley", - "I6O 3I1", - "Hungary" - ], - [ - "1667", - "Kasper", - "Washington", - "H4K 8K7", - "Serbia and Montenegro" - ], - [ - "1668", - "Suki", - "Hendricks", - "L1K 5O9", - "Norway" - ], - [ - "1669", - "Rebekah", - "Mccormick", - "89543", - "Slovenia" - ], - [ - "1670", - "Oprah", - "Rodriquez", - "90034", - "Costa Rica" - ], - [ - "1671", - "Ivory", - "Matthews", - "T9J 2A7", - "Panama" - ], - [ - "1672", - "Ferris", - "Garner", - "93583", - "Niue" - ], - [ - "1673", - "Melvin", - "White", - "X5U 9N8", - "Nigeria" - ], - [ - "1674", - "Henry", - "Swanson", - "E7V 2C9", - "Northern Mariana Islands" - ], - [ - "1675", - "Hadassah", - "Eaton", - "52798", - "Albania" - ], - [ - "1676", - "Lisandra", - "Sykes", - "90838", - "Namibia" - ], - [ - "1677", - "Honorato", - "Bradshaw", - "W3D 1Z9", - "United States" - ], - [ - "1678", - "Aurelia", - "Paul", - "Z6E 6W9", - "Malaysia" - ], - [ - "1679", - "Arthur", - "Mann", - "74673", - "Bhutan" - ], - [ - "1680", - "Melissa", - "Hernandez", - "11742", - "Dominican Republic" - ], - [ - "1681", - "Bert", - "Mosley", - "N2K 5U5", - "Kuwait" - ], - [ - "1682", - "Sigourney", - "Sharpe", - "30204", - "South Africa" - ], - [ - "1683", - "Ifeoma", - "Woods", - "39850", - "Haiti" - ], - [ - "1684", - "Tyler", - "Medina", - "K6L 9V8", - "Indonesia" - ], - [ - "1685", - "Karleigh", - "Griffin", - "G8Z 6W2", - "Canada" - ], - [ - "1686", - "Brianna", - "Collins", - "11919", - "New Caledonia" - ], - [ - "1687", - "Allistair", - "Hampton", - "O1X 2N7", - "Cocos (Keeling) Islands" - ], - [ - "1688", - "Carla", - "Manning", - "76866", - "Svalbard and Jan Mayen" - ], - [ - "1689", - "Jakeem", - "Brewer", - "Y1T 1D7", - "Comoros" - ], - [ - "1690", - "Price", - "Guerrero", - "S7Z 8O1", - "Christmas Island" - ], - [ - "1691", - "Harlan", - "Sandoval", - "58527", - "Czech Republic" - ], - [ - "1692", - "Marcia", - "Robinson", - "64662", - "Uganda" - ], - [ - "1693", - "Sylvester", - "Hewitt", - "81468", - "Honduras" - ], - [ - "1694", - "Dawn", - "Wood", - "77743", - "Malawi" - ], - [ - "1695", - "Farrah", - "Nielsen", - "E4N 9A9", - "Christmas Island" - ], - [ - "1696", - "Tanisha", - "Benjamin", - "L2J 3G7", - "Cape Verde" - ], - [ - "1697", - "Cherokee", - "Atkins", - "L7D 2L5", - "Moldova" - ], - [ - "1698", - "Madaline", - "Elliott", - "H7K 8R4", - "Barbados" - ], - [ - "1699", - "Odysseus", - "Roy", - "65008", - "Slovakia" - ], - [ - "1700", - "Eaton", - "Stein", - "Z2V 7H0", - "Moldova" - ], - [ - "1701", - "Rachel", - "Hurley", - "L6L 2B2", - "Antigua and Barbuda" - ], - [ - "1702", - "Stacey", - "Hardin", - "O9U 1B7", - "Montserrat" - ], - [ - "1703", - "Grady", - "Montgomery", - "75852", - "Guinea-bissau" - ], - [ - "1704", - "Serena", - "Douglas", - "F5M 8Z6", - "Mauritius" - ], - [ - "1705", - "Ralph", - "Duke", - "H7X 3M9", - "Tunisia" - ], - [ - "1706", - "Charles", - "Moody", - "86445", - "Pitcairn" - ], - [ - "1707", - "Mariam", - "Lara", - "07952", - "United Kingdom" - ], - [ - "1708", - "Whitney", - "Garza", - "74001", - "Norfolk Island" - ], - [ - "1709", - "Beverly", - "Thornton", - "69847", - "Canada" - ], - [ - "1710", - "Helen", - "Gentry", - "Z8S 7U4", - "Reunion" - ], - [ - "1711", - "Janna", - "Gould", - "W6C 6E1", - "Burundi" - ], - [ - "1712", - "Jana", - "Hooper", - "A1R 9Y0", - "Yemen" - ], - [ - "1713", - "Zachary", - "Nicholson", - "49616", - "Gabon" - ], - [ - "1714", - "Julian", - "Davis", - "37608", - "Anguilla" - ], - [ - "1715", - "Gay", - "Knox", - "51952", - "Croatia" - ], - [ - "1716", - "Iola", - "Moses", - "16601", - "French Polynesia" - ], - [ - "1717", - "Allegra", - "Holder", - "C9R 8J3", - "Dominican Republic" - ], - [ - "1718", - "Cecilia", - "Shannon", - "62624", - "Reunion" - ], - [ - "1719", - "Cora", - "Peterson", - "I9V 5P5", - "Chad" - ], - [ - "1720", - "Stewart", - "Mathews", - "A5H 1E1", - "Mexico" - ], - [ - "1721", - "Kathleen", - "Lynn", - "82408", - "Honduras" - ], - [ - "1722", - "William", - "Schneider", - "25823", - "Tajikistan" - ], - [ - "1723", - "Alice", - "Mcconnell", - "50155", - "Russian Federation" - ], - [ - "1724", - "Timon", - "Dillon", - "93171", - "Croatia" - ], - [ - "1725", - "Tanek", - "Ellison", - "Y7Q 5B1", - "Malawi" - ], - [ - "1726", - "Tamekah", - "Cummings", - "03764", - "Afghanistan" - ], - [ - "1727", - "Charlotte", - "Chaney", - "U7Y 7B0", - "Kyrgyzstan" - ], - [ - "1728", - "Jason", - "Conway", - "37713", - "Martinique" - ], - [ - "1729", - "Graiden", - "Combs", - "40454", - "Turkmenistan" - ], - [ - "1730", - "Virginia", - "Ortiz", - "K9N 2Q4", - "Malta" - ], - [ - "1731", - "Thomas", - "Cannon", - "W1H 3T9", - "Cuba" - ], - [ - "1732", - "Galena", - "Dominguez", - "68072", - "India" - ], - [ - "1733", - "Vaughan", - "Petty", - "15200", - "Lesotho" - ], - [ - "1734", - "Buffy", - "Saunders", - "K1W 3B1", - "Burkina Faso" - ], - [ - "1735", - "Chava", - "Hill", - "93461", - "Iran, Islamic Republic of" - ], - [ - "1736", - "Sage", - "Hampton", - "R8Y 8J1", - "Malta" - ], - [ - "1737", - "Nathaniel", - "Whitney", - "89097", - "Ukraine" - ], - [ - "1738", - "Hector", - "Hayden", - "70774", - "Netherlands" - ], - [ - "1739", - "Mercedes", - "Freeman", - "80848", - "Croatia" - ], - [ - "1740", - "Vance", - "Spencer", - "25484", - "Guyana" - ], - [ - "1741", - "Josephine", - "Stevens", - "E4D 9D1", - "Netherlands Antilles" - ], - [ - "1742", - "Barbara", - "Mcclure", - "22602", - "Cambodia" - ], - [ - "1743", - "Sydney", - "Holder", - "X4G 1Z7", - "British Indian Ocean Territory" - ], - [ - "1744", - "Velma", - "Evans", - "83914", - "New Zealand" - ], - [ - "1745", - "Francis", - "Lane", - "12545", - "Serbia and Montenegro" - ], - [ - "1746", - "Garrison", - "Brock", - "19993", - "Eritrea" - ], - [ - "1747", - "Quentin", - "Santiago", - "07085", - "Norfolk Island" - ], - [ - "1748", - "Ivory", - "Wilkerson", - "79440", - "Libyan Arab Jamahiriya" - ], - [ - "1749", - "Karyn", - "Buckner", - "D1Y 7D8", - "Cocos (Keeling) Islands" - ], - [ - "1750", - "Mari", - "Bright", - "24721", - "Pakistan" - ], - [ - "1751", - "Dexter", - "Garrison", - "X3X 7G3", - "Western Sahara" - ], - [ - "1752", - "Venus", - "Acevedo", - "V2F 8C0", - "Poland" - ], - [ - "1753", - "Nayda", - "Camacho", - "F6H 6J5", - "Northern Mariana Islands" - ], - [ - "1754", - "Avye", - "Hartman", - "G6V 2H0", - "Hong Kong" - ], - [ - "1755", - "Kerry", - "Baird", - "M3Q 7B7", - "Russian Federation" - ], - [ - "1756", - "Uma", - "Herman", - "C9A 4P3", - "Libyan Arab Jamahiriya" - ], - [ - "1757", - "Amaya", - "Roman", - "97179", - "Iceland" - ], - [ - "1758", - "Bruce", - "Joyce", - "18344", - "Denmark" - ], - [ - "1759", - "Jarrod", - "Alvarez", - "59269", - "Liberia" - ], - [ - "1760", - "Olivia", - "Reilly", - "99058", - "Malaysia" - ], - [ - "1761", - "Benedict", - "Hensley", - "23105", - "Uganda" - ], - [ - "1762", - "Lavinia", - "Hunter", - "44729", - "Maldives" - ], - [ - "1763", - "Bradley", - "Gomez", - "65125", - "Belize" - ], - [ - "1764", - "Keely", - "Burris", - "18390", - "Brunei Darussalam" - ], - [ - "1765", - "Autumn", - "England", - "E5D 7A5", - "Kyrgyzstan" - ], - [ - "1766", - "Jane", - "Blair", - "S1W 4O0", - "Bangladesh" - ], - [ - "1767", - "Chancellor", - "Barrett", - "E9F 1I1", - "Fiji" - ], - [ - "1768", - "Whitney", - "Morin", - "G5T 4E7", - "Aruba" - ], - [ - "1769", - "Madeline", - "Sparks", - "W7L 7E0", - "Belize" - ], - [ - "1770", - "Dale", - "Estes", - "82712", - "Guam" - ], - [ - "1771", - "Hakeem", - "Buck", - "O6K 1I8", - "Singapore" - ], - [ - "1772", - "Alexandra", - "Burns", - "12697", - "Portugal" - ], - [ - "1773", - "Winifred", - "Gill", - "Z8B 8B8", - "Uruguay" - ], - [ - "1774", - "Gail", - "Gomez", - "S1V 3N8", - "American Samoa" - ], - [ - "1775", - "Moana", - "Brady", - "18835", - "Wallis and Futuna" - ], - [ - "1776", - "Martha", - "Oliver", - "81962", - "Bolivia" - ], - [ - "1777", - "Nayda", - "Wooten", - "00071", - "Palau" - ], - [ - "1778", - "Bryar", - "Collier", - "50631", - "Mexico" - ], - [ - "1779", - "Penelope", - "Bradshaw", - "A6A 9M2", - "Lebanon" - ], - [ - "1780", - "Wyatt", - "Lara", - "75486", - "Slovenia" - ], - [ - "1781", - "Wang", - "Odonnell", - "N5X 1N5", - "Bahamas" - ], - [ - "1782", - "Chiquita", - "Harrell", - "21691", - "Guadeloupe" - ], - [ - "1783", - "Byron", - "Blankenship", - "M8A 3L4", - "Syrian Arab Republic" - ], - [ - "1784", - "Holmes", - "Stokes", - "81039", - "Mauritania" - ], - [ - "1785", - "Naomi", - "Phillips", - "56287", - "Switzerland" - ], - [ - "1786", - "Quyn", - "Johnson", - "D2T 6B7", - "Czech Republic" - ], - [ - "1787", - "Gillian", - "Sanders", - "50542", - "Colombia" - ], - [ - "1788", - "Hope", - "Benjamin", - "67423", - "Bolivia" - ], - [ - "1789", - "Bryar", - "Dean", - "U9V 9E5", - "Guatemala" - ], - [ - "1790", - "Karyn", - "Swanson", - "S6H 3R8", - "Israel" - ], - [ - "1791", - "Amena", - "David", - "02286", - "French Polynesia" - ], - [ - "1792", - "Ira", - "Joyner", - "37335", - "Cayman Islands" - ], - [ - "1793", - "Tanek", - "Oneil", - "75041", - "Slovenia" - ], - [ - "1794", - "Dolan", - "Miles", - "K7Q 9U8", - "Maldives" - ], - [ - "1795", - "Wang", - "Keith", - "88116", - "Congo" - ], - [ - "1796", - "Wylie", - "Bryant", - "93369", - "Andorra" - ], - [ - "1797", - "Heather", - "Bryant", - "78015", - "French Polynesia" - ], - [ - "1798", - "Regina", - "Wagner", - "29087", - "Virgin Islands, British" - ], - [ - "1799", - "Nathan", - "Bush", - "J5S 9L0", - "Viet Nam" - ], - [ - "1800", - "Charity", - "Dawson", - "29508", - "Greece" - ], - [ - "1801", - "Ulric", - "Guzman", - "I6R 6P6", - "Micronesia" - ], - [ - "1802", - "Keefe", - "Scott", - "J1R 8T6", - "Uzbekistan" - ], - [ - "1803", - "Florence", - "Price", - "U7P 8F6", - "Taiwan, Province of China" - ], - [ - "1804", - "Griffith", - "England", - "92557", - "China" - ], - [ - "1805", - "Kay", - "Nielsen", - "85991", - "Suriname" - ], - [ - "1806", - "Tamekah", - "Blackburn", - "47324", - "Panama" - ], - [ - "1807", - "Indira", - "Crosby", - "64463", - "Trinidad and Tobago" - ], - [ - "1808", - "Pamela", - "Vasquez", - "K2Q 9A1", - "Ghana" - ], - [ - "1809", - "Patricia", - "Haley", - "51509", - "Jordan" - ], - [ - "1810", - "Nevada", - "Prince", - "41315", - "Tokelau" - ], - [ - "1811", - "Martin", - "Wilkerson", - "Y8X 4Y5", - "Palestinian Territory, Occupied" - ], - [ - "1812", - "Deirdre", - "Castaneda", - "X1S 5E2", - "Bahrain" - ], - [ - "1813", - "Cara", - "Flynn", - "68372", - "Azerbaijan" - ], - [ - "1814", - "Sylvia", - "Alexander", - "E5F 9M5", - "Svalbard and Jan Mayen" - ], - [ - "1815", - "Macon", - "Suarez", - "69866", - "Tunisia" - ], - [ - "1816", - "Hammett", - "Haney", - "09768", - "Bangladesh" - ], - [ - "1817", - "Geoffrey", - "Simmons", - "61986", - "Burundi" - ], - [ - "1818", - "Danielle", - "Kelly", - "71568", - "Mali" - ], - [ - "1819", - "Wing", - "Brown", - "U4D 6L1", - "Uzbekistan" - ], - [ - "1820", - "Len", - "Barber", - "40311", - "Suriname" - ], - [ - "1821", - "Richard", - "Wilson", - "W9E 6D7", - "Finland" - ], - [ - "1822", - "Keaton", - "Hayes", - "55696", - "Slovakia" - ], - [ - "1823", - "Dora", - "Chaney", - "57297", - "United States Minor Outlying Islands" - ], - [ - "1824", - "Alexandra", - "Pruitt", - "17207", - "Turkmenistan" - ], - [ - "1825", - "Deanna", - "Gomez", - "C9M 9K0", - "Paraguay" - ], - [ - "1826", - "Laura", - "Downs", - "74422", - "Antigua and Barbuda" - ], - [ - "1827", - "Jolene", - "Lucas", - "K9E 6U4", - "Tokelau" - ], - [ - "1828", - "Lucy", - "Marquez", - "L1N 4O4", - "Argentina" - ], - [ - "1829", - "Abbot", - "Bishop", - "G8W 7I1", - "Guinea-bissau" - ], - [ - "1830", - "Aaron", - "Bowman", - "K8A 5K7", - "Greece" - ], - [ - "1831", - "Candace", - "Lee", - "58901", - "Turks and Caicos Islands" - ], - [ - "1832", - "Larissa", - "Allen", - "O1I 4X0", - "Belgium" - ], - [ - "1833", - "Linda", - "Malone", - "31211", - "United Arab Emirates" - ], - [ - "1834", - "Grace", - "Daugherty", - "62610", - "Cyprus" - ], - [ - "1835", - "Kyra", - "Berry", - "T2F 3E5", - "Netherlands Antilles" - ], - [ - "1836", - "Hadassah", - "Willis", - "C7H 5V4", - "El Salvador" - ], - [ - "1837", - "Kyle", - "Fitzgerald", - "X1V 2R9", - "Croatia" - ], - [ - "1838", - "Graiden", - "Atkinson", - "L9Q 6H8", - "Thailand" - ], - [ - "1839", - "Raymond", - "Fletcher", - "59574", - "Argentina" - ], - [ - "1840", - "Keaton", - "Barnett", - "O2G 6B4", - "Papua New Guinea" - ], - [ - "1841", - "Farrah", - "Kramer", - "21928", - "Netherlands Antilles" - ], - [ - "1842", - "Christian", - "Sellers", - "55504", - "Timor-leste" - ], - [ - "1843", - "Keith", - "Cohen", - "D9T 7D0", - "Italy" - ], - [ - "1844", - "Karleigh", - "Bruce", - "F2A 5H9", - "Montserrat" - ], - [ - "1845", - "Julie", - "Avery", - "T4T 3Y7", - "Nepal" - ], - [ - "1846", - "Hollee", - "Deleon", - "47524", - "Oman" - ], - [ - "1847", - "Charity", - "Booker", - "61071", - "Cocos (Keeling) Islands" - ], - [ - "1848", - "Flynn", - "Bond", - "E8L 9D2", - "Afghanistan" - ], - [ - "1849", - "Sybill", - "Roth", - "16453", - "Saudi Arabia" - ], - [ - "1850", - "Alyssa", - "Juarez", - "04466", - "Singapore" - ], - [ - "1851", - "Jennifer", - "Odonnell", - "59277", - "Tuvalu" - ], - [ - "1852", - "Carissa", - "Byrd", - "80861", - "Palau" - ], - [ - "1853", - "Coby", - "Barrett", - "04665", - "Congo" - ], - [ - "1854", - "Bertha", - "Paul", - "46442", - "Andorra" - ], - [ - "1855", - "Hayden", - "Dennis", - "K7E 3O1", - "France" - ], - [ - "1856", - "Kadeem", - "Berry", - "39544", - "Vanuatu" - ], - [ - "1857", - "Clayton", - "Burns", - "C2A 6W5", - "Andorra" - ], - [ - "1858", - "Breanna", - "Hardy", - "12284", - "Norway" - ], - [ - "1859", - "Yael", - "Hester", - "69399", - "Hong Kong" - ], - [ - "1860", - "Hunter", - "Harding", - "M4O 6N5", - "Bosnia and Herzegovina" - ], - [ - "1861", - "Breanna", - "Sutton", - "N2C 6K3", - "Singapore" - ], - [ - "1862", - "Bo", - "Huffman", - "54558", - "Taiwan, Province of China" - ], - [ - "1863", - "Zena", - "Potts", - "80326", - "Czech Republic" - ], - [ - "1864", - "Lucian", - "Sykes", - "D4M 6M5", - "Trinidad and Tobago" - ], - [ - "1865", - "Gabriel", - "Shepherd", - "77631", - "Bahrain" - ], - [ - "1866", - "Vivian", - "Gould", - "29510", - "Norway" - ], - [ - "1867", - "Ina", - "Sherman", - "08122", - "Portugal" - ], - [ - "1868", - "Constance", - "Parsons", - "D6E 9J8", - "Armenia" - ], - [ - "1869", - "Tallulah", - "Woodard", - "51380", - "Bahamas" - ], - [ - "1870", - "Amos", - "Morris", - "37846", - "Switzerland" - ], - [ - "1871", - "Charles", - "Kinney", - "45961", - "Marshall Islands" - ], - [ - "1872", - "Colby", - "Camacho", - "02978", - "Niger" - ], - [ - "1873", - "Ora", - "Hays", - "B6F 9Z9", - "Martinique" - ], - [ - "1874", - "Ariel", - "Cannon", - "04559", - "Burundi" - ], - [ - "1875", - "Beatrice", - "Hull", - "66569", - "Saint Pierre and Miquelon" - ], - [ - "1876", - "Stacey", - "Morrow", - "53760", - "Zimbabwe" - ], - [ - "1877", - "Naida", - "Thomas", - "43434", - "Virgin Islands, U.S." - ], - [ - "1878", - "Holly", - "Holcomb", - "31997", - "Kazakhstan" - ], - [ - "1879", - "Lee", - "Davenport", - "99355", - "Central African Republic" - ], - [ - "1880", - "Gary", - "Higgins", - "18703", - "Norway" - ], - [ - "1881", - "Kay", - "Wolf", - "25509", - "Switzerland" - ], - [ - "1882", - "Destiny", - "Patel", - "Q3X 2F8", - "Ghana" - ], - [ - "1883", - "Clayton", - "Middleton", - "Y5C 1I8", - "Antigua and Barbuda" - ], - [ - "1884", - "May", - "Rivers", - "26782", - "Uzbekistan" - ], - [ - "1885", - "Hadassah", - "Caldwell", - "64493", - "Chile" - ], - [ - "1886", - "Penelope", - "Gentry", - "V5N 7A6", - "Kyrgyzstan" - ], - [ - "1887", - "James", - "Boyle", - "95421", - "Indonesia" - ], - [ - "1888", - "Yuli", - "Cardenas", - "W4U 5U1", - "Solomon Islands" - ], - [ - "1889", - "George", - "Simpson", - "30385", - "Brazil" - ], - [ - "1890", - "Thaddeus", - "Ferrell", - "E6Z 2D4", - "Norfolk Island" - ], - [ - "1891", - "Piper", - "Morrow", - "S6I 1L8", - "Estonia" - ], - [ - "1892", - "Xaviera", - "Heath", - "L8I 5G1", - "Afghanistan" - ], - [ - "1893", - "Odette", - "Patton", - "L2S 4I8", - "Bosnia and Herzegovina" - ], - [ - "1894", - "Stewart", - "Phillips", - "E8E 5W6", - "El Salvador" - ], - [ - "1895", - "Kellie", - "Cooper", - "77401", - "Cape Verde" - ], - [ - "1896", - "Kathleen", - "Salinas", - "F3O 4Z9", - "Sierra Leone" - ], - [ - "1897", - "Fallon", - "Bennett", - "X3P 7L1", - "Macedonia" - ], - [ - "1898", - "Jesse", - "Guerrero", - "I2B 1Q0", - "Finland" - ], - [ - "1899", - "Zenaida", - "Mcguire", - "M5R 1X6", - "Kenya" - ], - [ - "1900", - "Carolyn", - "Richards", - "03060", - "Paraguay" - ], - [ - "1901", - "Ulla", - "Bruce", - "20940", - "Cambodia" - ], - [ - "1902", - "Adrian", - "Shaffer", - "M5O 9Y2", - "Thailand" - ], - [ - "1903", - "Callum", - "Russo", - "L3U 5S8", - "Holy See (Vatican City State)" - ], - [ - "1904", - "Echo", - "Mathews", - "49158", - "Spain" - ], - [ - "1905", - "Driscoll", - "Buckner", - "70115", - "Solomon Islands" - ], - [ - "1906", - "Nayda", - "Phillips", - "Y7D 4A9", - "Singapore" - ], - [ - "1907", - "Piper", - "Livingston", - "51701", - "Anguilla" - ], - [ - "1908", - "Zoe", - "Hoover", - "C8D 8W2", - "Iraq" - ], - [ - "1909", - "Veronica", - "Montoya", - "G6B 9S4", - "Egypt" - ], - [ - "1910", - "Kato", - "Richmond", - "41268", - "Saint Helena" - ], - [ - "1911", - "Kevyn", - "Lancaster", - "71863", - "Montserrat" - ], - [ - "1912", - "Rowan", - "Carr", - "90825", - "Ethiopia" - ], - [ - "1913", - "Alec", - "Wells", - "C9P 8I7", - "Netherlands" - ], - [ - "1914", - "Graham", - "Shields", - "S4B 5O9", - "Norfolk Island" - ], - [ - "1915", - "Pearl", - "Austin", - "43642", - "Bermuda" - ], - [ - "1916", - "Dana", - "Pugh", - "H4C 2A9", - "Tuvalu" - ], - [ - "1917", - "Lucy", - "Ellis", - "31272", - "Cameroon" - ], - [ - "1918", - "Logan", - "Wright", - "18651", - "Honduras" - ], - [ - "1919", - "Chantale", - "Velasquez", - "A5D 3X2", - "Burundi" - ], - [ - "1920", - "Linda", - "Ingram", - "R1P 1G8", - "Myanmar" - ], - [ - "1921", - "Ginger", - "Howell", - "Q5D 4E6", - "Pakistan" - ], - [ - "1922", - "Unity", - "Lester", - "P7M 7A4", - "Gibraltar" - ], - [ - "1923", - "Brett", - "Rutledge", - "Q1E 2B4", - "Thailand" - ], - [ - "1924", - "Stewart", - "Morrow", - "84299", - "Mali" - ], - [ - "1925", - "Declan", - "Aguilar", - "35400", - "Kenya" - ], - [ - "1926", - "Shad", - "Simpson", - "N8E 2U3", - "Saint Pierre and Miquelon" - ], - [ - "1927", - "Alma", - "Benton", - "Q6C 5D2", - "Pakistan" - ], - [ - "1928", - "Herman", - "Bailey", - "P5K 2X4", - "Ireland" - ], - [ - "1929", - "Keegan", - "Mendez", - "19421", - "Lesotho" - ], - [ - "1930", - "Erasmus", - "Foreman", - "J9T 1A2", - "Panama" - ], - [ - "1931", - "Tarik", - "Meyers", - "Z8V 5F9", - "Cape Verde" - ], - [ - "1932", - "Donovan", - "Knox", - "B8N 1G7", - "Iceland" - ], - [ - "1933", - "Chloe", - "Mccray", - "67537", - "United Arab Emirates" - ], - [ - "1934", - "Marvin", - "Edwards", - "21809", - "Ukraine" - ], - [ - "1935", - "Freya", - "Watkins", - "80099", - "Central African Republic" - ], - [ - "1936", - "Jerry", - "Morgan", - "C7U 7H5", - "Guinea" - ], - [ - "1937", - "Yardley", - "Marsh", - "23654", - "India" - ], - [ - "1938", - "Ava", - "Mueller", - "83374", - "Greece" - ], - [ - "1939", - "Silas", - "Joseph", - "P5M 7F2", - "Sweden" - ], - [ - "1940", - "Winifred", - "Solis", - "12335", - "Viet Nam" - ], - [ - "1941", - "Virginia", - "Cantu", - "K4C 3S5", - "Yemen" - ], - [ - "1942", - "Sade", - "Cole", - "40295", - "Spain" - ], - [ - "1943", - "Ethan", - "Hodges", - "R7W 8X2", - "Congo" - ], - [ - "1944", - "Barbara", - "Day", - "K6L 7S6", - "Nigeria" - ], - [ - "1945", - "Conan", - "Simon", - "22124", - "Guyana" - ], - [ - "1946", - "Lars", - "Puckett", - "R6Y 4N7", - "Trinidad and Tobago" - ], - [ - "1947", - "Quin", - "Ewing", - "99053", - "American Samoa" - ], - [ - "1948", - "Ali", - "Haynes", - "N6Z 7X0", - "China" - ], - [ - "1949", - "Sara", - "Wagner", - "74544", - "Chad" - ], - [ - "1950", - "Griffith", - "Fuentes", - "R1W 6Z9", - "Slovenia" - ], - [ - "1951", - "Sharon", - "Crane", - "I2Z 9D6", - "Philippines" - ], - [ - "1952", - "Marsden", - "Acosta", - "K6C 8C5", - "Jordan" - ], - [ - "1953", - "Whoopi", - "Villarreal", - "E2O 1T5", - "Svalbard and Jan Mayen" - ], - [ - "1954", - "Bruno", - "Ball", - "31931", - "Barbados" - ], - [ - "1955", - "Ulric", - "Young", - "T4R 3M5", - "Solomon Islands" - ], - [ - "1956", - "Noah", - "Gonzalez", - "L3O 6V5", - "Mayotte" - ], - [ - "1957", - "Cheryl", - "Gilliam", - "F4Q 4H9", - "Albania" - ], - [ - "1958", - "Bo", - "Rowe", - "67020", - "Jamaica" - ], - [ - "1959", - "Kelly", - "Alexander", - "P8Y 9K5", - "Somalia" - ], - [ - "1960", - "Hop", - "Navarro", - "O1G 9R6", - "Cayman Islands" - ], - [ - "1961", - "Zachery", - "Howard", - "67147", - "Fiji" - ], - [ - "1962", - "Elvis", - "Daugherty", - "X8V 7S7", - "Jordan" - ], - [ - "1963", - "Mallory", - "Hensley", - "A5S 1U6", - "Swaziland" - ], - [ - "1964", - "Fulton", - "Williams", - "P4C 4O5", - "Viet Nam" - ], - [ - "1965", - "Madison", - "Pittman", - "F8G 1P9", - "Chile" - ], - [ - "1966", - "Kermit", - "Bradford", - "W2T 6I5", - "Uganda" - ], - [ - "1967", - "Gabriel", - "Ballard", - "N5M 6W0", - "Andorra" - ], - [ - "1968", - "Jasmine", - "Barber", - "M2Z 7G5", - "French Guiana" - ], - [ - "1969", - "Thane", - "Koch", - "21097", - "Armenia" - ], - [ - "1970", - "Montana", - "Oneal", - "L2A 9Q6", - "South Africa" - ], - [ - "1971", - "Brett", - "Coleman", - "79399", - "Luxembourg" - ], - [ - "1972", - "Ivy", - "Jimenez", - "28549", - "Senegal" - ], - [ - "1973", - "Shad", - "Melton", - "Z8N 4Z5", - "Cook Islands" - ], - [ - "1974", - "Suki", - "Vance", - "H1A 1Z3", - "Ireland" - ], - [ - "1975", - "Jin", - "Hodges", - "L2I 3T8", - "France" - ], - [ - "1976", - "Diana", - "Booth", - "M3V 1S8", - "Iran, Islamic Republic of" - ], - [ - "1977", - "Martha", - "Nunez", - "27837", - "Northern Mariana Islands" - ], - [ - "1978", - "Silas", - "Ayers", - "17121", - "United States" - ], - [ - "1979", - "Ainsley", - "Whitaker", - "42695", - "Dominica" - ], - [ - "1980", - "Dillon", - "Tucker", - "N3R 3P3", - "Botswana" - ], - [ - "1981", - "Lillian", - "West", - "57665", - "Palau" - ], - [ - "1982", - "Talon", - "Hart", - "Z6T 4W3", - "Serbia and Montenegro" - ], - [ - "1983", - "Desiree", - "Booth", - "Q1W 9S1", - "Gambia" - ], - [ - "1984", - "Chastity", - "Merrill", - "F3B 9W7", - "Puerto Rico" - ], - [ - "1985", - "Nichole", - "Leon", - "T7V 5D6", - "Belize" - ], - [ - "1986", - "Rafael", - "Washington", - "87676", - "Eritrea" - ], - [ - "1987", - "Samson", - "Mathews", - "G7Q 5V6", - "Burkina Faso" - ], - [ - "1988", - "Jasper", - "Campbell", - "23791", - "Thailand" - ], - [ - "1989", - "Mason", - "Harrington", - "R9R 5S3", - "Nigeria" - ], - [ - "1990", - "Jameson", - "Frederick", - "R1N 4S0", - "Guyana" - ], - [ - "1991", - "Cadman", - "Woodard", - "43080", - "Gambia" - ], - [ - "1992", - "Catherine", - "Gill", - "W4W 8A4", - "Philippines" - ], - [ - "1993", - "Yael", - "Richards", - "99504", - "Kenya" - ], - [ - "1994", - "Porter", - "Finley", - "C8Z 5E0", - "Brunei Darussalam" - ], - [ - "1995", - "Alden", - "Merritt", - "P4E 9F0", - "Mali" - ], - [ - "1996", - "Kaye", - "Andrews", - "I5I 3A4", - "Cayman Islands" - ], - [ - "1997", - "Luke", - "Bryant", - "F3Z 2U1", - "Kuwait" - ], - [ - "1998", - "Heather", - "Blackburn", - "L1T 6B9", - "Mongolia" - ], - [ - "1999", - "Gage", - "Sykes", - "L9Q 7E6", - "Palestinian Territory, Occupied" - ], - [ - "2000", - "Kaseem", - "Harris", - "B9O 1C3", - "Korea" - ], - [ - "2001", - "Quail", - "Leonard", - "88755", - "Burkina Faso" - ], - [ - "2002", - "Dennis", - "Craft", - "13309", - "Namibia" - ], - [ - "2003", - "Ivor", - "Forbes", - "C3P 2E1", - "Malta" - ], - [ - "2004", - "Cade", - "Herman", - "R1E 5X9", - "Sri Lanka" - ], - [ - "2005", - "Larissa", - "Santiago", - "57781", - "Dominica" - ], - [ - "2006", - "Hyatt", - "Tillman", - "45071", - "Ghana" - ], - [ - "2007", - "Timothy", - "Rodgers", - "F8W 9W0", - "Andorra" - ], - [ - "2008", - "Hanae", - "Powell", - "F8B 7P7", - "Luxembourg" - ], - [ - "2009", - "Ima", - "Pennington", - "Z5W 5N5", - "Latvia" - ], - [ - "2010", - "Laurel", - "Bell", - "16805", - "Venezuela" - ], - [ - "2011", - "Avye", - "Long", - "04794", - "Dominica" - ], - [ - "2012", - "Lysandra", - "Pierce", - "H7O 3F4", - "Zimbabwe" - ], - [ - "2013", - "Eve", - "Pollard", - "L5K 6E2", - "Algeria" - ], - [ - "2014", - "Ina", - "Mcdowell", - "65712", - "Saint Lucia" - ], - [ - "2015", - "Meredith", - "Serrano", - "V8M 6K7", - "Libyan Arab Jamahiriya" - ], - [ - "2016", - "Daphne", - "Irwin", - "89933", - "Mongolia" - ], - [ - "2017", - "Adam", - "Henson", - "F6U 9D5", - "Chile" - ], - [ - "2018", - "Amery", - "Hoover", - "13408", - "Mongolia" - ], - [ - "2019", - "Quamar", - "Hendricks", - "20310", - "Gambia" - ], - [ - "2020", - "Ori", - "Wheeler", - "89005", - "Nigeria" - ], - [ - "2021", - "Zena", - "Douglas", - "Z1O 6F9", - "Serbia and Montenegro" - ], - [ - "2022", - "Buckminster", - "Huffman", - "R4V 9L2", - "Mali" - ], - [ - "2023", - "Harlan", - "Gamble", - "U4I 7M4", - "Guyana" - ], - [ - "2024", - "Dalton", - "Cline", - "63829", - "Tonga" - ], - [ - "2025", - "Martha", - "Weber", - "Z9B 4T0", - "Bangladesh" - ], - [ - "2026", - "Vernon", - "Francis", - "M5A 9X7", - "Tokelau" - ], - [ - "2027", - "Janna", - "Velazquez", - "67406", - "Qatar" - ], - [ - "2028", - "Fuller", - "Keller", - "80871", - "Burkina Faso" - ], - [ - "2029", - "Jamal", - "Spears", - "42197", - "Norfolk Island" - ], - [ - "2030", - "Christen", - "Holcomb", - "29806", - "Norway" - ], - [ - "2031", - "Mary", - "Carter", - "C6W 9K9", - "Belgium" - ], - [ - "2032", - "Colorado", - "Austin", - "62904", - "Cook Islands" - ], - [ - "2033", - "Fritz", - "Hunt", - "X8G 2V0", - "Morocco" - ], - [ - "2034", - "Isabella", - "Bush", - "17676", - "Monaco" - ], - [ - "2035", - "Adam", - "Gilliam", - "H7K 9X3", - "Indonesia" - ], - [ - "2036", - "John", - "Austin", - "O7X 4Z0", - "Czech Republic" - ], - [ - "2037", - "Cassady", - "Yates", - "68835", - "Christmas Island" - ], - [ - "2038", - "Ori", - "Cantrell", - "56920", - "Guinea" - ], - [ - "2039", - "May", - "Horn", - "47805", - "Kuwait" - ], - [ - "2040", - "Skyler", - "Clarke", - "64131", - "Lebanon" - ], - [ - "2041", - "Levi", - "Foster", - "S5Q 4B2", - "Germany" - ], - [ - "2042", - "Veda", - "Wilkinson", - "L7Z 9M8", - "Niger" - ], - [ - "2043", - "Brendan", - "Levine", - "L5B 9P4", - "Nepal" - ], - [ - "2044", - "Carson", - "Sullivan", - "93066", - "United Arab Emirates" - ], - [ - "2045", - "Steven", - "Spencer", - "F1V 9A7", - "Pitcairn" - ], - [ - "2046", - "Halla", - "Michael", - "N1U 1E7", - "Seychelles" - ], - [ - "2047", - "Jamal", - "Hobbs", - "G3D 6J7", - "New Caledonia" - ], - [ - "2048", - "Steel", - "Bush", - "U8F 6T2", - "Belize" - ], - [ - "2049", - "Ahmed", - "Dennis", - "M6E 3P3", - "Afghanistan" - ], - [ - "2050", - "Aspen", - "Estes", - "32157", - "American Samoa" - ], - [ - "2051", - "Peter", - "Kelly", - "91773", - "Morocco" - ], - [ - "2052", - "Xandra", - "Grimes", - "66702", - "Tokelau" - ], - [ - "2053", - "Michael", - "Battle", - "J2J 2N5", - "Honduras" - ], - [ - "2054", - "Steel", - "Wiggins", - "34625", - "United States Minor Outlying Islands" - ], - [ - "2055", - "Holmes", - "Christian", - "45402", - "Liechtenstein" - ], - [ - "2056", - "Charles", - "Barrett", - "O4N 9N8", - "Lebanon" - ], - [ - "2057", - "Hermione", - "Soto", - "C8E 4H8", - "Congo" - ], - [ - "2058", - "Elton", - "Maxwell", - "89033", - "Madagascar" - ], - [ - "2059", - "Zelda", - "Burks", - "B7W 5G7", - "Sweden" - ], - [ - "2060", - "Lynn", - "David", - "P3D 5K5", - "Chad" - ], - [ - "2061", - "Margaret", - "Neal", - "47438", - "Western Sahara" - ], - [ - "2062", - "David", - "Vaughan", - "E3L 8D9", - "Tokelau" - ], - [ - "2063", - "Vladimir", - "Mcfarland", - "U9V 1B3", - "Belgium" - ], - [ - "2064", - "Uriah", - "Harrington", - "77051", - "United Arab Emirates" - ], - [ - "2065", - "Noel", - "Merritt", - "J3G 7S1", - "Dominican Republic" - ], - [ - "2066", - "Christine", - "Key", - "54543", - "Niger" - ], - [ - "2067", - "Illana", - "Hendricks", - "07584", - "Montserrat" - ], - [ - "2068", - "Pearl", - "Lewis", - "U5D 2V3", - "Libyan Arab Jamahiriya" - ], - [ - "2069", - "Victoria", - "Bullock", - "17462", - "Mauritania" - ], - [ - "2070", - "Benedict", - "Marsh", - "61479", - "Guyana" - ], - [ - "2071", - "Quemby", - "Washington", - "99774", - "French Polynesia" - ], - [ - "2072", - "Shelley", - "Noble", - "U8S 5Z4", - "Philippines" - ], - [ - "2073", - "Olivia", - "Britt", - "72344", - "Holy See (Vatican City State)" - ], - [ - "2074", - "Oleg", - "Hendrix", - "67567", - "Cuba" - ], - [ - "2075", - "Hermione", - "Gutierrez", - "J5K 2J1", - "Mozambique" - ], - [ - "2076", - "Myra", - "Dean", - "03485", - "Andorra" - ], - [ - "2077", - "Deacon", - "Moore", - "34501", - "Tunisia" - ], - [ - "2078", - "Dai", - "Baird", - "B2P 4R0", - "Cambodia" - ], - [ - "2079", - "Levi", - "Melton", - "K7T 4B1", - "Zimbabwe" - ], - [ - "2080", - "Ocean", - "Dalton", - "66801", - "Gabon" - ], - [ - "2081", - "Selma", - "Harding", - "D7N 3J9", - "Kyrgyzstan" - ], - [ - "2082", - "Maisie", - "Gill", - "56324", - "Morocco" - ], - [ - "2083", - "Hillary", - "Horne", - "Y6O 6G3", - "Cyprus" - ], - [ - "2084", - "Joel", - "Stokes", - "77952", - "Burundi" - ], - [ - "2085", - "Channing", - "Patterson", - "G6B 8H4", - "China" - ], - [ - "2086", - "Elliott", - "Cleveland", - "H3J 9U9", - "Namibia" - ], - [ - "2087", - "Petra", - "Gay", - "44314", - "Palestinian Territory, Occupied" - ], - [ - "2088", - "May", - "Hatfield", - "48918", - "Faroe Islands" - ], - [ - "2089", - "Jemima", - "Francis", - "14347", - "Libyan Arab Jamahiriya" - ], - [ - "2090", - "Kyla", - "Hale", - "46200", - "Cocos (Keeling) Islands" - ], - [ - "2091", - "Veda", - "Bruce", - "F5W 9A6", - "Mauritania" - ], - [ - "2092", - "Sybill", - "Avila", - "58663", - "Angola" - ], - [ - "2093", - "Charissa", - "Salazar", - "35271", - "Faroe Islands" - ], - [ - "2094", - "Steven", - "Allison", - "E5L 4A3", - "Wallis and Futuna" - ], - [ - "2095", - "Kane", - "Parks", - "D5C 6K7", - "Norfolk Island" - ], - [ - "2096", - "Alika", - "Bishop", - "S3P 3O3", - "China" - ], - [ - "2097", - "James", - "Bonner", - "33277", - "Canada" - ], - [ - "2098", - "Yoko", - "Foster", - "B5J 6P9", - "Croatia" - ], - [ - "2099", - "Ivy", - "Riggs", - "94420", - "Kiribati" - ], - [ - "2100", - "Urielle", - "Rosa", - "V6W 2A0", - "Falkland Islands (Malvinas)" - ], - [ - "2101", - "Armando", - "Shepherd", - "Y5C 5W6", - "Panama" - ], - [ - "2102", - "Haley", - "Ingram", - "B4H 5U5", - "Fiji" - ], - [ - "2103", - "Brielle", - "Dyer", - "P2S 4H7", - "Malawi" - ], - [ - "2104", - "Francis", - "Brady", - "24239", - "Uruguay" - ], - [ - "2105", - "Fiona", - "Webster", - "72015", - "Belize" - ], - [ - "2106", - "Aiko", - "Santos", - "K4H 1N0", - "Saint Vincent and The Grenadines" - ], - [ - "2107", - "Amir", - "Rivas", - "02737", - "Papua New Guinea" - ], - [ - "2108", - "Mira", - "Kerr", - "W6E 6Y2", - "Sri Lanka" - ], - [ - "2109", - "Harrison", - "Jensen", - "50193", - "Heard Island and Mcdonald Islands" - ], - [ - "2110", - "Merrill", - "Randall", - "21534", - "Colombia" - ], - [ - "2111", - "Benjamin", - "Howe", - "N8M 4N6", - "Turkmenistan" - ], - [ - "2112", - "Melyssa", - "Kidd", - "97657", - "Cameroon" - ], - [ - "2113", - "Henry", - "Moore", - "95626", - "Botswana" - ], - [ - "2114", - "Nash", - "Peters", - "K3V 9F3", - "Wallis and Futuna" - ], - [ - "2115", - "Iliana", - "Holt", - "E9F 2Q8", - "Netherlands Antilles" - ], - [ - "2116", - "Naomi", - "Hood", - "P6D 2G3", - "Anguilla" - ], - [ - "2117", - "Ainsley", - "Barron", - "94273", - "New Caledonia" - ], - [ - "2118", - "Daphne", - "Acevedo", - "A9I 9E4", - "Bermuda" - ], - [ - "2119", - "Kiona", - "Keith", - "62523", - "Saint Lucia" - ], - [ - "2120", - "Kirsten", - "Mcgee", - "97481", - "Macedonia" - ], - [ - "2121", - "Emerald", - "Franklin", - "Q2I 6D6", - "Botswana" - ], - [ - "2122", - "Hall", - "Schroeder", - "I2D 9L7", - "Kenya" - ], - [ - "2123", - "Amaya", - "Lynch", - "50534", - "Costa Rica" - ], - [ - "2124", - "Randall", - "Hanson", - "B4R 2S3", - "United Arab Emirates" - ], - [ - "2125", - "Sasha", - "Clarke", - "50972", - "United States Minor Outlying Islands" - ], - [ - "2126", - "Susan", - "Sutton", - "Z4T 6K3", - "Solomon Islands" - ], - [ - "2127", - "Hiram", - "Torres", - "C8O 5O7", - "Botswana" - ], - [ - "2128", - "Melanie", - "Calhoun", - "87097", - "New Zealand" - ], - [ - "2129", - "Courtney", - "Sutton", - "07944", - "Spain" - ], - [ - "2130", - "Reuben", - "Beard", - "U6Z 8N5", - "Faroe Islands" - ], - [ - "2131", - "Jarrod", - "Payne", - "94171", - "Turkey" - ], - [ - "2132", - "Vincent", - "Potts", - "V5Z 9G9", - "Madagascar" - ], - [ - "2133", - "Kaye", - "Kent", - "O1B 2Z9", - "Fiji" - ], - [ - "2134", - "Carol", - "Green", - "78719", - "Comoros" - ], - [ - "2135", - "Cairo", - "Combs", - "G3C 8F0", - "Indonesia" - ], - [ - "2136", - "Ebony", - "Parker", - "77377", - "Portugal" - ], - [ - "2137", - "Gary", - "Shaffer", - "F1B 9W7", - "French Guiana" - ], - [ - "2138", - "Gay", - "Jimenez", - "05726", - "Nepal" - ], - [ - "2139", - "Patience", - "Bryan", - "60437", - "Macao" - ], - [ - "2140", - "Zenaida", - "Bowen", - "V3S 1G7", - "Mauritania" - ], - [ - "2141", - "Isaac", - "Aguirre", - "X8S 9K4", - "Bermuda" - ], - [ - "2142", - "Lacy", - "Harrell", - "67362", - "Bhutan" - ], - [ - "2143", - "Jael", - "Grimes", - "95612", - "Anguilla" - ], - [ - "2144", - "Catherine", - "Galloway", - "45834", - "Suriname" - ], - [ - "2145", - "Donna", - "Burt", - "N8C 2M8", - "Burkina Faso" - ], - [ - "2146", - "Colleen", - "Ball", - "N3E 4U8", - "Libyan Arab Jamahiriya" - ], - [ - "2147", - "Lael", - "Brady", - "01369", - "Macedonia" - ], - [ - "2148", - "Kermit", - "Logan", - "Y5P 8Q8", - "Honduras" - ], - [ - "2149", - "Katelyn", - "Orr", - "R7X 9W3", - "Switzerland" - ], - [ - "2150", - "Alisa", - "Glenn", - "17831", - "Timor-leste" - ], - [ - "2151", - "Lee", - "Bean", - "89445", - "Guam" - ], - [ - "2152", - "Maryam", - "Cotton", - "57924", - "Gambia" - ], - [ - "2153", - "Amena", - "Love", - "X1Z 6F7", - "Thailand" - ], - [ - "2154", - "Tallulah", - "Case", - "87477", - "Ecuador" - ], - [ - "2155", - "Carlos", - "Sanford", - "F6S 8J6", - "Iraq" - ], - [ - "2156", - "Quamar", - "David", - "D5F 2M8", - "Gabon" - ], - [ - "2157", - "Cassady", - "Mays", - "12786", - "Netherlands" - ], - [ - "2158", - "Jenna", - "Rowland", - "88845", - "China" - ], - [ - "2159", - "Justin", - "Tanner", - "66071", - "Nepal" - ], - [ - "2160", - "Riley", - "Santiago", - "F8K 2Y6", - "Gabon" - ], - [ - "2161", - "Iris", - "Gallegos", - "K9C 3T9", - "Niue" - ], - [ - "2162", - "Kato", - "Osborn", - "N4C 2L8", - "Puerto Rico" - ], - [ - "2163", - "Imogene", - "Schroeder", - "79710", - "United States Minor Outlying Islands" - ], - [ - "2164", - "Olympia", - "Hebert", - "D4W 1L0", - "Saint Lucia" - ], - [ - "2165", - "Skyler", - "Burnett", - "B2R 5H7", - "Antarctica" - ], - [ - "2166", - "Faith", - "Sims", - "88476", - "Egypt" - ], - [ - "2167", - "Emily", - "Odom", - "U7O 2P6", - "Kuwait" - ], - [ - "2168", - "Carly", - "Washington", - "46063", - "Benin" - ], - [ - "2169", - "Jolene", - "Meyer", - "B2B 9A4", - "Australia" - ], - [ - "2170", - "Ayanna", - "Conrad", - "84360", - "Northern Mariana Islands" - ], - [ - "2171", - "Violet", - "Blankenship", - "W2B 3U1", - "New Caledonia" - ], - [ - "2172", - "Rhona", - "Gallegos", - "10931", - "Montserrat" - ], - [ - "2173", - "Alice", - "Hodges", - "96181", - "Burkina Faso" - ], - [ - "2174", - "Brody", - "Sandoval", - "68959", - "Pitcairn" - ], - [ - "2175", - "Isabella", - "Dunlap", - "U8U 7Y8", - "Afghanistan" - ], - [ - "2176", - "Jordan", - "Golden", - "55152", - "Guam" - ], - [ - "2177", - "Gillian", - "Thomas", - "75633", - "Djibouti" - ], - [ - "2178", - "Hollee", - "Clay", - "79847", - "Panama" - ], - [ - "2179", - "Dane", - "Knapp", - "89535", - "Armenia" - ], - [ - "2180", - "Avram", - "Martin", - "T4S 4E2", - "Madagascar" - ], - [ - "2181", - "Fuller", - "Newman", - "47317", - "Jamaica" - ], - [ - "2182", - "Nina", - "Berry", - "81360", - "Mongolia" - ], - [ - "2183", - "Akeem", - "Pratt", - "56230", - "Colombia" - ], - [ - "2184", - "Lacy", - "Hayes", - "U7T 4F5", - "Cyprus" - ], - [ - "2185", - "Alfonso", - "Mcclure", - "06797", - "Swaziland" - ], - [ - "2186", - "Cedric", - "Love", - "64720", - "Bermuda" - ], - [ - "2187", - "Astra", - "Fernandez", - "H3I 1B0", - "Mongolia" - ], - [ - "2188", - "Iliana", - "Durham", - "R8C 7M8", - "Spain" - ], - [ - "2189", - "Gwendolyn", - "Livingston", - "C7X 5L1", - "Northern Mariana Islands" - ], - [ - "2190", - "Caldwell", - "Anderson", - "69099", - "Kuwait" - ], - [ - "2191", - "Risa", - "Mejia", - "P7A 4U7", - "Israel" - ], - [ - "2192", - "Dora", - "Navarro", - "L6G 2O8", - "Ireland" - ], - [ - "2193", - "Kirk", - "Dean", - "I2T 3E6", - "Pitcairn" - ], - [ - "2194", - "Jackson", - "Harvey", - "53467", - "Myanmar" - ], - [ - "2195", - "Thane", - "Ballard", - "87240", - "Solomon Islands" - ], - [ - "2196", - "Nadine", - "Estes", - "62003", - "Malta" - ], - [ - "2197", - "Candace", - "Nunez", - "57223", - "Virgin Islands, British" - ], - [ - "2198", - "Zelda", - "Odom", - "X4V 7F5", - "Mongolia" - ], - [ - "2199", - "Wylie", - "Ayala", - "S4I 4Q4", - "Djibouti" - ], - [ - "2200", - "Azalia", - "Page", - "57239", - "Korea, Republic of" - ], - [ - "2201", - "Joshua", - "Burch", - "R7B 1N7", - "Samoa" - ], - [ - "2202", - "Basil", - "Ramos", - "71614", - "Tunisia" - ], - [ - "2203", - "Jessica", - "Shields", - "U2D 4X3", - "Syrian Arab Republic" - ], - [ - "2204", - "Clio", - "Singleton", - "I1B 1B0", - "Ghana" - ], - [ - "2205", - "Astra", - "Dotson", - "62378", - "Turks and Caicos Islands" - ], - [ - "2206", - "Hamish", - "Tucker", - "E4Z 3N3", - "Anguilla" - ], - [ - "2207", - "Rachel", - "Matthews", - "U4I 8M3", - "Trinidad and Tobago" - ], - [ - "2208", - "Clayton", - "Ball", - "95319", - "India" - ], - [ - "2209", - "Quinn", - "Wilkinson", - "Y6M 3Q7", - "Virgin Islands, U.S." - ], - [ - "2210", - "Phelan", - "Talley", - "00543", - "Philippines" - ], - [ - "2211", - "Carol", - "Brock", - "M6X 4E2", - "Gibraltar" - ], - [ - "2212", - "Nomlanga", - "Robles", - "56511", - "Viet Nam" - ], - [ - "2213", - "Adrian", - "Clay", - "79479", - "France" - ], - [ - "2214", - "Sara", - "Riley", - "B9N 5P4", - "Peru" - ], - [ - "2215", - "Christine", - "Sweeney", - "W1Z 4S4", - "French Polynesia" - ], - [ - "2216", - "Leilani", - "Johnston", - "W1C 8M8", - "American Samoa" - ], - [ - "2217", - "Melyssa", - "Lambert", - "V1B 4P6", - "Iraq" - ], - [ - "2218", - "Talon", - "Delacruz", - "Y3N 9R2", - "Bulgaria" - ], - [ - "2219", - "Garth", - "Jennings", - "59667", - "Malta" - ], - [ - "2220", - "Naida", - "Coleman", - "45456", - "Finland" - ], - [ - "2221", - "Indigo", - "Lopez", - "77160", - "Pitcairn" - ], - [ - "2222", - "Asher", - "French", - "99064", - "British Indian Ocean Territory" - ], - [ - "2223", - "Vivian", - "Mcgowan", - "46310", - "Oman" - ], - [ - "2224", - "Gwendolyn", - "Cervantes", - "48905", - "Cocos (Keeling) Islands" - ], - [ - "2225", - "Logan", - "Reid", - "87376", - "Ethiopia" - ], - [ - "2226", - "Bryar", - "Wolfe", - "75860", - "Comoros" - ], - [ - "2227", - "Demetrius", - "Hutchinson", - "97252", - "Dominican Republic" - ], - [ - "2228", - "Freya", - "Becker", - "04872", - "United States" - ], - [ - "2229", - "Abel", - "Brooks", - "I7O 1M1", - "Comoros" - ], - [ - "2230", - "Silas", - "Mcguire", - "04101", - "Indonesia" - ], - [ - "2231", - "Quinn", - "Fletcher", - "B6E 2B0", - "Niger" - ], - [ - "2232", - "Rooney", - "Holden", - "29294", - "Micronesia" - ], - [ - "2233", - "Iris", - "Hale", - "N7W 6E9", - "Greenland" - ], - [ - "2234", - "Candace", - "Barry", - "U8I 5A4", - "Germany" - ], - [ - "2235", - "Yetta", - "Ball", - "62055", - "Switzerland" - ], - [ - "2236", - "Dai", - "Bentley", - "P2Y 4C5", - "Dominica" - ], - [ - "2237", - "Gannon", - "Dunlap", - "45728", - "Fiji" - ], - [ - "2238", - "Chelsea", - "Mays", - "36498", - "Guinea" - ], - [ - "2239", - "Ruth", - "Mcguire", - "62924", - "Maldives" - ], - [ - "2240", - "Melissa", - "Durham", - "D6S 1A2", - "Armenia" - ], - [ - "2241", - "Eaton", - "Salinas", - "53689", - "Somalia" - ], - [ - "2242", - "Driscoll", - "Cunningham", - "31194", - "Sweden" - ], - [ - "2243", - "Bevis", - "Acosta", - "V4M 9Z2", - "Jamaica" - ], - [ - "2244", - "Anastasia", - "Mcknight", - "24878", - "Sao Tome and Principe" - ], - [ - "2245", - "Anika", - "Rowland", - "45287", - "Chile" - ], - [ - "2246", - "Dexter", - "Rollins", - "00684", - "Iran, Islamic Republic of" - ], - [ - "2247", - "Brielle", - "Irwin", - "V4U 7R2", - "Belgium" - ], - [ - "2248", - "Ocean", - "Fields", - "08544", - "Croatia" - ], - [ - "2249", - "Sonia", - "Solis", - "C4X 1L5", - "Niue" - ], - [ - "2250", - "Joseph", - "Haney", - "29567", - "Argentina" - ], - [ - "2251", - "Lamar", - "Heath", - "81699", - "Italy" - ], - [ - "2252", - "Raya", - "Jordan", - "R6K 7B3", - "Spain" - ], - [ - "2253", - "Brody", - "Frost", - "34564", - "Dominican Republic" - ], - [ - "2254", - "Ann", - "Hawkins", - "S3A 5K7", - "Yemen" - ], - [ - "2255", - "Phillip", - "Lindsay", - "80544", - "Sierra Leone" - ], - [ - "2256", - "Willa", - "Maynard", - "A6A 4C5", - "Mexico" - ], - [ - "2257", - "Carolyn", - "Mercer", - "V8Z 1X5", - "Zimbabwe" - ], - [ - "2258", - "Justin", - "Cole", - "68764", - "Saint Vincent and The Grenadines" - ], - [ - "2259", - "Emmanuel", - "Parks", - "99769", - "Latvia" - ], - [ - "2260", - "Isaiah", - "Salazar", - "H1K 1X3", - "Turks and Caicos Islands" - ], - [ - "2261", - "Vance", - "Porter", - "49607", - "Costa Rica" - ], - [ - "2262", - "Igor", - "Kim", - "99489", - "Turkmenistan" - ], - [ - "2263", - "Emi", - "Graves", - "F4M 5L8", - "El Salvador" - ], - [ - "2264", - "Griffith", - "Monroe", - "11550", - "Tanzania, United Republic of" - ], - [ - "2265", - "Iliana", - "Coffey", - "30220", - "Albania" - ], - [ - "2266", - "Jemima", - "Guthrie", - "69283", - "Saint Pierre and Miquelon" - ], - [ - "2267", - "Zenia", - "Farrell", - "91872", - "Tanzania, United Republic of" - ], - [ - "2268", - "Lucas", - "Chambers", - "L5Z 1W0", - "Bouvet Island" - ], - [ - "2269", - "Zenaida", - "Valenzuela", - "31700", - "Guam" - ], - [ - "2270", - "Bradley", - "Wynn", - "21222", - "Lithuania" - ], - [ - "2271", - "Maite", - "Richard", - "H4D 7X0", - "Cameroon" - ], - [ - "2272", - "Moses", - "House", - "Y3Z 3K7", - "Saint Vincent and The Grenadines" - ], - [ - "2273", - "Erich", - "Petersen", - "U4N 9R7", - "Rwanda" - ], - [ - "2274", - "Stephanie", - "Zimmerman", - "70097", - "Malawi" - ], - [ - "2275", - "Rylee", - "Schneider", - "15645", - "Gibraltar" - ], - [ - "2276", - "Zia", - "Craig", - "H1K 1N9", - "Norway" - ], - [ - "2277", - "Fiona", - "Chaney", - "Y4U 7K8", - "San Marino" - ], - [ - "2278", - "Gil", - "Sherman", - "64720", - "Wallis and Futuna" - ], - [ - "2279", - "Raja", - "Sandoval", - "11225", - "Lithuania" - ], - [ - "2280", - "Illana", - "Wyatt", - "A2M 9O2", - "Brazil" - ], - [ - "2281", - "Declan", - "Howell", - "E9V 8J5", - "San Marino" - ], - [ - "2282", - "Warren", - "Cooper", - "47160", - "Guyana" - ], - [ - "2283", - "Alyssa", - "Juarez", - "S7G 8F2", - "Sweden" - ], - [ - "2284", - "Quynn", - "Long", - "P1P 5Y4", - "Mexico" - ], - [ - "2285", - "Dalton", - "Booker", - "I5T 1R3", - "Mauritius" - ], - [ - "2286", - "Lunea", - "Mclaughlin", - "I3F 6D4", - "Togo" - ], - [ - "2287", - "Irene", - "Brock", - "04760", - "Tajikistan" - ], - [ - "2288", - "Raven", - "Floyd", - "R2N 2Y5", - "Philippines" - ], - [ - "2289", - "Nichole", - "Farmer", - "81213", - "Seychelles" - ], - [ - "2290", - "Sophia", - "Mcdonald", - "86291", - "Chile" - ], - [ - "2291", - "Nehru", - "Matthews", - "60732", - "Central African Republic" - ], - [ - "2292", - "Marah", - "Nelson", - "44533", - "Kenya" - ], - [ - "2293", - "Marvin", - "Lyons", - "M7Y 1Q6", - "Somalia" - ], - [ - "2294", - "Ian", - "Fernandez", - "D9U 8B6", - "Turkey" - ], - [ - "2295", - "Gretchen", - "Dotson", - "48294", - "China" - ], - [ - "2296", - "Brady", - "Weaver", - "S4U 4I8", - "Burundi" - ], - [ - "2297", - "Ella", - "Salas", - "73771", - "Sao Tome and Principe" - ], - [ - "2298", - "Martha", - "Irwin", - "06554", - "Timor-leste" - ], - [ - "2299", - "Penelope", - "Pratt", - "S1R 4L4", - "Gabon" - ], - [ - "2300", - "Kenyon", - "Dale", - "64548", - "Zimbabwe" - ], - [ - "2301", - "Henry", - "Myers", - "07614", - "United Arab Emirates" - ], - [ - "2302", - "Chaney", - "Dunlap", - "18388", - "French Southern Territories" - ], - [ - "2303", - "Palmer", - "Le", - "10807", - "Colombia" - ], - [ - "2304", - "Kaseem", - "Madden", - "U4E 6L9", - "Guyana" - ], - [ - "2305", - "Grant", - "Anthony", - "F3K 4D8", - "Trinidad and Tobago" - ], - [ - "2306", - "Denton", - "Moore", - "I5O 4I5", - "Belize" - ], - [ - "2307", - "Regan", - "Pittman", - "U8T 9M1", - "Romania" - ], - [ - "2308", - "Valentine", - "Hunt", - "E9O 6H6", - "Poland" - ], - [ - "2309", - "Abraham", - "Love", - "X1T 4K0", - "Philippines" - ], - [ - "2310", - "Maggie", - "Gaines", - "W5Z 6L4", - "Chad" - ], - [ - "2311", - "Kylynn", - "Sears", - "53419", - "Ghana" - ], - [ - "2312", - "Abel", - "Hudson", - "O6C 6K5", - "Malaysia" - ], - [ - "2313", - "Aladdin", - "Brady", - "16465", - "Antarctica" - ], - [ - "2314", - "Laurel", - "Bush", - "42295", - "Kyrgyzstan" - ], - [ - "2315", - "Cameron", - "Shepherd", - "Y8R 5L7", - "Finland" - ], - [ - "2316", - "Colin", - "Barker", - "H8Q 5L0", - "Aruba" - ], - [ - "2317", - "Nichole", - "Stephens", - "B8P 3D5", - "Qatar" - ], - [ - "2318", - "Mary", - "Dorsey", - "J7D 1E5", - "Iceland" - ], - [ - "2319", - "Yetta", - "Dillon", - "I7X 9D3", - "Hong Kong" - ], - [ - "2320", - "Hope", - "May", - "L5W 1T9", - "Taiwan, Province of China" - ], - [ - "2321", - "Daphne", - "Barr", - "W2B 9G2", - "Korea, Republic of" - ], - [ - "2322", - "Melissa", - "Hartman", - "17607", - "Reunion" - ], - [ - "2323", - "Acton", - "Merritt", - "U7M 3Q5", - "Cape Verde" - ], - [ - "2324", - "Alika", - "Weeks", - "45475", - "Singapore" - ], - [ - "2325", - "Fitzgerald", - "Rowe", - "Z3Z 2B6", - "Israel" - ], - [ - "2326", - "Frances", - "Valentine", - "54329", - "Kyrgyzstan" - ], - [ - "2327", - "Hollee", - "Poole", - "56101", - "Saint Kitts and Nevis" - ], - [ - "2328", - "Melissa", - "Stafford", - "R5C 7V0", - "Philippines" - ], - [ - "2329", - "Patience", - "Jones", - "61516", - "Mauritius" - ], - [ - "2330", - "Uta", - "Sloan", - "K1B 9R2", - "Timor-leste" - ], - [ - "2331", - "Brent", - "West", - "69310", - "Burundi" - ], - [ - "2332", - "Otto", - "Olsen", - "88849", - "Monaco" - ], - [ - "2333", - "Blossom", - "Soto", - "E2Q 6E6", - "Ukraine" - ], - [ - "2334", - "Anastasia", - "Stanton", - "S8D 3U5", - "Mexico" - ], - [ - "2335", - "Nyssa", - "Massey", - "A4G 8G7", - "Ireland" - ], - [ - "2336", - "Brian", - "Moreno", - "T6O 4D7", - "Myanmar" - ], - [ - "2337", - "Fiona", - "Price", - "03826", - "Benin" - ], - [ - "2338", - "Wyoming", - "Knowles", - "I5M 7T3", - "Chad" - ], - [ - "2339", - "Iola", - "Noble", - "95251", - "Tunisia" - ], - [ - "2340", - "Cameran", - "Montgomery", - "35748", - "Korea" - ], - [ - "2341", - "Wesley", - "Sims", - "J6O 7C0", - "Hungary" - ], - [ - "2342", - "Mona", - "Gates", - "J6Y 3E2", - "Tokelau" - ], - [ - "2343", - "Dominique", - "Sellers", - "G6U 7I2", - "Sudan" - ], - [ - "2344", - "Destiny", - "Frazier", - "Y2P 5X6", - "Madagascar" - ], - [ - "2345", - "Kelsie", - "Stokes", - "78561", - "Yemen" - ], - [ - "2346", - "Julie", - "Jordan", - "U5H 4H0", - "Myanmar" - ], - [ - "2347", - "Xaviera", - "Hodge", - "36452", - "Turkey" - ], - [ - "2348", - "Cain", - "Boyd", - "74543", - "Lebanon" - ], - [ - "2349", - "Devin", - "Burch", - "94879", - "Cyprus" - ], - [ - "2350", - "Michelle", - "Manning", - "V7T 4A3", - "New Zealand" - ], - [ - "2351", - "Quintessa", - "Chapman", - "95379", - "Faroe Islands" - ], - [ - "2352", - "Danielle", - "Wells", - "27722", - "Colombia" - ], - [ - "2353", - "Faith", - "Decker", - "04881", - "Canada" - ], - [ - "2354", - "Gannon", - "Chapman", - "07687", - "Israel" - ], - [ - "2355", - "Jayme", - "Black", - "A6L 9W1", - "Jordan" - ], - [ - "2356", - "Zenia", - "Cooley", - "A6X 1B7", - "Greenland" - ], - [ - "2357", - "Maris", - "Burton", - "J4G 1Y0", - "Ecuador" - ], - [ - "2358", - "Rina", - "Vazquez", - "G3V 7G6", - "Russian Federation" - ], - [ - "2359", - "Nina", - "Stanton", - "E7Z 1W0", - "Dominica" - ], - [ - "2360", - "Alexandra", - "Jenkins", - "C6N 4R4", - "Morocco" - ], - [ - "2361", - "Jerome", - "Chen", - "68955", - "Israel" - ], - [ - "2362", - "Clementine", - "Robbins", - "X7I 7T3", - "Croatia" - ], - [ - "2363", - "Nigel", - "Guthrie", - "A4N 6X8", - "French Southern Territories" - ], - [ - "2364", - "Xaviera", - "Griffith", - "90489", - "Cuba" - ], - [ - "2365", - "Marsden", - "Best", - "U4B 5R7", - "Estonia" - ], - [ - "2366", - "Ebony", - "Benson", - "H7C 7F7", - "Anguilla" - ], - [ - "2367", - "Kylie", - "Hansen", - "38932", - "Eritrea" - ], - [ - "2368", - "Iola", - "Copeland", - "P4X 9M4", - "Rwanda" - ], - [ - "2369", - "Jorden", - "Green", - "48018", - "Namibia" - ], - [ - "2370", - "Hamish", - "Porter", - "L6F 8L1", - "Taiwan, Province of China" - ], - [ - "2371", - "Ezra", - "Taylor", - "09148", - "French Southern Territories" - ], - [ - "2372", - "Dara", - "Pratt", - "00558", - "Saint Kitts and Nevis" - ], - [ - "2373", - "Oliver", - "Holt", - "C4N 5Z7", - "Thailand" - ], - [ - "2374", - "Kato", - "Mcgee", - "17017", - "Micronesia" - ], - [ - "2375", - "Fuller", - "Rogers", - "M8F 6Y7", - "French Polynesia" - ], - [ - "2376", - "Carol", - "Stuart", - "55980", - "Sudan" - ], - [ - "2377", - "Wayne", - "Nichols", - "37344", - "Chile" - ], - [ - "2378", - "Lars", - "Gilbert", - "27076", - "Micronesia" - ], - [ - "2379", - "Todd", - "Rollins", - "M4I 4X8", - "Virgin Islands, U.S." - ], - [ - "2380", - "Colorado", - "Justice", - "68795", - "Yemen" - ], - [ - "2381", - "Jordan", - "Chang", - "11149", - "Mayotte" - ], - [ - "2382", - "Troy", - "Haynes", - "N2N 1N8", - "Reunion" - ], - [ - "2383", - "Amity", - "Snyder", - "17785", - "Argentina" - ], - [ - "2384", - "Kennan", - "Turner", - "30041", - "Brazil" - ], - [ - "2385", - "Dorothy", - "Gates", - "B7Z 6V4", - "Ghana" - ], - [ - "2386", - "Ariana", - "Rojas", - "70797", - "Eritrea" - ], - [ - "2387", - "Desirae", - "Joyner", - "63493", - "Maldives" - ], - [ - "2388", - "Marsden", - "Barton", - "36343", - "Chile" - ], - [ - "2389", - "Graham", - "Greer", - "65152", - "Cayman Islands" - ], - [ - "2390", - "Cameron", - "Edwards", - "89276", - "Montserrat" - ], - [ - "2391", - "Bradley", - "White", - "80364", - "United Kingdom" - ], - [ - "2392", - "Finn", - "Cote", - "G9P 1P0", - "Ghana" - ], - [ - "2393", - "Geoffrey", - "Becker", - "O5G 4L4", - "Wallis and Futuna" - ], - [ - "2394", - "Hayden", - "Estes", - "Q8G 7F9", - "Togo" - ], - [ - "2395", - "Quinlan", - "Garrett", - "R2C 3E7", - "Uganda" - ], - [ - "2396", - "Haviva", - "Harrington", - "64198", - "Bahamas" - ], - [ - "2397", - "Brennan", - "Hodge", - "35327", - "Paraguay" - ], - [ - "2398", - "Halee", - "Sykes", - "S6J 4S4", - "Costa Rica" - ], - [ - "2399", - "Mikayla", - "Ruiz", - "21686", - "Malaysia" - ], - [ - "2400", - "Macy", - "Stanley", - "F6D 6C4", - "Luxembourg" - ], - [ - "2401", - "Petra", - "Miles", - "O7X 2D2", - "Tokelau" - ], - [ - "2402", - "Oprah", - "Mendez", - "88994", - "France" - ], - [ - "2403", - "Upton", - "Silva", - "17878", - "French Southern Territories" - ], - [ - "2404", - "Wade", - "Pennington", - "S8J 3P2", - "Malaysia" - ], - [ - "2405", - "Gannon", - "Riddle", - "I4A 2H9", - "Somalia" - ], - [ - "2406", - "Jana", - "Myers", - "04982", - "Philippines" - ], - [ - "2407", - "Brooke", - "Hale", - "98272", - "Lithuania" - ], - [ - "2408", - "Hashim", - "Mendez", - "00144", - "Saint Helena" - ], - [ - "2409", - "Blythe", - "Hanson", - "U5Z 6P4", - "Saint Helena" - ], - [ - "2410", - "Michelle", - "Madden", - "B4R 1I9", - "Ireland" - ], - [ - "2411", - "Deirdre", - "Patton", - "B4H 1N7", - "Georgia" - ], - [ - "2412", - "Nathaniel", - "Chandler", - "W1V 8R4", - "Sierra Leone" - ], - [ - "2413", - "Tamekah", - "Murray", - "I8M 1W8", - "Guatemala" - ], - [ - "2414", - "Naida", - "Boyle", - "V4S 2N2", - "United Arab Emirates" - ], - [ - "2415", - "Hiroko", - "Winters", - "K8G 3R9", - "Barbados" - ], - [ - "2416", - "Palmer", - "Guy", - "A4H 5L1", - "Saudi Arabia" - ], - [ - "2417", - "Hermione", - "Nicholson", - "76147", - "Marshall Islands" - ], - [ - "2418", - "Russell", - "Boyd", - "66149", - "Switzerland" - ], - [ - "2419", - "Gretchen", - "Robles", - "B9L 1J7", - "Spain" - ], - [ - "2420", - "Leah", - "Gibbs", - "16682", - "Vanuatu" - ], - [ - "2421", - "Amir", - "Carlson", - "A5C 6F2", - "Myanmar" - ], - [ - "2422", - "Merrill", - "Ratliff", - "A6E 9B2", - "Tonga" - ], - [ - "2423", - "Wyatt", - "David", - "P8G 2M1", - "Kiribati" - ], - [ - "2424", - "Violet", - "Boyle", - "P5X 7B0", - "Denmark" - ], - [ - "2425", - "Jared", - "Myers", - "22131", - "Kyrgyzstan" - ], - [ - "2426", - "Lavinia", - "Stephenson", - "55537", - "Turks and Caicos Islands" - ], - [ - "2427", - "Zachary", - "Tyson", - "C4O 7V4", - "Macedonia" - ], - [ - "2428", - "Emma", - "Clark", - "A7Z 2Z1", - "Guam" - ], - [ - "2429", - "Aaron", - "Montoya", - "Q3U 2X1", - "Bahrain" - ], - [ - "2430", - "Dylan", - "Roach", - "81238", - "French Guiana" - ], - [ - "2431", - "Baxter", - "Rosario", - "H7B 1R2", - "Suriname" - ], - [ - "2432", - "Shad", - "Bolton", - "D1W 5X0", - "Barbados" - ], - [ - "2433", - "Hasad", - "Hines", - "D9U 3H1", - "Ukraine" - ], - [ - "2434", - "Maggy", - "French", - "M3E 5H8", - "Nicaragua" - ], - [ - "2435", - "Evangeline", - "Jenkins", - "57732", - "Nigeria" - ], - [ - "2436", - "Eaton", - "Shannon", - "56854", - "Namibia" - ], - [ - "2437", - "Keaton", - "Barber", - "G5V 7T0", - "Svalbard and Jan Mayen" - ], - [ - "2438", - "Lester", - "Love", - "J5Q 8H3", - "United Kingdom" - ], - [ - "2439", - "Olivia", - "Foley", - "16284", - "Mayotte" - ], - [ - "2440", - "Inez", - "Craig", - "98947", - "Poland" - ], - [ - "2441", - "Desirae", - "Jacobson", - "25950", - "French Polynesia" - ], - [ - "2442", - "Amethyst", - "Robertson", - "78840", - "Timor-leste" - ], - [ - "2443", - "Rahim", - "Day", - "61420", - "Maldives" - ], - [ - "2444", - "Kevyn", - "Mccarty", - "X7T 8Z3", - "Guam" - ], - [ - "2445", - "Logan", - "Malone", - "B6F 8N0", - "Madagascar" - ], - [ - "2446", - "Kathleen", - "Cote", - "L4R 6W9", - "Congo" - ], - [ - "2447", - "Porter", - "Mclean", - "G1Z 1W9", - "Mauritius" - ], - [ - "2448", - "Reagan", - "Chapman", - "86314", - "Palestinian Territory, Occupied" - ], - [ - "2449", - "Veda", - "Harrington", - "R7W 1K4", - "Congo" - ], - [ - "2450", - "Dominique", - "Hewitt", - "P5K 7L4", - "San Marino" - ], - [ - "2451", - "Zelda", - "Orr", - "Z5B 6V1", - "Greenland" - ], - [ - "2452", - "Natalie", - "Kane", - "10491", - "Belgium" - ], - [ - "2453", - "Elizabeth", - "Bright", - "R3V 2R4", - "Bangladesh" - ], - [ - "2454", - "Evan", - "Knapp", - "W3Z 3I5", - "Mauritius" - ], - [ - "2455", - "Unity", - "Armstrong", - "82986", - "Kiribati" - ], - [ - "2456", - "Arden", - "Winters", - "C7D 4M2", - "Sweden" - ], - [ - "2457", - "Hayfa", - "Henderson", - "B8Z 3V3", - "Latvia" - ], - [ - "2458", - "Ocean", - "Delacruz", - "Z3Z 2H8", - "Tonga" - ], - [ - "2459", - "Carter", - "Harding", - "R1Z 8J4", - "Ireland" - ], - [ - "2460", - "Harriet", - "Simmons", - "54757", - "Indonesia" - ], - [ - "2461", - "Sopoline", - "Hicks", - "I5A 6O2", - "Argentina" - ], - [ - "2462", - "Jenette", - "Ramos", - "I4V 3H6", - "Portugal" - ], - [ - "2463", - "Abigail", - "Berg", - "E6P 6L0", - "United States" - ], - [ - "2464", - "Sybill", - "Fox", - "02319", - "Svalbard and Jan Mayen" - ], - [ - "2465", - "Wyoming", - "Jarvis", - "I1R 7V9", - "Palestinian Territory, Occupied" - ], - [ - "2466", - "Cynthia", - "English", - "17983", - "Israel" - ], - [ - "2467", - "Jerry", - "Little", - "33846", - "Mauritius" - ], - [ - "2468", - "Quintessa", - "Donaldson", - "V4N 2K1", - "China" - ], - [ - "2469", - "Anne", - "Potter", - "78596", - "United States Minor Outlying Islands" - ], - [ - "2470", - "Madonna", - "Hart", - "A4A 4T8", - "Bahrain" - ], - [ - "2471", - "Madeline", - "Walls", - "Y3D 4T3", - "Comoros" - ], - [ - "2472", - "Fleur", - "Blevins", - "D1T 9P6", - "Guinea-bissau" - ], - [ - "2473", - "Jaden", - "Webb", - "13917", - "Lesotho" - ], - [ - "2474", - "Abdul", - "Fleming", - "A8A 3Y3", - "Canada" - ], - [ - "2475", - "Blaze", - "Carroll", - "41059", - "Marshall Islands" - ], - [ - "2476", - "David", - "Hoover", - "29132", - "Algeria" - ], - [ - "2477", - "Renee", - "Nieves", - "35843", - "Egypt" - ], - [ - "2478", - "Jaime", - "Mcclure", - "R5K 6B5", - "Liechtenstein" - ], - [ - "2479", - "Deborah", - "Fletcher", - "70399", - "Equatorial Guinea" - ], - [ - "2480", - "Otto", - "Lopez", - "72417", - "Belarus" - ], - [ - "2481", - "Bo", - "Walls", - "F4M 8X8", - "Latvia" - ], - [ - "2482", - "Jamal", - "Adams", - "N9X 3A2", - "Spain" - ], - [ - "2483", - "Silas", - "Gardner", - "25259", - "French Guiana" - ], - [ - "2484", - "Aladdin", - "Morin", - "45179", - "Sweden" - ], - [ - "2485", - "Dawn", - "Grant", - "53613", - "Grenada" - ], - [ - "2486", - "Forrest", - "Gay", - "53606", - "Cayman Islands" - ], - [ - "2487", - "Lavinia", - "Murphy", - "S5L 6X9", - "Turkey" - ], - [ - "2488", - "Sylvia", - "Wolfe", - "37280", - "Indonesia" - ], - [ - "2489", - "Wynter", - "Adkins", - "37391", - "Russian Federation" - ], - [ - "2490", - "Iola", - "Frank", - "I9H 1K7", - "Nigeria" - ], - [ - "2491", - "Emmanuel", - "Hester", - "Z6E 3I4", - "Guinea" - ], - [ - "2492", - "Karina", - "Christian", - "V8M 6F3", - "Honduras" - ], - [ - "2493", - "Malcolm", - "Holden", - "I7J 6U7", - "Austria" - ], - [ - "2494", - "Moana", - "Holmes", - "80402", - "Israel" - ], - [ - "2495", - "Ramona", - "Hewitt", - "U6B 7A6", - "Guadeloupe" - ], - [ - "2496", - "Nicholas", - "Terry", - "V8J 5D9", - "Costa Rica" - ], - [ - "2497", - "Erica", - "Dunlap", - "91596", - "Kazakhstan" - ], - [ - "2498", - "Logan", - "Harper", - "R7V 3T5", - "Guinea-bissau" - ], - [ - "2499", - "Bert", - "Ortega", - "74557", - "Paraguay" - ], - [ - "2500", - "Cameron", - "Ortiz", - "P9C 5B6", - "Eritrea" - ] - ] -} \ No newline at end of file diff --git a/PortalGPS/InicioGPS.aspx b/PortalGPS/InicioGPS.aspx index 3108676c0..51c7e7c0a 100644 --- a/PortalGPS/InicioGPS.aspx +++ b/PortalGPS/InicioGPS.aspx @@ -340,11 +340,5 @@ } - - <%----%> + - From 552154d81d918b3d889a533d0e2ee84e6356cb9f Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 13 May 2020 12:34:06 -0700 Subject: [PATCH 4/7] -cambios en validacion de uso de Secciones Almacen, Serie,Lote, Caducidad --- App_Code/ClsContabilidad.vb | 9 +- App_Code/ClsInventarios.vb | 214 +- App_Code/ClsOC.vb | 5102 ++++++++++----------- App_Code/ClsProductosServicios.vb | 20 + App_Code/WS_PuntoVenta.vb | 4 +- Global.asax | 4 +- Inventarios/AjustesSeccionAlmacen.aspx | 70 + Inventarios/AjustesSeccionAlmacen.aspx.vb | 144 + Inventarios/Apartados.aspx | 84 +- Inventarios/Apartados.aspx.vb | 277 +- Inventarios/EntregaAlmacen.aspx | 870 ++++ Inventarios/EntregaAlmacen.aspx.vb | 3074 +++++++++++++ Inventarios/Kardex.aspx | 18 +- Inventarios/Kardex.aspx.vb | 21 +- Inventarios/PrestamosdeProveedor.aspx | 6 +- Inventarios/PrestamosdeProveedor.aspx.vb | 48 +- Inventarios/RecepcionAlmacen.aspx | 102 +- Inventarios/RecepcionAlmacen.aspx.vb | 1829 ++++---- Inventarios/RecepcionUsados.aspx.vb | 20 +- Inventarios/RepTraspasoAlmacen.aspx | 720 +-- Inventarios/ResguardoMaterial.aspx | 74 +- Inventarios/ResguardoMaterial.aspx.vb | 245 +- Inventarios/TraspasoAlmacen.aspx | 75 +- Inventarios/TraspasoAlmacen.aspx.vb | 329 +- Ventas/ProductosServicios.aspx.vb | 2 +- 25 files changed, 8255 insertions(+), 5106 deletions(-) create mode 100644 Inventarios/AjustesSeccionAlmacen.aspx create mode 100644 Inventarios/AjustesSeccionAlmacen.aspx.vb create mode 100644 Inventarios/EntregaAlmacen.aspx create mode 100644 Inventarios/EntregaAlmacen.aspx.vb diff --git a/App_Code/ClsContabilidad.vb b/App_Code/ClsContabilidad.vb index 14500b57d..50bd8cd30 100644 --- a/App_Code/ClsContabilidad.vb +++ b/App_Code/ClsContabilidad.vb @@ -25,6 +25,7 @@ Public Class ClsContabilidad Private disposedValue As Boolean = False ' Para detectar llamadas redundantes 'REGISTRAR CONEXIONES ABIERTAS Private CveConexion As Integer = 0 + Public Property CvePrePolizaDetalle As Integer #End Region #Region " P R O P I E D A D E S" @@ -899,11 +900,17 @@ Public Class ClsContabilidad .Add("@CveColectiva", SqlDbType.Int).Value = CveColectiva .Add("@CveCreditoDetalle", SqlDbType.Int).Value = CveCreditoDetalle .Add("@PorcentajeImpuesto", SqlDbType.Money).Value = PorcentajeImpuesto + + .Add("@CvePrePolizaDetalle", SqlDbType.Int).Direction = ParameterDirection.Output End With Try SqlAdapter.Fill(Data) - Retorno = True + CvePrePolizaDetalle = SqlAdapter.SelectCommand.Parameters("@CvePrePolizaDetalle").Value.ToString.ToEntero + If CvePrePolizaDetalle > 0 Then + Retorno = True + End If + Catch ex1 As SqlException If ex1.Message.Contains("50015;") Then OnError("No se puede registrar una póliza en un ejercicio Cerrado", ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) diff --git a/App_Code/ClsInventarios.vb b/App_Code/ClsInventarios.vb index 74be2b92d..2a91b7d8b 100644 --- a/App_Code/ClsInventarios.vb +++ b/App_Code/ClsInventarios.vb @@ -80,7 +80,7 @@ Public Class ClsInventarios Public Property CveSubProyectoInventario As Integer Public Property SubProyecto As String Public Property SubProyectoInventario As String - Public Property SerieLote As String + Public Property Serie As String Public Property Guia As String Public Property TipoCambio As Double Public Property FolioVenta As String @@ -98,6 +98,7 @@ Public Class ClsInventarios Public Property CveCliente As Integer Public Property CveClienteSucursal As Integer Public Property NombreCliente As String + Public Property CveProveedor As Integer Public Property DepartamentoEntrega As String Public Property PedidoContrato As String Public Property GastoIndirecto As Double @@ -568,22 +569,11 @@ Public Class ClsInventarios #End Region #Region " SECCIONES ALMACENES " - Public Function GetSeccionesAlmacenes() As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_INV_SeccionesAlmacenesGet") - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Secciones de Almacenes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function Public Function UpdateSeccion(CveSeccion As Integer, Seccion As String, Estatus As Boolean) As Boolean Dim Retorno As Boolean = False - DataAdapter("PA_INV_SeccionesAlmacenesUpdate") + DataAdapter("PA_Inv_SeccionesAlmacenesUpdate") With SqlAdapter.SelectCommand.Parameters .Add("@CveSeccion", SqlDbType.Int).Value = CveSeccion @@ -606,10 +596,11 @@ Public Class ClsInventarios Return Retorno End Function - Public Function GetSeccionesAlmacenes(CveSeccion As Integer) As Boolean + Public Function GetSeccionesAlmacenes(CveEmpresa As Integer, CveSeccion As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_SeccionesAlmacenesGet") With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveSeccion", SqlDbType.Int).Value = CveSeccion End With Try @@ -824,6 +815,7 @@ Public Class ClsInventarios CveCliente = If(dr("CveCliente").ToString.ToEntero > 0, dr("CveCliente").ToString.ToEntero, -1) CveClienteSucursal = If(dr("CveClienteSucursal").ToString.ToEntero > 0, dr("CveClienteSucursal").ToString.ToEntero, -1) NombreCliente = dr("Nombre").ToString + CveProveedor = If(dr("CveProveedor").ToString.ToEntero > 0, dr("CveProveedor").ToString.ToEntero, -1) DepartamentoEntrega = dr("DepartamentoEntrega").ToString PedidoContrato = dr("PedidoContrato").ToString TienePrePoliza = dr("TienePrePoliza").ToString.ToEntero @@ -1260,37 +1252,38 @@ Public Class ClsInventarios Return Retorno End Function - Public Function AddMovimientoDetalle(CveMovimiento As Integer, Cantidad As Double, CveUM As Integer, CvePS As Integer, PU As Decimal, CveAF As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional SerieLote As String = "", - Optional Observaciones As String = "", Optional CveMovimientoDetalleEntrada As Integer = -1, Optional PUTC As Decimal = -1, Optional FechaCaducidad As Date = MinFecha, + Public Function AddMovimientoDetalle(CveMovimiento As Integer, Cantidad As Double, CveUM As Integer, CvePS As Integer, PU As Decimal, Optional CveAF As Integer = -1, + Optional CveSeccionAlmacen As Integer = -1, Optional Serie As String = "", Optional Lote As String = "", Optional FechaCaducidad As Date = MinFecha, + Optional Observaciones As String = "", Optional CveMovimientoDetalleEntrada As Integer = -1, Optional PUTC As Decimal = -1, Optional CostoIndirecto As Decimal = 0, Optional CveCompraDetalle As Integer = -1, Optional CveOrdenCompraDetalle As Integer = -1, Optional CveVentaDetalle As Integer = -1, - Optional Lote As String = "", Optional Batch As String = "", Optional CveContratoDetalle As Integer = -1, Optional CveUsuarioModifico As Integer = -1, Optional EsInterno As Integer = -1) As Boolean + Optional CveContratoDetalle As Integer = -1, Optional CveUsuarioModifico As Integer = -1, Optional EsInterno As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_MovimientosDetalleAdd") With SqlAdapter.SelectCommand.Parameters .Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento - .Add("@CveUM", SqlDbType.Int).Value = CveUM .Add("@Cantidad", SqlDbType.Money).Value = Cantidad + .Add("@CveUM", SqlDbType.Int).Value = CveUM + .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@PU", SqlDbType.Decimal).Value = PU .Add("@PUTC", SqlDbType.Decimal).Value = PUTC - .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen - .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CostoIndirecto", SqlDbType.Decimal).Value = CostoIndirecto .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@SerieLote", SqlDbType.VarChar).Value = SerieLote + .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen + .Add("@Serie", SqlDbType.VarChar).Value = Serie .Add("@Lote", SqlDbType.VarChar).Value = Lote - .Add("@Batch", SqlDbType.VarChar).Value = Batch + .Add("@FechaCaducidad", SqlDbType.Date).Value = FechaCaducidad .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones .Add("@CveMovimientoDetalleEntrada", SqlDbType.Int).Value = CveMovimientoDetalleEntrada - .Add("@FechaCaducidad", SqlDbType.Date).Value = FechaCaducidad - .Add("@CostoIndirecto", SqlDbType.Decimal).Value = CostoIndirecto .Add("@CveCompraDetalle", SqlDbType.Int).Value = CveCompraDetalle .Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = CveOrdenCompraDetalle .Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVentaDetalle .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle - .Add("@CveMovimientoDetalle", SqlDbType.Int).Direction = ParameterDirection.Output .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico .Add("@EsInterno", SqlDbType.Int).Value = EsInterno + + .Add("@CveMovimientoDetalle", SqlDbType.Int).Direction = ParameterDirection.Output End With Try @@ -1313,7 +1306,7 @@ Public Class ClsInventarios Return Retorno End Function - Public Function UpdateMovimientoDetalle(Cantidad As Double, CveUM As Integer, CvePS As Integer, PU As Double, CveAF As Integer, CveMovimientoDetalle As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional SerieLote As String = "", + Public Function UpdateMovimientoDetalle(Cantidad As Double, CveUM As Integer, CvePS As Integer, PU As Double, CveAF As Integer, CveMovimientoDetalle As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional Serie As String = "", Optional Observaciones As String = "-1", Optional PUTC As Double = -1, Optional CveUsuarioModifico As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -1328,7 +1321,7 @@ Public Class ClsInventarios .Add("@PUTC", SqlDbType.Money).Value = PUTC .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen .Add("@CveAF", SqlDbType.Int).Value = CveAF - .Add("@SerieLote", SqlDbType.VarChar).Value = SerieLote + .Add("@Serie", SqlDbType.VarChar).Value = Serie .Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico End With @@ -1765,8 +1758,10 @@ Public Class ClsInventarios #Region " INVENTARIOS - EXISTENCIAS " Public Function GetExistenciasPS(CvePS As Integer, CveUnidadMedida As Integer, CveEmpresa As Integer, CveAlmacen As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional CveTipoAlmacen As Integer = -1, Optional CveSubProyecto As Integer = -1, - Optional FechaMovto As String = "-1", Optional SerieLote As String = "-1", Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, - Optional ExcluyeAdelantado As Integer = -1, Optional PendientePorSurtir As Integer = -1, Optional Lote As String = "-1", Optional Batch As String = "-1", + Optional FechaMovto As String = "-1", + Optional Serie As String = "-1", Optional Lote As String = "-1", Optional FechaCaducidad As Date = MinFecha, + Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, + Optional ExcluyeAdelantado As Integer = -1, Optional PendientePorSurtir As Integer = -1, Optional ExcluyeApartados As Integer = 1, Optional RestringirAlmacenes As Integer = -1) As Decimal Dim Retorno As Decimal = -1 @@ -1784,9 +1779,9 @@ Public Class ClsInventarios .Add("@CveTipoAlmacen", SqlDbType.Int).Value = CveTipoAlmacen .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@FechaMovto", SqlDbType.DateTime).Value = DateTime.ParseExact(FechaMovto, "yyyy/MM/dd HH:mm", Nothing) - .Add("@SerieLote", SqlDbType.VarChar).Value = SerieLote + .Add("@Serie", SqlDbType.VarChar).Value = Serie .Add("@Lote", SqlDbType.VarChar).Value = Lote - .Add("@Batch", SqlDbType.VarChar).Value = Batch + .Add("@FechaCaducidad", SqlDbType.Date).Value = FechaCaducidad .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor .Add("@CveCliente", SqlDbType.Int).Value = CveCliente .Add("@ExcluyeAdelantado", SqlDbType.Int).Value = ExcluyeAdelantado @@ -1816,9 +1811,10 @@ Public Class ClsInventarios End Function Public Function GetExistenciasProducto(CvePS As Integer, CveUnidadMedida As Integer, CveEmpresa As Integer, CveAlmacen As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional CveTipoAlmacen As Integer = -1, Optional CveSubProyecto As Integer = -1, - Optional FechaMovto As String = "-1", Optional SerieLote As String = "-1", Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, - Optional ExcluyeAdelantado As Integer = -1, Optional PendientePorSurtir As Integer = -1, Optional Lote As String = "-1", Optional Batch As String = "-1", - Optional ExcluyeApartados As Integer = 1, Optional RestringirAlmacenes As Integer = -1, Optional Caducidad As Date = MinFecha) As Boolean + Optional FechaMovto As String = "-1", Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, + Optional Serie As String = "-1", Optional Lote As String = "-1", Optional Caducidad As Date = MinFecha, + Optional ExcluyeAdelantado As Integer = -1, Optional PendientePorSurtir As Integer = -1, + Optional ExcluyeApartados As Integer = 1, Optional RestringirAlmacenes As Integer = -1) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_ExistenciasGet") @@ -1827,20 +1823,19 @@ Public Class ClsInventarios .Add("@CveUnidadMedida", SqlDbType.Int).Value = CveUnidadMedida .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen - .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen .Add("@CveTipoAlmacen", SqlDbType.Int).Value = CveTipoAlmacen - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@FechaMovto", SqlDbType.DateTime).Value = DateTime.ParseExact(FechaMovto, "yyyy/MM/dd HH:mm", Nothing) - .Add("@SerieLote", SqlDbType.VarChar).Value = SerieLote - .Add("@Lote", SqlDbType.VarChar).Value = Lote - .Add("@Batch", SqlDbType.VarChar).Value = Batch .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen + .Add("@Serie", SqlDbType.VarChar).Value = Serie + .Add("@Lote", SqlDbType.VarChar).Value = Lote + .Add("@Caducidad", SqlDbType.Date).Value = Caducidad .Add("@ExcluyeAdelantado", SqlDbType.Int).Value = ExcluyeAdelantado .Add("@PendientePorSurtir", SqlDbType.Int).Value = PendientePorSurtir .Add("@ExcluyeApartados", SqlDbType.Int).Value = ExcluyeApartados .Add("@RestringirAlmacenes", SqlDbType.Int).Value = RestringirAlmacenes - .Add("@Caducidad", SqlDbType.Date).Value = Caducidad + .Add("@Existencia", SqlDbType.Money).Direction = ParameterDirection.Output End With Try @@ -1852,21 +1847,18 @@ Public Class ClsInventarios Return Retorno End Function - Public Function GetExistenciasPSSerie(SerieLote As String, CveAlmacen As Integer, CveEmpresa As Integer, Optional FechaMovto As String = "-1") As Decimal - - If SerieLote = "" Then Return 0 + Public Function GetExistenciasPSSerie(Serie As String, CveAlmacen As Integer, CveEmpresa As Integer, Optional CveSeccionAlmacen As Integer = -1) As Decimal + If Serie = "" Then Return 0 Dim Retorno As Decimal = 0 - If FechaMovto = "-1" Then - FechaMovto = String.Format("{0} 00:00", Now.AddDays(1).ToString("yyyy/MM/dd")) - End If DataAdapter("PA_Inv_ExistenciasPSSerieGet") With SqlAdapter.SelectCommand.Parameters - .Add("@SerieLote", SqlDbType.VarChar).Value = SerieLote + .Add("@Serie", SqlDbType.VarChar).Value = Serie .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen ' .Add("@FechaMovto", SqlDbType.DateTime).Value = DateTime.ParseExact(FechaMovto, "yyyy/MM/dd HH:mm", Nothing) .Add("@Existencia", SqlDbType.Money).Direction = ParameterDirection.Output @@ -1889,13 +1881,13 @@ Public Class ClsInventarios Return Retorno End Function - Public Function GetCostoPSSerie(CvePS As Integer, SerieLote As String, CveAlmacen As Integer, CveEmpresa As Integer) As Decimal + Public Function GetCostoPSSerie(CvePS As Integer, Serie As String, CveAlmacen As Integer, CveEmpresa As Integer) As Decimal Dim Retorno As Decimal = 0 DataAdapter("PA_Inv_CostoPSSerieGet") With SqlAdapter.SelectCommand.Parameters .Add("@CvePS", SqlDbType.Int).Value = CvePS - .Add("@SerieLote", SqlDbType.VarChar).Value = SerieLote + .Add("@Serie", SqlDbType.VarChar).Value = Serie .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen .Add("@Costo", SqlDbType.Money).Direction = ParameterDirection.Output @@ -1958,7 +1950,7 @@ Public Class ClsInventarios Public Function GetExistenciasPSEmpaque(CvePS As Integer, CveUnidadMedida As Integer, CveEmpresa As Integer, CveAlmacen As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional CveTipoAlmacen As Integer = -1, Optional CveSubProyecto As Integer = -1, - Optional FechaMovto As String = "-1", Optional SerieLote As String = "-1", Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, + Optional FechaMovto As String = "-1", Optional Serie As String = "-1", Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, Optional ExcluyeAdelantado As Integer = -1, Optional PendientePorSurtir As Integer = -1, Optional Lote As String = "-1", Optional Batch As String = "-1", Optional ExcluyeApartados As Integer = 1, Optional RestringirAlmacenes As Integer = -1) As Boolean Dim Retorno As Boolean = False @@ -1977,7 +1969,7 @@ Public Class ClsInventarios .Add("@CveTipoAlmacen", SqlDbType.Int).Value = CveTipoAlmacen .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@FechaMovto", SqlDbType.DateTime).Value = DateTime.ParseExact(FechaMovto, "yyyy/MM/dd HH:mm", Nothing) - .Add("@SerieLote", SqlDbType.VarChar).Value = SerieLote + .Add("@Serie", SqlDbType.VarChar).Value = Serie .Add("@Lote", SqlDbType.VarChar).Value = Lote .Add("@Batch", SqlDbType.VarChar).Value = Batch .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor @@ -2024,7 +2016,7 @@ Public Class ClsInventarios SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió un error al momento de vericar la existencia de los productos por xml.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + OnError("Ocurrió un error al momento de verificar la existencia de los productos por xml.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno @@ -2422,7 +2414,7 @@ Public Class ClsInventarios Return Retorno End Function - Public Function AddInventarioFisicoDetalle(CveInventarioFisico As Integer, CvePS As Integer, CveUM As Integer, Cantidad As Double, SerieLote As String, CveUsuario As Integer) As Boolean + Public Function AddInventarioFisicoDetalle(CveInventarioFisico As Integer, CvePS As Integer, CveUM As Integer, Cantidad As Double, Serie As String, CveUsuario As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_InventarioFisicoDetalleAdd") @@ -2432,7 +2424,7 @@ Public Class ClsInventarios .Add("@CveUM", SqlDbType.Int).Value = CveUM .Add("@Cantidad", SqlDbType.Money).Value = Cantidad .Add("@CvePS", SqlDbType.Int).Value = CvePS - .Add("@SerieLote", SqlDbType.VarChar).Value = SerieLote + .Add("@Serie", SqlDbType.VarChar).Value = Serie .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario .Add("@Estatus", SqlDbType.Int).Direction = ParameterDirection.Output End With @@ -2444,7 +2436,7 @@ Public Class ClsInventarios Retorno = True ElseIf SqlAdapter.SelectCommand.Parameters("@Estatus").Value.ToString.ToEntero = 2 Then Retorno = False - Alert($"Ya existe la Serie {SerieLote} en el inventario actual.", TipoMensaje.MsgAdvertencia) + Alert($"Ya existe la Serie {Serie} en el inventario actual.", TipoMensaje.MsgAdvertencia) End If Catch Ex1 As SqlException @@ -2839,15 +2831,16 @@ Public Class ClsInventarios Return Retorno End Function - Public Function SerieLoteRecomendadoGet(CvePS As Integer, CveEmpresa As Integer, Optional CveAlmacen As Integer = -1, Optional CveSubProyecto As Integer = -1) As Boolean + Public Function SerieRecomendadoGet(CvePS As Integer, CveEmpresa As Integer, Optional CveAlmacen As Integer = -1, Optional CveSeccionAlmacen As Integer = -1, Optional CveSubProyecto As Integer = -1) As Boolean Dim Retorno As Boolean = False - DataAdapter("PA_Inv_SerieLoteRecomendadoGet") + DataAdapter("PA_Inv_SerieRecomendadoGet") With SqlAdapter.SelectCommand.Parameters .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto End With @@ -2855,15 +2848,15 @@ Public Class ClsInventarios SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió un error al obtener la Serie/Lote recomendado.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + OnError("Ocurrió un error al obtener la Serie recomendado.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno End Function - Public Function LoteBatchRecomendadoGet(CvePS As Integer, CveEmpresa As Integer, Optional CveAlmacen As Integer = -1) As Boolean + Public Function LoteRecomendadoGet(CvePS As Integer, CveEmpresa As Integer, Optional CveAlmacen As Integer = -1) As Boolean Dim Retorno As Boolean = False - DataAdapter("PA_Inv_LoteBatchRecomendadoGet") + DataAdapter("PA_Inv_LoteRecomendadoGet") With SqlAdapter.SelectCommand.Parameters .Add("@CvePS", SqlDbType.Int).Value = CvePS @@ -3014,7 +3007,7 @@ Public Class ClsInventarios Return Retorno End Function - Public Function GetEstatusVentaPorSurir(CveVenta As Integer) As Boolean + Public Function GetEstatusVentaPorSurtir(CveVenta As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_EstatusVentaPorSurtirGet") @@ -3358,7 +3351,7 @@ Public Class ClsInventarios End Function #Region " INVENTARIOS - COSTO PS " - Public Function GetCostoPS(CvePS As Integer, Cantidad As Double, CveAlmacen As Integer, SerieLote As String, FechaFin As Datetime, Optional CveSubProyecto As Integer = -1, Optional CveTipoAlmacen As Integer = 1) As Decimal + Public Function GetCostoPS(CvePS As Integer, Cantidad As Double, CveAlmacen As Integer, Serie As String, FechaFin As DateTime, Optional CveSubProyecto As Integer = -1, Optional CveTipoAlmacen As Integer = 1) As Decimal Dim Retorno As Decimal = -1D DataAdapter("PA_Inv_PSCostoGet") @@ -3366,7 +3359,7 @@ Public Class ClsInventarios .Add("@CvePS", SqlDbType.Int).Value = CvePS .Add("@Cantidad", SqlDbType.Float).Value = Cantidad .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen - .Add("@SerieLote", SqlDbType.VarChar).Value = SerieLote + .Add("@Serie", SqlDbType.VarChar).Value = Serie .Add("@FechaFin", SqlDbType.DateTime).Value = FechaFin .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto .Add("@CveTipoAlmacen", SqlDbType.Int).Value = CveTipoAlmacen @@ -4734,41 +4727,60 @@ Public Class ClsInventarios #Region "MOVIMIENTOS DETALLE SECCION ALMACEN" - Public Function AddMovimientosDetalleSeccionesAlmacen(CveMovimientoDetalle As Integer, CveSeccionAlmacen As Integer, Cantidad As Decimal) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Inv_MovimientosDetalleSeccionesAlmacenAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveMovimientoDetalle", SqlDbType.Int).Value = CveMovimientoDetalle - .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen - .Add("@Cantidad", SqlDbType.Float).Value = Cantidad - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar movimientos detalle seccion almacen", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - Public Function GetMovimientosDetalleSeccionesAlmacen(CveSeccionAlmacen As Integer, CveAlmacen As Integer, CvePS As Integer, CveEmpresa As Integer) As Boolean + Public Function GetMovimientosDetalleSeccionesAlmacen(CveAlmacen As Integer, CveClasificacion As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False - DataAdapter("PA_Inv_MovimientosDetalleSeccionesAlmacenGet") + DataAdapter("PA_Inv_MovimientosDetalleAjusteSeccionesGet") With SqlAdapter.SelectCommand.Parameters - .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen - .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa End With Try SqlAdapter.Fill(Data) Retorno = True Catch ex As Exception - OnError("Ocurrió un error al agregar movimientos detalle seccion almacen", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + OnError("Ocurrió un error al obtener movimientos detalle seccion almacen", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) End Try Return Retorno + End Function + 'Public Function AddMovimientosDetalleSeccionesAlmacen(CveMovimientoDetalle As Integer, CveSeccionAlmacen As Integer, Cantidad As Decimal) As Boolean + ' Dim Retorno As Boolean = False + ' DataAdapter("PA_Inv_MovimientosDetalleSeccionesAlmacenAdd") + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveMovimientoDetalle", SqlDbType.Int).Value = CveMovimientoDetalle + ' .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen + ' .Add("@Cantidad", SqlDbType.Float).Value = Cantidad + ' End With + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al agregar movimientos detalle seccion almacen", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + ' Return Retorno + 'End Function + + 'Public Function GetMovimientosDetalleSeccionesAlmacen(CveSeccionAlmacen As Integer, CveAlmacen As Integer, CvePS As Integer, CveEmpresa As Integer) As Boolean + ' Dim Retorno As Boolean = False + ' DataAdapter("PA_Inv_MovimientosDetalleSeccionesAlmacenGet") + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen + ' .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + ' .Add("@CvePS", SqlDbType.Int).Value = CvePS + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' End With + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al agregar movimientos detalle seccion almacen", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + ' Return Retorno + 'End Function + Public Function GetExistenciaSeccionAlmacen(CveVenta As Integer, CveAlmacen As Integer, CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_ExistenciaSeccionAlmacenGet") @@ -4786,23 +4798,23 @@ Public Class ClsInventarios Return Retorno End Function - Public Function GetKardexSeccionAlmacen(CvePS As Integer, CveAlmacen As Integer, CveSeccionAlmacen As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_Inv_KardexSeccionAlmacenGet") - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePS", SqlDbType.Int).Value = CvePS - .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen - .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el kardex de seccion almacen", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function + 'Public Function GetKardexSeccionAlmacen(CvePS As Integer, CveAlmacen As Integer, CveSeccionAlmacen As Integer, CveEmpresa As Integer) As Boolean + ' Dim Retorno As Boolean = False + ' DataAdapter("PA_Inv_KardexSeccionAlmacenGet") + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CvePS", SqlDbType.Int).Value = CvePS + ' .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen + ' .Add("@CveSeccionAlmacen", SqlDbType.Int).Value = CveSeccionAlmacen + ' .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + ' End With + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener el kardex de seccion almacen", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + ' Return Retorno + 'End Function Public Function AddProductosServiciosAlmacenSeccion(CvePS As Integer, CveAlmacen As Integer, CveAlmacenSeccion As Integer) As Boolean Dim Retorno As Boolean = False DataAdapter("PA_Inv_ProductosServiciosAlmacenSeccionAdd") diff --git a/App_Code/ClsOC.vb b/App_Code/ClsOC.vb index bcecb847d..19d38432e 100644 --- a/App_Code/ClsOC.vb +++ b/App_Code/ClsOC.vb @@ -1,2553 +1,2553 @@ -Imports System.Data -Imports System.Data.SqlClient -Imports Extensiones -Imports Modelos - -Public Class ClsOC - Implements IDisposable - -#Region "Campos" - 'SQL - Private SqlConexion As SqlConnection - Private SqlAdapter As SqlDataAdapter - Private SqlTransacc As SqlTransaction - Private SqlCommand As SqlCommand - Private StrSQL As StringBuilder - Private Data As DataTable - 'Atributos de la clase - Private disposedValue As Boolean = False - 'PARA REGISTRAR CONEXION - Private CveConexion As Integer = 0 - -#End Region - -#Region "Propiedades" - - Public Property FechaIng As Date - Public Property CveUsuario As Integer - Public Property NombreUsuario As String - Public Property CveOrdenCompra As Integer - Public Property CveOrdenCompraDetalle As Integer - Public Property Folio As Integer - Public Property CveIEAnticipo As Integer - Public Property CveProveedorAnticipo As Integer - Public Property FolioIEAnticipo As Integer - Public Property ImporteAnticipo As Double - - Public Property FolioAdicional As String - Public Property EntregaDirecta As Boolean - Public Property CveVenta As Integer - Public Property CveCompra As Integer - Public Property CveMovimientoAlmacenVenta As Integer - Public Property TieneVenta As Integer - Public Property TieneCompraInv As Integer - - Public Property Tipo As String - Public Property CveEstatus As Integer - Public Property Estatus As String - Public Property Prioridad As Integer - Public Property Moneda As String - Public Property UsuarioAsignado As String - Public Property CveUsuarioAsignado As Integer - - Private _EsCancelable As Boolean - - Private _EsCotizacion As Boolean - Public Property TipoTermino As Integer - Public Property CveEstatusSiguiente As Integer - Public Property CveEstatusAnterior As Integer - - Public Property Descripcion As String - Public Property Justificacion As String - Public Property CveEmpresa As Integer - Private _CveProyecto As Integer - - 'Private _CveUsuario As Integer - Public Property Fecha As Date - Public Property FechaEstimadaEntrega As Date - 'Private _NombreUsuario As String - Public Property CveProveedor As Integer - Public Property CveProveedorSucursal As Integer - Public Property SucursalDireccion As String - Public Property ProveedorContacto As String - Public Property SucursalTelefono As String - Public Property RazonSocial As String - Public Property Direccion As String - Public Property Telefono As String - Public Property RFC As String - Public Property LugarEntrega As String - Public Property Cancelacion As String - Public Property PorcentajeIVA As Double - Public Property CveCliente As Integer - Public Property CveVendedor As Integer - Public Property PrioridadObservacion As String - Public Property SubTotal As Double - Public Property IVA As Double - Public Property RetIVA As Double - Public Property RetISR As Double - Public Property IEPS As Double - Public Property Total As Double - Public Property CvePresupuestoEgreso As Integer - Public Property RequiereCotizacion As Boolean - Public Property CveActivoFijo As Integer - Public Property Codigo As String - Public Property Proyecto As String - Public Property CveSubProyecto2 As Integer - Public Property SubProyecto As String - Public Property UsuarioSolicito As String - Public Property UsuarioAutorizo As String - Public Property Descuento As Double - Public Property Pendiente As Double - Public Property NombreCliente As String - Public Property SucCalle As String - Public Property SucNoExt As String - Public Property SucNoInt As String - Public Property SucColonia As String - Public Property SucMunicipio As String - Public Property SucEstado As String - Public Property SucPais As String - Public Property SucCP As String - Public Property SucTelefono As String - Public Property CveDireccionEnvio As Integer - Public Property IdPoliza As Integer - Public Property HoraElaboracion As String - Public Property SucSubProyecto As String - Public Property Guia As String - Public Property CveUsoCFDI As Integer - Public Property UsoCFDI As String - Public Property Promocion As String - Public Property CveProveedorContacto As Integer - - Public ReadOnly Property DtResultados() As DataTable - Get - DtResultados = Data - End Get - End Property - - -#End Region - -#Region "Propiedades ClsOCCotizaciones" - Public Property CveCotizacion As Integer - Public Property CveCotizacionDetalle As Integer - - Public Property NombreComercial As String - - Public Property CveMoneda As Integer - Public Property CveColectiva As Integer - Public Property Colectiva As String - - Public Property Extension As String - Public Property Adjunto As String - Public Property Usuario As String - - Public Property Empresa As String - Public Property Sucursal As String - Public Property ObjLugarEntrega As String - Public Property DiasCredito As Integer - - - -#End Region - - Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) - - If TransaccionCompartida Is Nothing Then - SqlConexion = New SqlConnection - SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString - Try - SqlConexion.Open() - Catch ex As Exception - OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex) - End Try - Else - SqlConexion = TransaccionCompartida.Connection - SqlTransacc = TransaccionCompartida - End If - - SqlCommand = New SqlCommand("", SqlConexion) - SqlAdapter = New SqlDataAdapter("", SqlConexion) - StrSQL = New StringBuilder - ConexionAdd() - End Sub - Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) - With SqlAdapter.SelectCommand - .Parameters.Clear() - .CommandText = StrSQL - .CommandType = TipoComando - End With - If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc - Data = New DataTable - End Sub -#Region "Conexiones" - - Private Sub ConexionAdd() - If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then - - 'DataAdapter(String.Format("INSERT INTO Sis_Conexiones (Clase,Modulo) VALUES ('ClsRH','{0}')", "RH/CatMotivosBaja"), CommandType.Text) ' pendiente de terminar parra registrar el cveconexion, falta el rarámetro de módulo - - Try - DataAdapter("PA_Sis_RegistrarConexion") - With SqlAdapter.SelectCommand.Parameters - .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name - .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString) - .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output - End With - SqlAdapter.Fill(Data) - CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero - Catch ex As Exception - OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - End If - End Sub - - Private Sub ConexionClose() - If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then - - DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text) - Try - SqlAdapter.Fill(Data) - - Catch ex As Exception - OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - CveConexion = 0 - End If - - End Sub -#End Region - Private Sub DataCommand(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) - With SqlCommand - .Parameters.Clear() - .CommandText = pStrSQL - .CommandType = TipoComando - End With - - If Not SqlTransacc Is Nothing Then SqlCommand.Transaction = SqlTransacc - - End Sub - Public Function IniciaTransacSQL() As SqlTransaction - If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() - Return SqlTransacc - End Function - Public Sub RollBack() - If SqlTransacc IsNot Nothing Then SqlTransacc.Rollback() - SqlTransacc = Nothing - End Sub - Public Sub Commit() - If SqlTransacc IsNot Nothing Then SqlTransacc.Commit() - SqlTransacc = Nothing - End Sub - -#Region "ClsOCCotizaciones" - Public Function GetCotizaciones(pCveOrdenCompra As Integer, Optional pCveCotizacion As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_CotizacionesGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - .Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion - End With - - Try - SqlAdapter.Fill(Data) - If Data.Rows.Count = 1 Then - Me.CveProveedor = If(Not IsDBNull(Data.Rows(0)("CveProveedor")), Data.Rows(0)("CveProveedor").ToString.ToEntero(), -1) - NombreComercial = If(Not IsDBNull(Data.Rows(0)("NombreComercial")), Data.Rows(0)("NombreComercial").ToString, "") - Me.RazonSocial = If(Not IsDBNull(Data.Rows(0)("RazonSocial")), Data.Rows(0)("RazonSocial").ToString, "") - - CveColectiva = If(Not IsDBNull(Data.Rows(0)("CveColectiva")), Data.Rows(0)("CveColectiva").ToString.ToEntero(), -1) - Colectiva = If(Not IsDBNull(Data.Rows(0)("Colectiva")), Data.Rows(0)("Colectiva").ToString, "") - - CveCotizacion = Data.Rows(0)("CveCotizacion").ToString.ToEntero() - Me.CveOrdenCompra = Data.Rows(0)("CveOrdenCompra").ToString.ToEntero() - CveMoneda = If(Not IsDBNull(Data.Rows(0)("CveMoneda")), Data.Rows(0)("CveMoneda").ToString.ToEntero(), -1) - - Me.Folio = Data.Rows(0)("Folio").ToString.ToEntero - Me.Fecha = Data.Rows(0)("Fecha").ToString.ToDate - Adjunto = Data.Rows(0)("Adjunto").ToString - Extension = Data.Rows(0)("Extension").ToString - Usuario = Data.Rows(0)("Usuario").ToString - Me.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero - Me.Total = Data.Rows(0)("Total").ToString.ToDouble - - - Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero - 'Me.CveProveedorSucursal = Data.Rows(0)("CveProveedorSucursal").ToString.ToEntero - Empresa = Data.Rows(0)("Empresa").ToString - CveSubProyecto2 = Data.Rows(0)("CveSubProyecto").ToString.ToEntero - SubProyecto = Data.Rows(0)("SubProyecto").ToString - ObjLugarEntrega = Data.Rows(0)("LugarEntrega").ToString - DiasCredito = Data.Rows(0)("DiasCredito").ToString.ToEntero - End If - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Cotizaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetCotizacionesTabla(pCveOrdenCompra As Integer) As DataSet - Dim Retorno As New DataSet - - DataAdapter("PA_OC_Cotizaciones2Get") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - End With - - Try - SqlAdapter.Fill(Retorno) - Catch ex As Exception - ' OnError("Ocurrió un error al obtener el Catálogo de Cotizaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddCotizacion(pCveOrdenCompra As Integer, pCveProveedor As Integer, pCveColectiva As Integer, pFolio As String, pFecha As String, pAdjunto As String, pCveMoneda As Integer, pDiasCredito As Integer, pCveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_CotizacionesAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - .Add("@CveProveedor", SqlDbType.Int).Value = pCveProveedor - .Add("@CveColectiva", SqlDbType.Int).Value = pCveColectiva - .Add("@Folio", SqlDbType.VarChar).Value = pFolio - .Add("@Fecha", SqlDbType.VarChar).Value = pFecha - .Add("@Adjunto", SqlDbType.VarChar).Value = pAdjunto - .Add("@CveMoneda", SqlDbType.Int).Value = pCveMoneda - .Add("@DiasCredito", SqlDbType.Int).Value = pDiasCredito - .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario - .Add("@vCveCotizacion", SqlDbType.Int).Direction = ParameterDirection.Output - End With - - Try - SqlAdapter.Fill(Data) - CveCotizacion = SqlAdapter.SelectCommand.Parameters("@vCveCotizacion").Value.ToString.ToEntero - Retorno = True - Catch ex As SqlException - If ex.Number = 2627 Then - Alert("La Clave o Descripción de la Cotizacion ya existe.", TipoMensaje.MsgAdvertencia) - Else - OnError("Ocurrió un error al guardar el nuevo Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar el nuevo Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateCotizacion(pCveProveedor As Integer, pCveColectiva As Integer, pFolio As String, pFecha As String, pAdjunto As String, pCveMoneda As Integer, pDiasCredito As Integer, pCveUsuario As Integer, pCveCotizacion As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_CotizacionesUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveProveedor", SqlDbType.Int).Value = pCveProveedor - .Add("@CveColectiva", SqlDbType.Int).Value = pCveColectiva - .Add("@Folio", SqlDbType.VarChar).Value = pFolio - .Add("@Fecha", SqlDbType.VarChar).Value = pFecha - .Add("@Adjunto", SqlDbType.VarChar).Value = pAdjunto - .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario - .Add("@DiasCredito", SqlDbType.Int).Value = pDiasCredito - .Add("@CveMoneda", SqlDbType.Int).Value = pCveMoneda - .Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As SqlException - If ex.Number = 2627 Then - Alert("La Clave o Descripción del Cotizacion ya existe.", TipoMensaje.MsgAdvertencia) - Else - OnError("Ocurrió un error al guardar los cambios en el Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemoveCotizacion(pCveCotizacion As Integer) As String - Dim Retorno As String = "" - - DataAdapter("PA_OC_CotizacionesRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion - .Add("@vNombreArchivo", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = SqlAdapter.SelectCommand.Parameters("@vNombreArchivo").Value.ToString - Catch ex As Exception - OnError("Ocurrió un error al eliminar el Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetCotizacionesDetalle(pCveCotizacion As Integer, Optional pCveOrdenCompra As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_CotizacionesDetalleGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener Detalle de cotización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddCotizacionDetalle(pCveCotizacion As Integer, pCvePS As Integer, pPrecioUnitario As Double, pCantidad As Double, pCveUM As Integer, pCantidadSurtir As Double, pFechaEntrega As String, pObservacion As String, pCveOrdenCompraDetalle As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_CotizacionesDetalleAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion - .Add("@CvePS", SqlDbType.Int).Value = pCvePS - .Add("@PU", SqlDbType.Money).Value = pPrecioUnitario - .Add("@Cantidad", SqlDbType.Float).Value = pCantidad - .Add("@CveUM", SqlDbType.Int).Value = pCveUM - .Add("@CantidadSurtir", SqlDbType.Float).Value = pCantidadSurtir - .Add("@FechaEntrega", SqlDbType.VarChar).Value = pFechaEntrega - .Add("@Observacion", SqlDbType.VarChar).Value = pObservacion - .Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = pCveOrdenCompraDetalle - .Add("@vCveCotizacionDetalle", SqlDbType.Int).Direction = ParameterDirection.Output - End With - - Try - SqlAdapter.Fill(Data) - - CveCotizacionDetalle = SqlAdapter.SelectCommand.Parameters("@vCveCotizacionDetalle").Value.ToString.ToEntero - Retorno = True - Catch ex As SqlException - If ex.Number = 2627 Then - Alert("La Clave o Descripción de la Cotizacion ya existe.", TipoMensaje.MsgAdvertencia) - Else - OnError("Ocurrió un error al guardar el nuevo Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar el nuevo Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function UpdateCotizacionDetalle(pCveCotizacionDetalle As Integer, pPrecioUnitario As Double, pCantidadSurtir As Double, pFechaEntrega As String, pObservacion As String) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_CotizacionesDetalleUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@PU", SqlDbType.Money).Value = pPrecioUnitario - .Add("@CantidadSurtir", SqlDbType.Float).Value = pCantidadSurtir - .Add("@FechaEntrega", SqlDbType.VarChar).Value = pFechaEntrega - .Add("@Observacion", SqlDbType.VarChar).Value = pObservacion - .Add("@CveCotizacionDetalle", SqlDbType.Int).Value = pCveCotizacionDetalle - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As SqlException - If ex.Number = 2627 Then - Alert("La Clave o Descripción de la Cotizacion ya existe.", TipoMensaje.MsgAdvertencia) - Else - OnError("Ocurrió un error al actualizar la Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al actualizar la Cotización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function UpdateCotizacionDetalleGanadora(pCveCotizacionDetalle As Integer, pEsGanadora As Boolean) As Integer - Dim Retorno As Integer = -1 - - DataAdapter("PA_OC_CotizacionesDetalleEsGanadoraUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@EsGanadora", SqlDbType.Bit).Value = pEsGanadora - .Add("@CveCotizacionDetalle", SqlDbType.Int).Value = pCveCotizacionDetalle - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = pCveCotizacionDetalle - Catch ex As SqlException - If ex.Number = 2627 Then - Alert("La Clave o Descripción de la Cotizacion ya existe.", TipoMensaje.MsgAdvertencia) - Else - OnError("Ocurrió un error al actualizar la Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al actualizar la Cotización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function RemoveCotizacionDetalle(pCveCotizacion As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_CotizacionesDetalleRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al eliminar el Cotizacion Detalle.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateOrdenCompraCotizacion(pCveOrdenCompra As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraDetalleCotizacionUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar la OC/Req con Cotización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - - 'Public Function GetEstatusCompra(ByVal CveEstatusCompra As Integer, ByVal EstatusCompra As String) As Boolean - ' Dim Retorno As Boolean = False - - ' DataAdapter("PA_OC_EstatusOrdenCompraGet") - ' Try - ' SqlAdapter.Fill(Data) - - ' If Data.Rows.Count = 1 Then - ' _CveEstatusCompra = Data.Rows(0)("CveEstatusCompra").ToString().ToEntero() - ' _EstatusCompra = Data.Rows(0)("EstatusCompra").ToString() - ' _Estatus = Data.Rows(0)("Estatus").ToString = "True" - ' _FechaIng = Data.Rows(0)("FechaIng").ToString().ToDate() - ' _CveUsuario = Data.Rows(0)("CveUsuario").ToString().ToEntero() - ' _NombreUsuario = Data.Rows(0)("Nombre").ToString() - ' End If - - ' Retorno = True - ' Catch ex As Exception - ' OnError("Ocurrió un error al obtener el Catálogo de Estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End Try - - ' Return Retorno - 'End Function - - 'Public Function AddEstatusCompra(ByVal Descripcion As String, Estatus As Boolean, ByVal CveUsuario As Integer) As Boolean - ' Dim Retorno As Boolean = False - - ' DataAdapter("PA_OC_EstatusOrdenCompraAdd") - - ' With SqlAdapter.SelectCommand.Parameters - ' .Add("@EstatusOrdenCompra", SqlDbType.VarChar).Value = Descripcion - ' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - ' End With - - ' Try - ' SqlAdapter.Fill(Data) - - ' Retorno = True - ' Catch ex As SqlException - ' If ex.Number = 2627 Then - ' Alert("La Clave o Descripción del EstatusCompra ya existe.", TipoMensaje.MsgAdvertencia) - ' Else - ' OnError("Ocurrió un error al guardar el nuevo estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End If - ' Catch ex As Exception - ' OnError("Ocurrió un error al guardar el nuevo estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End Try - - ' Return Retorno - 'End Function - - 'Public Function UpdateEstatusCompra(ByVal Descripcion As String, Estatus As Boolean, ByVal CveEstatusCompra As Integer, ByVal CveUsuario As Integer) As Boolean - ' Dim Retorno As Boolean = False - - ' DataAdapter("PA_OC_EstatusOrdenCompraUpdate") - - ' With SqlAdapter.SelectCommand.Parameters - ' .Add("@EstatusOrdenCompra", SqlDbType.VarChar).Value = Descripcion - ' '.Add("@pCveUsuario", SqlDbType.Int).Value = CveUsuario - ' .Add("@Estatus", SqlDbType.Bit).Value = Estatus - ' .Add("@CveEstatusOrdenCompra", SqlDbType.Int).Value = CveEstatusCompra - ' End With - - ' Try - ' SqlAdapter.Fill(Data) - - ' Retorno = True - ' Catch ex As SqlException - ' If ex.Number = 2627 Then - ' Alert("La Clave o Descripción del Estatus de Compra ya existe.", TipoMensaje.MsgAdvertencia) - ' Else - ' OnError("Ocurrió un error al guardar los cambios en el estatus de compra", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End If - ' Catch ex As Exception - ' OnError("Ocurrió un error al guardar los cambios en el estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End Try - - ' Return Retorno - 'End Function - - 'Public Function RemoveEstatusCompra(ByVal CveEstatusCompra As Integer) As Boolean - ' Dim Retorno As Boolean = False - - ' DataAdapter("PA_OC_EstatusOrdenCompraRemove") - - ' With SqlAdapter.SelectCommand.Parameters - ' .Add("@CveEstatusOrdenCompra", SqlDbType.Int).Value = CveEstatusCompra - ' End With - - ' Try - ' SqlAdapter.Fill(Data) - - ' Retorno = True - ' Catch ex As Exception - ' OnError("Ocurrió un error al eliminar el estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End Try - - ' Return Retorno - 'End Function - - - -#Region "O R D E N E S - D E - C O M P R A S" - Public Function GetOC(ObjOrdenCompra As Modelos.OrdenCompra) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = ObjOrdenCompra.CveOrdenCompra - .Add("@Folio", SqlDbType.Int).Value = ObjOrdenCompra.Folio - .Add("@CveSubProyecto", SqlDbType.Int).Value = -1 'ObjOrdenCompra.CveSucursal - .Add("@Tipo", SqlDbType.VarChar).Value = ObjOrdenCompra.Tipo - .Add("@CveCliente", SqlDbType.Int).Value = ObjOrdenCompra.CveCliente - .Add("@CveVendedor", SqlDbType.Int).Value = ObjOrdenCompra.CveVendedor - .Add("@Guia", SqlDbType.Int).Value = ObjOrdenCompra.Guia - .Add("@CveEmpresa", SqlDbType.Int).Value = ObjOrdenCompra.CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - - If Data.Rows.Count > 0 Then - - - Retorno = True - End If - - Catch ex As Exception - OnError("Ocurrió un error al obtener Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetOC(CveOrdenCompra As Integer, CveEmpresa As Integer, Optional Folio As Integer = -1, Optional CveSubProyecto As Integer = -1, Optional Tipo As String = "-1", Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, Optional Guia As String = "-1", Optional CveUsuario As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra - .Add("@Folio", SqlDbType.Int).Value = Folio - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@Tipo", SqlDbType.VarChar).Value = Tipo - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor - .Add("@Guia", SqlDbType.Int).Value = Guia - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - End With - - Try - SqlAdapter.Fill(Data) - - If Data.Rows.Count >= 1 Then - Dim dr As DataRow = Data.Rows(0) - _CveOrdenCompra = dr("CveOrdenCompra").ToString.ToEntero - _Folio = dr("Folio").ToString.ToEntero - _CveIEAnticipo = dr("CveIEAnticipo").ToString.ToEntero - _FolioIEAnticipo = dr("FolioIEAnticipo").ToString.ToEntero - _ImporteAnticipo = dr("ImporteAnticipo").ToString.ToDouble - _CveProveedorAnticipo = dr("CveProveedorAnticipo").ToString.ToEntero - _CveEmpresa = dr("CveEmpresa").ToString.ToEntero - _CveProyecto = dr("CveProyecto").ToString.ToEntero - '_CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero - _Guia = dr("Guia").ToString - _FechaEstimadaEntrega = If(Not IsDBNull(dr("FechaEstimadaEntrega")), CDate(dr("FechaEstimadaEntrega")), New DateTime) - _Descripcion = dr("Descripcion").ToString - _Justificacion = dr("Justificacion").ToString - _Prioridad = If(dr("Prioridad").ToString.ToEntero = 0, -1, dr("Prioridad").ToString.ToEntero) - _Tipo = dr("Tipo").ToString - _Fecha = dr("Fecha").ToString.ToDate - _HoraElaboracion = dr("HoraElaboracion").ToString - _CveEstatus = dr("CveEstatus").ToString.ToEntero - CveMoneda = dr("CveMoneda").ToString.ToEntero - Moneda = dr("Moneda").ToString - UsuarioAsignado = dr("UsuarioAsignado").ToString - CveUsuarioAsignado = dr("CveUsuarioAsignado").ToString.ToEntero - _EsCancelable = dr("EsCancelable").ToString = "True" - _TipoTermino = dr("TipoTermino").ToString.ToEntero - Cancelacion = dr("Cancelacion").ToString - _CveEstatusSiguiente = dr("CveEstatusSiguiente").ToString.ToEntero - _EsCotizacion = dr("EsCotizacion").ToString = "True" - _CveEstatusAnterior = If(Not IsDBNull(dr("CveEstatusAnterior")), dr("CveEstatusAnterior").ToString.ToEntero, -1) - _Estatus = dr("Estatus").ToString - RequiereCotizacion = dr("RequiereCotizacion").ToString() = "True" - _CveUsuario = dr("CveUsuario").ToString.ToEntero - _NombreUsuario = dr("NombreUsuario").ToString - - _CveProveedor = If(Not IsDBNull(dr("CveProveedor")), dr("CveProveedor").ToString.ToEntero, -1) - _CveProveedorSucursal = If(Not IsDBNull(dr("CveProveedorSucursal")), dr("CveProveedorSucursal").ToString.ToEntero, -1) - _RazonSocial = If(Not IsDBNull(dr("RazonSocial")), dr("RazonSocial").ToString, "") - _Direccion = If(Not IsDBNull(dr("Direccion")), dr("Direccion").ToString, "") - _Telefono = If(Not IsDBNull(dr("Telefono")), dr("Telefono").ToString, "") - _RFC = If(Not IsDBNull(dr("RFC")), dr("RFC").ToString, "") - _LugarEntrega = If(Not IsDBNull(dr("LugarEntrega")), dr("LugarEntrega").ToString, "") - _CveCliente = If(dr("CveCliente").ToString.ToEntero = 0, -1, dr("CveCliente").ToString.ToEntero) - _CveVendedor = If(dr("CveVendedor").ToString.ToEntero = 0, -1, dr("CveVendedor").ToString.ToEntero) - _PrioridadObservacion = dr("PrioridadObservacion").ToString - IdPoliza = dr("IdPoliza").ToString.ToEntero - Me.SucursalDireccion = If(Not IsDBNull(dr("DireccionSucursal")), dr("DireccionSucursal").ToString, "") - Me.SucursalTelefono = If(Not IsDBNull(dr("TelefonoSucursal")), dr("TelefonoSucursal").ToString, "") - ProveedorContacto = dr("ContactoNombre").ToString - - PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDouble - SubTotal = dr("SubTotal").ToString.ToDouble - Descuento = dr("Descuento").ToString.ToDouble - IVA = dr("IVA").ToString.ToDouble - RetIVA = dr("RetIVA").ToString.ToDouble - RetISR = dr("RetISR").ToString.ToDouble - IEPS = dr("IEPS").ToString.ToDouble - Total = dr("Total").ToString.ToDouble - Pendiente = dr("Pendiente").ToString.ToDouble - 'If Not IsDBNull(dr("SubTotal")) Then - ' SubTotal = dr("SubTotal").ToString.ToDouble - ' If IVA <= 0 Then - ' _IVA = _SubTotal * dr("PorcentajeIVA").ToString.ToDouble - ' End If - ' _Total = _SubTotal + _IVA - _Descuento - _RetIVA - _RetISR - 'End If - - '_CveSupervisara = dr("CveSupervisara").ToString.ToEntero - '_CveAutoriza = dr("CveAutoriza").ToString.ToEntero - '_CveAutorizara = dr("CveAutorizara").ToString.ToEntero - - '_NombreSupervisa = dr("NombreSupervisa").ToString - - '_NombreAutoriza = dr("NombreAutoriza").ToString - '_FechaSupervisa = dr("FechaSupervisa").ToString.ToDate - '_FechaAutoriza = dr("FechaAutoriza").ToString.ToDate - - 'RequiereCotizacion = CType(dr("RequiereCotizacion"), Boolean) - SubProyecto = dr("SubProyecto").ToString - CveSubProyecto2 = dr("CveSubProyecto").ToString.ToEntero - - Empresa = dr("Empresa").ToString - Proyecto = dr("Proyecto").ToString - 'SubProyecto = dr("SubProyecto").ToString - _CvePresupuestoEgreso = dr("CvePresupuestoEgreso").ToString.ToEntero - - UsuarioSolicito = dr("UsuarioSolicito").ToString - UsuarioAutorizo = dr("UsuarioAutorizo").ToString - FolioAdicional = dr("FolioAdicional").ToString - EntregaDirecta = If(dr("EntregaDirecta").ToString.ToEntero > 0, True, False) - NombreCliente = dr("NombreCliente").ToString - CveVenta = dr("CveVenta").ToString.ToEntero - CveCompra = dr("CveCompra").ToString.ToEntero - CveMovimientoAlmacenVenta = dr("CveMovimientoAlmacenVenta").ToString.ToEntero - TieneVenta = dr("TieneVenta").ToString.ToEntero - TieneCompraInv = dr("TieneCompraInv").ToString.ToEntero - _CveDireccionEnvio = dr("CveDireccionEnvio").ToString.ToEntero - _CveUsoCFDI = dr("CveUsoCFDI").ToString.ToEntero - _UsoCFDI = dr("UsoCFDI").ToString - Promocion = IfNull(dr("Promocion"), "", dr("Promocion").ToString) - CveProveedorContacto = If(Not IsDBNull(dr("CveProveedorContacto")), dr("CveProveedorContacto").ToString.ToEntero, -1) - - Retorno = True - ElseIf Data.Rows.Count > 0 Then - Retorno = True - End If - - Catch ex As Exception - OnError("Ocurrió un error al obtener Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddOrdenCompra(pTipo As String, pCveSubProyecto As Integer, ByVal pDescripcion As String, pJustificacion As String, Prioridad As Integer, Fecha As Date, CveMoneda As Integer, pCveEstatus As Integer, - pFechaEstimadaEntrega As String, pLugarEntrega As String, pCveUsuario As Integer, pCveEmpresa As Integer, pCvePresupuestoEgreso As Integer, - Optional pCveProveedor As Integer = -1, Optional pCveProveedorSucursal As Integer = -1, Optional IDPoliza As Integer = -1, Optional RequiereCotizacion As Boolean = False, Optional CveUsuarioAsignado As Integer = -1, - Optional CveCliente As Integer = -1, Optional CveVendedor As Integer = -1, Optional PrioridadObservacion As String = "", - Optional PorcentajeIVA As Double = 0.16, Optional IVA As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0, Optional FechaExpiracion As Date = Nothing, Optional CveCotizacion As Integer = -1, - Optional FolioAdicional As String = "", Optional EntregaDirecta As Integer = -1, Optional CveDireccionEnvio As Integer = -1, Optional Guia As String = "-1", Optional IEPS As Decimal = -1, - Optional CveIEAnticipo As Integer = -1, Optional ImporteAnticipo As Double = 0, Optional UsoCFDI As Integer = -1, Optional Promocion As String = "-1", Optional CveProveedorContacto As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Tipo", SqlDbType.VarChar).Value = pTipo - .Add("@CveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto - .Add("@Descripcion", SqlDbType.VarChar).Value = pDescripcion - .Add("@Justificacion", SqlDbType.VarChar).Value = pJustificacion - .Add("@Prioridad", SqlDbType.Int).Value = Prioridad - .Add("@Fecha", SqlDbType.DateTime).Value = Fecha - .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@CveEstatus", SqlDbType.Int).Value = pCveEstatus - .Add("@FechaEstimadaEntrega", SqlDbType.VarChar).Value = pFechaEstimadaEntrega - .Add("@LugarEntrega", SqlDbType.VarChar).Value = pLugarEntrega - .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = pCveEmpresa - .Add("@CveProveedor", SqlDbType.Int).Value = pCveProveedor - .Add("@CveProveedorSucursal", SqlDbType.Int).Value = pCveProveedorSucursal - .Add("@PorcentajeIVA", SqlDbType.SmallMoney).Value = PorcentajeIVA - .Add("@IVA", SqlDbType.Money).Value = IVA - .Add("@RetIVA", SqlDbType.Money).Value = RetIVA - .Add("@RetISR", SqlDbType.Money).Value = RetISR - .Add("@IEPS", SqlDbType.Money).Value = IEPS - .Add("@RequiereCotizacion", SqlDbType.Bit).Value = If(RequiereCotizacion = True, 1, 0) - .Add("@CvePresupuestoEgreso", SqlDbType.Int).Value = pCvePresupuestoEgreso - .Add("@CveUsuarioAsignado", SqlDbType.Int).Value = CveUsuarioAsignado - .Add("@IDCuentaPolizaAC", SqlDbType.Int).Value = IDPoliza - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor - .Add("@CveCotizacion", SqlDbType.Int).Value = CveCotizacion - - .Add("@PrioridadObservacion", SqlDbType.VarChar).Value = PrioridadObservacion - .Add("@FolioAdicional", SqlDbType.VarChar).Value = FolioAdicional - .Add("@EntregaDirecta", SqlDbType.Int).Value = EntregaDirecta - .Add("@CveDireccionEnvio", SqlDbType.Int).Value = CveDireccionEnvio - .Add("@Guia", SqlDbType.VarChar).Value = Guia - .Add("@CveIEAnticipo", SqlDbType.Int).Value = CveIEAnticipo - .Add("@ImporteAnticipo", SqlDbType.Money).Value = ImporteAnticipo - .Add("@UsoCFDI", SqlDbType.Int).Value = UsoCFDI - .Add("@Promocion", SqlDbType.VarChar).Value = Promocion - .Add("@CveProveedorContacto", SqlDbType.Int).Value = CveProveedorContacto - - .Add("@vCveOrdenCompra", SqlDbType.Int).Direction = ParameterDirection.Output - .Add("@vFolio", SqlDbType.Int).Direction = ParameterDirection.Output - End With - - Try - SqlAdapter.Fill(Data) - - _CveOrdenCompra = SqlAdapter.SelectCommand.Parameters("@vCveOrdenCompra").Value.ToString.ToEntero - _Folio = SqlAdapter.SelectCommand.Parameters("@vFolio").Value.ToString.ToEntero - - 'GetOC(_CveOrdenCompra, pCveEmpresa) - Retorno = True - Catch ex As SqlException - If ex.Number = 2627 Then - Alert("La Clave o Descripción del OrdenCompra ya existe.", TipoMensaje.MsgAdvertencia) - Else - OnError("Ocurrió un error al guardar la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddOrdenCompraMovil(OC As WSOrdenCompra) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Tipo", SqlDbType.VarChar).Value = OC.Tipo - .Add("@CveSubProyecto", SqlDbType.Int).Value = OC.CveSubProyecto - .Add("@Descripcion", SqlDbType.VarChar).Value = OC.Descripcion - .Add("@Justificacion", SqlDbType.VarChar).Value = OC.Justificacion - .Add("@Prioridad", SqlDbType.Int).Value = OC.Prioridad - .Add("@Fecha", SqlDbType.DateTime).Value = OC.Fecha - .Add("@CveMoneda", SqlDbType.Int).Value = OC.CveMoneda - .Add("@CveEstatus", SqlDbType.Int).Value = OC.CveEstatus - .Add("@FechaEstimadaEntrega", SqlDbType.VarChar).Value = OC.FechaEstimadaEntrega - .Add("@LugarEntrega", SqlDbType.VarChar).Value = OC.LugarEntrega - .Add("@CveUsuario", SqlDbType.Int).Value = OC.CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = OC.CveEmpresa - .Add("@CveProveedor", SqlDbType.Int).Value = OC.CveProveedor - .Add("@CveProveedorSucursal", SqlDbType.Int).Value = OC.CveProveedorSucursal - .Add("@PorcentajeIVA", SqlDbType.SmallMoney).Value = OC.PorcentajeIVA - .Add("@IVA", SqlDbType.Money).Value = OC.IVA - .Add("@RetIVA", SqlDbType.Money).Value = OC.RetIVA - .Add("@RetISR", SqlDbType.Money).Value = OC.RetISR - .Add("@RequiereCotizacion", SqlDbType.Bit).Value = If(OC.RequiereCotizacion = True, 1, 0) - .Add("@CvePresupuestoEgreso", SqlDbType.Int).Value = OC.CvePresupuestoEgreso - .Add("@CveUsuarioAsignado", SqlDbType.Int).Value = OC.CveUsuarioAsignado - .Add("@IDCuentaPolizaAC", SqlDbType.Int).Value = OC.IDCuentaPolizaAC - .Add("@CveCliente", SqlDbType.Int).Value = OC.CveCliente - .Add("@CveVendedor", SqlDbType.Int).Value = OC.CveVendedor - .Add("@CveCotizacion", SqlDbType.Int).Value = OC.CveCotizacion - .Add("@PrioridadObservacion", SqlDbType.VarChar).Value = OC.PrioridadObservacion - .Add("@FolioAdicional", SqlDbType.VarChar).Value = OC.FolioAdicional - .Add("@EntregaDirecta", SqlDbType.Int).Value = OC.EntregaDirecta - .Add("@CveDireccionEnvio", SqlDbType.Int).Value = OC.CveDireccionEnvio - .Add("@Guia", SqlDbType.VarChar).Value = "-1" - - .Add("@vCveOrdenCompra", SqlDbType.Int).Direction = ParameterDirection.Output - .Add("@vFolio", SqlDbType.Int).Direction = ParameterDirection.Output - End With - - Try - SqlAdapter.Fill(Data) - - _CveOrdenCompra = SqlAdapter.SelectCommand.Parameters("@vCveOrdenCompra").Value.ToString.ToEntero - _Folio = SqlAdapter.SelectCommand.Parameters("@vFolio").Value.ToString.ToEntero - - 'GetOC(_CveOrdenCompra, pCveEmpresa) - Retorno = True - Catch ex As SqlException - If ex.Number = 2627 Then - Alert("La Clave o Descripción del OrdenCompra ya existe.", TipoMensaje.MsgAdvertencia) - Else - OnError("Ocurrió un error al guardar la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function UpdateOrdenCompraPoliza(IDPoliza As Integer, pCveOrdenCompra As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraPolizaUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@IDPoliza", SqlDbType.Int).Value = IDPoliza - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar la Poliza de la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateOrdenCompraDetalleAjuste(CveOrdenCompra As Integer, CveOrdenCompraDetalle As Integer, Diferencia As Double, CveUsuarioModifico As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_OrdenesCompraDetalleAjusteUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra - .Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = CveOrdenCompraDetalle - .Add("@Diferencia", SqlDbType.Float).Value = Diferencia - .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar la Orden de Compra Detalle.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - Public Function UpdateOrdenCompraMoneda(CveOrdenCompra As Integer, CveEmpresa As Integer, CveMoneda As Integer, CveUsuarioModifico As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_OrdenesCompraMonedaUpdate") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa +Imports System.Data +Imports System.Data.SqlClient +Imports Extensiones +Imports Modelos + +Public Class ClsOC + Implements IDisposable + +#Region "Campos" + 'SQL + Private SqlConexion As SqlConnection + Private SqlAdapter As SqlDataAdapter + Private SqlTransacc As SqlTransaction + Private SqlCommand As SqlCommand + Private StrSQL As StringBuilder + Private Data As DataTable + 'Atributos de la clase + Private disposedValue As Boolean = False + 'PARA REGISTRAR CONEXION + Private CveConexion As Integer = 0 + +#End Region + +#Region "Propiedades" + + Public Property FechaIng As Date + Public Property CveUsuario As Integer + Public Property NombreUsuario As String + Public Property CveOrdenCompra As Integer + Public Property CveOrdenCompraDetalle As Integer + Public Property Folio As Integer + Public Property CveIEAnticipo As Integer + Public Property CveProveedorAnticipo As Integer + Public Property FolioIEAnticipo As Integer + Public Property ImporteAnticipo As Double + + Public Property FolioAdicional As String + Public Property EntregaDirecta As Boolean + Public Property CveVenta As Integer + Public Property CveCompra As Integer + Public Property CveMovimientoAlmacenVenta As Integer + Public Property TieneVenta As Integer + Public Property TieneCompraInv As Integer + + Public Property Tipo As String + Public Property CveEstatus As Integer + Public Property Estatus As String + Public Property Prioridad As Integer + Public Property Moneda As String + Public Property UsuarioAsignado As String + Public Property CveUsuarioAsignado As Integer + + Private _EsCancelable As Boolean + + Private _EsCotizacion As Boolean + Public Property TipoTermino As Integer + Public Property CveEstatusSiguiente As Integer + Public Property CveEstatusAnterior As Integer + + Public Property Descripcion As String + Public Property Justificacion As String + Public Property CveEmpresa As Integer + Private _CveProyecto As Integer + + 'Private _CveUsuario As Integer + Public Property Fecha As Date + Public Property FechaEstimadaEntrega As Date + 'Private _NombreUsuario As String + Public Property CveProveedor As Integer + Public Property CveProveedorSucursal As Integer + Public Property SucursalDireccion As String + Public Property ProveedorContacto As String + Public Property SucursalTelefono As String + Public Property RazonSocial As String + Public Property Direccion As String + Public Property Telefono As String + Public Property RFC As String + Public Property LugarEntrega As String + Public Property Cancelacion As String + Public Property PorcentajeIVA As Double + Public Property CveCliente As Integer + Public Property CveVendedor As Integer + Public Property PrioridadObservacion As String + Public Property SubTotal As Double + Public Property IVA As Double + Public Property RetIVA As Double + Public Property RetISR As Double + Public Property IEPS As Double + Public Property Total As Double + Public Property CvePresupuestoEgreso As Integer + Public Property RequiereCotizacion As Boolean + Public Property CveActivoFijo As Integer + Public Property Codigo As String + Public Property Proyecto As String + Public Property CveSubProyecto2 As Integer + Public Property SubProyecto As String + Public Property UsuarioSolicito As String + Public Property UsuarioAutorizo As String + Public Property Descuento As Double + Public Property Pendiente As Double + Public Property NombreCliente As String + Public Property SucCalle As String + Public Property SucNoExt As String + Public Property SucNoInt As String + Public Property SucColonia As String + Public Property SucMunicipio As String + Public Property SucEstado As String + Public Property SucPais As String + Public Property SucCP As String + Public Property SucTelefono As String + Public Property CveDireccionEnvio As Integer + Public Property IdPoliza As Integer + Public Property HoraElaboracion As String + Public Property SucSubProyecto As String + Public Property Guia As String + Public Property CveUsoCFDI As Integer + Public Property UsoCFDI As String + Public Property Promocion As String + Public Property CveProveedorContacto As Integer + + Public ReadOnly Property DtResultados() As DataTable + Get + DtResultados = Data + End Get + End Property + + +#End Region + +#Region "Propiedades ClsOCCotizaciones" + Public Property CveCotizacion As Integer + Public Property CveCotizacionDetalle As Integer + + Public Property NombreComercial As String + + Public Property CveMoneda As Integer + Public Property CveColectiva As Integer + Public Property Colectiva As String + + Public Property Extension As String + Public Property Adjunto As String + Public Property Usuario As String + + Public Property Empresa As String + Public Property Sucursal As String + Public Property ObjLugarEntrega As String + Public Property DiasCredito As Integer + + + +#End Region + + Sub New(Optional TransaccionCompartida As SqlTransaction = Nothing) + + If TransaccionCompartida Is Nothing Then + SqlConexion = New SqlConnection + SqlConexion.ConnectionString = ConfigurationManager.ConnectionStrings("Conexion").ConnectionString + Try + SqlConexion.Open() + Catch ex As Exception + OnError("Ocurrió un error al intentar conectarse a la base de datos.", ex) + End Try + Else + SqlConexion = TransaccionCompartida.Connection + SqlTransacc = TransaccionCompartida + End If + + SqlCommand = New SqlCommand("", SqlConexion) + SqlAdapter = New SqlDataAdapter("", SqlConexion) + StrSQL = New StringBuilder + ConexionAdd() + End Sub + Private Sub DataAdapter(StrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) + With SqlAdapter.SelectCommand + .Parameters.Clear() + .CommandText = StrSQL + .CommandType = TipoComando + End With + If Not SqlTransacc Is Nothing Then SqlAdapter.SelectCommand.Transaction = SqlTransacc + Data = New DataTable + End Sub +#Region "Conexiones" + + Private Sub ConexionAdd() + If ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + + 'DataAdapter(String.Format("INSERT INTO Sis_Conexiones (Clase,Modulo) VALUES ('ClsRH','{0}')", "RH/CatMotivosBaja"), CommandType.Text) ' pendiente de terminar parra registrar el cveconexion, falta el rarámetro de módulo + + Try + DataAdapter("PA_Sis_RegistrarConexion") + With SqlAdapter.SelectCommand.Parameters + .Add("@Clase", SqlDbType.VarChar).Value = Me.GetType().Name + .Add("@Modulo", SqlDbType.VarChar).Value = String.Format("{0}?{1}", HttpContext.Current.Request.Url.AbsolutePath.ToString, HttpContext.Current.Request.QueryString.ToString) + .Add("@IDConexion", SqlDbType.Int).Direction = ParameterDirection.Output + End With + SqlAdapter.Fill(Data) + CveConexion = SqlAdapter.SelectCommand.Parameters("@IDConexion").Value.ToString.ToEntero + Catch ex As Exception + OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + End If + End Sub + + Private Sub ConexionClose() + If CveConexion > 0 AndAlso ConfigurationManager.AppSettings("RegistraConexion") IsNot Nothing AndAlso ConfigurationManager.AppSettings("RegistraConexion").ToString() = "1" Then + + DataAdapter(String.Format("UPDATE Sis_Conexiones SET FechaCierre = GETDATE() WHERE CveConexion = {0}", CveConexion), CommandType.Text) + Try + SqlAdapter.Fill(Data) + + Catch ex As Exception + OnError("Ocurrió un error registrar la conexión.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + CveConexion = 0 + End If + + End Sub +#End Region + Private Sub DataCommand(pStrSQL As String, Optional TipoComando As CommandType = CommandType.StoredProcedure) + With SqlCommand + .Parameters.Clear() + .CommandText = pStrSQL + .CommandType = TipoComando + End With + + If Not SqlTransacc Is Nothing Then SqlCommand.Transaction = SqlTransacc + + End Sub + Public Function IniciaTransacSQL() As SqlTransaction + If SqlTransacc Is Nothing Then SqlTransacc = SqlConexion.BeginTransaction() + Return SqlTransacc + End Function + Public Sub RollBack() + If SqlTransacc IsNot Nothing Then SqlTransacc.Rollback() + SqlTransacc = Nothing + End Sub + Public Sub Commit() + If SqlTransacc IsNot Nothing Then SqlTransacc.Commit() + SqlTransacc = Nothing + End Sub + +#Region "ClsOCCotizaciones" + Public Function GetCotizaciones(pCveOrdenCompra As Integer, Optional pCveCotizacion As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_CotizacionesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + .Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion + End With + + Try + SqlAdapter.Fill(Data) + If Data.Rows.Count = 1 Then + Me.CveProveedor = If(Not IsDBNull(Data.Rows(0)("CveProveedor")), Data.Rows(0)("CveProveedor").ToString.ToEntero(), -1) + NombreComercial = If(Not IsDBNull(Data.Rows(0)("NombreComercial")), Data.Rows(0)("NombreComercial").ToString, "") + Me.RazonSocial = If(Not IsDBNull(Data.Rows(0)("RazonSocial")), Data.Rows(0)("RazonSocial").ToString, "") + + CveColectiva = If(Not IsDBNull(Data.Rows(0)("CveColectiva")), Data.Rows(0)("CveColectiva").ToString.ToEntero(), -1) + Colectiva = If(Not IsDBNull(Data.Rows(0)("Colectiva")), Data.Rows(0)("Colectiva").ToString, "") + + CveCotizacion = Data.Rows(0)("CveCotizacion").ToString.ToEntero() + Me.CveOrdenCompra = Data.Rows(0)("CveOrdenCompra").ToString.ToEntero() + CveMoneda = If(Not IsDBNull(Data.Rows(0)("CveMoneda")), Data.Rows(0)("CveMoneda").ToString.ToEntero(), -1) + + Me.Folio = Data.Rows(0)("Folio").ToString.ToEntero + Me.Fecha = Data.Rows(0)("Fecha").ToString.ToDate + Adjunto = Data.Rows(0)("Adjunto").ToString + Extension = Data.Rows(0)("Extension").ToString + Usuario = Data.Rows(0)("Usuario").ToString + Me.CveUsuario = Data.Rows(0)("CveUsuario").ToString.ToEntero + Me.Total = Data.Rows(0)("Total").ToString.ToDouble + + + Me.CveEmpresa = Data.Rows(0)("CveEmpresa").ToString.ToEntero + 'Me.CveProveedorSucursal = Data.Rows(0)("CveProveedorSucursal").ToString.ToEntero + Empresa = Data.Rows(0)("Empresa").ToString + CveSubProyecto2 = Data.Rows(0)("CveSubProyecto").ToString.ToEntero + SubProyecto = Data.Rows(0)("SubProyecto").ToString + ObjLugarEntrega = Data.Rows(0)("LugarEntrega").ToString + DiasCredito = Data.Rows(0)("DiasCredito").ToString.ToEntero + End If + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Cotizaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetCotizacionesTabla(pCveOrdenCompra As Integer) As DataSet + Dim Retorno As New DataSet + + DataAdapter("PA_OC_Cotizaciones2Get") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + End With + + Try + SqlAdapter.Fill(Retorno) + Catch ex As Exception + ' OnError("Ocurrió un error al obtener el Catálogo de Cotizaciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddCotizacion(pCveOrdenCompra As Integer, pCveProveedor As Integer, pCveColectiva As Integer, pFolio As String, pFecha As String, pAdjunto As String, pCveMoneda As Integer, pDiasCredito As Integer, pCveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_CotizacionesAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + .Add("@CveProveedor", SqlDbType.Int).Value = pCveProveedor + .Add("@CveColectiva", SqlDbType.Int).Value = pCveColectiva + .Add("@Folio", SqlDbType.VarChar).Value = pFolio + .Add("@Fecha", SqlDbType.VarChar).Value = pFecha + .Add("@Adjunto", SqlDbType.VarChar).Value = pAdjunto + .Add("@CveMoneda", SqlDbType.Int).Value = pCveMoneda + .Add("@DiasCredito", SqlDbType.Int).Value = pDiasCredito + .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario + .Add("@vCveCotizacion", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + CveCotizacion = SqlAdapter.SelectCommand.Parameters("@vCveCotizacion").Value.ToString.ToEntero + Retorno = True + Catch ex As SqlException + If ex.Number = 2627 Then + Alert("La Clave o Descripción de la Cotizacion ya existe.", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al guardar el nuevo Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar el nuevo Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateCotizacion(pCveProveedor As Integer, pCveColectiva As Integer, pFolio As String, pFecha As String, pAdjunto As String, pCveMoneda As Integer, pDiasCredito As Integer, pCveUsuario As Integer, pCveCotizacion As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_CotizacionesUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveProveedor", SqlDbType.Int).Value = pCveProveedor + .Add("@CveColectiva", SqlDbType.Int).Value = pCveColectiva + .Add("@Folio", SqlDbType.VarChar).Value = pFolio + .Add("@Fecha", SqlDbType.VarChar).Value = pFecha + .Add("@Adjunto", SqlDbType.VarChar).Value = pAdjunto + .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario + .Add("@DiasCredito", SqlDbType.Int).Value = pDiasCredito + .Add("@CveMoneda", SqlDbType.Int).Value = pCveMoneda + .Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As SqlException + If ex.Number = 2627 Then + Alert("La Clave o Descripción del Cotizacion ya existe.", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al guardar los cambios en el Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemoveCotizacion(pCveCotizacion As Integer) As String + Dim Retorno As String = "" + + DataAdapter("PA_OC_CotizacionesRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion + .Add("@vNombreArchivo", SqlDbType.VarChar, 50).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = SqlAdapter.SelectCommand.Parameters("@vNombreArchivo").Value.ToString + Catch ex As Exception + OnError("Ocurrió un error al eliminar el Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetCotizacionesDetalle(pCveCotizacion As Integer, Optional pCveOrdenCompra As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_CotizacionesDetalleGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener Detalle de cotización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddCotizacionDetalle(pCveCotizacion As Integer, pCvePS As Integer, pPrecioUnitario As Double, pCantidad As Double, pCveUM As Integer, pCantidadSurtir As Double, pFechaEntrega As String, pObservacion As String, pCveOrdenCompraDetalle As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_CotizacionesDetalleAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion + .Add("@CvePS", SqlDbType.Int).Value = pCvePS + .Add("@PU", SqlDbType.Money).Value = pPrecioUnitario + .Add("@Cantidad", SqlDbType.Float).Value = pCantidad + .Add("@CveUM", SqlDbType.Int).Value = pCveUM + .Add("@CantidadSurtir", SqlDbType.Float).Value = pCantidadSurtir + .Add("@FechaEntrega", SqlDbType.VarChar).Value = pFechaEntrega + .Add("@Observacion", SqlDbType.VarChar).Value = pObservacion + .Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = pCveOrdenCompraDetalle + .Add("@vCveCotizacionDetalle", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + + CveCotizacionDetalle = SqlAdapter.SelectCommand.Parameters("@vCveCotizacionDetalle").Value.ToString.ToEntero + Retorno = True + Catch ex As SqlException + If ex.Number = 2627 Then + Alert("La Clave o Descripción de la Cotizacion ya existe.", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al guardar el nuevo Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar el nuevo Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateCotizacionDetalle(pCveCotizacionDetalle As Integer, pPrecioUnitario As Double, pCantidadSurtir As Double, pFechaEntrega As String, pObservacion As String) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_CotizacionesDetalleUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@PU", SqlDbType.Money).Value = pPrecioUnitario + .Add("@CantidadSurtir", SqlDbType.Float).Value = pCantidadSurtir + .Add("@FechaEntrega", SqlDbType.VarChar).Value = pFechaEntrega + .Add("@Observacion", SqlDbType.VarChar).Value = pObservacion + .Add("@CveCotizacionDetalle", SqlDbType.Int).Value = pCveCotizacionDetalle + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + If ex.Number = 2627 Then + Alert("La Clave o Descripción de la Cotizacion ya existe.", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al actualizar la Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al actualizar la Cotización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateCotizacionDetalleGanadora(pCveCotizacionDetalle As Integer, pEsGanadora As Boolean) As Integer + Dim Retorno As Integer = -1 + + DataAdapter("PA_OC_CotizacionesDetalleEsGanadoraUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@EsGanadora", SqlDbType.Bit).Value = pEsGanadora + .Add("@CveCotizacionDetalle", SqlDbType.Int).Value = pCveCotizacionDetalle + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = pCveCotizacionDetalle + Catch ex As SqlException + If ex.Number = 2627 Then + Alert("La Clave o Descripción de la Cotizacion ya existe.", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al actualizar la Cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al actualizar la Cotización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function RemoveCotizacionDetalle(pCveCotizacion As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_CotizacionesDetalleRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCotizacion", SqlDbType.Int).Value = pCveCotizacion + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al eliminar el Cotizacion Detalle.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateOrdenCompraCotizacion(pCveOrdenCompra As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraDetalleCotizacionUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la OC/Req con Cotización.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + + 'Public Function GetEstatusCompra(ByVal CveEstatusCompra As Integer, ByVal EstatusCompra As String) As Boolean + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_OC_EstatusOrdenCompraGet") + ' Try + ' SqlAdapter.Fill(Data) + + ' If Data.Rows.Count = 1 Then + ' _CveEstatusCompra = Data.Rows(0)("CveEstatusCompra").ToString().ToEntero() + ' _EstatusCompra = Data.Rows(0)("EstatusCompra").ToString() + ' _Estatus = Data.Rows(0)("Estatus").ToString = "True" + ' _FechaIng = Data.Rows(0)("FechaIng").ToString().ToDate() + ' _CveUsuario = Data.Rows(0)("CveUsuario").ToString().ToEntero() + ' _NombreUsuario = Data.Rows(0)("Nombre").ToString() + ' End If + + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al obtener el Catálogo de Estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + + ' Return Retorno + 'End Function + + 'Public Function AddEstatusCompra(ByVal Descripcion As String, Estatus As Boolean, ByVal CveUsuario As Integer) As Boolean + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_OC_EstatusOrdenCompraAdd") + + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@EstatusOrdenCompra", SqlDbType.VarChar).Value = Descripcion + ' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + ' End With + + ' Try + ' SqlAdapter.Fill(Data) + + ' Retorno = True + ' Catch ex As SqlException + ' If ex.Number = 2627 Then + ' Alert("La Clave o Descripción del EstatusCompra ya existe.", TipoMensaje.MsgAdvertencia) + ' Else + ' OnError("Ocurrió un error al guardar el nuevo estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End If + ' Catch ex As Exception + ' OnError("Ocurrió un error al guardar el nuevo estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + + ' Return Retorno + 'End Function + + 'Public Function UpdateEstatusCompra(ByVal Descripcion As String, Estatus As Boolean, ByVal CveEstatusCompra As Integer, ByVal CveUsuario As Integer) As Boolean + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_OC_EstatusOrdenCompraUpdate") + + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@EstatusOrdenCompra", SqlDbType.VarChar).Value = Descripcion + ' '.Add("@pCveUsuario", SqlDbType.Int).Value = CveUsuario + ' .Add("@Estatus", SqlDbType.Bit).Value = Estatus + ' .Add("@CveEstatusOrdenCompra", SqlDbType.Int).Value = CveEstatusCompra + ' End With + + ' Try + ' SqlAdapter.Fill(Data) + + ' Retorno = True + ' Catch ex As SqlException + ' If ex.Number = 2627 Then + ' Alert("La Clave o Descripción del Estatus de Compra ya existe.", TipoMensaje.MsgAdvertencia) + ' Else + ' OnError("Ocurrió un error al guardar los cambios en el estatus de compra", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End If + ' Catch ex As Exception + ' OnError("Ocurrió un error al guardar los cambios en el estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + + ' Return Retorno + 'End Function + + 'Public Function RemoveEstatusCompra(ByVal CveEstatusCompra As Integer) As Boolean + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_OC_EstatusOrdenCompraRemove") + + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveEstatusOrdenCompra", SqlDbType.Int).Value = CveEstatusCompra + ' End With + + ' Try + ' SqlAdapter.Fill(Data) + + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al eliminar el estatus de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + + ' Return Retorno + 'End Function + + + +#Region "O R D E N E S - D E - C O M P R A S" + Public Function GetOC(ObjOrdenCompra As Modelos.OrdenCompra) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = ObjOrdenCompra.CveOrdenCompra + .Add("@Folio", SqlDbType.Int).Value = ObjOrdenCompra.Folio + .Add("@CveSubProyecto", SqlDbType.Int).Value = -1 'ObjOrdenCompra.CveSucursal + .Add("@Tipo", SqlDbType.VarChar).Value = ObjOrdenCompra.Tipo + .Add("@CveCliente", SqlDbType.Int).Value = ObjOrdenCompra.CveCliente + .Add("@CveVendedor", SqlDbType.Int).Value = ObjOrdenCompra.CveVendedor + .Add("@Guia", SqlDbType.Int).Value = ObjOrdenCompra.Guia + .Add("@CveEmpresa", SqlDbType.Int).Value = ObjOrdenCompra.CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + If Data.Rows.Count > 0 Then + + + Retorno = True + End If + + Catch ex As Exception + OnError("Ocurrió un error al obtener Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetOC(CveOrdenCompra As Integer, CveEmpresa As Integer, Optional Folio As Integer = -1, Optional CveSubProyecto As Integer = -1, Optional Tipo As String = "-1", Optional CveVendedor As Integer = -1, Optional CveCliente As Integer = -1, Optional Guia As String = "-1", Optional CveUsuario As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@Tipo", SqlDbType.VarChar).Value = Tipo + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@Guia", SqlDbType.Int).Value = Guia + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + End With + + Try + SqlAdapter.Fill(Data) + + If Data.Rows.Count >= 1 Then + Dim dr As DataRow = Data.Rows(0) + _CveOrdenCompra = dr("CveOrdenCompra").ToString.ToEntero + _Folio = dr("Folio").ToString.ToEntero + _CveIEAnticipo = dr("CveIEAnticipo").ToString.ToEntero + _FolioIEAnticipo = dr("FolioIEAnticipo").ToString.ToEntero + _ImporteAnticipo = dr("ImporteAnticipo").ToString.ToDouble + _CveProveedorAnticipo = dr("CveProveedorAnticipo").ToString.ToEntero + _CveEmpresa = dr("CveEmpresa").ToString.ToEntero + _CveProyecto = dr("CveProyecto").ToString.ToEntero + '_CveSubProyecto = dr("CveSubProyecto").ToString.ToEntero + _Guia = dr("Guia").ToString + _FechaEstimadaEntrega = If(Not IsDBNull(dr("FechaEstimadaEntrega")), CDate(dr("FechaEstimadaEntrega")), New DateTime) + _Descripcion = dr("Descripcion").ToString + _Justificacion = dr("Justificacion").ToString + _Prioridad = If(dr("Prioridad").ToString.ToEntero = 0, -1, dr("Prioridad").ToString.ToEntero) + _Tipo = dr("Tipo").ToString + _Fecha = dr("Fecha").ToString.ToDate + _HoraElaboracion = dr("HoraElaboracion").ToString + _CveEstatus = dr("CveEstatus").ToString.ToEntero + CveMoneda = dr("CveMoneda").ToString.ToEntero + Moneda = dr("Moneda").ToString + UsuarioAsignado = dr("UsuarioAsignado").ToString + CveUsuarioAsignado = dr("CveUsuarioAsignado").ToString.ToEntero + _EsCancelable = dr("EsCancelable").ToString = "True" + _TipoTermino = dr("TipoTermino").ToString.ToEntero + Cancelacion = dr("Cancelacion").ToString + _CveEstatusSiguiente = dr("CveEstatusSiguiente").ToString.ToEntero + _EsCotizacion = dr("EsCotizacion").ToString = "True" + _CveEstatusAnterior = If(Not IsDBNull(dr("CveEstatusAnterior")), dr("CveEstatusAnterior").ToString.ToEntero, -1) + _Estatus = dr("Estatus").ToString + RequiereCotizacion = dr("RequiereCotizacion").ToString() = "True" + _CveUsuario = dr("CveUsuario").ToString.ToEntero + _NombreUsuario = dr("NombreUsuario").ToString + + _CveProveedor = If(Not IsDBNull(dr("CveProveedor")), dr("CveProveedor").ToString.ToEntero, -1) + _CveProveedorSucursal = If(Not IsDBNull(dr("CveProveedorSucursal")), dr("CveProveedorSucursal").ToString.ToEntero, -1) + _RazonSocial = If(Not IsDBNull(dr("RazonSocial")), dr("RazonSocial").ToString, "") + _Direccion = If(Not IsDBNull(dr("Direccion")), dr("Direccion").ToString, "") + _Telefono = If(Not IsDBNull(dr("Telefono")), dr("Telefono").ToString, "") + _RFC = If(Not IsDBNull(dr("RFC")), dr("RFC").ToString, "") + _LugarEntrega = If(Not IsDBNull(dr("LugarEntrega")), dr("LugarEntrega").ToString, "") + _CveCliente = If(dr("CveCliente").ToString.ToEntero = 0, -1, dr("CveCliente").ToString.ToEntero) + _CveVendedor = If(dr("CveVendedor").ToString.ToEntero = 0, -1, dr("CveVendedor").ToString.ToEntero) + _PrioridadObservacion = dr("PrioridadObservacion").ToString + IdPoliza = dr("IdPoliza").ToString.ToEntero + Me.SucursalDireccion = If(Not IsDBNull(dr("DireccionSucursal")), dr("DireccionSucursal").ToString, "") + Me.SucursalTelefono = If(Not IsDBNull(dr("TelefonoSucursal")), dr("TelefonoSucursal").ToString, "") + ProveedorContacto = dr("ContactoNombre").ToString + + PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDouble + SubTotal = dr("SubTotal").ToString.ToDouble + Descuento = dr("Descuento").ToString.ToDouble + IVA = dr("IVA").ToString.ToDouble + RetIVA = dr("RetIVA").ToString.ToDouble + RetISR = dr("RetISR").ToString.ToDouble + IEPS = dr("IEPS").ToString.ToDouble + Total = dr("Total").ToString.ToDouble + Pendiente = dr("Pendiente").ToString.ToDouble + 'If Not IsDBNull(dr("SubTotal")) Then + ' SubTotal = dr("SubTotal").ToString.ToDouble + ' If IVA <= 0 Then + ' _IVA = _SubTotal * dr("PorcentajeIVA").ToString.ToDouble + ' End If + ' _Total = _SubTotal + _IVA - _Descuento - _RetIVA - _RetISR + 'End If + + '_CveSupervisara = dr("CveSupervisara").ToString.ToEntero + '_CveAutoriza = dr("CveAutoriza").ToString.ToEntero + '_CveAutorizara = dr("CveAutorizara").ToString.ToEntero + + '_NombreSupervisa = dr("NombreSupervisa").ToString + + '_NombreAutoriza = dr("NombreAutoriza").ToString + '_FechaSupervisa = dr("FechaSupervisa").ToString.ToDate + '_FechaAutoriza = dr("FechaAutoriza").ToString.ToDate + + 'RequiereCotizacion = CType(dr("RequiereCotizacion"), Boolean) + SubProyecto = dr("SubProyecto").ToString + CveSubProyecto2 = dr("CveSubProyecto").ToString.ToEntero + + Empresa = dr("Empresa").ToString + Proyecto = dr("Proyecto").ToString + 'SubProyecto = dr("SubProyecto").ToString + _CvePresupuestoEgreso = dr("CvePresupuestoEgreso").ToString.ToEntero + + UsuarioSolicito = dr("UsuarioSolicito").ToString + UsuarioAutorizo = dr("UsuarioAutorizo").ToString + FolioAdicional = dr("FolioAdicional").ToString + EntregaDirecta = If(dr("EntregaDirecta").ToString.ToEntero > 0, True, False) + NombreCliente = dr("NombreCliente").ToString + CveVenta = dr("CveVenta").ToString.ToEntero + CveCompra = dr("CveCompra").ToString.ToEntero + CveMovimientoAlmacenVenta = dr("CveMovimientoAlmacenVenta").ToString.ToEntero + TieneVenta = dr("TieneVenta").ToString.ToEntero + TieneCompraInv = dr("TieneCompraInv").ToString.ToEntero + _CveDireccionEnvio = dr("CveDireccionEnvio").ToString.ToEntero + _CveUsoCFDI = dr("CveUsoCFDI").ToString.ToEntero + _UsoCFDI = dr("UsoCFDI").ToString + Promocion = IfNull(dr("Promocion"), "", dr("Promocion").ToString) + CveProveedorContacto = If(Not IsDBNull(dr("CveProveedorContacto")), dr("CveProveedorContacto").ToString.ToEntero, -1) + + Retorno = True + ElseIf Data.Rows.Count > 0 Then + Retorno = True + End If + + Catch ex As Exception + OnError("Ocurrió un error al obtener Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddOrdenCompra(pTipo As String, pCveSubProyecto As Integer, ByVal pDescripcion As String, pJustificacion As String, Prioridad As Integer, Fecha As Date, CveMoneda As Integer, pCveEstatus As Integer, + pFechaEstimadaEntrega As String, pLugarEntrega As String, pCveUsuario As Integer, pCveEmpresa As Integer, pCvePresupuestoEgreso As Integer, + Optional pCveProveedor As Integer = -1, Optional pCveProveedorSucursal As Integer = -1, Optional IDPoliza As Integer = -1, Optional RequiereCotizacion As Boolean = False, Optional CveUsuarioAsignado As Integer = -1, + Optional CveCliente As Integer = -1, Optional CveVendedor As Integer = -1, Optional PrioridadObservacion As String = "", + Optional PorcentajeIVA As Double = 0.16, Optional IVA As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0, Optional FechaExpiracion As Date = Nothing, Optional CveCotizacion As Integer = -1, + Optional FolioAdicional As String = "", Optional EntregaDirecta As Integer = -1, Optional CveDireccionEnvio As Integer = -1, Optional Guia As String = "-1", Optional IEPS As Decimal = -1, + Optional CveIEAnticipo As Integer = -1, Optional ImporteAnticipo As Double = 0, Optional UsoCFDI As Integer = -1, Optional Promocion As String = "-1", Optional CveProveedorContacto As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Tipo", SqlDbType.VarChar).Value = pTipo + .Add("@CveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto + .Add("@Descripcion", SqlDbType.VarChar).Value = pDescripcion + .Add("@Justificacion", SqlDbType.VarChar).Value = pJustificacion + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@Fecha", SqlDbType.DateTime).Value = Fecha .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda - .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar la Orden de Compra Detalle.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - Return Retorno - End Function - - Public Function UpdateOrdenCompra(pCveSubProyecto As Integer, ByVal pDescripcion As String, pJustificacion As String, Prioridad As Integer, pRequiereCotizacion As Boolean, pFechaEstimadaEntrega As String, pLugarEntrega As String, pCveMoneda As Integer, - pCveProveedor As Integer, pCveOrdenCompra As Integer, pCveUsuarioModifico As Integer, Optional CveCliente As Integer = -1, Optional CveVendedor As Integer = -1, Optional PrioridadObservacion As String = "", - Optional IVA As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0, Optional IDPoliza As Integer = -1, Optional FechaExpiracion As Date = Nothing, Optional FolioAdicional As String = "", - Optional EntregaDirecta As Integer = -1, Optional CveDireccionEnvio As Integer = -1, Optional Guia As String = "-1", Optional IEPS As Decimal = -1, Optional UsoCFDI As Integer = -1, Optional Promocion As String = "-1", - Optional pCveProveedorSucursal As Integer = -1, Optional CveProveedorContacto As Integer = -1, Optional PorcentajeIVA As Double = 0.16) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto - .Add("@Descripcion", SqlDbType.VarChar).Value = pDescripcion - .Add("@Justificacion", SqlDbType.VarChar).Value = pJustificacion - .Add("@Prioridad", SqlDbType.Int).Value = Prioridad - .Add("@RequiereCotizacion", SqlDbType.Bit).Value = If(pRequiereCotizacion, 1, 0) - .Add("@FechaEstimadaEntrega", SqlDbType.VarChar).Value = pFechaEstimadaEntrega - .Add("@LugarEntrega", SqlDbType.VarChar).Value = pLugarEntrega - .Add("@CveMoneda", SqlDbType.Int).Value = pCveMoneda - .Add("@CveProveedor", SqlDbType.Int).Value = pCveProveedor - .Add("@CveUsuarioModifico", SqlDbType.Int).Value = pCveUsuarioModifico - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor - .Add("@PrioridadObservacion", SqlDbType.VarChar).Value = PrioridadObservacion - .Add("@IVA", SqlDbType.Money).Value = IVA - .Add("@RetIVA", SqlDbType.Money).Value = RetIVA - .Add("@RetISR", SqlDbType.Money).Value = RetISR - .Add("@IEPS", SqlDbType.Money).Value = IEPS - .Add("@IDCuentaPolizaAC", SqlDbType.Int).Value = IDPoliza - .Add("@FolioAdicional", SqlDbType.VarChar).Value = FolioAdicional - .Add("@EntregaDirecta", SqlDbType.Int).Value = EntregaDirecta - .Add("@CveDireccionEnvio", SqlDbType.Int).Value = CveDireccionEnvio - .Add("@Guia", SqlDbType.VarChar).Value = Guia - .Add("@UsoCFDI", SqlDbType.Int).Value = UsoCFDI - .Add("@Promocion", SqlDbType.VarChar).Value = Promocion - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - .Add("@CveProveedorSucursal", SqlDbType.Int).Value = pCveProveedorSucursal - .Add("@CveProveedorContacto", SqlDbType.Int).Value = CveProveedorContacto - .Add("@PorcentajeIVA", SqlDbType.SmallMoney).Value = PorcentajeIVA - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As SqlException - If ex.Number = 2627 Then - Alert("La Clave o Descripción del OrdenCompra ya existe.", TipoMensaje.MsgAdvertencia) - Else - OnError("Ocurrió un error al actualizar la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al actualizar la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateOrdenCompraGuia(pGuia As String, pCveEmpresa As Integer, pCveOrdenCompra As Integer, pCveUsuarioModifico As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraUpdateGuia") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Guia", SqlDbType.VarChar).Value = pGuia - .Add("@CveEmpresa", SqlDbType.Int).Value = pCveEmpresa - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - .Add("@CveUsuarioModifico", SqlDbType.Int).Value = pCveUsuarioModifico - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As SqlException - If ex.Number = 2627 Then - Alert("La Clave o Descripción del OrdenCompra ya existe.", TipoMensaje.MsgAdvertencia) - Else - OnError("Ocurrió un error al guardar la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al editar la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateProveedorOrdenCompra(pCveProveedor As Integer, pCveOrdenCompra As Integer, pCveUsuarioModifico As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraProveedorUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveProveedor", SqlDbType.Int).Value = pCveProveedor - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - .Add("@CveUsuarioModifico", SqlDbType.Int).Value = pCveUsuarioModifico - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - - Catch ex As Exception - OnError("Ocurrió un error al editar el proveedor en la orden de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateClienteVendedorOrdenCompra(pCveCliente As Integer, pCveVendedor As Integer, pCveOrdenCompra As Integer, pCveUsuarioModifico As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraClienteVendedorUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCliente", SqlDbType.Int).Value = pCveCliente - .Add("@CveVendedor", SqlDbType.Int).Value = pCveVendedor - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - .Add("@CveUsuarioModifico", SqlDbType.Int).Value = pCveUsuarioModifico - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - - Catch ex As Exception - OnError("Ocurrió un error al editar el Cliente-Vendedor en la orden de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function UpdateOrdenCompraVinculacionCompra(CveCompra As Integer, CveOrdenCompra As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraUpdateCompra") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As SqlException - If ex.Number = 2627 Then - Alert("La Clave o Descripción del OrdenCompra ya existe.", TipoMensaje.MsgAdvertencia) - Else - OnError("Ocurrió un error al guardar la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al editar la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function UpdateOrdenCompraRequiereCorizacion(CveOrdenCompra As Integer, RequiereCotizacion As Boolean) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraRequiereCorizacionUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@RequiereCotizacion", SqlDbType.Bit).Value = RequiereCotizacion - .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al editar la OrdenCompra, Requiere cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetSucursalOC(CveOC As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_GetSucursalOC") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra - End With - - Try - SqlAdapter.Fill(Data) - If Data.Rows.Count > 0 Then - Dim dr As DataRow = Data.Rows(0) - SucCalle = dr("Calle").ToString - SucNoExt = dr("NoExt").ToString - SucNoInt = dr("NoInt").ToString - SucColonia = dr("Colonia").ToString - SucMunicipio = dr("Municipio").ToString - SucEstado = dr("Estado").ToString - SucPais = dr("Pais").ToString - SucCP = dr("CP").ToString - SucSubProyecto = dr("SubProyecto").ToString - SucTelefono = dr("Telefono").ToString - End If - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener la sucursal de la orden de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "O R D E N E S - D E - C O M P R A S - D E T A L L E" - Public Function GetPrueba() As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_PruebaGet") - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener una Prueba.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetOrdenesDetalle(pCveOrdenCompra As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraDetalleGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el detalle de OrdenCompras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddOrdenCompraDetalle(pCveOrdenCompra As Integer, pCantidad As Double, pCveUnidadMedida As Integer, pCvePS As Integer, pImporte As Double, pCveSubProyecto As Integer, pCveActivoFijo As Integer, - pObservacion As String, pCveUsuario As Integer, Optional pCveOrdenCompraPadre As Integer = -1, Optional CvePresupuestoEgreso As Integer = -1, Optional Descuento As Double = 0, - Optional IEPSPS As Double = 0, Optional IEPSPSIVA As Double = 0, Optional IVA As Double = 0, Optional RetIVA As Double = 0, Optional RetISR As Double = 0, Optional Total As Double = 0, - Optional CveContratoDetalle As Integer = -1, Optional IVAPorcentaje As Double = 0, Optional RetIVAPorcentaje As Double = 0, Optional RetISRPorcentaje As Double = 0, Optional IEPSPSPorcentaje As Double = 0, - Optional IEPSPSIVAPorcentaje As Double = 0, Optional CveVentaDetalleCotizacion As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_OrdenesCompraDetalleAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - .Add("@Cantidad", SqlDbType.Float).Value = pCantidad - .Add("@Descuento", SqlDbType.Float).Value = Descuento - .Add("@Importe", SqlDbType.Float).Value = pImporte - .Add("@CveUnidadMedida", SqlDbType.Int).Value = pCveUnidadMedida - .Add("@CvePS", SqlDbType.Int).Value = pCvePS - .Add("@Observacion", SqlDbType.VarChar).Value = pObservacion - .Add("@CveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto - .Add("@CveActivoFijo", SqlDbType.Int).Value = pCveActivoFijo - .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario - .Add("@CveOrdenCompraPadre", SqlDbType.Int).Value = pCveOrdenCompraPadre - .Add("@CvePresupuestoEgreso", SqlDbType.Int).Value = CvePresupuestoEgreso - .Add("@vCveOrdenCompraDetalle", SqlDbType.Int).Direction = ParameterDirection.Output - .Add("@IEPSPS", SqlDbType.Money).Value = IEPSPS - .Add("@IEPSPSIVA", SqlDbType.Money).Value = IEPSPSIVA - .Add("@IVA", SqlDbType.Float).Value = IVA - .Add("@RetIVA", SqlDbType.Float).Value = RetIVA - .Add("@RetISR", SqlDbType.Float).Value = RetISR - .Add("@Total", SqlDbType.Float).Value = Total - .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle - .Add("@IVAPorcentaje", SqlDbType.Float).Value = IVAPorcentaje - .Add("@RetIVAPorcentaje", SqlDbType.Float).Value = RetIVAPorcentaje - .Add("@RetISRPorcentaje", SqlDbType.Float).Value = RetISRPorcentaje - .Add("@IEPSPSPorcentaje", SqlDbType.Float).Value = IEPSPSPorcentaje + .Add("@CveEstatus", SqlDbType.Int).Value = pCveEstatus + .Add("@FechaEstimadaEntrega", SqlDbType.VarChar).Value = pFechaEstimadaEntrega + .Add("@LugarEntrega", SqlDbType.VarChar).Value = pLugarEntrega + .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = pCveEmpresa + .Add("@CveProveedor", SqlDbType.Int).Value = pCveProveedor + .Add("@CveProveedorSucursal", SqlDbType.Int).Value = pCveProveedorSucursal + .Add("@PorcentajeIVA", SqlDbType.SmallMoney).Value = PorcentajeIVA + .Add("@IVA", SqlDbType.Money).Value = IVA + .Add("@RetIVA", SqlDbType.Money).Value = RetIVA + .Add("@RetISR", SqlDbType.Money).Value = RetISR + .Add("@IEPS", SqlDbType.Money).Value = IEPS + .Add("@RequiereCotizacion", SqlDbType.Bit).Value = If(RequiereCotizacion = True, 1, 0) + .Add("@CvePresupuestoEgreso", SqlDbType.Int).Value = pCvePresupuestoEgreso + .Add("@CveUsuarioAsignado", SqlDbType.Int).Value = CveUsuarioAsignado + .Add("@IDCuentaPolizaAC", SqlDbType.Int).Value = IDPoliza + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@CveCotizacion", SqlDbType.Int).Value = CveCotizacion + + .Add("@PrioridadObservacion", SqlDbType.VarChar).Value = PrioridadObservacion + .Add("@FolioAdicional", SqlDbType.VarChar).Value = FolioAdicional + .Add("@EntregaDirecta", SqlDbType.Int).Value = EntregaDirecta + .Add("@CveDireccionEnvio", SqlDbType.Int).Value = CveDireccionEnvio + .Add("@Guia", SqlDbType.VarChar).Value = Guia + .Add("@CveIEAnticipo", SqlDbType.Int).Value = CveIEAnticipo + .Add("@ImporteAnticipo", SqlDbType.Money).Value = ImporteAnticipo + .Add("@UsoCFDI", SqlDbType.Int).Value = UsoCFDI + .Add("@Promocion", SqlDbType.VarChar).Value = Promocion + .Add("@CveProveedorContacto", SqlDbType.Int).Value = CveProveedorContacto + + .Add("@vCveOrdenCompra", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@vFolio", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + + _CveOrdenCompra = SqlAdapter.SelectCommand.Parameters("@vCveOrdenCompra").Value.ToString.ToEntero + _Folio = SqlAdapter.SelectCommand.Parameters("@vFolio").Value.ToString.ToEntero + + 'GetOC(_CveOrdenCompra, pCveEmpresa) + Retorno = True + Catch ex As SqlException + If ex.Number = 2627 Then + Alert("La Clave o Descripción del OrdenCompra ya existe.", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al guardar la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddOrdenCompraMovil(OC As WSOrdenCompra) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Tipo", SqlDbType.VarChar).Value = OC.Tipo + .Add("@CveSubProyecto", SqlDbType.Int).Value = OC.CveSubProyecto + .Add("@Descripcion", SqlDbType.VarChar).Value = OC.Descripcion + .Add("@Justificacion", SqlDbType.VarChar).Value = OC.Justificacion + .Add("@Prioridad", SqlDbType.Int).Value = OC.Prioridad + .Add("@Fecha", SqlDbType.DateTime).Value = OC.Fecha + .Add("@CveMoneda", SqlDbType.Int).Value = OC.CveMoneda + .Add("@CveEstatus", SqlDbType.Int).Value = OC.CveEstatus + .Add("@FechaEstimadaEntrega", SqlDbType.VarChar).Value = OC.FechaEstimadaEntrega + .Add("@LugarEntrega", SqlDbType.VarChar).Value = OC.LugarEntrega + .Add("@CveUsuario", SqlDbType.Int).Value = OC.CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = OC.CveEmpresa + .Add("@CveProveedor", SqlDbType.Int).Value = OC.CveProveedor + .Add("@CveProveedorSucursal", SqlDbType.Int).Value = OC.CveProveedorSucursal + .Add("@PorcentajeIVA", SqlDbType.SmallMoney).Value = OC.PorcentajeIVA + .Add("@IVA", SqlDbType.Money).Value = OC.IVA + .Add("@RetIVA", SqlDbType.Money).Value = OC.RetIVA + .Add("@RetISR", SqlDbType.Money).Value = OC.RetISR + .Add("@RequiereCotizacion", SqlDbType.Bit).Value = If(OC.RequiereCotizacion = True, 1, 0) + .Add("@CvePresupuestoEgreso", SqlDbType.Int).Value = OC.CvePresupuestoEgreso + .Add("@CveUsuarioAsignado", SqlDbType.Int).Value = OC.CveUsuarioAsignado + .Add("@IDCuentaPolizaAC", SqlDbType.Int).Value = OC.IDCuentaPolizaAC + .Add("@CveCliente", SqlDbType.Int).Value = OC.CveCliente + .Add("@CveVendedor", SqlDbType.Int).Value = OC.CveVendedor + .Add("@CveCotizacion", SqlDbType.Int).Value = OC.CveCotizacion + .Add("@PrioridadObservacion", SqlDbType.VarChar).Value = OC.PrioridadObservacion + .Add("@FolioAdicional", SqlDbType.VarChar).Value = OC.FolioAdicional + .Add("@EntregaDirecta", SqlDbType.Int).Value = OC.EntregaDirecta + .Add("@CveDireccionEnvio", SqlDbType.Int).Value = OC.CveDireccionEnvio + .Add("@Guia", SqlDbType.VarChar).Value = "-1" + + .Add("@vCveOrdenCompra", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@vFolio", SqlDbType.Int).Direction = ParameterDirection.Output + End With + + Try + SqlAdapter.Fill(Data) + + _CveOrdenCompra = SqlAdapter.SelectCommand.Parameters("@vCveOrdenCompra").Value.ToString.ToEntero + _Folio = SqlAdapter.SelectCommand.Parameters("@vFolio").Value.ToString.ToEntero + + 'GetOC(_CveOrdenCompra, pCveEmpresa) + Retorno = True + Catch ex As SqlException + If ex.Number = 2627 Then + Alert("La Clave o Descripción del OrdenCompra ya existe.", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al guardar la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateOrdenCompraPoliza(IDPoliza As Integer, pCveOrdenCompra As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraPolizaUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@IDPoliza", SqlDbType.Int).Value = IDPoliza + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la Poliza de la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateOrdenCompraDetalleAjuste(CveOrdenCompra As Integer, CveOrdenCompraDetalle As Integer, Diferencia As Double, CveUsuarioModifico As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_OrdenesCompraDetalleAjusteUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra + .Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = CveOrdenCompraDetalle + .Add("@Diferencia", SqlDbType.Float).Value = Diferencia + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la Orden de Compra Detalle.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + Public Function UpdateOrdenCompraMoneda(CveOrdenCompra As Integer, CveEmpresa As Integer, CveMoneda As Integer, CveUsuarioModifico As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_OrdenesCompraMonedaUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveMoneda", SqlDbType.Int).Value = CveMoneda + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar la Orden de Compra Detalle.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + Return Retorno + End Function + + Public Function UpdateOrdenCompra(pCveSubProyecto As Integer, ByVal pDescripcion As String, pJustificacion As String, Prioridad As Integer, pRequiereCotizacion As Boolean, pFechaEstimadaEntrega As String, pLugarEntrega As String, pCveMoneda As Integer, + pCveProveedor As Integer, pCveOrdenCompra As Integer, pCveUsuarioModifico As Integer, Optional CveCliente As Integer = -1, Optional CveVendedor As Integer = -1, Optional PrioridadObservacion As String = "", + Optional IVA As Decimal = 0, Optional RetIVA As Decimal = 0, Optional RetISR As Decimal = 0, Optional IDPoliza As Integer = -1, Optional FechaExpiracion As Date = Nothing, Optional FolioAdicional As String = "", + Optional EntregaDirecta As Integer = -1, Optional CveDireccionEnvio As Integer = -1, Optional Guia As String = "-1", Optional IEPS As Decimal = -1, Optional UsoCFDI As Integer = -1, Optional Promocion As String = "-1", + Optional pCveProveedorSucursal As Integer = -1, Optional CveProveedorContacto As Integer = -1, Optional PorcentajeIVA As Double = 0.16) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto + .Add("@Descripcion", SqlDbType.VarChar).Value = pDescripcion + .Add("@Justificacion", SqlDbType.VarChar).Value = pJustificacion + .Add("@Prioridad", SqlDbType.Int).Value = Prioridad + .Add("@RequiereCotizacion", SqlDbType.Bit).Value = If(pRequiereCotizacion, 1, 0) + .Add("@FechaEstimadaEntrega", SqlDbType.VarChar).Value = pFechaEstimadaEntrega + .Add("@LugarEntrega", SqlDbType.VarChar).Value = pLugarEntrega + .Add("@CveMoneda", SqlDbType.Int).Value = pCveMoneda + .Add("@CveProveedor", SqlDbType.Int).Value = pCveProveedor + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = pCveUsuarioModifico + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@PrioridadObservacion", SqlDbType.VarChar).Value = PrioridadObservacion + .Add("@IVA", SqlDbType.Money).Value = IVA + .Add("@RetIVA", SqlDbType.Money).Value = RetIVA + .Add("@RetISR", SqlDbType.Money).Value = RetISR + .Add("@IEPS", SqlDbType.Money).Value = IEPS + .Add("@IDCuentaPolizaAC", SqlDbType.Int).Value = IDPoliza + .Add("@FolioAdicional", SqlDbType.VarChar).Value = FolioAdicional + .Add("@EntregaDirecta", SqlDbType.Int).Value = EntregaDirecta + .Add("@CveDireccionEnvio", SqlDbType.Int).Value = CveDireccionEnvio + .Add("@Guia", SqlDbType.VarChar).Value = Guia + .Add("@UsoCFDI", SqlDbType.Int).Value = UsoCFDI + .Add("@Promocion", SqlDbType.VarChar).Value = Promocion + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + .Add("@CveProveedorSucursal", SqlDbType.Int).Value = pCveProveedorSucursal + .Add("@CveProveedorContacto", SqlDbType.Int).Value = CveProveedorContacto + .Add("@PorcentajeIVA", SqlDbType.SmallMoney).Value = PorcentajeIVA + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As SqlException + If ex.Number = 2627 Then + Alert("La Clave o Descripción del OrdenCompra ya existe.", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al actualizar la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al actualizar la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateOrdenCompraGuia(pGuia As String, pCveEmpresa As Integer, pCveOrdenCompra As Integer, pCveUsuarioModifico As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraUpdateGuia") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Guia", SqlDbType.VarChar).Value = pGuia + .Add("@CveEmpresa", SqlDbType.Int).Value = pCveEmpresa + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = pCveUsuarioModifico + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As SqlException + If ex.Number = 2627 Then + Alert("La Clave o Descripción del OrdenCompra ya existe.", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al guardar la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al editar la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateProveedorOrdenCompra(pCveProveedor As Integer, pCveOrdenCompra As Integer, pCveUsuarioModifico As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraProveedorUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveProveedor", SqlDbType.Int).Value = pCveProveedor + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = pCveUsuarioModifico + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + + Catch ex As Exception + OnError("Ocurrió un error al editar el proveedor en la orden de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateClienteVendedorOrdenCompra(pCveCliente As Integer, pCveVendedor As Integer, pCveOrdenCompra As Integer, pCveUsuarioModifico As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraClienteVendedorUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCliente", SqlDbType.Int).Value = pCveCliente + .Add("@CveVendedor", SqlDbType.Int).Value = pCveVendedor + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = pCveUsuarioModifico + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + + Catch ex As Exception + OnError("Ocurrió un error al editar el Cliente-Vendedor en la orden de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateOrdenCompraVinculacionCompra(CveCompra As Integer, CveOrdenCompra As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraUpdateCompra") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As SqlException + If ex.Number = 2627 Then + Alert("La Clave o Descripción del OrdenCompra ya existe.", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al guardar la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al editar la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function UpdateOrdenCompraRequiereCorizacion(CveOrdenCompra As Integer, RequiereCotizacion As Boolean) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraRequiereCorizacionUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@RequiereCotizacion", SqlDbType.Bit).Value = RequiereCotizacion + .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al editar la OrdenCompra, Requiere cotizacion.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetSucursalOC(CveOC As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_GetSucursalOC") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra + End With + + Try + SqlAdapter.Fill(Data) + If Data.Rows.Count > 0 Then + Dim dr As DataRow = Data.Rows(0) + SucCalle = dr("Calle").ToString + SucNoExt = dr("NoExt").ToString + SucNoInt = dr("NoInt").ToString + SucColonia = dr("Colonia").ToString + SucMunicipio = dr("Municipio").ToString + SucEstado = dr("Estado").ToString + SucPais = dr("Pais").ToString + SucCP = dr("CP").ToString + SucSubProyecto = dr("SubProyecto").ToString + SucTelefono = dr("Telefono").ToString + End If + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener la sucursal de la orden de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "O R D E N E S - D E - C O M P R A S - D E T A L L E" + Public Function GetPrueba() As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_PruebaGet") + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener una Prueba.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetOrdenesDetalle(pCveOrdenCompra As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraDetalleGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el detalle de OrdenCompras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddOrdenCompraDetalle(pCveOrdenCompra As Integer, pCantidad As Double, pCveUnidadMedida As Integer, pCvePS As Integer, pImporte As Double, pCveSubProyecto As Integer, pCveActivoFijo As Integer, + pObservacion As String, pCveUsuario As Integer, Optional pCveOrdenCompraPadre As Integer = -1, Optional CvePresupuestoEgreso As Integer = -1, Optional Descuento As Double = 0, + Optional IEPSPS As Double = 0, Optional IEPSPSIVA As Double = 0, Optional IVA As Double = 0, Optional RetIVA As Double = 0, Optional RetISR As Double = 0, Optional Total As Double = 0, + Optional CveContratoDetalle As Integer = -1, Optional IVAPorcentaje As Double = 0, Optional RetIVAPorcentaje As Double = 0, Optional RetISRPorcentaje As Double = 0, Optional IEPSPSPorcentaje As Double = 0, + Optional IEPSPSIVAPorcentaje As Double = 0, Optional CveVentaDetalleCotizacion As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_OrdenesCompraDetalleAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + .Add("@Cantidad", SqlDbType.Float).Value = pCantidad + .Add("@Descuento", SqlDbType.Float).Value = Descuento + .Add("@Importe", SqlDbType.Float).Value = pImporte + .Add("@CveUnidadMedida", SqlDbType.Int).Value = pCveUnidadMedida + .Add("@CvePS", SqlDbType.Int).Value = pCvePS + .Add("@Observacion", SqlDbType.VarChar).Value = pObservacion + .Add("@CveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto + .Add("@CveActivoFijo", SqlDbType.Int).Value = pCveActivoFijo + .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario + .Add("@CveOrdenCompraPadre", SqlDbType.Int).Value = pCveOrdenCompraPadre + .Add("@CvePresupuestoEgreso", SqlDbType.Int).Value = CvePresupuestoEgreso + .Add("@vCveOrdenCompraDetalle", SqlDbType.Int).Direction = ParameterDirection.Output + .Add("@IEPSPS", SqlDbType.Money).Value = IEPSPS + .Add("@IEPSPSIVA", SqlDbType.Money).Value = IEPSPSIVA + .Add("@IVA", SqlDbType.Float).Value = IVA + .Add("@RetIVA", SqlDbType.Float).Value = RetIVA + .Add("@RetISR", SqlDbType.Float).Value = RetISR + .Add("@Total", SqlDbType.Float).Value = Total + .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle + .Add("@IVAPorcentaje", SqlDbType.Float).Value = IVAPorcentaje + .Add("@RetIVAPorcentaje", SqlDbType.Float).Value = RetIVAPorcentaje + .Add("@RetISRPorcentaje", SqlDbType.Float).Value = RetISRPorcentaje + .Add("@IEPSPSPorcentaje", SqlDbType.Float).Value = IEPSPSPorcentaje .Add("@IEPSPSIVAPorcentaje", SqlDbType.Float).Value = IEPSPSIVAPorcentaje - .Add("@CveVentaDetalleCotizacion", SqlDbType.Int).Value = CveVentaDetalleCotizacion - End With - - Try - SqlAdapter.Fill(Data) - _CveOrdenCompraDetalle = SqlAdapter.SelectCommand.Parameters("@vCveOrdenCompraDetalle").Value.ToString.ToEntero - Retorno = True - Catch ex As Exception - - If ex.Message.Contains("CK_OC_OrdenesCompraDetalle_RetIVA_Total") Then - OnError("La retención de iva no coincide con su total", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - Else - OnError("Ocurrió un error al agregar el detalle de OrdenCompras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - - End Try - - Return Retorno - End Function - Public Function UpdateOrdenCompraDetalle(pCantidad As Double, pCveUnidadMedida As Integer, pCvePS As Integer, pImporte As Double, pCveSubProyecto As Integer, pCveActivoFijo As Integer, - pObservacion As String, pCveUsuario As Integer, pCveOrdenCompraDetalle As Integer, Optional CvePresupuestoEgreso As Integer = -1, Optional Descuento As Double = 0, - Optional IEPSPS As Double = 0, Optional IEPSPSIVA As Double = 0, Optional IVA As Double = 0, Optional RetIVA As Double = 0, Optional RetISR As Double = 0, Optional Total As Double = 0, - Optional CveContratoDetalle As Integer = -1, Optional IVAPorcentaje As Double = 0, Optional RetIVAPorcentaje As Double = 0, Optional RetISRPorcentaje As Double = 0, Optional IEPSPSPorcentaje As Double = 0, - Optional IEPSPSIVAPorcentaje As Double = 0) As Integer - Dim Retorno As Integer = -1 - - DataAdapter("PA_OC_OrdenesCompraDetalleUpdate") - - With SqlAdapter.SelectCommand.Parameters - '.Add("@pCveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - .Add("@Cantidad", SqlDbType.Float).Value = pCantidad - .Add("@CveUnidadMedida", SqlDbType.Int).Value = pCveUnidadMedida - .Add("@CvePS", SqlDbType.Int).Value = pCvePS - .Add("@Descuento", SqlDbType.Float).Value = Descuento - .Add("@Importe", SqlDbType.Float).Value = pImporte - .Add("@CveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto - .Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = pCveOrdenCompraDetalle - .Add("@CveActivoFijo", SqlDbType.Int).Value = pCveActivoFijo - .Add("@Observacion", SqlDbType.VarChar).Value = pObservacion - .Add("@CvePresupuestoEgreso", SqlDbType.Int).Value = CvePresupuestoEgreso - .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario - .Add("@IEPSPS", SqlDbType.Money).Value = IEPSPS - .Add("@IEPSPSIVA", SqlDbType.Money).Value = IEPSPSIVA - .Add("@IVA", SqlDbType.Float).Value = IVA - .Add("@RetIVA", SqlDbType.Float).Value = RetIVA - .Add("@RetISR", SqlDbType.Float).Value = RetISR - .Add("@Total", SqlDbType.Float).Value = Total - .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle - .Add("@IVAPorcentaje", SqlDbType.Float).Value = IVAPorcentaje - .Add("@RetIVAPorcentaje", SqlDbType.Float).Value = RetIVAPorcentaje - .Add("@RetISRPorcentaje", SqlDbType.Float).Value = RetISRPorcentaje - .Add("@IEPSPSPorcentaje", SqlDbType.Float).Value = IEPSPSPorcentaje - .Add("@IEPSPSIVAPorcentaje", SqlDbType.Float).Value = IEPSPSIVAPorcentaje - End With - - Try - SqlAdapter.Fill(Data) - Retorno = pCveOrdenCompraDetalle - Catch ex As SqlException - If ex.Number = 2627 Then - Alert("La Clave o Descripción del OrdenCompra ya existe.", TipoMensaje.MsgAdvertencia) - Else - OnError("Ocurrió un error al editar la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al editar la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function RemoveOrdenCompraDetalle(ByVal pCveOrdenCompraDetalle As Integer, CveUsuarioModifico As Integer) As Boolean - Dim OnError As Boolean = False - DataAdapter("PA_OC_OrdenesCompraDetalleRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = pCveOrdenCompraDetalle - .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico - End With - - Try - SqlAdapter.Fill(Data) - OnError = True - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar detalle de orden de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return OnError - End Function - Public Function OrdenesCompraDetalleCostoPP(CveOrdenCompraDetalle As Integer) As Boolean - Dim OnError As Boolean = False - DataAdapter("PA_OC_OrdenesCompraDetalleCostoPP") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOCDetalle", SqlDbType.Int).Value = CveOrdenCompraDetalle - End With - - Try - SqlAdapter.Fill(Data) - OnError = True - Catch ex As Exception - Me.OnError("Ocurrió un error al obtener el costo de la orden de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return OnError - End Function - -#End Region - -#Region " O R D E N E S - D E - C O M P R A - E S T A T U S" - Public Function GetEstatus() As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_EstatusGet") - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Estatus de Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddEstatus(Estatus As String, Tipo As String, CveEstatusSiguiente As Integer, TipoTermino As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_EstatusAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Estatus", SqlDbType.VarChar).Value = Estatus - .Add("@Tipo", SqlDbType.VarChar).Value = Tipo - .Add("@CveEstatusSiguiente", SqlDbType.Int).Value = CveEstatusSiguiente - .Add("@TipoTermino", SqlDbType.Int).Value = TipoTermino - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Estatus con el mismo nombre: " & Estatus & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar el Estatus de Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar el Estatus", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function UpdateEstatus(Estatus As String, Tipo As String, CveEstatusSiguiente As Integer, TipoTermino As Integer, EstatusActivo As Boolean, EsCancelable As Boolean, CveEstatus As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_EstatusUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Estatus", SqlDbType.VarChar).Value = Estatus - .Add("@Tipo", SqlDbType.VarChar).Value = Tipo - .Add("@CveEstatusSiguiente", SqlDbType.Int).Value = CveEstatusSiguiente - .Add("@TipoTermino", SqlDbType.Int).Value = TipoTermino - .Add("@EsCancelable", SqlDbType.Bit).Value = EsCancelable - .Add("@EstatusActivo", SqlDbType.Bit).Value = EstatusActivo - .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Estatus con el mismo nombre: " & Estatus & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en el Estatus", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Estatus de Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function RemoveEstatus(CveEstatus As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_EstatusRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus - - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("El Estatus no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar el Estatus de Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar el Estatus de Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - -#End Region - -#Region " O R D E N E S - D E - C O M P R A - E S T A T U S - U S U A R I O S" - Public Function GetEstatusUsuarios(CveUsuario As Integer, CveEstatus As Integer, CveSubProyecto As Integer, CveOrdenCompra As Integer, CveEmpresa As Integer, Optional CveEstatusUsuarios As Integer = -1, Optional Estatus As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_EstatusUsuariosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Estatus", SqlDbType.Int).Value = Estatus - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Estatus de Usuarios para Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddEstatusUsuarios(CveEstatus As Integer, CveSubProyecto As Integer, CveUsuario As Integer, Estatus As Boolean, Optional CveSuperior As Integer = -1, Optional LimiteSuperior As Decimal = -1, Optional LimiteInferior As Decimal = -1, Optional CveUsuarioModifico As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_EstatusUsuariosAdd") - 'SqlAdapter.SelectCommand.CommandTimeout = 180 - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveSuperior", SqlDbType.Int).Value = CveSuperior - .Add("@LimiteSuperior", SqlDbType.Money).Value = LimiteSuperior - .Add("@LimiteInferior", SqlDbType.Money).Value = LimiteInferior - .Add("@Estatus", SqlDbType.Bit).Value = Estatus.ToEntero - .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - 'SqlAdapter.SelectCommand.CommandTimeout = 30 - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Estatus con el mismo nombre: " & Estatus & ".", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar el Estatus de Usuario para Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar el Estatus de Usuario para Ordenes de Compra", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function UpdateEstatusUsuarios(CveEstatusUsuarios As Integer, CveSuperior As Integer, LimiteSuperior As Decimal, LimiteInferior As Decimal) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_EstatusUsuariosUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios - .Add("@CveSuperior", SqlDbType.Int).Value = CveSuperior - .Add("@LimiteSuperior", SqlDbType.Decimal).Value = LimiteSuperior - .Add("@LimiteInferior", SqlDbType.Decimal).Value = LimiteInferior - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Estatus con el mismo nombre. ", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en el Estatus", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Estatus de Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function RemoveEstatusUsuarios(CveEstatusUsuarios As Integer, Optional CveUsuarioModifico As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_EstatusUsuariosRemove") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios - .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico - - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("El Estatus no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar el Estatus de Usuario para Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar el Estatus de Usuario para Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - -#End Region - -#Region " O R D E N E S - D E - C O M P R A - E S T A T U S - U S U A R I O - T E M P" - 'Public Function CreateEstatusUsuarioTemporal() As Boolean - ' Dim Retorno As Boolean = False - ' DataAdapter("PA_OC_TempEstatusUsuarioCreate") - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch ex As Exception - ' OnError("Ocurrió un error al Crear la tabla temporal", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End Try - ' Return Retorno - 'End Function - 'Public Function DeleteEstatusUsuarioTemporal() As Boolean - ' Dim Retorno As Boolean = False - ' DataAdapter("PA_OC_TempEstatusUsuarioDelete") - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch ex As Exception - ' OnError("Ocurrió un error al eliminar la tabla temporal", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End Try - ' Return Retorno - 'End Function - Public Function GetEstatusUsuarioTemporal(CveUsuario As Integer, CveEstatus As Integer, CveSubProyecto As Integer, CveEmpresa As Integer, Optional CveEstatusUsuarios As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_TempEstatusUsuarioGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Estatus de Usuarios para Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - 'Public Function AddEstatusUsuarioTemporal(CveEstatus As Integer, CveSubProyecto As Integer, CveUsuario As Integer, Estatus As Boolean, Optional CveSuperior As Integer = -1, Optional LimiteSuperior As Decimal = -1, Optional LimiteInferior As Decimal = -1) As Boolean - ' Dim Retorno As Boolean = False - - ' DataAdapter("PA_OC_TempEstatusUsuarioAdd") - ' 'SqlAdapter.SelectCommand.CommandTimeout = 180 - ' With SqlAdapter.SelectCommand.Parameters - ' .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus - ' .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - ' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - ' .Add("@CveSuperior", SqlDbType.Int).Value = CveSuperior - ' .Add("@LimiteSuperior", SqlDbType.Money).Value = LimiteSuperior - ' .Add("@LimiteInferior", SqlDbType.Money).Value = LimiteInferior - ' .Add("@Estatus", SqlDbType.Bit).Value = Estatus.ToEntero - ' End With - - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' 'SqlAdapter.SelectCommand.CommandTimeout = 30 - ' Catch Ex1 As SqlException - ' If Ex1.Message.Contains("Número: 2627;") Then - ' Alert("Ya existe un Estatus con el mismo nombre: " & Estatus & ".", TipoMensaje.MsgAdvertencia) - ' Else - ' Me.OnError("Ocurrió un error al Guardar el Estatus de Usuario para Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End If - ' Catch ex As Exception - ' OnError("Ocurrió un error al Guardar el Estatus de Usuario para Ordenes de Compra", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - ' End Try - - ' Return Retorno - 'End Function - 'Public Function UpdateEstatusUsuarioTemporal(CveEstatusUsuarios As Integer, CveSuperior As Integer, LimiteSuperior As Decimal, LimiteInferior As Decimal) As Boolean - ' Dim Retorno As Boolean = False - - ' DataAdapter("PA_OC_TempEstatusUsuarioUpdate") - - ' With SqlAdapter.SelectCommand.Parameters - ' .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios - ' .Add("@CveSuperior", SqlDbType.Int).Value = CveSuperior - ' .Add("@LimiteSuperior", SqlDbType.Decimal).Value = LimiteSuperior - ' .Add("@LimiteInferior", SqlDbType.Decimal).Value = LimiteInferior - ' End With - - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch Ex1 As SqlException - ' If Ex1.Message.Contains("Número: 2627;") Then - ' Alert("Ya existe un Estatus con el mismo nombre. ", TipoMensaje.MsgAdvertencia) - ' Else - ' Me.OnError("Ocurrió un error al guardar los cambios en el Estatus", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End If - ' Catch ex As Exception - ' OnError("Ocurrió un error al guardar los cambios en el Estatus de Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - ' End Try - - ' Return Retorno - 'End Function - 'Public Function RemoveEstatusUsuarioTemporal(CveEstatusUsuarios As Integer) As Boolean - ' Dim Retorno As Boolean = False - - ' DataAdapter("PA_OC_TempEstatusUsuarioRemove") - - ' SqlAdapter.SelectCommand.Parameters.Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios - - - ' Try - ' SqlAdapter.Fill(Data) - ' Retorno = True - ' Catch Ex1 As SqlException - ' If Ex1.Message.Contains("Número: 547;") Then - ' Alert("El Estatus no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - ' Else - ' Me.OnError("Ocurrió un error al eliminar el Estatus de Usuario para Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End If - ' Catch ex As Exception - ' Me.OnError("Ocurrió un error al eliminar el Estatus de Usuario para Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - ' End Try - - ' Return Retorno - 'End Function -#End Region - - Public Function GetOrdenesCompraRep(Tipo As String, CveProyecto As Integer, CveSubProyecto As Integer, CveClasificacion As Integer, CveEstatus As Integer, - FechaInicio As Date, FechaFin As Date, CveOrdenCompra As Integer, CveProveedor As Integer, Folio As Integer, CveUsuarioRegistro As Integer, CveUsuario As Integer, CveEmpresa As Integer, CvePS As Integer, Optional PendientePorSurtir As Boolean = False, Optional CveCliente As Integer = -1, Optional Guia As String = "-1", Optional CveActivoFijo As Integer = -1, - Optional SoloSubProyectosConPermiso As Boolean = False) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraRep") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Tipo", SqlDbType.VarChar).Value = Tipo - .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra - .Add("@CveUsuarioRegistro", SqlDbType.Int).Value = CveUsuarioRegistro - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@Folio", SqlDbType.Int).Value = Folio - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion - .Add("@CvePS", SqlDbType.Int).Value = CvePS - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@PendientePorSurtir", SqlDbType.Bit).Value = PendientePorSurtir - .Add("@Guia", SqlDbType.VarChar).Value = Guia - .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo - .Add("@SoloSubProyectosConPermiso", SqlDbType.Bit).Value = SoloSubProyectosConPermiso - - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetOrdenesCompraRepReqXOC(Folio As Integer, FechaInicio As String, FechaFin As String, CveProveedor As Integer, CveVendedor As Integer, CveCliente As Integer, CveEmpresa As Integer, Grupo As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraReqXOC") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Folio", SqlDbType.Int).Value = Folio - .Add("@FechaInicio", SqlDbType.VarChar).Value = FechaInicio - .Add("@FechaFin", SqlDbType.VarChar).Value = FechaFin - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@Grupo", SqlDbType.Int).Value = Grupo - - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el reporte de requisiciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetOrdenesCompraCorreo(CveCompra As Integer, Optional CveMovimiento As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraCorreosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los correos de Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetComprasOC(CveCompra As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraFoliosGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los correos de Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetOrdenesCompraMovimiento(CveCompra As Integer, Optional CveMovimiento As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraPSGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveCompra", SqlDbType.Int).Value = CveCompra - .Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los movimientos de Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetOrdenesPendientes(pTipo As String, pTipoBusqueda As Integer, pCveEmpresa As Integer, pCveProyecto As Integer, pCveSubProyecto As Integer, pCveEstatusCompra As Integer, - pCveUsuario As Integer, CveCliente As Integer, Optional SoloSubProyectosConPermiso As Boolean = False) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraPendientes") - - With SqlAdapter.SelectCommand.Parameters - .Add("@Tipo", SqlDbType.VarChar).Value = pTipo - .Add("@CveEmpresa", SqlDbType.Int).Value = pCveEmpresa - .Add("@CveProyecto", SqlDbType.Int).Value = pCveProyecto - .Add("@CveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto - .Add("@CveEstatus", SqlDbType.Int).Value = pCveEstatusCompra - .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@TipoBusqueda", SqlDbType.Int).Value = pTipoBusqueda - .Add("@SoloSubProyectosConPermiso", SqlDbType.Bit).Value = SoloSubProyectosConPermiso - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetCompras(ByVal pCveEmpresa As Integer, ByVal pCveProyecto As Integer, pCveSubProyecto As Integer, pCveClasificacion As Integer, pCveEstatusCompras As String, - pFechaInicio As Date, pFechaFin As Date, pCveOrdenCompra As Integer, pCveUsuario As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraRepCompras") - - With SqlAdapter.SelectCommand.Parameters - .Add("@pCveEmpresa", SqlDbType.Int).Value = pCveEmpresa - .Add("@pCveProyecto", SqlDbType.Int).Value = pCveProyecto - .Add("@pCveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto - .Add("@pCveClasificacion", SqlDbType.Int).Value = pCveClasificacion - .Add("@pCveEstatusCompra", SqlDbType.Int).Value = pCveEstatusCompras - .Add("@pFechaInicio", SqlDbType.Date).Value = pFechaInicio - .Add("@pFechaFin", SqlDbType.Date).Value = pFechaFin - .Add("@pCveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - .Add("@pCveUsuario", SqlDbType.Int).Value = pCveUsuario - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function UpdateOrdenCompraEstatus(pCveEstatus As Integer, pCveOrdenCompra As Integer, pCveUsuario As Integer, pMotivo As String, Optional pCveCompra As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraEstatusUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEstatus", SqlDbType.Int).Value = pCveEstatus - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario - .Add("@Motivo", SqlDbType.VarChar, 500).Value = pMotivo - .Add("@CveCompra", SqlDbType.Int).Value = pCveCompra - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al cambiar el estatus de la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function UpdateOrdenCompraCompletada(pCveEstatus As Integer, pCveOrdenCompra As Integer, pCveUsuario As Integer, pMotivo As String, Optional pCveCompra As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraCompletadas") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEstatus", SqlDbType.Int).Value = pCveEstatus - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario - .Add("@Motivo", SqlDbType.VarChar, 500).Value = pMotivo - .Add("@CveCompra", SqlDbType.Int).Value = pCveCompra - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al cambiar el estatus de la OrdenCompra Completada.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function UpdateOrdenCompraDetalleProveedor(pCveOrdenCompraDetalle As Integer, pCveProveedor As Integer, pCveCotizacion As Integer) As Integer - Dim Retorno As Integer = -1 - - DataAdapter("BEGIN UPDATE OC_OrdenesCompraDetalle SET CveProveedor = @pCveProveedor WHERE CveOrdenCompraDetalle = @pCveOrdenCompraDetalle; UPDATE OC_CotizacionesDetalle SET Ganador = 1 WHERE CveCotizacion = @pCveCotizacion AND CveOrdenCompraDetalle = @pCveOrdenCompraDetalle; END", CommandType.Text) - - With SqlAdapter.SelectCommand.Parameters - - .Add("@pCveOrdenCompraDetalle", SqlDbType.Int).Value = pCveOrdenCompraDetalle - .Add("@pCveProveedor", SqlDbType.Int).Value = pCveProveedor - .Add("@pCveCotizacion", SqlDbType.Int).Value = pCveCotizacion - - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = pCveOrdenCompraDetalle - Catch ex As Exception - OnError("Ocurrió un error al actualizar el proveedor a la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetOrdenesHistorial(pCveOrdenCompra As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraHistorialGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el historial de OrdenCompras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetOrdenesEstatus(pCveOrdenCompra As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraEstatusGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el estatus de OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetOrdenesEstatusHistorial(pCveOrdenCompra As Integer) As DataTable - - DataAdapter("PA_OC_OrdenesCompraEstatusHistorialGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - End With - - Try - SqlAdapter.Fill(Data) - - Catch ex As Exception - OnError("Ocurrió un error al obtener los estatus de OrdenesCompras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Data - End Function - - Public Function GetOCIncompletaDetalle(CveEmpresa As Integer, Optional CveOrdenCompra As Integer = -1, Optional CveProveedor As Integer = -1) As Boolean - Dim retorno As Boolean = False - StrSQL.Clear() - StrSQL.Append("SELECT OCD.CveOrdenCompra, OCD.Cantidad CantidadOrden, CD.Cantidad CantidadCompra, OCD.Cantidad - CD.Cantidad CantidadPendiente, OC.Folio, ") - StrSQL.Append("OC.Fecha, P.RazonSocial, E.Estatus, PS.PS, OC.CveProveedor ") - StrSQL.Append("FROM OC_OrdenesCompraDetalle OCD ") - StrSQL.Append("INNER JOIN Comp_ComprasDetalles CD ON OCD.CveOrdenCompraDetalle = CD.CveCompraDetalle ") - StrSQL.Append("INNER JOIN OC_OrdenesCompra OC ON OCD.CveOrdenCompra = OC.CveOrdenCompra ") - StrSQL.Append("INNER JOIN Comp_Proveedores P ON OC.CveProveedor = P.CveProveedor ") - StrSQL.Append("INNER JOIN ProductosServicios PS ON OCD.CvePS = PS.CvePS ") - StrSQL.Append("INNER JOIN OC_Estatus E ON OC.CveEstatus = E.CveEstatus ") - StrSQL.Append("WHERE OCD.CveOrdenCompraDetalle = CD.CveCompraDetalle AND OCD.Cantidad != CD.Cantidad ") - StrSQL.Append("AND (@CveOrdenCompra = -1 OR @CveOrdenCompra = OCD.CveOrdenCompra) ") - StrSQL.Append("AND (@CveEmpresa = -1 OR @CveEmpresa = OC.CveEmpresa) ") - StrSQL.Append("AND (@CveProveedor = -1 OR @CveProveedor = OC.CveProveedor) ") - StrSQL.Append("ORDER BY OC.Folio ") - - DataAdapter(StrSQL.ToString, CommandType.Text) - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - - End With - - - Try - SqlAdapter.Fill(Data) - retorno = True - Catch ex As Exception - OnError("Ocurrió un error al consultar Ordenes de Compra", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return retorno - - - - End Function - -#Region " OC FACTURA " - Public Function GetOCSinFactura(CveSubProyecto As Integer, CveVendedor As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_PendientesFacturar") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Ordenes de Compra Sin Factura.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetOCFacturacion(pCveOrdenCompra As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno = False - - DataAdapter("PA_OC_OrdenesCompraFacturacionGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los detalles de la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region " OC POR SEMANA " - Public Function RepOCCount(FechaInicio As Date, FechaFin As Date, CveUsuario As Integer, Cveempresa As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OrdenesCompraRepCount") - - With SqlAdapter.SelectCommand.Parameters - .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio - .Add("@FechaFin", SqlDbType.Date).Value = FechaFin - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEmpresa", SqlDbType.Int).Value = Cveempresa - End With - - Try - SqlAdapter.Fill(Data) - - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region " OC CLASIFICACIONES " - - Public Function GetEstatusUsuariosClasificaciones(CveEstatusUsuarios As Integer, CveUsuario As Integer, CveSubProyecto As Integer, CveClasificacion As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_EstatusUsuariosClasificacionesGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Estatus de Usuarios Clasificaciones para Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function AddEstatusUsuariosClasificaciones(CveEstatusUsuarios As Integer, CveClasificacion As Integer, CveSuperior As Integer, LimiteInferior As Decimal, LimiteSuperior As Decimal, CveUsuarioModifico As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_EstatusUsuariosClasificacionesAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios - .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion - .Add("@CveSuperior", SqlDbType.Int).Value = CveSuperior - .Add("@LimiteSuperior", SqlDbType.Money).Value = LimiteSuperior - .Add("@LimiteInferior", SqlDbType.Money).Value = LimiteInferior - .Add("@CveUsuarioModifico", SqlDbType.Bit).Value = CveUsuarioModifico - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Estatus con los mismos valores", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al Guardar el Estatus de Usuario Clasificaciones para Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al Guardar el Estatus de Usuario Clasificaciones para Ordenes de Compra", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function UpdateEstatusUsuariosClasificaciones(CveEstatusUsuariosClasificacion As Integer, CveClasificacion As Integer, CveSuperior As Integer, LimiteInferior As Decimal, LimiteSuperior As Decimal, CveUsuarioModifico As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_EstatusUsuariosClasificacionesUpdate") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEstatusUsuariosClasificacion", SqlDbType.Int).Value = CveEstatusUsuariosClasificacion - .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion - .Add("@CveSuperior", SqlDbType.Int).Value = CveSuperior - .Add("@LimiteSuperior", SqlDbType.Money).Value = LimiteSuperior - .Add("@LimiteInferior", SqlDbType.Money).Value = LimiteInferior - .Add("@CveUsuarioModifico", SqlDbType.Bit).Value = CveUsuarioModifico - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 2627;") Then - Alert("Ya existe un Estatus con los mismos valores. ", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al guardar los cambios en el Estatus de Usuario Clasificaciones para Ordenes de Compra", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - OnError("Ocurrió un error al guardar los cambios en el Estatus de Usuario Clasificaciones para Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) - End Try - - Return Retorno - End Function - Public Function RemoveEstatusUsuariosClasificaciones(CveEstatusUsuariosClasificacion As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_EstatusUsuariosClasificacionesRemove") - - SqlAdapter.SelectCommand.Parameters.Add("@CveEstatusUsuariosClasificacion", SqlDbType.Int).Value = CveEstatusUsuariosClasificacion - - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch Ex1 As SqlException - If Ex1.Message.Contains("Número: 547;") Then - Alert("El Estatus no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) - Else - Me.OnError("Ocurrió un error al eliminar el Estatus de Usuario Clasificaciones para Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End If - Catch ex As Exception - Me.OnError("Ocurrió un error al eliminar el Estatus de Usuario Clasificaciones para Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - -#End Region - -#Region " OC X VINCULAR COMPRA " - Public Function GetPendietePorSurtirOC(FechaI As String, FechaF As String, CveProveedor As Integer, Folio As Integer, CveSubProyecto As Integer, CveCliente As Integer, CveEmpresa As Integer, Optional CveOC As Integer = -1) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_ComprasPendientesPorSurtirGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@Folio", SqlDbType.Int).Value = Folio - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@FechaI", SqlDbType.VarChar).Value = FechaI - .Add("@FechaF", SqlDbType.VarChar).Value = FechaF - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveOC", SqlDbType.Int).Value = CveOC - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener Ordenes de compra pendientes por surtir.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetOCVinculadasPendientes(CveOCDetalle As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_OCVinculadas") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOCDetalle", SqlDbType.Int).Value = CveOCDetalle - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener Ordenes de compra pendientes por surtir.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "P y M E" - - Public Function AddEstatusRequisicionesPredefinidas(CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_EstatusPredefinidosPyMEAdd") - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - - Catch ex As Exception - OnError("Ocurrió un error al agregar los estatus de las requisiciones predefinidas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetEstatusUsuariosPyME(CveUsuario As Integer, CveEstatus As Integer, CveSubProyecto As Integer, CveOrdenCompra As Integer, CveEmpresa As Integer, Optional CveEstatusUsuarios As Integer = -1) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_EstatusUsuariosPyMEGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios - .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario - .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el Catálogo de Estatus de Usuarios para Ordenes de Compra en PyME.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - -#End Region - -#Region " SOLICITUD DE ANTICIPO " - Public Function GetSolicitudAnticipo(CveOC As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_SolicitudAnticipoGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOC", SqlDbType.Int).Value = CveOC - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener la solicitud de anticipo de la OC.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function GetSolicitudAnticipoUsuarios(CveOC As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_SolicitudAnticipoUsuarioGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOC", SqlDbType.Int).Value = CveOC - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener la solicitud de anticipo de la OC.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddSolicitudAnticipo(CveOrdenCompra As Integer, Importe As Double, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_SolicitudAnticipoAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra - .Add("@Importe", SqlDbType.Money).Value = Importe - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el estatus de solicitud anticipo de la OC.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - Public Function AddSolicitudAnticipoPago(CveOrdenCompra As Integer, CveIE As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_SolicitudAnticipoAddPago") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra - .Add("@CveIE", SqlDbType.Int).Value = CveIE - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al actualizar el estatus de solicitud anticipo de la OC.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - -#End Region - - Public Function GetUltimoCostoPS(CvePS As Integer) As Boolean - Dim Retorno As Boolean = False - - DataAdapter("PA_OC_UltimoCostoPS") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CvePS", SqlDbType.Int).Value = CvePS - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el último costo del producto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - - Public Function GetRepOCGuias(FechaI As String, FechaF As String, CveProveedor As Integer, CveVendedor As Integer, CveCliente As Integer, CveSubProyecto As Integer, CveEmpresa As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_RepOCGuiasGet") - - With SqlAdapter.SelectCommand.Parameters - - .Add("@FechaI", SqlDbType.VarChar).Value = FechaI - .Add("@FechaF", SqlDbType.VarChar).Value = FechaF - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor - .Add("@CveCliente", SqlDbType.Int).Value = CveCliente - .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener el reporte de Ordenes de compra guias.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function - -#Region " OC DETALLE - SALDOS [ SURTIDO INV | VINCULADO COMP ]" - Public Function OrdenesCompraDetalleSaldosInvCompraAdd(CveOCDetalle As Integer, CveInvDetalle As Integer, CantidadSurtida As Double, CveCompraDetalle As Integer, CantidadVinculada As Double) As Boolean - Dim Retorno As Boolean = False - DataAdapter("OC_OrdenesCompraDetalleSaldosInvCompraAdd") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveOCDetalle", SqlDbType.Int).Value = CveOCDetalle - .Add("@CveInvDetalle", SqlDbType.Int).Value = CveInvDetalle - .Add("@CantidadSurtida", SqlDbType.Float).Value = CantidadSurtida - .Add("@CveCompraDetalle", SqlDbType.Int).Value = CveCompraDetalle - .Add("@CantidadVinculada", SqlDbType.Float).Value = CantidadVinculada - - End With - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al agregar los saldos de (Inv/Compra) de la OC.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - -#Region "REP OC CON ANTICIPOS PENDIENTES" - Public Function GetOCAnticiposPendientes(CveEmpresa As Integer, CveUsuarioPara As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_OC_AnticiposPendientesGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveUsuarioPara", SqlDbType.Int).Value = CveUsuarioPara - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@FechaI", SqlDbType.DateTime).Value = FechaI - .Add("@FechaF", SqlDbType.DateTime).Value = FechaF - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los anticipos pendientes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region -#Region "REP SOLICITUDES ANTICIPO" - Public Function GetRepSolicitudAnticipos(CveEmpresa As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date, CveEventoEstatus As Integer) As Boolean - Dim Retorno As Boolean = False - DataAdapter("PA_RepSolicitudAnticipoGet") - - With SqlAdapter.SelectCommand.Parameters - .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa - .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor - .Add("@FechaI", SqlDbType.DateTime).Value = FechaI - .Add("@FechaF", SqlDbType.DateTime).Value = FechaF - .Add("@CveEventoEstatus", SqlDbType.Int).Value = CveEventoEstatus - End With - - Try - SqlAdapter.Fill(Data) - Retorno = True - Catch ex As Exception - OnError("Ocurrió un error al obtener los anticipos pendientes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) - End Try - - Return Retorno - End Function -#End Region - - - -#Region " IDisposable Support " - ' IDisposable - Protected Overridable Sub Dispose(ByVal disposing As Boolean) - If Not disposedValue Then - If disposing Then - SqlConexion.Close() - SqlConexion.Dispose() - If Not Data Is Nothing Then Data.Dispose() - If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() - - End If - End If - disposedValue = True - End Sub - Public Sub Dispose() Implements IDisposable.Dispose - ConexionClose() - Dispose(True) - GC.SuppressFinalize(Me) - End Sub -#End Region -End Class + .Add("@CveVentaDetalleCotizacion", SqlDbType.Int).Value = CveVentaDetalleCotizacion + End With + + Try + SqlAdapter.Fill(Data) + _CveOrdenCompraDetalle = SqlAdapter.SelectCommand.Parameters("@vCveOrdenCompraDetalle").Value.ToString.ToEntero + Retorno = True + Catch ex As Exception + + If ex.Message.Contains("CK_OC_OrdenesCompraDetalle_RetIVA_Total") Then + OnError("La retención de iva no coincide con su total", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + Else + OnError("Ocurrió un error al agregar el detalle de OrdenCompras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + + End Try + + Return Retorno + End Function + Public Function UpdateOrdenCompraDetalle(pCantidad As Double, pCveUnidadMedida As Integer, pCvePS As Integer, pImporte As Double, pCveSubProyecto As Integer, pCveActivoFijo As Integer, + pObservacion As String, pCveUsuario As Integer, pCveOrdenCompraDetalle As Integer, Optional CvePresupuestoEgreso As Integer = -1, Optional Descuento As Double = 0, + Optional IEPSPS As Double = 0, Optional IEPSPSIVA As Double = 0, Optional IVA As Double = 0, Optional RetIVA As Double = 0, Optional RetISR As Double = 0, Optional Total As Double = 0, + Optional CveContratoDetalle As Integer = -1, Optional IVAPorcentaje As Double = 0, Optional RetIVAPorcentaje As Double = 0, Optional RetISRPorcentaje As Double = 0, Optional IEPSPSPorcentaje As Double = 0, + Optional IEPSPSIVAPorcentaje As Double = 0) As Integer + Dim Retorno As Integer = -1 + + DataAdapter("PA_OC_OrdenesCompraDetalleUpdate") + + With SqlAdapter.SelectCommand.Parameters + '.Add("@pCveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + .Add("@Cantidad", SqlDbType.Float).Value = pCantidad + .Add("@CveUnidadMedida", SqlDbType.Int).Value = pCveUnidadMedida + .Add("@CvePS", SqlDbType.Int).Value = pCvePS + .Add("@Descuento", SqlDbType.Float).Value = Descuento + .Add("@Importe", SqlDbType.Float).Value = pImporte + .Add("@CveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto + .Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = pCveOrdenCompraDetalle + .Add("@CveActivoFijo", SqlDbType.Int).Value = pCveActivoFijo + .Add("@Observacion", SqlDbType.VarChar).Value = pObservacion + .Add("@CvePresupuestoEgreso", SqlDbType.Int).Value = CvePresupuestoEgreso + .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario + .Add("@IEPSPS", SqlDbType.Money).Value = IEPSPS + .Add("@IEPSPSIVA", SqlDbType.Money).Value = IEPSPSIVA + .Add("@IVA", SqlDbType.Float).Value = IVA + .Add("@RetIVA", SqlDbType.Float).Value = RetIVA + .Add("@RetISR", SqlDbType.Float).Value = RetISR + .Add("@Total", SqlDbType.Float).Value = Total + .Add("@CveContratoDetalle", SqlDbType.Int).Value = CveContratoDetalle + .Add("@IVAPorcentaje", SqlDbType.Float).Value = IVAPorcentaje + .Add("@RetIVAPorcentaje", SqlDbType.Float).Value = RetIVAPorcentaje + .Add("@RetISRPorcentaje", SqlDbType.Float).Value = RetISRPorcentaje + .Add("@IEPSPSPorcentaje", SqlDbType.Float).Value = IEPSPSPorcentaje + .Add("@IEPSPSIVAPorcentaje", SqlDbType.Float).Value = IEPSPSIVAPorcentaje + End With + + Try + SqlAdapter.Fill(Data) + Retorno = pCveOrdenCompraDetalle + Catch ex As SqlException + If ex.Number = 2627 Then + Alert("La Clave o Descripción del OrdenCompra ya existe.", TipoMensaje.MsgAdvertencia) + Else + OnError("Ocurrió un error al editar la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al editar la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function RemoveOrdenCompraDetalle(ByVal pCveOrdenCompraDetalle As Integer, CveUsuarioModifico As Integer) As Boolean + Dim OnError As Boolean = False + DataAdapter("PA_OC_OrdenesCompraDetalleRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompraDetalle", SqlDbType.Int).Value = pCveOrdenCompraDetalle + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico + End With + + Try + SqlAdapter.Fill(Data) + OnError = True + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar detalle de orden de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return OnError + End Function + Public Function OrdenesCompraDetalleCostoPP(CveOrdenCompraDetalle As Integer) As Boolean + Dim OnError As Boolean = False + DataAdapter("PA_OC_OrdenesCompraDetalleCostoPP") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOCDetalle", SqlDbType.Int).Value = CveOrdenCompraDetalle + End With + + Try + SqlAdapter.Fill(Data) + OnError = True + Catch ex As Exception + Me.OnError("Ocurrió un error al obtener el costo de la orden de compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return OnError + End Function + +#End Region + +#Region " O R D E N E S - D E - C O M P R A - E S T A T U S" + Public Function GetEstatus() As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_EstatusGet") + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Estatus de Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddEstatus(Estatus As String, Tipo As String, CveEstatusSiguiente As Integer, TipoTermino As Integer, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_EstatusAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Estatus", SqlDbType.VarChar).Value = Estatus + .Add("@Tipo", SqlDbType.VarChar).Value = Tipo + .Add("@CveEstatusSiguiente", SqlDbType.Int).Value = CveEstatusSiguiente + .Add("@TipoTermino", SqlDbType.Int).Value = TipoTermino + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Estatus con el mismo nombre: " & Estatus & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar el Estatus de Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar el Estatus", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdateEstatus(Estatus As String, Tipo As String, CveEstatusSiguiente As Integer, TipoTermino As Integer, EstatusActivo As Boolean, EsCancelable As Boolean, CveEstatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_EstatusUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Estatus", SqlDbType.VarChar).Value = Estatus + .Add("@Tipo", SqlDbType.VarChar).Value = Tipo + .Add("@CveEstatusSiguiente", SqlDbType.Int).Value = CveEstatusSiguiente + .Add("@TipoTermino", SqlDbType.Int).Value = TipoTermino + .Add("@EsCancelable", SqlDbType.Bit).Value = EsCancelable + .Add("@EstatusActivo", SqlDbType.Bit).Value = EstatusActivo + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Estatus con el mismo nombre: " & Estatus & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en el Estatus", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Estatus de Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function RemoveEstatus(CveEstatus As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_EstatusRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El Estatus no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el Estatus de Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el Estatus de Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + +#Region " O R D E N E S - D E - C O M P R A - E S T A T U S - U S U A R I O S" + Public Function GetEstatusUsuarios(CveUsuario As Integer, CveEstatus As Integer, CveSubProyecto As Integer, CveOrdenCompra As Integer, CveEmpresa As Integer, Optional CveEstatusUsuarios As Integer = -1, Optional Estatus As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_EstatusUsuariosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Estatus", SqlDbType.Int).Value = Estatus + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Estatus de Usuarios para Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddEstatusUsuarios(CveEstatus As Integer, CveSubProyecto As Integer, CveUsuario As Integer, Estatus As Boolean, Optional CveSuperior As Integer = -1, Optional LimiteSuperior As Decimal = -1, Optional LimiteInferior As Decimal = -1, Optional CveUsuarioModifico As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_EstatusUsuariosAdd") + 'SqlAdapter.SelectCommand.CommandTimeout = 180 + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveSuperior", SqlDbType.Int).Value = CveSuperior + .Add("@LimiteSuperior", SqlDbType.Money).Value = LimiteSuperior + .Add("@LimiteInferior", SqlDbType.Money).Value = LimiteInferior + .Add("@Estatus", SqlDbType.Bit).Value = Estatus.ToEntero + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + 'SqlAdapter.SelectCommand.CommandTimeout = 30 + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Estatus con el mismo nombre: " & Estatus & ".", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar el Estatus de Usuario para Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar el Estatus de Usuario para Ordenes de Compra", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdateEstatusUsuarios(CveEstatusUsuarios As Integer, CveSuperior As Integer, LimiteSuperior As Decimal, LimiteInferior As Decimal) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_EstatusUsuariosUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios + .Add("@CveSuperior", SqlDbType.Int).Value = CveSuperior + .Add("@LimiteSuperior", SqlDbType.Decimal).Value = LimiteSuperior + .Add("@LimiteInferior", SqlDbType.Decimal).Value = LimiteInferior + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Estatus con el mismo nombre. ", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en el Estatus", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Estatus de Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function RemoveEstatusUsuarios(CveEstatusUsuarios As Integer, Optional CveUsuarioModifico As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_EstatusUsuariosRemove") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios + .Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico + + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El Estatus no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el Estatus de Usuario para Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el Estatus de Usuario para Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + +#Region " O R D E N E S - D E - C O M P R A - E S T A T U S - U S U A R I O - T E M P" + 'Public Function CreateEstatusUsuarioTemporal() As Boolean + ' Dim Retorno As Boolean = False + ' DataAdapter("PA_OC_TempEstatusUsuarioCreate") + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al Crear la tabla temporal", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + ' Return Retorno + 'End Function + 'Public Function DeleteEstatusUsuarioTemporal() As Boolean + ' Dim Retorno As Boolean = False + ' DataAdapter("PA_OC_TempEstatusUsuarioDelete") + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch ex As Exception + ' OnError("Ocurrió un error al eliminar la tabla temporal", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + ' Return Retorno + 'End Function + Public Function GetEstatusUsuarioTemporal(CveUsuario As Integer, CveEstatus As Integer, CveSubProyecto As Integer, CveEmpresa As Integer, Optional CveEstatusUsuarios As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_TempEstatusUsuarioGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Estatus de Usuarios para Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + 'Public Function AddEstatusUsuarioTemporal(CveEstatus As Integer, CveSubProyecto As Integer, CveUsuario As Integer, Estatus As Boolean, Optional CveSuperior As Integer = -1, Optional LimiteSuperior As Decimal = -1, Optional LimiteInferior As Decimal = -1) As Boolean + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_OC_TempEstatusUsuarioAdd") + ' 'SqlAdapter.SelectCommand.CommandTimeout = 180 + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + ' .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + ' .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + ' .Add("@CveSuperior", SqlDbType.Int).Value = CveSuperior + ' .Add("@LimiteSuperior", SqlDbType.Money).Value = LimiteSuperior + ' .Add("@LimiteInferior", SqlDbType.Money).Value = LimiteInferior + ' .Add("@Estatus", SqlDbType.Bit).Value = Estatus.ToEntero + ' End With + + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' 'SqlAdapter.SelectCommand.CommandTimeout = 30 + ' Catch Ex1 As SqlException + ' If Ex1.Message.Contains("Número: 2627;") Then + ' Alert("Ya existe un Estatus con el mismo nombre: " & Estatus & ".", TipoMensaje.MsgAdvertencia) + ' Else + ' Me.OnError("Ocurrió un error al Guardar el Estatus de Usuario para Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End If + ' Catch ex As Exception + ' OnError("Ocurrió un error al Guardar el Estatus de Usuario para Ordenes de Compra", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try + + ' Return Retorno + 'End Function + 'Public Function UpdateEstatusUsuarioTemporal(CveEstatusUsuarios As Integer, CveSuperior As Integer, LimiteSuperior As Decimal, LimiteInferior As Decimal) As Boolean + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_OC_TempEstatusUsuarioUpdate") + + ' With SqlAdapter.SelectCommand.Parameters + ' .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios + ' .Add("@CveSuperior", SqlDbType.Int).Value = CveSuperior + ' .Add("@LimiteSuperior", SqlDbType.Decimal).Value = LimiteSuperior + ' .Add("@LimiteInferior", SqlDbType.Decimal).Value = LimiteInferior + ' End With + + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch Ex1 As SqlException + ' If Ex1.Message.Contains("Número: 2627;") Then + ' Alert("Ya existe un Estatus con el mismo nombre. ", TipoMensaje.MsgAdvertencia) + ' Else + ' Me.OnError("Ocurrió un error al guardar los cambios en el Estatus", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End If + ' Catch ex As Exception + ' OnError("Ocurrió un error al guardar los cambios en el Estatus de Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + ' End Try + + ' Return Retorno + 'End Function + 'Public Function RemoveEstatusUsuarioTemporal(CveEstatusUsuarios As Integer) As Boolean + ' Dim Retorno As Boolean = False + + ' DataAdapter("PA_OC_TempEstatusUsuarioRemove") + + ' SqlAdapter.SelectCommand.Parameters.Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios + + + ' Try + ' SqlAdapter.Fill(Data) + ' Retorno = True + ' Catch Ex1 As SqlException + ' If Ex1.Message.Contains("Número: 547;") Then + ' Alert("El Estatus no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + ' Else + ' Me.OnError("Ocurrió un error al eliminar el Estatus de Usuario para Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End If + ' Catch ex As Exception + ' Me.OnError("Ocurrió un error al eliminar el Estatus de Usuario para Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + ' End Try + + ' Return Retorno + 'End Function +#End Region + + Public Function GetOrdenesCompraRep(Tipo As String, CveProyecto As Integer, CveSubProyecto As Integer, CveClasificacion As Integer, CveEstatus As Integer, + FechaInicio As Date, FechaFin As Date, CveOrdenCompra As Integer, CveProveedor As Integer, Folio As Integer, CveUsuarioRegistro As Integer, CveUsuario As Integer, CveEmpresa As Integer, CvePS As Integer, Optional PendientePorSurtir As Boolean = False, Optional CveCliente As Integer = -1, Optional Guia As String = "-1", Optional CveActivoFijo As Integer = -1, + Optional SoloSubProyectosConPermiso As Boolean = False) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraRep") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Tipo", SqlDbType.VarChar).Value = Tipo + .Add("@CveProyecto", SqlDbType.Int).Value = CveProyecto + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra + .Add("@CveUsuarioRegistro", SqlDbType.Int).Value = CveUsuarioRegistro + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@PendientePorSurtir", SqlDbType.Bit).Value = PendientePorSurtir + .Add("@Guia", SqlDbType.VarChar).Value = Guia + .Add("@CveActivoFijo", SqlDbType.Int).Value = CveActivoFijo + .Add("@SoloSubProyectosConPermiso", SqlDbType.Bit).Value = SoloSubProyectosConPermiso + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetOrdenesCompraRepReqXOC(Folio As Integer, FechaInicio As String, FechaFin As String, CveProveedor As Integer, CveVendedor As Integer, CveCliente As Integer, CveEmpresa As Integer, Grupo As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraReqXOC") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@FechaInicio", SqlDbType.VarChar).Value = FechaInicio + .Add("@FechaFin", SqlDbType.VarChar).Value = FechaFin + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@Grupo", SqlDbType.Int).Value = Grupo + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de requisiciones.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetOrdenesCompraCorreo(CveCompra As Integer, Optional CveMovimiento As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraCorreosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los correos de Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetComprasOC(CveCompra As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraFoliosGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los correos de Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetOrdenesCompraMovimiento(CveCompra As Integer, Optional CveMovimiento As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraPSGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveCompra", SqlDbType.Int).Value = CveCompra + .Add("@CveMovimiento", SqlDbType.Int).Value = CveMovimiento + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los movimientos de Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetOrdenesPendientes(pTipo As String, pTipoBusqueda As Integer, pCveEmpresa As Integer, pCveProyecto As Integer, pCveSubProyecto As Integer, pCveEstatusCompra As Integer, + pCveUsuario As Integer, CveCliente As Integer, Optional SoloSubProyectosConPermiso As Boolean = False) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraPendientes") + + With SqlAdapter.SelectCommand.Parameters + .Add("@Tipo", SqlDbType.VarChar).Value = pTipo + .Add("@CveEmpresa", SqlDbType.Int).Value = pCveEmpresa + .Add("@CveProyecto", SqlDbType.Int).Value = pCveProyecto + .Add("@CveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto + .Add("@CveEstatus", SqlDbType.Int).Value = pCveEstatusCompra + .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@TipoBusqueda", SqlDbType.Int).Value = pTipoBusqueda + .Add("@SoloSubProyectosConPermiso", SqlDbType.Bit).Value = SoloSubProyectosConPermiso + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetCompras(ByVal pCveEmpresa As Integer, ByVal pCveProyecto As Integer, pCveSubProyecto As Integer, pCveClasificacion As Integer, pCveEstatusCompras As String, + pFechaInicio As Date, pFechaFin As Date, pCveOrdenCompra As Integer, pCveUsuario As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraRepCompras") + + With SqlAdapter.SelectCommand.Parameters + .Add("@pCveEmpresa", SqlDbType.Int).Value = pCveEmpresa + .Add("@pCveProyecto", SqlDbType.Int).Value = pCveProyecto + .Add("@pCveSubProyecto", SqlDbType.Int).Value = pCveSubProyecto + .Add("@pCveClasificacion", SqlDbType.Int).Value = pCveClasificacion + .Add("@pCveEstatusCompra", SqlDbType.Int).Value = pCveEstatusCompras + .Add("@pFechaInicio", SqlDbType.Date).Value = pFechaInicio + .Add("@pFechaFin", SqlDbType.Date).Value = pFechaFin + .Add("@pCveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + .Add("@pCveUsuario", SqlDbType.Int).Value = pCveUsuario + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateOrdenCompraEstatus(pCveEstatus As Integer, pCveOrdenCompra As Integer, pCveUsuario As Integer, pMotivo As String, Optional pCveCompra As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraEstatusUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatus", SqlDbType.Int).Value = pCveEstatus + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario + .Add("@Motivo", SqlDbType.VarChar, 500).Value = pMotivo + .Add("@CveCompra", SqlDbType.Int).Value = pCveCompra + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al cambiar el estatus de la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateOrdenCompraCompletada(pCveEstatus As Integer, pCveOrdenCompra As Integer, pCveUsuario As Integer, pMotivo As String, Optional pCveCompra As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraCompletadas") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatus", SqlDbType.Int).Value = pCveEstatus + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + .Add("@CveUsuario", SqlDbType.Int).Value = pCveUsuario + .Add("@Motivo", SqlDbType.VarChar, 500).Value = pMotivo + .Add("@CveCompra", SqlDbType.Int).Value = pCveCompra + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al cambiar el estatus de la OrdenCompra Completada.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function UpdateOrdenCompraDetalleProveedor(pCveOrdenCompraDetalle As Integer, pCveProveedor As Integer, pCveCotizacion As Integer) As Integer + Dim Retorno As Integer = -1 + + DataAdapter("BEGIN UPDATE OC_OrdenesCompraDetalle SET CveProveedor = @pCveProveedor WHERE CveOrdenCompraDetalle = @pCveOrdenCompraDetalle; UPDATE OC_CotizacionesDetalle SET Ganador = 1 WHERE CveCotizacion = @pCveCotizacion AND CveOrdenCompraDetalle = @pCveOrdenCompraDetalle; END", CommandType.Text) + + With SqlAdapter.SelectCommand.Parameters + + .Add("@pCveOrdenCompraDetalle", SqlDbType.Int).Value = pCveOrdenCompraDetalle + .Add("@pCveProveedor", SqlDbType.Int).Value = pCveProveedor + .Add("@pCveCotizacion", SqlDbType.Int).Value = pCveCotizacion + + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = pCveOrdenCompraDetalle + Catch ex As Exception + OnError("Ocurrió un error al actualizar el proveedor a la OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetOrdenesHistorial(pCveOrdenCompra As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraHistorialGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el historial de OrdenCompras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetOrdenesEstatus(pCveOrdenCompra As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraEstatusGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el estatus de OrdenCompra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetOrdenesEstatusHistorial(pCveOrdenCompra As Integer) As DataTable + + DataAdapter("PA_OC_OrdenesCompraEstatusHistorialGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + End With + + Try + SqlAdapter.Fill(Data) + + Catch ex As Exception + OnError("Ocurrió un error al obtener los estatus de OrdenesCompras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Data + End Function + + Public Function GetOCIncompletaDetalle(CveEmpresa As Integer, Optional CveOrdenCompra As Integer = -1, Optional CveProveedor As Integer = -1) As Boolean + Dim retorno As Boolean = False + StrSQL.Clear() + StrSQL.Append("SELECT OCD.CveOrdenCompra, OCD.Cantidad CantidadOrden, CD.Cantidad CantidadCompra, OCD.Cantidad - CD.Cantidad CantidadPendiente, OC.Folio, ") + StrSQL.Append("OC.Fecha, P.RazonSocial, E.Estatus, PS.PS, OC.CveProveedor ") + StrSQL.Append("FROM OC_OrdenesCompraDetalle OCD ") + StrSQL.Append("INNER JOIN Comp_ComprasDetalles CD ON OCD.CveOrdenCompraDetalle = CD.CveCompraDetalle ") + StrSQL.Append("INNER JOIN OC_OrdenesCompra OC ON OCD.CveOrdenCompra = OC.CveOrdenCompra ") + StrSQL.Append("INNER JOIN Comp_Proveedores P ON OC.CveProveedor = P.CveProveedor ") + StrSQL.Append("INNER JOIN ProductosServicios PS ON OCD.CvePS = PS.CvePS ") + StrSQL.Append("INNER JOIN OC_Estatus E ON OC.CveEstatus = E.CveEstatus ") + StrSQL.Append("WHERE OCD.CveOrdenCompraDetalle = CD.CveCompraDetalle AND OCD.Cantidad != CD.Cantidad ") + StrSQL.Append("AND (@CveOrdenCompra = -1 OR @CveOrdenCompra = OCD.CveOrdenCompra) ") + StrSQL.Append("AND (@CveEmpresa = -1 OR @CveEmpresa = OC.CveEmpresa) ") + StrSQL.Append("AND (@CveProveedor = -1 OR @CveProveedor = OC.CveProveedor) ") + StrSQL.Append("ORDER BY OC.Folio ") + + DataAdapter(StrSQL.ToString, CommandType.Text) + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + + End With + + + Try + SqlAdapter.Fill(Data) + retorno = True + Catch ex As Exception + OnError("Ocurrió un error al consultar Ordenes de Compra", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return retorno + + + + End Function + +#Region " OC FACTURA " + Public Function GetOCSinFactura(CveSubProyecto As Integer, CveVendedor As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_PendientesFacturar") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Ordenes de Compra Sin Factura.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetOCFacturacion(pCveOrdenCompra As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno = False + + DataAdapter("PA_OC_OrdenesCompraFacturacionGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = pCveOrdenCompra + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los detalles de la Orden de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region " OC POR SEMANA " + Public Function RepOCCount(FechaInicio As Date, FechaFin As Date, CveUsuario As Integer, Cveempresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OrdenesCompraRepCount") + + With SqlAdapter.SelectCommand.Parameters + .Add("@FechaInicio", SqlDbType.Date).Value = FechaInicio + .Add("@FechaFin", SqlDbType.Date).Value = FechaFin + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = Cveempresa + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener Ordenes de Compras.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region " OC CLASIFICACIONES " + + Public Function GetEstatusUsuariosClasificaciones(CveEstatusUsuarios As Integer, CveUsuario As Integer, CveSubProyecto As Integer, CveClasificacion As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_EstatusUsuariosClasificacionesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Estatus de Usuarios Clasificaciones para Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function AddEstatusUsuariosClasificaciones(CveEstatusUsuarios As Integer, CveClasificacion As Integer, CveSuperior As Integer, LimiteInferior As Decimal, LimiteSuperior As Decimal, CveUsuarioModifico As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_EstatusUsuariosClasificacionesAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios + .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveSuperior", SqlDbType.Int).Value = CveSuperior + .Add("@LimiteSuperior", SqlDbType.Money).Value = LimiteSuperior + .Add("@LimiteInferior", SqlDbType.Money).Value = LimiteInferior + .Add("@CveUsuarioModifico", SqlDbType.Bit).Value = CveUsuarioModifico + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Estatus con los mismos valores", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al Guardar el Estatus de Usuario Clasificaciones para Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al Guardar el Estatus de Usuario Clasificaciones para Ordenes de Compra", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function UpdateEstatusUsuariosClasificaciones(CveEstatusUsuariosClasificacion As Integer, CveClasificacion As Integer, CveSuperior As Integer, LimiteInferior As Decimal, LimiteSuperior As Decimal, CveUsuarioModifico As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_EstatusUsuariosClasificacionesUpdate") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusUsuariosClasificacion", SqlDbType.Int).Value = CveEstatusUsuariosClasificacion + .Add("@CveClasificacion", SqlDbType.Int).Value = CveClasificacion + .Add("@CveSuperior", SqlDbType.Int).Value = CveSuperior + .Add("@LimiteSuperior", SqlDbType.Money).Value = LimiteSuperior + .Add("@LimiteInferior", SqlDbType.Money).Value = LimiteInferior + .Add("@CveUsuarioModifico", SqlDbType.Bit).Value = CveUsuarioModifico + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 2627;") Then + Alert("Ya existe un Estatus con los mismos valores. ", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al guardar los cambios en el Estatus de Usuario Clasificaciones para Ordenes de Compra", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + OnError("Ocurrió un error al guardar los cambios en el Estatus de Usuario Clasificaciones para Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function + Public Function RemoveEstatusUsuariosClasificaciones(CveEstatusUsuariosClasificacion As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_EstatusUsuariosClasificacionesRemove") + + SqlAdapter.SelectCommand.Parameters.Add("@CveEstatusUsuariosClasificacion", SqlDbType.Int).Value = CveEstatusUsuariosClasificacion + + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + If Ex1.Message.Contains("Número: 547;") Then + Alert("El Estatus no se pudo eliminar porque está siendo usado por un registro.", TipoMensaje.MsgAdvertencia) + Else + Me.OnError("Ocurrió un error al eliminar el Estatus de Usuario Clasificaciones para Ordenes de Compra.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End If + Catch ex As Exception + Me.OnError("Ocurrió un error al eliminar el Estatus de Usuario Clasificaciones para Ordenes de Compra.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + +#Region " OC X VINCULAR COMPRA " + Public Function GetPendietePorSurtirOC(FechaI As String, FechaF As String, CveProveedor As Integer, Folio As Integer, CveSubProyecto As Integer, CveCliente As Integer, CveEmpresa As Integer, Optional CveOC As Integer = -1) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_ComprasPendientesPorSurtirGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@Folio", SqlDbType.Int).Value = Folio + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@FechaI", SqlDbType.VarChar).Value = FechaI + .Add("@FechaF", SqlDbType.VarChar).Value = FechaF + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveOC", SqlDbType.Int).Value = CveOC + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener Ordenes de compra pendientes por surtir.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetOCVinculadasPendientes(CveOCDetalle As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_OCVinculadas") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOCDetalle", SqlDbType.Int).Value = CveOCDetalle + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener Ordenes de compra pendientes por surtir.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "P y M E" + + Public Function AddEstatusRequisicionesPredefinidas(CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_EstatusPredefinidosPyMEAdd") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + + Catch ex As Exception + OnError("Ocurrió un error al agregar los estatus de las requisiciones predefinidas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetEstatusUsuariosPyME(CveUsuario As Integer, CveEstatus As Integer, CveSubProyecto As Integer, CveOrdenCompra As Integer, CveEmpresa As Integer, Optional CveEstatusUsuarios As Integer = -1) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_EstatusUsuariosPyMEGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEstatusUsuarios", SqlDbType.Int).Value = CveEstatusUsuarios + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEstatus", SqlDbType.Int).Value = CveEstatus + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el Catálogo de Estatus de Usuarios para Ordenes de Compra en PyME.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + +#Region " SOLICITUD DE ANTICIPO " + Public Function GetSolicitudAnticipo(CveOC As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_SolicitudAnticipoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOC", SqlDbType.Int).Value = CveOC + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener la solicitud de anticipo de la OC.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetSolicitudAnticipoUsuarios(CveOC As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_SolicitudAnticipoUsuarioGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOC", SqlDbType.Int).Value = CveOC + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener la solicitud de anticipo de la OC.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddSolicitudAnticipo(CveOrdenCompra As Integer, Importe As Double, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_SolicitudAnticipoAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra + .Add("@Importe", SqlDbType.Money).Value = Importe + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el estatus de solicitud anticipo de la OC.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function AddSolicitudAnticipoPago(CveOrdenCompra As Integer, CveIE As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_SolicitudAnticipoAddPago") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOrdenCompra", SqlDbType.Int).Value = CveOrdenCompra + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el estatus de solicitud anticipo de la OC.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#End Region + + Public Function GetUltimoCostoPS(CvePS As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_OC_UltimoCostoPS") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePS", SqlDbType.Int).Value = CvePS + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el último costo del producto.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + + Public Function GetRepOCGuias(FechaI As String, FechaF As String, CveProveedor As Integer, CveVendedor As Integer, CveCliente As Integer, CveSubProyecto As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_RepOCGuiasGet") + + With SqlAdapter.SelectCommand.Parameters + + .Add("@FechaI", SqlDbType.VarChar).Value = FechaI + .Add("@FechaF", SqlDbType.VarChar).Value = FechaF + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@CveVendedor", SqlDbType.Int).Value = CveVendedor + .Add("@CveCliente", SqlDbType.Int).Value = CveCliente + .Add("@CveSubProyecto", SqlDbType.Int).Value = CveSubProyecto + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener el reporte de Ordenes de compra guias.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + +#Region " OC DETALLE - SALDOS [ SURTIDO INV | VINCULADO COMP ]" + Public Function OrdenesCompraDetalleSaldosInvCompraAdd(CveOCDetalle As Integer, CveInvDetalle As Integer, CantidadSurtida As Double, CveCompraDetalle As Integer, CantidadVinculada As Double) As Boolean + Dim Retorno As Boolean = False + DataAdapter("OC_OrdenesCompraDetalleSaldosInvCompraAdd") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveOCDetalle", SqlDbType.Int).Value = CveOCDetalle + .Add("@CveInvDetalle", SqlDbType.Int).Value = CveInvDetalle + .Add("@CantidadSurtida", SqlDbType.Float).Value = CantidadSurtida + .Add("@CveCompraDetalle", SqlDbType.Int).Value = CveCompraDetalle + .Add("@CantidadVinculada", SqlDbType.Float).Value = CantidadVinculada + + End With + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al agregar los saldos de (Inv/Compra) de la OC.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + +#Region "REP OC CON ANTICIPOS PENDIENTES" + Public Function GetOCAnticiposPendientes(CveEmpresa As Integer, CveUsuarioPara As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_OC_AnticiposPendientesGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveUsuarioPara", SqlDbType.Int).Value = CveUsuarioPara + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@FechaI", SqlDbType.DateTime).Value = FechaI + .Add("@FechaF", SqlDbType.DateTime).Value = FechaF + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los anticipos pendientes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region +#Region "REP SOLICITUDES ANTICIPO" + Public Function GetRepSolicitudAnticipos(CveEmpresa As Integer, CveProveedor As Integer, FechaI As Date, FechaF As Date, CveEventoEstatus As Integer) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_RepSolicitudAnticipoGet") + + With SqlAdapter.SelectCommand.Parameters + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@CveProveedor", SqlDbType.Int).Value = CveProveedor + .Add("@FechaI", SqlDbType.DateTime).Value = FechaI + .Add("@FechaF", SqlDbType.DateTime).Value = FechaF + .Add("@CveEventoEstatus", SqlDbType.Int).Value = CveEventoEstatus + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al obtener los anticipos pendientes.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function +#End Region + + + +#Region " IDisposable Support " + ' IDisposable + Protected Overridable Sub Dispose(ByVal disposing As Boolean) + If Not disposedValue Then + If disposing Then + SqlConexion.Close() + SqlConexion.Dispose() + If Not Data Is Nothing Then Data.Dispose() + If Not SqlAdapter Is Nothing Then SqlAdapter.Dispose() + + End If + End If + disposedValue = True + End Sub + Public Sub Dispose() Implements IDisposable.Dispose + ConexionClose() + Dispose(True) + GC.SuppressFinalize(Me) + End Sub +#End Region +End Class diff --git a/App_Code/ClsProductosServicios.vb b/App_Code/ClsProductosServicios.vb index c90639042..786b97c24 100644 --- a/App_Code/ClsProductosServicios.vb +++ b/App_Code/ClsProductosServicios.vb @@ -1345,7 +1345,27 @@ Public Class ClsProductosServicios Return Retorno End Function + Public Function UpdateAplicaSeccionAlmacen(CvePS As Integer, CveEmpresa As Integer, AplicaSeccionAlmacen As Boolean) As Boolean + Dim Retorno As Boolean = False + DataAdapter("PA_Gral_ProductosServiciosSeccionAlmacenUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CvePS", SqlDbType.Int).Value = CvePS + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + .Add("@AplicaSeccionAlmacen", SqlDbType.Bit).Value = AplicaSeccionAlmacen + End With + + Try + SqlAdapter.Fill(Data) + Retorno = True + Catch Ex1 As SqlException + + Catch ex As Exception + OnError("Ocurrió un error al actualizar aplica seccion almacen.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo) + End Try + + Return Retorno + End Function Public Function GetMarcas(CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False diff --git a/App_Code/WS_PuntoVenta.vb b/App_Code/WS_PuntoVenta.vb index 2f1c60dac..9fd221fe0 100644 --- a/App_Code/WS_PuntoVenta.vb +++ b/App_Code/WS_PuntoVenta.vb @@ -1346,8 +1346,8 @@ Public Class WS_PuntoVenta Dim objInventario As New ClsInventarios Dim Respuesta As New RespuestaWS - If objInventario.GetSeccionesAlmacenes(-1) Then - Respuesta.Datos = objInventario.DtResultados.FiltraParametros(String.Format("CveEmpresa={0}", CveEmpresa)) + If objInventario.GetSeccionesAlmacenes(CveEmpresa, -1) Then + Respuesta.Datos = objInventario.DtResultados '.FiltraParametros(String.Format("CveEmpresa={0}", CveEmpresa)) Respuesta.Datos.TableName = "Inv_SeccionesAlmacenes" Respuesta.HuboError = False End If diff --git a/Global.asax b/Global.asax index 973a330a8..b39b1d880 100644 --- a/Global.asax +++ b/Global.asax @@ -193,8 +193,8 @@ 'I N V E N T A R I O S Dim Objinventarios As New ClsInventarios - If Objinventarios.GetAlmacenes(-1, -1, -1, -1) Then Application("GlobalDTAlmacen") = Objinventarios.DtResultados Else Application("GlobalDTAlmacen") = Nothing - If Objinventarios.GetSeccionesAlmacenes(-1) Then Application("GlobalDTSeccionAlmacen") = Objinventarios.DtResultados Else Application("GlobalDTSeccionAlmacen") = Nothing + If Objinventarios.GetAlmacenes(-1, -1, -1, -1) Then Application("GlobalDTAlmacen") = Objinventarios.DtResultados Else Application("GlobalDTAlmacen") = Nothing + If Objinventarios.GetSeccionesAlmacenes(-1, -1) Then Application("GlobalDTSeccionAlmacen") = Objinventarios.DtResultados Else Application("GlobalDTSeccionAlmacen") = Nothing If Objinventarios.GetTiposAlmacenes Then Application("GlobalDTTipoAlmacen") = Objinventarios.DtResultados Else Application("GlobalDTTipoAlmacen") = Nothing If Objinventarios.GetConceptos Then Application("GlobalDTInvConceptos") = Objinventarios.DtResultados Else Application("GlobalDTInvConceptos") = Nothing Objinventarios.Dispose() diff --git a/Inventarios/AjustesSeccionAlmacen.aspx b/Inventarios/AjustesSeccionAlmacen.aspx new file mode 100644 index 000000000..9efda2629 --- /dev/null +++ b/Inventarios/AjustesSeccionAlmacen.aspx @@ -0,0 +1,70 @@ +<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="AjustesSeccionAlmacen.aspx.vb" Inherits="Inventarios_AjustesSeccionAlmacen" %> + + + + + + + Ajustes de Productos en Secciones de Almacen + + + + + + + + + + +
+
+
+ +
+
+ + +
+ +
+ + +
+ +
+ +
+
+
+
+
+
+ + + + + + + + + + + + + + + + + + + + + + + + + +
+ + + diff --git a/Inventarios/AjustesSeccionAlmacen.aspx.vb b/Inventarios/AjustesSeccionAlmacen.aspx.vb new file mode 100644 index 000000000..0e11ceb67 --- /dev/null +++ b/Inventarios/AjustesSeccionAlmacen.aspx.vb @@ -0,0 +1,144 @@ + +Imports System.Data +Imports Extensiones + +Partial Class Inventarios_AjustesSeccionAlmacen + Inherits ClsPaginas + + Private Sub Inventarios_AjustesSeccionAlmacen_Load(sender As Object, e As EventArgs) Handles Me.Load + If Not Page.IsPostBack Then + CargaCombos() + End If + End Sub + + Private Sub CargaCombos() + DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + DdlAlmacen.DataBind() + + DdlClasificaciones.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) + DdlClasificaciones.DataBind() + DdlClasificaciones.Items.Insert(0, New ListItem("Todos", "-1")) + End Sub + + Private Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click + CargaDatos() + End Sub + + Private Sub CargaDatos() + Dim ObjInv As New ClsInventarios + + If ObjInv.GetMovimientosDetalleSeccionesAlmacen(DdlAlmacen.SelectedValue.ToEntero, DdlClasificaciones.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then + GvD.DataSource = ObjInv.DtResultados + End If + + ObjInv.Dispose() + GvD.DataBind() + UppD.Update() + End Sub + + Private Sub GvD_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvD.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + e.Row.FCDropDownList("DDlS").DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero) + e.Row.FCDropDownList("DDlS").DataBind() + + End If + End Sub + + Private Sub BtnCambiarSeccion_Click(sender As Object, e As EventArgs) Handles BtnCambiarSeccion.Click + Dim ObjInventario As New ClsInventarios + Dim ObjPS As New ClsProductosServicios(ObjInventario.IniciaTransacSQL) + Dim Dtt As DataTable = Nothing + Dim CveMovimientoEntrada As Integer = 0 + Dim Folio = 0 + Dim ErrorMovInv As Boolean = False + Dim TextoError = "" + Dim CveAlmacen As Integer = DdlAlmacen.SelectedValue.ToEntero + + + + Dim Fecha As Date = DateTime.Now + 'AGREGAMOS LA ENTRADA + Dim CveMovimientoSalida As Integer = ObjInventario.AddMovimiento(CveAlmacen, 3, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, + Observaciones:="", Modulo:="ASA/G1") + Folio = ObjInventario.Folio + + If CveMovimientoSalida <= 0 Then + TextoError = "No se pudo generar el movimiento de salida correctamente" + ErrorMovInv = True + Else + + Dim CveMovimientoDetalleEntrada As Integer = 0 + Dim Cont As Integer = 0 + For Each gvr As GridViewRow In GvD.Rows + + 'que este seleccionado y que tenga diferente seccion + If gvr.FCCheckBox("Chk").Checked AndAlso gvr.FCDropDownList("DDlS").SelectedValue.ToEntero <> gvr.DataKey("CveSeccionAlmacen").ToEntero Then + + If gvr.DataKey("CveSeccionAlmacen").ToEntero > 0 Then + ObjPS.UpdateAplicaSeccionAlmacen(gvr.DataKey("CvePS").ToEntero, UsuarioActual.CveEmpresa, True) + End If + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, gvr.DataKey("Existencia").ToDecimal, gvr.DataKey("CveUM").ToEntero, gvr.DataKey("CvePS").ToEntero, 0, -1, CveSeccionAlmacen:=gvr.DataKey("CveSeccionAlmacen").ToEntero, Serie:=gvr.DataKey("Serie"), Lote:=gvr.DataKey("Lote"), FechaCaducidad:=gvr.DataKey("FechaCaducidad").ToDate) Then + ErrorMovInv = True + TextoError = "Ocurrió un error al guardar los movimientos de salida" + Exit For + End If + + End If + + Next + + If Not ErrorMovInv Then + + If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then + + Dim resultado As DataTable = ObjInventario.DtResultados + CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacen, 2, 1, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:="", CveMovimientoRelacionado:=CveMovimientoSalida, Modulo:="ASA/G1") + Dim ind As Integer = 0 + + For Each Row As DataRow In resultado.Rows + Dim CvePS = Row("CvePS").ToString().ToEntero() + Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal() + Dim PU As Decimal = Row("PUOriginal").ToString().ToDecimal() + Dim CveUM As Integer = Row("CveUM").ToString().ToEntero() + Dim CveSeccionAlmacen As Integer = GvD.Rows(ind).FCDropDownList("DDlS").SelectedValue.ToEntero ' IfNull(Row("CveSeccionAlmacen"), "-1").ToString().ToEntero() + Dim CostoIndirecto As Decimal = Row("CostoIndirecto").ToString().ToDecimal() + Dim Serie As String = Row("Serie").ToString() + Dim Lote As String = Row("Lote").ToString() + Dim FechaCaducidad As Date = IfNull(Row("FechaCaducidad"), MinFecha).ToString.ToDate + + 'actualizamos el PS, para que tenga el aplica seccion + + ObjPS.UpdateAplicaSeccionAlmacen(Row("CvePS").ToString().ToEntero(), UsuarioActual.CveEmpresa, True) + + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Cantidad, CveUM, CvePS, PU, -1, CostoIndirecto:=CostoIndirecto, CveSeccionAlmacen:=CveSeccionAlmacen, Lote:=Lote, Serie:=Serie, FechaCaducidad:=FechaCaducidad, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then + ErrorMovInv = True + Exit For + End If + ind += 1 + Next + resultado.Dispose() + + Else + TextoError = "No se pudo registrar el movimiento" + ErrorMovInv = True + End If + + End If + + End If + + + If Not ErrorMovInv Then + ObjInventario.Commit() + cargadatos + Alert("El Movimiento quede registrado correctamente", TipoMensaje.MsgInformacion) + Else + ObjInventario.RollBack() + Alert("Ocurrio un error al registrar el movimiento", TipoMensaje.MsgError) + End If + + ObjInventario.Dispose() + End Sub +End Class diff --git a/Inventarios/Apartados.aspx b/Inventarios/Apartados.aspx index 011ed8251..37846e8bc 100644 --- a/Inventarios/Apartados.aspx +++ b/Inventarios/Apartados.aspx @@ -86,9 +86,8 @@
- - - + +
@@ -210,6 +209,12 @@
- - - - - - - - - - - - - - - + + @@ -695,64 +690,6 @@ - <%--SECCION DE ALMACEN--%> - - <%--AGREGAR POR SERIE LOTE--%> + +
> +
+ + +
+ +
+
+
+
+ + +
+
+
+ " style="display: inline-block; width: 150px;" /> + " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> +
+
+ + + + + + + + + + + + + + + + + + + + + + + + + + <%----%> + + + + + + + + diff --git a/Inventarios/ResguardoMaterial.aspx b/Inventarios/ResguardoMaterial.aspx index fcdf5d98c..b1085efd1 100644 --- a/Inventarios/ResguardoMaterial.aspx +++ b/Inventarios/ResguardoMaterial.aspx @@ -273,7 +273,7 @@ - + ss @@ -475,7 +475,7 @@ - + xx @@ -496,76 +496,6 @@ - <%--SECCION DE ALMACEN--%> - - - - diff --git a/Inventarios/ResguardoMaterial.aspx.vb b/Inventarios/ResguardoMaterial.aspx.vb index 723cf5821..054faab06 100644 --- a/Inventarios/ResguardoMaterial.aspx.vb +++ b/Inventarios/ResguardoMaterial.aspx.vb @@ -176,8 +176,6 @@ Partial Class Inventarios_ResguardoMaterial CantidadTotal = 0 IndexSeccionAlmacen = 0 CvePS = 0 - CreaDtSeccionAlmacen() - CargaDdlAlmacen() TipoSeccionAlmacen = 0 End Sub @@ -783,16 +781,6 @@ Partial Class Inventarios_ResguardoMaterial MensajeError = "Ocurrió un error al guardar los detalles del movimiento de salida. Por favor vuelva a intentar." TieneError = True Exit For - Else - If ObjInventario.CveMovimientoDetalle > 0 AndAlso DtSeccionAlmacen.Rows.Count > 0 Then - For Each Dr2 As DataRow In DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {Cont} AND TipoSeccionAlmacen = 1").Rows - If Not ObjInventario.AddMovimientosDetalleSeccionesAlmacen(ObjInventario.CveMovimientoDetalle, Dr2("CveSeccionAlmacenOrigen").ToString.ToEntero, -Dr2("CantidadSeccionAlmacen").ToString.ToDecimal) Then - TieneError = True - MensajeError = "Ocurrió un error al procesar las secciones de almacen. Por favor vuelva a intentar." - Exit For - End If - Next - End If End If Cont += 1 Next @@ -812,16 +800,7 @@ Partial Class Inventarios_ResguardoMaterial TieneError = True MensajeError = "Ocurrió un error al guardar los movimientos de entrada" Exit For - Else - If ObjInventario.CveMovimientoDetalle > 0 AndAlso DtSeccionAlmacen.Rows.Count > 0 Then - For Each Dr2 As DataRow In DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {Cont} AND TipoSeccionAlmacen = 1").Rows - If Not ObjInventario.AddMovimientosDetalleSeccionesAlmacen(ObjInventario.CveMovimientoDetalle, Dr2("CveSeccionAlmacenDestino").ToString.ToEntero, Dr2("CantidadSeccionAlmacen").ToString.ToDecimal) Then - TieneError = True - MensajeError = "Ocurrió un error al procesar las secciones de almacen. Por favor vuelva a intentar." - Exit For - End If - Next - End If + End If Cont += 1 Next @@ -849,16 +828,7 @@ Partial Class Inventarios_ResguardoMaterial MensajeError = "Ocurrió un error al guardar los detalles del movimiento de salida. Por favor vuelva a intentar." TieneError = True Exit For - Else - If ObjInventario.CveMovimientoDetalle > 0 AndAlso DtSeccionAlmacen.Rows.Count > 0 Then - For Each Dr2 As DataRow In DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {Cont} AND TipoSeccionAlmacen = 2").Rows - If Not ObjInventario.AddMovimientosDetalleSeccionesAlmacen(ObjInventario.CveMovimientoDetalle, Dr2("CveSeccionAlmacenOrigen").ToString.ToEntero, -Dr2("CantidadSeccionAlmacen").ToString.ToDecimal) Then - TieneError = True - MensajeError = "Ocurrió un error al procesar las secciones de almacen. Por favor vuelva a intentar." - Exit For - End If - Next - End If + End If End If Cont += 1 @@ -880,16 +850,7 @@ Partial Class Inventarios_ResguardoMaterial TieneError = True MensajeError = "Ocurrió un error al guardar los movimientos de entrada" Exit For - Else - If ObjInventario.CveMovimientoDetalle > 0 AndAlso DtSeccionAlmacen.Rows.Count > 0 Then - For Each Dr2 As DataRow In DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {Cont} AND TipoSeccionAlmacen = 2").Rows - If Not ObjInventario.AddMovimientosDetalleSeccionesAlmacen(ObjInventario.CveMovimientoDetalle, Dr2("CveSeccionAlmacenDestino").ToString.ToEntero, Dr2("CantidadSeccionAlmacen").ToString.ToDecimal) Then - TieneError = True - MensajeError = "Ocurrió un error al procesar las secciones de almacen. Por favor vuelva a intentar." - Exit For - End If - Next - End If + End If Cont += 1 Next @@ -1010,206 +971,6 @@ Partial Class Inventarios_ResguardoMaterial UpFiltraLiberacion.Update() End Sub -#End Region - -#Region "SECCION ALMACEN" - Private Sub CreaDtSeccionAlmacen() - DtSeccionAlmacen = New DataTable - DtSeccionAlmacen.Columns.Add("CantidadSeccionAlmacen", GetType(Decimal)) - DtSeccionAlmacen.Columns.Add("IndexSeccionAlmacen", GetType(Integer)) - DtSeccionAlmacen.Columns.Add("CveSeccionAlmacenOrigen", GetType(Integer)) - DtSeccionAlmacen.Columns.Add("CveSeccionAlmacenDestino", GetType(Integer)) - DtSeccionAlmacen.Columns.Add("CvePS", GetType(Integer)) - DtSeccionAlmacen.Columns.Add("SeccionAlmacenOrigen", GetType(String)) - DtSeccionAlmacen.Columns.Add("SeccionAlmacenDestino", GetType(String)) - DtSeccionAlmacen.Columns.Add("Consec", GetType(Integer)) - DtSeccionAlmacen.Columns.Add("TipoSeccionAlmacen", GetType(Integer)) - End Sub - Private Sub CargaDdlAlmacen() - DdlSeccionAlmacenOrigen.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa) - DdlSeccionAlmacenOrigen.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlSeccionAlmacenOrigen.DataBind() - - DdlSeccionAlmacenDestino.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa) - DdlSeccionAlmacenDestino.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlSeccionAlmacenDestino.DataBind() - End Sub - Protected Sub LnkSeccionAlmacen_Click(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - - If Not DdlAlmacen.SelectedValue.ToEntero > 0 Then - Alert("Tiene que tener seleccionado un almacen para registrar seccion almacen origen.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'If Not DdlAlmacenDestino.SelectedValue.ToEntero > 0 AndAlso Not ChkTransitorio.Checked Then - ' Alert("Tiene que tener seleccionado un almacen para registrar seccion almacen destino.", TipoMensaje.MsgAdvertencia) - ' Exit Sub - 'End If - - GvSeccion.Columns(2).Visible = True - DivSeccionAlmacenDestino.Visible = True - - DivSeccionAlmacenOrigen.Visible = True - GvSeccion.Columns(1).Visible = True - - CantidadTotal = gvRow.DataKey("Cantidad").ToDecimal - IndexSeccionAlmacen = gvRow.RowIndex - CvePS = gvRow.DataKey("CvePS").ToEntero - TipoSeccionAlmacen = 1 - CargaSeccionAlmacen() - RegistraScript("$('#DModalSeccionAlmacen').modal()") - End Sub - - Protected Sub LnkSeccionAlmacenDestino_Click(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - - If Not DdlAlmacenLiberacion.SelectedValue.ToEntero > 0 Then - Alert("Tiene que tener seleccionado un almacen para registrar seccion almacen destino.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - DivSeccionAlmacenOrigen.Visible = True - DivSeccionAlmacenDestino.Visible = True - GvSeccion.Columns(1).Visible = True - GvSeccion.Columns(2).Visible = True - - CantidadTotal = gvRow.FCTextBox("TxtCantidad").Text.ToDecimal - IndexSeccionAlmacen = gvRow.RowIndex - CvePS = gvRow.DataKey("CvePS").ToEntero - TipoSeccionAlmacen = 2 - CargaSeccionAlmacen() - RegistraScript("$('#DModalSeccionAlmacen').modal()") - - End Sub - - Private Sub CargaSeccionAlmacen() - Dim CantidadTotalSeccion As Decimal = DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {IndexSeccionAlmacen} AND TipoSeccionAlmacen = {TipoSeccionAlmacen}").SUMD("CantidadSeccionAlmacen") - GvSeccion.DataSource = DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {IndexSeccionAlmacen} AND TipoSeccionAlmacen = {TipoSeccionAlmacen}") - GvSeccion.DataBind() - - TxtCantidadSeccion.Text = "" - DdlSeccionAlmacenOrigen.SelectedIndex = 0 - DdlSeccionAlmacenDestino.SelectedIndex = 0 - Dim CantidadRestante As Decimal = CantidadTotal - CantidadTotalSeccion - If CantidadRestante = 0 Then - RVTxtCantidad.MaximumValue = "1" - TxtCantidadSeccion.Enabled = False - Else - RVTxtCantidad.MaximumValue = CantidadRestante.ToString - TxtCantidadSeccion.Enabled = True - End If - - If TipoSeccionAlmacen = 1 Then - If CantidadTotalSeccion > 0 Then - GvM.Rows(IndexSeccionAlmacen).FCLinkButton("lnkRemove").Visible = False - GvM.Rows(IndexSeccionAlmacen).FCLinkButton("lnkRemove").ToolTip = "Cuenta con sección almacen" - Else - GvM.Rows(IndexSeccionAlmacen).FCLinkButton("lnkRemove").Visible = True - GvM.Rows(IndexSeccionAlmacen).FCLinkButton("lnkRemove").ToolTip = "" - End If - If DtSeccionAlmacen.SUMD("CantidadSeccionAlmacen") > 0 Then - DdlAlmacen.Enabled = False - DdlAlmacen.ToolTip = "Cuenta con sección almacen" - Else - DdlAlmacen.Enabled = True - DdlAlmacen.ToolTip = "" - End If - UpGenerales.Update() - - ElseIf TipoSeccionAlmacen = 2 Then - If CantidadTotalSeccion > 0 Then - GvMLiberacion.Rows(IndexSeccionAlmacen).FCTextBox("TxtCantidad").Enabled = False - GvMLiberacion.Rows(IndexSeccionAlmacen).FCTextBox("TxtCantidad").ToolTip = "Cuenta con sección almacen" - Else - GvMLiberacion.Rows(IndexSeccionAlmacen).FCTextBox("TxtCantidad").Enabled = True - GvMLiberacion.Rows(IndexSeccionAlmacen).FCTextBox("TxtCantidad").ToolTip = "" - End If - If DtSeccionAlmacen.SUMD("CantidadSeccionAlmacen") > 0 Then - DdlAlmacenLiberacion.Enabled = False - DdlAlmacenLiberacion.ToolTip = "Cuenta con sección almacen" - Else - DdlAlmacenLiberacion.Enabled = True - DdlAlmacenLiberacion.ToolTip = "" - End If - UpGridLiberacion.Update() - UpFiltraLiberacion.Update() - End If - - UpModalSeccionAlmacen.Update() - End Sub - - Protected Sub LnkAddSeccionAlmacen_Click(sender As Object, e As EventArgs) - - Dim ObjInv As New ClsInventarios - Dim CantidadDisponible As Decimal = 0 - If ObjInv.GetMovimientosDetalleSeccionesAlmacen(DdlSeccionAlmacenOrigen.SelectedValue.ToEntero, If(TipoSeccionAlmacen = 1, DdlAlmacen.SelectedValue.ToEntero, DdlAlmacenLiberacion.SelectedValue.ToEntero), - CvePS, UsuarioActual.CveEmpresa) Then - If ObjInv.DtResultados.Rows.Count > 0 Then - CantidadDisponible = ObjInv.DtResultados.Rows(0)("CantidadRestante").ToString.ToDecimal - End If - End If - ObjInv.Dispose() - - CantidadDisponible -= DtSeccionAlmacen.FiltraParametros($"CvePS = {CvePS} AND CveSeccionAlmacenOrigen = {DdlSeccionAlmacenOrigen.SelectedValue} AND TipoSeccionAlmacen = {TipoSeccionAlmacen}").SUMD("CantidadSeccionAlmacen") - - If TxtCantidadSeccion.Text.ToDecimal > CantidadDisponible Then - Alert($"No tiene cantidad de producto suficiente en esta seccion de almacen, su cantidad restante es: {CantidadDisponible}", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim Row As DataRow = Nothing - DtSeccionAlmacen.AcceptChanges() - Row = DtSeccionAlmacen.NewRow - Row("CantidadSeccionAlmacen") = TxtCantidadSeccion.Text.ToDecimal - Row("IndexSeccionAlmacen") = IndexSeccionAlmacen - Row("CveSeccionAlmacenOrigen") = DdlSeccionAlmacenOrigen.SelectedValue.ToEntero - Row("SeccionAlmacenOrigen") = DdlSeccionAlmacenOrigen.SelectedItem.Text - Row("CveSeccionAlmacenDestino") = DdlSeccionAlmacenDestino.SelectedValue.ToEntero - Row("SeccionAlmacenDestino") = DdlSeccionAlmacenDestino.SelectedItem.Text - Row("CvePS") = CvePS - Row("Consec") = DtSeccionAlmacen.Rows.Count + 1 - Row("TipoSeccionAlmacen") = TipoSeccionAlmacen - DtSeccionAlmacen.Rows.Add(Row) - DtSeccionAlmacen.AcceptChanges() - CargaSeccionAlmacen() - End Sub - - Protected Sub LnkEliminarSeccion_Click(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - Dim Index As Integer = 0 - For Each Dr As DataRow In DtSeccionAlmacen.Rows - If Dr("Consec").ToString.ToEntero = gvRow.DataKey("Consec").ToEntero() Then - Exit For - End If - Index += 1 - Next - DtSeccionAlmacen.Rows.RemoveAt(Index) - DtSeccionAlmacen.AcceptChanges() - CargaSeccionAlmacen() - End Sub - - 'Protected Sub LnkVerSecciones_Click(sender As Object, e As EventArgs) - ' If Not CveVentaSurtir > 0 Then - ' Alert("Tiene que seleccionar la venta a surtir", TipoMensaje.MsgAdvertencia) - ' Exit Sub - ' End If - - ' If Not DdlAlmacen.SelectedValue.ToEntero > 0 Then - ' Alert("Tiene que seleccionar el almacen", TipoMensaje.MsgAdvertencia) - ' Exit Sub - ' End If - - ' Dim ObjInv As New ClsInventarios - ' If ObjInv.GetExistenciaSeccionAlmacen(CveVentaSurtir, DdlAlmacen.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then - ' GvVerSeccionesAlmacen.DataSource = ObjInv.DtResultados - ' End If - ' ObjInv.Dispose() - ' GvVerSeccionesAlmacen.DataBind() - ' UpVerSeccionesAlmacen.Update() - ' RegistraScript("$('#ModalVerSeccionesAlmacen').modal()") - 'End Sub - #End Region Private Sub ImgExcel_Click(sender As Object, e As EventArgs) Handles ImgExcel.Click diff --git a/Inventarios/TraspasoAlmacen.aspx b/Inventarios/TraspasoAlmacen.aspx index b794965e5..9804276ea 100644 --- a/Inventarios/TraspasoAlmacen.aspx +++ b/Inventarios/TraspasoAlmacen.aspx @@ -450,10 +450,10 @@ - + - + s @@ -654,7 +654,7 @@ - + sss @@ -726,74 +726,7 @@ - - <%--SECCION DE ALMACEN--%> - + <%--CARGA EXCEL--%> -
+
@@ -1655,7 +1655,7 @@ - +
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb index 1c08e740c..2c262bbc5 100644 --- a/Ventas/Ventas.aspx.vb +++ b/Ventas/Ventas.aspx.vb @@ -9503,8 +9503,11 @@ Partial Class Ventas TmpDr("CveVentaDetalle") = ObjVentas.CveVentaDetalle Try - Dim InvDr As DataRow = DtInv.Select($"Consec = {Row("Consec").ToString}")(0) - InvDr("CveVentaDetalle") = ObjVentas.CveVentaDetalle + If DtInv IsNot Nothing Then + Dim InvDr As DataRow = DtInv.Select($"Consec = {Row("Consec").ToString}")(0) + InvDr("CveVentaDetalle") = ObjVentas.CveVentaDetalle + End If + Catch ex As Exception End Try @@ -11175,7 +11178,7 @@ Partial Class Ventas CveConceptoAlmacen = 18 End If - Dim CveAlmacen = ddlAlmacen.SelectedValue.ToEnteroca + Dim CveAlmacen As Integer = ddlAlmacen.SelectedValue.ToEntero Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(CveAlmacen, CveConceptoAlmacen, factura.CveMoneda, factura.Fecha, -1, factura.CveUsuario, factura.CveEmpresa, -1, factura.CveVenta, -1, -1, Modulo:="Vta/E1") If CveMovimientoInventario <= 0 Then @@ -11239,7 +11242,7 @@ Partial Class Ventas End If End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, Serie:=Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then OcurrioError = True ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.
") Exit For @@ -13246,7 +13249,7 @@ Partial Class Ventas Protected Function CancelarMovimientoInventario(ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, CveVentaNueva As Integer, CveVentaVieja As Integer) As Boolean 'SI YA ESTA QUEMADA DE ALMACEN LA VENTA, NO SE CANCELAN LOS MOVIMIENTOS DE INVENTARIO - If ObjInventario.GetEstatusVentaPorSurir(CveVentaVieja) Then + If ObjInventario.GetEstatusVentaPorSurtir(CveVentaVieja) Then If ObjInventario.EsDevolucionVenta = 2 Then Return True End If @@ -13285,12 +13288,12 @@ Partial Class Ventas Dim CveUnidad As Integer = MovDet("CveUM").ToString.ToEntero Dim PU As Decimal = MovDet("PU").ToString.ToDecimal Dim CveProducto As Integer = MovDet("CvePS").ToString.ToEntero - Dim SerieLote As String = MovDet("SerieLote").ToString + Dim Serie As String = MovDet("Serie").ToString Dim CveVentaDetalle = MovDet("CveVentaDetalle").ToString.ToEntero 'Entrada - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioEntrada, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=SerieLote, CveVentaDetalle:=CveVentaDetalle) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioEntrada, Cantidad, CveUnidad, CveProducto, PU, Serie:=Serie, CveVentaDetalle:=CveVentaDetalle) Then OcurrioError = True Exit For End If @@ -13298,7 +13301,7 @@ Partial Class Ventas 'Salida CveVentaDetalle = ObjInventario.VentaDetallePadreGet(CveVentaDetalle).ToString.ToEntero If CveVentaDetalle > 0 Then - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioSalida, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=SerieLote, CveVentaDetalle:=CveVentaDetalle) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioSalida, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Serie, CveVentaDetalle:=CveVentaDetalle) Then OcurrioError = True Exit For End If @@ -16223,7 +16226,7 @@ Partial Class Ventas Dim CveUnidad As Integer = MovDet("CveUM").ToString.ToEntero Dim PU As Decimal = MovDet("PU").ToString.ToDecimal Dim CveProducto As Integer = MovDet("CvePS").ToString.ToEntero - Dim SerieLote As String = MovDet("SerieLote").ToString + Dim Serie As String = MovDet("Serie").ToString Dim Consec As Integer = DtRemisionesTmpDT.FiltroPrimeroValor("Consec", $"CveVentaDetalle = {MovDet("CveVentaDetalle").ToString}").ToEntero 'COMIENZA: VENTADETALLE @@ -16249,7 +16252,7 @@ Partial Class Ventas CveMovimientoDetalleEntrada = MovDet("CveMovimientoDetalle").ToString.ToEntero End If - If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, SerieLote:=SerieLote, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then + If ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Serie, CveVentaDetalle:=CveVentaDetalle, CveMovimientoDetalleEntrada:=CveMovimientoDetalleEntrada) Then ContadorMovtosDetalles += 1 Else OcurrioError = True @@ -17364,7 +17367,7 @@ Partial Class Ventas Dim DrProducto As DataRow = Nothing If TxtCantidad.Text.Trim.ToDouble <= 0 Then TxtCantidad.Text = "1" - Dim SerieLote As String = "" + Dim Serie As String = "" Dim CodigoBarras As String = "" Dim CvePS As Integer @@ -17373,10 +17376,10 @@ Partial Class Ventas 'BUSCA POR SERIE E IGNORA CODIGO DE BARRAS (LIMPIA) If TxtCodigoSerie.Text.Trim <> "" Then - SerieLote = TxtCodigoSerie.Text.Trim().ToUpper() + Serie = TxtCodigoSerie.Text.Trim().ToUpper() Dim Objinventarios As New ClsInventarios - Dim Existencia = Objinventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, -1, SerieLote:=SerieLote, ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero) - Dim ExistenciaActual = DtInv.SUM("Cantidad", String.Format("SerieLote = '{0}'", SerieLote)) + Dim Existencia = Objinventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, -1, Serie:=Serie, ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero) + Dim ExistenciaActual = DtInv.SUM("Cantidad", String.Format("Serie = '{0}'", Serie)) CvePS = Objinventarios.CvePS Objinventarios.Dispose() @@ -17387,11 +17390,11 @@ Partial Class Ventas HdnCvePS.Value = CvePS.ToString TxtCantidad.Text = "1" Else - Alert($"No se encontró un producto con la serie: {SerieLote}. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia) + Alert($"No se encontró un producto con la serie: {Serie}. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia) End If End If Else - Alert(String.Format("No hay existencia suficiente del producto con la Serie: {0}. Por favor rectifique y vuelva a intentar", SerieLote), TipoMensaje.MsgAdvertencia) + Alert(String.Format("No hay existencia suficiente del producto con la Serie: {0}. Por favor rectifique y vuelva a intentar", Serie), TipoMensaje.MsgAdvertencia) TxtCodigoSerie.Focus() RegistraScript($"$('#{TxtCodigoSerie.ClientID}').select();") Exit Sub @@ -17404,7 +17407,7 @@ Partial Class Ventas CodigoBarras = TxtCodigoBarras.Text.Trim() DrProducto = GlobalDTPS(UsuarioActual.CveEmpresa).FiltroPrimero($"CodigoBarras = '{CodigoBarras}'") If DrProducto IsNot Nothing Then - If DrProducto("Inv_CveMetodoInventario").ToString = "5" Then 'si es serielote + If DrProducto("Inv_CveMetodoInventario").ToString = "5" Then 'si es serie TxtCodigoSerie.Focus() Exit Sub Else @@ -17414,7 +17417,7 @@ Partial Class Ventas Else TxtCodigoBarras.Focus() RegistraScript($"$('#{TxtCodigoBarras.ClientID}').select();") - Alert($"No se encontró un producto con el código de barras: {SerieLote}. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia) + Alert($"No se encontró un producto con el código de barras: {Serie}. Por favor verifique y vuelva a intentar ", TipoMensaje.MsgAdvertencia) Exit Sub End If End If @@ -18031,8 +18034,8 @@ Partial Class Ventas 'SIN EXISTENCIA If Gvr.FCTextBox("TxtSerie").Visible = True And Gvr.FCTextBox("TxtSerie").Text.Trim <> "" Then - Existencia = ObjInventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, ddlAlmacen.SelectedValue.ToEntero, SerieLote:=Gvr.FCTextBox("TxtSerie").Text.ToString, ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) - ExistenciaActual = DtInv.SUM("Cantidad", String.Format("SerieLote = '{0}'", Gvr.FCTextBox("TxtSerie").Text.Trim)) + Existencia = ObjInventarios.GetExistenciasPS(-1, -1, UsuarioActual.CveEmpresa, ddlAlmacen.SelectedValue.ToEntero, Serie:=Gvr.FCTextBox("TxtSerie").Text.ToString, ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) + ExistenciaActual = DtInv.SUM("Cantidad", String.Format("Serie = '{0}'", Gvr.FCTextBox("TxtSerie").Text.Trim)) 'Valida Existencia If Existencia - ExistenciaActual < 0 Then @@ -18230,13 +18233,13 @@ Partial Class Ventas DtTemporal.Columns.Add("Lote", Type.GetType("System.String")) End If - If Not DtTemporal.Columns.Contains("Batch") Then - DtTemporal.Columns.Add("Batch", Type.GetType("System.String")) + If Not DtTemporal.Columns.Contains("FechaCaducidad") Then + DtTemporal.Columns.Add("FechaCaducidad", Type.GetType("System.DateTime")) End If GvInv.Columns(4).Visible = DtTemporal.MAX("SerieLote", "SerieLote <> ''") <> "" Or CveVenta <= 0 GvInv.Columns(5).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> "" - GvInv.Columns(6).Visible = DtTemporal.MAX("Lote", "Lote <> ''") <> "" + GvInv.Columns(6).Visible = DtTemporal.MAX("FechaCaducidad", "FechaCaducidad <> ''") <> "" GvInv.DataSource = DtTemporal GvInv.DataBind() @@ -19926,7 +19929,7 @@ Partial Class Ventas End If For Each dr As DataRow In ObjInventarios.DtResultados.FiltraParametros($"ExistenciaPedido > 0 {Filtro}").Rows AgregarProductoServicio(dr("Cantidad").ToString.ToDecimal, dr("CveUM").ToString.ToEntero, dr("UnidadMedida").ToString, dr("CveClasificacion").ToString.ToEntero, dr("Clasificacion").ToString, - dr("CvePS").ToString.ToEntero, dr("PS").ToString, dr("SerieLote").ToString, dr("PU").ToString.ToDecimal, 0.0D, + dr("CvePS").ToString.ToEntero, dr("PS").ToString, dr("Serie").ToString, dr("PU").ToString.ToDecimal, 0.0D, dr("CveProyecto").ToString.ToEntero, dr("Proyecto").ToString, dr("CveSubProyecto").ToString.ToEntero, dr("SubProyecto").ToString, CveMovimientoDetallePedido:=dr("CveMovimientoDetalle").ToString.ToEntero) Next @@ -20432,12 +20435,12 @@ Partial Class Ventas If Dr("CveTipoInvPS").ToString.ToEntero = 5 Then For Each Dr2 As DataRow In DtContratosSerieDetalle.FiltraParametros($"ConsecId = {Dr("CveContratoDetalle")}").Rows - Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, factura.CveEmpresa, CveAlmacenExistenciasContrato, SerieLote:=Dr2("Serie").ToString, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) + Existencia = ObjInventario.GetExistenciasPS(CveProducto, CveUnidad, factura.CveEmpresa, CveAlmacenExistenciasContrato, Serie:=Dr2("Serie").ToString, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, ExcluyeAdelantado:=1, RestringirAlmacenes:=1, ExcluyeApartados:=1) If Existencia < 1 Then Return False End If - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaConsignacion, 1, CveUnidad, CveProducto, 0, -1, SerieLote:=Dr2("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaConsignacion, 1, CveUnidad, CveProducto, 0, -1, Serie:=Dr2("Serie").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then Return False End If Next @@ -20462,7 +20465,7 @@ Partial Class Ventas If CveMovimientoEntradaGeneral > 0 Then If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaConsignacion, UsuarioActual.CveEmpresa) Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, Dr("CveSeccionAlmacen").ToString.ToEntero, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then Return False End If Next @@ -20476,7 +20479,7 @@ Partial Class Ventas If CveMovimientoEntradaGeneral > 0 Then If ObjInventario.GetMovimientosDetalle(CveMovimientoSalidaConsignacion, UsuarioActual.CveEmpresa) Then For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, Dr("CveSeccionAlmacen").ToString.ToEntero, Dr("SerieLote").ToString, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then + If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaGeneral, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then Return False End If Next @@ -20612,7 +20615,7 @@ Partial Class Ventas End If 'VERIFICA EXISTENCIAS - Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerieLote, CveUMSerieLote, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), SerieLote:=SerieRow) + Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerieLote, CveUMSerieLote, UsuarioActual.CveEmpresa, CveAlmacenExistenciasContrato, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Serie:=SerieRow) If Existencia < 1 Then MensajeSinExistencias.Append($"Serie: {SerieRow}.
") Continue For @@ -20952,6 +20955,7 @@ Partial Class Ventas Count = +1 Next End If + DtDocumentacionCliente(IndexDocumentoCliente)("RutaArchivo") = fileItem.FileUrl DtDocumentacionCliente(IndexDocumentoCliente)("UpArchivo") = "1" @@ -21989,6 +21993,7 @@ Partial Class Ventas End If End If + Dim ImpuestoTolerancia As Decimal = 0.01D ' SI EXCEDE ESA DIFERENCIA, AJUSTA EL IMPUESTO Dim query = From dr In DtImpuestos Group By PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal, @@ -21999,14 +22004,29 @@ Partial Class Ventas Select ImportePU = x.Sum(Function(s) s("ImportePU").ToString.ToDecimal), ImporteTotal = x.Sum(Function(s) s("ImporteTotal").ToString.ToDecimal), ImporteIVA = x.Sum(Function(s) (s("ImporteIVA").ToString.ToDecimal)).RoundSQL(2), ' Math.Round(s("ImporteIVA").ToString.ToDecimal, 2)) * (1 + PorcentajeIEPS) * PorcentajeIVA, - ImporteRetIVA = x.Sum(Function(s) Math.Round(s("ImporteRetIVA").ToString.ToDecimal, 2)),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetIVA, - ImporteRetISR = x.Sum(Function(s) Math.Round(s("ImporteRetISR").ToString.ToDecimal, 2)),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetISR, - ImporteIEPS = x.Sum(Function(s) Math.Round(s("ImporteIEPS").ToString.ToDecimal, 2)), 'Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeIEPS, + ImporteIVACalculado = (x.Sum(Function(s) (s("ImportePU").ToString.ToDecimal) * PorcentajeIVA)).RoundSQL(2), + ImporteRetIVA = x.Sum(Function(s) s("ImporteRetIVA").ToString.ToDecimal).RoundSQL(2),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetIVA, + ImporteRetISR = x.Sum(Function(s) s("ImporteRetISR").ToString.ToDecimal).RoundSQL(2),' Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeRetISR, + ImporteIEPS = x.Sum(Function(s) s("ImporteIEPS").ToString.ToDecimal).RoundSQL(2), 'Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeIEPS, + ImporteIEPSCalculado = (x.Sum(Function(s) s("ImportePU").ToString.ToDecimal) * PorcentajeIEPS).RoundSQL(2), 'Math.Round(s("ImportePU").ToString.ToDecimal, 2)) * PorcentajeIEPS, PorcentajeIVA = PorcentajeIVA, PorcentajeRetIVA = PorcentajeRetIVA, PorcentajeRetISR = PorcentajeRetISR, PorcentajeIEPS = PorcentajeIEPS - '(1 + DrPS("IEPSPorcentaje").ToString.ToDecimal) + 'codigo para ajustar tolerancia. + Dim Impuesto = From dd In query + Select PorcentajeIEPS = dd.PorcentajeIEPS, + PorcentajeIVA = dd.PorcentajeIVA, + PorcentajeRetISR = dd.PorcentajeRetISR, + PorcentajeRetIVA = dd.PorcentajeRetIVA, + ImportePU = dd.ImportePU, + ImporteTotal = dd.ImporteTotal, + ImporteIVA = If((dd.ImporteIVA - dd.ImporteIVACalculado).Abs >= ImpuestoTolerancia, dd.ImporteIVACalculado, dd.ImporteIVA), + ImporteRetIVA = dd.ImporteRetIVA, + ImporteRetISR = dd.ImporteRetISR, + ImporteIEPS = If((dd.ImporteIEPS - dd.ImporteIEPSCalculado).Abs >= ImpuestoTolerancia, dd.ImporteIEPSCalculado, dd.ImporteIEPS) + Order By PorcentajeIVA, PorcentajeIEPS + 'hay una condicion de verificacion arriba, en la que checa si la diferencia en ieps, es menor a 3 centavos, toma el valor recalculado Dim DrSubProyecto = GlobalDTSubProyectos(-1, TmpDT.FiltroPrimeroValor("CveSubProyecto", "", "ImporteTotal DESC").ToEntero, UsuarioActual.CveEmpresa, -1).FiltroPrimero("") If DrSubProyecto Is Nothing Then @@ -22014,7 +22034,7 @@ Partial Class Ventas Exit Sub End If - DtImpuestos = query.QueryToDataTable(False) + DtImpuestos = Impuesto.QueryToDataTable(False) If Not NCDescuento Then LimpiaDocumentoNC() @@ -22035,7 +22055,7 @@ Partial Class Ventas AgregaTempDT(TmpDTDescNC, DrPS("CvePS").ToString.ToEntero, DrPS("PS").ToString, DrPS("Codigo").ToString, DrPS("PSCodigo").ToString, DrPS("CveTipoPS").ToString.ToEntero, DrPS("Inv_CveMetodoInventario").ToString.ToEntero, DrPS("CveUM").ToString.ToEntero, DrPS("UnidadMedida").ToString, DrPS("CveClasificacion").ToString.ToEntero, DrPS("Clasificacion").ToString, CveProyecto, Proyecto, CveSubProyecto, SubProyecto, TxtNCObservaciones.Text.Trim, 1, Dr("ImportePU").ToString.ToDecimal, Dr("PorcentajeIVA").ToString.ToDecimal, Dr("ImporteIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("ImporteRetIVA").ToString.ToDecimal, - Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("ImporteRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("ImporteIEPS").ToString.ToDecimal, -1, 0.0, Dr("ImporteTotal").ToString.ToDecimal, "", "", -1, -1, + Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("ImporteRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("ImporteIEPS").ToString.ToDecimal, -1, 0.0, Dr("ImportePU").ToString.ToDecimal, "", "", -1, -1, DrPS("SATClavePS").ToString, DrPS("SATClaveUnidadMedida").ToString, -1, -1, -1, -1, -1, -1) Next @@ -22149,8 +22169,8 @@ Partial Class Ventas End If For Each Dr As DataRow In DtImpuestosLocal.Rows - FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA").ToString.ToDecimal, Dr("PorcentajeRetIVA").ToString.ToDecimal, Dr("PorcentajeRetISR").ToString.ToDecimal, Dr("PorcentajeIEPS").ToString.ToDecimal, Dr("CveSubProyecto")) - importePuTemp = (Porcentaje * (TmpDT.SUM("TotalImporte", FiltroStr).ToDecimal() - TmpDT.SUM("Descuento", FiltroStr).ToDecimal())) + FiltroStr = String.Format("ISNULL(PorcentajeIVA,0) = {0} AND ISNULL(PorcentajeRetIVA,0) = {1} AND ISNULL(PorcentajeRetISR,0) = {2} AND ISNULL(PorcentajeIEPS,0) = {3} AND ISNULL(CveSubProyecto,0) = {4} ", Dr("PorcentajeIVA"), Dr("PorcentajeRetIVA"), Dr("PorcentajeRetISR"), Dr("PorcentajeIEPS"), Dr("CveSubProyecto")) + importePuTemp = (Porcentaje * (TmpDT.SUMD("TotalImporte", FiltroStr) - TmpDT.SUMD("Descuento", FiltroStr))) If Not AplicaImpuestosLocales Then importePuTemp = importePuTemp - TotalImpuestosLocales From ba4d3b4937938fa29890f8b5265bdf487295edb6 Mon Sep 17 00:00:00 2001 From: rrene Date: Wed, 13 May 2020 12:42:30 -0700 Subject: [PATCH 7/7] cambios en SeccionesAlmacen,Serie,Lote,Caducidad --- Compras/EvaluacionProveedor.aspx.vb | 2 +- Inventarios/CatSeccionesAlmacenes.aspx.vb | 10 +- Inventarios/KardexSeccionAlmacen.aspx | 140 - Inventarios/KardexSeccionAlmacen.aspx.vb | 337 - Inventarios/RecepcionEntrega.aspx | 1032 -- Inventarios/RecepcionEntrega.aspx.vb | 3112 ---- Ventas/Clientes.aspx.vb | 18654 ++++++++++---------- 7 files changed, 9333 insertions(+), 13954 deletions(-) delete mode 100644 Inventarios/KardexSeccionAlmacen.aspx delete mode 100644 Inventarios/KardexSeccionAlmacen.aspx.vb delete mode 100644 Inventarios/RecepcionEntrega.aspx delete mode 100644 Inventarios/RecepcionEntrega.aspx.vb diff --git a/Compras/EvaluacionProveedor.aspx.vb b/Compras/EvaluacionProveedor.aspx.vb index b842df48b..dfb5f0047 100644 --- a/Compras/EvaluacionProveedor.aspx.vb +++ b/Compras/EvaluacionProveedor.aspx.vb @@ -334,7 +334,7 @@ Partial Class Compras_EvaluacionProveedor ListaTagsDocumentost.Add(New TagsDocumentos("{{Proveedor}}", Proveedor)) ListaTagsDocumentost.Add(New TagsDocumentos("{{Dia}}", Dia)) ListaTagsDocumentost.Add(New TagsDocumentos("{{Mes}}", Mes)) - ListaTagsDocumentost.Add(New TagsDocumentos("{{Anio}}", Now.Year)) + ListaTagsDocumentost.Add(New TagsDocumentos("{{Anio}}", Now.Year.ToString)) ListaTagsDocumentost.Add(New TagsDocumentos("{{Calificacion}}", Calificacion)) ListaTagsDocumentost.Add(New TagsDocumentos("{{Resultado}}", Resultado)) 'ListaTagsDocumentost.Add(New TagsDocumentos("{{Usuario}}", UsuarioActual.Nombre)) diff --git a/Inventarios/CatSeccionesAlmacenes.aspx.vb b/Inventarios/CatSeccionesAlmacenes.aspx.vb index 3cbca21f3..15091d1ca 100644 --- a/Inventarios/CatSeccionesAlmacenes.aspx.vb +++ b/Inventarios/CatSeccionesAlmacenes.aspx.vb @@ -29,9 +29,9 @@ Partial Class Inventarios_CatSeccionesAlmacenes Public Sub CargaDatos() Dim ObjSeccion As New ClsInventarios - If ObjSeccion.GetSeccionesAlmacenes(-1) Then + If ObjSeccion.GetSeccionesAlmacenes(-1, -1) Then ViewState("DTSeccionesAlmacenes") = ObjSeccion.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTSeccionAlmacen(-1) = ObjSeccion.DtResultados + GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, -1) = ObjSeccion.DtResultados Else GvDatos.DataSource = Nothing End If @@ -62,7 +62,7 @@ Partial Class Inventarios_CatSeccionesAlmacenes Alert("La Seccion se guardó correctamente.", TipoMensaje.MsgInformacion) ViewState("DTSeccionesAlmacenes") = ObjSeccion.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTSeccionAlmacen(-1) = ObjSeccion.DtResultados + GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, -1) = ObjSeccion.DtResultados If ViewState("Orden").ToString() <> String.Empty Then CargaGrid(ViewState("Orden").ToString()) @@ -108,7 +108,7 @@ Partial Class Inventarios_CatSeccionesAlmacenes DdlAlmacen.SelectedIndex = 0 Alert("La Seccion se actualizo correctamente.", TipoMensaje.MsgInformacion) ViewState("DTSeccionesAlmacenes") = ObjSeccion.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTSeccionAlmacen(-1) = ObjSeccion.DtResultados + GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, -1) = ObjSeccion.DtResultados End If ObjSeccion.Dispose() @@ -134,7 +134,7 @@ Partial Class Inventarios_CatSeccionesAlmacenes If ObjSeccion.RemoveSeccion(GvRow.DataKey("CveSeccion").ToString.ToEntero) Then Alert("La Seccion se elimino correctamente.", TipoMensaje.MsgInformacion) ViewState("DTSeccionesAlmacenes") = ObjSeccion.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - GlobalDTSeccionAlmacen(-1) = ObjSeccion.DtResultados + GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa, -1) = ObjSeccion.DtResultados End If ObjSeccion.Dispose() If ViewState("Orden").ToString() <> String.Empty Then diff --git a/Inventarios/KardexSeccionAlmacen.aspx b/Inventarios/KardexSeccionAlmacen.aspx deleted file mode 100644 index ff55a29ce..000000000 --- a/Inventarios/KardexSeccionAlmacen.aspx +++ /dev/null @@ -1,140 +0,0 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="KardexSeccionAlmacen.aspx.vb" Inherits="Inventarios_KardexSeccionAlmacen" %> - - - - - - - Kardex Secciones de Almacen - - - - - - - - - - - -
-
-
- - -
-
-
- -
- -
- -
- - -
- -
- - -
-
-
-
-
-
-
-
-
- - - -
- " style="display: inline-block; margin-right: -20px; width: 150px;" /> - " style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"> -
- - - - - - - - - - - - -
-
- - <%--SECCION DE ALMACEN--%> - -
- - - diff --git a/Inventarios/KardexSeccionAlmacen.aspx.vb b/Inventarios/KardexSeccionAlmacen.aspx.vb deleted file mode 100644 index d242ead2e..000000000 --- a/Inventarios/KardexSeccionAlmacen.aspx.vb +++ /dev/null @@ -1,337 +0,0 @@ -Option Strict On -Imports System.Data -Imports System.Collections.Generic -Imports System.Linq -Imports System.Web -Imports System.Web.UI.WebControls -Imports Extensiones -Partial Class Inventarios_KardexSeccionAlmacen - Inherits ClsPaginas - - -#Region "PROPIEDADES" - - Private Property DtSeccionAlmacen As DataTable - Get - Return CType(ViewState("DtSeccionAlmacen"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtSeccionAlmacen") = value - End Set - End Property - Private Property CantidadTotal As Decimal - Get - Return CType(ViewState("CantidadTotal"), Decimal) - End Get - Set(value As Decimal) - ViewState("CantidadTotal") = value - End Set - End Property - Private Property CvePS As Integer - Get - Return CType(ViewState("CvePS"), Integer) - End Get - Set(value As Integer) - ViewState("CvePS") = value - End Set - End Property - Private Property CveSeccionAlmacenOrigen As Integer - Get - Return CType(ViewState("CveSeccionAlmacenOrigen"), Integer) - End Get - Set(value As Integer) - ViewState("CveSeccionAlmacenOrigen") = value - End Set - End Property - Private Property SeccionAlmacenOrigen As String - Get - Return CType(ViewState("SeccionAlmacenOrigen"), String) - End Get - Set(value As String) - ViewState("SeccionAlmacenOrigen") = value - End Set - End Property - Private Property CveAlmacen As Integer - Get - Return CType(ViewState("CveAlmacen"), Integer) - End Get - Set(value As Integer) - ViewState("CveAlmacen") = value - End Set - End Property - Private Property CveUM As Integer - Get - Return CType(ViewState("CveUM"), Integer) - End Get - Set(value As Integer) - ViewState("CveUM") = value - End Set - End Property - Private Property CveSubProyecto As Integer - Get - Return CType(ViewState("CveSubProyecto"), Integer) - End Get - Set(value As Integer) - ViewState("CveSubProyecto") = value - End Set - End Property - Private Property SerieLote As String - Get - Return CType(ViewState("SerieLote"), String) - End Get - Set(value As String) - ViewState("SerieLote") = value - End Set - End Property - - -#End Region - - Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load - If Not IsPostBack Then - InicializaValores() - End If - End Sub - -#Region "CARGAS" - - Private Sub InicializaValores() - CantidadTotal = 0 - SeccionAlmacenOrigen = "" - CvePS = 0 - CveAlmacen = 0 - CveSeccionAlmacenOrigen = 0 - CveSubProyecto = 0 - CveUM = 0 - SerieLote = "" - - CreaDtSeccionAlmacen() - CargaDdlAlmacen() - CargaPS() - End Sub - - Private Sub CargaPS() - DdlPS.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") - - If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then - DdlPS.ddlWS.Attributes.Add("data-cveclasificacion", "-1") - DdlPS.SelectedText = "Seleccione" - DdlPS.SelectedValue = "-1" - Else - DdlPS.ddl.Items.Clear() - DdlPS.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) - DdlPS.ddl.DataBind() - DdlPS.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) - End If - End Sub - - Private Sub CargaDdlAlmacen() - DdlAlmacen.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa) - DdlAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlAlmacen.DataBind() - - DdlSeccionAlmacen.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa) - DdlSeccionAlmacen.Items.Insert(0, New ListItem("Todos", "-1")) - DdlSeccionAlmacen.DataBind() - - DdlSeccionAlmacenDestino.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa) - DdlSeccionAlmacenDestino.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlSeccionAlmacenDestino.DataBind() - End Sub - - Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) - CargaDatos() - End Sub - - Private Sub CargaDatos() - If Not DdlPS.SelectedValue.ToEntero > 0 Then - Alert("Tiene que seleccionar un producto/servicio.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - If Not DdlAlmacen.SelectedValue.ToEntero > 0 Then - Alert("Tiene que seleccionar un alamacen.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim ObjInv As New ClsInventarios - If ObjInv.GetKardexSeccionAlmacen(DdlPS.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, DdlSeccionAlmacen.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then - GvDatos.DataSource = ObjInv.DtResultados - End If - ObjInv.Dispose() - GvDatos.DataBind() - UpDatos.Update() - End Sub - -#End Region - - -#Region "SECCION ALMACEN" - Private Sub CreaDtSeccionAlmacen() - DtSeccionAlmacen = New DataTable - DtSeccionAlmacen.Columns.Add("CantidadSeccionAlmacen", GetType(Decimal)) - DtSeccionAlmacen.Columns.Add("CveSeccionAlmacenOrigen", GetType(Integer)) - DtSeccionAlmacen.Columns.Add("CveSeccionAlmacenDestino", GetType(Integer)) - DtSeccionAlmacen.Columns.Add("SeccionAlmacenOrigen", GetType(String)) - DtSeccionAlmacen.Columns.Add("SeccionAlmacenDestino", GetType(String)) - DtSeccionAlmacen.Columns.Add("Consec", GetType(Integer)) - End Sub - - Protected Sub LnkSeccionAlmacen_Click(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - DtSeccionAlmacen.Rows.Clear() - CantidadTotal = gvRow.DataKey("Existencia").ToDecimal - CveSeccionAlmacenOrigen = gvRow.DataKey("CveAlmacenSeccion").ToEntero - SeccionAlmacenOrigen = gvRow.DataKey("AlmacenSeccion").ToString - CvePS = gvRow.DataKey("CvePS").ToEntero - SerieLote = gvRow.DataKey("SerieLote").ToString - CveAlmacen = gvRow.DataKey("CveAlmacen").ToEntero - CveUM = gvRow.DataKey("CveUM").ToEntero - CveSubProyecto = gvRow.DataKey("CveSubProyecto").ToEntero - RegistraScript("$('#DModalSeccionAlmacen').modal()") - CargaSeccionAlmacen() - End Sub - - Protected Sub LnkAddSeccionAlmacen_Click(sender As Object, e As EventArgs) - - Dim ObjInv As New ClsInventarios - Dim CantidadDisponible As Decimal = 0 - If ObjInv.GetMovimientosDetalleSeccionesAlmacen(CveSeccionAlmacenOrigen, CveAlmacen, CvePS, UsuarioActual.CveEmpresa) Then - If ObjInv.DtResultados.Rows.Count > 0 Then - CantidadDisponible = ObjInv.DtResultados.Rows(0)("CantidadRestante").ToString.ToDecimal - End If - End If - ObjInv.Dispose() - - CantidadDisponible -= DtSeccionAlmacen.SUMD("CantidadSeccionAlmacen") - - If TxtCantidadSeccion.Text.ToDecimal > CantidadDisponible Then - Alert($"No tiene cantidad de producto suficiente en esta seccion de almacen, su cantidad restante es: {CantidadDisponible}", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim Row As DataRow = Nothing - DtSeccionAlmacen.AcceptChanges() - Row = DtSeccionAlmacen.NewRow - Row("CantidadSeccionAlmacen") = TxtCantidadSeccion.Text.ToDecimal - Row("CveSeccionAlmacenOrigen") = CveSeccionAlmacenOrigen - Row("SeccionAlmacenOrigen") = SeccionAlmacenOrigen - Row("CveSeccionAlmacenDestino") = DdlSeccionAlmacenDestino.SelectedValue.ToEntero - Row("SeccionAlmacenDestino") = DdlSeccionAlmacenDestino.SelectedItem.Text - Row("Consec") = DtSeccionAlmacen.Rows.Count + 1 - DtSeccionAlmacen.Rows.Add(Row) - DtSeccionAlmacen.AcceptChanges() - CargaSeccionAlmacen() - End Sub - - Protected Sub LnkEliminarSeccion_Click(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - Dim Index As Integer = 0 - For Each Dr As DataRow In DtSeccionAlmacen.Rows - If Dr("Consec").ToString.ToEntero = gvRow.DataKey("Consec").ToEntero() Then - Exit For - End If - Index += 1 - Next - DtSeccionAlmacen.Rows.RemoveAt(Index) - DtSeccionAlmacen.AcceptChanges() - CargaSeccionAlmacen() - End Sub - - Private Sub CargaSeccionAlmacen() - Dim CantidadTotalSeccion As Decimal = DtSeccionAlmacen.SUMD("CantidadSeccionAlmacen") - GvSeccion.DataSource = DtSeccionAlmacen - GvSeccion.DataBind() - - TxtCantidadSeccion.Text = "" - DdlSeccionAlmacenDestino.SelectedIndex = 0 - Dim CantidadRestante As Decimal = CantidadTotal - CantidadTotalSeccion - If CantidadRestante = 0 Then - RVTxtCantidad.MaximumValue = "1" - TxtCantidadSeccion.Enabled = False - Else - RVTxtCantidad.MaximumValue = CantidadRestante.ToString - TxtCantidadSeccion.Enabled = True - End If - - UpModalSeccionAlmacen.Update() - End Sub - - Protected Sub BtnTraspasar_Click(sender As Object, e As EventArgs) - Dim ObjInv As New ClsInventarios - ObjInv.IniciaTransacSQL() - Dim TieneError As Boolean = False - Dim MensajeError As String = "" - - 'SALIDA - Dim CveMovimientoSalida As Integer = ObjInv.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 3, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, CveSubProyecto, -1, CveAlmacenDestino:=CveAlmacen) - - If CveMovimientoSalida <= 0 Then - TieneError = True - MensajeError = "Ocurrió un error al guardar el movimiento de salida. Por favor vuelva a intentar." - End If - - Dim Cantidad As Decimal = DtSeccionAlmacen.SUMD("CantidadSeccionAlmacen") - - If Not ObjInv.AddMovimientoDetalle(CveMovimientoSalida, Cantidad, CveUM, CvePS, 0, -1, SerieLote:=SerieLote) Then - MensajeError = "Ocurrió un error al guardar los detalles del movimiento de salida. Por favor vuelva a intentar." - TieneError = True - Else - If ObjInv.CveMovimientoDetalle > 0 AndAlso DtSeccionAlmacen.Rows.Count > 0 Then - For Each Dr2 As DataRow In DtSeccionAlmacen.Rows - If Not ObjInv.AddMovimientosDetalleSeccionesAlmacen(ObjInv.CveMovimientoDetalle, Dr2("CveSeccionAlmacenOrigen").ToString.ToEntero, -Dr2("CantidadSeccionAlmacen").ToString.ToDecimal) Then - TieneError = True - MensajeError = "Ocurrió un error al procesar las secciones de almacen. Por favor vuelva a intentar." - Exit For - End If - Next - End If - End If - - 'ENTRADA - If Not TieneError Then - Dim CveMovimientoEntrada As Integer = ObjInv.AddMovimiento(CveAlmacen, 2, 1, Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, CveSubProyecto, -1, CveMovimientoRelacionado:=CveMovimientoSalida) - - If CveMovimientoEntrada <= 0 Then - MensajeError = "Ocurrió un error al guardar el movimiento de entrada correctamente. Por favor vuelva a intentar." - TieneError = True - Else - If ObjInv.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - For Each Dr As DataRow In ObjInv.DtResultados.Rows - If Not ObjInv.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, Dr("Observaciones").ToString) Then - TieneError = True - MensajeError = "Ocurrió un error al guardar los movimientos de entrada" - Exit For - Else - If ObjInv.CveMovimientoDetalle > 0 AndAlso DtSeccionAlmacen.Rows.Count > 0 Then - For Each Dr2 As DataRow In DtSeccionAlmacen.Rows - If Not ObjInv.AddMovimientosDetalleSeccionesAlmacen(ObjInv.CveMovimientoDetalle, Dr2("CveSeccionAlmacenDestino").ToString.ToEntero, Dr2("CantidadSeccionAlmacen").ToString.ToDecimal) Then - TieneError = True - MensajeError = "Ocurrió un error al procesar las secciones de almacen. Por favor vuelva a intentar." - Exit For - End If - Next - End If - End If - Next - End If - End If - End If - - If Not TieneError Then - ObjInv.Commit() - Alert("El traspaso se ha hecho correctamente") - CargaDatos() - RegistraScript("$('#DModalSeccionAlmacen').modal('hide')") - Else - ObjInv.RollBack() - Alert(MensajeError, TipoMensaje.MsgError) - End If - - End Sub - -#End Region - - - -End Class diff --git a/Inventarios/RecepcionEntrega.aspx b/Inventarios/RecepcionEntrega.aspx deleted file mode 100644 index 91f95119b..000000000 --- a/Inventarios/RecepcionEntrega.aspx +++ /dev/null @@ -1,1032 +0,0 @@ -<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RecepcionEntrega.aspx.vb" Inherits="Inventarios_RecepcionEntrega" %> - - - - - - - - Entrega Almacén (Surtir Mercancia) - - - - -
  • -   -
  • -
    - - - - <%--FILTROS--%> - - - -
    -
    -
    -
      -
    • Cliente: - - <%----%> -
    • -
    • Serie-Folio: - - - -
    • -
    -
    -
    - - <%----%> -
    -
    - -
    -
    -
    -
    - - - -
    - -
    - - <%--DATOS DE LA VENTA--%> -
    - - -
    -
    -
    -
    - - Venta a surtir -
    -
    -
    -
    -
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - - - -
    Cliente: - -
    Folio: - - <%----%> -
    Observaciones Grales: - -
    Observaciones Almacén: - -
    -
    -
    -
    -
    -
    -
    - - - <%--DATOS DEL MOVIMIENTO--%> -
    - - -
    -
    -
    -
    - - Datos del movimiento -
    -
    -
    -
    -
    -
    - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    Almacén: - - - -
    Fecha: -
    -
    - - - - - - - - - - - - -
    -
    -
    Guía: - -
    Observaciones: - -
    Transitorio: - -
    - -
    - -
    - -
    - - - -
    -
    -
    -
    -
    -
    -
    -
    - -
    - - - - -
    -
    - - <%--PENDIENTES DE SURTIR--%> -
    -
    -
    -
    - - Ventas por surtir -
    -
    -
    -
    -
    -
    - - - - -   - Sucursal: - - - - - - - - - - - - - - - - - -
    -
    -
    - - - - - - - - - - - - - - - - - - - - - - - - - -
    -
    -
    - - - <%--ADVERTENCIA--%> -
    -
    -
    - - Información: - -
    -
    -
    - <%--ADVERTENCIA--%> -
    -
    -
    - - Información: - -
    -
    -
    -
    - - - - - - - - - - - - - - -
    -
    -
    -
    -
    - -
    - - - -
    -
    -
    - - Salida de Inventario -
    -
    -
    -
    -
    -
    - -
    -
    -
    - - <%--AGREGAR POR CODIGO DE BARRAS--%> - - -
    -
    - - - - - - -
    - - - - - - - -
    -
    -
    -
    -
    - -
    -
    -
    - -
    -
    -
    - -
    -
    -
    - -
    -
    -
    - - <%--GV DATOS--%> - - - - - - - - - - - <%-- - - - - - - --%> - - - - - - - - - - - - <%----%> - <%-- - - -
    - -
    - - -
    -
    -
    - -
    - -
    -
    - -
    --%> - <%-- - - - - - --%> - <%----%> - - - - <%----%> - - - - - - - - - - - - - - - - - - - - - - -
    - - - - - - - - -
    -
    -
    - - - - - - -
    -
    - -
    -
    - -
    -
    - - - <%--BOTON GUARDAR--%> - - -
    - -
    -
    - -
    -
    -
    - - - <%--SECCION DE ALMACEN--%> - - - <%--AGREGA POR SERIE--%> - - - - - - - - <%--CANTIDAD ESPECIAL--%> - - - - - - - - - - - <%--CANTIDAD ESPECIAL 2--%> - - - - - - - <%--NUMERO DE GUIA--%> - - - - - - - - <%--MODAL SECCION ALMACEN--%> - - - - - - -
    - - - - - - - diff --git a/Inventarios/RecepcionEntrega.aspx.vb b/Inventarios/RecepcionEntrega.aspx.vb deleted file mode 100644 index 30413d05c..000000000 --- a/Inventarios/RecepcionEntrega.aspx.vb +++ /dev/null @@ -1,3112 +0,0 @@ -Option Strict On -Option Explicit On - -Imports System.Data -Imports System.IO -Imports System.Linq -Imports Extensiones - -Partial Class Inventarios_RecepcionEntrega - Inherits ClsPaginas - -#Region "PROPIEDADES" - Private Property CveVentaAD As Integer - Get - Return CType(ViewState("CveVentaAD"), Integer) - End Get - Set(value As Integer) - ViewState("CveVentaAD") = value - End Set - End Property - Private Property DtDatos As DataTable - Get - Return CType(ViewState("DtDatos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtDatos") = value - End Set - End Property - Private Property DtDatosDetalle As DataTable - Get - Return CType(ViewState("DtDatosDetalle"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtDatosDetalle") = value - End Set - End Property - Private Property DtDatosSugerencias As DataTable - Get - Return CType(ViewState("DtDatosSugerencias"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtDatosSugerencias") = value - End Set - End Property - Private Property DtDatosDetalleLote As DataTable - Get - Return CType(ViewState("DtDatosDetalleLote"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtDatosDetalleLote") = value - End Set - End Property - Private Property PSSerieLote As String - Get - Return CType(ViewState("PSSerieLote"), String) - End Get - Set(value As String) - ViewState("PSSerieLote") = value - End Set - End Property - Private Property CveConsecSerieLote As Integer - Get - Return CType(ViewState("CveConsecSerieLote"), Integer) - End Get - Set(value As Integer) - ViewState("CveConsecSerieLote") = value - End Set - End Property - Private Property CvePSSerieLote As Integer - Get - Return CType(ViewState("CvePSSerieLote"), Integer) - End Get - Set(value As Integer) - ViewState("CvePSSerieLote") = value - End Set - End Property - Private Property CveUMSerieLote As Integer - Get - Return CType(ViewState("CveUMSerieLote"), Integer) - End Get - Set(value As Integer) - ViewState("CveUMSerieLote") = value - End Set - End Property - Private Property EsInterno As Boolean - Get - Return CBool(If(ViewState("EsInterno") Is Nothing, 0, ViewState("EsInterno"))) - End Get - Set(value As Boolean) - ViewState("EsInterno") = value - End Set - End Property - Private Property CveMetodoInventarioLote As Integer - Get - Return CType(ViewState("CveMetodoInventarioLote"), Integer) - End Get - Set(value As Integer) - ViewState("CveMetodoInventarioLote") = value - End Set - End Property - Private Property CveVentaSurtir As Integer - Get - Return CType(ViewState("CveVentaSurtir"), Integer) - End Get - Set(value As Integer) - ViewState("CveVentaSurtir") = value - End Set - End Property - Private Property TipoEstatus As Integer - Get - Return CType(ViewState("TipoEstatus"), Integer) - End Get - Set(value As Integer) - ViewState("TipoEstatus") = value - End Set - End Property - Private Property CveContrato As Integer - Get - Return CType(ViewState("CveContrato"), Integer) - End Get - Set(value As Integer) - ViewState("CveContrato") = value - End Set - End Property - Private Property CveAlmacenTraspasoOrigen As Integer - Get - Return CType(ViewState("CveAlmacenTraspasoOrigen"), Integer) - End Get - Set(value As Integer) - ViewState("CveAlmacenTraspasoOrigen") = value - End Set - End Property - Private Property CveAlmacenTraspasoDestino As Integer - Get - Return CType(ViewState("CveAlmacenTraspasoDestino"), Integer) - End Get - Set(value As Integer) - ViewState("CveAlmacenTraspasoDestino") = value - End Set - End Property - Private Property TipoMovimiento As Integer - Get - Return CType(ViewState("TipoMovimiento"), Integer) - End Get - Set(value As Integer) - ViewState("TipoMovimiento") = value - End Set - End Property - Private Property TipoDocto As String - Get - Return CType(ViewState("TipoDocto"), String) - End Get - Set(value As String) - ViewState("TipoDocto") = value - End Set - End Property - Private Property DtExistencias As DataTable - Get - Return CType(ViewState("DtExistencias"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtExistencias") = value - End Set - End Property - Private Property RowIndexCantidadEspecial As Integer - Get - Return CType(ViewState("RowIndexCantidadEspecial"), Integer) - End Get - Set(value As Integer) - ViewState("RowIndexCantidadEspecial") = value - End Set - End Property - Private Property CantidadEspecialTemp As Decimal - Get - Return CType(ViewState("CantidadEspecialTemp"), Decimal) - End Get - Set(value As Decimal) - ViewState("CantidadEspecialTemp") = value - End Set - End Property - Private Property EsDevolucionVenta As Integer - Get - Return CType(ViewState("EsDevolucionVenta"), Integer) - End Get - Set(value As Integer) - ViewState("EsDevolucionVenta") = value - End Set - End Property - Private Property CveVendedor As Integer - Get - Return CType(ViewState("CveVendedor"), Integer) - End Get - Set(value As Integer) - ViewState("CveVendedor") = value - End Set - End Property - Private Property CveSubProyecto As Integer - Get - Return CType(ViewState("CveSubProyecto"), Integer) - End Get - Set(value As Integer) - ViewState("CveSubProyecto") = value - End Set - End Property - Private Property CveCliente As Integer - Get - Return CType(ViewState("CveCliente"), Integer) - End Get - Set(value As Integer) - ViewState("CveCliente") = value - End Set - End Property - Private Property CveMovimiento As Integer - Get - Return CType(ViewState("CveMovimiento"), Integer) - End Get - Set(value As Integer) - ViewState("CveMovimiento") = value - End Set - End Property - Private Property CveTraspasoSurtir As Integer - Get - Return CType(ViewState("CveTraspasoSurtir"), Integer) - End Get - Set(value As Integer) - ViewState("CveTraspasoSurtir") = value - End Set - End Property - Private Property TipoEntrega As Integer - Get - Return CType(ViewState("TipoEntrega"), Integer) - End Get - Set(value As Integer) - ViewState("TipoEntrega") = value - End Set - End Property - - Private Property DtSeccionAlmacen As DataTable - Get - Return CType(ViewState("DtSeccionAlmacen"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtSeccionAlmacen") = value - End Set - End Property - Private Property IndexSeccionAlmacen As Integer - Get - Return CType(ViewState("IndexSeccionAlmacen"), Integer) - End Get - Set(value As Integer) - ViewState("IndexSeccionAlmacen") = value - End Set - End Property - Private Property CantidadTotal As Decimal - Get - Return CType(ViewState("CantidadTotal"), Decimal) - End Get - Set(value As Decimal) - ViewState("CantidadTotal") = value - End Set - End Property - Private Property CvePS As Integer - Get - Return CType(ViewState("CvePS"), Integer) - End Get - Set(value As Integer) - ViewState("CvePS") = value - End Set - End Property - - Private Property EsDevolucionDirecta As Boolean - Get - Return CBool(If(ViewState("EsDevolucionDirecta") Is Nothing, 0, ViewState("EsDevolucionDirecta"))) - End Get - Set(value As Boolean) - ViewState("EsDevolucionDirecta") = value - End Set - End Property - -#End Region - - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then - - InicializaValores() - CargaParametrosAD() - - End If - End Sub - - -#Region " INICIALIZA VALORES " - Private Sub InicializaValores() - TipoEstatus = -1 - CveVendedor = -1 - CveCliente = -1 - CveSubProyecto = -1 - - DtDatosSugerencias = New DataTable - - Dim StrAlmacenes As String = "CveTipoAlmacen IN (1,2)" - - If (UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1") Then - DdlClientes.setEsWebService(True) - DdlClientes.Attributes.Add("data-metodo", "getcliente") - DdlClientes.SelectedText = "Todos" - DdlClientes.SelectedValue = "-1" - Else - DdlClientes.setEsWebService(False) - DdlClientes.ddl.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) - DdlClientes.ddl.DataBind() - DdlClientes.ddl.Items.Insert(0, New ListItem("Todos", "-1")) - End If - - If UsuarioActual.CveSubProyecto = 8804 Then - StrAlmacenes = "CveTipoAlmacen IN (1,2,12)" - End If - - DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros(StrAlmacenes) 'GlobalDTAlmacen(UsuarioActual.CveEmpresa) - DdlAlmacen.Items.Insert(0, New ListItem(" Seleccione ", "-1")) - DdlAlmacen.SelectedValue = "-1" - DdlAlmacen.DataBind() - DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen) - - DdlAlmacenTransitorio.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 3) - DdlAlmacenTransitorio.DataBind() - DdlAlmacenTransitorio.Items.Insert(0, New ListItem("Seleccione", "-1")) - - DdlFolio.Items.Insert(0, New ListItem("Seleccione", "-1")) - - TxtFechaPendientes.Text = Now.ToShortDateString - TxtFechaCaducidad.Text = Now.ToShortDateString - TxtFecha.Text = Now.ToShortDateString - RVFecha.MaximumValue = MaxFecha.ToShortDateString - If UsuarioActual.CveEmpresa.Contiene(119) Then RVFecha.MinimumValue = Now.ToShortDateString : CEFecha.StartDate = Now Else RVFecha.MinimumValue = MinFecha.ToShortDateString - - If Not UsuarioActual.TienePermisoProceso(190) Then - 'CARGA SOLO LAS SUCURSALES DE LOS ALMCENES QUE TIENE ASIGNADO EL USUARIO - Dim ObjInventarios As New ClsInventarios - If ObjInventarios.GetSucursalesAlmacenUsuario(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - DdlSubProyectos.DataSource = ObjInventarios.DtResultados - End If - ObjInventarios.Dispose() - Else - DdlSubProyectos.DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) - End If - DdlSubProyectos.DataBind() - DdlSubProyectos.SelectedValueExist(UsuarioActual.CveSubProyecto.ToString) - - If UsuarioActual.TienePermisoProceso(152) Then DdlSubProyectos.Enabled = False - - CreaDtDetalle() - CreaDtDetalleLote() - CargaPendientes() - - CantidadTotal = 0 - IndexSeccionAlmacen = 0 - CvePS = 0 - CreaDtSeccionAlmacen() - CargaDdlAlmacen() - - LnkVerSecciones.Visible = UsuarioActual.Empresa.Funcionalidad(563) = "1" - - End Sub - -#End Region - - -#Region " CARGA PARAMETROS - EXCLUSIVO USO AD " - Private Sub CargaParametrosAD() - - CveVentaAD = -1 - - If UsuarioActual.CveUsuario <> 100 Then - Exit Sub - End If - - If Not IsNothing(Request("CveVenta")) AndAlso IsNumeric(Request("CveVenta")) Then - CveVentaAD = Request("CveVenta").ToEntero - CargaVentaPorSurtir(Request("CveVenta").ToEntero) - LbSurtida.Visible = True - LbSurtida.Text = "SOLO MODO VISUAL" - BtnGuardar.Visible = False - End If - - End Sub -#End Region - -#Region " CARGA PENDIENTES POR SURTIR " - Protected Sub DdlCliente_SelectedIndexChanged(sender As Object, e As EventArgs) - CargaFolios() - End Sub - Private Sub CargaFolios() - Dim ObjInventarios As New ClsInventarios - - DdlFolio.Items.Clear() - - If DdlClientes.SelectedValue.ToEntero > 0 Then - If ObjInventarios.VentasPendientesAlmacenGet(DdlClientes.SelectedValue.ToEntero, MinFecha, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then - DdlFolio.DataSource = ObjInventarios.DtResultados - Else - Alert("Ocurrió un error al obtener las Compras pendientes de recibir del proveedor. Por favor vuelva a intentar", TipoMensaje.MsgError) - End If - End If - - ObjInventarios.Dispose() - - DdlFolio.DataBind() - DdlFolio.Items.Insert(0, New ListItem("Seleccione", "-1")) - UpFiltros.Update() - End Sub - Protected Sub TimmerRefresh_Tick(sender As Object, e As EventArgs) - CargaPendientes() - End Sub - Protected Sub BtnConsultarPendientes_Click(sender As Object, e As EventArgs) - CargaPendientes() - End Sub - Private Sub CargaPendientes() - DivTipoCambioAdvertencia.Visible = False - - Dim ObjInventarios As New ClsInventarios - Dim DtPendientes As New DataTable - - If ObjInventarios.VentasPendientesAlmacenGet(-1, TxtFechaPendientes.Text.ToDate, DdlSubProyectos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario) Then - - - If UsuarioActual.TienePermisoProceso(266) AndAlso UsuarioActual.TienePermisoProceso(267) Then - DtPendientes = ObjInventarios.DtResultados.FiltraParametros("TipoDocto IN ('Ing','Dev','Rem','Traspaso','Ped','PDev','DPe','Ant')") - ElseIf UsuarioActual.TienePermisoProceso(266) AndAlso Not UsuarioActual.TienePermisoProceso(267) Then - DtPendientes = ObjInventarios.DtResultados.FiltraParametros("TipoDocto IN ('Ing','Dev','Rem','Traspaso','Ant')") - ElseIf UsuarioActual.TienePermisoProceso(267) AndAlso Not UsuarioActual.TienePermisoProceso(266) Then - DtPendientes = ObjInventarios.DtResultados.FiltraParametros("TipoDocto IN ('Ped','PDev','DPe')") - Else - DtPendientes = ObjInventarios.DtResultados - End If - Else - DtPendientes = Nothing - Alert("Ocurrió un error al obtener las Compras pendientes de recibir del proveedor. Por favor vuelva a intentar", TipoMensaje.MsgError) - End If - - If UsuarioActual.Empresa.Funcionalidad(540) = "1" Then - BtnGuardar.Enabled = False - Dim FI As Date = Now.AddDays(-1) - Dim FF As Date = Now.AddDays(-7) - If ObjInventarios.RepNotasSinAlmacen(1, -1, FI, FF, "-1", -1, UsuarioActual.Empresa.CveEmpresa) Then - If ObjInventarios.DtResultados IsNot Nothing AndAlso ObjInventarios.DtResultados.Rows.Count > 1 Then - BtnGuardar.Enabled = False - Alert("No se podrá realizar entrega de mercancía si no se les da salida a los documentos pendientes. Para más información ver el Reporte de notas sin entrada en la sección Ventas.", TipoMensaje.MsgAdvertencia) - Else - BtnGuardar.Enabled = True - - End If - End If - End If - - ObjInventarios.Dispose() - - If DtPendientes IsNot Nothing Then - GVPendientes.DataSource = DtPendientes - - End If - - LtActualizado.Text = String.Format("Actualizado: {0}", Now.ToString("H:mm")) - - GVPendientes.DataBind() - UpPendientes.Update() - If DtPendientes IsNot Nothing Then DtPendientes.Dispose() - - End Sub - Protected Sub GVPendientes_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GVPendientes.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - e.Row.FCLinkButton("BtnSurtir").CommandArgument = If(e.Row.DBCampo("TipoEntrega") = "1", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("CveTraspasoSolicitud")) - - - - Select Case e.Row.DBCampo("TipoEntrega").ToString.ToEntero - Case 1 - If UsuarioActual.TienePermisoProceso(201) Then - Dim Css = "Texto" - Dim Liga = $"/Ventas/Ventas.aspx?&CveVenta={e.Row.DBCampo("CveVenta")}" - e.Row.FCLabel("LblFolio").Text = "" + e.Row.FCLabel("LblFolio").Text + "" - End If - - If UsuarioActual.CveEmpresa.Contiene(72, 80) Then - GVPendientes.Columns(4).Visible = True - e.Row.FCHyperLink("HplDownPDF").Visible = True - e.Row.FCHyperLink("HplDownPDF").NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}", e.Row.DBCampo("CveVenta")))) - End If - - If e.Row.DBCampo("TipoDocto").ToString.Contiene({"Rem", "Ing", "Ped", "PeC", "Ant"}) And e.Row.DBCampo("EsDevolucionVenta").ToString.ToEntero = 0 Then - e.Row.FCLinkButton("BtnSurtir").CssClass = "btn btn-primary btn-sm" - e.Row.FCLinkButton("BtnSurtir").Text = " Surtir " - Else - e.Row.FCLinkButton("BtnSurtir").CssClass = "btn yellow-gold btn-sm" - e.Row.FCLinkButton("BtnSurtir").Text = " Recibir" - End If - Case 2 - Dim Css = "Texto" - Dim Liga = $"/Inventarios/TrasladoSolicitud.aspx?&CveTraspasoSolicitud={e.Row.DBCampo("CveTraspasoSolicitud")}" - e.Row.FCLabel("LblFolio").Text = "" + e.Row.FCLabel("LblFolio").Text + "" - e.Row.FCLinkButton("BtnSurtir").CssClass = "btn btn-primary btn-sm" - e.Row.FCLinkButton("BtnSurtir").Text = " Traspasar " - End Select - UpPendientes.Update() - End If - End Sub - -#End Region - - -#Region " CARGA VENTA POR SURTIR " - Protected Sub BtnSurtir_Click(sender As Object, e As EventArgs) - - Dim Boton = CType(sender, LinkButton) - CveVentaAD = -1 - - If Boton.CommandArgument.ToEntero > 0 Then - TimmerRefresh.Enabled = False - - DivTransitorio1.Visible = False - ChkTransitorio.Checked = False - TxtResponsable.Text = "" - DivTransitorio2.Visible = False - - - Select Case CType(Boton.NamingContainer, GridViewRow).DataKey("TipoEntrega").ToEntero - Case 1 ' VENTA - CargaVentaPorSurtir(CType(sender, LinkButton).CommandArgument.ToEntero) - Case 2 ' TRASPASO - DivTransitorio1.Visible = True - CargaTraspasoPorSurtir(CType(Boton.NamingContainer, GridViewRow).DataKey("CveTraspasoSolicitud").ToEntero) - End Select - - End If - - End Sub - Protected Sub BtnBuscar_Click(sender As Object, e As EventArgs) - CveVentaAD = -2 - CargaVentaPorSurtir(DdlFolio.SelectedValue.ToEntero) - End Sub - Private Sub CargaVentaPorSurtir(CveVenta As Integer) - LbSurtida.Visible = False - CveContrato = -1 - CveSubProyecto = -1 - DtDatos = Nothing - TipoEntrega = 1 - BtnGuardar.Visible = True - - Dim StrAlmacenes As String = "CveTipoAlmacen IN (1,2)" - - If UsuarioActual.CveSubProyecto = 8804 Then - StrAlmacenes = "CveTipoAlmacen IN (1,2,12)" - End If - - Dim ObjInventario As New ClsInventarios - - If ObjInventario.EntregaAlmacenGet(CveVenta) Then - If ObjInventario.DtResultados IsNot Nothing AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then - - - DtDatos = ObjInventario.DtResultados - DtDatos.Columns.Add("Consec", GetType(Integer)) - DtDatos.Columns.Add("CantidadGV", GetType(Double)) - DtDatos.Columns.Add("CantidadTraspaso", GetType(Double)) - Dim Index = 1 - For Each Dr As DataRow In DtDatos.Rows - Dr("Consec") = Index - Index += 1 - Next - - DtDatosDetalle = Nothing - CreaDtDetalle() - - DtDatosDetalleLote = Nothing - CreaDtDetalleLote() - - If DtDatos.Rows(0) IsNot Nothing Then - EsDevolucionVenta = DtDatos.Rows(0)("EsDevolucionVenta").ToString.ToEntero - TipoDocto = DtDatos.Rows(0)("TipoDocto").ToString - TipoMovimiento = If(TipoDocto.Contiene({"Rem", "Ing", "Ped", "PeC", "Ant"}) And (EsDevolucionVenta = 0 Or CveVentaAD > 0), 1, 2) - - LbCliente.Text = DtDatos.Rows(0)("Nombre").ToString - 'LbFolio.Text = DtDatos.Rows(0)("SerieFolio").ToString - HLFolio.Text = DtDatos.Rows(0)("SerieFolio").ToString - If UsuarioActual.TienePermisoProceso(201) Then - HLFolio.NavigateUrl = $"/Ventas/Ventas.aspx?CveVenta={CveVenta}" - End If - - LbObservaciones.Text = DtDatos.Rows(0)("Observaciones").ToString - LbObservacionesAlmacen.Text = DtDatos.Rows(0)("ObservacionesAlmacen").ToString - CveVentaSurtir = CveVenta - CveAlmacenTraspasoDestino = DtDatos.Rows(0)(If(EsDevolucionVenta = 1 And TipoDocto <> "Rem", "CveAlmacenTraspasoOrigen", "CveAlmacenTraspasoDestino")).ToString.ToEntero - CveAlmacenTraspasoOrigen = DtDatos.Rows(0)(If(EsDevolucionVenta = 1 And TipoDocto <> "Rem", "CveAlmacenTraspasoDestino", "CveAlmacenTraspasoOrigen")).ToString.ToEntero - CveContrato = DtDatos.Rows(0)("CveContrato").ToString.ToEntero - CveVendedor = DtDatos.Rows(0)("CveVendedor").ToString.ToEntero - CveCliente = DtDatos.Rows(0)("CveCliente").ToString.ToEntero - CveSubProyecto = DtDatos.Rows(0)("CveSubProyecto").ToString.ToEntero - EsInterno = CBool(DtDatos.Rows(0)("EsInterno").ToString) - - If DtDatos.SUM("CantidadS") <= 0 Then - GvDatos.CssClass = "table table-striped table-hover Widthall ScrollAD gvInventario gvEscondeColumna" - Else - GvDatos.CssClass = "table table-striped table-hover Widthall ScrollAD gvInventario" - End If - - If CveAlmacenTraspasoDestino > 0 And Not (TipoMovimiento = 2 And TipoDocto = "Rem") Then - DivTipoCambioAdvertencia.Visible = True - LtTipoCambioAdvertencia.Text = $"Los productos seran Trasladados al Almacen: {GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Almacen", $"CveAlmacen = {CveAlmacenTraspasoDestino}")}" - Else - DivTipoCambioAdvertencia.Visible = False - End If - - 'DEVOLUCION REMISION - If TipoMovimiento = 2 And TipoDocto = "Rem" And Not CveAlmacenTraspasoDestino > 0 Then - Alert("La remisión que se intenta devolver presenta inconsistencias. Comuniquese con servicio tecnico SIG.", TipoMensaje.MsgError) - BtnGuardar.Visible = False - End If - - DdlAlmacen.Items.Clear() - If CveAlmacenTraspasoOrigen > 0 Then 'Not (EsDevolucionVenta = 1 And DtDatos.Rows(0)("TipoDocto").ToString = "Rem" And UsuarioActual.Empresa.Funcionalidad(145) = "1") - ESTO ES PARA CUANDO SEA REMISION DE ENTREGA POR ADELANTADO FUNCIONA LA DEVOLUCION - DdlAlmacen.Items.Insert(0, New ListItem(GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Almacen", $"CveAlmacen = {CveAlmacenTraspasoOrigen}"), CveAlmacenTraspasoOrigen.ToString)) - Else - '[IPP] PARCHE - Debe hacerse permiso proceso - 17Enero2018 - Dim RestriccionAlmacenSubProyecto = If(UsuarioActual.CveEmpresa.Contiene(72, 80), $" AND CveSubProyecto = {CveSubProyecto}", "") - DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros($"{StrAlmacenes} {RestriccionAlmacenSubProyecto}") - End If - DdlAlmacen.Items.Insert(0, New ListItem(" Seleccione ", "-1")) - DdlAlmacen.SelectedValue = "-1" - DdlAlmacen.DataBind() - DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen) - If CveAlmacenTraspasoOrigen > 0 Then - DdlAlmacen.SelectedValueExist(CveAlmacenTraspasoOrigen) - End If - - - If Not DtDatos.Columns.Contains("Lote") Then - DtDatos.Columns.Add("Lote", GetType(String)) - End If - If Not DtDatos.Columns.Contains("CveSeccion") Then - DtDatos.Columns.Add("CveSeccion", GetType(Integer)) - End If - If Not DtDatos.Columns.Contains("Caducidad") Then - DtDatos.Columns.Add("Caducidad", GetType(Date)) - End If - If Not DtDatos.Columns.Contains("Seleccionado") Then - DtDatos.Columns.Add("Seleccionado", GetType(Boolean)) - End If - If Not DtDatos.Columns.Contains("CantidadSeleccionada") Then - DtDatos.Columns.Add("CantidadSeleccionada", GetType(Double)) - End If - - For Each Dr As DataRow In DtDatos.Rows - Dr("Caducidad") = Now - Next - - 'TxtFecha.Text = If(EsDevolucionVenta = 1, Now.ToShortDateString, DtDatos.Rows(0)("Fecha").ToString) - End If - - If UsuarioActual.Empresa.Funcionalidad(132) = "1" Then - DivCodigoSeriePS.Visible = True - Else - DivCodigoSeriePS.Visible = False - End If - - If TipoMovimiento = 2 Then ' cuando es cancelación - Dim Filtro As String '= If(ObjInventario.DtResultados.Rows(0)("TipoDocto").ToString.Contiene({"Ing", "Dev", "Ped"}), "CveConcepto = 3", "CveConcepto = 9") - Select Case ObjInventario.DtResultados.Rows(0)("TipoDocto").ToString - Case "Ing", "Ped" - Filtro = "CveConcepto IN (3,40)" - Case "Dev" - 'cuand es devolucionventa=1, es cancelación de la devolución - If EsDevolucionVenta = 1 Then Filtro = "CveConcepto = 18" Else Filtro = "CveConcepto IN (3,40)" - Case Else - Filtro = "CveConcepto = 9" - End Select - If ObjInventario.GetInv_Mov(ObjInventario.DtResultados.Rows(0)("CveVentaPadre").ToString.ToEntero, UsuarioActual.CveEmpresa) Then - DtExistencias = ObjInventario.DtResultados.FiltraParametros($"CvePS Is Not NULL AND {Filtro}") - - If Not DtExistencias.Rows.Count > 0 Then - Alert("La Venta original de la Devolución no tiene salida de Almacén.", TipoMensaje.MsgAdvertencia) - End If - - If TipoDocto.Contiene("Ing") AndAlso TipoMovimiento = 2 Then - Dim DtMov As DataTable = DtExistencias.FiltraParametros("CveConcepto = 40", "", {"CveAlmacen"}) - If DtMov.Rows.Count > 0 Then - Dim CveAlmacenDev As Integer = DtMov.Rows(0)("CveAlmacen").ToString().ToEntero() - DdlAlmacen.Items.Clear() - DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros($"CveAlmacen = {CveAlmacenDev}") - DdlAlmacen.DataBind() - - DdlAlmacen.SelectedValueExist(CveAlmacenDev) - EsDevolucionDirecta = True - End If - End If - - Else - Alert("Ocurrió un error al cargar los datos de devolución. Por favor vuelva a intentar.", TipoMensaje.MsgError) - End If - End If - - CargaDocumentos(CveVenta) - Else - Alert("No se encontraron productos pendientes por surtir. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - End If - Else - DtDatos = Nothing - End If - - ObjInventario.Dispose() - UpGenerales.Update() - CargaGvDatos() - DtSeccionAlmacen.Rows.Clear() - DtSeccionAlmacen.AcceptChanges() - End Sub - Private Sub CargaTraspasoPorSurtir(CveTraspaso As Integer) - LbSurtida.Visible = False - CveContrato = -1 - CveSubProyecto = -1 - DtDatos = Nothing - TipoEntrega = 2 - - Dim ObjInventario As New ClsInventarios - - If ObjInventario.EntregaAlmacenTraspasosGet(CveTraspaso) Then - If ObjInventario.DtResultados IsNot Nothing AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then - CveTraspasoSurtir = CveTraspaso - TipoMovimiento = 1 - - DtDatos = ObjInventario.DtResultados - DtDatos.Columns.Add("Consec", GetType(Integer)) - DtDatos.Columns.Add("CantidadGV", GetType(Double)) - DtDatos.Columns.Add("CantidadTraspaso", GetType(Double)) - - LbCliente.Text = DtDatos.Rows(0)("Nombre").ToString - HLFolio.Text = DtDatos.Rows(0)("SerieFolio").ToString - If UsuarioActual.TienePermisoProceso(201) Then - HLFolio.NavigateUrl = $"/Inventarios/TrasladoSolicitud.aspx?CveTraspasoSolicitud={CveTraspasoSurtir}" - End If - LbObservaciones.Text = DtDatos.Rows(0)("Observaciones").ToString - - Dim Index = 1 - For Each Dr As DataRow In DtDatos.Rows - Dr("Consec") = Index - Index += 1 - Next - - DtDatosDetalle = Nothing - CreaDtDetalle() - - DtDatosDetalleLote = Nothing - CreaDtDetalleLote() - - CveAlmacenTraspasoDestino = DtDatos.Rows(0)("CveAlmacenDestino").ToString.ToEntero - CveAlmacenTraspasoOrigen = DtDatos.Rows(0)("CveAlmacenOrigen").ToString.ToEntero - - If DtDatos.SUM("CantidadS") <= 0 Then - GvDatos.CssClass = "table table-striped table-hover Widthall ScrollAD gvInventario gvEscondeColumna" - Else - GvDatos.CssClass = "table table-striped table-hover Widthall ScrollAD gvInventario" - End If - - If CveAlmacenTraspasoDestino > 0 Then - DivTipoCambioAdvertencia.Visible = True - LtTipoCambioAdvertencia.Text = $"Los productos seran Trasladados al Almacen: {GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Almacen", $"CveAlmacen = {CveAlmacenTraspasoDestino}")}" - Else - DivTipoCambioAdvertencia.Visible = False - End If - - 'If DtDatos.Rows.Cast(Of DataRow).Any(Function(Row) Row("CveTamaño").ToString().ToEntero() > 0) Then - - 'End If - - - DdlAlmacen.Items.Clear() - If CveAlmacenTraspasoOrigen > 0 Then - DdlAlmacen.Items.Insert(0, New ListItem(GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Almacen", $"CveAlmacen = {CveAlmacenTraspasoOrigen}"), CveAlmacenTraspasoOrigen.ToString)) - End If - - DdlAlmacen.Items.Insert(0, New ListItem(" Seleccione ", "-1")) - DdlAlmacen.SelectedValue = "-1" - DdlAlmacen.DataBind() - DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen) - If CveAlmacenTraspasoOrigen > 0 Then - DdlAlmacen.SelectedValueExist(CveAlmacenTraspasoOrigen) - End If - - 'TxtFecha.Text = DtDatos.Rows(0)("Fecha").ToString - - If UsuarioActual.Empresa.Funcionalidad(132) = "1" Then - DivCodigoSeriePS.Visible = True - Else - DivCodigoSeriePS.Visible = False - End If - - Else - Alert("No se encontraron productos pendientes por surtir. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - End If - Else - DtDatos = Nothing - End If - - ObjInventario.Dispose() - UpGenerales.Update() - CargaGvDatos() - - End Sub - Private Sub CargaGvDatos() - - If DtDatos IsNot Nothing Then - - For Each item As DataRow In DtDatos.Rows - Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, item("CvePS").ToString.ToEntero).FiltroPrimero("") - If Dr IsNot Nothing Then - item("AplicaSeccion") = CBool(Dr("AplicaSeccion")) - If CBool(Dr("AplicaSeccion")) Then GvDatos.Columns(9).Visible = True - item("AplicaSerie") = CBool(Dr("AplicaSerie")) - item("AplicaLote") = CBool(Dr("AplicaLote")) - If CBool(Dr("AplicaLote")) Then GvDatos.Columns(10).Visible = True - item("AplicaCaducidad") = CBool(Dr("AplicaCaducidad")) - If CBool(Dr("AplicaCaducidad")) Then GvDatos.Columns(11).Visible = True - If CBool(Dr("AplicaSeccion")) Or CBool(Dr("AplicaLote")) Or CBool(Dr("AplicaCaducidad")) Or CBool(Dr("AplicaSerie")) Then - GvDatos.Columns(12).Visible = True - End If - End If - Next - - GvDatos.DataSource = DtDatos - End If - - GvDatos.Columns(7).Visible = UsuarioActual.Empresa.Funcionalidad(147) = "1" - - GvDatos.Columns(8).Visible = UsuarioActual.Empresa.Funcionalidad(563) = "1" - - GvDatos.DataBind() - UpDatos.Update() - UpVenta.Update() - - 'CARGA LO PRECARGADO CON SERIELOTE - Dim Contador = 0 - For Each Gvr As GridViewRow In GvDatos.Rows - If Gvr.DataKey("CvePS").ToEntero = CvePSSerieLote Then - Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec"))).Rows.Count - Gvr.FCCheckBox("cbInv").Enabled = False - Gvr.FCCheckBox("cbInv").Checked = True - Gvr.FCTextBox("TbCantidadF").Text = Contador.ToString - End If - Next - - End Sub - - Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - If CBool(e.Row.DBCampo("AplicaSerie")) Then - e.Row.FCButton("BtnSerieLote").Visible = True - e.Row.FCButton("BtnSerieLote").Text = If(e.Row.DBCampo("Inv_CveMetodoInventario").ToString = "5", "SerieLote", "Lote-Batch") - e.Row.FCButton("BtnSerieLote").CommandArgument = String.Format("{0}°{1}°{2}°{3}°{4}°{5}", e.Row.DBCampo("CvePS"), e.Row.DBCampo("CveUM"), e.Row.DBCampo("PS"), e.Row.DBCampo("CantidadF"), e.Row.DBCampo("Consec"), e.Row.DBCampo("Inv_CveMetodoInventario")) - e.Row.FCTextBox("TbCantidadF").Enabled = False - e.Row.FCCheckBox("cbInv").Enabled = False - Dim Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", e.Row.DBCampo("Consec"))).Rows.Count - e.Row.FCTextBox("TbCantidadF").Text = Contador.ToString - 'e.Row.FCTextBox("TbCantidadF").Text = "0" - - If TipoDocto = "DPe" Then - CveConsecSerieLote = e.Row.DBCampo("Consec").ToString.ToEntero - PSSerieLote = e.Row.DBCampo("PS").ToString - CvePSSerieLote = e.Row.DBCampo("CvePS").ToEntero - CveUMSerieLote = e.Row.DBCampo("CveUM").ToEntero - LbCantidad.Text = e.Row.DBCampo("CantidadF") - LbCantidad2.Text = e.Row.DBCampo("CantidadF") - AgregaSerieLote(e.Row.DBCampo("ObservacionesDetalle"), 3) - End If - - Else - e.Row.FCButton("BtnSerieLote").Visible = False - e.Row.FCTextBox("TbCantidadF").Enabled = True - e.Row.FCTextBox("TbCantidadF").Attributes.Add("onblur", String.Format("ValidarCantidad(this, {0})", e.Row.DBCampo("CantidadF"))) - End If - - - If CBool(e.Row.DBCampo("AplicaSeccion")) Then - e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = True - Else - e.Row.FCDropDownList("DdlSeccionAlmacen").Visible = False - End If - - If CBool(e.Row.DBCampo("AplicaCaducidad")) Then - e.Row.FCTextBox("TxtCaducidad").Visible = True - e.Row.FCLinkButton("LnkCaducidad").Visible = True - e.Row.FCTextBox("TxtCaducidad").Text = Now.ToShortDateString - Else - e.Row.FCTextBox("TxtCaducidad").Visible = False - e.Row.FCLinkButton("LnkCaducidad").Visible = False - End If - - If CBool(e.Row.DBCampo("AplicaLote")) Then - e.Row.FCTextBox("TxtLote").Visible = True - Else - e.Row.FCTextBox("TxtLote").Visible = False - End If - - e.Row.FCButton("BtnDividir").Attributes.Add("onclick", String.Format("Dividir('{0}');", e.Row.FCTextBox("TxtDividir").ClientID)) - e.Row.FCButton("BtnDividir").CommandArgument = e.Row.RowIndex.ToString - e.Row.FCTextBox("TxtDividir").Attributes.Add("onkeyup", String.Format("LimitaCantidad({0},this,'{1}');", e.Row.DBCampo("CantidadF"), e.Row.FCButton("BtnDividir").ClientID)) - - - 'FUNCIONALIDAD PISTOLA DE CODIGOS - If UsuarioActual.Empresa.Funcionalidad(132) = "1" And e.Row.DBCampo("CodigoBarras").Trim <> "" Then - 'NO BLOQUEA PARA ROL AD - If UsuarioActual.CveRol = 1 Then - If e.Row.DBCampo("Inv_CveMetodoInventario").Contiene("5", "6") Then - e.Row.FCTextBox("TbCantidadF").Enabled = False - Else - e.Row.FCTextBox("TbCantidadF").Text = e.Row.DBCampo("CantidadF").FormatoNumero() - End If - End If - - If Not UsuarioActual.CveRol = 1 Then - e.Row.FCTextBox("TbCantidadF").Enabled = False - End If - End If - - If UsuarioActual.Empresa.Funcionalidad(147) = "1" Then - e.Row.FCLinkButton("LBSeccionAlmacen").CommandArgument = $"{e.Row.DBCampo("CvePS").ToString.ToEntero}|{e.Row.DBCampo("CantidadF").ToString.ToDecimal}|{DdlAlmacen.SelectedValue.ToEntero}" - End If - - 'SI ES TRASPASO OBLIGATORIO SURTIR TODO - If TipoEntrega = 2 Then - e.Row.FCCheckBox("cbInv").Enabled = False - End If - - 'If UsuarioActual.Empresa.Funcionalidad(147) = "1" Then - ' Dim ObjInventarios As New ClsInventarios - ' If ObjInventarios.SeccionAlmacenRecomendadoSurtidoGet(e.Row.DBCampo("CvePS").ToString.ToEntero, e.Row.DBCampo("CantidadF").ToString.ToDecimal, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero) Then - ' e.Row.FCLabel("LbSeccionAlmacen").Text = ObjInventarios.DtResultados().Rows(0)(0).ToString - ' End If - ' ObjInventarios.Dispose() - 'End If - - End If - End Sub - - Private Sub CargaDocumentos(tCveVenta As Integer) - Dim objInv As New ClsEdocumentacion - - If objInv.DocumentacionElectronicaGet(-1, -1, -1, UsuarioActual.CveEmpresa, -1, tCveVenta) Then - GvDocs.DataSource = objInv.DtResultados.FiltraParametros("Adjunto <> ''") - End If - objInv.Dispose() - GvDocs.DataBind() - End Sub - Protected Sub LBSeccionAlmacen_Click(sender As Object, e As EventArgs) - Dim Argumentos = CType(sender, LinkButton).CommandArgument.Split("|"c) - - Dim ObjInventarios As New ClsInventarios - If ObjInventarios.SeccionAlmacenRecomendadoSurtidoGet(Argumentos(0).ToEntero, Argumentos(1).ToEntero, UsuarioActual.CveEmpresa, Argumentos(2).ToEntero) Then - GVSeccionAlmacen.DataSource = ObjInventarios.DtResultados - End If - ObjInventarios.Dispose() - - GVSeccionAlmacen.DataBind() - UpSeccionAlmacen.Update() - - RegistraScript("$('#ModalSeccionAlmacen').modal('show')") - End Sub - -#End Region - - -#Region " AGREGAR " - - Protected Sub BtnSerieLote_Click(sender As Object, e As EventArgs) - - Dim Argumentos = CType(sender, Button).CommandArgument.Split("°"c) - - LbProducto.Text = Argumentos(2) - LbCantidad.Text = Argumentos(3) - - LbProducto2.Text = Argumentos(2) - LbCantidad2.Text = Argumentos(3) - - CvePSSerieLote = Argumentos(0).ToEntero - CveUMSerieLote = Argumentos(1).ToEntero - PSSerieLote = Argumentos(2).ToString - CveConsecSerieLote = Argumentos(4).ToEntero - CveMetodoInventarioLote = Argumentos(5).ToEntero - - If CveMetodoInventarioLote = 5 Then - RegistraScript("$('#DivSerie').modal('show')") - CargaSerie() - UpSerie.Update() - ElseIf CveMetodoInventarioLote = 6 Then - RegistraScript("$('#DivLote').modal('show')") - CargaLote() - UpLoteBatch.Update() - End If - - End Sub - -#Region " AGREGA POR SERIE/LOTE " - - Private Sub CreaDtDetalle() - If DtDatosDetalle Is Nothing Then - DtDatosDetalle = New DataTable - DtDatosDetalle.Columns.Add("CveVentaDetalle", GetType(Integer)) - DtDatosDetalle.Columns.Add("Consec", GetType(Integer)) - DtDatosDetalle.Columns.Add("ConsecId", GetType(Integer)) - DtDatosDetalle.Columns.Add("CvePS", GetType(Integer)) - DtDatosDetalle.Columns.Add("PS", GetType(String)) - DtDatosDetalle.Columns.Add("CveUM", GetType(Integer)) - DtDatosDetalle.Columns.Add("SerieLote", GetType(String)) - DtDatosDetalle.Columns.Add("FechaCaducidad", GetType(String)) - DtDatosDetalle.Columns.Add("FueTraspaso", GetType(Integer)) - End If - End Sub - Private Sub CargaSerie(Optional CerrarCompletado As Boolean = False) - RegistraScript("$('#DivSerie').modal('show')", "show") - 'RegistraScript("document.getElementById(""TxtSerieLote"").focus();") - - Dim AplicaCaducidad = False - If GlobalDTPS(UsuarioActual.CveEmpresa, ).FiltraParametros("").Rows(0) IsNot Nothing Then - AplicaCaducidad = If(GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0)("AplicaCaducidad").ToString = "True", True, False) - End If - - If AplicaCaducidad Then - GvSerie.Columns(1).Visible = True - TdCaducidad1.Visible = True - TdCaducidad2.Visible = True - Else - GvSerie.Columns(1).Visible = False - TdCaducidad1.Visible = False - TdCaducidad2.Visible = False - End If - - GvSerie.DataSource = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerieLote), "Consec DESC") - GvSerie.DataBind() - - 'SERIE LOTE RECOMENDADO - Dim DtSerieLote As New DataTable - If TipoMovimiento = 1 Then - Dim ObjInventarios As New ClsInventarios - If ObjInventarios.SerieLoteRecomendadoGet(CvePSSerieLote, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, CveSubProyecto:=CveSubProyecto) Then - DtSerieLote = ObjInventarios.DtResultados - End If - ObjInventarios.Dispose() - Else - DtSerieLote = DtExistencias.FiltraParametros("SerieLote <> ''") - End If - 'SERIE LOTE RECOMENDADO - QUITA YA COMPLETADOS EN EL CLIENTE - If DtSerieLote.Rows.Count > 0 Then - 'CALCULA YA COMPLETADOS - Dim DrsRemove As New List(Of DataRow) - DtSerieLote.Columns.Add("CantidadSeleccionada", GetType(Integer)) - For Each dr As DataRow In DtSerieLote.Rows - dr("CantidadSeleccionada") = DtDatosDetalle.FiltraParametros(String.Format("Consec = {0} AND SerieLote = '{1}'", CveConsecSerieLote, dr("SerieLote").ToString.Replace("'", "''"))).Rows.Count - If dr("CantidadSeleccionada").ToString.ToDecimal = dr("Existencia").ToString.ToDecimal Then - DrsRemove.Add(dr) - End If - Next - - 'ELIMINA YA COMPLETADOS EN PAGINA - For Each dr As DataRow In DrsRemove - DtSerieLote.Rows.Remove(dr) - Next - - If DtSerieLote.Rows.Count > 0 Then - Dim Mensaje As New StringBuilder - Mensaje.AppendFormat("Serie / Lote Recomendado: {0}", DtSerieLote.Rows(0)("SerieLote")) - If AplicaCaducidad Then Mensaje.AppendFormat(", Caducicdad: {0}", DtSerieLote.Rows(0)("FechaCaducidad").ToString.ToDate.ToShortDateString) - LbSerieLoteRecomendado.Text = Mensaje.ToString 'String.Format("Serie / Lote Recomendado: {0}, Caducicdad: {1}", ObjInventarios.DtResultados.Rows(0)("SerieLote"), ObjInventarios.DtResultados.Rows(0)("FechaCaducidad").ToString.ToDate.ToShortDateString) - Else - LbSerieLoteRecomendado.Text = "No se encontro ningun Serie/Lote." - End If - Else - LbSerieLoteRecomendado.Text = "No se encontro ningun Serie/Lote." - End If - - 'SI TIENE SALIDA POR SERIE LOTE, BLOQUEAMOS CHECK Y TXTCANTIDAD - Dim Contador = 0 - For Each Gvr As GridViewRow In GvDatos.Rows - If Gvr.DataKey("AplicaSerieLote") = "True" Then - Contador = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Gvr.DataKey("Consec"))).Rows.Count - Gvr.FCCheckBox("cbInv").Enabled = False - Gvr.FCCheckBox("cbInv").Checked = True - Gvr.FCTextBox("TbCantidadF").Text = Contador.ToString - End If - Next - UpDatos.Update() - - 'VALIDA QUE SIGA AGREGANDO - If DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerieLote)).Rows.Count = LbCantidad.Text.ToEntero Then - BtnAgregarPS.Enabled = False - If CerrarCompletado Then - RegistraScript("$('#DivSerie').modal('hide')", "hide") - End If - UpSerie.Update() - Exit Sub - Else - BtnAgregarPS.Enabled = True - UpSerie.Update() - End If - - End Sub - - Protected Sub BtnAgregarPS_Click(sender As Object, e As EventArgs) - If TxtSerieLote.Text.Trim.Length >= 2 AndAlso TxtSerieLote.Text.Trim.StartsWith("*") AndAlso TxtSerieLote.Text.Trim.EndsWith("*") Then - Dim ArraySeries() As String = Nothing - Dim Series As String = Nothing - - Series = TxtSerieLote.Text.Trim - Series = Series.Remove(0, 1) - Series = Series.Remove(Series.Length - 1, 1) - ArraySeries = Series.Trim.Split(","c) - - For i As Integer = 0 To ArraySeries.Length - 1 - If ArraySeries(i).Trim.Length > 1 Then AgregaSerieLote(ArraySeries(i).Trim, 1) - Next - Else - AgregaSerieLote(TxtSerieLote.Text.Trim, 1) - End If - End Sub - - Private Sub AgregaSerieLote(SerieLote As String, Tipo As Integer) - - If SerieLote.Trim = "" Then - Alert("El campo Serie es obligatorio. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - If DtDatosDetalle.FiltraParametros($"CvePS = {CvePSSerieLote} AND SerieLote = '{SerieLote}'").Rows.Count > 0 Then - Alert("La SerieLote indicada ya esta registrada. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error1") - TxtSerieLote.Text = "" - Exit Sub - End If - - Dim AplicaCaducidad = False - If GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0) IsNot Nothing Then - AplicaCaducidad = If(GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSSerieLote).FiltraParametros("").Rows(0)("AplicaCaducidad").ToString = "True", True, False) - End If - - - 'Valida Existencia - If TipoMovimiento = 1 Then - Dim ObjInventarios As New ClsInventarios - Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerieLote, CveUMSerieLote, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), SerieLote:=SerieLote, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=If(TipoEntrega = 2, 1, -1)) - If Existencia < 1 Then - Alert($"No hay existencia suficiente del producto ""{PSSerieLote}"" con la SerieLote definida ""{SerieLote}"". Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia, If(Tipo = 2, "window.setTimeout(Focus,200);", "")) - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error2") - ObjInventarios.Dispose() - Exit Sub - End If - Else - If DtExistencias IsNot Nothing Then - Dim Existencia = DtExistencias.SUM("Cantidad", $"CvePS = {CvePSSerieLote} AND CveUM = {CveUMSerieLote} AND SerieLote = '{SerieLote}'") - If Existencia < 1 Then - Alert($"No hay existencia suficiente del producto ""{PSSerieLote}"" con la SerieLote definida ""{SerieLote}"". Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia, If(Tipo = 2, "window.setTimeout(Focus,200);", "")) - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')", "Error3") - Exit Sub - End If - End If - End If - - - Dim Row = DtDatosDetalle.NewRow - - Row("ConsecId") = CveConsecSerieLote - Row("Consec") = DtDatosDetalle.Rows.Count + 1 - Row("PS") = PSSerieLote - Row("CvePS") = CvePSSerieLote - Row("CveUM") = CveUMSerieLote - Row("SerieLote") = SerieLote - Row("FechaCaducidad") = If(AplicaCaducidad, TxtFechaCaducidad.Text, MinFecha.ToShortDateString) - - DtDatosDetalle.Rows.Add(Row) - RegistraScript("playsonidito('beep-07.wav')", "Sonidito") - - If Tipo = 1 Then - TxtSerieLote.Text = "" - TxtFechaCaducidad.Text = Now.ToShortDateString - End If - - If Tipo < 3 Then - CargaSerie(True) - End If - - End Sub - - Protected Sub GvSerie_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvSerie.RowDeleting - - Dim keySerieLote As String = e.Keys("SerieLote").ToString - Try - For Each dr As DataRow In DtDatosDetalle.Rows - If dr("SerieLote").ToString = keySerieLote Then - dr.Delete() - End If - Next - Catch ex As Exception - - End Try - - DtDatosDetalle.AcceptChanges() - CargaSerie() - - End Sub -#End Region - -#Region " AGREGA CON LOTE BATCH " - - Private Sub CreaDtDetalleLote() - If DtDatosDetalleLote Is Nothing Then - DtDatosDetalleLote = New DataTable - DtDatosDetalleLote.Columns.Add("CveVentaDetalle", GetType(Integer)) - DtDatosDetalleLote.Columns.Add("Consec", GetType(Integer)) - DtDatosDetalleLote.Columns.Add("ConsecId", GetType(Integer)) - DtDatosDetalleLote.Columns.Add("Cantidad", GetType(Double)) - DtDatosDetalleLote.Columns.Add("CvePS", GetType(Integer)) - DtDatosDetalleLote.Columns.Add("PS", GetType(String)) - DtDatosDetalleLote.Columns.Add("CveUM", GetType(Integer)) - DtDatosDetalleLote.Columns.Add("Lote", GetType(String)) - DtDatosDetalleLote.Columns.Add("Batch", GetType(String)) - DtDatosDetalleLote.Columns.Add("FechaCaducidad", GetType(String)) - DtDatosDetalleLote.Columns.Add("FueTraspaso", GetType(Integer)) - End If - End Sub - Private Sub CargaLote(Optional CerrarCompletado As Boolean = False) - - RegistraScript("$('#DivLote').modal('show')") - GvLote.DataSource = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0}", CveConsecSerieLote), "Consec DESC") - GvLote.DataBind() - - 'VALIDA QUE SIGA AGREGANDO - If DtDatosDetalleLote.SUM("Cantidad", String.Format("ConsecId = {0}", CveConsecSerieLote)) = LbCantidad2.Text.ToDecimal Then - BtnLote.Enabled = False - If CerrarCompletado Then - RegistraScript("$('#DivLote').modal('hide')", "hide") - End If - Else - BtnLote.Enabled = True - End If - - 'LOTE RECOMENDADO - Dim DtLotes As New DataTable - If TipoMovimiento = 1 Then - Dim ObjInventarios As New ClsInventarios - If ObjInventarios.LoteBatchRecomendadoGet(CvePSSerieLote, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero) Then - DtLotes = ObjInventarios.DtResultados - End If - ObjInventarios.Dispose() - Else - DtLotes = DtExistencias.FiltraParametros("Lote <> ''") - End If - - Dim DrsRemove As New List(Of DataRow) - - If DtLotes.Rows.Count > 0 Then - 'CALCULA YA COMPLETADOS - DtLotes.Columns.Add("CantidadSeleccionada", GetType(Integer)) - For Each dr As DataRow In DtLotes.Rows - dr("CantidadSeleccionada") = DtDatosDetalleLote.SUM("Cantidad", String.Format("Consec = {0} AND Lote = '{1}' AND Batch = '{2}'", CveConsecSerieLote, dr("Lote"), dr("Batch"))) - If dr("CantidadSeleccionada").ToString.ToDecimal = dr("Existencia").ToString.ToDecimal Then - DrsRemove.Add(dr) - End If - Next - - 'ELIMINA YA COMPLETADOS EN PAGINA - For Each dr As DataRow In DrsRemove - DtLotes.Rows.Remove(dr) - Next - - If DtLotes.Rows.Count > 0 Then - Dim Mensaje As New StringBuilder - Mensaje.AppendFormat("Recomendado: Existencia: {0} Lote: {1} Batch: {2} Fecha Caducidad: {3} ", DtLotes.Rows(0)("Existencia").ToString.FormatoNumero, DtLotes.Rows(0)("Lote"), DtLotes.Rows(0)("Batch"), DtLotes.Rows(0)("FechaCaducidad").ToString.ToDate.ToShortDateString) - LbLoteRecomendado.Text = Mensaje.ToString - Else - LbLoteRecomendado.Text = "No se encontro ningún Lote-Batch recomendato." - End If - Else - LbLoteRecomendado.Text = "No se encontro ningún Lote-Batch recomendato." - End If - - - 'SI TIENE SALIDA POR LOTE, BLOQUEAMOS CHECK Y TXTCANTIDAD - Dim Contador As Decimal = 0 - For Each Gvr As GridViewRow In GvDatos.Rows - If Gvr.DataKey("CvePS").ToEntero = CvePSSerieLote Then - Contador = DtDatosDetalleLote.SUM("Cantidad", String.Format("ConsecId = {0}", Gvr.DataKey("Consec"))).ToDecimal - Gvr.FCCheckBox("cbInv").Enabled = False - Gvr.FCCheckBox("cbInv").Checked = True - Gvr.FCTextBox("TbCantidadF").Text = Contador.ToString.FormatoNumero - End If - Next - - RVCantidadLote.MaximumValue = (If((LbCantidad2.Text.ToDecimal - Contador) = 0, 0.02, LbCantidad2.Text.ToDecimal - Contador)).ToString.FormatoNumero - - TxtCantidadLote.Text = "1" - TxtLote.Text = "" - TxtBatch.Text = "" - TxtLote.Focus() - - UpLoteBatch.Update() - UpDatos.Update() - - End Sub - - Protected Sub BtnAgregarPS2_Click(sender As Object, e As EventArgs) - AgregaLote(TxtLote.Text.Trim, TxtBatch.Text.Trim, 1) - End Sub - Private Sub AgregaLote(Lote As String, Batch As String, Tipo As Integer) - - If Lote = "" Then - Alert("El campo Lote es obligatorio. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'VALIDACION DE SERIES DUPLICADAS - Dim MensajeAlert As New StringBuilder - Dim DtDuplicado As New DataTable - Dim DtSeriesNuevas As New DataTable - DtSeriesNuevas.Columns.Add("Serie", GetType(String)) - - DtDuplicado = DtDatosDetalleLote.FiltraParametros($"ConsecId = {CveConsecSerieLote} AND Lote = '{Lote}' AND Batch = '{Batch}'") - If DtDuplicado IsNot Nothing AndAlso DtDuplicado.Rows.Count > 0 Then - Alert($"
    El numero de Lote ""{Lote}"" y Batch = '{Batch}' proporcionado ya se encuentra ingresado.", TipoMensaje.MsgAdvertencia) - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - Exit Sub - End If - - Dim Row = DtDatosDetalleLote.NewRow - Dim CantidadLote = TxtCantidadLote.Text.ToDecimal - - Dim MensajeSinExistencias As New StringBuilder - Dim ObjInventarios As New ClsInventarios - - 'VERIFICA EXISTENCIAS - If TipoMovimiento = 1 Then - Dim Existencia = ObjInventarios.GetExistenciasPS(CvePSSerieLote, CveUMSerieLote, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), Lote:=Lote, Batch:=Batch, ExcluyeApartados:=If(TipoEntrega = 2, 1, -1)) - If Existencia < CantidadLote Then - Alert($"No hay existencia suficiente del producto ""{PSSerieLote}"" con el lote definido ""{Lote}"" y el batch ""{Batch}"". Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia) - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - ObjInventarios.Dispose() - Exit Sub - End If - Else - If DtExistencias IsNot Nothing Then - Dim Existencia = DtExistencias.SUM("Cantidad", $"CvePS = {CvePSSerieLote} AND CveUM = {CveUMSerieLote} AND Lote = '{Lote}' AND Batch = '{Batch}'") - If Existencia < CantidadLote Then - Alert($"No hay existencia suficiente del producto ""{PSSerieLote}"" con el lote definido ""{Lote}"" y el batch ""{Batch}"". Por favor rectifique y vuelva a intentar", TipoMensaje.MsgAdvertencia) - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - ObjInventarios.Dispose() - Exit Sub - End If - End If - End If - - Dim FechaCaducidad = "" - If ObjInventarios.LoteBatchRecomendadoGet(CvePSSerieLote, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero) AndAlso ObjInventarios.DtResultados.Rows.Count > 0 Then - FechaCaducidad = ObjInventarios.DtResultados.Rows(0)("FechaCaducidad").ToString.ToDate.ToShortDateString - End If - - Row("ConsecId") = CveConsecSerieLote - Row("Consec") = DtDatosDetalle.Rows.Count + 1 - Row("Cantidad") = CantidadLote - Row("CvePS") = CvePSSerieLote - Row("PS") = PSSerieLote - Row("CveUM") = CveUMSerieLote - Row("Lote") = Lote - Row("Batch") = Batch - Row("FechaCaducidad") = FechaCaducidad - - DtDatosDetalleLote.Rows.Add(Row) - ObjInventarios.Dispose() - - If Tipo = 1 Then - TxtCantidadLote.Text = "1" - TxtLote.Text = "" - TxtBatch.Text = "" - End If - - CargaLote(True) - - End Sub - - Protected Sub GvLote_RowDeleting(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvLote.RowDeleting - - Dim keySerieLote As String = e.Keys("Lote").ToString - Try - For Each dr As DataRow In DtDatosDetalleLote.Rows - If dr("Lote").ToString = keySerieLote Then - dr.Delete() - End If - Next - Catch ex As Exception - - End Try - DtDatosDetalleLote.AcceptChanges() - CargaLote() - End Sub -#End Region - -#Region " AGREGA CON TXT | CODIGO - SERIE " - Protected Sub BtnCodigoPS_Click(sender As Object, e As EventArgs) - - If TxtCodigoPS.Text = "" Then - Exit Sub - End If - - TdSeriePS.Visible = False - Dim Existe = False - Dim PSTemp = "" - - For Each Gvr As GridViewRow In GvDatos.Rows - If Gvr.DataKey("CodigoBarras") = TxtCodigoPS.Text.Trim Then - Dim TxtCantidad = GvDatos.Rows(Gvr.RowIndex).FCTextBox("TbCantidadF") - If Gvr.DataKey("CantidadF").ToDecimal - TxtCantidad.Text.ToDecimal - 1 >= 0 Then - - ''VALIDA EXISTENCIA - If Not TipoDocto.Contiene("Dev") Then - If TipoMovimiento = 1 Then - Dim ObjInventario As New ClsInventarios - Dim Existencia = ObjInventario.GetExistenciasPS(Gvr.DataKey("CvePS").ToString.ToEntero, Gvr.DataKey("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=If(TipoEntrega = 2, 1, -1)) - ObjInventario.Dispose() - If Not Existencia >= TxtCantidad.Text.ToDecimal + 1 Then - TxtCodigoPS.Text = "" - Alert($"No hay existencias suficientes del producto:
    ""{Gvr.DataKey("Codigo")}-{Gvr.DataKey("PS")}"".
    Solo hay disponibles {Existencia.FormatoNumero} en Almacen. Por favor Verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);") - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - Exit Sub - End If - Else - If DtExistencias IsNot Nothing Then - Dim Existencia = DtExistencias.SUM("Cantidad", $"CvePS = {Gvr.DataKey("CvePS")} AND CveUM = {Gvr.DataKey("CveUM").ToString.ToEntero}") - If Not Existencia >= TxtCantidad.Text.ToDecimal + 1 Then - TxtCodigoPS.Text = "" - Alert($"No hay existencias suficientes del producto:
    ""{Gvr.DataKey("Codigo")}-{Gvr.DataKey("PS")}"".
    Solo hay disponibles {Existencia.FormatoNumero} en Almacen. Por favor Verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);") - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - Exit Sub - End If - End If - End If - End If - - - If Gvr.DataKey("AplicaSerieLote") = "True" Then - TdSeriePS.Visible = True - TxtSeriePS.Focus() - - CveConsecSerieLote = Gvr.DataKey("Consec").ToString.ToEntero - PSSerieLote = Gvr.DataKey("PS").ToString - CvePSSerieLote = Gvr.DataKey("CvePS").ToEntero - CveUMSerieLote = Gvr.DataKey("CveUM").ToEntero - Exit Sub - End If - - - Dim CantidadEspecial = Gvr.DataKey("CveClasificacion").ToString.ToEntero.Contiene(17601, 17881) OrElse Gvr.DataKey("CvePS").ToString.ToEntero.Contiene(343032, 343033) - - If CantidadEspecial Then - RegistraScript("CantidadEspecial();window.setTimeout(FocusCantidadEspecial,200);") - LtlProductoCantidad.Text = $"{Gvr.DataKey("Codigo")}" - RowIndexCantidadEspecial = Gvr.RowIndex - CantidadEspecialTemp = Gvr.DataKey("CantidadF").ToDecimal - TxtCodigoPS.Text = "" - Exit Sub - Else - TxtCantidad.Text = (TxtCantidad.Text.ToDecimal + 1).ToString.FormatoNumero - TxtCodigoPS.Text = "" - UpDatos.Update() - Exit Sub - End If - - VerificaVentaSurtida() - Exit Sub - End If - - Existe = True - PSTemp = Gvr.DataKey("PS").ToString - 'Alert($"Ya se ha cargado la totalidad del Producto ""{Gvr.DataKey("PS").ToString}"" con el Codigo ""{TxtCodigoPS.Text}"".", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);") - 'VerificaVentaSurtida() - 'Exit Sub - End If - Next - - VerificaVentaSurtida() - If Existe Then - Alert($"Ya se ha cargado la totalidad del Producto ""{PSTemp}"" con el Codigo ""{TxtCodigoPS.Text}"".", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);") - Else - Alert($"No se ha encontrado un producto para surtir con el Codigo ""{TxtCodigoPS.Text}"". ", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);") - End If - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - TxtCodigoPS.Text = "" - - End Sub - Private Sub VerificaVentaSurtida() - Dim Surtida = True - - For Each Gvr As GridViewRow In GvDatos.Rows - If Gvr.DataKey("CantidadF").ToDecimal <> Gvr.FCTextBox("TbCantidadF").Text.ToDecimal Then - Surtida = False - Exit Sub - End If - Next - - If Surtida Then - LbSurtida.Visible = True - End If - End Sub - Protected Sub BtnSeriePS_Click(sender As Object, e As EventArgs) - AgregaSerieLote(TxtSeriePS.Text.Trim, 2) - - TdSeriePS.Visible = False - TxtSeriePS.Text = "" - TxtCodigoPS.Text = "" - TxtCodigoPS.Focus() - VerificaVentaSurtida() - - End Sub - Protected Sub BtnGuardarCantidadEspecial_Click(sender As Object, e As EventArgs) - AgregaCantidadEspecial() - End Sub - Private Sub AgregaCantidadEspecial() - Dim TxtCantidad = GvDatos.Rows(RowIndexCantidadEspecial).FCTextBox("TbCantidadF") - If CantidadEspecialTemp - TxtCantidadEspecialDiv.Text.ToDecimal - TxtCantidad.Text.ToDecimal >= 0 Then - TxtCantidad.Text = (TxtCantidad.Text.ToDecimal + TxtCantidadEspecialDiv.Text.ToDecimal).ToString.FormatoNumero - 'RegistraScript("$('#ModalCantidad').modal('hide');") - RegistraScript("$('#DivCantidadEspecial').hide(200);") - UpDatos.Update() - TxtCodigoPS.Focus() - Else - Alert("La cantidad excede la pendiente por surtir. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia, "window.setTimeout(Focus,200);") - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - End If - - TxtCantidadEspecialDiv.Text = "1" - End Sub -#End Region - -#End Region - - -#Region " GUARDAR " - Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) - - Select Case TipoEntrega - Case 1 - GuardaVenta() - Case 2 - GuardaTraspaso() - End Select - - End Sub - - Private Sub GuardaVenta() - - - '' INICIA: VALIDACIONES - - 'Valida el estatus de la Venta, si es = 5 O DevolucionVenta = 2, NO SE SURTE! - Dim ObjVentaInv As New ClsInventarios - If ObjVentaInv.GetEstatusVentaPorSurir(CveVentaSurtir) Then - TipoEstatus = ObjVentaInv.TipoEstatus - EsDevolucionVenta = ObjVentaInv.EsDevolucionVenta - End If - ObjVentaInv.Dispose() - - If TipoEstatus = 5 Or EsDevolucionVenta.Contiene(2, 3) Then - Alert("No se puede surtir esta venta, verifique que no esté cancelada o ya registrado su movimiento en almacen", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - - 'VALIDA CANTIDAD DE SALIDA - Dim Cantidad As Decimal = 0.0D - For Each Gvr As GridViewRow In GvDatos.Rows - If Gvr.FCCheckBox("cbInv").Checked AndAlso Gvr.FCTextBox("TbCantidadF").Text.ToDecimal > 0 Then - Cantidad = Gvr.FCTextBox("TbCantidadF").Text.ToDecimal - Exit For - End If - Next - - If Not Cantidad > 0 Then - Alert("No se detecto ningun movimiento por hacer. Por favor verifique e intente nuevamente.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'PROCESO , si tiene proceso "176" no lo valida - If Not UsuarioActual.TienePermisoProceso(176) Then - For Each Gvr As GridViewRow In GvDatos.Rows - If Gvr.DataKey("CantidadF").ToDecimal <> Gvr.FCTextBox("TbCantidadF").Text.ToDecimal Then - Alert("En la factura no se han especificado todos los productos a entregar, favor de especificarlos para poder dar salida.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - Next - End If - - If EsDevolucionVenta = 1 Or TipoDocto.Contiene({"Ped"}) Then - For Each Gvr As GridViewRow In GvDatos.Rows - If Not Gvr.FCCheckBox("cbInv").Checked Or (Gvr.FCCheckBox("cbInv").Checked AndAlso Gvr.FCTextBox("TbCantidadF").Text.ToDecimal <> Gvr.DataKey("CantidadC").ToString.ToDecimal) Then - Alert("Es necesario surtir todos los productos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - Exit Sub - End If - Next - End If - - If UsuarioActual.Empresa.Funcionalidad(563) = "1" Then - If Cantidad <> DtSeccionAlmacen.SUMD("CantidadSeccionAlmacen") Then - Alert("La seccion de almacen no ha sido agregada completamente.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - End If - - Dim EsInterno As Integer = -1 - If TipoDocto = "Ped" Then - EsInterno = If(Me.EsInterno, 1, 0) - End If - - Dim ObjInventario As New ClsInventarios - Dim ObjConta As New ClsContabilidad(ObjInventario.IniciaTransacSQL()) - Dim ObjVentas As New ClsVentas(ObjInventario.IniciaTransacSQL()) - Dim ObjEventos As New ClsOIEventos(ObjInventario.IniciaTransacSQL()) - Dim ObjAcumuladores As New ClsAcumuladores(ObjInventario.IniciaTransacSQL()) - Dim CveMovimiento As Integer - Dim Folio As Integer - Dim ErrorMovInv As Boolean - Dim DtDetalle As New DataTable - Dim DtDetalleLote As New DataTable - Dim TextoError = "" - - Dim CveMovimientoGarantia As Integer = -1 - Dim FolioGarantia As Integer = -1 - - Dim CveMovimientoVirtual As Integer = -1 - Dim FolioVirtual As Integer = -1 - - 'PASA DATOS DEL GV A DATATABLE PARA MANEJOR CON FOR EACH - Dim Index = 0 - For Each gvr As GridViewRow In GvDatos.Rows - If gvr.FCCheckBox("cbInv").Checked AndAlso gvr.FCTextBox("TbCantidadF").Text.ToDecimal > 0 Then - DtDatos.Rows(Index)("CantidadGV") = gvr.FCTextBox("TbCantidadF").Text.ToDecimal - DtDatos.Rows(Index)("CveSeccion") = gvr.FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero - DtDatos.Rows(Index)("Caducidad") = gvr.FCTextBox("TxtCaducidad").Text.ToDate - DtDatos.Rows(Index)("Lote") = gvr.FCTextBox("TxtLote").Text - End If - Index += 1 - Next - - 'VALIDA SI HUBO CAMBIOS EN LA EXISTENCIA - Dim DtDatosVenta As New DataTable - If ObjInventario.EntregaAlmacenGet(CveVentaSurtir) Then - DtDatosVenta = ObjInventario.DtResultados - End If - Dim CantidadGV = GvDatos.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.DataKey("CantidadF").ToDecimal) - If CantidadGV <> DtDatosVenta.SUM("CantidadF").ToDecimal Then - ObjInventario.RollBack() - ObjInventario.Dispose() - ObjConta.Dispose() - ObjVentas.Dispose() - ObjEventos.Dispose() - CargaVentaPorSurtir(CveVentaSurtir) - CargaPendientes() - Alert("Ha sido cambiada la informacion de existencias de la venta actual, se han recargado la información.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - If Not ObjVentas.UpdateVentasDevolucionAlmacen(3, CveVentaSurtir) Then - ObjInventario.RollBack() - ObjInventario.Dispose() - ObjConta.Dispose() - ObjVentas.Dispose() - ObjEventos.Dispose() - Exit Sub - End If - - Dim DtTraspasos As New DataTable - DtTraspasos.Columns.Add("CveAlmacen", GetType(Integer)) - DtTraspasos.Columns.Add("Almacen", GetType(String)) - DtTraspasos.Columns.Add("CveMovimientoSalida", GetType(Integer)) - DtTraspasos.Columns.Add("FolioSalida", GetType(Integer)) - DtTraspasos.Columns.Add("CveMovimientoEntrada", GetType(Integer)) - DtTraspasos.Columns.Add("FolioEntrada", GetType(Integer)) - - Dim CveMovimientoSalida = -1, FolioSalida = -1, CveMovimientoEntrada = -1, CveMovimientoEntradaApartado = -1, FolioEntrada = -1, CveMovimientoSalidaDevRem = -1, FolioMovimientoSalidaDevRem = -1, CveMovimientoEntradaDevRem = -1, FolioMovimientoEntradaDevRem = -1 - - Try - 'VALIDA EXISTENCIA 2 - If TipoMovimiento = 1 Then - Dim StrXML As New StringBuilder - StrXML.Append("") - For Each Dr As DataRow In DtDatos.Rows - If Dr("CantidadGV").ToString.ToDecimal > 0 Then - If CBool(Dr("AplicaSeccion")) Then - DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec"))) - For Each Dr1 As DataRow In DtDetalle.Rows - StrXML.AppendFormat("", Dr1("CvePS"), Dr1("CveUM"), 1, Dr1("SerieLote"), If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1), If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha)) - Next - ElseIf Dr("Inv_CveMetodoInventario").ToString = "6" Then - DtDetalle = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec"))) - For Each Dr1 As DataRow In DtDetalle.Rows - StrXML.AppendFormat("", Dr1("CvePS"), Dr1("CveUM"), DtDatosDetalleLote.SUM("Cantidad", $"Lote = '{Dr1("Lote").ToString}' AND Batch = '{Dr1("Batch").ToString}'"), Dr1("Lote")) - Next - Else - StrXML.AppendFormat("", Dr("CvePS"), Dr("CveUM"), Dr("CantidadGV"), "-1", If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1), If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha)) - End If - End If - Next - StrXML.Append("") - - Dim TieneErrorExistencia = False - If ObjInventario.GetExistenciasPSXML(StrXML.ToString(), DdlAlmacen.SelectedValue.ToEntero, TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveSubProyecto, CveVendedor, If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), If(TipoEntrega = 2, 1, -1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - If ObjInventario.DtResultados.Rows.Count > 0 Then - TieneErrorExistencia = True - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - TextoError += $" - {Dr("CodigoPS")} Existencia: {Dr("Existencia").ToString.ToDecimal.ToString("#,##0.##")}
    " - Next - End If - Else - TieneErrorExistencia = True - End If - - If TieneErrorExistencia Then - ObjInventario.RollBack() - ObjInventario.Dispose() - ObjConta.Dispose() - ObjVentas.Dispose() - ObjEventos.Dispose() - If TextoError.Length > 0 Then - Alert($" Lo(s) siguiente(s) Productos no tienen existencia suficiente:

    {TextoError}", TipoMensaje.MsgAdvertencia) - End If - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - Exit Sub - End If - - End If - - '' TERMINA: VALIDACIONES - - - '' COMIENZA: APARTADOS - Dim CantidadPendiente As Decimal = 0 - Dim CantidadSaldo As Decimal = 0 - - - If CveVendedor > 0 AndAlso (UsuarioActual.Empresa.Funcionalidad(146) = "1" Or CveCliente > 0) Then 'no debe considerar cuando es pedido de contrato - If TipoMovimiento = 1 Then ' SI ES DEVOLUCION NO APLICA APARTADO - ' SALIDA POR TRASPASO DE LOS ALMACENES DE APARTADO - For Each Dr As DataRow In DtDatos.Rows - If Dr("CantidadGV").ToString.ToDecimal > 0 Then - - If CBool(Dr("AplicaSerieLote")) Then - - DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec"))) - For Each Dr1 As DataRow In DtDetalle.Rows - If ObjInventario.GetExistenciasProducto(Dr1("CvePS").ToString.ToEntero, Dr1("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), SerieLote:=Dr1("SerieLote").ToString, CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then - For Each Dr2 As DataRow In ObjInventario.DtResultados.FiltraParametros("CveAlmacen > 0 AND ExistenciaFinal > 0").Rows - - 'BUSCA SI EXISTE YA UN TRASPASO DEL ALMACEN DE APARTADO - CveMovimientoSalida = DtTraspasos.FiltroPrimeroValor("CveMovimientoSalida", $"CveAlmacen = {Dr2("CveAlmacen")}").ToEntero - - If Not CveMovimientoSalida > 0 Then - CveMovimientoSalida = ObjInventario.AddMovimiento(Dr2("CveAlmacen").ToString.ToEntero, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, - Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), - CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero, Modulo:="RE/G1") - FolioSalida = ObjInventario.Folio - - If Not CveMovimientoSalida > 0 Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los movimientos de traspaso de apartado. Por favor vuelva a intentar." - Exit For - End If - - Dim DrMovto = DtTraspasos.NewRow - DrMovto("Almacen") = Dr2("Almacen").ToString.ToEntero - DrMovto("CveAlmacen") = Dr2("CveAlmacen").ToString.ToEntero - DrMovto("CveMovimientoSalida") = CveMovimientoSalida - DrMovto("FolioSalida") = FolioSalida - DtTraspasos.Rows.Add(DrMovto) - End If - - - CantidadPendiente = 1 - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, SerieLote:=Dr1("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar." - Exit For - End If - - DtDatosDetalle.Select($"Consec = {Dr1("Consec")}")(0)("FueTraspaso") = 1 - DtDatosDetalle.Select($"Consec = {Dr1("Consec")}")(0)("CveVentaDetalle") = Dr("CveVentaDetalle") - Dr("CantidadTraspaso") = Dr("CantidadTraspaso").ToString.ToDecimal + CantidadPendiente - Exit For - Next - End If - If ErrorMovInv Then Exit For - Next - - ElseIf Dr("Inv_CveMetodoInventario").ToString = "6" Then - - DtDetalle = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec"))) - For Each Dr1 As DataRow In DtDetalle.Rows - If ObjInventario.GetExistenciasProducto(Dr1("CvePS").ToString.ToEntero, Dr1("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), Lote:=Dr1("Lote").ToString, Batch:=Dr1("Batch").ToString, CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then - - CantidadSaldo = Dr("CantidadGV").ToString.ToDecimal - - For Each Dr2 As DataRow In ObjInventario.DtResultados.FiltraParametros("CveAlmacen > 0 AND ExistenciaFinal > 0").Rows - - 'BUSCA SI EXISTE YA UN TRASPASO DEL ALMACEN DE APARTADO - CveMovimientoSalida = DtTraspasos.FiltroPrimeroValor("CveMovimientoSalida", $"CveAlmacen = {Dr2("CveAlmacen")}").ToEntero - - If Not CveMovimientoSalida > 0 Then - CveMovimientoSalida = ObjInventario.AddMovimiento(Dr2("CveAlmacen").ToString.ToEntero, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, - Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), - CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero, Modulo:="RE/G2") - FolioSalida = ObjInventario.Folio - - If Not CveMovimientoSalida > 0 Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los movimientos de traspaso de apartado. Por favor vuelva a intentar." - Exit For - End If - - Dim DrMovto = DtTraspasos.NewRow - DrMovto("Almacen") = Dr2("Almacen").ToString.ToEntero - DrMovto("CveAlmacen") = Dr2("CveAlmacen").ToString.ToEntero - DrMovto("CveMovimientoSalida") = CveMovimientoSalida - DrMovto("FolioSalida") = FolioSalida - DtTraspasos.Rows.Add(DrMovto) - End If - - CantidadPendiente = If(Dr1("Cantidad").ToString.ToDecimal > CantidadSaldo, CantidadSaldo, Dr1("Cantidad").ToString.ToDecimal) - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, Lote:=Dr1("Lote").ToString, Batch:=Dr1("Batch").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar." - Exit For - End If - - DtDatosDetalle.Select($"Consec = {Dr1("Consec")}")(0)("FueTraspaso") = 1 - DtDatosDetalle.Select($"Consec = {Dr1("Consec")}")(0)("CveVentaDetalle") = Dr("CveVentaDetalle") - - CantidadSaldo -= CantidadPendiente - Dr("CantidadTraspaso") = Dr("CantidadTraspaso").ToString.ToDecimal + CantidadPendiente - If CantidadSaldo <= 0 Then Exit For - Next - End If - Next - - Else - - If ObjInventario.GetExistenciasProducto(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, -1, FechaMovto:=TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveTipoAlmacen:=9, CveVendedor:=CveVendedor, CveSubProyecto:=CveSubProyecto, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeApartados:=-1, Caducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then - - CantidadSaldo = Dr("CantidadGV").ToString.ToDecimal - - For Each Dr1 As DataRow In ObjInventario.DtResultados.FiltraParametros("CveAlmacen > 0 AND ExistenciaFinal > 0").Rows - - 'BUSCA SI EXISTE YA UN TRASPASO DEL ALMACEN DE APARTADO - CveMovimientoSalida = DtTraspasos.FiltroPrimeroValor("CveMovimientoSalida", $"CveAlmacen = {Dr1("CveAlmacen")}").ToEntero - - If Not CveMovimientoSalida > 0 Then - CveMovimientoSalida = ObjInventario.AddMovimiento(Dr1("CveAlmacen").ToString.ToEntero, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, - Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, - CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero, Modulo:="RE/G3") - FolioSalida = ObjInventario.Folio - - If Not CveMovimientoSalida > 0 Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los movimientos de traspaso de apartado. Por favor vuelva a intentar." - Exit For - End If - - Dim DrMovto = DtTraspasos.NewRow - DrMovto("Almacen") = Dr1("Almacen").ToString.ToEntero - DrMovto("CveAlmacen") = Dr1("CveAlmacen").ToString.ToEntero - DrMovto("CveMovimientoSalida") = CveMovimientoSalida - DrMovto("FolioSalida") = FolioSalida - DtTraspasos.Rows.Add(DrMovto) - End If - - - CantidadPendiente = If(Dr1("ExistenciaFinal").ToString.ToDecimal > CantidadSaldo, CantidadSaldo, Dr1("ExistenciaFinal").ToString.ToDecimal) - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, CantidadPendiente.ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, - SerieLote:=Dr("SerieLote").ToString, - CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, - FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), - Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), - CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar." - Exit For - End If - - CantidadSaldo -= CantidadPendiente - Dr("CantidadTraspaso") = Dr("CantidadTraspaso").ToString.ToDecimal + CantidadPendiente - If CantidadSaldo <= 0 Then Exit For - Next - - If ErrorMovInv Then Exit For - Else - ErrorMovInv = True - End If - - End If - If ErrorMovInv Then Exit For - - End If - - Next - - 'ENTRADA POR TRASPASO AL ALMACEN GENERAL - If Not ErrorMovInv Then - For Each Dr1 As DataRow In DtTraspasos.Rows - CveMovimientoSalida = Dr1("CveMovimientoSalida").ToString.ToEntero - - CveMovimientoEntradaApartado = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, - Observaciones:=TxtObservaciones.Text.Trim, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero, CveMovimientoRelacionado:=CveMovimientoSalida, - Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, CveCliente:=CveCliente, Modulo:="RE/G4") - FolioEntrada = ObjInventario.Folio - - If Not CveMovimientoEntradaApartado > 0 Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los movimientos de traspaso de apartado. Por favor vuelva a intentar." - Exit For - End If - - Dr1("CveMovimientoEntrada") = CveMovimientoEntradaApartado - Dr1("FolioEntrada") = FolioEntrada - - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, SerieLote:=Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar." - Exit For - End If - Next - End If - - If ErrorMovInv Then Exit For - - Next - End If - End If - End If - '' TERMINA: APARTADOS - - ' COMIENZA: GARANTIAS - If TipoDocto.Contiene("Ing", "Rem") AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso TipoMovimiento = 1 Then - - Dim CveAlmacenGarantia As Integer = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 6).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero() - Dim DtGarantias As DataTable = Nothing - - If ObjAcumuladores.GetGarantiasDetalle(CveVentaSurtir) Then - DtGarantias = ObjAcumuladores.DtResultados.Copy() - End If - - If DtGarantias IsNot Nothing AndAlso DtGarantias.Rows.Count > 0 AndAlso CveAlmacenGarantia > 0 Then - CveMovimientoGarantia = ObjInventario.AddMovimiento(CveAlmacenGarantia, 2, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, Modulo:="RE/G5") - FolioGarantia = ObjInventario.Folio - - For Each RowGarantia As DataRow In DtGarantias.Rows - Dim CvePS = RowGarantia("CvePS").ToString().ToEntero() - Dim CveTamaño As Integer = RowGarantia("CveTamaño").ToString().ToEntero() - Dim CveUM As Integer = RowGarantia("CveUnidadMedida").ToString().ToEntero() - Dim PU As Decimal = RowGarantia("Importe").ToString().ToDecimal() ' / RowGarantia("Cantidad").ToString().ToDouble() - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoGarantia, RowGarantia("Cantidad").ToString().ToDouble(), CveUM, CvePS, PU, -1) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar." - Exit For - End If - Next - End If - End If - ' TERMINA: GARANTIAS - - - - If Not ErrorMovInv Then - Dim ConceptoMovimiento = 3 - ConceptoMovimiento = If(TipoMovimiento = 1, ConceptoMovimiento, 18) - ConceptoMovimiento = If(CveAlmacenTraspasoDestino > 0, 8, ConceptoMovimiento) - - Dim Almacen1 = DdlAlmacen.SelectedValue.ToEntero - - If TipoDocto = "Rem" AndAlso CveAlmacenTraspasoDestino = 0 Then - ErrorMovInv = True - TextoError = "Ocurrió un error. no se tiene definido el almacen destino" - End If - - 'DEVOLUCION REMISION - If TipoMovimiento = 2 And TipoDocto = "Rem" Then - ConceptoMovimiento = 8 - Almacen1 = CveAlmacenTraspasoDestino - CveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero - End If - - 'CANCELACION DE DEVOLUCION - If TipoMovimiento = 2 And TipoDocto = "Dev" And EsDevolucionVenta = 1 Then - ConceptoMovimiento = 3 - Almacen1 = DdlAlmacen.SelectedValue.ToEntero - CveAlmacenTraspasoDestino = DdlAlmacen.SelectedValue.ToEntero - End If - - 'DEVOLUCION DIRECTA A ENTREGA POR ADELANTADO - If TipoMovimiento = 2 And ConceptoMovimiento = 18 AndAlso EsDevolucionDirecta Then - ConceptoMovimiento = 41 - End If - - CveMovimiento = ObjInventario.AddMovimiento(Almacen1, ConceptoMovimiento, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, - CveContrato:=CveContrato, CveAlmacenDestino:=CveAlmacenTraspasoDestino, Modulo:="RE/G7") - Folio = ObjInventario.Folio - - 'SALIDA DE ALMACEN - SALIDA POR TRASPASO CUANDO ES REMISION - DEVOLUCION (SI ES TRASPASO Y TIENE CONTRATO NO HACE DEVOLUCIóN) - 'If Not (CveContrato > 0 And CveAlmacenTraspasoDestino > 0) Then - If CveMovimiento > 0 Then - - 'SACA LO DE TRASPASOS - APARTADO - For Each Dr1 As DataRow In DtTraspasos.Rows - CveMovimientoSalida = Dr1("CveMovimientoEntrada").ToString.ToEntero - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - If ObjInventario.DtResultados.Rows.Count = 0 Then - ErrorMovInv = True - TextoError = "Ocurrió un error, no se tienen registros que ingresar" - Exit Sub - End If - - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, SerieLote:=Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar." - Exit For - End If - Next - Else - ErrorMovInv = True - TextoError = "Ocurrió un error al obtener los registros" - End If - If ErrorMovInv Then Exit For - Next - - 'ES EL MOVIMIENTO PRINCIPAL - CantidadPendiente = 0 - Dim Cont As Integer = 0 - For Each Dr As DataRow In DtDatos.Rows - CantidadPendiente = Dr("CantidadGV").ToString.ToDecimal - Dr("CantidadTraspaso").ToString.ToDecimal - If CantidadPendiente > 0 Then - Dim PU As Decimal = 0 - - 'SI FUE POR SERIELOTE - DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) - DtDetalleLote = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) - If DtDetalle.Rows.Count > 0 Then - For Each Dr1 As DataRow In DtDetalle.Rows - If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then - PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, SerieLote:=Dr1("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." - Exit For - End If - Next - ElseIf DtDetalleLote.Rows.Count > 0 Then - For Each Dr1 As DataRow In DtDetalleLote.Rows - If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then - PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero} AND SerieLote = '{Dr1("SerieLote").ToString}'").ToString.ToDecimal - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr1("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, Batch:=Dr1("Batch").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." - Exit For - End If - Next - Else - If TipoMovimiento = 2 AndAlso DtExistencias IsNot Nothing Then - PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString.ToEntero}").ToString.ToDecimal - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, CantidadPendiente, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, PU, -1, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("Caducidad").ToString.ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString, "-1"), CveSeccionAlmacen:=If(CBool(Dr("AplicaSeccion")), Dr("CveSeccion").ToString.ToEntero, -1)) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar." - Exit For - End If - End If - If ObjInventario.CveMovimientoDetalle > 0 AndAlso DtSeccionAlmacen.Rows.Count > 0 Then - For Each Dr2 As DataRow In DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {Cont}").Rows - If Not ObjInventario.AddMovimientosDetalleSeccionesAlmacen(ObjInventario.CveMovimientoDetalle, Dr2("CveSeccionAlmacen").ToString.ToEntero, -Dr2("CantidadSeccionAlmacen").ToString.ToDecimal) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar las secciones de almacen. Por favor vuelva a intentar." - Exit For - End If - Next - End If - Cont += 1 - End If - Next - Else - ErrorMovInv = True - End If - End If - 'End If - - - 'ENTRADA POR TRASPASO CUANDO ES REMISION - If Not ErrorMovInv Then - If CveAlmacenTraspasoDestino > 0 AndAlso Not (TipoMovimiento = 2 And TipoDocto = "Dev" And EsDevolucionVenta = 1) Then ' TRASPASO CUANDO ES REMISION - CveMovimientoEntrada = ObjInventario.AddMovimiento(CveAlmacenTraspasoDestino, 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, - CveMovimientoRelacionado:=CveMovimiento, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero, Modulo:="RE/G8") - FolioEntrada = ObjInventario.Folio - - If CveMovimientoEntrada <= 0 Then - TextoError = "No se pudo generar el movimiento de entrada correctamente" - ErrorMovInv = True - Else - If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString, EsInterno:=EsInterno, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero()) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al guardar los movimientos de entrada" - Exit For - End If - Next - Else - ErrorMovInv = True - TextoError = "Ocurrió un error al guardar los movimientos de entrada" - End If - End If - - Else 'REGISTRO LA PREPOLIZA DE COSTO VS ALMACEN - SALIDA ALMACEN - Dim DtCostos As DataTable = Nothing - Dim ValorInventario As Decimal = 0 - If ObjInventario.GetMovimientosDetalle(CveMovimiento, UsuarioActual.CveEmpresa) Then - DtCostos = ObjInventario.DtResultados - - Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"}) - Dim IdCtaContableAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {DdlAlmacen.SelectedValue}").ToEntero - Dim CveCuentaAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContableSIG", $"CveAlmacen = {DdlAlmacen.SelectedValue}").ToEntero - Dim IdCtaContable As Integer = 0 - Dim CveCuenta As Integer = 0 - If tmpCostos.Rows.Count > 0 Then - - - If ObjVentas.GetVenta(CveVentaSurtir, UsuarioActual.CveEmpresa) Then - Dim Fecha As Date = TxtFecha.Text.ToDate ' If(TipoMovimiento <> 1, TxtFecha.Text.ToDate, ObjVentas.DtResultados(0)("Fecha").ToString.ToDate) - Dim CveCliente As Integer = ObjVentas.DtResultados(0)("CveCliente").ToString.ToEntero - Dim ClienteNombre As String = ObjVentas.DtResultados(0)("ClienteNombre").ToString - Dim SerieFolio As String = ObjVentas.DtResultados(0)("SerieFolio").ToString - Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundSQL() - Dim TotalCostoAcumulado As Decimal = 0 - Dim cont As Integer = 1 - - Dim ValorMultiplicador = 1 - - If TipoMovimiento = 1 Then - ValorMultiplicador = 1 - ElseIf TipoMovimiento = 2 Then - ValorMultiplicador = -1 - ElseIf TipoMovimiento = 2 AndAlso TipoDocto.Contiene({"Dev"}) And (EsDevolucionVenta = 1) Then - ValorMultiplicador = 1 - End If - - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inventario/RecepcionEntrega", 4, TotalCosto, TotalCosto, 1, Fecha, ClienteNombre, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - 'Se agrega movimiento separado por la cuenta de ventas (ER) - - If CvePrePoliza > 0 Then - - For Each RowInv As DataRow In tmpCostos.Rows - ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundSQL() - TotalCostoAcumulado += ValorInventario - - 'cuando es el último movimiento y hay diferencias en los importes - If cont = DtCostos.FiltraParametros("", "", {"CveClasificacion"}).Rows.Count AndAlso TotalCosto <> TotalCostoAcumulado Then - ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado) - End If - - 'Concepto = String.Format("{0} - {1}", Row2("Clasificacion").ToString, Row2("SubProyecto").ToString) - IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostosSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero - - If Not ErrorMovInv Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ValorMultiplicador * ValorInventario, SerieFolio, 69, SerieFolio, Fecha, IdCtaContable, -1, CveVenta:=CveVentaSurtir, CveCliente:=CveCliente, CveMovimientoAlmacen:=CveMovimiento, CveSubProyecto:=CveSubProyecto, ImporteMX:=ValorMultiplicador * ValorInventario, CveCuenta:=CveCuenta, CveClasificacion:=RowInv("CveClasificacion").ToString.ToEntero) Then - ErrorMovInv = True - End If - End If - - cont += 1 - Next - - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ValorMultiplicador * TotalCosto, SerieFolio, 68, SerieFolio, Fecha, IdCtaContableAlmacen, -1, CveVenta:=CveVentaSurtir, CveCliente:=CveCliente, CveMovimientoAlmacen:=CveMovimiento, CveSubProyecto:=CveSubProyecto, ImporteMX:=ValorMultiplicador * TotalCosto, CveCuenta:=CveCuentaAlmacen) Then - ErrorMovInv = True - End If - - 'AutoConta - El movimiento 1 es el de Venta - Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1" - - If AutoConta And Not ErrorMovInv Then - Dim ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa) - - If IdCtaContable > 0 Then - If Not ObjConta.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContPaq) Then - Alert("Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico") - ErrorMovInv = True - TextoError = "Ocurrio un Error al contabilizar, pongase en contacto con Soporte Técnico" - End If - Else - Alert(String.Format("No se puede contabilizar ya que falta asignación de las cuentas contables"), TipoMensaje.MsgAdvertencia) - End If - - ObjContPaq.Dispose() - End If - Else - ErrorMovInv = True - TextoError = "Ocurrió un Error al ingresar la prepoliza.1" - End If - Else - ErrorMovInv = True - TextoError = "Ocurrió un Error al ingresar las prepolizas.2" - End If - Else - ErrorMovInv = True - TextoError = "Ocurrió un Error al ingresar las prepolizas.3" - End If - Else - ErrorMovInv = True - TextoError = "Ocurrió un Error al ingresar las prepolizas.4" - End If - End If - - End If - - 'DEVOLUCION APARTADOS - If Not ErrorMovInv Then - If TipoMovimiento = 2 Then - If ObjInventario.VentasAlmacenApartadosGet(CveVentaSurtir) Then - - Dim DtTempApartados = ObjInventario.DtResultados.FiltraParametros("CveTipoAlmacen = 9", "CveAlmacen") - Dim CveMovimientoSalidaApartado = -1 - Dim CveAlmacenApartado = -1 - Dim CveAlmacenOrigen = If(CveAlmacenTraspasoDestino > 0, CveAlmacenTraspasoDestino, DdlAlmacen.SelectedValue.ToEntero) - - For Each Dr As DataRow In DtTempApartados.Rows - - If CveMovimientoSalidaApartado = -1 Or CveAlmacenApartado <> Dr("CveAlmacen").ToString.ToEntero Then - CveMovimientoSalidaApartado = ObjInventario.AddMovimiento(CveAlmacenOrigen, 8, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, - Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, CveCliente:=CveCliente, - CveAlmacenDestino:=Dr("CveAlmacen").ToString.ToEntero, Modulo:="RE/G9") - FolioSalida = ObjInventario.Folio - CveAlmacenApartado = Dr("CveAlmacen").ToString.ToEntero - - Dim DrMovto = DtTraspasos.NewRow - DrMovto("Almacen") = Dr("Almacen").ToString.ToEntero - DrMovto("CveAlmacen") = Dr("CveAlmacen").ToString.ToEntero - DrMovto("CveMovimientoSalida") = CveMovimientoSalidaApartado - DrMovto("FolioSalida") = FolioSalida - DtTraspasos.Rows.Add(DrMovto) - End If - - If Not CveMovimientoSalidaApartado > 0 Then - ErrorMovInv = True - TextoError = "Ocurrió un error al guardar los movimientos de control de apartados" - Exit For - End If - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalidaApartado, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al guardar los movimientos de control de apartados" - Exit For - End If - Next - - If Not ErrorMovInv Then - For Each Dr1 As DataRow In DtTraspasos.Rows - CveMovimientoSalida = Dr1("CveMovimientoSalida").ToString.ToEntero - - CveMovimientoEntradaApartado = ObjInventario.AddMovimiento(Dr1("CveAlmacen").ToString.ToEntero, 9, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, - -1, CveVentaSurtir, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, CveAlmacenDestino:=DdlAlmacen.SelectedValue.ToEntero, - CveMovimientoRelacionado:=CveMovimientoSalida, Guia:=TxtGuia.Text, CveContrato:=CveContrato, CveVendedor:=CveVendedor, - CveCliente:=CveCliente, Modulo:="RE/G10") - FolioEntrada = ObjInventario.Folio - - If Not CveMovimientoEntradaApartado > 0 Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los movimientos de traspaso de apartado. Por favor vuelva a intentar." - Exit For - End If - - Dr1("CveMovimientoEntrada") = CveMovimientoEntradaApartado - Dr1("FolioEntrada") = FolioEntrada - - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntradaApartado, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar." - Exit For - End If - Next - End If - - If ErrorMovInv Then Exit For - - Next - End If - - End If - End If - End If - - 'QUEMAR REMISIONES - If Not ErrorMovInv And EsDevolucionVenta = 1 And TipoDocto = "Ing" Then - Dim DtDevRem As New DataTable - - 'CARGA REMISIONES DE LA VENTA DEVUELTA - If ObjInventario.GetDevolucionRemisionesFacturadas(CveVentaSurtir) Then - DtDevRem = ObjInventario.DtResultados.FiltraParametros("CantidadAlmacen = 0") - Else - ErrorMovInv = True - End If - - If Not ErrorMovInv Then - If DtDevRem.Rows.Count > 0 Then - For Each DrMovtos As DataRow In DtDevRem.FiltraParametros("", "CveRem", {"CveRem"}).Rows - If Not ObjInventario.ActualizarEsDevolucionVenta(DrMovtos("CveRem").ToString.ToEntero, 2) Then - TextoError = "Ocurrió un error al hacer la devolución hacia la remision. Por favor vuelva a intentar." - ErrorMovInv = True - Exit For - End If - Next - End If - Else - TextoError = "Ocurrió un error al hacer la devolucion a remisión. Por favor vuelva a intentar." - ErrorMovInv = True - End If - - End If - - 'QUEMA DEVOLUCION | QUEMA = LA QUITA DE PENDIENTE POR RECIBIR (DEVOLVER) - If Not ErrorMovInv And EsDevolucionVenta = 1 Then - If Not ObjVentas.UpdateVentasDevolucionAlmacen(2, CveVentaSurtir) Then - TextoError = "Ocurrió un error al hacer la devolución. Por favor vuelva a intentar." - ErrorMovInv = True - End If - End If - - If Not ErrorMovInv And EsDevolucionVenta = 0 Then - If Not ObjVentas.UpdateVentasDevolucionAlmacen(0, CveVentaSurtir) Then - TextoError = "Ocurrió un error al hacer la devolucion. Por favor vuelva a intentar." - ErrorMovInv = True - End If - End If - - ' COMIENZA: VIRTUAL - If Not ErrorMovInv AndAlso TipoDocto.Contiene("Ing", "Dev") AndAlso UsuarioActual.Empresa.Funcionalidad(573) = "1" AndAlso CveMovimiento > 0 Then - Dim DtPSVirtual As New DataTable("DtTamanios") - - If ObjInventario.GetMovimientosDetalleVirtual(CveMovimiento, UsuarioActual.CveEmpresa) Then - DtPSVirtual = ObjInventario.DtResultados - End If - - ' - 'DtPSVirtual.Columns.Add(New DataColumn("CvePS", GetType(Integer))) - 'DtPSVirtual.Columns.Add(New DataColumn("Cantidad", GetType(Decimal))) - 'DtPSVirtual.Columns.Add(New DataColumn("PU", GetType(Decimal))) - 'DtPSVirtual.Columns.Add(New DataColumn("CveUM", GetType(Integer))) - - 'Dim DtTamanios As DataTable = Nothing - - 'If ObjAcumuladores.TamañoGet(-1, UsuarioActual.CveEmpresa) Then - ' DtTamanios = ObjAcumuladores.DtResultados.Copy() - 'End If - - Dim CveConceptoMovimientoVirtual As Integer = -1 - Dim CveAlmacenVirtual As Integer = -1 - Dim CveMovimientoRelacionadoVirtual As Integer = CveMovimiento - Dim ValidaVirtual As Boolean = False - CveAlmacenVirtual = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 24).FiltroPrimeroValor("CveAlmacen", $"CveSubProyecto={CveSubProyecto}").ToEntero() - - If TipoMovimiento = 1 Then - CveConceptoMovimientoVirtual = 37 - - ElseIf TipoMovimiento = 2 Then - ValidaVirtual = True - CveConceptoMovimientoVirtual = 36 - End If - - If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then - CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, - Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveMovimientoRelacionado:=CveMovimientoRelacionadoVirtual, Modulo:="RE/G6") - FolioVirtual = ObjInventario.Folio - - If CveMovimientoVirtual > 0 Then - For Each RowUsado As DataRow In DtPSVirtual.Rows - Dim CvePS = RowUsado("CvePS").ToString().ToEntero() - Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble() - Dim PU As Decimal = RowUsado("PU").ToString().ToDecimal() - Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero() - - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos de traspaso de apartado. Por favor vuelva a intentar." - Exit For - End If - Next - Else - ErrorMovInv = True - End If - - Else - If ValidaVirtual Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar el movimiento en almacen virtual. Por favor vuelva a intentar." - - End If - End If - - If DtPSVirtual.Rows.Count = 0 AndAlso ValidaVirtual = True Then - ErrorMovInv = True - TextoError = "No se tienen productos para el almacen virtual." - End If - End If - - ' TERMINA: VIRTUAL - - - 'AGREGA BITACORA A VENTA - If Not ErrorMovInv Then - Dim MensajeBitacora = If(TipoMovimiento = 1, "Surtida", "Devuelta") - If Not ObjEventos.AddEventoBitacora(String.Format("Venta {2} en Folio: {1}", CveMovimiento, Folio, MensajeBitacora), "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveVenta:=CveVentaSurtir) Then - ErrorMovInv = True - End If - End If - - Catch ex As Exception - ErrorMovInv = True - OnError("Ocurrió un error al guardar", ex) - End Try - - If Not ErrorMovInv Then - ObjInventario.Commit() - RegistraScript("playsonidito('beep-07.wav')") - Dim Msg As New StringBuilder - - Msg.AppendFormat("Movimiento {2}: {1}", CveMovimiento, Folio, If(TipoMovimiento = 1, "Salida", "Entrada")) - Msg.AppendFormat("
    Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimiento))) - - If CveMovimientoEntrada > 0 Then - Msg.AppendFormat("

    Movimiento Entrada (Traspaso): {1}", CveMovimientoEntrada, FolioEntrada) - Msg.AppendFormat("
    Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoEntrada))) - End If - - If DtTraspasos.Rows.Count > 0 Then - Msg.AppendFormat("

    Movimientos de Control (Apartados):") - For Each Dr As DataRow In DtTraspasos.Rows - Msg.AppendFormat("
    Almacén {0} | Salida por Traspaso: {2} | Entrada por Traspaso: {4} ", Dr("Almacen"), Dr("CveMovimientoSalida"), Dr("FolioSalida"), Dr("CveMovimientoEntrada"), Dr("FolioEntrada")) - Next - End If - - If CveMovimientoGarantia > 0 Then - Msg.AppendFormat("
    Movimiento de Entrada (garantías): {1}", CveMovimientoGarantia, FolioGarantia) - Msg.AppendFormat("
    Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoGarantia))) - End If - - If CveMovimientoVirtual > 0 Then - Msg.AppendFormat("

    {0} Almacen Virtual: ", If(TipoMovimiento = 1, "Salida", "Entrada")) - Msg.AppendFormat("{1}", CveMovimientoVirtual, FolioVirtual) - Msg.AppendFormat("
    Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoVirtual))) - End If - - Alert(Msg.ToString, TipoMensaje.MsgInformacion) - - Limpia() - CargaPendientes() - Else - ObjInventario.RollBack() - Alert(TextoError, TipoMensaje.MsgError) - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - End If - - ObjAcumuladores.Dispose() - ObjInventario.Dispose() - ObjConta.Dispose() - ObjVentas.Dispose() - ObjEventos.Dispose() - - End Sub - - Private Sub GuardaTraspaso() - - 'OBLIGA A SURTIR TODO - For Each Gvr As GridViewRow In GvDatos.Rows - If Not Gvr.FCCheckBox("cbInv").Checked Or (Gvr.FCCheckBox("cbInv").Checked AndAlso Gvr.FCTextBox("TbCantidadF").Text.ToDecimal <> Gvr.DataKey("CantidadC").ToString.ToDecimal) Then - Alert("Es necesario surtir todos los productos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - Exit Sub - End If - Next - - 'VALIDA TRANSITORIO - If ChkTransitorio.Checked Then - If TxtResponsable.Text.Trim = "" Then - Alert("Debe seleccionar un responsable para el traspaso transitorio.", TipoMensaje.MsgAdvertencia) - RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')") - If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(200);") - Exit Sub - End If - - If DdlAlmacenTransitorio.SelectedValue.ToEntero <= 0 Then - Alert("Debe seleccionar un almacen transitorio.", TipoMensaje.MsgAdvertencia) - RegistraScript("playsonidito(''142608__autistic-lucario__error.wav'')") - If ChkTransitorio.Checked Then RegistraScript("$('#DivTransitorio').show(200);") - Exit Sub - End If - End If - - Dim ObjInventario As New ClsInventarios : ObjInventario.IniciaTransacSQL() - Dim CveMovimientoSalida As Integer - Dim ConceptoMovimiento = 0 - Dim FolioSalida As Integer - Dim CveMovimientoEntrada As Integer - Dim FolioEntrada As Integer - Dim ErrorMovInv As Boolean - Dim DtDetalle As New DataTable - Dim DtDetalleLote As New DataTable - Dim TextoError = "" - - 'PASA DATOS DEL GV A DATATABLE PARA MANEJOR CON FOR EACH - Dim Index = 0 - For Each gvr As GridViewRow In GvDatos.Rows - If gvr.FCCheckBox("cbInv").Checked AndAlso gvr.FCTextBox("TbCantidadF").Text.ToDecimal > 0 Then - DtDatos.Rows(Index)("CantidadGV") = gvr.FCTextBox("TbCantidadF").Text.ToDecimal - End If - Index += 1 - Next - - 'VALIDA SI HUBO CAMBIOS EN LA EXISTENCIA - Dim DtDatosTraspaso As New DataTable - If ObjInventario.EntregaAlmacenTraspasosGet(CveTraspasoSurtir) Then - DtDatosTraspaso = ObjInventario.DtResultados - End If - Dim CantidadGV = GvDatos.Rows.Cast(Of GridViewRow)().Sum(Function(gvr) gvr.DataKey("CantidadF").ToDecimal) - If DtDatos.SUM("CantidadF") <> DtDatosTraspaso.SUM("CantidadF") Then - ObjInventario.RollBack() - ObjInventario.Dispose() - CargaTraspasoPorSurtir(CveTraspasoSurtir) - CargaPendientes() - Alert("Ha sido cambiada la informacion de existencias del traspaso actual. Por favor verifique.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'VALIDA QUE EL TRASPASO SIGA VIGENTE - If ObjInventario.AddTrasladoSolicitudGet(CveTraspasoSurtir, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 AndAlso ObjInventario.DtResultados.Rows(0)("CveTrasladoEstatus").ToString = "2" Then - ObjInventario.RollBack() - ObjInventario.Dispose() - CargaTraspasoPorSurtir(CveTraspasoSurtir) - CargaPendientes() - Alert("Ha sido cambiada la informacion del traspaso actual. Por favor verifique.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'VALIDA ALMACENES - Dim Almacen1 = DdlAlmacen.SelectedValue.ToEntero - Dim Almacen2 = CveAlmacenTraspasoDestino - If Almacen1 <= 0 Or Almacen2 <= 0 Then - Alert("Ocurrió un error al obtener los almacenes del movimiento. Por favor recargue y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - ObjInventario.RollBack() - ObjInventario.Dispose() - Exit Sub - End If - - 'VERIFICAR EXISTENCIA - Dim StrXML As New StringBuilder - StrXML.Append("") - For Each Dr As DataRow In DtDatos.Rows - If Dr("CantidadGV").ToString.ToDecimal > 0 Then - If Dr("Inv_CveMetodoInventario").ToString = "5" Then - DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec"))) - For Each Dr1 As DataRow In DtDetalle.Rows - StrXML.AppendFormat("", Dr1("CvePS"), Dr1("CveUM"), 1, Dr1("SerieLote")) - Next - ElseIf Dr("Inv_CveMetodoInventario").ToString = "6" Then - DtDetalle = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0}", Dr("Consec"))) - For Each Dr1 As DataRow In DtDetalle.Rows - StrXML.AppendFormat("", Dr1("CvePS"), Dr1("CveUM"), DtDatosDetalleLote.SUM("Cantidad", $"Lote = '{Dr1("Lote").ToString}' AND Batch = '{Dr1("Batch").ToString}'"), Dr1("Lote")) - Next - Else - StrXML.AppendFormat("", Dr("CvePS"), Dr("CveUM"), Dr("CantidadGV"), "-1") - End If - End If - Next - StrXML.Append("") - - Dim TieneErrorExistencia = False - If ObjInventario.GetExistenciasPSXML(StrXML.ToString(), DdlAlmacen.SelectedValue.ToEntero, TxtFecha.Text.ToDateTime.ToString("yyyy/MM/dd HH:mm"), CveSubProyecto, CveVendedor, If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), If(TipoEntrega = 2, 1, -1), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - If ObjInventario.DtResultados.Rows.Count > 0 Then - TieneErrorExistencia = True - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - TextoError += $" - {Dr("CodigoPS")} Existencia: {Dr("Existencia").ToString.ToDecimal.ToString("#,##0.##")}
    " - Next - End If - Else - TieneErrorExistencia = True - End If - - If TieneErrorExistencia Then - ObjInventario.RollBack() - ObjInventario.Dispose() - If TextoError.Length > 0 Then - Alert($" Lo(s) siguiente(s) Productos no tienen existencia suficiente:

    {TextoError}", TipoMensaje.MsgAdvertencia) - End If - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - Exit Sub - End If - - 'SALIDA POR TRASPASO - If Not ErrorMovInv Then - ConceptoMovimiento = 26 - CveMovimientoSalida = ObjInventario.AddMovimiento(Almacen1, ConceptoMovimiento, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, Guia:="", - CveContrato:=-1, CveAlmacenDestino:=CveAlmacenTraspasoDestino, Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, ""), Modulo:="RE/GT") - FolioSalida = ObjInventario.Folio - If CveMovimientoSalida > 0 Then - Dim CantidadPendiente As Decimal = 0 - - For Each Dr As DataRow In DtDatos.Rows - DtDetalle = DtDatosDetalle.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) - DtDetalleLote = DtDatosDetalleLote.FiltraParametros(String.Format("ConsecId = {0} AND FueTraspaso IS NULL", Dr("Consec"))) - If DtDetalle.Rows.Count > 0 Then 'SI FUE POR SERIELOTE - For Each Dr1 As DataRow In DtDetalle.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, 1, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, SerieLote:=Dr1("SerieLote").ToString, CveVentaDetalle:=-1, CveContratoDetalle:=Dr("CveContratoDetalle").ToString.ToEntero) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." - Exit For - End If - Next - ElseIf DtDetalleLote.Rows.Count > 0 Then 'SI FUE POR LOTE BATCH - For Each Dr1 As DataRow In DtDetalleLote.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr1("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, Lote:=Dr1("Lote").ToString, Batch:=Dr1("Batch").ToString, CveVentaDetalle:=-1, CveContratoDetalle:=Dr("CveContratoDetalle").ToString.ToEntero) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos con serie. Por favor vuelva a intentar." - Exit For - End If - Next - Else 'NORMAL - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoSalida, Dr("CantidadGV").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, 0, -1, -1, CveContratoDetalle:=Dr("CveContratoDetalle").ToString.ToEntero) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al procesar los conceptos de salida. Por favor vuelva a intentar." - Exit For - End If - End If - Next - Else - TextoError = "Ocurrió un error al generar el movimiento de salida." - ErrorMovInv = True - End If - End If - - 'ENTRADA POR TRASPASO - If Not ErrorMovInv Then - 'sino es transitorio, los transitorios, ya no se hace otro movimiento - If Not ChkTransitorio.Checked Then - ConceptoMovimiento = 27 ' If(ChkTransitorio.Checked, 2, 27) - Almacen2 = If(ChkTransitorio.Checked, DdlAlmacenTransitorio.SelectedValue.ToEntero, CveAlmacenTraspasoDestino) - CveMovimientoEntrada = ObjInventario.AddMovimiento(Almacen2, ConceptoMovimiento, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, - Guia:="", CveContrato:=CveContrato, CveMovimientoRelacionado:=CveMovimientoSalida, CveAlmacenDestino:=CveAlmacenTraspasoDestino, - Recibio:=If(ChkTransitorio.Checked, TxtResponsable.Text.Trim, ""), Modulo:="RE/GT1") - FolioEntrada = ObjInventario.Folio - If CveMovimientoEntrada > 0 Then - If ObjInventario.GetMovimientosDetalle(CveMovimientoSalida, UsuarioActual.CveEmpresa) Then - For Each Dr As DataRow In ObjInventario.DtResultados.Rows - If Not ObjInventario.AddMovimientoDetalle(CveMovimientoEntrada, Dr("Cantidad").ToString.ToDecimal, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, -1, Dr("SerieLote").ToString, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, Lote:=Dr("Lote").ToString, Batch:=Dr("Batch").ToString) Then - ErrorMovInv = True - TextoError = "Ocurrió un error al guardar los movimientos de entrada" - Exit For - End If - Next - End If - Else - TextoError = "Ocurrió un error al generar el movimiento de entrada" - ErrorMovInv = True - End If - End If - - End If - - 'MARCA SOLICITUD CON EL MOVIMIENTO GENERADO - If Not ErrorMovInv Then - If Not ObjInventario.UpdateTraspasoSolicitudMovimiento(CveTraspasoSurtir, CveMovimientoSalida) Then - TextoError = "Ocurrió un error al vincular los movimientos con la solicitud de traspaso. Por favor verifique y vuelva a intentar" - ErrorMovInv = True - End If - End If - - - If Not ErrorMovInv Then - ObjInventario.Commit() - RegistraScript("playsonidito('beep-07.wav')") - - Dim Msg As New StringBuilder - Msg.AppendFormat("Movimiento Salida: {1}", CveMovimientoSalida, FolioSalida) - Msg.AppendFormat("
    Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoSalida))) - - Msg.AppendFormat("

    Movimiento Entrada (Traspaso): {1}", CveMovimientoEntrada, FolioEntrada) - Msg.AppendFormat("
    Imprimir Movimiento ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", CveMovimientoEntrada))) - - Alert(Msg.ToString, TipoMensaje.MsgInformacion) - - Limpia() - CargaPendientes() - Else - Alert(TextoError, TipoMensaje.MsgError) - RegistraScript("playsonidito('142608__autistic-lucario__error.wav')") - ObjInventario.RollBack() - End If - - ObjInventario.Dispose() - - End Sub - - Private Sub Limpia() - - 'DATOS DE LA VENTA - LbCantidad.Text = "" - LbCliente.Text = "" - LbObservaciones.Text = "" - 'LbFolio.Text = "" - HLFolio.Text = "" - - 'DATOS DEL MOVIMINETO - TxtObservaciones.Text = "" - TxtFecha.Text = Now.ToShortDateString - DdlAlmacen.SelectedValueExist(-1) - CargaFolios() - - 'VARIABLES GENERALES - CveVentaSurtir = -1 - DtDatosDetalle = Nothing - DtDatosDetalleLote = Nothing - DtDatos = Nothing - - DivTipoCambioAdvertencia.Visible = False - - 'TRASPASO - DivTransitorio1.Visible = False - ChkTransitorio.Checked = False - TxtResponsable.Text = "" - DivTransitorio2.Visible = False - - LbSurtida.Visible = False - TimmerRefresh.Enabled = True - UpGenerales.Update() - CargaGvDatos() - End Sub - -#End Region - -#Region " TRASPASO - TRANSITORIO " - Protected Sub ChkTransitorio_CheckedChanged(sender As Object, e As EventArgs) - - TxtResponsable.Text = "" - DivTransitorio2.Visible = ChkTransitorio.Checked - - End Sub -#End Region - -#Region "SECCION ALMACEN" - Private Sub CreaDtSeccionAlmacen() - DtSeccionAlmacen = New DataTable - DtSeccionAlmacen.Columns.Add("CantidadSeccionAlmacen", GetType(Decimal)) - DtSeccionAlmacen.Columns.Add("IndexSeccionAlmacen", GetType(Integer)) - DtSeccionAlmacen.Columns.Add("CveSeccionAlmacen", GetType(Integer)) - DtSeccionAlmacen.Columns.Add("CvePS", GetType(Integer)) - DtSeccionAlmacen.Columns.Add("SeccionAlmacen", GetType(String)) - DtSeccionAlmacen.Columns.Add("Consec", GetType(Integer)) - End Sub - Private Sub CargaDdlAlmacen() - DdlSeccionAlmacen.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa) - DdlSeccionAlmacen.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlSeccionAlmacen.DataBind() - End Sub - Protected Sub LnkSeccionAlmacen_Click(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - - If Not DdlAlmacen.SelectedValue.ToEntero > 0 Then - Alert("Tiene que tener seleccionado un almacen para registrar seccion almacen.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - CantidadTotal = gvRow.FCTextBox("TbCantidadF").Text.ToDecimal - IndexSeccionAlmacen = gvRow.RowIndex - CvePS = gvRow.DataKey("CvePS").ToEntero - CargaSeccionAlmacen() - RegistraScript("$('#DModalSeccionAlmacen').modal()") - End Sub - - Private Sub CargaSeccionAlmacen() - Dim CantidadTotalSeccion As Decimal = DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {IndexSeccionAlmacen}").SUMD("CantidadSeccionAlmacen") - GvSeccion.DataSource = DtSeccionAlmacen.FiltraParametros($"IndexSeccionAlmacen = {IndexSeccionAlmacen}") - GvSeccion.DataBind() - - TxtCantidadSeccion.Text = "" - DdlSeccionAlmacen.SelectedIndex = 0 - Dim CantidadRestante As Decimal = CantidadTotal - CantidadTotalSeccion - If CantidadRestante = 0 Then - RVTxtCantidad.MaximumValue = "1" - TxtCantidadSeccion.Enabled = False - Else - RVTxtCantidad.MaximumValue = CantidadRestante.ToString - TxtCantidadSeccion.Enabled = True - End If - - If CantidadTotalSeccion > 0 Then - GvDatos.Rows(IndexSeccionAlmacen).FCTextBox("TbCantidadF").Enabled = False - GvDatos.Rows(IndexSeccionAlmacen).FCTextBox("TbCantidadF").ToolTip = "Cuenta con sección almacen" - - Else - GvDatos.Rows(IndexSeccionAlmacen).FCTextBox("TbCantidadF").Enabled = True - GvDatos.Rows(IndexSeccionAlmacen).FCTextBox("TbCantidadF").ToolTip = "" - - End If - - If DtSeccionAlmacen.SUMD("CantidadSeccionAlmacen") > 0 Then - DdlAlmacen.Enabled = False - DdlAlmacen.ToolTip = "Cuenta con sección almacen" - Else - DdlAlmacen.Enabled = True - DdlAlmacen.ToolTip = "" - End If - - UpModalSeccionAlmacen.Update() - UpDatos.Update() - UpGenerales.Update() - End Sub - - Protected Sub LnkAddSeccionAlmacen_Click(sender As Object, e As EventArgs) - - Dim ObjInv As New ClsInventarios - Dim CantidadDisponible As Decimal = 0 - If ObjInv.GetMovimientosDetalleSeccionesAlmacen(DdlSeccionAlmacen.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, - CvePS, UsuarioActual.CveEmpresa) Then - If ObjInv.DtResultados.Rows.Count > 0 Then - CantidadDisponible = ObjInv.DtResultados.Rows(0)("CantidadRestante").ToString.ToDecimal - End If - End If - ObjInv.Dispose() - - CantidadDisponible -= DtSeccionAlmacen.FiltraParametros($"CvePS = {CvePS} AND CveSeccionAlmacen = {DdlSeccionAlmacen.SelectedValue}").SUMD("CantidadSeccionAlmacen") - - If TxtCantidadSeccion.Text.ToDecimal > CantidadDisponible Then - Alert($"No tiene cantidad de producto suficiente en esta seccion de almacen, su cantidad restante es: {CantidadDisponible}", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim Row As DataRow = Nothing - DtSeccionAlmacen.AcceptChanges() - Row = DtSeccionAlmacen.NewRow - Row("CantidadSeccionAlmacen") = TxtCantidadSeccion.Text.ToDecimal - Row("IndexSeccionAlmacen") = IndexSeccionAlmacen - Row("CveSeccionAlmacen") = DdlSeccionAlmacen.SelectedValue.ToEntero - Row("SeccionAlmacen") = DdlSeccionAlmacen.SelectedItem.Text - Row("CvePS") = CvePS - Row("Consec") = DtSeccionAlmacen.Rows.Count + 1 - DtSeccionAlmacen.Rows.Add(Row) - DtSeccionAlmacen.AcceptChanges() - CargaSeccionAlmacen() - End Sub - - Protected Sub LnkEliminarSeccion_Click(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - Dim Index As Integer = 0 - For Each Dr As DataRow In DtSeccionAlmacen.Rows - If Dr("Consec").ToString.ToEntero = gvRow.DataKey("Consec").ToEntero() Then - Exit For - End If - Index += 1 - Next - DtSeccionAlmacen.Rows.RemoveAt(Index) - DtSeccionAlmacen.AcceptChanges() - CargaSeccionAlmacen() - End Sub - - Protected Sub LnkVerSecciones_Click(sender As Object, e As EventArgs) - If Not CveVentaSurtir > 0 Then - Alert("Tiene que seleccionar la venta a surtir", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - If Not DdlAlmacen.SelectedValue.ToEntero > 0 Then - Alert("Tiene que seleccionar el almacen", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim ObjInv As New ClsInventarios - If ObjInv.GetExistenciaSeccionAlmacen(CveVentaSurtir, DdlAlmacen.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then - GvVerSeccionesAlmacen.DataSource = ObjInv.DtResultados - End If - ObjInv.Dispose() - GvVerSeccionesAlmacen.DataBind() - UpVerSeccionesAlmacen.Update() - RegistraScript("$('#ModalVerSeccionesAlmacen').modal()") - End Sub - -#End Region - -#Region "DIVIDIR" - - Protected Sub Dividir(sender As Object, e As EventArgs) - Dim index2 As Integer = 0 - - For Each Row As DataRow In DtDatos.Rows - Row("Seleccionado") = GvDatos.Rows(index2).FCCheckBox("cbInv").Checked - If GvDatos.Rows(index2).FCTextBox("TbCantidadF").Text <> "" Then - Row("CantidadSeleccionada") = GvDatos.Rows(index2).FCTextBox("TbCantidadF").Text - End If - If GvDatos.Rows(index2).FCTextBox("TxtLote").Text <> "" Then - Row("Lote") = GvDatos.Rows(index2).FCTextBox("TxtLote").Text - End If - If GvDatos.Rows(index2).FCDropDownList("DdlSeccionAlmacen").SelectedValue <> "-1" Then - Row("CveSeccion") = GvDatos.Rows(index2).FCDropDownList("DdlSeccionAlmacen").SelectedValue.ToEntero - End If - If GvDatos.Rows(index2).FCTextBox("TxtCaducidad").Text <> "" Then - Row("Caducidad") = GvDatos.Rows(index2).FCTextBox("TxtCaducidad").Text.ToDate - End If - index2 += 1 - Next - DtDatos.AcceptChanges() - - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, Button)).NamingContainer, GridViewRow) - Dim Index As Integer = gvRow.RowIndex - Dim Cantidad As String = HdnCantidadMovimiento.Value - Dim dr1 As DataRow = DtDatos.Rows(Index) - Dim dr As DataRow = DtDatos.NewRow - dr.ItemArray = dr1.ItemArray - dr1("CantidadC") = (dr1("CantidadC").ToString.ToDouble - Cantidad.ToDouble) - Dim CantidadFOriginal As Double = dr1("CantidadF").ToString.ToDouble - dr1("CantidadF") = (dr1("CantidadF").ToString.ToDouble - Cantidad.ToDouble) - Dim CantidadSOriginal As Double = dr1("CantidadS").ToString.ToDouble - dr1("CantidadS") = (CantidadSOriginal * dr1("CantidadF").ToString.ToDouble) / CantidadFOriginal - Dim CantidadSeleccionadaOriginal As Double = dr1("CantidadSeleccionada").ToString.ToDouble - dr1("CantidadSeleccionada") = If(CantidadSeleccionadaOriginal > dr1("CantidadF").ToString.ToDouble, dr1("CantidadF").ToString.ToDouble, CantidadSeleccionadaOriginal) - CantidadSeleccionadaOriginal = CantidadSeleccionadaOriginal - dr1("CantidadF").ToString.ToDouble - - 'Dim CostoIndirectoOriginal As Double = dr1("CostoIndirecto").ToString.ToDouble - 'dr1("CostoIndirecto") = (CostoIndirectoOriginal * dr1("CantidadF").ToString.ToDouble) / CantidadFOriginal - 'Dim CostoIndirectoExtranjeroOriginal As Double = dr1("CostoIndirectoExtranjero").ToString.ToDouble - 'dr1("CostoIndirectoExtranjero") = (CostoIndirectoExtranjeroOriginal * dr1("CantidadF").ToString.ToDouble) / CantidadFOriginal - - DtDatos.AcceptChanges() - - dr("CantidadC") = Cantidad.ToDouble - dr("CantidadF") = Cantidad.ToDouble - dr("CantidadS") = (CantidadSOriginal * dr("CantidadF").ToString.ToDouble) / CantidadFOriginal - dr("CantidadSeleccionada") = If(CantidadSeleccionadaOriginal > 0, CantidadSeleccionadaOriginal, 0) - dr("Seleccionado") = If(CantidadSeleccionadaOriginal > 0, True, False) - 'dr("CostoIndirecto") = (CostoIndirectoOriginal * dr("CantidadF").ToString.ToDouble) / CantidadFOriginal - 'dr("CostoIndirectoExtranjero") = (CostoIndirectoExtranjeroOriginal * dr("CantidadF").ToString.ToDouble) / CantidadFOriginal - DtDatos.Rows.InsertAt(dr, Index) - DtDatos.AcceptChanges() - - index2 = 1 - For Each Row As DataRow In DtDatos.Rows - Row("Consec") = index2 - index2 += 1 - Next - DtDatos.AcceptChanges() - - CargaGvDatos() - - index2 = 0 - For Each Row As DataRow In DtDatos.Rows - GvDatos.Rows(index2).FCCheckBox("cbInv").Checked = CBool(Row("Seleccionado")) - If Row("CantidadSeleccionada").ToString <> "" Then - GvDatos.Rows(index2).FCTextBox("TbCantidadF").Text = Row("CantidadSeleccionada").ToString - End If - If Row("Lote").ToString <> "" Then - GvDatos.Rows(index2).FCTextBox("TxtLote").Text = Row("Lote").ToString - End If - If Row("CveSeccion").ToString <> "" Then - GvDatos.Rows(index2).FCDropDownList("DdlSeccionAlmacen").SelectedValue = Row("CveSeccion").ToString - End If - If Row("Caducidad").ToString <> "" Then - GvDatos.Rows(index2).FCTextBox("TxtCaducidad").Text = Row("Caducidad").ToString.ToDate.ToShortDateString - End If - index2 += 1 - Next - - End Sub - - -#End Region - -#Region " GUIAS - SABE QUE ES PORQUE NO VEO QUE SE UTILIZE EN ALGUNA PARTE - EN MIRAS DE ELIMINAR - IPP 24 AGOSTO 2017 " - Private Sub BtnNumeroGuia_Click(sender As Object, e As EventArgs) Handles BtnNumeroGuia.Click - Dim Objeto As New ClsInventarios - If Objeto.UpdateMovimientoGuia(TxtGuia.Text, CveMovimiento, UsuarioActual.CveEmpresa) Then - Alert("Se ha guardado correctamente la póliza", TipoMensaje.MsgConfirmacion) - End If - Objeto.Dispose() - End Sub - - Private Sub GvDocs_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDocs.RowDataBound - - If e.Row.RowType = DataControlRowType.DataRow Then - - Dim ImgDownLoad As Literal = e.Row.FCLiteral("HplDown") - Dim Adjunto As String = e.Row.DBCampo("Adjunto").ToString - Dim ArchivoRuta As String = "" - - If Adjunto.Trim.Length > 0 Then - ArchivoRuta = UsuarioActual.Empresa.Ruta & "Documentacion\Ventas\" & Adjunto - Dim fi As New FileInfo(ArchivoRuta) - Dim linkDescarga As String = "" - If fi.Exists() Then - linkDescarga = $"/Empresas/{UsuarioActual.CveEmpresa}/Documentacion/ventas/{fi.Name}" - ImgDownLoad.Visible = True - ImgDownLoad.Text = String.Format(" ", linkDescarga) - - - End If - - End If - - End If - - End Sub -#End Region - -#Region "SUGERENCIAS" - - Protected Sub BtnVerSugerencias_Click(sender As Object, e As EventArgs) - If Not CveVentaSurtir > 0 Then - Alert("Tiene que seleccionar la venta a surtir", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - If Not DdlAlmacen.SelectedValue.ToEntero > 0 Then - Alert("Tiene que seleccionar el almacen", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim ObjInv As New ClsInventarios - If ObjInv.GetSugerenciasSalidaAlmacen(CveVentaSurtir, DdlAlmacen.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then - GvSugerencias.DataSource = ObjInv.DtResultados - - - DtDatosSugerencias = ObjInv.DtResultados - - DtDatos.Columns.Add("Consec", GetType(Integer)) - DtDatos.Columns.Add("CantidadGV", GetType(Double)) - DtDatos.Columns.Add("CantidadTraspaso", GetType(Double)) - DtDatos.Columns.Add("AplicaSeccion", GetType(Boolean)) - DtDatos.Columns.Add("AplicaSerie", GetType(Boolean)) - DtDatos.Columns.Add("AplicaLote", GetType(Boolean)) - DtDatos.Columns.Add("AplicaCaducidad", GetType(Boolean)) - If Not DtDatos.Columns.Contains("Lote") Then - DtDatos.Columns.Add("Lote", GetType(String)) - End If - If Not DtDatos.Columns.Contains("CveSeccion") Then - DtDatos.Columns.Add("CveSeccion", GetType(Integer)) - End If - If Not DtDatos.Columns.Contains("Caducidad") Then - DtDatos.Columns.Add("Caducidad", GetType(Date)) - End If - If Not DtDatos.Columns.Contains("Seleccionado") Then - DtDatos.Columns.Add("Seleccionado", GetType(Boolean)) - End If - If Not DtDatos.Columns.Contains("CantidadSeleccionada") Then - DtDatos.Columns.Add("CantidadSeleccionada", GetType(Double)) - End If - - Dim Index = 1 - For Each Dr As DataRow In DtDatosSugerencias.Rows - Dr("Consec") = Index - Dr("Caducidad") = Now - Index += 1 - Next - - DtDatosSugerencias.AcceptChanges() - - - End If - ObjInv.Dispose() - GvSugerencias.DataBind() - - UpVerSugerencias.Update() - - RegistraScript("$('#ModalVerSugerencias').modal()") - End Sub - Protected Sub BtnAplicarSugerencias_Click(sender As Object, e As EventArgs) - - DtDatos = Nothing - DtDatos = New DataTable - DtDatos = DtDatosSugerencias - - DtDatosDetalle = Nothing - CreaDtDetalle() - - DtDatosDetalleLote = Nothing - CreaDtDetalleLote() - - CargaGvDatos() - - RegistraScript("$('#ModalVerSugerencias').modal('hide')") - End Sub - - -#End Region - - - -End Class diff --git a/Ventas/Clientes.aspx.vb b/Ventas/Clientes.aspx.vb index 849a7129d..26da6c8fe 100644 --- a/Ventas/Clientes.aspx.vb +++ b/Ventas/Clientes.aspx.vb @@ -1,1052 +1,1052 @@ -Option Explicit On -Option Strict On - -Imports Extensiones -Imports System.Runtime.InteropServices -Imports System.IO -Imports Microsoft.Reporting.WebForms -Imports System.Data -Imports System.Globalization - -Partial Class Clientes - Inherits ClsPaginas - - 'Configuración -#Region "P R O P I E D A D E S" - Private Const NumeroDecimales As Integer = 2 - Private CveVentaDeduccion As Integer - Private Opcion As Integer - - Public ReadOnly Property RowStyle As TableItemStyle - Private ReadOnly Property CveCliente As Integer - Get - Return ViewState("CveCliente").ToString.ToEntero - End Get - End Property - Private Property DTCuentasBancos As DataTable - Get - Return CType(ViewState("DTCuentasBancos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DTCuentasBancos") = value - End Set - End Property - Private Property DTHistorialVentas As DataTable - Get - Return CType(ViewState("DTHistorialVentas"), DataTable) - End Get - Set(value As DataTable) - ViewState("DTHistorialVentas") = value - End Set - End Property - Private Property TempDTCuentasBancos As DataTable - Get - Return CType(ViewState("TempDTCuentasBancos"), DataTable) - End Get - Set(value As DataTable) - ViewState("TempDTCuentasBancos") = value - End Set - End Property - - Private Property Modalidad As String - Get - Return ViewState("Modalidad").ToString - End Get - Set(value As String) - ViewState("Modalidad") = value - End Set - End Property - - Private Property IdCtaCliente As String - Get - Return If(IsNothing(ViewState("IdCtaCliente")), "", ViewState("IdCtaCliente").ToString) - End Get - Set(value As String) - ViewState("IdCtaCliente") = value - End Set - End Property - Private Property IdCtaAnticipos As String - Get - - Return If(IsNothing(ViewState("IdCtaAnticipos")), "", ViewState("IdCtaAnticipos").ToString) - End Get - Set(value As String) - ViewState("IdCtaAnticipos") = value - End Set - End Property - Private Property IdCtaRetIVA As String - Get - Return If(IsNothing(ViewState("IdCtaRetIVA")), "", ViewState("IdCtaRetIVA").ToString) - End Get - Set(value As String) - ViewState("IdCtaRetIVA") = value - End Set - End Property - Private Property IdCtaFondoGarantia As String - Get - Return If(IsNothing(ViewState("IdCtaFondoGarantia")), "", ViewState("IdCtaFondoGarantia").ToString) - End Get - Set(value As String) - ViewState("IdCtaFondoGarantia") = value - End Set - End Property - Private Property IdCtaRetISR As String - Get - Return If(IsNothing(ViewState("IdCtaRetISR")), "", ViewState("IdCtaRetISR").ToString) - End Get - Set(value As String) - ViewState("IdCtaRetISR") = value - End Set - End Property - - Private Property CveCuentaBancaria As Integer - Get - Return ViewState("CveCuentaBancaria").ToString.ToEntero - End Get - Set(value As Integer) - ViewState("CveCuentaBancaria") = value - End Set - End Property - - Private Property CveClienteSuc As Integer - Get - If ViewState("CveClienteSuc") Is Nothing Then - Return -1 - Else - Return ViewState("CveClienteSuc").ToString.ToEntero - End If - End Get - Set(value As Integer) - ViewState("CveClienteSuc") = value - End Set - End Property - - Private Property Actualizar As Boolean - Get - Return Convert.ToBoolean(ViewState("Actualizar")) - End Get - Set(value As Boolean) - ViewState("Actualizar") = value - End Set - End Property - - Private Property Existe As Boolean - Get - Return Convert.ToBoolean(ViewState("Existe")) - End Get - Set(value As Boolean) - ViewState("Existe") = value - End Set - End Property - - Private Property IdCtaCompCliente As String - Get - Return If(IsNothing(ViewState("IdCtaCompCliente")), "", ViewState("IdCtaCompCliente").ToString) - End Get - Set(value As String) - ViewState("IdCtaCompCliente") = value - End Set - End Property - - Private Property ArrayDisp As String - Get - Return If(IsNothing(ViewState("ArrayDisp")), "", ViewState("ArrayDisp").ToString) - End Get - Set(value As String) - ViewState("ArrayDisp") = value - End Set - End Property - Private Property NombreDispositivo As String - Get - Return If(IsNothing(ViewState("NombreDispositivo")), "", ViewState("NombreDispositivo").ToString) - End Get - Set(value As String) - ViewState("NombreDispositivo") = value - End Set - End Property - - Private Property IdCtaCompAnticipo As String - Get - Return If(IsNothing(ViewState("IdCtaCompAnticipo")), "", ViewState("IdCtaCompAnticipo").ToString) - End Get - Set(value As String) - ViewState("IdCtaCompAnticipo") = value - End Set - End Property - - Private Property CveDireccionEnvio As Integer - Get - If ViewState("CveDireccionEnvio") Is Nothing Then - Return -1 - Else - Return ViewState("CveDireccionEnvio").ToString.ToEntero - End If - End Get - Set(value As Integer) - ViewState("CveDireccionEnvio") = value - End Set - End Property - - Private Property CveCuentaEquipo As Integer - Get - If ViewState("CveCuentaEquipo") Is Nothing Then - Return -1 - Else - Return ViewState("CveCuentaEquipo").ToString.ToEntero - End If - End Get - Set(value As Integer) - ViewState("CveCuentaEquipo") = value - End Set - End Property - - - Private Property IdCtaMonedaExtranjera As String - Get - Return If(IsNothing(ViewState("IdCtaMonedaExtranjera")), "", ViewState("IdCtaMonedaExtranjera").ToString) - End Get - Set(value As String) - ViewState("IdCtaMonedaExtranjera") = value - End Set - End Property - - Private Property IdCtaMonedaExtranjeraAnticipos As String - Get - Return If(IsNothing(ViewState("IdCtaMonedaExtranjeraAnticipos")), "", ViewState("IdCtaMonedaExtranjeraAnticipos").ToString) - End Get - Set(value As String) - ViewState("IdCtaMonedaExtranjeraAnticipos") = value - End Set - End Property - - Private Property TempDTSucursales As DataTable - Get - Return CType(ViewState("TempDTSucursales"), DataTable) - End Get - Set(value As DataTable) - ViewState("TempDTSucursales") = value - End Set - End Property - - Private Property EstatusAnteriorCliente As Boolean - Get - If ViewState("EstatusAnteriorCliente") Is Nothing Then - Return True - Else - Return Boolean.Parse(ViewState("EstatusAnteriorCliente").ToString) - End If - End Get - Set(value As Boolean) - ViewState("EstatusAnteriorCliente") = value - End Set - End Property - - Private Property DtSubProyectos As DataTable - Get - Return If(IsNothing(ViewState("DtSubProyectos")), Nothing, CType(ViewState("DtSubProyectos"), DataTable)) - End Get - Set(value As DataTable) - ViewState("DtSubProyectos") = value - End Set - End Property - Private Property CveSucursal As Integer - Get - If ViewState("CveSucursal") Is Nothing Then - Return -1 - Else - Return ViewState("CveSucursal").ToString.ToEntero - End If - End Get - Set(value As Integer) - ViewState("CveSucursal") = value - End Set - End Property - - - Private Property DTCobrosRealizados As DataTable - Get - If ViewState("DTCobrosRealizados") Is Nothing Then - Return New DataTable - Else - Return DirectCast(ViewState("DTCobrosRealizados"), DataTable) - End If - End Get - Set(value As DataTable) - ViewState("DTCobrosRealizados") = value - End Set - End Property - - Private Property ObjFactura As Modelos.Factura - Get - Return CType(ViewState("ObjFactura"), Modelos.Factura) - End Get - Set(value As Modelos.Factura) - ViewState("ObjFactura") = value - End Set - End Property - - Private Property CobranzaTelefono As String - Get - CobranzaTelefono = ViewState("CobranzaTelefono").ToString - End Get - Set(value As String) - ViewState("CobranzaTelefono") = value - End Set - End Property - Private Property CodigoCliente As String - Get - CodigoCliente = ViewState("CodigoCliente").ToString - End Get - Set(value As String) - ViewState("CodigoCliente") = value - End Set - End Property - Private Property DtVencido As DataTable - Get - DtVencido = CType(ViewState("DtVencido"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtVencido") = value - End Set - End Property - Private Property DtRotacion As DataTable - Get - DtRotacion = CType(ViewState("DtRotacion"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtRotacion") = value - End Set - End Property - Private Property DtSaldoMensual As DataTable - Get - DtSaldoMensual = CType(ViewState("DtSaldoMensual"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtSaldoMensual") = value - End Set - End Property - Private Property DtComportamientoVentas As DataTable - Get - DtComportamientoVentas = CType(ViewState("DtComportamientoVentas"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtComportamientoVentas") = value - End Set - End Property - Private Property CveEmpresaCRM As Integer - Get - If ViewState("CveEmpresaCRM") Is Nothing Then - Return -1 - Else - Return ViewState("CveEmpresaCRM").ToString.ToEntero - End If - End Get - Set(value As Integer) - ViewState("CveEmpresaCRM") = value - End Set - End Property - - Private Property DtEmpresasCRM As DataTable - Get - DtEmpresasCRM = CType(ViewState("DtEmpresasCRM"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtEmpresasCRM") = value - End Set - End Property - - Private Property CveEmpresaCRMUnificar As Integer - Get - If ViewState("CveEmpresaCRMUnificar") Is Nothing Then - Return -1 - Else - Return ViewState("CveEmpresaCRMUnificar").ToString.ToEntero - End If - End Get - Set(value As Integer) - ViewState("CveEmpresaCRMUnificar") = value - End Set - End Property - - Private Property DTPorcentajePrecios As DataTable - Get - Return CType(ViewState("DTPorcentajePrecios"), DataTable) - End Get - Set(value As DataTable) - ViewState("DTPorcentajePrecios") = value - End Set - End Property - Private Property TmpDT As DataTable - Get - Return If(IsNothing(ViewState("TmpDT")), Nothing, CType(ViewState("TmpDT"), DataTable)) - End Get - Set(value As DataTable) - ViewState("TmpDT") = value - End Set - End Property - Private Property DtPromociones As DataTable - Get - Return If(IsNothing(ViewState("DtPromociones")), Nothing, CType(ViewState("DtPromociones"), DataTable)) - End Get - Set(value As DataTable) - ViewState("DtPromociones") = value - End Set - End Property - Private Property DtPagos As DataTable - Get - Return CType(ViewState("DtPagos"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtPagos") = value - End Set +Option Explicit On +Option Strict On + +Imports Extensiones +Imports System.Runtime.InteropServices +Imports System.IO +Imports Microsoft.Reporting.WebForms +Imports System.Data +Imports System.Globalization + +Partial Class Clientes + Inherits ClsPaginas + + 'Configuración +#Region "P R O P I E D A D E S" + Private Const NumeroDecimales As Integer = 2 + Private CveVentaDeduccion As Integer + Private Opcion As Integer + + Public ReadOnly Property RowStyle As TableItemStyle + Private ReadOnly Property CveCliente As Integer + Get + Return ViewState("CveCliente").ToString.ToEntero + End Get + End Property + Private Property DTCuentasBancos As DataTable + Get + Return CType(ViewState("DTCuentasBancos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTCuentasBancos") = value + End Set + End Property + Private Property DTHistorialVentas As DataTable + Get + Return CType(ViewState("DTHistorialVentas"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTHistorialVentas") = value + End Set + End Property + Private Property TempDTCuentasBancos As DataTable + Get + Return CType(ViewState("TempDTCuentasBancos"), DataTable) + End Get + Set(value As DataTable) + ViewState("TempDTCuentasBancos") = value + End Set End Property - Private Property DtCotizaciones As DataTable - Get - Return CType(ViewState("DtCotizaciones"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtCotizaciones") = value - End Set - End Property - Private Property DtCxCActivas As DataTable - Get - Return CType(ViewState("DtCxCActivas"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtCxCActivas") = value - End Set - End Property - Private Property DtHistorialCxC As DataTable - Get - Return CType(ViewState("DtHistorialCxC"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtHistorialCxC") = value - End Set - End Property - Private Property DtClientesAnticipo As DataTable - Get - Return CType(ViewState("DtClientesAnticipo"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtClientesAnticipo") = value - End Set - End Property - Private Property DtAnticipoHistorial As DataTable - Get - Return CType(ViewState("DtAnticipoHistorial"), DataTable) - End Get - Set(value As DataTable) - ViewState("DtAnticipoHistorial") = value - End Set - End Property - 'Private Property EstatusAnteriorCliente As Boolean - ' Get - ' If ViewState("EstatusAnteriorCliente") Is Nothing Then - ' Return True - ' Else - ' Return Boolean.Parse(ViewState("EstatusAnteriorCliente").ToString) - ' End If - ' End Get - ' Set(value As Boolean) - ' ViewState("EstatusAnteriorCliente") = value - ' End Set - 'End Property - - Private Property CargoUsado As Boolean - Get - If ViewState("CargoUsado") Is Nothing Then - Return True - Else - Return Boolean.Parse(ViewState("CargoUsado").ToString) - End If - End Get - Set(value As Boolean) - ViewState("CargoUsado") = value - End Set - End Property - - Private Property BonificacionUsado As Boolean - Get - If ViewState("BonificacionUsado") Is Nothing Then - Return True - Else - Return Boolean.Parse(ViewState("BonificacionUsado").ToString) - End If - End Get - Set(value As Boolean) - ViewState("BonificacionUsado") = value - End Set + Private Property Modalidad As String + Get + Return ViewState("Modalidad").ToString + End Get + Set(value As String) + ViewState("Modalidad") = value + End Set End Property - Private Property linkDescargaPagare As String - Get - Return If(IsNothing(ViewState("linkDescargaPagare")), "", ViewState("linkDescargaPagare").ToString) - End Get - Set(value As String) - ViewState("linkDescargaPagare") = value - End Set + Private Property IdCtaCliente As String + Get + Return If(IsNothing(ViewState("IdCtaCliente")), "", ViewState("IdCtaCliente").ToString) + End Get + Set(value As String) + ViewState("IdCtaCliente") = value + End Set + End Property + Private Property IdCtaAnticipos As String + Get + + Return If(IsNothing(ViewState("IdCtaAnticipos")), "", ViewState("IdCtaAnticipos").ToString) + End Get + Set(value As String) + ViewState("IdCtaAnticipos") = value + End Set + End Property + Private Property IdCtaRetIVA As String + Get + Return If(IsNothing(ViewState("IdCtaRetIVA")), "", ViewState("IdCtaRetIVA").ToString) + End Get + Set(value As String) + ViewState("IdCtaRetIVA") = value + End Set + End Property + Private Property IdCtaFondoGarantia As String + Get + Return If(IsNothing(ViewState("IdCtaFondoGarantia")), "", ViewState("IdCtaFondoGarantia").ToString) + End Get + Set(value As String) + ViewState("IdCtaFondoGarantia") = value + End Set + End Property + Private Property IdCtaRetISR As String + Get + Return If(IsNothing(ViewState("IdCtaRetISR")), "", ViewState("IdCtaRetISR").ToString) + End Get + Set(value As String) + ViewState("IdCtaRetISR") = value + End Set End Property -#End Region + Private Property CveCuentaBancaria As Integer + Get + Return ViewState("CveCuentaBancaria").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveCuentaBancaria") = value + End Set + End Property -#Region "Documentacion" - Private Property DTDocumentacion As DataTable - Get - If ViewState("DTDocumentacion") Is Nothing Then - Return New DataTable - Else - Return DirectCast(ViewState("DTDocumentacion"), DataTable) - End If - End Get - Set(value As DataTable) - ViewState("DTDocumentacion") = value - End Set - End Property - - Property Documentacion As String - Get - If ViewState("Documentacion") Is Nothing Then - Return "-1" - Else - Return ViewState("Documentacion").ToString - End If - End Get - Set(value As String) - ViewState("Documentacion") = value - End Set - End Property - Property CveDocumentacion As Integer - Get - If ViewState("CveDocumentacion") Is Nothing Then - Return -1 - Else - Return DirectCast(ViewState("CveDocumentacion"), Integer) - End If - End Get - Set(value As Integer) - ViewState("CveDocumentacion") = value - End Set - End Property - Property CveDocumentacionElectronica As Integer - Get - If ViewState("CvePersonalClienteDocumentacion") Is Nothing Then - Return -1 - Else - Return DirectCast(ViewState("CvePersonalClienteDocumentacion"), Integer) - End If - End Get - Set(value As Integer) - ViewState("CvePersonalClienteDocumentacion") = value - End Set - End Property - Property ActualizarDocumentacion As Boolean - Get - If ViewState("ActualizarDocumentacion") Is Nothing Then - Return True - Else - Return DirectCast(ViewState("ActualizarDocumentacion"), Boolean) - End If - End Get - Set(value As Boolean) - ViewState("ActualizarDocumentacion") = value - End Set - End Property - Private Property FechaLimite As Date - Get - If ViewState("FechaLimite") Is Nothing Then - Return Date.Now.AddDays(15) - Else - Return ViewState("FechaLimite").ToString.ToDate - End If - End Get - Set(value As Date) - ViewState("FechaLimite") = value - End Set - - End Property - Property Estatus As Integer - Get - If ViewState("Estatus") Is Nothing Then - Return 0 - Else - Return DirectCast(ViewState("Estatus"), Integer) - End If - End Get - Set(value As Integer) - ViewState("Estatus") = value - End Set - End Property - Property ObservacionDocumentacion As String - Get - If ViewState("ObservacionDocumentacion") Is Nothing Then - Return "" - Else - Return ViewState("ObservacionDocumentacion").ToString - End If - End Get - Set(value As String) - ViewState("ObservacionDocumentacion") = value - End Set - End Property - Property AdjuntoDocumentacion As String - Get - If ViewState("AdjuntoDocumentacion") Is Nothing Then - Return "" - Else - Return ViewState("AdjuntoDocumentacion").ToString - End If - End Get - Set(value As String) - ViewState("AdjuntoDocumentacion") = value - End Set - End Property - 'Private ReadOnly Property CvePersonal As Integer - ' Get - ' If ViewState("CvePersonal") Is Nothing Then - ' Return -1 - ' Else - ' Return ViewState("CvePersonal").ToString.ToEntero - ' End If - ' End Get - 'End Property - -#End Region - - - -#Region " A C U M U L A D O R E S" - Property CveVentaNota As Integer - Get - If ViewState("CveVentaNota") Is Nothing Then - Return 0 - Else - Return ViewState("CveVentaNota").ToString.ToEntero - End If - End Get - Set(value As Integer) - ViewState("CveVentaNota") = value - End Set - - End Property - - Property FolioNotaAcumulador As Integer - Get - If ViewState("FolioNotaAcumulador") Is Nothing Then - Return 0 - Else - Return ViewState("FolioNotaAcumulador").ToString.ToEntero - End If - End Get - Set(value As Integer) - ViewState("FolioNotaAcumulador") = value - End Set - End Property - Property SerieNotaAcumulador As String - Get - If ViewState("SerieNotaAcumulador") Is Nothing Then - Return "" - - Else - Return ViewState("SerieNotaAcumulador").ToString - End If - End Get - Set(value As String) - ViewState("SerieNotaAcumulador") = value - End Set - End Property - -#End Region - Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load - If Not IsPostBack Then - - Actualizar = False - SetValues() - CargaCombos() - CreaDTVentas() - CreaDtPago() - RegistraScript("CargaHeader();") - - - If UsuarioActual.Empresa.CvePlataforma = 3 Then 'SI ES USUARIO GPS - TabFiscalContable.Visible = True - TabRetenciones.Visible = False - TabOS.Visible = False - TabComplementos.Visible = False - TabOtros.Visible = False - TabCuentasEquipos.Visible = True - ReporteDispositivos.Visible = True - TabCuentasEquipos.HeaderText = "Equipos GPS" - TabRH.Visible = False - TabUsuarios.Visible = True - TabUsuarios.HeaderText = "Usuarios" - dvZH.Visible = True - CargaZonasHorarias() - dvPlataformaSig.Style.Add("display", "none") - dvPlataformGPS.Style.Add("display", "") - BtnAgregarCtaEquipo.Visible = False - HyperLink1.Text = "Georef" - HyperLink1.ToolTip = "Creación de geocercas y rutas" - HyperLink2.Text = "Rastreo" - HyperLink2.ToolTip = "Rastreo de equipos" - HyperLink3.Text = "P.Interes" - HyperLink3.ToolTip = "Creación y reportes de puntos de interés" - ThBusqueda.Visible = True - TdBusqueda.Visible = True - HyperLink7.Visible = False - ChkSist.Visible = False - - CargaEmpresasUsuario(UsuarioActual.CveEmpresa) - End If - - 'ROL DE GPS - If UsuarioActual.CveRol = 1198 Then - TabUsuarios.HeaderText = "Usuarios" - End If - - '02/07/2018 - PRUEBAS USUARIOS PLATAFORMA CLIENTES - If UsuarioActual.Empresa.CvePlataforma = 1 Then 'SI ES USUARIO SIG - TabUsuarios.Visible = True - End If - - If UsuarioActual.Empresa.Funcionalidad(510) <> "" Then - TabCuentasEquipos.HeaderText = UsuarioActual.Empresa.Funcionalidad(510) - TabCuentasEquipos.Visible = True - End If - - If UsuarioActual.Empresa.Funcionalidad(504).ToEntero > 0 Then - If UsuarioActual.TienePermisoProceso(162) Then - ChkPermiteCredito.Enabled = True - TxtLimiteCreditoSucursal.Enabled = True - Else - ChkPermiteCredito.Enabled = False - TxtLimiteCreditoSucursal.Enabled = False - End If - ChkEstado.Enabled = False - If UsuarioActual.TienePermisoProceso(180) Then - ChkEstado.Enabled = True - End If + Private Property CveClienteSuc As Integer + Get + If ViewState("CveClienteSuc") Is Nothing Then + Return -1 + Else + Return ViewState("CveClienteSuc").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveClienteSuc") = value + End Set + End Property + + Private Property Actualizar As Boolean + Get + Return Convert.ToBoolean(ViewState("Actualizar")) + End Get + Set(value As Boolean) + ViewState("Actualizar") = value + End Set + End Property + + Private Property Existe As Boolean + Get + Return Convert.ToBoolean(ViewState("Existe")) + End Get + Set(value As Boolean) + ViewState("Existe") = value + End Set + End Property + + Private Property IdCtaCompCliente As String + Get + Return If(IsNothing(ViewState("IdCtaCompCliente")), "", ViewState("IdCtaCompCliente").ToString) + End Get + Set(value As String) + ViewState("IdCtaCompCliente") = value + End Set + End Property + + Private Property ArrayDisp As String + Get + Return If(IsNothing(ViewState("ArrayDisp")), "", ViewState("ArrayDisp").ToString) + End Get + Set(value As String) + ViewState("ArrayDisp") = value + End Set + End Property + Private Property NombreDispositivo As String + Get + Return If(IsNothing(ViewState("NombreDispositivo")), "", ViewState("NombreDispositivo").ToString) + End Get + Set(value As String) + ViewState("NombreDispositivo") = value + End Set + End Property + + Private Property IdCtaCompAnticipo As String + Get + Return If(IsNothing(ViewState("IdCtaCompAnticipo")), "", ViewState("IdCtaCompAnticipo").ToString) + End Get + Set(value As String) + ViewState("IdCtaCompAnticipo") = value + End Set + End Property + + Private Property CveDireccionEnvio As Integer + Get + If ViewState("CveDireccionEnvio") Is Nothing Then + Return -1 + Else + Return ViewState("CveDireccionEnvio").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveDireccionEnvio") = value + End Set + End Property + + Private Property CveCuentaEquipo As Integer + Get + If ViewState("CveCuentaEquipo") Is Nothing Then + Return -1 + Else + Return ViewState("CveCuentaEquipo").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveCuentaEquipo") = value + End Set + End Property + + + Private Property IdCtaMonedaExtranjera As String + Get + Return If(IsNothing(ViewState("IdCtaMonedaExtranjera")), "", ViewState("IdCtaMonedaExtranjera").ToString) + End Get + Set(value As String) + ViewState("IdCtaMonedaExtranjera") = value + End Set + End Property + + Private Property IdCtaMonedaExtranjeraAnticipos As String + Get + Return If(IsNothing(ViewState("IdCtaMonedaExtranjeraAnticipos")), "", ViewState("IdCtaMonedaExtranjeraAnticipos").ToString) + End Get + Set(value As String) + ViewState("IdCtaMonedaExtranjeraAnticipos") = value + End Set + End Property + + Private Property TempDTSucursales As DataTable + Get + Return CType(ViewState("TempDTSucursales"), DataTable) + End Get + Set(value As DataTable) + ViewState("TempDTSucursales") = value + End Set + End Property + + Private Property EstatusAnteriorCliente As Boolean + Get + If ViewState("EstatusAnteriorCliente") Is Nothing Then + Return True + Else + Return Boolean.Parse(ViewState("EstatusAnteriorCliente").ToString) + End If + End Get + Set(value As Boolean) + ViewState("EstatusAnteriorCliente") = value + End Set + End Property + + Private Property DtSubProyectos As DataTable + Get + Return If(IsNothing(ViewState("DtSubProyectos")), Nothing, CType(ViewState("DtSubProyectos"), DataTable)) + End Get + Set(value As DataTable) + ViewState("DtSubProyectos") = value + End Set + End Property + Private Property CveSucursal As Integer + Get + If ViewState("CveSucursal") Is Nothing Then + Return -1 + Else + Return ViewState("CveSucursal").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveSucursal") = value + End Set + End Property + + + Private Property DTCobrosRealizados As DataTable + Get + If ViewState("DTCobrosRealizados") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("DTCobrosRealizados"), DataTable) + End If + End Get + Set(value As DataTable) + ViewState("DTCobrosRealizados") = value + End Set + End Property + + Private Property ObjFactura As Modelos.Factura + Get + Return CType(ViewState("ObjFactura"), Modelos.Factura) + End Get + Set(value As Modelos.Factura) + ViewState("ObjFactura") = value + End Set + End Property + + Private Property CobranzaTelefono As String + Get + CobranzaTelefono = ViewState("CobranzaTelefono").ToString + End Get + Set(value As String) + ViewState("CobranzaTelefono") = value + End Set + End Property + Private Property CodigoCliente As String + Get + CodigoCliente = ViewState("CodigoCliente").ToString + End Get + Set(value As String) + ViewState("CodigoCliente") = value + End Set + End Property + Private Property DtVencido As DataTable + Get + DtVencido = CType(ViewState("DtVencido"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtVencido") = value + End Set + End Property + Private Property DtRotacion As DataTable + Get + DtRotacion = CType(ViewState("DtRotacion"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtRotacion") = value + End Set + End Property + Private Property DtSaldoMensual As DataTable + Get + DtSaldoMensual = CType(ViewState("DtSaldoMensual"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtSaldoMensual") = value + End Set + End Property + Private Property DtComportamientoVentas As DataTable + Get + DtComportamientoVentas = CType(ViewState("DtComportamientoVentas"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtComportamientoVentas") = value + End Set + End Property + Private Property CveEmpresaCRM As Integer + Get + If ViewState("CveEmpresaCRM") Is Nothing Then + Return -1 + Else + Return ViewState("CveEmpresaCRM").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveEmpresaCRM") = value + End Set + End Property + + Private Property DtEmpresasCRM As DataTable + Get + DtEmpresasCRM = CType(ViewState("DtEmpresasCRM"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtEmpresasCRM") = value + End Set + End Property + + Private Property CveEmpresaCRMUnificar As Integer + Get + If ViewState("CveEmpresaCRMUnificar") Is Nothing Then + Return -1 + Else + Return ViewState("CveEmpresaCRMUnificar").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveEmpresaCRMUnificar") = value + End Set + End Property + + Private Property DTPorcentajePrecios As DataTable + Get + Return CType(ViewState("DTPorcentajePrecios"), DataTable) + End Get + Set(value As DataTable) + ViewState("DTPorcentajePrecios") = value + End Set + End Property + Private Property TmpDT As DataTable + Get + Return If(IsNothing(ViewState("TmpDT")), Nothing, CType(ViewState("TmpDT"), DataTable)) + End Get + Set(value As DataTable) + ViewState("TmpDT") = value + End Set + End Property + Private Property DtPromociones As DataTable + Get + Return If(IsNothing(ViewState("DtPromociones")), Nothing, CType(ViewState("DtPromociones"), DataTable)) + End Get + Set(value As DataTable) + ViewState("DtPromociones") = value + End Set + End Property + Private Property DtPagos As DataTable + Get + Return CType(ViewState("DtPagos"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtPagos") = value + End Set + End Property + + Private Property DtCotizaciones As DataTable + Get + Return CType(ViewState("DtCotizaciones"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtCotizaciones") = value + End Set + End Property + Private Property DtCxCActivas As DataTable + Get + Return CType(ViewState("DtCxCActivas"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtCxCActivas") = value + End Set + End Property + Private Property DtHistorialCxC As DataTable + Get + Return CType(ViewState("DtHistorialCxC"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtHistorialCxC") = value + End Set + End Property + Private Property DtClientesAnticipo As DataTable + Get + Return CType(ViewState("DtClientesAnticipo"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtClientesAnticipo") = value + End Set + End Property + Private Property DtAnticipoHistorial As DataTable + Get + Return CType(ViewState("DtAnticipoHistorial"), DataTable) + End Get + Set(value As DataTable) + ViewState("DtAnticipoHistorial") = value + End Set + End Property + 'Private Property EstatusAnteriorCliente As Boolean + ' Get + ' If ViewState("EstatusAnteriorCliente") Is Nothing Then + ' Return True + ' Else + ' Return Boolean.Parse(ViewState("EstatusAnteriorCliente").ToString) + ' End If + ' End Get + ' Set(value As Boolean) + ' ViewState("EstatusAnteriorCliente") = value + ' End Set + 'End Property + + Private Property CargoUsado As Boolean + Get + If ViewState("CargoUsado") Is Nothing Then + Return True + Else + Return Boolean.Parse(ViewState("CargoUsado").ToString) + End If + End Get + Set(value As Boolean) + ViewState("CargoUsado") = value + End Set + End Property + + Private Property BonificacionUsado As Boolean + Get + If ViewState("BonificacionUsado") Is Nothing Then + Return True + Else + Return Boolean.Parse(ViewState("BonificacionUsado").ToString) + End If + End Get + Set(value As Boolean) + ViewState("BonificacionUsado") = value + End Set + End Property + + Private Property linkDescargaPagare As String + Get + Return If(IsNothing(ViewState("linkDescargaPagare")), "", ViewState("linkDescargaPagare").ToString) + End Get + Set(value As String) + ViewState("linkDescargaPagare") = value + End Set + End Property + +#End Region + +#Region "Documentacion" + Private Property DTDocumentacion As DataTable + Get + If ViewState("DTDocumentacion") Is Nothing Then + Return New DataTable + Else + Return DirectCast(ViewState("DTDocumentacion"), DataTable) + End If + End Get + Set(value As DataTable) + ViewState("DTDocumentacion") = value + End Set + End Property + + Property Documentacion As String + Get + If ViewState("Documentacion") Is Nothing Then + Return "-1" + Else + Return ViewState("Documentacion").ToString + End If + End Get + Set(value As String) + ViewState("Documentacion") = value + End Set + End Property + Property CveDocumentacion As Integer + Get + If ViewState("CveDocumentacion") Is Nothing Then + Return -1 + Else + Return DirectCast(ViewState("CveDocumentacion"), Integer) + End If + End Get + Set(value As Integer) + ViewState("CveDocumentacion") = value + End Set + End Property + Property CveDocumentacionElectronica As Integer + Get + If ViewState("CvePersonalClienteDocumentacion") Is Nothing Then + Return -1 + Else + Return DirectCast(ViewState("CvePersonalClienteDocumentacion"), Integer) + End If + End Get + Set(value As Integer) + ViewState("CvePersonalClienteDocumentacion") = value + End Set + End Property + Property ActualizarDocumentacion As Boolean + Get + If ViewState("ActualizarDocumentacion") Is Nothing Then + Return True + Else + Return DirectCast(ViewState("ActualizarDocumentacion"), Boolean) + End If + End Get + Set(value As Boolean) + ViewState("ActualizarDocumentacion") = value + End Set + End Property + Private Property FechaLimite As Date + Get + If ViewState("FechaLimite") Is Nothing Then + Return Date.Now.AddDays(15) + Else + Return ViewState("FechaLimite").ToString.ToDate + End If + End Get + Set(value As Date) + ViewState("FechaLimite") = value + End Set + + End Property + Property Estatus As Integer + Get + If ViewState("Estatus") Is Nothing Then + Return 0 + Else + Return DirectCast(ViewState("Estatus"), Integer) + End If + End Get + Set(value As Integer) + ViewState("Estatus") = value + End Set + End Property + Property ObservacionDocumentacion As String + Get + If ViewState("ObservacionDocumentacion") Is Nothing Then + Return "" + Else + Return ViewState("ObservacionDocumentacion").ToString + End If + End Get + Set(value As String) + ViewState("ObservacionDocumentacion") = value + End Set + End Property + Property AdjuntoDocumentacion As String + Get + If ViewState("AdjuntoDocumentacion") Is Nothing Then + Return "" + Else + Return ViewState("AdjuntoDocumentacion").ToString + End If + End Get + Set(value As String) + ViewState("AdjuntoDocumentacion") = value + End Set + End Property + 'Private ReadOnly Property CvePersonal As Integer + ' Get + ' If ViewState("CvePersonal") Is Nothing Then + ' Return -1 + ' Else + ' Return ViewState("CvePersonal").ToString.ToEntero + ' End If + ' End Get + 'End Property + +#End Region + + + +#Region " A C U M U L A D O R E S" + Property CveVentaNota As Integer + Get + If ViewState("CveVentaNota") Is Nothing Then + Return 0 + Else + Return ViewState("CveVentaNota").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("CveVentaNota") = value + End Set + + End Property + + Property FolioNotaAcumulador As Integer + Get + If ViewState("FolioNotaAcumulador") Is Nothing Then + Return 0 + Else + Return ViewState("FolioNotaAcumulador").ToString.ToEntero + End If + End Get + Set(value As Integer) + ViewState("FolioNotaAcumulador") = value + End Set + End Property + Property SerieNotaAcumulador As String + Get + If ViewState("SerieNotaAcumulador") Is Nothing Then + Return "" + + Else + Return ViewState("SerieNotaAcumulador").ToString + End If + End Get + Set(value As String) + ViewState("SerieNotaAcumulador") = value + End Set + End Property + +#End Region + Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load + If Not IsPostBack Then + + Actualizar = False + SetValues() + CargaCombos() + CreaDTVentas() + CreaDtPago() + RegistraScript("CargaHeader();") + + + If UsuarioActual.Empresa.CvePlataforma = 3 Then 'SI ES USUARIO GPS + TabFiscalContable.Visible = True + TabRetenciones.Visible = False + TabOS.Visible = False + TabComplementos.Visible = False + TabOtros.Visible = False + TabCuentasEquipos.Visible = True + ReporteDispositivos.Visible = True + TabCuentasEquipos.HeaderText = "Equipos GPS" + TabRH.Visible = False + TabUsuarios.Visible = True + TabUsuarios.HeaderText = "Usuarios" + dvZH.Visible = True + CargaZonasHorarias() + dvPlataformaSig.Style.Add("display", "none") + dvPlataformGPS.Style.Add("display", "") + BtnAgregarCtaEquipo.Visible = False + HyperLink1.Text = "Georef" + HyperLink1.ToolTip = "Creación de geocercas y rutas" + HyperLink2.Text = "Rastreo" + HyperLink2.ToolTip = "Rastreo de equipos" + HyperLink3.Text = "P.Interes" + HyperLink3.ToolTip = "Creación y reportes de puntos de interés" + ThBusqueda.Visible = True + TdBusqueda.Visible = True + HyperLink7.Visible = False + ChkSist.Visible = False + + CargaEmpresasUsuario(UsuarioActual.CveEmpresa) + End If + + 'ROL DE GPS + If UsuarioActual.CveRol = 1198 Then + TabUsuarios.HeaderText = "Usuarios" + End If + + '02/07/2018 - PRUEBAS USUARIOS PLATAFORMA CLIENTES + If UsuarioActual.Empresa.CvePlataforma = 1 Then 'SI ES USUARIO SIG + TabUsuarios.Visible = True + End If + + If UsuarioActual.Empresa.Funcionalidad(510) <> "" Then + TabCuentasEquipos.HeaderText = UsuarioActual.Empresa.Funcionalidad(510) + TabCuentasEquipos.Visible = True + End If + + If UsuarioActual.Empresa.Funcionalidad(504).ToEntero > 0 Then + If UsuarioActual.TienePermisoProceso(162) Then + ChkPermiteCredito.Enabled = True + TxtLimiteCreditoSucursal.Enabled = True + Else + ChkPermiteCredito.Enabled = False + TxtLimiteCreditoSucursal.Enabled = False + End If + ChkEstado.Enabled = False + If UsuarioActual.TienePermisoProceso(180) Then + ChkEstado.Enabled = True + End If End If If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then DivTipoRetenciones.Visible = True DivRetIVA.Visible = False - End If - - If Request("CveCliente") IsNot Nothing AndAlso IsNumeric(Request("CveCliente")) AndAlso Request("CveCliente").ToEntero > 0 Then - 'If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not Request("CveCliente").Contiene("10450", "10460", "10458") Then - ' BtnGuardar.Enabled = False : BtnEliminar.Enabled = False : LbAgregarSucursal.Enabled = False : LbEnviarActivacionPortal.Enabled = False - ' Exit Sub - 'ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not Request("CveCliente").Contiene("27448") Then - ' BtnGuardar.Enabled = False : BtnEliminar.Enabled = False : LbAgregarSucursal.Enabled = False : LbEnviarActivacionPortal.Enabled = False - ' Exit Sub - 'Else - ViewState("CveCliente") = Request("CveCliente") - CargaDatos() - If Existe Then - 'Configuración de Modalidad Update - BtnGuardar.Text = "Guardar Cambios" - LtlTitulo.Text = "Consulta del Cliente:" - CargaDatosContrato() - - - 'ImgAddVenta - HplAddVenta.NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveCliente={0}", CveCliente) - HplAddCotizacion.NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveCliente={0}&Op=Cot", CveCliente) - 'ImgAddObs.Attributes.Add("onclick", "javascript:PosicionaObjeto(this.id,'DivEventoBitacora',null,-250,-250); $('#DivEventoBitacora').show(1000); ") - If Request("Opt") IsNot Nothing AndAlso IsNumeric(Request("Opt")) Then Tab.ActiveTabIndex = Request("Opt").ToEntero - CargaDireccionesEnvio() - CargaAFAsignados() - - 'CARGA LOS FILTROS DEL TAB COMPORTAMIENTO VENTA - TabComportamientoVentas.Visible = True - CargaFiltros() - - 'JM 05-02-19: CRM - If UsuarioActual.Empresa.UsaCRM Then - VerificaVinculacion() - UpAccionesCRM.Update() - End If - End If - 'End If - HlEvento.Visible = True - HlEvento.NavigateUrl = "/OI/PopUpAgenda.aspx?CveTipoEvento=2&CveCliente=" & CveCliente & "&TB_iframe=true&height=370&width=600;" - - If UsuarioActual.Empresa.CvePlataforma = 3 Then - dvPlataformaSig.Style.Add("display", "none") - dvPlataformGPS.Style.Add("display", "") - CargaUsuarios() - BtnAgregarCtaEquipo.Visible = False - End If - - '02/07/2018 - PRUEBAS USUARIOS PLATAFORMA CLIENTES - If UsuarioActual.Empresa.CvePlataforma = 1 Then - CargaUsuariosPortalCliente() - End If - - If Request("ATI") IsNot Nothing AndAlso IsNumeric(Request("ATI")) Then - Tab.ActiveTabIndex = Request("ATI").ToEntero - End If - CargaCuentasyConceptos() - Else - 'Configuración de Modalidad Insert - - If UsuarioActual.Empresa.Funcionalidad(525) = "1" Then - Dim ObjClientes As New ClsClientes - TxtCodigo.Text = ObjClientes.GetSiguienteCodigoCliente(UsuarioActual.CveEmpresa).ToString - ObjClientes.Dispose() - End If - - ImgAddObs.Visible = False - LblFechaCaptura.Text = Now.ToShortDateString() - LblUsuarioCapturo.Text = UsuarioActual.Usuario - ViewState("CveCliente") = -1 - BtnEliminar.Visible = False - LbAgregarSucursal.Enabled = True - CreaDTSucursales() - CargaDocumentacionCliente() - - TxtPais.Text = "México" - End If - - If UsuarioActual.Empresa.CvePlataforma = 3 Then - LbAddDispositivo.Visible = True - LbAddDispositivo.Attributes.Add("onclick", $"javascript:AbrirVentana('/GPS/WizardDispositivos.aspx?CveCliente={CveCliente}', 801, 700);") - LnkAddUsuario.Visible = True - LnkAddUsuario.Attributes.Add("onclick", $"javascript:AbrirVentana('/Sistemas/PopUpAddUsuario.aspx?CveCliente={CveCliente}', 801, 700);") - End If - - '02/07/2018 - PRUEBAS USUARIOS PLATAFORMA CLIENTES - If UsuarioActual.Empresa.CvePlataforma = 1 And CveCliente > 0 Then - LnkAddUsuario.Visible = True - LnkAddUsuario.Attributes.Add("onclick", $"javascript:AbrirVentana('/Sistemas/PopUpAddUsuario.aspx?CveCliente={CveCliente}', 801, 700);") - End If - - TrImprimeNombreSucursal.Visible = True - - If UsuarioActual.CveEmpresa.Contiene(72, 80) Then - DivRetenciones.Visible = False - DivRetFletes.Visible = False - DivDiasRevision.Visible = True - DivDiasRevisionObs.Visible = True - UpParametros.Update() - UpFiscalContable.Update() - End If - - If Request("CveEmpresaCRM") IsNot Nothing AndAlso IsNumeric(Request("CveEmpresaCRM")) AndAlso Request("CveEmpresaCRM").ToEntero > 0 Then - ViewState("CveEmpresaCRM") = Request("CveEmpresaCRM") - CargaDatosCRM() - End If - - ChecaPermiteCredito() - - - 'Crea y carga CuentasBancarias - tab:Bancos - CargaCuentasBancarias() - - - 'PERMISOS PAGINA - If CveCliente > 0 Then - BtnEliminar.Visible = PermiteEliminar() - BtnGuardar.Visible = PermiteEditar() - Else - BtnGuardar.Visible = PermiteGuardar() - End If - UpGuardar.Update() - - '[IPP]: SOLO PARA JAM - 'CORPORATIVO - Div2.Visible = UsuarioActual.CveEmpresa = 119 - - 'ENVIO SMS SOLO VSH - BtnCobranzaSMS.Visible = CobranzaTelefono.Length = 10 And UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12) - - If TxtRFC.Text.Length = 13 Then - LnkPersonaFisica.Visible = True - End If - - InicializaDevolverDinero() - - TxtFechaICredito.Text = Now.AddYears(-2).ToShortDateString - TxtFechaFCredito.Text = Now.ToShortDateString - - - - If UsuarioActual.TienePermisoProceso(257) Then 'Falta agregar proceso - DivMapAddSucursal.Visible = True - LiLnkAgragarDireccion.Visible = True - End If - - End If - - 'EN SERIO SE OCUPA EN CADA POSTBACK ??? IPP 7 SEPTIEMNRE 2017 - ChkPermiso4.Enabled = False - ChkPermiso5.Enabled = False - ChkPermiso6.Enabled = False - - End Sub - -#Region " PERMISOS PAGINAS " - Private Function PermiteGuardar() As Boolean - Return UsuarioActual.TienePermisoProceso(192) - End Function - Private Function PermiteEditar() As Boolean - Return UsuarioActual.TienePermisoProceso(193) - End Function - Private Function PermiteEliminar() As Boolean - Return UsuarioActual.TienePermisoProceso(194) - End Function - -#End Region - - -#Region "C A R G A S" - Private Sub CreaDtPago() - DtPagos = New DataTable - DtPagos.Columns.Add("CveTipoMovimiento", GetType(String)) - DtPagos.Columns.Add("TipoMovimiento", GetType(String)) - DtPagos.Columns.Add("CveCuenta", GetType(String)) - DtPagos.Columns.Add("Cuenta", GetType(String)) - DtPagos.Columns.Add("Folio", GetType(String)) - DtPagos.Columns.Add("Importe", GetType(Decimal)) - DtPagos.Columns.Add("Observaciones", GetType(String)) - DtPagos.Columns.Add("Tipo", GetType(String)) - DtPagos.Columns.Add("CveMetodoPago", GetType(Integer)) - End Sub - Private Sub CargaClasificaciones() - Dim Dt As DataTable = GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa) - DdlClasificacion.DataSource = Dt - DdlClasificacion.DataBind() - DdlClasificacion.Items.Insert(0, New ListItem("Seleccione", "-1")) - UpDatos.Update() - End Sub - Private Sub CargaResponsables() - Dim Dt As DataTable = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltraParametros("True", "Nombre") - DdlResponsable.DataSource = Dt.FiltraParametros("", "", {"CveUsuario", "Nombre"}) - DdlResponsable.DataBind() - DdlResponsable.Items.Insert(0, New ListItem("Seleccione", "-1")) - - DdlResponsableSucursal.DataSource = Dt - DdlResponsableSucursal.DataBind() - DdlResponsableSucursal.Items.Insert(0, New ListItem("Seleccione", "-1")) - - UpAgregarSucursal.Update() - UpDatos.Update() - End Sub - Private Sub CargaCondicionesEntrega() - Dim Dt As DataTable = GlobalDTVtaCondicionesEntrega(UsuarioActual.CveEmpresa) - DdlCondicionesEntrega.DataSource = Dt - DdlCondicionesEntrega.DataBind() - DdlCondicionesEntrega.Items.Insert(0, New ListItem("-", "-1")) - UpDatos.Update() - End Sub - Private Sub CargaZonasHorarias() - Dim GPS As New ClsGPS - If GPS.GetZonasHorarias() Then - DdlZonaHoraria.DataSource = GPS.DtResultados - Else - DdlZonaHoraria.DataSource = Nothing - End If - DdlZonaHoraria.DataBind() - DdlZonaHoraria.Items.Insert(0, New ListItem("-", "-1")) - GPS.Dispose() - End Sub - Private Sub CargaUsuarios() - GvUsuarios.DataSource = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa, CveCliente, -1) - GvUsuarios.DataBind() - UpGvUsuarios.Update() - End Sub - Protected Sub CargaDdlSucursalCliente() - Dim ObjCliente As New ClsClientes - - DdlClienteSucursal.Items.Clear() - DdlClienteSucursalEnvio.Items.Clear() - - If ObjCliente.GetSucursales(CveCliente) Then - If ObjCliente.DtResultados.Rows.Count > 0 Then - DivFiltraSucursal.Visible = True - DdlSucursalCliente.DataSource = ObjCliente.DtResultados - DdlClienteSucursal.DataSource = ObjCliente.DtResultados - DdlClienteSucursalEnvio.DataSource = ObjCliente.DtResultados - End If - End If - - ObjCliente.Dispose() - DdlSucursalCliente.DataBind() - DdlSucursalCliente.Items.Insert(0, New ListItem("Matriz", "0")) - DdlSucursalCliente.Items.Insert(0, New ListItem("Todas", "-1")) - DdlSucursalCliente.SelectedValue = "-1" - - DdlClienteSucursal.DataBind() - DdlClienteSucursal.Items.Insert(0, New ListItem("Todas", "-1")) - DdlClienteSucursal.SelectedValue = "-1" - - DdlClienteSucursalEnvio.DataBind() - DdlClienteSucursalEnvio.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlClienteSucursalEnvio.SelectedValue = "-1" - End Sub - Private Sub CargaGridRetenciones() - Dim ObjClientes As New ClsClientes - If ObjClientes.RetencionesGet(CveCliente, -1, UsuarioActual.CveEmpresa) Then - GvRetenciones.DataSource = ObjClientes.DtResultados - If ObjClientes.DtResultados.Rows.Count > 0 Then TabRetenciones.Visible = True - End If - ObjClientes.Dispose() - GvRetenciones.DataBind() - End Sub - Private Sub CargaCuentasEquipos() - Dim Objeto As New ClsGenerales - If Objeto.GetCuentasEquipos(CveCliente, -1) Then - If Objeto.DtResultados.Rows.Count > 0 Then TabOS.Visible = True - GvCuentasEquipos.DataSource = Objeto.DtResultados - End If - - If Objeto.GetTipoCuentasEquipos() Then - DdlTipoCuentaDetalle.Items.Clear() - DdlTipoCuentaDetalle.DataSource = Objeto.DtResultados - - DdlTipoCuentaDetalle.Items.Insert(0, New ListItem("Seleccione", "-1")) - End If - Objeto.Dispose() - GvCuentasEquipos.DataBind() - DdlTipoCuentaDetalle.DataBind() - End Sub - Private Sub CargaCuentasContablesDdls() - DdlCtaContableClientes.AutoPostBack = True - DdlCtaContableAnticipos.AutoPostBack = True - DdlCtaContableRetIVA.AutoPostBack = True - DdlCtaContableRetISR.AutoPostBack = True - DdlCtaContableFondoGarantia.AutoPostBack = True - DdlCtaContableCompClientes.AutoPostBack = True - DdlCtaContableCompAnticipos.AutoPostBack = True - DdlMonedaExtranjeraClientes.AutoPostBack = True - DdlMonedaExtranjeraAnticipos.AutoPostBack = True - - If UsuarioActual.Empresa.Funcionalidad(246).ToEntero > 0 Then - DdlCtaContableClientes.Attributes.Add("onclick", "CargaCuentas(1);") - End If - - If UsuarioActual.Empresa.Funcionalidad(237).ToEntero > 0 Then - DdlCtaContableAnticipos.Attributes.Add("onclick", "CargaCuentas(2);") - End If - - 'DdlCtaContableRetIVA.Attributes.Add("onclick", "CargaCuentas(3);") - 'DdlCtaContableRetISR.Attributes.Add("onclick", "CargaCuentas(4);") - 'DdlCtaContableFondoGarantia.Attributes.Add("onclick", "CargaCuentas(5);") - - If UsuarioActual.Empresa.Funcionalidad(248).ToEntero > 0 Then - DdlCtaContableCompClientes.Attributes.Add("onclick", "CargaCuentas(6);") - End If - - DdlCtaContableCompAnticipos.Attributes.Add("onclick", "CargaCuentas(7);") - - If UsuarioActual.Empresa.Funcionalidad(247).ToEntero > 0 Then - DdlMonedaExtranjeraClientes.Attributes.Add("onclick", "CargaCuentas(8);") - End If - DdlMonedaExtranjeraAnticipos.Attributes.Add("onclick", "CargaCuentas(9);") - - End Sub + End If + + If Request("CveCliente") IsNot Nothing AndAlso IsNumeric(Request("CveCliente")) AndAlso Request("CveCliente").ToEntero > 0 Then + 'If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not Request("CveCliente").Contiene("10450", "10460", "10458") Then + ' BtnGuardar.Enabled = False : BtnEliminar.Enabled = False : LbAgregarSucursal.Enabled = False : LbEnviarActivacionPortal.Enabled = False + ' Exit Sub + 'ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not Request("CveCliente").Contiene("27448") Then + ' BtnGuardar.Enabled = False : BtnEliminar.Enabled = False : LbAgregarSucursal.Enabled = False : LbEnviarActivacionPortal.Enabled = False + ' Exit Sub + 'Else + ViewState("CveCliente") = Request("CveCliente") + CargaDatos() + If Existe Then + 'Configuración de Modalidad Update + BtnGuardar.Text = "Guardar Cambios" + LtlTitulo.Text = "Consulta del Cliente:" + CargaDatosContrato() + + + 'ImgAddVenta + HplAddVenta.NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveCliente={0}", CveCliente) + HplAddCotizacion.NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveCliente={0}&Op=Cot", CveCliente) + 'ImgAddObs.Attributes.Add("onclick", "javascript:PosicionaObjeto(this.id,'DivEventoBitacora',null,-250,-250); $('#DivEventoBitacora').show(1000); ") + If Request("Opt") IsNot Nothing AndAlso IsNumeric(Request("Opt")) Then Tab.ActiveTabIndex = Request("Opt").ToEntero + CargaDireccionesEnvio() + CargaAFAsignados() + + 'CARGA LOS FILTROS DEL TAB COMPORTAMIENTO VENTA + TabComportamientoVentas.Visible = True + CargaFiltros() + + 'JM 05-02-19: CRM + If UsuarioActual.Empresa.UsaCRM Then + VerificaVinculacion() + UpAccionesCRM.Update() + End If + End If + 'End If + HlEvento.Visible = True + HlEvento.NavigateUrl = "/OI/PopUpAgenda.aspx?CveTipoEvento=2&CveCliente=" & CveCliente & "&TB_iframe=true&height=370&width=600;" + + If UsuarioActual.Empresa.CvePlataforma = 3 Then + dvPlataformaSig.Style.Add("display", "none") + dvPlataformGPS.Style.Add("display", "") + CargaUsuarios() + BtnAgregarCtaEquipo.Visible = False + End If + + '02/07/2018 - PRUEBAS USUARIOS PLATAFORMA CLIENTES + If UsuarioActual.Empresa.CvePlataforma = 1 Then + CargaUsuariosPortalCliente() + End If + + If Request("ATI") IsNot Nothing AndAlso IsNumeric(Request("ATI")) Then + Tab.ActiveTabIndex = Request("ATI").ToEntero + End If + CargaCuentasyConceptos() + Else + 'Configuración de Modalidad Insert + + If UsuarioActual.Empresa.Funcionalidad(525) = "1" Then + Dim ObjClientes As New ClsClientes + TxtCodigo.Text = ObjClientes.GetSiguienteCodigoCliente(UsuarioActual.CveEmpresa).ToString + ObjClientes.Dispose() + End If + + ImgAddObs.Visible = False + LblFechaCaptura.Text = Now.ToShortDateString() + LblUsuarioCapturo.Text = UsuarioActual.Usuario + ViewState("CveCliente") = -1 + BtnEliminar.Visible = False + LbAgregarSucursal.Enabled = True + CreaDTSucursales() + CargaDocumentacionCliente() + + TxtPais.Text = "México" + End If + + If UsuarioActual.Empresa.CvePlataforma = 3 Then + LbAddDispositivo.Visible = True + LbAddDispositivo.Attributes.Add("onclick", $"javascript:AbrirVentana('/GPS/WizardDispositivos.aspx?CveCliente={CveCliente}', 801, 700);") + LnkAddUsuario.Visible = True + LnkAddUsuario.Attributes.Add("onclick", $"javascript:AbrirVentana('/Sistemas/PopUpAddUsuario.aspx?CveCliente={CveCliente}', 801, 700);") + End If + + '02/07/2018 - PRUEBAS USUARIOS PLATAFORMA CLIENTES + If UsuarioActual.Empresa.CvePlataforma = 1 And CveCliente > 0 Then + LnkAddUsuario.Visible = True + LnkAddUsuario.Attributes.Add("onclick", $"javascript:AbrirVentana('/Sistemas/PopUpAddUsuario.aspx?CveCliente={CveCliente}', 801, 700);") + End If + + TrImprimeNombreSucursal.Visible = True + + If UsuarioActual.CveEmpresa.Contiene(72, 80) Then + DivRetenciones.Visible = False + DivRetFletes.Visible = False + DivDiasRevision.Visible = True + DivDiasRevisionObs.Visible = True + UpParametros.Update() + UpFiscalContable.Update() + End If + + If Request("CveEmpresaCRM") IsNot Nothing AndAlso IsNumeric(Request("CveEmpresaCRM")) AndAlso Request("CveEmpresaCRM").ToEntero > 0 Then + ViewState("CveEmpresaCRM") = Request("CveEmpresaCRM") + CargaDatosCRM() + End If + + ChecaPermiteCredito() + + + 'Crea y carga CuentasBancarias - tab:Bancos + CargaCuentasBancarias() + + + 'PERMISOS PAGINA + If CveCliente > 0 Then + BtnEliminar.Visible = PermiteEliminar() + BtnGuardar.Visible = PermiteEditar() + Else + BtnGuardar.Visible = PermiteGuardar() + End If + UpGuardar.Update() + + '[IPP]: SOLO PARA JAM + 'CORPORATIVO + Div2.Visible = UsuarioActual.CveEmpresa = 119 + + 'ENVIO SMS SOLO VSH + BtnCobranzaSMS.Visible = CobranzaTelefono.Length = 10 And UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12) + + If TxtRFC.Text.Length = 13 Then + LnkPersonaFisica.Visible = True + End If + + InicializaDevolverDinero() + + TxtFechaICredito.Text = Now.AddYears(-2).ToShortDateString + TxtFechaFCredito.Text = Now.ToShortDateString + + + + If UsuarioActual.TienePermisoProceso(257) Then 'Falta agregar proceso + DivMapAddSucursal.Visible = True + LiLnkAgragarDireccion.Visible = True + End If + + End If + + 'EN SERIO SE OCUPA EN CADA POSTBACK ??? IPP 7 SEPTIEMNRE 2017 + ChkPermiso4.Enabled = False + ChkPermiso5.Enabled = False + ChkPermiso6.Enabled = False + + End Sub + +#Region " PERMISOS PAGINAS " + Private Function PermiteGuardar() As Boolean + Return UsuarioActual.TienePermisoProceso(192) + End Function + Private Function PermiteEditar() As Boolean + Return UsuarioActual.TienePermisoProceso(193) + End Function + Private Function PermiteEliminar() As Boolean + Return UsuarioActual.TienePermisoProceso(194) + End Function + +#End Region + + +#Region "C A R G A S" + Private Sub CreaDtPago() + DtPagos = New DataTable + DtPagos.Columns.Add("CveTipoMovimiento", GetType(String)) + DtPagos.Columns.Add("TipoMovimiento", GetType(String)) + DtPagos.Columns.Add("CveCuenta", GetType(String)) + DtPagos.Columns.Add("Cuenta", GetType(String)) + DtPagos.Columns.Add("Folio", GetType(String)) + DtPagos.Columns.Add("Importe", GetType(Decimal)) + DtPagos.Columns.Add("Observaciones", GetType(String)) + DtPagos.Columns.Add("Tipo", GetType(String)) + DtPagos.Columns.Add("CveMetodoPago", GetType(Integer)) + End Sub + Private Sub CargaClasificaciones() + Dim Dt As DataTable = GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa) + DdlClasificacion.DataSource = Dt + DdlClasificacion.DataBind() + DdlClasificacion.Items.Insert(0, New ListItem("Seleccione", "-1")) + UpDatos.Update() + End Sub + Private Sub CargaResponsables() + Dim Dt As DataTable = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltraParametros("True", "Nombre") + DdlResponsable.DataSource = Dt.FiltraParametros("", "", {"CveUsuario", "Nombre"}) + DdlResponsable.DataBind() + DdlResponsable.Items.Insert(0, New ListItem("Seleccione", "-1")) + + DdlResponsableSucursal.DataSource = Dt + DdlResponsableSucursal.DataBind() + DdlResponsableSucursal.Items.Insert(0, New ListItem("Seleccione", "-1")) + + UpAgregarSucursal.Update() + UpDatos.Update() + End Sub + Private Sub CargaCondicionesEntrega() + Dim Dt As DataTable = GlobalDTVtaCondicionesEntrega(UsuarioActual.CveEmpresa) + DdlCondicionesEntrega.DataSource = Dt + DdlCondicionesEntrega.DataBind() + DdlCondicionesEntrega.Items.Insert(0, New ListItem("-", "-1")) + UpDatos.Update() + End Sub + Private Sub CargaZonasHorarias() + Dim GPS As New ClsGPS + If GPS.GetZonasHorarias() Then + DdlZonaHoraria.DataSource = GPS.DtResultados + Else + DdlZonaHoraria.DataSource = Nothing + End If + DdlZonaHoraria.DataBind() + DdlZonaHoraria.Items.Insert(0, New ListItem("-", "-1")) + GPS.Dispose() + End Sub + Private Sub CargaUsuarios() + GvUsuarios.DataSource = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa, CveCliente, -1) + GvUsuarios.DataBind() + UpGvUsuarios.Update() + End Sub + Protected Sub CargaDdlSucursalCliente() + Dim ObjCliente As New ClsClientes + + DdlClienteSucursal.Items.Clear() + DdlClienteSucursalEnvio.Items.Clear() + + If ObjCliente.GetSucursales(CveCliente) Then + If ObjCliente.DtResultados.Rows.Count > 0 Then + DivFiltraSucursal.Visible = True + DdlSucursalCliente.DataSource = ObjCliente.DtResultados + DdlClienteSucursal.DataSource = ObjCliente.DtResultados + DdlClienteSucursalEnvio.DataSource = ObjCliente.DtResultados + End If + End If + + ObjCliente.Dispose() + DdlSucursalCliente.DataBind() + DdlSucursalCliente.Items.Insert(0, New ListItem("Matriz", "0")) + DdlSucursalCliente.Items.Insert(0, New ListItem("Todas", "-1")) + DdlSucursalCliente.SelectedValue = "-1" + + DdlClienteSucursal.DataBind() + DdlClienteSucursal.Items.Insert(0, New ListItem("Todas", "-1")) + DdlClienteSucursal.SelectedValue = "-1" + + DdlClienteSucursalEnvio.DataBind() + DdlClienteSucursalEnvio.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlClienteSucursalEnvio.SelectedValue = "-1" + End Sub + Private Sub CargaGridRetenciones() + Dim ObjClientes As New ClsClientes + If ObjClientes.RetencionesGet(CveCliente, -1, UsuarioActual.CveEmpresa) Then + GvRetenciones.DataSource = ObjClientes.DtResultados + If ObjClientes.DtResultados.Rows.Count > 0 Then TabRetenciones.Visible = True + End If + ObjClientes.Dispose() + GvRetenciones.DataBind() + End Sub + Private Sub CargaCuentasEquipos() + Dim Objeto As New ClsGenerales + If Objeto.GetCuentasEquipos(CveCliente, -1) Then + If Objeto.DtResultados.Rows.Count > 0 Then TabOS.Visible = True + GvCuentasEquipos.DataSource = Objeto.DtResultados + End If + + If Objeto.GetTipoCuentasEquipos() Then + DdlTipoCuentaDetalle.Items.Clear() + DdlTipoCuentaDetalle.DataSource = Objeto.DtResultados + + DdlTipoCuentaDetalle.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + Objeto.Dispose() + GvCuentasEquipos.DataBind() + DdlTipoCuentaDetalle.DataBind() + End Sub + Private Sub CargaCuentasContablesDdls() + DdlCtaContableClientes.AutoPostBack = True + DdlCtaContableAnticipos.AutoPostBack = True + DdlCtaContableRetIVA.AutoPostBack = True + DdlCtaContableRetISR.AutoPostBack = True + DdlCtaContableFondoGarantia.AutoPostBack = True + DdlCtaContableCompClientes.AutoPostBack = True + DdlCtaContableCompAnticipos.AutoPostBack = True + DdlMonedaExtranjeraClientes.AutoPostBack = True + DdlMonedaExtranjeraAnticipos.AutoPostBack = True + + If UsuarioActual.Empresa.Funcionalidad(246).ToEntero > 0 Then + DdlCtaContableClientes.Attributes.Add("onclick", "CargaCuentas(1);") + End If + + If UsuarioActual.Empresa.Funcionalidad(237).ToEntero > 0 Then + DdlCtaContableAnticipos.Attributes.Add("onclick", "CargaCuentas(2);") + End If + + 'DdlCtaContableRetIVA.Attributes.Add("onclick", "CargaCuentas(3);") + 'DdlCtaContableRetISR.Attributes.Add("onclick", "CargaCuentas(4);") + 'DdlCtaContableFondoGarantia.Attributes.Add("onclick", "CargaCuentas(5);") + + If UsuarioActual.Empresa.Funcionalidad(248).ToEntero > 0 Then + DdlCtaContableCompClientes.Attributes.Add("onclick", "CargaCuentas(6);") + End If + + DdlCtaContableCompAnticipos.Attributes.Add("onclick", "CargaCuentas(7);") + + If UsuarioActual.Empresa.Funcionalidad(247).ToEntero > 0 Then + DdlMonedaExtranjeraClientes.Attributes.Add("onclick", "CargaCuentas(8);") + End If + DdlMonedaExtranjeraAnticipos.Attributes.Add("onclick", "CargaCuentas(9);") + + End Sub Private Sub CargaCuentasyConceptos() Dim ObjConta As New ClsContabilidad If ObjConta.GetCuentasyConceptos(CveCliente) Then @@ -1055,1519 +1055,1519 @@ Partial Class Clientes ObjConta.Dispose() GvCuentasContable.DataBind() UpCuentaConceptos.Update() - End Sub - Protected Sub BtnCargarCuentas_Click(sender As Object, e As EventArgs) Handles BtnCargarCuentas.Click - If UsuarioActual.Empresa.ServerContPAQi = "" Then Exit Sub - - Select Case HdnCuenta.Value - Case "1" - CargaDdlCuentasContables(DdlCtaContableClientes, UsuarioActual.Empresa.Funcionalidad(246).ToEntero) - Case "2" - CargaDdlCuentasContables(DdlCtaContableAnticipos, UsuarioActual.Empresa.Funcionalidad(237).ToEntero) - Case "3" - CargaDdlCuentasContables(DdlCtaContableRetIVA, -1) - Case "4" - CargaDdlCuentasContables(DdlCtaContableRetISR, -1) - Case "5" - CargaDdlCuentasContables(DdlCtaContableFondoGarantia, -1) - Case "6" - CargaDdlCuentasContables(DdlCtaContableCompClientes, UsuarioActual.Empresa.Funcionalidad(248).ToEntero) - Case "7" - CargaDdlCuentasContables(DdlCtaContableCompAnticipos, -1) - Case "8" - CargaDdlCuentasContables(DdlMonedaExtranjeraClientes, UsuarioActual.Empresa.Funcionalidad(247).ToEntero) - Case "9" - CargaDdlCuentasContables(DdlMonedaExtranjeraAnticipos, UsuarioActual.Empresa.Funcionalidad(542).ToEntero) - End Select - UpFiscalContable.Update() - - ' Las funcionalidades 246, 247 y 248 para DdlCtaContableClientes, DdlMonedaExtranjeraClientes y DdlCtaContableCompClientes tienen prioridad sobre las demas. - 'If UsuarioActual.Empresa.UsaContabilidad Then CargaCuentasContablesClientes() - - - End Sub - - 'Private Sub CargaCuentasContablesClientes() - ' If UsuarioActual.Empresa.ServerContPAQi = "" Then Exit Sub - ' ' Verifica si la empresas tienen las funcionalidades 246, 247 y 248 - ' Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa) - - ' If UsuarioActual.Empresa.Funcionalidad(246).ToEntero > 0 Then - ' If ObjContabilidad.GetCuentas(UsuarioActual.Empresa.Funcionalidad(246).ToEntero, "-1", 1) Then - ' DdlCtaContableClientes.Items.Clear() - ' DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) - ' DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados - ' DdlCtaContableClientes.DataBind() - ' End If - ' End If - - ' If UsuarioActual.Empresa.Funcionalidad(247).ToEntero > 0 Then - ' If ObjContabilidad.GetCuentas(UsuarioActual.Empresa.Funcionalidad(247).ToEntero, "-1", 1) Then - ' DdlMonedaExtranjeraClientes.Items.Clear() - ' DdlMonedaExtranjeraClientes.Items.Add(New ListItem("Seleccione", "0")) - ' DdlMonedaExtranjeraClientes.DataSource = ObjContabilidad.DtResultados - ' DdlMonedaExtranjeraClientes.DataBind() - ' End If - ' End If - - ' If UsuarioActual.Empresa.Funcionalidad(248).ToEntero > 0 Then - ' If ObjContabilidad.GetCuentas(UsuarioActual.Empresa.Funcionalidad(248).ToEntero, "-1", 1) Then - ' DdlCtaContableCompClientes.Items.Clear() - ' DdlCtaContableCompClientes.Items.Add(New ListItem("Seleccione", "0")) - ' DdlCtaContableCompClientes.DataSource = ObjContabilidad.DtResultados - ' DdlCtaContableCompClientes.DataBind() - ' End If - ' End If - - ' ObjContabilidad.Dispose() - - 'End Sub - Private Sub CargaDdlCuentasContables(Ddl As DropDownList, Optional CveFuncionalidad As Integer = -1) - Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa) - If ObjContabilidad.GetCuentasRecursiva(CveFuncionalidad, 1) Then - Dim Seleccionado = Ddl.SelectedValue - Ddl.Items.Clear() - Ddl.Items.Add(New ListItem("Seleccione", "0")) - Ddl.DataSource = ObjContabilidad.DtResultados - Ddl.DataBind() - Ddl.AutoPostBack = False - Ddl.Attributes.Remove("onclick") - Ddl.CssClass &= " select2me" - Ddl.SelectedValueExist(Seleccionado) - End If - ObjContabilidad.Dispose() - End Sub - - - Private Sub CargaCombos() - CargaSubProyectoss() - CargaMetodosPago() - CargaPrecioLista() - CargaVendedores() - - - CargaCorporativo() - - CargaMetodosPago33() - CargaFormaPago33() - CargaComboCFDI() - - CargaClasificaciones() - - If UsuarioActual.Empresa.UsaContabilidad Then - 'CargaCuentasContables() - End If - - - CargaCombosComercioExterior() - - End Sub - Private Sub CargaSubProyectoss() - DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1).FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - DdlSubProyecto.DataBind() - - 'If UsuarioActual.CveSucursal = -1 Then - ' DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1")) - 'Else - ' DdlSubProyecto.SelectedValue = UsuarioActual.CveSucursal.ToString - 'End If - End Sub - Private Sub CargaMetodosPago() - DdlMetodoPago.DataSource = GlobalDTMetodosPago.FiltraParametros("Estatus = 'Activo'", "ClaveSAT") '.FiltraParametros("CveMetodoPago > 0 ") - DdlMetodoPagoSucursal.DataSource = GlobalDTMetodosPago.FiltraParametros("Estatus = 'Activo'", "ClaveSAT") - DdlMetodoPagoSucursal.DataBind() - DdlMetodoPago.DataBind() - End Sub - Private Sub CargaPrecioLista() - DdlPrecioLista.DataSource = GlobalDTPrecioListas(UsuarioActual.CveEmpresa) - DdlPrecioLista.DataBind() - DdlPrecioLista.Items.Insert(0, New ListItem(" - ", "-1")) - End Sub - Private Sub CargaCuentasContables() - If UsuarioActual.Empresa.ServerContPAQi = "" Then Exit Sub - Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa) - If ObjContabilidad.GetCuentas(-1, "-1", -1) Then - DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados - DdlCtaContableAnticipos.DataSource = ObjContabilidad.DtResultados - DdlCtaContableRetIVA.DataSource = ObjContabilidad.DtResultados - DdlCtaContableRetISR.DataSource = ObjContabilidad.DtResultados - DdlCtaContableFondoGarantia.DataSource = ObjContabilidad.DtResultados - DdlCtaContableCompClientes.DataSource = ObjContabilidad.DtResultados - DdlCtaContableCompAnticipos.DataSource = ObjContabilidad.DtResultados - DdlMonedaExtranjeraClientes.DataSource = ObjContabilidad.DtResultados - DdlMonedaExtranjeraAnticipos.DataSource = ObjContabilidad.DtResultados - Else - DdlCtaContableClientes.DataSource = Nothing - DdlCtaContableAnticipos.DataSource = Nothing - DdlCtaContableRetIVA.DataSource = Nothing - DdlCtaContableRetISR.DataSource = Nothing - DdlCtaContableFondoGarantia.DataSource = Nothing - DdlCtaContableCompClientes.DataSource = Nothing - DdlCtaContableCompAnticipos.DataSource = Nothing - DdlMonedaExtranjeraClientes.DataSource = Nothing - DdlMonedaExtranjeraAnticipos.DataSource = Nothing - End If - - If UsuarioActual.Empresa.Funcionalidad(211).ToEntero > 0 Then - If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(211).ToEntero) Then - DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados - End If - End If - - If UsuarioActual.Empresa.Funcionalidad(212).ToEntero > 0 Then - If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(212).ToEntero) Then - DdlCtaContableAnticipos.DataSource = ObjContabilidad.DtResultados - End If - End If - - If UsuarioActual.Empresa.Funcionalidad(213).ToEntero > 0 Then - If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(213).ToEntero) Then - DdlCtaContableRetIVA.DataSource = ObjContabilidad.DtResultados - End If - End If - - If UsuarioActual.Empresa.Funcionalidad(214).ToEntero > 0 Then - If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(214).ToEntero) Then - DdlCtaContableRetISR.DataSource = ObjContabilidad.DtResultados - End If - End If - - If UsuarioActual.Empresa.Funcionalidad(214).ToEntero > 0 Then - If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(214).ToEntero) Then - DdlCtaContableFondoGarantia.DataSource = ObjContabilidad.DtResultados - End If - End If - - If UsuarioActual.Empresa.Funcionalidad(211).ToEntero > 0 Then - If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(214).ToEntero) Then - DdlCtaContableCompClientes.DataSource = ObjContabilidad.DtResultados - End If - End If - - If UsuarioActual.Empresa.Funcionalidad(212).ToEntero > 0 Then - If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(214).ToEntero) Then - DdlCtaContableCompAnticipos.DataSource = ObjContabilidad.DtResultados - End If - End If - - If UsuarioActual.Empresa.Funcionalidad(211).ToEntero > 0 Then - If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(214).ToEntero) Then - DdlMonedaExtranjeraClientes.DataSource = ObjContabilidad.DtResultados - End If - End If - - If UsuarioActual.Empresa.Funcionalidad(212).ToEntero > 0 Then - If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(214).ToEntero) Then - DdlMonedaExtranjeraAnticipos.DataSource = ObjContabilidad.DtResultados - End If - End If - - ObjContabilidad.Dispose() - DdlCtaContableClientes.DataBind() - DdlCtaContableAnticipos.DataBind() - DdlCtaContableRetIVA.DataBind() - DdlCtaContableRetISR.DataBind() - DdlCtaContableFondoGarantia.DataBind() - - DdlCtaContableCompClientes.DataBind() - DdlCtaContableCompAnticipos.DataBind() - - DdlMonedaExtranjeraClientes.DataBind() - DdlMonedaExtranjeraAnticipos.DataBind() - End Sub - Private Sub CargaVendedores() - Dim dt As DataTable = GlobalDTVendedores(UsuarioActual.CveEmpresa) - Dim item As New ListItem("Seleccione", "-1") - DdlVendedor.DataSource = dt - DdlVendedorSucursal.DataSource = dt - - DdlVendedor.DataBind() - DdlVendedorSucursal.DataBind() - - DdlVendedor.Items.Insert(0, item) - DdlVendedorSucursal.Items.Insert(0, New ListItem("Seleccione", "-1")) - - - End Sub - Private Sub CargaCorporativo() - - Dim ObjCorporativo As New ClsClientes - - If ObjCorporativo.GetCorporativo(UsuarioActual.CveEmpresa, 1) Then - If ObjCorporativo.DtResultados.Rows.Count > 0 Then - Dim dt As DataTable = ObjCorporativo.DtResultados - DdlCorporativo.DataSource = dt - DdlCorporativo.DataBind() - DdlCorporativo.Items.Insert(0, New ListItem("Seleccione", "-1")) - Else - DdlCorporativo.DataSource = Nothing - End If - End If - ObjCorporativo.Dispose() - End Sub - Protected Sub CargaCuentasExistentes() - 'SELECTED VALUES - DdlCtaContableClientes.SelectedValue = IdCtaCliente - DdlCtaContableAnticipos.SelectedValue = IdCtaAnticipos - DdlCtaContableRetIVA.SelectedValue = IdCtaRetIVA - DdlCtaContableRetISR.SelectedValue = IdCtaRetISR - DdlCtaContableFondoGarantia.SelectedValue = IdCtaFondoGarantia - - DdlMonedaExtranjeraClientes.SelectedValue = IdCtaMonedaExtranjera - DdlMonedaExtranjeraAnticipos.SelectedValue = IdCtaMonedaExtranjeraAnticipos - - ActivarRegistroAutomatico() - HeedarContable.Attributes.Remove("onclick") - UpFiscalContable.Update() - End Sub - Private Function CargaDatos() As Boolean - Dim watch As New Diagnostics.Stopwatch() - watch.Start() - Dim Retorno As Boolean = False - Dim ObjClientes As New ClsClientes() - If ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, Estatus:=-1, TipoCliente:=-1) Then - If ObjClientes.DtResultados.Rows.Count > 0 Then - Existe = True - Retorno = True - - CargaDdlSucursalCliente() - CargaDocumentosVenta(CveCliente) - - Dim RetSC As Boolean = CargaSucursalesCliente() - Dim RetCC As Boolean = CargaCotizaciones() - CargaHistorial() - Dim RetCxC As Boolean = CargaCxC() - CargaAnticipos() - CargaPersonalAsignado() - CargaUsuariosPortal() - CargaBancos() - CargaOrdenesServiciosCliente() - CargaImpuestosLocales() - CargaCuentasContablesDdls() - CargaResponsables() - CargaCondicionesEntrega() - 'CargaClasificaciones() - CargaGridRetenciones() - ' CargaDocs() - CargaCombos() - CargaDocumentacionCliente() - 'CargaMetodosPago33() - 'CargaFormaPago33() - 'CargaComboCFDI() - + End Sub + Protected Sub BtnCargarCuentas_Click(sender As Object, e As EventArgs) Handles BtnCargarCuentas.Click + If UsuarioActual.Empresa.ServerContPAQi = "" Then Exit Sub + + Select Case HdnCuenta.Value + Case "1" + CargaDdlCuentasContables(DdlCtaContableClientes, UsuarioActual.Empresa.Funcionalidad(246).ToEntero) + Case "2" + CargaDdlCuentasContables(DdlCtaContableAnticipos, UsuarioActual.Empresa.Funcionalidad(237).ToEntero) + Case "3" + CargaDdlCuentasContables(DdlCtaContableRetIVA, -1) + Case "4" + CargaDdlCuentasContables(DdlCtaContableRetISR, -1) + Case "5" + CargaDdlCuentasContables(DdlCtaContableFondoGarantia, -1) + Case "6" + CargaDdlCuentasContables(DdlCtaContableCompClientes, UsuarioActual.Empresa.Funcionalidad(248).ToEntero) + Case "7" + CargaDdlCuentasContables(DdlCtaContableCompAnticipos, -1) + Case "8" + CargaDdlCuentasContables(DdlMonedaExtranjeraClientes, UsuarioActual.Empresa.Funcionalidad(247).ToEntero) + Case "9" + CargaDdlCuentasContables(DdlMonedaExtranjeraAnticipos, UsuarioActual.Empresa.Funcionalidad(542).ToEntero) + End Select + UpFiscalContable.Update() + + ' Las funcionalidades 246, 247 y 248 para DdlCtaContableClientes, DdlMonedaExtranjeraClientes y DdlCtaContableCompClientes tienen prioridad sobre las demas. + 'If UsuarioActual.Empresa.UsaContabilidad Then CargaCuentasContablesClientes() + + + End Sub + + 'Private Sub CargaCuentasContablesClientes() + ' If UsuarioActual.Empresa.ServerContPAQi = "" Then Exit Sub + ' ' Verifica si la empresas tienen las funcionalidades 246, 247 y 248 + ' Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa) + + ' If UsuarioActual.Empresa.Funcionalidad(246).ToEntero > 0 Then + ' If ObjContabilidad.GetCuentas(UsuarioActual.Empresa.Funcionalidad(246).ToEntero, "-1", 1) Then + ' DdlCtaContableClientes.Items.Clear() + ' DdlCtaContableClientes.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados + ' DdlCtaContableClientes.DataBind() + ' End If + ' End If + + ' If UsuarioActual.Empresa.Funcionalidad(247).ToEntero > 0 Then + ' If ObjContabilidad.GetCuentas(UsuarioActual.Empresa.Funcionalidad(247).ToEntero, "-1", 1) Then + ' DdlMonedaExtranjeraClientes.Items.Clear() + ' DdlMonedaExtranjeraClientes.Items.Add(New ListItem("Seleccione", "0")) + ' DdlMonedaExtranjeraClientes.DataSource = ObjContabilidad.DtResultados + ' DdlMonedaExtranjeraClientes.DataBind() + ' End If + ' End If + + ' If UsuarioActual.Empresa.Funcionalidad(248).ToEntero > 0 Then + ' If ObjContabilidad.GetCuentas(UsuarioActual.Empresa.Funcionalidad(248).ToEntero, "-1", 1) Then + ' DdlCtaContableCompClientes.Items.Clear() + ' DdlCtaContableCompClientes.Items.Add(New ListItem("Seleccione", "0")) + ' DdlCtaContableCompClientes.DataSource = ObjContabilidad.DtResultados + ' DdlCtaContableCompClientes.DataBind() + ' End If + ' End If + + ' ObjContabilidad.Dispose() + + 'End Sub + Private Sub CargaDdlCuentasContables(Ddl As DropDownList, Optional CveFuncionalidad As Integer = -1) + Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa) + If ObjContabilidad.GetCuentasRecursiva(CveFuncionalidad, 1) Then + Dim Seleccionado = Ddl.SelectedValue + Ddl.Items.Clear() + Ddl.Items.Add(New ListItem("Seleccione", "0")) + Ddl.DataSource = ObjContabilidad.DtResultados + Ddl.DataBind() + Ddl.AutoPostBack = False + Ddl.Attributes.Remove("onclick") + Ddl.CssClass &= " select2me" + Ddl.SelectedValueExist(Seleccionado) + End If + ObjContabilidad.Dispose() + End Sub + + + Private Sub CargaCombos() + CargaSubProyectoss() + CargaMetodosPago() + CargaPrecioLista() + CargaVendedores() + + + CargaCorporativo() + + CargaMetodosPago33() + CargaFormaPago33() + CargaComboCFDI() + + CargaClasificaciones() + + If UsuarioActual.Empresa.UsaContabilidad Then + 'CargaCuentasContables() + End If + + + CargaCombosComercioExterior() + + End Sub + Private Sub CargaSubProyectoss() + DdlSubProyecto.DataSource = GlobalDTSubProyectos(-1).FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) + DdlSubProyecto.DataBind() + + 'If UsuarioActual.CveSucursal = -1 Then + ' DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione", "-1")) + 'Else + ' DdlSubProyecto.SelectedValue = UsuarioActual.CveSucursal.ToString + 'End If + End Sub + Private Sub CargaMetodosPago() + DdlMetodoPago.DataSource = GlobalDTMetodosPago.FiltraParametros("Estatus = 'Activo'", "ClaveSAT") '.FiltraParametros("CveMetodoPago > 0 ") + DdlMetodoPagoSucursal.DataSource = GlobalDTMetodosPago.FiltraParametros("Estatus = 'Activo'", "ClaveSAT") + DdlMetodoPagoSucursal.DataBind() + DdlMetodoPago.DataBind() + End Sub + Private Sub CargaPrecioLista() + DdlPrecioLista.DataSource = GlobalDTPrecioListas(UsuarioActual.CveEmpresa) + DdlPrecioLista.DataBind() + DdlPrecioLista.Items.Insert(0, New ListItem(" - ", "-1")) + End Sub + Private Sub CargaCuentasContables() + If UsuarioActual.Empresa.ServerContPAQi = "" Then Exit Sub + Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa) + If ObjContabilidad.GetCuentas(-1, "-1", -1) Then + DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados + DdlCtaContableAnticipos.DataSource = ObjContabilidad.DtResultados + DdlCtaContableRetIVA.DataSource = ObjContabilidad.DtResultados + DdlCtaContableRetISR.DataSource = ObjContabilidad.DtResultados + DdlCtaContableFondoGarantia.DataSource = ObjContabilidad.DtResultados + DdlCtaContableCompClientes.DataSource = ObjContabilidad.DtResultados + DdlCtaContableCompAnticipos.DataSource = ObjContabilidad.DtResultados + DdlMonedaExtranjeraClientes.DataSource = ObjContabilidad.DtResultados + DdlMonedaExtranjeraAnticipos.DataSource = ObjContabilidad.DtResultados + Else + DdlCtaContableClientes.DataSource = Nothing + DdlCtaContableAnticipos.DataSource = Nothing + DdlCtaContableRetIVA.DataSource = Nothing + DdlCtaContableRetISR.DataSource = Nothing + DdlCtaContableFondoGarantia.DataSource = Nothing + DdlCtaContableCompClientes.DataSource = Nothing + DdlCtaContableCompAnticipos.DataSource = Nothing + DdlMonedaExtranjeraClientes.DataSource = Nothing + DdlMonedaExtranjeraAnticipos.DataSource = Nothing + End If + + If UsuarioActual.Empresa.Funcionalidad(211).ToEntero > 0 Then + If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(211).ToEntero) Then + DdlCtaContableClientes.DataSource = ObjContabilidad.DtResultados + End If + End If + + If UsuarioActual.Empresa.Funcionalidad(212).ToEntero > 0 Then + If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(212).ToEntero) Then + DdlCtaContableAnticipos.DataSource = ObjContabilidad.DtResultados + End If + End If + + If UsuarioActual.Empresa.Funcionalidad(213).ToEntero > 0 Then + If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(213).ToEntero) Then + DdlCtaContableRetIVA.DataSource = ObjContabilidad.DtResultados + End If + End If + + If UsuarioActual.Empresa.Funcionalidad(214).ToEntero > 0 Then + If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(214).ToEntero) Then + DdlCtaContableRetISR.DataSource = ObjContabilidad.DtResultados + End If + End If + + If UsuarioActual.Empresa.Funcionalidad(214).ToEntero > 0 Then + If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(214).ToEntero) Then + DdlCtaContableFondoGarantia.DataSource = ObjContabilidad.DtResultados + End If + End If + + If UsuarioActual.Empresa.Funcionalidad(211).ToEntero > 0 Then + If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(214).ToEntero) Then + DdlCtaContableCompClientes.DataSource = ObjContabilidad.DtResultados + End If + End If + + If UsuarioActual.Empresa.Funcionalidad(212).ToEntero > 0 Then + If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(214).ToEntero) Then + DdlCtaContableCompAnticipos.DataSource = ObjContabilidad.DtResultados + End If + End If + + If UsuarioActual.Empresa.Funcionalidad(211).ToEntero > 0 Then + If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(214).ToEntero) Then + DdlMonedaExtranjeraClientes.DataSource = ObjContabilidad.DtResultados + End If + End If + + If UsuarioActual.Empresa.Funcionalidad(212).ToEntero > 0 Then + If ObjContabilidad.GetCuentas(-1, "-1", 1, IdPadre:=UsuarioActual.Empresa.Funcionalidad(214).ToEntero) Then + DdlMonedaExtranjeraAnticipos.DataSource = ObjContabilidad.DtResultados + End If + End If + + ObjContabilidad.Dispose() + DdlCtaContableClientes.DataBind() + DdlCtaContableAnticipos.DataBind() + DdlCtaContableRetIVA.DataBind() + DdlCtaContableRetISR.DataBind() + DdlCtaContableFondoGarantia.DataBind() + + DdlCtaContableCompClientes.DataBind() + DdlCtaContableCompAnticipos.DataBind() + + DdlMonedaExtranjeraClientes.DataBind() + DdlMonedaExtranjeraAnticipos.DataBind() + End Sub + Private Sub CargaVendedores() + Dim dt As DataTable = GlobalDTVendedores(UsuarioActual.CveEmpresa) + Dim item As New ListItem("Seleccione", "-1") + DdlVendedor.DataSource = dt + DdlVendedorSucursal.DataSource = dt + + DdlVendedor.DataBind() + DdlVendedorSucursal.DataBind() + + DdlVendedor.Items.Insert(0, item) + DdlVendedorSucursal.Items.Insert(0, New ListItem("Seleccione", "-1")) + + + End Sub + Private Sub CargaCorporativo() + + Dim ObjCorporativo As New ClsClientes + + If ObjCorporativo.GetCorporativo(UsuarioActual.CveEmpresa, 1) Then + If ObjCorporativo.DtResultados.Rows.Count > 0 Then + Dim dt As DataTable = ObjCorporativo.DtResultados + DdlCorporativo.DataSource = dt + DdlCorporativo.DataBind() + DdlCorporativo.Items.Insert(0, New ListItem("Seleccione", "-1")) + Else + DdlCorporativo.DataSource = Nothing + End If + End If + ObjCorporativo.Dispose() + End Sub + Protected Sub CargaCuentasExistentes() + 'SELECTED VALUES + DdlCtaContableClientes.SelectedValue = IdCtaCliente + DdlCtaContableAnticipos.SelectedValue = IdCtaAnticipos + DdlCtaContableRetIVA.SelectedValue = IdCtaRetIVA + DdlCtaContableRetISR.SelectedValue = IdCtaRetISR + DdlCtaContableFondoGarantia.SelectedValue = IdCtaFondoGarantia + + DdlMonedaExtranjeraClientes.SelectedValue = IdCtaMonedaExtranjera + DdlMonedaExtranjeraAnticipos.SelectedValue = IdCtaMonedaExtranjeraAnticipos + + ActivarRegistroAutomatico() + HeedarContable.Attributes.Remove("onclick") + UpFiscalContable.Update() + End Sub + Private Function CargaDatos() As Boolean + Dim watch As New Diagnostics.Stopwatch() + watch.Start() + Dim Retorno As Boolean = False + Dim ObjClientes As New ClsClientes() + If ObjClientes.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, Estatus:=-1, TipoCliente:=-1) Then + If ObjClientes.DtResultados.Rows.Count > 0 Then + Existe = True + Retorno = True + + CargaDdlSucursalCliente() + CargaDocumentosVenta(CveCliente) + + Dim RetSC As Boolean = CargaSucursalesCliente() + Dim RetCC As Boolean = CargaCotizaciones() + CargaHistorial() + Dim RetCxC As Boolean = CargaCxC() + CargaAnticipos() + CargaPersonalAsignado() + CargaUsuariosPortal() + CargaBancos() + CargaOrdenesServiciosCliente() + CargaImpuestosLocales() + CargaCuentasContablesDdls() + CargaResponsables() + CargaCondicionesEntrega() + 'CargaClasificaciones() + CargaGridRetenciones() + ' CargaDocs() + CargaCombos() + CargaDocumentacionCliente() + 'CargaMetodosPago33() + 'CargaFormaPago33() + 'CargaComboCFDI() + If UsuarioActual.TienePermisoProceso(279) Then LnkPorcentajeMarcas.Visible = True LnkPorcentajePrecios.Visible = True - End If - - If UsuarioActual.TienePermisoProceso(261) Then LnkVerGrafica.Visible = True - - If UsuarioActual.Empresa.CvePlataforma = 3 Then ' SI ES USUARIO DE GPS. - CargaDispositivos() - Else - CargaCuentasEquipos() - End If - - CargaCuentasCaracteristicas() - - If ObjClientes.Pais = "" Then ObjClientes.Pais = "México" - - 'Campos para Modificación - LtlCliente.Text = ObjClientes.Nombre - TxtNombre.Text = ObjClientes.Nombre - TxtNombreComercial.Text = ObjClientes.NombreComercial - TxtCodigo.Text = ObjClientes.Codigo - CodigoCliente = ObjClientes.Codigo - TxtDireccion.Text = ObjClientes.Direccion - TxtNoExt.Text = ObjClientes.NoExt - TxtNoInt.Text = ObjClientes.NoInt - TxtColonia.Text = ObjClientes.Colonia - TxtLocalidad.Text = ObjClientes.Localidad - TxtCiudad.Text = ObjClientes.Ciudad - TxtEstado.Text = ObjClientes.Estado - TxtPais.Text = ObjClientes.Pais - TxtRFC.Text = ObjClientes.RFC - TxtCP.Text = ObjClientes.CP.ToString - TxtTelefono.Text = ObjClientes.Telefono - TxtContacto.Text = ObjClientes.Contacto - TxtEmail.Text = ObjClientes.Mail - TxtEmailCotizacion.Text = ObjClientes.MailCotizacion - TxtNotificar.Text = ObjClientes.NotificarA - TxtPagina.Text = ObjClientes.Pagina - TxtGiro.Text = ObjClientes.Giro - DdlPrecioLista.SelectedValue = ObjClientes.CvePrecioLista.ToString - TxtCC.Text = ObjClientes.NotificarA + End If + + If UsuarioActual.TienePermisoProceso(261) Then LnkVerGrafica.Visible = True + + If UsuarioActual.Empresa.CvePlataforma = 3 Then ' SI ES USUARIO DE GPS. + CargaDispositivos() + Else + CargaCuentasEquipos() + End If + + CargaCuentasCaracteristicas() + + If ObjClientes.Pais = "" Then ObjClientes.Pais = "México" + + 'Campos para Modificación + LtlCliente.Text = ObjClientes.Nombre + TxtNombre.Text = ObjClientes.Nombre + TxtNombreComercial.Text = ObjClientes.NombreComercial + TxtCodigo.Text = ObjClientes.Codigo + CodigoCliente = ObjClientes.Codigo + TxtDireccion.Text = ObjClientes.Direccion + TxtNoExt.Text = ObjClientes.NoExt + TxtNoInt.Text = ObjClientes.NoInt + TxtColonia.Text = ObjClientes.Colonia + TxtLocalidad.Text = ObjClientes.Localidad + TxtCiudad.Text = ObjClientes.Ciudad + TxtEstado.Text = ObjClientes.Estado + TxtPais.Text = ObjClientes.Pais + TxtRFC.Text = ObjClientes.RFC + TxtCP.Text = ObjClientes.CP.ToString + TxtTelefono.Text = ObjClientes.Telefono + TxtContacto.Text = ObjClientes.Contacto + TxtEmail.Text = ObjClientes.Mail + TxtEmailCotizacion.Text = ObjClientes.MailCotizacion + TxtNotificar.Text = ObjClientes.NotificarA + TxtPagina.Text = ObjClientes.Pagina + TxtGiro.Text = ObjClientes.Giro + DdlPrecioLista.SelectedValue = ObjClientes.CvePrecioLista.ToString + TxtCC.Text = ObjClientes.NotificarA ChkMail.Checked = ObjClientes.EnviarFactura - DdlTipoRetencion.SelectedValueExist(ObjClientes.DtResultados(0)("CveTipoRetencion").ToString) - DdlTipoRetencion_SelectedIndexChanged(DdlTipoRetencion, EventArgs.Empty) - TxtRetIVA.Text = ObjClientes.RetIVA.ToString - TxtRetISR.Text = ObjClientes.RetISR.ToString - ChkRetIVAFletesAcarreos.Checked = ObjClientes.RetieneIVAFletes - DdlSubProyecto.SelectedValue = ObjClientes.CveSubProyecto.ToString - DdlZonaHoraria.SelectedValueExist(ObjClientes.DtResultados(0)("CveZonaHoraria").ToString) - ChkEstado.Checked = ObjClientes.Estatus - EstatusAnteriorCliente = ObjClientes.Estatus - LblFechaCaptura.Text = ObjClientes.FechaIng.ToShortDateString - LblUsuarioCapturo.Text = ObjClientes.Usuario - TxtNombreCorto.Text = ObjClientes.NombreCorto - DdlVendedor.SelectedValueExist(ObjClientes.Vendedor.ToString) - 'TxtVendedor.Text = ObjClientes.Vendedor - TxtPlazoCobranza.Text = ObjClientes.PlazoCobranza.ToString - TxtPlazoCobranzaRemision.Text = ObjClientes.PlazoCobranzaRemision.ToString - ' TxtSucursalCliente.Text = ObjClientes.Sucursal - 'TxtRecepcionPago.Text = ObjClientes.RecepcionPagos - DdlTipoPago.SelectedValueExist(ObjClientes.TipoPago) - 'TxtCuentaContable.Text = ObjClientes.CuentaContable - TxtExtension.Text = ObjClientes.TelefonoExtension - TxtTelefonoOtro.Text = ObjClientes.TelefonoOtros - IdCtaCliente = ObjClientes.IdCtaContClientes.ToString - IdCtaAnticipos = ObjClientes.IdCtaContAnticipos.ToString - IdCtaRetIVA = ObjClientes.IdCtaContRetIVA.ToString - IdCtaRetISR = ObjClientes.IdCtaContRetISR.ToString - IdCtaFondoGarantia = ObjClientes.IdCtaContFondoGarantia.ToString - TxtConvenioCIE.Text = ObjClientes.ConvenioCIE - TxtNumCtaPago.Text = ObjClientes.NumCtaPago - DdlMetodoPago.SelectedValue = ObjClientes.CveMetodoPago.ToString - TxtFormaFacturacion.Text = ObjClientes.FormaFacturacion - ChkPermiteCredito.Checked = ObjClientes.PermiteCredito - TxtLimiteCredito.Text = ObjClientes.LimiteCredito.FormatoNumero - ChkAplicaFEMSA.Checked = ObjClientes.AplicaFEMSA - TxtFEMSA_NumSociedad.Text = ObjClientes.FEMSA_NumSociedad - TxtFEMSA_NumProveedor.Text = ObjClientes.FEMSA_NumProveedor - TxtFEMA_Mail.Text = ObjClientes.FEMSA_Mail - ChkAplicaDetallista.Checked = ObjClientes.AplicaDetallista - TxtDet_GLNComprador.Text = ObjClientes.Detallista_GLNComprador - TxtDet_Departamento.Text = ObjClientes.Detallista_Departamento - TxtDet_GLNVendedor.Text = ObjClientes.Detallista_GLNVendedor - TxtDet_NumProveedor.Text = ObjClientes.Detallista_NumProveedor - HplAbonarMasivo.NavigateUrl = String.Format("/Ventas/ClientesAbonar.aspx?CveCliente={0}&CveMoneda={1}", CveCliente, -1) - DdlResponsable.SelectedValueExist(ObjClientes.CveUsuarioResponsable) - DdlClasificacion.SelectedValueExist(ObjClientes.CveClasificacion) - DdlCondicionesEntrega.SelectedValueExist(ObjClientes.CveCondicionEntrega) - DdlTipoCliente.SelectedValueExist(ObjClientes.TipoCliente) - TxtCobranzaContacto.Text = ObjClientes.CobranzaContacto - TxtCobranzaTelefono.Text = ObjClientes.CobranzaTelefono - ChkRequiereOC.Checked = ObjClientes.RequiereOC - ChkEsDistribuidor.Checked = Boolean.Parse(ObjClientes.DtResultados(0)("EsDistribuidor").ToString) - CobranzaTelefono = ObjClientes.CobranzaTelefono - If CobranzaTelefono.Length = 10 Then - BtnCobranzaSMS.ToolTip = $"El mensaje SMS será enviado al número celular {CobranzaTelefono}
    con #referencia ""{If(UsuarioActual.CveEmpresa = 4, TxtNombreCorto.Text, CodigoCliente)}""" - End If - - TxtCobranzaExt.Text = ObjClientes.CobranzaNoExt - TxtCobranzaCorreo.Text = ObjClientes.CobranzaCorreo - - TxtPortalFacturacion.Text = ObjClientes.PortalFacturacion - TxtDiasEspecifico.Text = ObjClientes.DiasEspecificos - TxtDocumentacion.Text = ObjClientes.Documentacion - TxtUsuarioPortalFacturacion.Text = ObjClientes.UsuarioPortal - TxtContraseñaPortalFacturacion.Text = ObjClientes.ContraseñaPortal - - IdCtaCompCliente = ObjClientes.IdCtaContComplementaria.ToString - IdCtaCompAnticipo = ObjClientes.IdCtaContCompAnticipos.ToString - - IdCtaMonedaExtranjera = ObjClientes.IdCtaMonedaExtranjera.ToString - IdCtaMonedaExtranjeraAnticipos = ObjClientes.IdCtaMonedaExtranjeraAnticipos.ToString - - ChkMuestraNombre.Checked = ObjClientes.ImprimeNombreSucursal - - - DdlUsoCFDI.SelectedValueExist(ObjClientes.CveUsoCFDI.ToString) - DdlMetodoPago33.SelectedValueExist(ObjClientes.CveMetodoPago33.ToString) - DdlFormaPago33.SelectedValueExist(ObjClientes.CveFormaPago33.ToString) - - ChkDesglosarIEPS.Checked = ObjClientes.DesglosaIEPS - DdlCorporativo.SelectedValueExist(ObjClientes.CveClienteCorporativo.ToString) - ChkCargoUsado.Checked = ObjClientes.CargoUsados - ChkBonificacionUsado.Checked = ObjClientes.BonificacionUsado - 'COMERCIO EXTERIOR - ChkAplicaComercioExterior.Checked = ObjClientes.AplicaComercioExterior - DdlTipoOperacion.SelectedValueExist(ObjClientes.CveTipoOperacion) - DdlClavePedimento.SelectedValueExist(ObjClientes.CvePedimento) - DdlIncoterm.SelectedValueExist(ObjClientes.CveIncoterm) - - 'PERSONA FISICA - If ObjClientes.RFC.Length = 13 Then - TxtApellidoPaternoPF.Text = ObjClientes.ApellidoPaterno - TxtApellidoMaternoPF.Text = ObjClientes.ApellidoMaterno - TxtNombrePF.Text = ObjClientes.Nombres - - TxtApellidoPaterno.Text = ObjClientes.ApellidoPaterno - TxtApellidoMaterno.Text = ObjClientes.ApellidoMaterno - TxtNombres.Text = ObjClientes.Nombres - - If ObjClientes.Nombres <> "" AndAlso ObjClientes.ApellidoPaterno <> "" AndAlso ObjClientes.ApellidoMaterno <> "" Then - DivPersonaFisica.Visible = True - DivRazonSocial.Visible = False - End If - End If - - HDLT.Value = If(ObjClientes.DtResultados(0)("LT").ToString = "", "0", ObjClientes.DtResultados(0)("LT").ToString) - HDLG.Value = If(ObjClientes.DtResultados(0)("LG").ToString = "", "0", ObjClientes.DtResultados(0)("LG").ToString) - - DdlPais.SelectedValueExist(ObjClientes.CvePais) - CargaEstado() - - If DdlPais.SelectedValue.Contiene("151", "66", "40") Then - DdlEstado.Visible = True - DdlEstado.SelectedValueExist(ObjClientes.CveEstado) - - If DdlPais.SelectedValue.Contiene("151") Then - - CargaMunicipio() - DdlMunicipio.Visible = True - DdlMunicipio.SelectedValueExist(ObjClientes.CveMunicipio) - - CargaColonia() - DdlColonia.Visible = True - DdlColonia.SelectedValueExist(ObjClientes.CveColonia) - Else - DdlMunicipio.Visible = False - TxtComExtMunicipio.Visible = True - TxtComExtMunicipio.Text = ObjClientes.ComExtMunicipio - - DdlColonia.Visible = False - TxtComExtColonia.Visible = True - TxtComExtColonia.Text = ObjClientes.ComExtColonia - End If - Else - DdlEstado.Visible = False - TxtComExtEstado.Visible = True - TxtComExtEstado.Text = ObjClientes.ComExtEstado - - DdlMunicipio.Visible = False - TxtComExtMunicipio.Visible = True - TxtComExtMunicipio.Text = ObjClientes.ComExtMunicipio - - DdlColonia.Visible = False - TxtComExtColonia.Visible = True - TxtComExtColonia.Text = ObjClientes.ComExtColonia - End If - - DdlMotivoTraslado.SelectedValueExist(ObjClientes.CveMotivoTraslado) - TxtNumRegIdTrib.Text = ObjClientes.NumRegIdTrib - - - 'If ObjClientes.CveUsoCFDI > 0 Then DdlUsoCFDI.Items.RemoveAt(0) - 'If ObjClientes.CveMetodoPago33 > 0 Then DdlMetodoPago33.Items.RemoveAt(0) - 'If ObjClientes.CveFormaPago33 > 0 Then DdlFormaPago33.Items.RemoveAt(0) - - 'DIAS DE PAGO - If ObjClientes.RecepcionPagos <> "" AndAlso ObjClientes.RecepcionPagos.Length = 11 Then - Dim array As String() = ObjClientes.RecepcionPagos.Split(New Char() {"-"c}) - If array(0) = "1" Then ChkLunes.Checked = True - If array(1) = "1" Then ChkMartes.Checked = True - If array(2) = "1" Then ChkMiercoles.Checked = True - If array(3) = "1" Then ChkJueves.Checked = True - If array(4) = "1" Then ChkViernes.Checked = True - If array(5) = "1" Then ChkSabado.Checked = True - End If - - 'DIAS DE REVSION - If ObjClientes.DiasRevision <> "" AndAlso ObjClientes.DiasRevision.Length = 11 Then - Dim array As String() = ObjClientes.DiasRevision.Split(New Char() {"-"c}) - If array(0) = "1" Then ChkRevLunes.Checked = True - If array(1) = "1" Then ChkRevMartes.Checked = True - If array(2) = "1" Then ChkRevMiercoles.Checked = True - If array(3) = "1" Then ChkRevJueves.Checked = True - If array(4) = "1" Then ChkRevViernes.Checked = True - If array(5) = "1" Then ChkRevSabado.Checked = True - End If - - - 'Horario - TxtHorario.Text = ObjClientes.Horario - 'If ObjClientes.Horario <> "" Then - ' Dim arrayHorario As String() = ObjClientes.Horario.Split(New Char() {"|"c}) - ' If arrayHorario.Count = 1 Then - ' TxtHorario1.Text = arrayHorario(0) - ' End If - ' If arrayHorario.Count = 2 Then - ' TxtHorario2.Text = arrayHorario(1) - ' End If - 'End If - - TxtObsDiasRevision.Text = ObjClientes.ObservacionRevision - TxtReferenciaFiscal.Text = ObjClientes.ReferenciaFiscal - TxtCelular.Text = ObjClientes.Celular - TxtExtOtro.Text = ObjClientes.ExtOtros - - - If ObjClientes.IdCtaContClientes > 0 Then DdlCtaContableClientes.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaContClientes), ObjClientes.IdCtaContClientes.ToString)) : DdlCtaContableClientes.SelectedValue = ObjClientes.IdCtaContClientes.ToString - If ObjClientes.IdCtaContAnticipos > 0 Then - DdlCtaContableAnticipos.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaContAnticipos), ObjClientes.IdCtaContAnticipos.ToString)) - DdlCtaContableAnticipos.SelectedValue = ObjClientes.IdCtaContAnticipos.ToString - End If - If ObjClientes.IdCtaContRetISR > 0 Then DdlCtaContableRetISR.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaContRetISR), ObjClientes.IdCtaContRetISR.ToString)) : DdlCtaContableRetISR.SelectedValue = ObjClientes.IdCtaContRetISR.ToString - If ObjClientes.IdCtaContRetIVA > 0 Then DdlCtaContableRetIVA.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaContRetIVA), ObjClientes.IdCtaContRetIVA.ToString)) : DdlCtaContableRetIVA.SelectedValue = ObjClientes.IdCtaContRetIVA.ToString - If ObjClientes.IdCtaContFondoGarantia > 0 Then DdlCtaContableFondoGarantia.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaContFondoGarantia), ObjClientes.IdCtaContFondoGarantia.ToString)) : DdlCtaContableFondoGarantia.SelectedValue = ObjClientes.IdCtaContFondoGarantia.ToString - - - If ObjClientes.IdCtaContComplementaria > 0 Then DdlCtaContableCompClientes.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaContComplementaria), ObjClientes.IdCtaContComplementaria.ToString)) : DdlCtaContableCompClientes.SelectedValue = ObjClientes.IdCtaContComplementaria.ToString - If ObjClientes.IdCtaContCompAnticipos > 0 Then DdlCtaContableCompAnticipos.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaContCompAnticipos), ObjClientes.IdCtaContCompAnticipos.ToString)) : DdlCtaContableCompAnticipos.SelectedValue = ObjClientes.IdCtaContCompAnticipos.ToString - - If ObjClientes.IdCtaMonedaExtranjera > 0 Then DdlMonedaExtranjeraClientes.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaMonedaExtranjera), ObjClientes.IdCtaMonedaExtranjera.ToString)) : DdlMonedaExtranjeraClientes.SelectedValue = ObjClientes.IdCtaMonedaExtranjera.ToString - If ObjClientes.IdCtaMonedaExtranjeraAnticipos > 0 Then DdlMonedaExtranjeraAnticipos.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaMonedaExtranjeraAnticipos), ObjClientes.IdCtaMonedaExtranjeraAnticipos.ToString)) : DdlMonedaExtranjeraAnticipos.SelectedValue = ObjClientes.IdCtaMonedaExtranjeraAnticipos.ToString - ActivarRegistroAutomatico() - - '7eleven - TxtProveedor.Text = ObjClientes.SevenEleven_NumProveedor - - 'FORD - TxtFordGSDB.Text = ObjClientes.Ford_GSDB - ChkAplicaFord.Checked = ObjClientes.AplicaFord - - If TxtEmail.Text <> "" Then - LbEnviarActivacionPortal.Enabled = True - LbEnviarActivacionPortal.Visible = True - LblActivacionPortal.Visible = False - LblUsuarioPortalCliente.Text = TxtEmail.Text - - LblUsuarioPortalCliente.Attributes("style") = "font-weight: bold;" - - ElseIf TxtEmail.Text <> "" And UsuarioActual.Empresa.CvePlataforma = 3 Then - LbEnviarActivacionPortal.Enabled = True - Else - - LblActivacionPortal.Attributes("style") = "color:red;" - LblActivacionPortal.Visible = True - LbEnviarActivacionPortal.Visible = False - LblUsuarioPortalCliente.Text = "" - End If - - If Not ObjClientes.Estatus Then - Alert("El cliente actualmente se encuentra Inactivo.", TipoMensaje.MsgAdvertencia) - End If - - CargaEventoBitacora() - - 'Ocultamos la mayoria de informacion si es no-frecuente - If ObjClientes.TipoCliente = 2 Then - TabFiscalContable.Visible = False - TabCxC.Visible = False - TabAnticipos.Visible = False - TabRetenciones.Visible = False - TabOS.Visible = False - TabComplementos.Visible = False - TabOtros.Visible = False - TabRH.Visible = False - TabCuentasEquipos.Visible = False - TabSistema.Visible = False - - DivPortletSucursales.Visible = False - DivPortletDireccionEnvio.Visible = False - DivPortletAsignaciones.Visible = False - DivPortletBitacora.Visible = False - BtnEliminar.Visible = False - - DivProtletRegistrar.Visible = True - End If - - Else - Existe = False - Alert("El Cliente Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) - BtnGuardar.Enabled = False - End If - - - - If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then ' Funcionalidad Es Distribuidor - - DivEsDistribuidor.Visible = True - TabUsados.Visible = True - DivCargoUsado.Visible = True - DivBonificacionUsado.Visible = True - CargaUsados() - + DdlTipoRetencion.SelectedValueExist(ObjClientes.DtResultados(0)("CveTipoRetencion").ToString) + DdlTipoRetencion_SelectedIndexChanged(DdlTipoRetencion, EventArgs.Empty) + TxtRetIVA.Text = ObjClientes.RetIVA.ToString + TxtRetISR.Text = ObjClientes.RetISR.ToString + ChkRetIVAFletesAcarreos.Checked = ObjClientes.RetieneIVAFletes + DdlSubProyecto.SelectedValue = ObjClientes.CveSubProyecto.ToString + DdlZonaHoraria.SelectedValueExist(ObjClientes.DtResultados(0)("CveZonaHoraria").ToString) + ChkEstado.Checked = ObjClientes.Estatus + EstatusAnteriorCliente = ObjClientes.Estatus + LblFechaCaptura.Text = ObjClientes.FechaIng.ToShortDateString + LblUsuarioCapturo.Text = ObjClientes.Usuario + TxtNombreCorto.Text = ObjClientes.NombreCorto + DdlVendedor.SelectedValueExist(ObjClientes.Vendedor.ToString) + 'TxtVendedor.Text = ObjClientes.Vendedor + TxtPlazoCobranza.Text = ObjClientes.PlazoCobranza.ToString + TxtPlazoCobranzaRemision.Text = ObjClientes.PlazoCobranzaRemision.ToString + ' TxtSucursalCliente.Text = ObjClientes.Sucursal + 'TxtRecepcionPago.Text = ObjClientes.RecepcionPagos + DdlTipoPago.SelectedValueExist(ObjClientes.TipoPago) + 'TxtCuentaContable.Text = ObjClientes.CuentaContable + TxtExtension.Text = ObjClientes.TelefonoExtension + TxtTelefonoOtro.Text = ObjClientes.TelefonoOtros + IdCtaCliente = ObjClientes.IdCtaContClientes.ToString + IdCtaAnticipos = ObjClientes.IdCtaContAnticipos.ToString + IdCtaRetIVA = ObjClientes.IdCtaContRetIVA.ToString + IdCtaRetISR = ObjClientes.IdCtaContRetISR.ToString + IdCtaFondoGarantia = ObjClientes.IdCtaContFondoGarantia.ToString + TxtConvenioCIE.Text = ObjClientes.ConvenioCIE + TxtNumCtaPago.Text = ObjClientes.NumCtaPago + DdlMetodoPago.SelectedValue = ObjClientes.CveMetodoPago.ToString + TxtFormaFacturacion.Text = ObjClientes.FormaFacturacion + ChkPermiteCredito.Checked = ObjClientes.PermiteCredito + TxtLimiteCredito.Text = ObjClientes.LimiteCredito.FormatoNumero + ChkAplicaFEMSA.Checked = ObjClientes.AplicaFEMSA + TxtFEMSA_NumSociedad.Text = ObjClientes.FEMSA_NumSociedad + TxtFEMSA_NumProveedor.Text = ObjClientes.FEMSA_NumProveedor + TxtFEMA_Mail.Text = ObjClientes.FEMSA_Mail + ChkAplicaDetallista.Checked = ObjClientes.AplicaDetallista + TxtDet_GLNComprador.Text = ObjClientes.Detallista_GLNComprador + TxtDet_Departamento.Text = ObjClientes.Detallista_Departamento + TxtDet_GLNVendedor.Text = ObjClientes.Detallista_GLNVendedor + TxtDet_NumProveedor.Text = ObjClientes.Detallista_NumProveedor + HplAbonarMasivo.NavigateUrl = String.Format("/Ventas/ClientesAbonar.aspx?CveCliente={0}&CveMoneda={1}", CveCliente, -1) + DdlResponsable.SelectedValueExist(ObjClientes.CveUsuarioResponsable) + DdlClasificacion.SelectedValueExist(ObjClientes.CveClasificacion) + DdlCondicionesEntrega.SelectedValueExist(ObjClientes.CveCondicionEntrega) + DdlTipoCliente.SelectedValueExist(ObjClientes.TipoCliente) + TxtCobranzaContacto.Text = ObjClientes.CobranzaContacto + TxtCobranzaTelefono.Text = ObjClientes.CobranzaTelefono + ChkRequiereOC.Checked = ObjClientes.RequiereOC + ChkEsDistribuidor.Checked = Boolean.Parse(ObjClientes.DtResultados(0)("EsDistribuidor").ToString) + CobranzaTelefono = ObjClientes.CobranzaTelefono + If CobranzaTelefono.Length = 10 Then + BtnCobranzaSMS.ToolTip = $"El mensaje SMS será enviado al número celular {CobranzaTelefono}
    con #referencia ""{If(UsuarioActual.CveEmpresa = 4, TxtNombreCorto.Text, CodigoCliente)}""" + End If + + TxtCobranzaExt.Text = ObjClientes.CobranzaNoExt + TxtCobranzaCorreo.Text = ObjClientes.CobranzaCorreo + + TxtPortalFacturacion.Text = ObjClientes.PortalFacturacion + TxtDiasEspecifico.Text = ObjClientes.DiasEspecificos + TxtDocumentacion.Text = ObjClientes.Documentacion + TxtUsuarioPortalFacturacion.Text = ObjClientes.UsuarioPortal + TxtContraseñaPortalFacturacion.Text = ObjClientes.ContraseñaPortal + + IdCtaCompCliente = ObjClientes.IdCtaContComplementaria.ToString + IdCtaCompAnticipo = ObjClientes.IdCtaContCompAnticipos.ToString + + IdCtaMonedaExtranjera = ObjClientes.IdCtaMonedaExtranjera.ToString + IdCtaMonedaExtranjeraAnticipos = ObjClientes.IdCtaMonedaExtranjeraAnticipos.ToString + + ChkMuestraNombre.Checked = ObjClientes.ImprimeNombreSucursal + + + DdlUsoCFDI.SelectedValueExist(ObjClientes.CveUsoCFDI.ToString) + DdlMetodoPago33.SelectedValueExist(ObjClientes.CveMetodoPago33.ToString) + DdlFormaPago33.SelectedValueExist(ObjClientes.CveFormaPago33.ToString) + + ChkDesglosarIEPS.Checked = ObjClientes.DesglosaIEPS + DdlCorporativo.SelectedValueExist(ObjClientes.CveClienteCorporativo.ToString) + ChkCargoUsado.Checked = ObjClientes.CargoUsados + ChkBonificacionUsado.Checked = ObjClientes.BonificacionUsado + 'COMERCIO EXTERIOR + ChkAplicaComercioExterior.Checked = ObjClientes.AplicaComercioExterior + DdlTipoOperacion.SelectedValueExist(ObjClientes.CveTipoOperacion) + DdlClavePedimento.SelectedValueExist(ObjClientes.CvePedimento) + DdlIncoterm.SelectedValueExist(ObjClientes.CveIncoterm) + + 'PERSONA FISICA + If ObjClientes.RFC.Length = 13 Then + TxtApellidoPaternoPF.Text = ObjClientes.ApellidoPaterno + TxtApellidoMaternoPF.Text = ObjClientes.ApellidoMaterno + TxtNombrePF.Text = ObjClientes.Nombres + + TxtApellidoPaterno.Text = ObjClientes.ApellidoPaterno + TxtApellidoMaterno.Text = ObjClientes.ApellidoMaterno + TxtNombres.Text = ObjClientes.Nombres + + If ObjClientes.Nombres <> "" AndAlso ObjClientes.ApellidoPaterno <> "" AndAlso ObjClientes.ApellidoMaterno <> "" Then + DivPersonaFisica.Visible = True + DivRazonSocial.Visible = False + End If + End If + + HDLT.Value = If(ObjClientes.DtResultados(0)("LT").ToString = "", "0", ObjClientes.DtResultados(0)("LT").ToString) + HDLG.Value = If(ObjClientes.DtResultados(0)("LG").ToString = "", "0", ObjClientes.DtResultados(0)("LG").ToString) + + DdlPais.SelectedValueExist(ObjClientes.CvePais) + CargaEstado() + + If DdlPais.SelectedValue.Contiene("151", "66", "40") Then + DdlEstado.Visible = True + DdlEstado.SelectedValueExist(ObjClientes.CveEstado) + + If DdlPais.SelectedValue.Contiene("151") Then + + CargaMunicipio() + DdlMunicipio.Visible = True + DdlMunicipio.SelectedValueExist(ObjClientes.CveMunicipio) + + CargaColonia() + DdlColonia.Visible = True + DdlColonia.SelectedValueExist(ObjClientes.CveColonia) + Else + DdlMunicipio.Visible = False + TxtComExtMunicipio.Visible = True + TxtComExtMunicipio.Text = ObjClientes.ComExtMunicipio + + DdlColonia.Visible = False + TxtComExtColonia.Visible = True + TxtComExtColonia.Text = ObjClientes.ComExtColonia + End If + Else + DdlEstado.Visible = False + TxtComExtEstado.Visible = True + TxtComExtEstado.Text = ObjClientes.ComExtEstado + + DdlMunicipio.Visible = False + TxtComExtMunicipio.Visible = True + TxtComExtMunicipio.Text = ObjClientes.ComExtMunicipio + + DdlColonia.Visible = False + TxtComExtColonia.Visible = True + TxtComExtColonia.Text = ObjClientes.ComExtColonia + End If + + DdlMotivoTraslado.SelectedValueExist(ObjClientes.CveMotivoTraslado) + TxtNumRegIdTrib.Text = ObjClientes.NumRegIdTrib + + + 'If ObjClientes.CveUsoCFDI > 0 Then DdlUsoCFDI.Items.RemoveAt(0) + 'If ObjClientes.CveMetodoPago33 > 0 Then DdlMetodoPago33.Items.RemoveAt(0) + 'If ObjClientes.CveFormaPago33 > 0 Then DdlFormaPago33.Items.RemoveAt(0) + + 'DIAS DE PAGO + If ObjClientes.RecepcionPagos <> "" AndAlso ObjClientes.RecepcionPagos.Length = 11 Then + Dim array As String() = ObjClientes.RecepcionPagos.Split(New Char() {"-"c}) + If array(0) = "1" Then ChkLunes.Checked = True + If array(1) = "1" Then ChkMartes.Checked = True + If array(2) = "1" Then ChkMiercoles.Checked = True + If array(3) = "1" Then ChkJueves.Checked = True + If array(4) = "1" Then ChkViernes.Checked = True + If array(5) = "1" Then ChkSabado.Checked = True + End If + + 'DIAS DE REVSION + If ObjClientes.DiasRevision <> "" AndAlso ObjClientes.DiasRevision.Length = 11 Then + Dim array As String() = ObjClientes.DiasRevision.Split(New Char() {"-"c}) + If array(0) = "1" Then ChkRevLunes.Checked = True + If array(1) = "1" Then ChkRevMartes.Checked = True + If array(2) = "1" Then ChkRevMiercoles.Checked = True + If array(3) = "1" Then ChkRevJueves.Checked = True + If array(4) = "1" Then ChkRevViernes.Checked = True + If array(5) = "1" Then ChkRevSabado.Checked = True + End If + + + 'Horario + TxtHorario.Text = ObjClientes.Horario + 'If ObjClientes.Horario <> "" Then + ' Dim arrayHorario As String() = ObjClientes.Horario.Split(New Char() {"|"c}) + ' If arrayHorario.Count = 1 Then + ' TxtHorario1.Text = arrayHorario(0) + ' End If + ' If arrayHorario.Count = 2 Then + ' TxtHorario2.Text = arrayHorario(1) + ' End If + 'End If + + TxtObsDiasRevision.Text = ObjClientes.ObservacionRevision + TxtReferenciaFiscal.Text = ObjClientes.ReferenciaFiscal + TxtCelular.Text = ObjClientes.Celular + TxtExtOtro.Text = ObjClientes.ExtOtros + + + If ObjClientes.IdCtaContClientes > 0 Then DdlCtaContableClientes.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaContClientes), ObjClientes.IdCtaContClientes.ToString)) : DdlCtaContableClientes.SelectedValue = ObjClientes.IdCtaContClientes.ToString + If ObjClientes.IdCtaContAnticipos > 0 Then + DdlCtaContableAnticipos.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaContAnticipos), ObjClientes.IdCtaContAnticipos.ToString)) + DdlCtaContableAnticipos.SelectedValue = ObjClientes.IdCtaContAnticipos.ToString + End If + If ObjClientes.IdCtaContRetISR > 0 Then DdlCtaContableRetISR.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaContRetISR), ObjClientes.IdCtaContRetISR.ToString)) : DdlCtaContableRetISR.SelectedValue = ObjClientes.IdCtaContRetISR.ToString + If ObjClientes.IdCtaContRetIVA > 0 Then DdlCtaContableRetIVA.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaContRetIVA), ObjClientes.IdCtaContRetIVA.ToString)) : DdlCtaContableRetIVA.SelectedValue = ObjClientes.IdCtaContRetIVA.ToString + If ObjClientes.IdCtaContFondoGarantia > 0 Then DdlCtaContableFondoGarantia.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaContFondoGarantia), ObjClientes.IdCtaContFondoGarantia.ToString)) : DdlCtaContableFondoGarantia.SelectedValue = ObjClientes.IdCtaContFondoGarantia.ToString + + + If ObjClientes.IdCtaContComplementaria > 0 Then DdlCtaContableCompClientes.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaContComplementaria), ObjClientes.IdCtaContComplementaria.ToString)) : DdlCtaContableCompClientes.SelectedValue = ObjClientes.IdCtaContComplementaria.ToString + If ObjClientes.IdCtaContCompAnticipos > 0 Then DdlCtaContableCompAnticipos.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaContCompAnticipos), ObjClientes.IdCtaContCompAnticipos.ToString)) : DdlCtaContableCompAnticipos.SelectedValue = ObjClientes.IdCtaContCompAnticipos.ToString + + If ObjClientes.IdCtaMonedaExtranjera > 0 Then DdlMonedaExtranjeraClientes.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaMonedaExtranjera), ObjClientes.IdCtaMonedaExtranjera.ToString)) : DdlMonedaExtranjeraClientes.SelectedValue = ObjClientes.IdCtaMonedaExtranjera.ToString + If ObjClientes.IdCtaMonedaExtranjeraAnticipos > 0 Then DdlMonedaExtranjeraAnticipos.Items.Add(New ListItem(NombreCuenta(ObjClientes.IdCtaMonedaExtranjeraAnticipos), ObjClientes.IdCtaMonedaExtranjeraAnticipos.ToString)) : DdlMonedaExtranjeraAnticipos.SelectedValue = ObjClientes.IdCtaMonedaExtranjeraAnticipos.ToString + ActivarRegistroAutomatico() + + '7eleven + TxtProveedor.Text = ObjClientes.SevenEleven_NumProveedor + + 'FORD + TxtFordGSDB.Text = ObjClientes.Ford_GSDB + ChkAplicaFord.Checked = ObjClientes.AplicaFord + + If TxtEmail.Text <> "" Then + LbEnviarActivacionPortal.Enabled = True + LbEnviarActivacionPortal.Visible = True + LblActivacionPortal.Visible = False + LblUsuarioPortalCliente.Text = TxtEmail.Text + + LblUsuarioPortalCliente.Attributes("style") = "font-weight: bold;" + + ElseIf TxtEmail.Text <> "" And UsuarioActual.Empresa.CvePlataforma = 3 Then + LbEnviarActivacionPortal.Enabled = True + Else + + LblActivacionPortal.Attributes("style") = "color:red;" + LblActivacionPortal.Visible = True + LbEnviarActivacionPortal.Visible = False + LblUsuarioPortalCliente.Text = "" + End If + + If Not ObjClientes.Estatus Then + Alert("El cliente actualmente se encuentra Inactivo.", TipoMensaje.MsgAdvertencia) + End If + + CargaEventoBitacora() + + 'Ocultamos la mayoria de informacion si es no-frecuente + If ObjClientes.TipoCliente = 2 Then + TabFiscalContable.Visible = False + TabCxC.Visible = False + TabAnticipos.Visible = False + TabRetenciones.Visible = False + TabOS.Visible = False + TabComplementos.Visible = False + TabOtros.Visible = False + TabRH.Visible = False + TabCuentasEquipos.Visible = False + TabSistema.Visible = False + + DivPortletSucursales.Visible = False + DivPortletDireccionEnvio.Visible = False + DivPortletAsignaciones.Visible = False + DivPortletBitacora.Visible = False + BtnEliminar.Visible = False + + DivProtletRegistrar.Visible = True + End If + + Else + Existe = False + Alert("El Cliente Solicitado no existe, por favor revise su búsqueda.", TipoMensaje.MsgAdvertencia) + BtnGuardar.Enabled = False + End If + + + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then ' Funcionalidad Es Distribuidor + + DivEsDistribuidor.Visible = True + TabUsados.Visible = True + DivCargoUsado.Visible = True + DivBonificacionUsado.Visible = True + CargaUsados() + If UsuarioActual.TienePermisoProceso(280) Then UPUsadosReset.Visible = True - End If - - End If - - - - End If - UpActivacionPortal.Update() - UpModalPersonaFisica.Update() - ObjClientes.Dispose() - - - watch.Stop() - 'Alert(watch.ElapsedMilliseconds.ToString) - - Return Retorno - End Function - Private Sub CargaHistorial(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1, Optional TipoDocto As String = "-1") - Dim ObjClientes As New ClsClientes() - If ObjClientes.GetHistorialVentas(CveCliente, SelectTop, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero, TipoDocto:=TipoDocto) Then - If ObjClientes.DtResultados.Rows.Count > 0 Then - 'Carga Generales - LtlCantidad.Text = ObjClientes.DtResultados.Rows(0)("CountTotal").ToString.FormatoNumero(0) - LtlTotalVendido.Text = ObjClientes.DtResultados.Rows(0)("Total").ToString.FormatoNumero(2) - LtlMinima.Text = ObjClientes.DtResultados.Rows(0)("MIN_Total").ToString.FormatoNumero(2) - LtlPromedio.Text = ObjClientes.DtResultados.Rows(0)("AVG_Total").ToString.FormatoNumero(2) - LtlMaxima.Text = ObjClientes.DtResultados.Rows(0)("MAX_Total").ToString.FormatoNumero(2) - 'Carga Grid - DTHistorialVentas = ObjClientes.DtResultados - GVHistorial.DataSource = ObjClientes.DtResultados - Else - GVHistorial.DataSource = Nothing - End If - Else - GVHistorial.DataSource = Nothing - End If - ObjClientes.Dispose() - GVHistorial.DataBind() - End Sub - Private Function CargaCxC(Optional CveClienteSucursal As Integer = -1) As Boolean - Dim Retorno As Boolean = False - Dim ObjMovtos As New ClsMovimientos() - 'Dim ObjClientesVentas As New ClsMovimientos - 'CxC Clientes - If ObjMovtos.GetCxCClienteDetalle(CveCliente, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, DdlSucursalCliente.SelectedValue.ToEntero) Then - DtCxCActivas = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act'", "Moneda, OrdenVencimiento, FechaVencimiento") - GvCxC.DataSource = DtCxCActivas - 'solo tomo los 10 ultimos mas el totalizador general - Dim dt As DataTable = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Hist'") + End If + + End If + + + + End If + UpActivacionPortal.Update() + UpModalPersonaFisica.Update() + ObjClientes.Dispose() + + + watch.Stop() + 'Alert(watch.ElapsedMilliseconds.ToString) + + Return Retorno + End Function + Private Sub CargaHistorial(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1, Optional TipoDocto As String = "-1") + Dim ObjClientes As New ClsClientes() + If ObjClientes.GetHistorialVentas(CveCliente, SelectTop, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero, TipoDocto:=TipoDocto) Then + If ObjClientes.DtResultados.Rows.Count > 0 Then + 'Carga Generales + LtlCantidad.Text = ObjClientes.DtResultados.Rows(0)("CountTotal").ToString.FormatoNumero(0) + LtlTotalVendido.Text = ObjClientes.DtResultados.Rows(0)("Total").ToString.FormatoNumero(2) + LtlMinima.Text = ObjClientes.DtResultados.Rows(0)("MIN_Total").ToString.FormatoNumero(2) + LtlPromedio.Text = ObjClientes.DtResultados.Rows(0)("AVG_Total").ToString.FormatoNumero(2) + LtlMaxima.Text = ObjClientes.DtResultados.Rows(0)("MAX_Total").ToString.FormatoNumero(2) + 'Carga Grid + DTHistorialVentas = ObjClientes.DtResultados + GVHistorial.DataSource = ObjClientes.DtResultados + Else + GVHistorial.DataSource = Nothing + End If + Else + GVHistorial.DataSource = Nothing + End If + ObjClientes.Dispose() + GVHistorial.DataBind() + End Sub + Private Function CargaCxC(Optional CveClienteSucursal As Integer = -1) As Boolean + Dim Retorno As Boolean = False + Dim ObjMovtos As New ClsMovimientos() + 'Dim ObjClientesVentas As New ClsMovimientos + 'CxC Clientes + If ObjMovtos.GetCxCClienteDetalle(CveCliente, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, DdlSucursalCliente.SelectedValue.ToEntero) Then + DtCxCActivas = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act'", "Moneda, OrdenVencimiento, FechaVencimiento") + GvCxC.DataSource = DtCxCActivas + 'solo tomo los 10 ultimos mas el totalizador general + Dim dt As DataTable = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Hist'") DtHistorialCxC = dt - If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then - GvCxCHistorial.DataSource = dt.AsEnumerable().Take(22).CopyToDataTable() - End If - Retorno = True - Else - GvCxC.DataSource = Nothing - DtCxCActivas = Nothing - GvCxCHistorial.DataSource = Nothing - DtHistorialCxC = Nothing - End If - - - ObjMovtos.Dispose() - GvCxC.DataBind() - GvCxCHistorial.DataBind() - UpParametros.Update() - Return Retorno - End Function - Private Sub CargaAnticipos(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1) - Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then + If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then + GvCxCHistorial.DataSource = dt.AsEnumerable().Take(22).CopyToDataTable() + End If + Retorno = True + Else + GvCxC.DataSource = Nothing + DtCxCActivas = Nothing + GvCxCHistorial.DataSource = Nothing + DtHistorialCxC = Nothing + End If + + + ObjMovtos.Dispose() + GvCxC.DataBind() + GvCxCHistorial.DataBind() + UpParametros.Update() + Return Retorno + End Function + Private Sub CargaAnticipos(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1) + Dim ObjMovtos As New ClsMovimientos() + If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then DtClientesAnticipo = ObjMovtos.DtResultados.FiltraParametros("Saldo > 0 ") GVAnticipos.DataSource = DtClientesAnticipo DtAnticipoHistorial = ObjMovtos.DtResultados.FiltraParametros("Saldo <= 0 ") GVAnticiposHistorial.DataSource = DtAnticipoHistorial - Else - GVAnticipos.DataSource = Nothing - DtClientesAnticipo = Nothing - GVAnticiposHistorial.DataSource = Nothing - DtAnticipoHistorial = Nothing - End If - ObjMovtos.Dispose() - GVAnticipos.DataBind() - GVAnticiposHistorial.DataBind() - - If (GVAnticipos.Rows.Count > 0) Then - GVAnticipos.UseAccessibleHeader = True - GVAnticipos.HeaderRow.TableSection = TableRowSection.TableHeader - RegistraScript("OrdenarGVAnticipos();") - End If - - If (GVAnticiposHistorial.Rows.Count > 0) Then - GVAnticiposHistorial.UseAccessibleHeader = True - GVAnticiposHistorial.HeaderRow.TableSection = TableRowSection.TableHeader - RegistraScript("OrdenarGVAnticiposHistorial();") - End If - - - End Sub - Private Sub CargaOrdenesServiciosCliente() - Dim ObjOS As New ClsOS - If ObjOS.GetOrdenesServiciosCliente(CveCliente) Then - If ObjOS.DtResultados.Rows.Count > 0 Then TabOS.Visible = True - GVOSActivas.DataSource = ObjOS.DtResultados.FiltraParametros("Activa = 1") - 'GVOSNoActivas.DataSource = ObjOS.DtResultados - GVOSNoActivas.DataSource = ObjOS.DtResultados.FiltraParametros("Activa = 0") - Else - GVOSActivas.DataSource = Nothing - GVOSNoActivas.DataSource = Nothing - End If - ObjOS.Dispose() - GVOSActivas.DataBind() - GVOSNoActivas.DataBind() - End Sub - Private Sub CargaUsuariosPortal() - Dim ObjUsrs As New ClsSisUsuarios() - - - If ObjUsrs.GetUsuariosPortal(-1, CveCliente, -1) Then - Dim dtUsr As DataTable = ObjUsrs.DtResultados - - 'busco la clave del admin, si es que existe - Dim dr As DataRow = dtUsr.FiltroPrimero("Nombre = 'Admin'") - - If dr IsNot Nothing Then - HdnCveUsuarioPortalAdmin.Value = dr("CveUsuario").ToString - - If Convert.ToBoolean(dr("Estatus").ToString) Then - LblUsuarioActivo.Text = "Si" - 'divUsuariosPortal.Visible = True - HdnCveUsuarioPortalActivado.Value = "1" - trDesactivarUsuario.Visible = True - - 'DivPermisosPortal.Visible = True - End If - - End If - - If HdnCveUsuarioPortalActivado.Value.ToEntero > 0 Then - trEnviarActivacion.Visible = False - End If - - GvUsuariosPortal.DataSource = dtUsr - ViewState("DTUsuariosCliente") = ObjUsrs.DtResultados - Else - GvUsuariosPortal.DataSource = Nothing - ViewState("DTUsuariosCliente") = Nothing - End If - ObjUsrs.Dispose() - GvUsuariosPortal.DataBind() - End Sub - Public Sub CargaImpuestosLocales() - Dim ObjClientes As New ClsClientes - If ObjClientes.GetClienteImpuestosLocales(CveCliente) Then - GvImpuestosLocales.DataSource = ObjClientes.DtResultados - End If - ObjClientes.Dispose() - GvImpuestosLocales.DataBind() - End Sub - Public Sub CargaDireccionesEnvio() - Dim ObjClientes As New ClsClientes - If ObjClientes.DireccionEnvioGet(-1, CveCliente, -1) Then - GvDireccionesEnvio.DataSource = ObjClientes.DtResultados - End If - ObjClientes.Dispose() - GvDireccionesEnvio.DataBind() - UpDatos.Update() - End Sub - Public Sub CargaAFAsignados() - Dim ObjAF As New ClsAF() - If ObjAF.GetActivosFijos(-1, UsuarioActual.CveEmpresa, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, -1, "-1", CveCliente) Then - GvAFAsignado.DataSource = ObjAF.DtResultados - Else - GvAFAsignado.DataSource = Nothing - End If - GvAFAsignado.DataBind() - ObjAF.Dispose() - End Sub - Private Sub CargaMetodosPago33() - DdlMetodoPago33.Items.Clear() - DdlMetodoPago33.DataSource = GlobalDTVtaMetodoPago - DdlMetodoPago33.DataBind() - - DdlSucursalMetodoPago33.Items.Clear() - DdlSucursalMetodoPago33.DataSource = GlobalDTVtaMetodoPago - DdlSucursalMetodoPago33.DataBind() - - End Sub - Private Sub CargaFormaPago33() - DdlFormaPago33.Items.Clear() - DdlFormaPago33.DataSource = GlobalDTVtaFormaPago - DdlFormaPago33.DataBind() - - DdlSucursalFormaPago33.Items.Clear() - DdlSucursalFormaPago33.DataSource = GlobalDTVtaFormaPago - DdlSucursalFormaPago33.DataBind() - End Sub - Private Sub CargaComboCFDI() - DdlUsoCFDI.Items.Clear() - DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica) + Else + GVAnticipos.DataSource = Nothing + DtClientesAnticipo = Nothing + GVAnticiposHistorial.DataSource = Nothing + DtAnticipoHistorial = Nothing + End If + ObjMovtos.Dispose() + GVAnticipos.DataBind() + GVAnticiposHistorial.DataBind() + + If (GVAnticipos.Rows.Count > 0) Then + GVAnticipos.UseAccessibleHeader = True + GVAnticipos.HeaderRow.TableSection = TableRowSection.TableHeader + RegistraScript("OrdenarGVAnticipos();") + End If + + If (GVAnticiposHistorial.Rows.Count > 0) Then + GVAnticiposHistorial.UseAccessibleHeader = True + GVAnticiposHistorial.HeaderRow.TableSection = TableRowSection.TableHeader + RegistraScript("OrdenarGVAnticiposHistorial();") + End If + + + End Sub + Private Sub CargaOrdenesServiciosCliente() + Dim ObjOS As New ClsOS + If ObjOS.GetOrdenesServiciosCliente(CveCliente) Then + If ObjOS.DtResultados.Rows.Count > 0 Then TabOS.Visible = True + GVOSActivas.DataSource = ObjOS.DtResultados.FiltraParametros("Activa = 1") + 'GVOSNoActivas.DataSource = ObjOS.DtResultados + GVOSNoActivas.DataSource = ObjOS.DtResultados.FiltraParametros("Activa = 0") + Else + GVOSActivas.DataSource = Nothing + GVOSNoActivas.DataSource = Nothing + End If + ObjOS.Dispose() + GVOSActivas.DataBind() + GVOSNoActivas.DataBind() + End Sub + Private Sub CargaUsuariosPortal() + Dim ObjUsrs As New ClsSisUsuarios() + + + If ObjUsrs.GetUsuariosPortal(-1, CveCliente, -1) Then + Dim dtUsr As DataTable = ObjUsrs.DtResultados + + 'busco la clave del admin, si es que existe + Dim dr As DataRow = dtUsr.FiltroPrimero("Nombre = 'Admin'") + + If dr IsNot Nothing Then + HdnCveUsuarioPortalAdmin.Value = dr("CveUsuario").ToString + + If Convert.ToBoolean(dr("Estatus").ToString) Then + LblUsuarioActivo.Text = "Si" + 'divUsuariosPortal.Visible = True + HdnCveUsuarioPortalActivado.Value = "1" + trDesactivarUsuario.Visible = True + + 'DivPermisosPortal.Visible = True + End If + + End If + + If HdnCveUsuarioPortalActivado.Value.ToEntero > 0 Then + trEnviarActivacion.Visible = False + End If + + GvUsuariosPortal.DataSource = dtUsr + ViewState("DTUsuariosCliente") = ObjUsrs.DtResultados + Else + GvUsuariosPortal.DataSource = Nothing + ViewState("DTUsuariosCliente") = Nothing + End If + ObjUsrs.Dispose() + GvUsuariosPortal.DataBind() + End Sub + Public Sub CargaImpuestosLocales() + Dim ObjClientes As New ClsClientes + If ObjClientes.GetClienteImpuestosLocales(CveCliente) Then + GvImpuestosLocales.DataSource = ObjClientes.DtResultados + End If + ObjClientes.Dispose() + GvImpuestosLocales.DataBind() + End Sub + Public Sub CargaDireccionesEnvio() + Dim ObjClientes As New ClsClientes + If ObjClientes.DireccionEnvioGet(-1, CveCliente, -1) Then + GvDireccionesEnvio.DataSource = ObjClientes.DtResultados + End If + ObjClientes.Dispose() + GvDireccionesEnvio.DataBind() + UpDatos.Update() + End Sub + Public Sub CargaAFAsignados() + Dim ObjAF As New ClsAF() + If ObjAF.GetActivosFijos(-1, UsuarioActual.CveEmpresa, "-1", "-1", -1, -1, "-1", -1, -1, -1, -1, -1, "-1", CveCliente) Then + GvAFAsignado.DataSource = ObjAF.DtResultados + Else + GvAFAsignado.DataSource = Nothing + End If + GvAFAsignado.DataBind() + ObjAF.Dispose() + End Sub + Private Sub CargaMetodosPago33() + DdlMetodoPago33.Items.Clear() + DdlMetodoPago33.DataSource = GlobalDTVtaMetodoPago + DdlMetodoPago33.DataBind() + + DdlSucursalMetodoPago33.Items.Clear() + DdlSucursalMetodoPago33.DataSource = GlobalDTVtaMetodoPago + DdlSucursalMetodoPago33.DataBind() + + End Sub + Private Sub CargaFormaPago33() + DdlFormaPago33.Items.Clear() + DdlFormaPago33.DataSource = GlobalDTVtaFormaPago + DdlFormaPago33.DataBind() + + DdlSucursalFormaPago33.Items.Clear() + DdlSucursalFormaPago33.DataSource = GlobalDTVtaFormaPago + DdlSucursalFormaPago33.DataBind() + End Sub + Private Sub CargaComboCFDI() + DdlUsoCFDI.Items.Clear() + DdlUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica) DdlUsoCFDI.DataBind() DdlUsoCFDI.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlSucursalUsoCFDI.Items.Clear() - DdlSucursalUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica) - DdlSucursalUsoCFDI.DataBind() - End Sub -#End Region - -#Region "V E R M Á S" - - Protected Sub BtnVerMasVentas_Click(sender As Object, e As EventArgs) - If BtnVerMasVentas.Text = "Ver Más" Then - CargaHistorial(-1, TipoDocto:=RblTipo.SelectedValue) - BtnVerMasVentas.Text = "Ver Menos" - Else - CargaHistorial(21, TipoDocto:=RblTipo.SelectedValue) - BtnVerMasVentas.Text = "Ver Más" - End If - End Sub - - Protected Sub BtnVerMasAnticipos_Click(sender As Object, e As EventArgs) - If BtnVerMasAnticipos.Text = "Ver Más" Then - CargaAnticipos(-1) - BtnVerMasAnticipos.Text = "Ver Menos" - Else - CargaAnticipos(21) - BtnVerMasAnticipos.Text = "Ver Más" - End If - End Sub - - Protected Sub BtnVerMasBancos_Click(sender As Object, e As EventArgs) - If BtnVerMasBancos.Text = "Ver Más" Then - CargaBancos(1000000) - BtnVerMasBancos.Text = "Ver Menos" - Else - CargaBancos(51) - BtnVerMasBancos.Text = "Ver Más" - End If + DdlSucursalUsoCFDI.Items.Clear() + DdlSucursalUsoCFDI.DataSource = GlobalDTSATUsosCFDI(UsuarioActual.Empresa.EsPersonaFisica) + DdlSucursalUsoCFDI.DataBind() + End Sub +#End Region + +#Region "V E R M Á S" + + Protected Sub BtnVerMasVentas_Click(sender As Object, e As EventArgs) + If BtnVerMasVentas.Text = "Ver Más" Then + CargaHistorial(-1, TipoDocto:=RblTipo.SelectedValue) + BtnVerMasVentas.Text = "Ver Menos" + Else + CargaHistorial(21, TipoDocto:=RblTipo.SelectedValue) + BtnVerMasVentas.Text = "Ver Más" + End If End Sub -#End Region + Protected Sub BtnVerMasAnticipos_Click(sender As Object, e As EventArgs) + If BtnVerMasAnticipos.Text = "Ver Más" Then + CargaAnticipos(-1) + BtnVerMasAnticipos.Text = "Ver Menos" + Else + CargaAnticipos(21) + BtnVerMasAnticipos.Text = "Ver Más" + End If + End Sub -#Region "B A N C O S" + Protected Sub BtnVerMasBancos_Click(sender As Object, e As EventArgs) + If BtnVerMasBancos.Text = "Ver Más" Then + CargaBancos(1000000) + BtnVerMasBancos.Text = "Ver Menos" + Else + CargaBancos(51) + BtnVerMasBancos.Text = "Ver Más" + End If + End Sub + +#End Region + +#Region "B A N C O S" 'CuentasxCobrar Activas (Pagos Recibidos) - Private Sub CargaBancos(Optional SelectTop As Integer = 51, Optional CveClienteSucursal As Integer = -1) - Dim ObjMovtos As New ClsMovimientos() - 'CxC Activas - If ObjMovtos.GetClienteAbonos(CveCliente, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero, SelectTop:=SelectTop) AndAlso ObjMovtos.DtResultados.Rows.Count > 0 Then - GvBancos.DataSource = ObjMovtos.DtResultados - DTCobrosRealizados = ObjMovtos.DtResultados - DTCobrosRealizados.Rows.Remove(DTCobrosRealizados.Rows(0)) - Else - DTCobrosRealizados = Nothing - End If - ObjMovtos.Dispose() - GvBancos.DataBind() - End Sub - - Protected Sub GvBancos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvBancos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - 'Dim HLSendMail As HtmlAnchor = DirectCast(e.Row.FindControl("HLSendMail"), HtmlAnchor) - - If e.Row.DBCampo("CveVenta") = "" Then - If e.Row.DBCampo("CveIE") <> "" Then - Dim ObjBancos As New ClsBancos - - e.Row.Cells(0).Text = String.Format("{0} - {1}", e.Row.DBCampo("Banco"), e.Row.DBCampo("NumCuenta")) - e.Row.FCLiteral("LtlFechaVenci").Text = e.Row.DBCampo("FechaDocumento").ToDate.ToShortDateString - e.Row.FCHyperLink("HplCheque").Visible = True - e.Row.FCLiteral("LtlImp").Text = e.Row.DBCampo("ImporteIE").FormatoNumero - e.Row.FCLiteral("LtlMon").Text = e.Row.DBCampo("MonedaIE") - - - 'HLSendMail.HRef = String.Format("javascript:$get('HdnCveIE').value='{0}';$get('HdnSerieFolio').value='{1}';$get('HdnFolioPago').value='{2}';$get('TxtParaMail').value='{3}';$('#ModalDivMail').modal();", e.Row.DBCampo("CveIE"), e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("FolioCobro"), TxtCobranzaCorreo.Text) - - If ObjBancos.GetComplementoPagos(-1, e.Row.DBCampo("CveIE").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) Then - If ObjBancos.DtResultados.Rows.Count > 0 Then - e.Row.FCHyperLink("HplXML").Visible = True : e.Row.FCHyperLink("HplXML").NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CompP&EXT=xml&CveComplementoPago={0}&SerieFolio={1}&CveIE={2}", ObjBancos.DtResultados(0)("CveComplementoPago").ToString, ObjBancos.DtResultados(0)("SerieFolio").ToString, ObjBancos.DtResultados(0)("CveIE").ToString))) - e.Row.FCHyperLink("HplPDF").Visible = True : e.Row.FCHyperLink("HplPDF").NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CompP&EXT=pdf&CveComplementoPago={0}&SerieFolio={1}&CveIE={2}", ObjBancos.DtResultados(0)("CveComplementoPago").ToString, ObjBancos.DtResultados(0)("SerieFolio").ToString, ObjBancos.DtResultados(0)("CveIE").ToString))) - - e.Row.FCLinkButton("LnkSendMail").Visible = True - End If - End If - - ObjBancos.Dispose() - End If - e.Row.BackColor = Drawing.Color.LightGray - End If - - If e.Row.DBCampo("CveVenta") = "" And e.Row.DBCampo("Banco") = "" Then - e.Row.Visible = False - End If - End If - End Sub - - Protected Sub LnkSendMail_Click(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - HdnSerieFolioPago.Value = gvRow.DataKey("SerieFolioCP").ToString - TxtParaMail.Text = TxtCobranzaCorreo.Text - UpSendMail.Update() - RegistraScript("$('#ModalDivMail').modal('show');") - End Sub -#End Region - -#Region "B T N ´ S" - Protected Sub BtnEliminar_Click(sender As Object, e As System.EventArgs) Handles BtnEliminar.Click - Dim ObjClientes As New ClsClientes() - If ObjClientes.RemoveCliente(CveCliente) Then - Alert("El Cliente se Eliminó correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/CatClientes.aspx""") - End If - ObjClientes.Dispose() - End Sub - Protected Sub BtnSendMail_Click(sender As Object, e As System.EventArgs) Handles BtnSendMail.Click - Try - - If HdnCveVenta.Value <> "-1" AndAlso HdnFolioVenta.Value <> "-1" Then - - Dim ObjMail As New ClsSisMail() - Dim Ruta As String = AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\" - - Dim Cuerpo As String = TxtBody.Text - Dim Asunto As String = "" - Dim TipoComprobante = "" - - If HdnTipoDocto.Value.ToString = "Ing" Then TipoComprobante = "Factura" - If HdnTipoDocto.Value.ToString = "Egs" Then TipoComprobante = "Nota de Crédito" - If HdnTipoDocto.Value.ToString = "Dev" Then TipoComprobante = "Nota de Devolución" - If HdnTipoDocto.Value.ToString = "Rem" Then TipoComprobante = "Remisión" - If HdnTipoDocto.Value.ToString = "Cot" Then TipoComprobante = "Cotización" - If HdnTipoDocto.Value.ToString = "Ant" Then TipoComprobante = "Anticipo" - - Dim DisplayName As String = "" - If UsuarioActual.CveEmpresa = 119 Then DisplayName = "Facturación Agroquímicos JAM" - - Dim ObjVenta As New ClsVentas - Dim Dr As DataRow = Nothing - If ObjVenta.GetVenta(HdnCveVenta.Value.ToEntero, UsuarioActual.CveEmpresa) Then - If ObjVenta.DtResultados.Rows.Count > 0 Then - Dr = ObjVenta.DtResultados.Rows(0) - End If - End If - ObjVenta.Dispose() - - If UsuarioActual.Empresa.PlantillaMailVenta.Trim.Length > 0 Then - Cuerpo = UsuarioActual.Empresa.PlantillaMailVenta - Cuerpo = Cuerpo.Replace("{""NombreEmpresa""}", UsuarioActual.Empresa.Empresa) - Cuerpo = Cuerpo.Replace("{""NombreCliente""}", LtlCliente.Text.Trim) - Cuerpo = Cuerpo.Replace("{""TipoDocumento""}", TipoComprobante) - Cuerpo = Cuerpo.Replace("{""SerieFolio""}", HdnSerieFolio.Value.ToString) - If Dr IsNot Nothing Then - Cuerpo = Cuerpo.Replace("{""Fecha""}", Dr("Fecha").ToString.ToDate.ToShortDateString) - Cuerpo = Cuerpo.Replace("{""Total""}", Dr("Total").ToString.FormatoNumero) - Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString.ToDate.ToShortDateString) - End If - End If - - - If UsuarioActual.Empresa.AsuntoPlantillaMailVenta.Trim.Length > 0 Then - Asunto = UsuarioActual.Empresa.AsuntoPlantillaMailVenta - Asunto = Asunto.Replace("{""TipoDocumento""}", TipoComprobante) - Asunto = Asunto.Replace("{""Sucursal""}", HdnSubProyecto.Value.ToString) - Asunto = Asunto.Replace("{""SerieFolio""}", HdnSerieFolio.Value.ToString) - End If - - If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso HdnTipoDocto.Value.Contiene("Ing", "Egs", "Ant", "Dev") Then - If File.Exists($"{Ruta}PDF\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.pdf") AndAlso File.Exists($"{Ruta}XML\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.xml") Then - Dim PDF As String = $"{Ruta}PDF\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.pdf" - Dim XML As String = $"{Ruta}XML\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.xml" - - Dim ResultadoMail As Integer = 0 - Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) - - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = XML}) - - 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then - If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, Asunto, Cuerpo, TxtCC.Text.Trim, LSRutasMail, Displayname:=DisplayName) Then - ResultadoMail = 1 - TxtCC.Text = "" - TxtBody.Text = "" - RegistraScript("$('#ModalDivMail').modal('hide');") - Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) - CargaHistorial() - 'UpnHistorial.Update() - Else - ResultadoMail = 3 - Alert("No se pudo enviar el correo electrónico.", TipoMensaje.MsgError) - End If - - Dim ObjVentas As New ClsVentas - ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta.Value.ToEntero) - ObjVentas.Dispose() - Else - Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) - End If - ElseIf UsuarioActual.Empresa.TipoFacturacion = "CBB" AndAlso HdnTipoDocto.Value.Contiene("Ing", "Egs", "Ant", "Dev") Then - If File.Exists(Ruta & "PDF\" & HdnFolioVenta.Value & ".pdf") Then - Dim PDF As String = Ruta & "PDF\" & HdnFolioVenta.Value & ".pdf" - - Dim ResultadoMail As Integer = 0 - Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) - - - 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then - If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, Asunto, Cuerpo, TxtCC.Text.Trim, LSRutasMail) Then - ResultadoMail = 1 - TxtCC.Text = "" - TxtBody.Text = "" - RegistraScript("$('#ModalDivMail').modal('hide');") - Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) - CargaHistorial() - UpnHistorial.Update() - Else - ResultadoMail = 3 - End If - - Dim ObjVentas As New ClsVentas - ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta.Value.ToEntero) - ObjVentas.Dispose() - Else - Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) - End If - ElseIf HdnTipoDocto.Value = "Cot" Then - If File.Exists($"{Ruta}PDF\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.pdf") Then - Dim PDF As String = $"{Ruta}PDF\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.pdf" - - Dim ResultadoMail As Integer = 0 - Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) - - 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then - If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, Asunto, Cuerpo, TxtCC.Text.Trim, LSRutasMail) Then - ResultadoMail = 1 - TxtCC.Text = "" - TxtBody.Text = "" - RegistraScript("$('#ModalDivMail').modal('hide');") - Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) - CargaHistorial() - UpnHistorial.Update() - Else - ResultadoMail = 3 - End If - - Dim ObjVentas As New ClsVentas - ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta.Value.ToEntero) - ObjVentas.Dispose() - Else - Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) - End If - End If - - 'End If - 'ObjEmprea.Dispose() - ElseIf HdnSerieFolioPago.Value <> "-1" Then - - Dim ObjMail As New ClsSisMail() - Dim RutaXML As String = String.Format("{0}XML\Pag\{1}.xml", UsuarioActual.Empresa.Ruta, HdnSerieFolioPago.Value) - Dim RutaPDF As String = String.Format("{0}PDF\Pag\{1}.pdf", UsuarioActual.Empresa.Ruta, HdnSerieFolioPago.Value) - - Dim Cuerpo As String = "Se hace entrega del comprobante de pago" - Dim Asunto As String = "Entrega de comprobante de pago" - - If IO.File.Exists(RutaPDF) AndAlso IO.File.Exists(RutaXML) Then - - Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) - - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaPDF}) - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaXML}) - - If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, Asunto, Cuerpo, TxtCC.Text.Trim, LSRutasMail) Then - TxtCC.Text = "" - RegistraScript("$('#ModalDivMail').modal('hide');") - Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) - End If - Else - Alert("No se encontraron los archivos para enviar.", TipoMensaje.MsgAdvertencia) - End If - Else - Alert("No se seleccionó ninguna factura para envíar.", TipoMensaje.MsgAdvertencia) - End If - Catch ex As Exception - OnError("Ocurrió error al mandar MAIL", ex) - Dim ObjVentas As New ClsVentas - ObjVentas.UpdateVentaMail(3, HdnCveVenta.Value.ToEntero) - ObjVentas.Dispose() - End Try - End Sub - Protected Sub BtnAbonar_Click(sender As Object, e As System.EventArgs) Handles BtnAbonar.Click - Dim ObjMovtos As New ClsMovimientos() - - - If ObjMovtos.AddMovimiento(2, "Cli", CveCliente.ToString, HdnCveVentaAbono.Value, 1, 0, TxtCantidad.Text.Trim.ToDouble, Now, TxtFechaPago.Text.ToDate, TxtReferencia.Text.Trim, DdlCtaContableClientes.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - Alert("El abono se guardó correctamente", TipoMensaje.MsgInformacion, "$get(""DivAddPago"").style.display=""none"";") - CargaCxC() - TxtCantidad.Text = "" - TxtReferencia.Text = "" - - 'UpAbono.Update() - UPPUsuarios.Update() - End If - ObjMovtos.Dispose() - AbonaaCuenta() - End Sub - - Private Function AsignaCuentasAutomaticas(ObjClientes As ClsClientes) As Boolean - Dim IdCtaContableClientes As Integer = UsuarioActual.Empresa.Funcionalidad(246).ToEntero - Dim IdCtaContableAnticipos As Integer = UsuarioActual.Empresa.Funcionalidad(319).ToEntero - Dim IdCtaContableComplementaria As Integer = UsuarioActual.Empresa.Funcionalidad(320).ToEntero - Dim IdCtaContMonedaExtranjera As Integer = UsuarioActual.Empresa.Funcionalidad(331).ToEntero - Dim IdCtaContMonedaExtranjeraAnticipos As Integer = UsuarioActual.Empresa.Funcionalidad(332).ToEntero - Dim IdCtaContCompAnticipos As Integer = UsuarioActual.Empresa.Funcionalidad(333).ToEntero - - If Not ObjClientes.VincularCuentasContables(IdCtaContableClientes, IdCtaContableAnticipos, 0, 0, CveCliente, IdCtaContableComplementaria, IdCtaContMonedaExtranjera, IdCtaContMonedaExtranjeraAnticipos, IdCtaContCompAnticipos) Then - Return False - End If - Return True - End Function - - Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click - If UsuarioActual.CveUsuario = 1465 And TxtCodigo.Text.Trim = "" Then - Alert("El cliente no se puede registrar sin ingresar un Código.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - If ChkAplicaComercioExterior.Checked Then - If Not DdlTipoOperacion.SelectedValue.ToEntero > 0 Then - Alert("Tiene que seleccionar un tipo de operacion para comercio exterior.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - If Not DdlClavePedimento.SelectedValue.ToEntero > 0 Then - Alert("Tiene que seleccionar una clave de pedimento para comercio exterior.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - If Not DdlIncoterm.SelectedValue.ToEntero > 0 Then - Alert("Tiene que seleccionar un incoterm para comercio exterior.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - If Not DdlPais.SelectedValue.ToEntero > 0 Then - Alert("Tiene que seleccionar un pais para comercio exterior.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - If Not DdlPais.SelectedValue.ToEntero > 0 Then - Alert("Tiene que seleccionar un pais para comercio exterior.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - If (Not DdlEstado.SelectedValue.ToEntero > 0 And DdlEstado.Visible) Or (Not DdlEstado.Visible And TxtComExtEstado.Text = "") Then - Alert("Tiene que seleccionar un estado para comercio exterior.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - If DdlPais.SelectedValue.ToEntero = 151 Then - If Not DdlMunicipio.SelectedValue.ToEntero > 0 Then - Alert("Tiene que seleccionar un municipio para comercio exterior si el pais es mexico.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - If Not DdlColonia.SelectedValue.ToEntero > 0 Then - Alert("Tiene que seleccionar una colonia para comercio exterior si el pais es mexico.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - End If - - End If - - 'CargaSucursal() - 'If UsuarioActual.TienePermisoProceso(170) AndAlso TxtCodigo.Text.Trim = "" Then - ' Alert("Es necesario ingresar un Código", TipoMensaje.MsgAdvertencia) - ' Exit Sub - 'End If - - 'Dim rowcodigo As DataTable = GlobalDTCliente.FiltraParametros(String.Format("Codigo='{0}' AND CveEmpresa={1} ", TxtCodigo.Text.Trim, UsuarioActual.CveEmpresa)) - 'If (Not IsNothing(rowcodigo)) AndAlso (rowcodigo.Rows.Count > 0) AndAlso (rowcodigo.Rows(0)("CveCliente").ToString.ToEntero <> CveCliente) Then - ' Alert(String.Format("ya existe un Cliente Con este Codigo '{0}'", TxtCodigo.Text.Trim), TipoMensaje.MsgAdvertencia) - ' Exit Sub - 'End If - Dim ObjClientes As New ClsClientes() - Dim objDoc As New ClsEdocumentacion(ObjClientes.IniciaTransacSQL()) - Dim MsgCuentaContable As String = "" - Dim ErrorProceso As Boolean = False - - 'Dias de pago - Dim SBDiasPago As New StringBuilder() - Dim DiasPago As String = "" - If ChkLunes.Checked Then SBDiasPago.AppendFormat("1-") Else SBDiasPago.AppendFormat("0-") - If ChkMartes.Checked Then SBDiasPago.AppendFormat("1-") Else SBDiasPago.AppendFormat("0-") - If ChkMiercoles.Checked Then SBDiasPago.AppendFormat("1-") Else SBDiasPago.AppendFormat("0-") - If ChkJueves.Checked Then SBDiasPago.AppendFormat("1-") Else SBDiasPago.AppendFormat("0-") - If ChkViernes.Checked Then SBDiasPago.AppendFormat("1-") Else SBDiasPago.AppendFormat("0-") - If ChkSabado.Checked Then SBDiasPago.AppendFormat("1") Else SBDiasPago.AppendFormat("0") - DiasPago = SBDiasPago.ToString - - 'Dias de Revision - Dim SBDiasRevision As New StringBuilder() - Dim DiasRevision As String = "" - If ChkRevLunes.Checked Then SBDiasRevision.AppendFormat("1-") Else SBDiasRevision.AppendFormat("0-") - If ChkRevMartes.Checked Then SBDiasRevision.AppendFormat("1-") Else SBDiasRevision.AppendFormat("0-") - If ChkRevMiercoles.Checked Then SBDiasRevision.AppendFormat("1-") Else SBDiasRevision.AppendFormat("0-") - If ChkRevJueves.Checked Then SBDiasRevision.AppendFormat("1-") Else SBDiasRevision.AppendFormat("0-") - If ChkRevViernes.Checked Then SBDiasRevision.AppendFormat("1-") Else SBDiasRevision.AppendFormat("0-") - If ChkRevSabado.Checked Then SBDiasRevision.AppendFormat("1") Else SBDiasRevision.AppendFormat("0") - DiasRevision = SBDiasRevision.ToString - - - Dim errorContPaq As Boolean = False - Dim IdContPaqi As Integer = 0 - Dim CodigoPersona As Integer = 0 - - -#Region "comentado" - 'If UsuarioActual.Empresa.Funcionalidad(522).ToString = "1" Then - - ' Dim ObjContPaqi As New ClsContPAQi(UsuarioActual.Empresa) - - ' If ObjContPaqi.GetPersona(TxtRFC.Text) Then - - ' If ObjContPaqi.DtResultados.Rows.Count > 0 Then - - ' IdContPaqi = ObjContPaqi.DtResultados.Rows(0)("Id").ToString.ToEntero - ' CodigoPersona = ObjContPaqi.DtResultados.Rows(0)("Codigo").ToString.ToEntero - - ' Dim Cont_EsProveedor As Integer = If(Boolean.Parse(ObjContPaqi.DtResultados.Rows(0)("EsProveedor").ToString), 1, 0) - ' Dim Cont_Nombre As String = ObjContPaqi.DtResultados(0)("Nombre").ToString - ' Dim Cont_RFC As String = ObjContPaqi.DtResultados(0)("RFC").ToString - - ' If ObjContPaqi.UpdatePersona(IdContPaqi, Cont_Nombre, Cont_RFC, 1, Cont_EsProveedor) Then - ' errorContPaq = False - ' Else - ' errorContPaq = True - ' End If - - ' Else - ' If ObjContPaqi.AddPersona(TxtNombre.Text.Trim, TxtRFC.Text.Trim, 1, 0) Then - - ' IdContPaqi = ObjContPaqi.DtResultados.Rows(0)("IdContPaqiPersona").ToString.ToEntero - ' CodigoPersona = ObjContPaqi.DtResultados.Rows(0)("Codigo").ToString.ToEntero - ' errorContPaq = False - ' Else - ' errorContPaq = True - ' End If - ' End If - ' End If - - - ' If Not errorContPaq Then - ' Dim IdContPaqiCliente As Integer - - ' If ObjContPaqi.GetCliente(-1, CodigoPersona) Then - - ' If ObjContPaqi.DtResultados.Rows.Count > 0 Then - - ' IdContPaqiCliente = ObjContPaqi.DtResultados.Rows(0)("IdContPaqiClient").ToString.ToEntero - - ' If ObjContPaqi.UpdateCliente(IdContPaqiCliente, CodigoPersona, CodigoPersona, "", "") Then - ' errorContPaq = False - ' Else - ' errorContPaq = True - ' End If - ' Else - ' If ObjContPaqi.AddCliente(CodigoPersona, CodigoPersona, "", "") Then - ' errorContPaq = False - ' Else - ' errorContPaq = True - ' End If - ' End If - ' Else - ' errorContPaq = True - ' End If - ' End If - - - ' If Not errorContPaq Then - ' ObjContPaqi.Commit() - ' ObjContPaqi.Dispose() - ' Else - ' ObjContPaqi.RollBack() - ' ObjContPaqi.Dispose() - ' Alert("Se presento un error al guardar en ContPAQi", TipoMensaje.MsgError) - ' Exit Sub - ' End If - - - 'End If -#End Region - - Dim LT As String = If(HDLT.Value.ToDouble <> 0, HDLT.Value, "0") - Dim LG As String = If(HDLG.Value.ToDouble <> 0, HDLG.Value, "0") - - If CveCliente = -1 Then - Dim ErrorAC As Boolean = False - Dim CtaCliente As Integer = DdlCtaContableClientes.SelectedValue.ToEntero - - ' si tiene la funcionalidad de la cuenta contable padre - If UsuarioActual.Empresa.Funcionalidad(114) <> "" Then - - Dim ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa) - - ObjContaAC.IniciaTransacSQL() - 'se registra la cuenta contable automaticamente - - CtaCliente = ObjContaAC.AddSiguienteCuentaHijo(UsuarioActual.Empresa.Funcionalidad(114).ToEntero, TxtNombreComercial.Text.Trim, "A", 2) - - If CtaCliente > 0 Then - ObjContaAC.Commit() - DdlCtaContableClientes.Items.Add(New ListItem(TxtNombreComercial.Text.Trim, CtaCliente.ToString)) - DdlCtaContableClientes.SelectedValue = CtaCliente.ToString - 'MsgCuentaContable = String.Format("
    Con la cuenta contable: {0}", NewCuenta) - - Else - - ObjContaAC.RollBack() - ObjContaAC.Dispose() - Alert("Error al guardar la cuenta contable ", TipoMensaje.MsgError) - ObjClientes.Dispose() - Exit Sub - End If - ObjContaAC.Dispose() - End If - - 'Si tiene contabilizacion automatica y la funcionalidad de carga cuenta automatica o UsaAC le agregamos automaticamente una cuenta al cliente - If UsuarioActual.Empresa.Funcionalidad(211).ToEntero > 0 AndAlso (UsuarioActual.Empresa.Funcionalidad(200).ToEntero > 0 Or UsuarioActual.Empresa.UsaAC) AndAlso DdlCtaContableClientes.SelectedValue.ToEntero < 1 Then - If Not AgregarCuentaContable(BtnActivaRegistroClientes, DdlCtaContableClientes) Then - ErrorProceso = True - End If - End If - - Dim MetodoPago = DdlMetodoPago.SelectedValue.ToEntero - If UsuarioActual.Empresa.CvePlataforma = 3 Then - MetodoPago = 1 - End If - - - - - If ObjClientes.AddCliente(TxtNombre.Text.Trim, TxtNombreComercial.Text.Trim, TxtDireccion.Text.Trim, TxtNoExt.Text.Trim, TxtNoInt.Text.Trim, TxtColonia.Text.Trim, TxtLocalidad.Text.Trim, TxtCiudad.Text.Trim, TxtEstado.Text.Trim, TxtPais.Text.Trim, TxtRFC.Text.Trim, TxtCP.Text.Trim, TxtTelefono.Text.Trim.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), - TxtContacto.Text.Trim, TxtEmail.Text.Trim, TxtEmailCotizacion.Text.Trim, TxtNotificar.Text.Trim, TxtPagina.Text.Trim, TxtGiro.Text.Trim, DdlPrecioLista.SelectedValue.ToEntero, ChkMail.Checked, TxtRetIVA.Text.ToDouble, - TxtRetISR.Text.ToDouble, ChkRetIVAFletesAcarreos.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtNombreCorto.Text.Trim, DdlVendedor.SelectedValue.ToEntero, TxtPlazoCobranza.Text.Trim.ToEntero, TxtPlazoCobranzaRemision.Text.Trim.ToEntero, - DiasPago, DdlTipoPago.SelectedValue, DdlCtaContableClientes.SelectedValue.ToEntero, DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableAnticipos.SelectedValue.ToEntero, - DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableRetIVA.SelectedValue.ToEntero, DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableRetISR.SelectedValue.ToEntero, DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableFondoGarantia.SelectedValue.ToEntero, - DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableCompClientes.SelectedValue.ToEntero, DdlCtaContableCompClientes.SelectedItem.Text, DdlCtaContableCompAnticipos.SelectedValue.ToEntero, DdlCtaContableCompAnticipos.SelectedItem.Text, - TxtConvenioCIE.Text.Trim, TxtFormaFacturacion.Text.Trim, TxtCodigo.Text.Trim, TxtLimiteCredito.Text.ToDouble, TxtNumCtaPago.Text.Trim, MetodoPago, ChkAplicaFEMSA.Checked, TxtFEMSA_NumSociedad.Text.Trim, - TxtFEMSA_NumProveedor.Text.Trim, TxtFEMA_Mail.Text.Trim, ChkAplicaDetallista.Checked, TxtDet_GLNComprador.Text.Trim, TxtDet_Departamento.Text.Trim, TxtDet_GLNVendedor.Text.Trim, TxtDet_NumProveedor.Text.Trim, TxtProveedor.Text.Trim, ChkAplicaFord.Checked, TxtFordGSDB.Text.Trim, - TxtExtension.Text.Trim, TxtTelefonoOtro.Text.Trim.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), ChkPermiteCredito.Checked, DdlSubProyecto.SelectedValue.ToEntero, DdlCorporativo.SelectedValue.ToEntero, - CveClienteClasificacion:=DdlClasificacion.SelectedValue.ToEntero, CveUsuarioResponsable:=DdlResponsable.SelectedValue.ToEntero, - CveCondicionEntrega:=DdlCondicionesEntrega.SelectedValue.ToEntero, ImprimeNombreSucursal:=ChkMuestraNombre.Checked, CveZonaHoraria:=DdlZonaHoraria.SelectedValue.ToEntero, CobranzaContacto:=TxtCobranzaContacto.Text.Trim, CobranzaTelefono:=TxtCobranzaTelefono.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), - CobranzaExt:=TxtCobranzaExt.Text, CobranzaCorreo:=TxtCobranzaCorreo.Text.Trim, Horario:=TxtHorario.Text.Trim, PortalFacturacion:=TxtPortalFacturacion.Text.Trim, Documentacion:=TxtDocumentacion.Text.Trim, DiasEspecifico:=TxtDiasEspecifico.Text.Trim, UsuarioPortal:=TxtUsuarioPortalFacturacion.Text, ContraseñaPortal:=TxtContraseñaPortalFacturacion.Text, - DiasRevision:=DiasRevision, ObservacionRevsion:=TxtObsDiasRevision.Text.Trim, ReferenciaFiscal:=TxtReferenciaFiscal.Text.Trim, Celular:=TxtCelular.Text.Trim.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), ExtOtros:=TxtExtOtro.Text.Trim, CveUsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, - CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero, DesglosaIEPS:=ChkDesglosarIEPS.Checked, AplicaComercioExterior:=ChkAplicaComercioExterior.Checked, CveTipoOperacion:=DdlTipoOperacion.SelectedValue.ToEntero, CvePedimento:=DdlClavePedimento.SelectedValue.ToEntero, CveIncoterm:=DdlIncoterm.SelectedValue.ToEntero, - CvePais:=DdlPais.SelectedValue.ToEntero, CveEstado:=DdlEstado.SelectedValue.ToEntero, CveMunicipio:=DdlMunicipio.SelectedValue.ToEntero, CveColonia:=DdlColonia.SelectedValue.ToEntero, CveMotivoTraslado:=IIf(DdlMotivoTraslado.SelectedValue = "-1", "0", DdlMotivoTraslado.SelectedValue).ToString().ToEntero, NumRegIdTrib:=IIf(TxtNumRegIdTrib.Text = "", "-1", TxtNumRegIdTrib.Text).ToString(), - ComExtEstado:=IIf(TxtComExtEstado.Text = "", "-1", TxtComExtEstado.Text).ToString(), ComExtMunicipio:=IIf(TxtComExtMunicipio.Text = "", "-1", TxtComExtMunicipio.Text).ToString(), ComExtColonia:=IIf(TxtComExtColonia.Text = "", "-1", TxtComExtColonia.Text).ToString(), RequiereOC:=ChkRequiereOC.Checked, LT:=LT, LG:=LG, EsDistribuidor:=ChkEsDistribuidor.Checked, - TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, CargoUsado:=ChkCargoUsado.Checked, BonificacionUsado:=ChkBonificacionUsado.Checked, CveTipoRetencion:=DdlTipoRetencion.SelectedValue.ToEntero()) Then - - ViewState("CveCliente") = ObjClientes.CveCliente - - - 'For Each gvr As GridViewRow In GvDocsVentas.Rows - ' If gvr.FCCheckBox("ChkDoc").Checked Then - - ' objDoc.DocumentacionElectronicaAdd(gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, Now, Observacion2:=gvr.FCTextBox("TxtObs2").Text, FechaVigencia:=gvr.FCTextBox("TxtFechaVigencia").Text.ToDate) - - ' End If - - 'Next - GuardarDocumentosClientes() - - If Not AsignaCuentasAutomaticas(ObjClientes) Then - ErrorProceso = True - End If - - For Each GVR As GridViewRow In GvImpuestosLocales.Rows - If GVR.FCCheckBox("ChkDeduccion").Checked Then - ObjClientes.AddClienteImpuestosLocales(CveCliente, GVR.DataKey("CveImpuestoLocal").ToEntero) - End If - Next - - For Each Row As DataRow In TempDTSucursales.Rows - If Not CveCliente > 0 Then - If ObjClientes.AddSucursal(ObjClientes.CveCliente, Row("SucursalCliente").ToString, UsuarioActual.CveUsuario, Row("CiudadSucursal").ToString, Row("ColoniaSucursal").ToString, Row("CPSucursal").ToString, Row("DireccionSucursal").ToString, Row("EstadoSucursal").ToString, Row("LocalidadSucursal").ToString, - Row("PaisSucursal").ToString, Row("NumExtSucursal").ToString, Row("NumIntSucursal").ToString, Row("TelefonoSucursal").ToString, Row("CorreoSucursal").ToString, Row("CorreoCotiziacionSucursal").ToString, Row("ContactoSucursal").ToString, - Row("CveVendedorSucursal").ToString.ToEntero, Row("NumCuenta").ToString, Row("CveMetodoPago").ToString.ToEntero, Row("LimiteCredito").ToString.ToDecimal, Row("CveResponsableCobranza").ToString.ToEntero, - Row("CveUsoCFDI").ToString.ToEntero, Row("CveFormaPago33").ToString.ToEntero, Row("CveMetodoPago33").ToString.ToEntero, LT:=Row("LT").ToString, LG:=Row("LG").ToString) Then - End If - End If - Next - - If UsuarioActual.Empresa.CvePlataforma = 3 AndAlso Not ErrorProceso Then - Dim GPS As New ClsGPS - GPS.IniciaTransacSQL() - For Each GvRow As GridViewRow In GvDatos.Rows - If Not GPS.DispositivosClienteUpdate(GvRow.DataKey("CveDispositivo").ToString.ToEntero, ObjClientes.CveCliente) Then - ErrorProceso = True - End If - Next - If ErrorProceso Then - GPS.RollBack() - Else - GPS.Commit() - End If - End If - - - If ErrorProceso Then - ObjClientes.RollBack() - Else + Private Sub CargaBancos(Optional SelectTop As Integer = 51, Optional CveClienteSucursal As Integer = -1) + Dim ObjMovtos As New ClsMovimientos() + 'CxC Activas + If ObjMovtos.GetClienteAbonos(CveCliente, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero, SelectTop:=SelectTop) AndAlso ObjMovtos.DtResultados.Rows.Count > 0 Then + GvBancos.DataSource = ObjMovtos.DtResultados + DTCobrosRealizados = ObjMovtos.DtResultados + DTCobrosRealizados.Rows.Remove(DTCobrosRealizados.Rows(0)) + Else + DTCobrosRealizados = Nothing + End If + ObjMovtos.Dispose() + GvBancos.DataBind() + End Sub + + Protected Sub GvBancos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvBancos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + 'Dim HLSendMail As HtmlAnchor = DirectCast(e.Row.FindControl("HLSendMail"), HtmlAnchor) + + If e.Row.DBCampo("CveVenta") = "" Then + If e.Row.DBCampo("CveIE") <> "" Then + Dim ObjBancos As New ClsBancos + + e.Row.Cells(0).Text = String.Format("{0} - {1}", e.Row.DBCampo("Banco"), e.Row.DBCampo("NumCuenta")) + e.Row.FCLiteral("LtlFechaVenci").Text = e.Row.DBCampo("FechaDocumento").ToDate.ToShortDateString + e.Row.FCHyperLink("HplCheque").Visible = True + e.Row.FCLiteral("LtlImp").Text = e.Row.DBCampo("ImporteIE").FormatoNumero + e.Row.FCLiteral("LtlMon").Text = e.Row.DBCampo("MonedaIE") + + + 'HLSendMail.HRef = String.Format("javascript:$get('HdnCveIE').value='{0}';$get('HdnSerieFolio').value='{1}';$get('HdnFolioPago').value='{2}';$get('TxtParaMail').value='{3}';$('#ModalDivMail').modal();", e.Row.DBCampo("CveIE"), e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("FolioCobro"), TxtCobranzaCorreo.Text) + + If ObjBancos.GetComplementoPagos(-1, e.Row.DBCampo("CveIE").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) Then + If ObjBancos.DtResultados.Rows.Count > 0 Then + e.Row.FCHyperLink("HplXML").Visible = True : e.Row.FCHyperLink("HplXML").NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CompP&EXT=xml&CveComplementoPago={0}&SerieFolio={1}&CveIE={2}", ObjBancos.DtResultados(0)("CveComplementoPago").ToString, ObjBancos.DtResultados(0)("SerieFolio").ToString, ObjBancos.DtResultados(0)("CveIE").ToString))) + e.Row.FCHyperLink("HplPDF").Visible = True : e.Row.FCHyperLink("HplPDF").NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=CompP&EXT=pdf&CveComplementoPago={0}&SerieFolio={1}&CveIE={2}", ObjBancos.DtResultados(0)("CveComplementoPago").ToString, ObjBancos.DtResultados(0)("SerieFolio").ToString, ObjBancos.DtResultados(0)("CveIE").ToString))) + + e.Row.FCLinkButton("LnkSendMail").Visible = True + End If + End If + + ObjBancos.Dispose() + End If + e.Row.BackColor = Drawing.Color.LightGray + End If + + If e.Row.DBCampo("CveVenta") = "" And e.Row.DBCampo("Banco") = "" Then + e.Row.Visible = False + End If + End If + End Sub + + Protected Sub LnkSendMail_Click(sender As Object, e As EventArgs) + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + HdnSerieFolioPago.Value = gvRow.DataKey("SerieFolioCP").ToString + TxtParaMail.Text = TxtCobranzaCorreo.Text + UpSendMail.Update() + RegistraScript("$('#ModalDivMail').modal('show');") + End Sub +#End Region + +#Region "B T N ´ S" + Protected Sub BtnEliminar_Click(sender As Object, e As System.EventArgs) Handles BtnEliminar.Click + Dim ObjClientes As New ClsClientes() + If ObjClientes.RemoveCliente(CveCliente) Then + Alert("El Cliente se Eliminó correctamente.", TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/CatClientes.aspx""") + End If + ObjClientes.Dispose() + End Sub + Protected Sub BtnSendMail_Click(sender As Object, e As System.EventArgs) Handles BtnSendMail.Click + Try + + If HdnCveVenta.Value <> "-1" AndAlso HdnFolioVenta.Value <> "-1" Then + + Dim ObjMail As New ClsSisMail() + Dim Ruta As String = UsuarioActual.Empresa.Ruta + + Dim Cuerpo As String = TxtBody.Text + Dim Asunto As String = "" + Dim TipoComprobante = "" + + If HdnTipoDocto.Value.ToString = "Ing" Then TipoComprobante = "Factura" + If HdnTipoDocto.Value.ToString = "Egs" Then TipoComprobante = "Nota de Crédito" + If HdnTipoDocto.Value.ToString = "Dev" Then TipoComprobante = "Nota de Devolución" + If HdnTipoDocto.Value.ToString = "Rem" Then TipoComprobante = "Remisión" + If HdnTipoDocto.Value.ToString = "Cot" Then TipoComprobante = "Cotización" + If HdnTipoDocto.Value.ToString = "Ant" Then TipoComprobante = "Anticipo" + + Dim DisplayName As String = "" + If UsuarioActual.CveEmpresa = 119 Then DisplayName = "Facturación Agroquímicos JAM" + + Dim ObjVenta As New ClsVentas + Dim Dr As DataRow = Nothing + If ObjVenta.GetVenta(HdnCveVenta.Value.ToEntero, UsuarioActual.CveEmpresa) Then + If ObjVenta.DtResultados.Rows.Count > 0 Then + Dr = ObjVenta.DtResultados.Rows(0) + End If + End If + ObjVenta.Dispose() + + If UsuarioActual.Empresa.PlantillaMailVenta.Trim.Length > 0 Then + Cuerpo = UsuarioActual.Empresa.PlantillaMailVenta + Cuerpo = Cuerpo.Replace("{""NombreEmpresa""}", UsuarioActual.Empresa.Empresa) + Cuerpo = Cuerpo.Replace("{""NombreCliente""}", LtlCliente.Text.Trim) + Cuerpo = Cuerpo.Replace("{""TipoDocumento""}", TipoComprobante) + Cuerpo = Cuerpo.Replace("{""SerieFolio""}", HdnSerieFolio.Value.ToString) + If Dr IsNot Nothing Then + Cuerpo = Cuerpo.Replace("{""Fecha""}", Dr("Fecha").ToString.ToDate.ToShortDateString) + Cuerpo = Cuerpo.Replace("{""Total""}", Dr("Total").ToString.FormatoNumero) + Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString.ToDate.ToShortDateString) + End If + End If + + + If UsuarioActual.Empresa.AsuntoPlantillaMailVenta.Trim.Length > 0 Then + Asunto = UsuarioActual.Empresa.AsuntoPlantillaMailVenta + Asunto = Asunto.Replace("{""TipoDocumento""}", TipoComprobante) + Asunto = Asunto.Replace("{""Sucursal""}", HdnSubProyecto.Value.ToString) + Asunto = Asunto.Replace("{""SerieFolio""}", HdnSerieFolio.Value.ToString) + End If + + If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso HdnTipoDocto.Value.Contiene("Ing", "Egs", "Ant", "Dev") Then + If File.Exists($"{Ruta}PDF\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.pdf") AndAlso File.Exists($"{Ruta}XML\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.xml") Then + Dim PDF As String = $"{Ruta}PDF\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.pdf" + Dim XML As String = $"{Ruta}XML\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.xml" + + Dim ResultadoMail As Integer = 0 + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = XML}) + + 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then + If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, Asunto, Cuerpo, TxtCC.Text.Trim, LSRutasMail, Displayname:=DisplayName) Then + ResultadoMail = 1 + TxtCC.Text = "" + TxtBody.Text = "" + RegistraScript("$('#ModalDivMail').modal('hide');") + Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + CargaHistorial() + 'UpnHistorial.Update() + Else + ResultadoMail = 3 + Alert("No se pudo enviar el correo electrónico.", TipoMensaje.MsgError) + End If + + Dim ObjVentas As New ClsVentas + ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta.Value.ToEntero) + ObjVentas.Dispose() + Else + Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) + End If + ElseIf UsuarioActual.Empresa.TipoFacturacion = "CBB" AndAlso HdnTipoDocto.Value.Contiene("Ing", "Egs", "Ant", "Dev") Then + If File.Exists(Ruta & "PDF\" & HdnFolioVenta.Value & ".pdf") Then + Dim PDF As String = Ruta & "PDF\" & HdnFolioVenta.Value & ".pdf" + + Dim ResultadoMail As Integer = 0 + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) + + + 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then + If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, Asunto, Cuerpo, TxtCC.Text.Trim, LSRutasMail) Then + ResultadoMail = 1 + TxtCC.Text = "" + TxtBody.Text = "" + RegistraScript("$('#ModalDivMail').modal('hide');") + Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + CargaHistorial() + UpnHistorial.Update() + Else + ResultadoMail = 3 + End If + + Dim ObjVentas As New ClsVentas + ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta.Value.ToEntero) + ObjVentas.Dispose() + Else + Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) + End If + ElseIf HdnTipoDocto.Value = "Cot" Then + If File.Exists($"{Ruta}PDF\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.pdf") Then + Dim PDF As String = $"{Ruta}PDF\{HdnTipoDocto.Value}\{HdnFolioVenta.Value}.pdf" + + Dim ResultadoMail As Integer = 0 + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) + + 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then + If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, Asunto, Cuerpo, TxtCC.Text.Trim, LSRutasMail) Then + ResultadoMail = 1 + TxtCC.Text = "" + TxtBody.Text = "" + RegistraScript("$('#ModalDivMail').modal('hide');") + Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + CargaHistorial() + UpnHistorial.Update() + Else + ResultadoMail = 3 + End If + + Dim ObjVentas As New ClsVentas + ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta.Value.ToEntero) + ObjVentas.Dispose() + Else + Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) + End If + End If + + 'End If + 'ObjEmprea.Dispose() + ElseIf HdnSerieFolioPago.Value <> "-1" Then + + Dim ObjMail As New ClsSisMail() + Dim RutaXML As String = String.Format("{0}XML\Pag\{1}.xml", UsuarioActual.Empresa.Ruta, HdnSerieFolioPago.Value) + Dim RutaPDF As String = String.Format("{0}PDF\Pag\{1}.pdf", UsuarioActual.Empresa.Ruta, HdnSerieFolioPago.Value) + + Dim Cuerpo As String = "Se hace entrega del comprobante de pago" + Dim Asunto As String = "Entrega de comprobante de pago" + + If IO.File.Exists(RutaPDF) AndAlso IO.File.Exists(RutaXML) Then + + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaPDF}) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = RutaXML}) + + If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, Asunto, Cuerpo, TxtCC.Text.Trim, LSRutasMail) Then + TxtCC.Text = "" + RegistraScript("$('#ModalDivMail').modal('hide');") + Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + End If + Else + Alert("No se encontraron los archivos para enviar.", TipoMensaje.MsgAdvertencia) + End If + Else + Alert("No se seleccionó ninguna factura para envíar.", TipoMensaje.MsgAdvertencia) + End If + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL", ex) + Dim ObjVentas As New ClsVentas + ObjVentas.UpdateVentaMail(3, HdnCveVenta.Value.ToEntero) + ObjVentas.Dispose() + End Try + End Sub + Protected Sub BtnAbonar_Click(sender As Object, e As System.EventArgs) Handles BtnAbonar.Click + Dim ObjMovtos As New ClsMovimientos() + + + If ObjMovtos.AddMovimiento(2, "Cli", CveCliente.ToString, HdnCveVentaAbono.Value, 1, 0, TxtCantidad.Text.Trim.ToDouble, Now, TxtFechaPago.Text.ToDate, TxtReferencia.Text.Trim, DdlCtaContableClientes.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + Alert("El abono se guardó correctamente", TipoMensaje.MsgInformacion, "$get(""DivAddPago"").style.display=""none"";") + CargaCxC() + TxtCantidad.Text = "" + TxtReferencia.Text = "" + + 'UpAbono.Update() + UPPUsuarios.Update() + End If + ObjMovtos.Dispose() + AbonaaCuenta() + End Sub + + Private Function AsignaCuentasAutomaticas(ObjClientes As ClsClientes) As Boolean + Dim IdCtaContableClientes As Integer = UsuarioActual.Empresa.Funcionalidad(246).ToEntero + Dim IdCtaContableAnticipos As Integer = UsuarioActual.Empresa.Funcionalidad(319).ToEntero + Dim IdCtaContableComplementaria As Integer = UsuarioActual.Empresa.Funcionalidad(320).ToEntero + Dim IdCtaContMonedaExtranjera As Integer = UsuarioActual.Empresa.Funcionalidad(331).ToEntero + Dim IdCtaContMonedaExtranjeraAnticipos As Integer = UsuarioActual.Empresa.Funcionalidad(332).ToEntero + Dim IdCtaContCompAnticipos As Integer = UsuarioActual.Empresa.Funcionalidad(333).ToEntero + + If Not ObjClientes.VincularCuentasContables(IdCtaContableClientes, IdCtaContableAnticipos, 0, 0, CveCliente, IdCtaContableComplementaria, IdCtaContMonedaExtranjera, IdCtaContMonedaExtranjeraAnticipos, IdCtaContCompAnticipos) Then + Return False + End If + Return True + End Function + + Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click + If UsuarioActual.CveUsuario = 1465 And TxtCodigo.Text.Trim = "" Then + Alert("El cliente no se puede registrar sin ingresar un Código.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If ChkAplicaComercioExterior.Checked Then + If Not DdlTipoOperacion.SelectedValue.ToEntero > 0 Then + Alert("Tiene que seleccionar un tipo de operacion para comercio exterior.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If Not DdlClavePedimento.SelectedValue.ToEntero > 0 Then + Alert("Tiene que seleccionar una clave de pedimento para comercio exterior.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If Not DdlIncoterm.SelectedValue.ToEntero > 0 Then + Alert("Tiene que seleccionar un incoterm para comercio exterior.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If Not DdlPais.SelectedValue.ToEntero > 0 Then + Alert("Tiene que seleccionar un pais para comercio exterior.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If Not DdlPais.SelectedValue.ToEntero > 0 Then + Alert("Tiene que seleccionar un pais para comercio exterior.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If (Not DdlEstado.SelectedValue.ToEntero > 0 And DdlEstado.Visible) Or (Not DdlEstado.Visible And TxtComExtEstado.Text = "") Then + Alert("Tiene que seleccionar un estado para comercio exterior.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If DdlPais.SelectedValue.ToEntero = 151 Then + If Not DdlMunicipio.SelectedValue.ToEntero > 0 Then + Alert("Tiene que seleccionar un municipio para comercio exterior si el pais es mexico.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + If Not DdlColonia.SelectedValue.ToEntero > 0 Then + Alert("Tiene que seleccionar una colonia para comercio exterior si el pais es mexico.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + End If + + End If + + 'CargaSucursal() + 'If UsuarioActual.TienePermisoProceso(170) AndAlso TxtCodigo.Text.Trim = "" Then + ' Alert("Es necesario ingresar un Código", TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If + + 'Dim rowcodigo As DataTable = GlobalDTCliente.FiltraParametros(String.Format("Codigo='{0}' AND CveEmpresa={1} ", TxtCodigo.Text.Trim, UsuarioActual.CveEmpresa)) + 'If (Not IsNothing(rowcodigo)) AndAlso (rowcodigo.Rows.Count > 0) AndAlso (rowcodigo.Rows(0)("CveCliente").ToString.ToEntero <> CveCliente) Then + ' Alert(String.Format("ya existe un Cliente Con este Codigo '{0}'", TxtCodigo.Text.Trim), TipoMensaje.MsgAdvertencia) + ' Exit Sub + 'End If + Dim ObjClientes As New ClsClientes() + Dim objDoc As New ClsEdocumentacion(ObjClientes.IniciaTransacSQL()) + Dim MsgCuentaContable As String = "" + Dim ErrorProceso As Boolean = False + + 'Dias de pago + Dim SBDiasPago As New StringBuilder() + Dim DiasPago As String = "" + If ChkLunes.Checked Then SBDiasPago.AppendFormat("1-") Else SBDiasPago.AppendFormat("0-") + If ChkMartes.Checked Then SBDiasPago.AppendFormat("1-") Else SBDiasPago.AppendFormat("0-") + If ChkMiercoles.Checked Then SBDiasPago.AppendFormat("1-") Else SBDiasPago.AppendFormat("0-") + If ChkJueves.Checked Then SBDiasPago.AppendFormat("1-") Else SBDiasPago.AppendFormat("0-") + If ChkViernes.Checked Then SBDiasPago.AppendFormat("1-") Else SBDiasPago.AppendFormat("0-") + If ChkSabado.Checked Then SBDiasPago.AppendFormat("1") Else SBDiasPago.AppendFormat("0") + DiasPago = SBDiasPago.ToString + + 'Dias de Revision + Dim SBDiasRevision As New StringBuilder() + Dim DiasRevision As String = "" + If ChkRevLunes.Checked Then SBDiasRevision.AppendFormat("1-") Else SBDiasRevision.AppendFormat("0-") + If ChkRevMartes.Checked Then SBDiasRevision.AppendFormat("1-") Else SBDiasRevision.AppendFormat("0-") + If ChkRevMiercoles.Checked Then SBDiasRevision.AppendFormat("1-") Else SBDiasRevision.AppendFormat("0-") + If ChkRevJueves.Checked Then SBDiasRevision.AppendFormat("1-") Else SBDiasRevision.AppendFormat("0-") + If ChkRevViernes.Checked Then SBDiasRevision.AppendFormat("1-") Else SBDiasRevision.AppendFormat("0-") + If ChkRevSabado.Checked Then SBDiasRevision.AppendFormat("1") Else SBDiasRevision.AppendFormat("0") + DiasRevision = SBDiasRevision.ToString + + + Dim errorContPaq As Boolean = False + Dim IdContPaqi As Integer = 0 + Dim CodigoPersona As Integer = 0 + + +#Region "comentado" + 'If UsuarioActual.Empresa.Funcionalidad(522).ToString = "1" Then + + ' Dim ObjContPaqi As New ClsContPAQi(UsuarioActual.Empresa) + + ' If ObjContPaqi.GetPersona(TxtRFC.Text) Then + + ' If ObjContPaqi.DtResultados.Rows.Count > 0 Then + + ' IdContPaqi = ObjContPaqi.DtResultados.Rows(0)("Id").ToString.ToEntero + ' CodigoPersona = ObjContPaqi.DtResultados.Rows(0)("Codigo").ToString.ToEntero + + ' Dim Cont_EsProveedor As Integer = If(Boolean.Parse(ObjContPaqi.DtResultados.Rows(0)("EsProveedor").ToString), 1, 0) + ' Dim Cont_Nombre As String = ObjContPaqi.DtResultados(0)("Nombre").ToString + ' Dim Cont_RFC As String = ObjContPaqi.DtResultados(0)("RFC").ToString + + ' If ObjContPaqi.UpdatePersona(IdContPaqi, Cont_Nombre, Cont_RFC, 1, Cont_EsProveedor) Then + ' errorContPaq = False + ' Else + ' errorContPaq = True + ' End If + + ' Else + ' If ObjContPaqi.AddPersona(TxtNombre.Text.Trim, TxtRFC.Text.Trim, 1, 0) Then + + ' IdContPaqi = ObjContPaqi.DtResultados.Rows(0)("IdContPaqiPersona").ToString.ToEntero + ' CodigoPersona = ObjContPaqi.DtResultados.Rows(0)("Codigo").ToString.ToEntero + ' errorContPaq = False + ' Else + ' errorContPaq = True + ' End If + ' End If + ' End If + + + ' If Not errorContPaq Then + ' Dim IdContPaqiCliente As Integer + + ' If ObjContPaqi.GetCliente(-1, CodigoPersona) Then + + ' If ObjContPaqi.DtResultados.Rows.Count > 0 Then + + ' IdContPaqiCliente = ObjContPaqi.DtResultados.Rows(0)("IdContPaqiClient").ToString.ToEntero + + ' If ObjContPaqi.UpdateCliente(IdContPaqiCliente, CodigoPersona, CodigoPersona, "", "") Then + ' errorContPaq = False + ' Else + ' errorContPaq = True + ' End If + ' Else + ' If ObjContPaqi.AddCliente(CodigoPersona, CodigoPersona, "", "") Then + ' errorContPaq = False + ' Else + ' errorContPaq = True + ' End If + ' End If + ' Else + ' errorContPaq = True + ' End If + ' End If + + + ' If Not errorContPaq Then + ' ObjContPaqi.Commit() + ' ObjContPaqi.Dispose() + ' Else + ' ObjContPaqi.RollBack() + ' ObjContPaqi.Dispose() + ' Alert("Se presento un error al guardar en ContPAQi", TipoMensaje.MsgError) + ' Exit Sub + ' End If + + + 'End If +#End Region + + Dim LT As String = If(HDLT.Value.ToDouble <> 0, HDLT.Value, "0") + Dim LG As String = If(HDLG.Value.ToDouble <> 0, HDLG.Value, "0") + + If CveCliente = -1 Then + Dim ErrorAC As Boolean = False + Dim CtaCliente As Integer = DdlCtaContableClientes.SelectedValue.ToEntero + + ' si tiene la funcionalidad de la cuenta contable padre + If UsuarioActual.Empresa.Funcionalidad(114) <> "" Then + + Dim ObjContaAC = New ClsContPAQi(UsuarioActual.Empresa) + + ObjContaAC.IniciaTransacSQL() + 'se registra la cuenta contable automaticamente + + CtaCliente = ObjContaAC.AddSiguienteCuentaHijo(UsuarioActual.Empresa.Funcionalidad(114).ToEntero, TxtNombreComercial.Text.Trim, "A", 2) + + If CtaCliente > 0 Then + ObjContaAC.Commit() + DdlCtaContableClientes.Items.Add(New ListItem(TxtNombreComercial.Text.Trim, CtaCliente.ToString)) + DdlCtaContableClientes.SelectedValue = CtaCliente.ToString + 'MsgCuentaContable = String.Format("
    Con la cuenta contable: {0}", NewCuenta) + + Else + + ObjContaAC.RollBack() + ObjContaAC.Dispose() + Alert("Error al guardar la cuenta contable ", TipoMensaje.MsgError) + ObjClientes.Dispose() + Exit Sub + End If + ObjContaAC.Dispose() + End If + + 'Si tiene contabilizacion automatica y la funcionalidad de carga cuenta automatica o UsaAC le agregamos automaticamente una cuenta al cliente + If UsuarioActual.Empresa.Funcionalidad(211).ToEntero > 0 AndAlso (UsuarioActual.Empresa.Funcionalidad(200).ToEntero > 0 Or UsuarioActual.Empresa.UsaAC) AndAlso DdlCtaContableClientes.SelectedValue.ToEntero < 1 Then + If Not AgregarCuentaContable(BtnActivaRegistroClientes, DdlCtaContableClientes) Then + ErrorProceso = True + End If + End If + + Dim MetodoPago = DdlMetodoPago.SelectedValue.ToEntero + If UsuarioActual.Empresa.CvePlataforma = 3 Then + MetodoPago = 1 + End If + + + + + If ObjClientes.AddCliente(TxtNombre.Text.Trim, TxtNombreComercial.Text.Trim, TxtDireccion.Text.Trim, TxtNoExt.Text.Trim, TxtNoInt.Text.Trim, TxtColonia.Text.Trim, TxtLocalidad.Text.Trim, TxtCiudad.Text.Trim, TxtEstado.Text.Trim, TxtPais.Text.Trim, TxtRFC.Text.Trim, TxtCP.Text.Trim, TxtTelefono.Text.Trim.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), + TxtContacto.Text.Trim, TxtEmail.Text.Trim, TxtEmailCotizacion.Text.Trim, TxtNotificar.Text.Trim, TxtPagina.Text.Trim, TxtGiro.Text.Trim, DdlPrecioLista.SelectedValue.ToEntero, ChkMail.Checked, TxtRetIVA.Text.ToDouble, + TxtRetISR.Text.ToDouble, ChkRetIVAFletesAcarreos.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtNombreCorto.Text.Trim, DdlVendedor.SelectedValue.ToEntero, TxtPlazoCobranza.Text.Trim.ToEntero, TxtPlazoCobranzaRemision.Text.Trim.ToEntero, + DiasPago, DdlTipoPago.SelectedValue, DdlCtaContableClientes.SelectedValue.ToEntero, DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableAnticipos.SelectedValue.ToEntero, + DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableRetIVA.SelectedValue.ToEntero, DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableRetISR.SelectedValue.ToEntero, DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableFondoGarantia.SelectedValue.ToEntero, + DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableCompClientes.SelectedValue.ToEntero, DdlCtaContableCompClientes.SelectedItem.Text, DdlCtaContableCompAnticipos.SelectedValue.ToEntero, DdlCtaContableCompAnticipos.SelectedItem.Text, + TxtConvenioCIE.Text.Trim, TxtFormaFacturacion.Text.Trim, TxtCodigo.Text.Trim, TxtLimiteCredito.Text.ToDouble, TxtNumCtaPago.Text.Trim, MetodoPago, ChkAplicaFEMSA.Checked, TxtFEMSA_NumSociedad.Text.Trim, + TxtFEMSA_NumProveedor.Text.Trim, TxtFEMA_Mail.Text.Trim, ChkAplicaDetallista.Checked, TxtDet_GLNComprador.Text.Trim, TxtDet_Departamento.Text.Trim, TxtDet_GLNVendedor.Text.Trim, TxtDet_NumProveedor.Text.Trim, TxtProveedor.Text.Trim, ChkAplicaFord.Checked, TxtFordGSDB.Text.Trim, + TxtExtension.Text.Trim, TxtTelefonoOtro.Text.Trim.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), ChkPermiteCredito.Checked, DdlSubProyecto.SelectedValue.ToEntero, DdlCorporativo.SelectedValue.ToEntero, + CveClienteClasificacion:=DdlClasificacion.SelectedValue.ToEntero, CveUsuarioResponsable:=DdlResponsable.SelectedValue.ToEntero, + CveCondicionEntrega:=DdlCondicionesEntrega.SelectedValue.ToEntero, ImprimeNombreSucursal:=ChkMuestraNombre.Checked, CveZonaHoraria:=DdlZonaHoraria.SelectedValue.ToEntero, CobranzaContacto:=TxtCobranzaContacto.Text.Trim, CobranzaTelefono:=TxtCobranzaTelefono.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), + CobranzaExt:=TxtCobranzaExt.Text, CobranzaCorreo:=TxtCobranzaCorreo.Text.Trim, Horario:=TxtHorario.Text.Trim, PortalFacturacion:=TxtPortalFacturacion.Text.Trim, Documentacion:=TxtDocumentacion.Text.Trim, DiasEspecifico:=TxtDiasEspecifico.Text.Trim, UsuarioPortal:=TxtUsuarioPortalFacturacion.Text, ContraseñaPortal:=TxtContraseñaPortalFacturacion.Text, + DiasRevision:=DiasRevision, ObservacionRevsion:=TxtObsDiasRevision.Text.Trim, ReferenciaFiscal:=TxtReferenciaFiscal.Text.Trim, Celular:=TxtCelular.Text.Trim.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), ExtOtros:=TxtExtOtro.Text.Trim, CveUsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, + CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero, DesglosaIEPS:=ChkDesglosarIEPS.Checked, AplicaComercioExterior:=ChkAplicaComercioExterior.Checked, CveTipoOperacion:=DdlTipoOperacion.SelectedValue.ToEntero, CvePedimento:=DdlClavePedimento.SelectedValue.ToEntero, CveIncoterm:=DdlIncoterm.SelectedValue.ToEntero, + CvePais:=DdlPais.SelectedValue.ToEntero, CveEstado:=DdlEstado.SelectedValue.ToEntero, CveMunicipio:=DdlMunicipio.SelectedValue.ToEntero, CveColonia:=DdlColonia.SelectedValue.ToEntero, CveMotivoTraslado:=IIf(DdlMotivoTraslado.SelectedValue = "-1", "0", DdlMotivoTraslado.SelectedValue).ToString().ToEntero, NumRegIdTrib:=IIf(TxtNumRegIdTrib.Text = "", "-1", TxtNumRegIdTrib.Text).ToString(), + ComExtEstado:=IIf(TxtComExtEstado.Text = "", "-1", TxtComExtEstado.Text).ToString(), ComExtMunicipio:=IIf(TxtComExtMunicipio.Text = "", "-1", TxtComExtMunicipio.Text).ToString(), ComExtColonia:=IIf(TxtComExtColonia.Text = "", "-1", TxtComExtColonia.Text).ToString(), RequiereOC:=ChkRequiereOC.Checked, LT:=LT, LG:=LG, EsDistribuidor:=ChkEsDistribuidor.Checked, + TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, CargoUsado:=ChkCargoUsado.Checked, BonificacionUsado:=ChkBonificacionUsado.Checked, CveTipoRetencion:=DdlTipoRetencion.SelectedValue.ToEntero()) Then + + ViewState("CveCliente") = ObjClientes.CveCliente + + + 'For Each gvr As GridViewRow In GvDocsVentas.Rows + ' If gvr.FCCheckBox("ChkDoc").Checked Then + + ' objDoc.DocumentacionElectronicaAdd(gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, Now, Observacion2:=gvr.FCTextBox("TxtObs2").Text, FechaVigencia:=gvr.FCTextBox("TxtFechaVigencia").Text.ToDate) + + ' End If + + 'Next + GuardarDocumentosClientes() + + If Not AsignaCuentasAutomaticas(ObjClientes) Then + ErrorProceso = True + End If + + For Each GVR As GridViewRow In GvImpuestosLocales.Rows + If GVR.FCCheckBox("ChkDeduccion").Checked Then + ObjClientes.AddClienteImpuestosLocales(CveCliente, GVR.DataKey("CveImpuestoLocal").ToEntero) + End If + Next + + For Each Row As DataRow In TempDTSucursales.Rows + If Not CveCliente > 0 Then + If ObjClientes.AddSucursal(ObjClientes.CveCliente, Row("SucursalCliente").ToString, UsuarioActual.CveUsuario, Row("CiudadSucursal").ToString, Row("ColoniaSucursal").ToString, Row("CPSucursal").ToString, Row("DireccionSucursal").ToString, Row("EstadoSucursal").ToString, Row("LocalidadSucursal").ToString, + Row("PaisSucursal").ToString, Row("NumExtSucursal").ToString, Row("NumIntSucursal").ToString, Row("TelefonoSucursal").ToString, Row("CorreoSucursal").ToString, Row("CorreoCotiziacionSucursal").ToString, Row("ContactoSucursal").ToString, + Row("CveVendedorSucursal").ToString.ToEntero, Row("NumCuenta").ToString, Row("CveMetodoPago").ToString.ToEntero, Row("LimiteCredito").ToString.ToDecimal, Row("CveResponsableCobranza").ToString.ToEntero, + Row("CveUsoCFDI").ToString.ToEntero, Row("CveFormaPago33").ToString.ToEntero, Row("CveMetodoPago33").ToString.ToEntero, LT:=Row("LT").ToString, LG:=Row("LG").ToString) Then + End If + End If + Next + + If UsuarioActual.Empresa.CvePlataforma = 3 AndAlso Not ErrorProceso Then + Dim GPS As New ClsGPS + GPS.IniciaTransacSQL() + For Each GvRow As GridViewRow In GvDatos.Rows + If Not GPS.DispositivosClienteUpdate(GvRow.DataKey("CveDispositivo").ToString.ToEntero, ObjClientes.CveCliente) Then + ErrorProceso = True + End If + Next + If ErrorProceso Then + GPS.RollBack() + Else + GPS.Commit() + End If + End If + + + If ErrorProceso Then + ObjClientes.RollBack() + Else ObjClientes.Commit() 'JM 05-02-19: CRM ASIGAN CLIENTE A EMPRESACRM - Dim MensajeCRM As String = "" - If CveEmpresaCRM > 0 Then - If VincularEmpresaCRM() Then - MensajeCRM = "

    Se vinculo el cliente a la Empresa CRM" - Else - MensajeCRM = "

    Ocurrio un error al vincular la Empresa CRM, intente unificar el Cliente." - End If - End If - - Alert("El Cliente se guardó correctamente." & MsgCuentaContable & MensajeCRM, TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/CatClientes.aspx""") - End If - End If - Else - - Dim NombreCliente As String = "" - - If TxtRFC.Text.Length = 13 AndAlso TxtApellidoPaterno.Text <> "" AndAlso TxtApellidoMaterno.Text <> "" AndAlso TxtNombres.Text <> "" Then - NombreCliente = ($"{TxtNombres.Text} {TxtApellidoPaterno.Text} {TxtApellidoMaterno.Text}").Trim() - Else - NombreCliente = TxtNombre.Text.Trim() - End If - - If ObjClientes.UpdateCliente(NombreCliente, TxtNombreComercial.Text.Trim, TxtDireccion.Text.Trim, TxtNoExt.Text.Trim, TxtNoInt.Text.Trim, TxtColonia.Text.Trim, TxtLocalidad.Text.Trim, TxtCiudad.Text.Trim, TxtEstado.Text.Trim, TxtPais.Text.Trim, TxtRFC.Text.Trim, TxtCP.Text.Trim, - TxtTelefono.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), TxtContacto.Text.Trim, TxtEmail.Text.Trim, TxtEmailCotizacion.Text.Trim, TxtNotificar.Text.Trim, TxtPagina.Text, TxtGiro.Text, DdlPrecioLista.SelectedValue.ToEntero, ChkMail.Checked, TxtRetIVA.Text.ToDouble, TxtRetISR.Text.ToDouble, ChkRetIVAFletesAcarreos.Checked, - ChkEstado.Checked, TxtNombreCorto.Text.Trim, DdlVendedor.SelectedValue.ToEntero, TxtPlazoCobranza.Text.Trim.ToEntero, TxtPlazoCobranzaRemision.Text.Trim.ToEntero, DiasPago, DdlTipoPago.SelectedValue, - DdlCtaContableClientes.SelectedValue.ToEntero, DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableAnticipos.SelectedValue.ToEntero, DdlCtaContableAnticipos.SelectedItem.Text, DdlCtaContableRetIVA.SelectedValue.ToEntero, DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableRetISR.SelectedValue.ToEntero, - DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableFondoGarantia.SelectedValue.ToEntero, DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableCompClientes.SelectedValue.ToEntero, DdlCtaContableCompClientes.SelectedItem.Text, DdlCtaContableCompAnticipos.SelectedValue.ToEntero, DdlCtaContableCompAnticipos.SelectedItem.Text, - DdlMonedaExtranjeraClientes.SelectedValue.ToEntero, DdlMonedaExtranjeraClientes.SelectedItem.Text, DdlMonedaExtranjeraAnticipos.SelectedValue.ToEntero, DdlMonedaExtranjeraAnticipos.SelectedItem.Text, - TxtConvenioCIE.Text.Trim, TxtFormaFacturacion.Text.Trim, TxtCodigo.Text.Trim, TxtLimiteCredito.Text.ToDouble, TxtNumCtaPago.Text.Trim, DdlMetodoPago.SelectedValue.ToEntero, ChkAplicaFEMSA.Checked, TxtFEMSA_NumSociedad.Text.Trim, TxtFEMSA_NumProveedor.Text.Trim, TxtFEMA_Mail.Text.Trim, - ChkAplicaDetallista.Checked, TxtDet_GLNComprador.Text.Trim, TxtDet_Departamento.Text.Trim, TxtDet_GLNVendedor.Text.Trim, TxtDet_NumProveedor.Text.Trim, TxtProveedor.Text.Trim, ChkAplicaFord.Checked, TxtFordGSDB.Text.Trim, UsuarioActual.CveUsuario, - CveCliente, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtExtension.Text.Trim, TxtTelefonoOtro.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), ChkPermiteCredito.Checked, DdlSubProyecto.SelectedValue.ToEntero, DdlCorporativo.SelectedValue.ToEntero, CveClienteClasificacion:=DdlClasificacion.SelectedValue.ToEntero, CveUsuarioResponsable:=DdlResponsable.SelectedValue.ToEntero, - CveCondicionEntrega:=DdlCondicionesEntrega.SelectedValue.ToEntero, ImprimeNombreSucursal:=ChkMuestraNombre.Checked, CveZonaHoraria:=DdlZonaHoraria.SelectedValue.ToEntero, CobranzaContacto:=TxtCobranzaContacto.Text.Trim, CobranzaTelefono:=TxtCobranzaTelefono.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), CobranzaExt:=TxtCobranzaExt.Text, - CobranzaCorreo:=TxtCobranzaCorreo.Text.Trim, Horario:=TxtHorario.Text.Trim, PortalFacturacion:=TxtPortalFacturacion.Text.Trim, Documentacion:=TxtDocumentacion.Text.Trim, DiasEspecifico:=TxtDiasEspecifico.Text.Trim, UsuarioPortal:=TxtUsuarioPortalFacturacion.Text, ContraseñaPortal:=TxtContraseñaPortalFacturacion.Text, - DiasRevision:=DiasRevision, ObservacionRevsion:=TxtObsDiasRevision.Text.Trim, ReferenciaFiscal:=TxtReferenciaFiscal.Text.Trim, Celular:=TxtCelular.Text.Trim.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), ExtOtros:=TxtExtOtro.Text.Trim, CveUsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero, DesglosaIEPS:=ChkDesglosarIEPS.Checked, - AplicaComercioExterior:=ChkAplicaComercioExterior.Checked, CveTipoOperacion:=DdlTipoOperacion.SelectedValue.ToEntero, CvePedimento:=DdlClavePedimento.SelectedValue.ToEntero, CveIncoterm:=DdlIncoterm.SelectedValue.ToEntero, CvePais:=DdlPais.SelectedValue.ToEntero, CveEstado:=DdlEstado.SelectedValue.ToEntero, CveMunicipio:=DdlMunicipio.SelectedValue.ToEntero, CveColonia:=DdlColonia.SelectedValue.ToEntero, - CveMotivoTraslado:=IIf(DdlMotivoTraslado.SelectedValue = "-1", "0", DdlMotivoTraslado.SelectedValue).ToString().ToEntero, NumRegIdTrib:=IIf(TxtNumRegIdTrib.Text = "", "-1", TxtNumRegIdTrib.Text).ToString(), - ComExtEstado:=IIf(TxtComExtEstado.Text = "", "-1", TxtComExtEstado.Text).ToString(), ComExtMunicipio:=IIf(TxtComExtMunicipio.Text = "", "-1", TxtComExtMunicipio.Text).ToString(), ComExtColonia:=IIf(TxtComExtColonia.Text = "", "-1", TxtComExtColonia.Text).ToString(), + Dim MensajeCRM As String = "" + If CveEmpresaCRM > 0 Then + If VincularEmpresaCRM() Then + MensajeCRM = "

    Se vinculo el cliente a la Empresa CRM" + Else + MensajeCRM = "

    Ocurrio un error al vincular la Empresa CRM, intente unificar el Cliente." + End If + End If + + Alert("El Cliente se guardó correctamente." & MsgCuentaContable & MensajeCRM, TipoMensaje.MsgInformacion, "document.location.href=""/Ventas/CatClientes.aspx""") + End If + End If + Else + + Dim NombreCliente As String = "" + + If TxtRFC.Text.Length = 13 AndAlso TxtApellidoPaterno.Text <> "" AndAlso TxtApellidoMaterno.Text <> "" AndAlso TxtNombres.Text <> "" Then + NombreCliente = ($"{TxtNombres.Text} {TxtApellidoPaterno.Text} {TxtApellidoMaterno.Text}").Trim() + Else + NombreCliente = TxtNombre.Text.Trim() + End If + + If ObjClientes.UpdateCliente(NombreCliente, TxtNombreComercial.Text.Trim, TxtDireccion.Text.Trim, TxtNoExt.Text.Trim, TxtNoInt.Text.Trim, TxtColonia.Text.Trim, TxtLocalidad.Text.Trim, TxtCiudad.Text.Trim, TxtEstado.Text.Trim, TxtPais.Text.Trim, TxtRFC.Text.Trim, TxtCP.Text.Trim, + TxtTelefono.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), TxtContacto.Text.Trim, TxtEmail.Text.Trim, TxtEmailCotizacion.Text.Trim, TxtNotificar.Text.Trim, TxtPagina.Text, TxtGiro.Text, DdlPrecioLista.SelectedValue.ToEntero, ChkMail.Checked, TxtRetIVA.Text.ToDouble, TxtRetISR.Text.ToDouble, ChkRetIVAFletesAcarreos.Checked, + ChkEstado.Checked, TxtNombreCorto.Text.Trim, DdlVendedor.SelectedValue.ToEntero, TxtPlazoCobranza.Text.Trim.ToEntero, TxtPlazoCobranzaRemision.Text.Trim.ToEntero, DiasPago, DdlTipoPago.SelectedValue, + DdlCtaContableClientes.SelectedValue.ToEntero, DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableAnticipos.SelectedValue.ToEntero, DdlCtaContableAnticipos.SelectedItem.Text, DdlCtaContableRetIVA.SelectedValue.ToEntero, DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableRetISR.SelectedValue.ToEntero, + DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableFondoGarantia.SelectedValue.ToEntero, DdlCtaContableClientes.SelectedItem.Text, DdlCtaContableCompClientes.SelectedValue.ToEntero, DdlCtaContableCompClientes.SelectedItem.Text, DdlCtaContableCompAnticipos.SelectedValue.ToEntero, DdlCtaContableCompAnticipos.SelectedItem.Text, + DdlMonedaExtranjeraClientes.SelectedValue.ToEntero, DdlMonedaExtranjeraClientes.SelectedItem.Text, DdlMonedaExtranjeraAnticipos.SelectedValue.ToEntero, DdlMonedaExtranjeraAnticipos.SelectedItem.Text, + TxtConvenioCIE.Text.Trim, TxtFormaFacturacion.Text.Trim, TxtCodigo.Text.Trim, TxtLimiteCredito.Text.ToDouble, TxtNumCtaPago.Text.Trim, DdlMetodoPago.SelectedValue.ToEntero, ChkAplicaFEMSA.Checked, TxtFEMSA_NumSociedad.Text.Trim, TxtFEMSA_NumProveedor.Text.Trim, TxtFEMA_Mail.Text.Trim, + ChkAplicaDetallista.Checked, TxtDet_GLNComprador.Text.Trim, TxtDet_Departamento.Text.Trim, TxtDet_GLNVendedor.Text.Trim, TxtDet_NumProveedor.Text.Trim, TxtProveedor.Text.Trim, ChkAplicaFord.Checked, TxtFordGSDB.Text.Trim, UsuarioActual.CveUsuario, + CveCliente, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtExtension.Text.Trim, TxtTelefonoOtro.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), ChkPermiteCredito.Checked, DdlSubProyecto.SelectedValue.ToEntero, DdlCorporativo.SelectedValue.ToEntero, CveClienteClasificacion:=DdlClasificacion.SelectedValue.ToEntero, CveUsuarioResponsable:=DdlResponsable.SelectedValue.ToEntero, + CveCondicionEntrega:=DdlCondicionesEntrega.SelectedValue.ToEntero, ImprimeNombreSucursal:=ChkMuestraNombre.Checked, CveZonaHoraria:=DdlZonaHoraria.SelectedValue.ToEntero, CobranzaContacto:=TxtCobranzaContacto.Text.Trim, CobranzaTelefono:=TxtCobranzaTelefono.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), CobranzaExt:=TxtCobranzaExt.Text, + CobranzaCorreo:=TxtCobranzaCorreo.Text.Trim, Horario:=TxtHorario.Text.Trim, PortalFacturacion:=TxtPortalFacturacion.Text.Trim, Documentacion:=TxtDocumentacion.Text.Trim, DiasEspecifico:=TxtDiasEspecifico.Text.Trim, UsuarioPortal:=TxtUsuarioPortalFacturacion.Text, ContraseñaPortal:=TxtContraseñaPortalFacturacion.Text, + DiasRevision:=DiasRevision, ObservacionRevsion:=TxtObsDiasRevision.Text.Trim, ReferenciaFiscal:=TxtReferenciaFiscal.Text.Trim, Celular:=TxtCelular.Text.Trim.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), ExtOtros:=TxtExtOtro.Text.Trim, CveUsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero, CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero, DesglosaIEPS:=ChkDesglosarIEPS.Checked, + AplicaComercioExterior:=ChkAplicaComercioExterior.Checked, CveTipoOperacion:=DdlTipoOperacion.SelectedValue.ToEntero, CvePedimento:=DdlClavePedimento.SelectedValue.ToEntero, CveIncoterm:=DdlIncoterm.SelectedValue.ToEntero, CvePais:=DdlPais.SelectedValue.ToEntero, CveEstado:=DdlEstado.SelectedValue.ToEntero, CveMunicipio:=DdlMunicipio.SelectedValue.ToEntero, CveColonia:=DdlColonia.SelectedValue.ToEntero, + CveMotivoTraslado:=IIf(DdlMotivoTraslado.SelectedValue = "-1", "0", DdlMotivoTraslado.SelectedValue).ToString().ToEntero, NumRegIdTrib:=IIf(TxtNumRegIdTrib.Text = "", "-1", TxtNumRegIdTrib.Text).ToString(), + ComExtEstado:=IIf(TxtComExtEstado.Text = "", "-1", TxtComExtEstado.Text).ToString(), ComExtMunicipio:=IIf(TxtComExtMunicipio.Text = "", "-1", TxtComExtMunicipio.Text).ToString(), ComExtColonia:=IIf(TxtComExtColonia.Text = "", "-1", TxtComExtColonia.Text).ToString(), ApellidoPaternoPF:=IIf(TxtApellidoPaterno.Text = "", "-1", TxtApellidoPaterno.Text).ToString(), ApellidoMaternoPF:=IIf(TxtApellidoMaterno.Text = "", "-1", TxtApellidoMaterno.Text).ToString(), NombresPF:=IIf(TxtNombres.Text = "", "-1", TxtNombres.Text).ToString(), - RequiereOC:=ChkRequiereOC.Checked, LT:=LT, LG:=LG, EsDistribuidor:=ChkEsDistribuidor.Checked, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, CargoUsado:=ChkCargoUsado.Checked, BonificacionUsado:=ChkBonificacionUsado.Checked, CveTipoRetencion:=DdlTipoRetencion.SelectedValue.ToEntero()) Then - - - ObjClientes.LimpiaImpuestosLocales(CveCliente) - - For Each GVR As GridViewRow In GvImpuestosLocales.Rows - If GVR.FCCheckBox("ChkDeduccion").Checked Then - ObjClientes.AddClienteImpuestosLocales(CveCliente, GVR.DataKey("CveImpuestoLocal").ToEntero) - End If - Next - - GuardarDocumentosClientes() - - 'For Each gvr As GridViewRow In GvDocsVentas.Rows - ' 'sino está registrada y se selecciona, se va a insertar - ' If gvr.DataKey("CveDocumentacionElectronica").ToEntero <= 0 Then - ' objDoc.DocumentacionElectronicaAdd(gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, Now, Observacion2:=gvr.FCTextBox("TxtObs2").Text, FechaVigencia:=gvr.FCTextBox("TxtFechaVigencia").Text.ToDate) - ' Else - ' ', Observacion2:=gvr.FCTextBox("TxtObs2").Text - ' objDoc.DocumentacionElectronicaUpdate(gvr.DataKey("CveDocumentacionElectronica").ToEntero, gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, gvr.DataKey("FechaLimite").ToDate, Observacion2:=gvr.FCTextBox("TxtObs2").Text, FechaVigencia:=gvr.FCTextBox("TxtFechaVigencia").Text.ToDate) - ' End If - - ' 'si ya estaba registrada y no se selecciona, se va a insertar - ' If gvr.DataKey("CveDocumentacionElectronica").ToEntero > 0 AndAlso Not gvr.FCCheckBox("ChkDoc").Checked Then - ' objDoc.DocumentacionElectronicaRemove(gvr.DataKey("CveDocumentacionElectronica").ToEntero, -1) - ' End If - - 'Next - - ObjClientes.Commit() - + RequiereOC:=ChkRequiereOC.Checked, LT:=LT, LG:=LG, EsDistribuidor:=ChkEsDistribuidor.Checked, TipoCliente:=DdlTipoCliente.SelectedValue.ToEntero, CargoUsado:=ChkCargoUsado.Checked, BonificacionUsado:=ChkBonificacionUsado.Checked, CveTipoRetencion:=DdlTipoRetencion.SelectedValue.ToEntero()) Then + + + ObjClientes.LimpiaImpuestosLocales(CveCliente) + + For Each GVR As GridViewRow In GvImpuestosLocales.Rows + If GVR.FCCheckBox("ChkDeduccion").Checked Then + ObjClientes.AddClienteImpuestosLocales(CveCliente, GVR.DataKey("CveImpuestoLocal").ToEntero) + End If + Next + + GuardarDocumentosClientes() + + 'For Each gvr As GridViewRow In GvDocsVentas.Rows + ' 'sino está registrada y se selecciona, se va a insertar + ' If gvr.DataKey("CveDocumentacionElectronica").ToEntero <= 0 Then + ' objDoc.DocumentacionElectronicaAdd(gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, Now, Observacion2:=gvr.FCTextBox("TxtObs2").Text, FechaVigencia:=gvr.FCTextBox("TxtFechaVigencia").Text.ToDate) + ' Else + ' ', Observacion2:=gvr.FCTextBox("TxtObs2").Text + ' objDoc.DocumentacionElectronicaUpdate(gvr.DataKey("CveDocumentacionElectronica").ToEntero, gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, gvr.DataKey("FechaLimite").ToDate, Observacion2:=gvr.FCTextBox("TxtObs2").Text, FechaVigencia:=gvr.FCTextBox("TxtFechaVigencia").Text.ToDate) + ' End If + + ' 'si ya estaba registrada y no se selecciona, se va a insertar + ' If gvr.DataKey("CveDocumentacionElectronica").ToEntero > 0 AndAlso Not gvr.FCCheckBox("ChkDoc").Checked Then + ' objDoc.DocumentacionElectronicaRemove(gvr.DataKey("CveDocumentacionElectronica").ToEntero, -1) + ' End If + + 'Next + + ObjClientes.Commit() + Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) - If EstatusAnteriorCliente <> ChkEstado.Checked Then - - Dim DTVendedor As New DataTable + If EstatusAnteriorCliente <> ChkEstado.Checked Then + + Dim DTVendedor As New DataTable DTVendedor = GlobalDTVendedores(UsuarioActual.Empresa.CveEmpresa).FiltraParametros(" CveVendedor = " & DdlVendedor.SelectedValue.ToEntero) Dim ObjVendedores As New ClsVtaVendedores @@ -2575,9 +2575,9 @@ Partial Class Clientes If ObjVendedores.GetVendedores(UsuarioActual.CveEmpresa) Then DtVendedores = ObjVendedores.DtResultados End If - ObjVendedores.Dispose() - - If DTVendedor.Rows.Count > 0 Then + ObjVendedores.Dispose() + + If DTVendedor.Rows.Count > 0 Then Dim _CorreoVendedor As String = DTVendedor(0)("Correo").ToString Dim _CorreoAsistente As String = "" Dim _CorreoCoordinador As String = "" @@ -2586,4295 +2586,4295 @@ Partial Class Clientes If DTVendedor.Rows.Count > 0 Then _CorreoAsistente = DtVendedores.FiltroPrimeroValor("Correo", "CveSuperior = " & DdlVendedor.SelectedValue.ToEntero) _CorreoCoordinador = DtVendedores.FiltroPrimeroValor("Correo", "CveVendedor = " & CveSuperior) - End If - - If (_CorreoVendedor.Length > 0 Or _CorreoAsistente.Length > 0 Or _CorreoCoordinador.Length > 0) And UsuarioActual.Empresa.Funcionalidad(571).ToEntero > 0 Then - - Dim Asunto As String = "" - Dim Para As String = If(_CorreoVendedor.Length > 0, _CorreoVendedor & ";", "") & If(_CorreoAsistente.Length > 0, _CorreoAsistente & ";", "") & _CorreoCoordinador - Dim SBBody As New StringBuilder - - If ChkEstado.Checked Then - Asunto = "Activación de cliente " & TxtNombre.Text - SBBody.Append(String.Format(" Por Medio de la presente se le notifica que el estatus del cliente {0} ha sido activado.", TxtNombre.Text)) - Else - Asunto = "Desactivación de cliente " & TxtNombre.Text - SBBody.Append(String.Format(" Por Medio de la presente se le notifica que el estatus del cliente {0} ha sido desactivado.", TxtNombre.Text)) + End If + + If (_CorreoVendedor.Length > 0 Or _CorreoAsistente.Length > 0 Or _CorreoCoordinador.Length > 0) And UsuarioActual.Empresa.Funcionalidad(571).ToEntero > 0 Then + + Dim Asunto As String = "" + Dim Para As String = If(_CorreoVendedor.Length > 0, _CorreoVendedor & ";", "") & If(_CorreoAsistente.Length > 0, _CorreoAsistente & ";", "") & _CorreoCoordinador + Dim SBBody As New StringBuilder + + If ChkEstado.Checked Then + Asunto = "Activación de cliente " & TxtNombre.Text + SBBody.Append(String.Format(" Por Medio de la presente se le notifica que el estatus del cliente {0} ha sido activado.", TxtNombre.Text)) + Else + Asunto = "Desactivación de cliente " & TxtNombre.Text + SBBody.Append(String.Format(" Por Medio de la presente se le notifica que el estatus del cliente {0} ha sido desactivado.", TxtNombre.Text)) End If - MandaCorreo(Asunto, Para + "", SBBody.ToString) - End If - End If - - End If - - CargaHistorial() - CargaDatos() - UpDatos.Update() + MandaCorreo(Asunto, Para + "", SBBody.ToString) + End If + End If + + End If + + CargaHistorial() + CargaDatos() + UpDatos.Update() UpnHistorial.Update() - End If - End If - ObjClientes.Dispose() - objDoc.Dispose() - RecargaGlobal() - End Sub - -#End Region - - -#Region "G L O B L A L" - Private Sub RecargaGlobal() - 'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT) - 'Hilo.Start() - GeneraGlobalDT() - End Sub - Private Sub GeneraGlobalDT() - GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing - 'Dim Objclientes As New ClsClientes - 'If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then - ' Application("GlobalDTCliente") = Objclientes.DtResultados - 'End If - 'Objclientes.Dispose() + End If + End If + ObjClientes.Dispose() + objDoc.Dispose() + RecargaGlobal() End Sub -#End Region + +#End Region -#Region "G R I D V I E W S" - Protected Sub GVHistorial_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVHistorial.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - Dim HLSendMail As HtmlAnchor = DirectCast(e.Row.FindControl("HLSendMail"), HtmlAnchor) - 'Dim HLRemision As HtmlAnchor = DirectCast(e.Row.FindControl("HLRemision"), HtmlAnchor) - - - e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right - - - If e.Row.RowIndex = 0 Then - e.Row.BackColor = Drawing.Color.LightGray - HLSendMail.Visible = False - 'HLRemision.Visible = False - End If - - - 'If e.Row.RowIndex > 0 AndAlso e.Row.DBCampo("TipoDocto") <> "Rem" Then - ' HLRemision.Visible = False - 'ElseIf e.Row.RowIndex > 0 AndAlso e.Row.DBCampo("TipoDocto") = "Rem" AndAlso e.Row.DBCampo("CveVentaFacturada") <> String.Empty Then - ' HLRemision.Visible = False - 'End If - 'HLRemision.HRef = $"/Ventas/Ventas.aspx?CveRemision={e.Row.DBCampo("CveVenta")}" - - Dim Liga As String = String.Format("< a class=""Texto"" href=""/Ventas/Ventas.aspx?CveVenta={0}"">", e.Row.DBCampo("CveVenta")) - HLSendMail.HRef = String.Format("javascript:$get('HdnTipoDocto').value='{0}';$get('HdnCveVenta').value='{1}';$get('HdnFolioVenta').value='{2}';$get('TxtParaMail').value='{3}';$get('HdnSerieFolio').value='{4}';$get('HdnSubProyecto').value='{5}';$('#ModalDivMail').modal();", e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("CveVenta"), e.Row.DBCampo("folio"), e.Row.DBCampo("Correo"), e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("SubProyecto")) - e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("Folio")) - - UpSendMail.Update() - End If - End Sub - Protected Sub GvCxC_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxC.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 1 Then - e.Row.Cells(0).Width = Unit.Pixel(60) - e.Row.Cells(1).Width = Unit.Pixel(120) - e.Row.Cells(2).Width = Unit.Pixel(70) - e.Row.Cells(3).Width = Unit.Pixel(80) - e.Row.Cells(4).Width = Unit.Pixel(80) - e.Row.Cells(5).Width = Unit.Pixel(90) - e.Row.Cells(6).Width = Unit.Pixel(90) - e.Row.Cells(7).Width = Unit.Pixel(90) - e.Row.Cells(8).Width = Unit.Pixel(80) - e.Row.Cells(9).Width = Unit.Pixel(70) - End If - - e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(7).HorizontalAlign = HorizontalAlign.Right - - If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(6).ForeColor = Drawing.Color.Red - If e.Row.DBCampo("DiasVencidos").ToDouble > 0 AndAlso CType(sender, GridView).ID = "GvCxC" Then e.Row.Cells(4).ForeColor = Drawing.Color.Red - If e.Row.DBCampo("Original").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldoOriginal"), Literal).Text = "" - If e.Row.DBCampo("Abonado").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlAbonado"), Literal).Text = "" - - If e.Row.DBCampo("Saldo").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldo"), Literal).Text = "" - - If e.Row.DBCampo("CveVenta") <> "" Then - e.Row.FCHyperLink("LtlAux").NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=420&width=1000", CveCliente, e.Row.DBCampo("CveVenta")) - e.Row.FCHyperLink("ImgAbonar").NavigateUrl = String.Format("/Bancos/PopIEVentas.aspx?CveVenta={0}&TB_iframe=true&height=550&width=700", e.Row.DBCampo("CveVenta")) - e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("SerieFolio")) - Else - e.Row.FCLiteral("LtlFactura").Text = e.Row.DBCampo("SerieFolio") - e.Row.FCHyperLink("LtlAux").Visible = False - e.Row.BackColor = Drawing.Color.LightGray - e.Row.FCHyperLink("ImgAbonar").Visible = False - End If - - If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 72) Then - e.Row.Cells(9).Visible = True - e.Row.Cells(9).Font.Bold = True - Dim OBjClientes As New ClsClientes - If OBjClientes.GetVisitasCobranza(-1, e.Row.DBCampo("CveVenta").ToEntero, -1) Then - If OBjClientes.DtResultados.Rows.Count > 0 Then - e.Row.FCLinkButton("ImgVisitas").Visible = True - GvVisitas.DataSource = OBjClientes.DtResultados - GvVisitas.DataBind() - Else - e.Row.FCLinkButton("ImgVisitas").Visible = False - End If - End If - OBjClientes.Dispose() - End If - - If UsuarioActual.TienePermisoProceso(100) And e.Row.DBCampo("CveVenta") <> "" Then - e.Row.FCHyperLink("ImgAbonar").Visible = True - Else - e.Row.FCHyperLink("ImgAbonar").Visible = False - End If - - End If - End Sub - Protected Sub GvCxCHistorial_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxCHistorial.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - If e.Row.RowIndex = 1 Then - e.Row.Cells(0).Width = Unit.Pixel(90) - e.Row.Cells(1).Width = Unit.Pixel(125) - e.Row.Cells(2).Width = Unit.Pixel(155) - e.Row.Cells(3).Width = Unit.Pixel(232) - e.Row.Cells(4).Width = Unit.Pixel(302) - e.Row.Cells(5).Width = Unit.Pixel(90) - e.Row.Cells(6).Width = Unit.Pixel(90) - e.Row.Cells(7).Width = Unit.Pixel(90) - End If - e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right - e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right - - If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(6).ForeColor = Drawing.Color.Red - If e.Row.DBCampo("DiasVencidos").ToDouble > 0 AndAlso CType(sender, GridView).ID = "GvCxC" Then e.Row.Cells(4).ForeColor = Drawing.Color.Red - If e.Row.DBCampo("Original").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldoOriginal"), Literal).Text = "" - If e.Row.DBCampo("Abonado").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlAbonado"), Literal).Text = "" - If e.Row.DBCampo("Saldo").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldo"), Literal).Text = "" - - If e.Row.DBCampo("CveVenta") <> "" Then - e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("SerieFolio")) - Else - e.Row.FCLiteral("LtlFactura").Text = e.Row.DBCampo("SerieFolio") - e.Row.BackColor = Drawing.Color.LightGray - End If - - - End If - End Sub - Protected Sub GVAnticipos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAnticipos.RowDataBound, GVAnticiposHistorial.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - If e.Row.DataKey("ISTotal") = "1" Then - e.Row.FCLiteral("LtlFecha").Text = String.Format("Total {0} ", e.Row.DataKey("Tipo")) - e.Row.BackColor = Drawing.Color.LightGray - End If - - 'If e.Row.DataKey("Saldo").ToDouble < 0 Then e.Row.Cells(2).ForeColor = Drawing.Color.Red - 'If e.Row.DataKey("Saldo").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlAnticipos"), Literal).Text = "" - - If e.Row.RowIndex > -1 Then - If e.Row.DBCampo("Folio") = "N/D" Then - e.Row.FCLiteral("LtlFactura").Text = e.Row.DataKey("Folio") - Else - If e.Row.DataKey("CveIE").ToString.ToEntero > 0 Then - e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DataKey("CveIE"), e.Row.DataKey("Folio")) - Else - e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DataKey("CveVenta"), e.Row.DataKey("Folio")) - End If - End If - End If - - If UsuarioActual.TienePermisoProceso(247) Then - If CType(sender, GridView).ID = "GVAnticipos" And e.Row.DBCampo("CveVenta").ToEntero > 0 And e.Row.DBCampo("Tipo") = "NC" Then - Dim Parametros = Encripta($"CveVenta={e.Row.DBCampo("CveVenta").ToEntero}&SerieFolio={e.Row.DBCampo("Folio")}&CveMoneda={e.Row.DBCampo("CveMoneda")}&CveCliente={CveCliente}&Saldo={e.Row.DBCampo("Saldo")}&Original={e.Row.DBCampo("Original")}&CvePrePoliza={e.Row.DBCampo("CvePrePoliza")}") - e.Row.FCHyperLink("HLDevolverDinero").Visible = True - e.Row.FCHyperLink("HLDevolverDinero").NavigateUrl = $"/Bancos/IE.aspx?Opcion=DevDinV&P={Parametros}" - End If - End If - - End If - End Sub -#End Region - -#Region "R H" - - Private Sub CargaPersonalAsignado() - Dim ObjPersonal As New ClsRH - If ObjPersonal.GetPersonal(-1, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, CveCliente, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then - GVPersonal.DataSource = ObjPersonal.DtResultados - Else - GVPersonal.DataSource = Nothing - End If - ObjPersonal.Dispose() - GVPersonal.DataBind() - End Sub - - Protected Sub GVPersonal_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVPersonal.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 0 Then - e.Row.Cells(0).Width = Unit.Pixel(70) - e.Row.Cells(1).Width = Unit.Pixel(300) - e.Row.Cells(2).Width = Unit.Pixel(80) - e.Row.Cells(3).Width = Unit.Pixel(80) - e.Row.Cells(4).Width = Unit.Pixel(120) - e.Row.Cells(5).Width = Unit.Pixel(120) - e.Row.Cells(6).Width = Unit.Pixel(60) - End If - e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left - e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Left - e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left - e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Left - e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Left - - Dim Liga As String = "" - e.Row.FCLiteral("LtlCodigo").Text = Liga & e.Row.FCLiteral("LtlCodigo").Text & "" - e.Row.FCLiteral("LtlPersonal").Text = Liga & e.Row.FCLiteral("LtlPersonal").Text & "" - End If - End Sub - - Protected Sub BtnConsultarAsistencia_Click(sender As Object, e As System.EventArgs) Handles BtnConsultarAsistencia.Click - Dim objpersonal As New ClsRH - If objpersonal.GetAsistencias(-1, CveCliente, -1, -1, -1, 1, txtFechaI.Text.Trim.ToDate, txtFechaF.Text.Trim.ToDate, UsuarioActual.CveEmpresa) Then - GVAsistencia.DataSource = objpersonal.DtResultados.FiltraParametros("Fecha IS NOT NULL") - Else - GVAsistencia.DataSource = Nothing - End If - objpersonal.Dispose() - GVAsistencia.DataBind() - UpDatos.Update() - End Sub - - Protected Sub GVAsistencia_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAsistencia.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - If e.Row.RowIndex = 0 Then - e.Row.Cells(0).Width = Unit.Pixel(75) - e.Row.Cells(1).Width = Unit.Pixel(145) - e.Row.Cells(2).Width = Unit.Pixel(70) - e.Row.Cells(3).Width = Unit.Pixel(100) - e.Row.Cells(4).Width = Unit.Pixel(100) - e.Row.Cells(5).Width = Unit.Pixel(145) - e.Row.Cells(6).Width = Unit.Pixel(220) - End If - - e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left - e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Left - e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Left - - If IsDate(e.Row.DBCampo("Fecha")) Then e.Row.FCLiteral("LtlFecha").Text = e.Row.DBCampo("Fecha").ToDate.ToShortDateString - - If e.Row.DBCampo("SeModifico") = "0" Then - e.Row.BackColor = Drawing.Color.LightBlue - ElseIf e.Row.DBCampo("SeModifico") = "1" Then - e.Row.ForeColor = Drawing.Color.Red - End If - - End If - End Sub -#End Region - -#Region "S U C U R S A L E S" - Private Sub LbAgregarSucursal_Click(sender As Object, e As EventArgs) Handles LbAgregarSucursal.Click - ChkEstatusSucursal.Checked = True - DivEstatusSucursal.Visible = False - TxtNumeroCuenta.Text = "" - DdlMetodoPagoSucursal.SelectedIndex = 0 - UpAgregarSucursal.Update() - Me.CveClienteSuc = -1 - Me.Actualizar = False - txtLg.Text = "" - txtLt.Text = "" - HDMAPOP.Value = "2" - - UpModalDivMapa.Update() - - - RegistraScript("showDivEC();") - End Sub - Public Function CargaSucursalesCliente() As Boolean - Dim Retorno As Boolean = False - Dim ObjCliente As New ClsClientes - If ObjCliente.GetSucursales(CveCliente) Then - ViewState("DTSucursalesCliente") = ObjCliente.DtResultados - Retorno = True - Else - ViewState("DTSucursalesCliente") = Nothing - Me.GVSucursales.DataSource = Nothing - End If - - ObjCliente.Dispose() - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString(), 0) - Else - CargaGrid("", 0) - End If - Return Retorno - End Function - Protected Sub BtnAgregar_Click(sender As Object, e As System.EventArgs) Handles BtnAgregarSucursal.Click - Dim ObjCliente As New ClsClientes - - Dim LT As String = If(txtLt.Text.ToDouble <> 0, txtLt.Text, "0") - Dim LG As String = If(txtLg.Text.ToDouble <> 0, txtLg.Text, "0") - - If CveCliente > 0 Then - If Actualizar Then - - - Dim Estatus As Boolean = ChkEstatusSucursal.Checked - - - - If ObjCliente.UpdateSucursal(TxtNombreSucursal.Text.Trim, Estatus, CveCliente, CveClienteSuc, TxtCiudadSucursal.Text.Trim, TxtColoniaSucursal.Text.Trim, TxtCPSucursal.Text.Trim, TxtDireccionSucursal.Text.Trim, TxtEstadoSucursal.Text.Trim, TxtLocalidadSucursal.Text.Trim, TxtPaisSucursal.Text.Trim, TxtNumExtSucursal.Text.Trim, TxtNumIntSucursal.Text.Trim, - TxtTelefonoSucursal.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), TxtCorreoSucursal.Text.Trim, TxtCorreoSucursalCotizacion.Text.Trim, TxtContactoSucursal.Text.Trim, DdlVendedorSucursal.SelectedValue.ToEntero, TxtNumeroCuenta.Text, DdlMetodoPagoSucursal.SelectedValue.ToEntero, TxtLimiteCreditoSucursal.Text.ToDecimal, DdlResponsableSucursal.SelectedValue.ToEntero, - DdlSucursalUsoCFDI.SelectedValue.ToEntero, DdlSucursalFormaPago33.SelectedValue.ToEntero, DdlSucursalMetodoPago33.SelectedValue.ToEntero, LT:=LT, LG:=LG) Then - GVSucursales.EditIndex = -1 - ViewState("DTSucursalesCliente") = ObjCliente.DtResultados - Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) - End If - ObjCliente.Dispose() - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString(), 0) - Else - CargaGrid("", 0) - End If - - Else - If ObjCliente.AddSucursal(CveCliente, TxtNombreSucursal.Text.Trim, UsuarioActual.CveUsuario, TxtCiudadSucursal.Text.Trim, TxtColoniaSucursal.Text.Trim, TxtCPSucursal.Text.Trim, TxtDireccionSucursal.Text.Trim, TxtEstadoSucursal.Text.Trim, TxtLocalidadSucursal.Text.Trim, TxtPaisSucursal.Text.Trim, TxtNumExtSucursal.Text.Trim, TxtNumIntSucursal.Text.Trim, TxtTelefonoSucursal.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", ""), TxtCorreoSucursal.Text.Trim, TxtCorreoSucursalCotizacion.Text.Trim, TxtContactoSucursal.Text.Trim, - DdlVendedorSucursal.SelectedValue.ToEntero, TxtNumeroCuenta.Text, DdlMetodoPagoSucursal.SelectedValue.ToEntero, TxtLimiteCreditoSucursal.Text.ToDecimal, DdlResponsableSucursal.SelectedValue.ToEntero, - DdlSucursalUsoCFDI.SelectedValue.ToEntero, DdlSucursalFormaPago33.SelectedValue.ToEntero, DdlSucursalMetodoPago33.SelectedValue.ToEntero, LT:=LT, LG:=LG) Then - TxtNombreSucursal.Text = "" - TxtCiudadSucursal.Text = "" - TxtColoniaSucursal.Text = "" - TxtCPSucursal.Text = "" - TxtDireccionSucursal.Text = "" - TxtEstadoSucursal.Text = "" - TxtLocalidadSucursal.Text = "" - TxtPaisSucursal.Text = "" - TxtNumExtSucursal.Text = "" - TxtNumIntSucursal.Text = "" - TxtTelefonoSucursal.Text = "" - TxtCorreoSucursal.Text = "" - TxtCorreoSucursalCotizacion.Text = "" - TxtContactoSucursal.Text = "" - DdlVendedorSucursal.SelectedIndex = 0 - DdlMetodoPagoSucursal.SelectedIndex = 0 - TxtNumeroCuenta.Text = "" - TxtLimiteCreditoSucursal.Text = "" - DdlResponsableSucursal.SelectedIndex = 0 - DdlSucursalUsoCFDI.SelectedIndex = 0 - DdlSucursalFormaPago33.SelectedIndex = 0 - DdlSucursalMetodoPago33.SelectedIndex = 0 - Alert("La nueva Sucursal del Cliente se guardó correctamente.", TipoMensaje.MsgInformacion) - ViewState("DTSucursalesCliente") = ObjCliente.DtResultados - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString(), 0) - Else - CargaGrid("", 0) - End If - End If - End If - - Else - AddSucursalTemp() - End If - - txtLg.Text = "" - txtLt.Text = "" - - UpModalDivMapa.Update() - - - UpAgregarSucursal.Update() - CargaDdlSucursalCliente() - ObjCliente.Dispose() - +#Region "G L O B L A L" + Private Sub RecargaGlobal() + 'Dim Hilo As New System.Threading.Thread(AddressOf GeneraGlobalDT) + 'Hilo.Start() + GeneraGlobalDT() + End Sub + Private Sub GeneraGlobalDT() + GlobalDTCliente(UsuarioActual.CveEmpresa) = Nothing + 'Dim Objclientes As New ClsClientes + 'If Objclientes.GetClientes(-1, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then + ' Application("GlobalDTCliente") = Objclientes.DtResultados + 'End If + 'Objclientes.Dispose() + End Sub +#End Region + + +#Region "G R I D V I E W S" + Protected Sub GVHistorial_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVHistorial.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + Dim HLSendMail As HtmlAnchor = DirectCast(e.Row.FindControl("HLSendMail"), HtmlAnchor) + 'Dim HLRemision As HtmlAnchor = DirectCast(e.Row.FindControl("HLRemision"), HtmlAnchor) + + + e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right + + + If e.Row.RowIndex = 0 Then + e.Row.BackColor = Drawing.Color.LightGray + HLSendMail.Visible = False + 'HLRemision.Visible = False + End If + + + 'If e.Row.RowIndex > 0 AndAlso e.Row.DBCampo("TipoDocto") <> "Rem" Then + ' HLRemision.Visible = False + 'ElseIf e.Row.RowIndex > 0 AndAlso e.Row.DBCampo("TipoDocto") = "Rem" AndAlso e.Row.DBCampo("CveVentaFacturada") <> String.Empty Then + ' HLRemision.Visible = False + 'End If + 'HLRemision.HRef = $"/Ventas/Ventas.aspx?CveRemision={e.Row.DBCampo("CveVenta")}" + + Dim Liga As String = String.Format("< a class=""Texto"" href=""/Ventas/Ventas.aspx?CveVenta={0}"">", e.Row.DBCampo("CveVenta")) + HLSendMail.HRef = String.Format("javascript:$get('HdnTipoDocto').value='{0}';$get('HdnCveVenta').value='{1}';$get('HdnFolioVenta').value='{2}';$get('TxtParaMail').value='{3}';$get('HdnSerieFolio').value='{4}';$get('HdnSubProyecto').value='{5}';$('#ModalDivMail').modal();", e.Row.DBCampo("TipoDocto"), e.Row.DBCampo("CveVenta"), e.Row.DBCampo("folio"), e.Row.DBCampo("Correo"), e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("SubProyecto")) + e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("Folio")) + + UpSendMail.Update() + End If + End Sub + Protected Sub GvCxC_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxC.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.RowIndex = 1 Then + e.Row.Cells(0).Width = Unit.Pixel(60) + e.Row.Cells(1).Width = Unit.Pixel(120) + e.Row.Cells(2).Width = Unit.Pixel(70) + e.Row.Cells(3).Width = Unit.Pixel(80) + e.Row.Cells(4).Width = Unit.Pixel(80) + e.Row.Cells(5).Width = Unit.Pixel(90) + e.Row.Cells(6).Width = Unit.Pixel(90) + e.Row.Cells(7).Width = Unit.Pixel(90) + e.Row.Cells(8).Width = Unit.Pixel(80) + e.Row.Cells(9).Width = Unit.Pixel(70) + End If + + e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(7).HorizontalAlign = HorizontalAlign.Right + + If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(6).ForeColor = Drawing.Color.Red + If e.Row.DBCampo("DiasVencidos").ToDouble > 0 AndAlso CType(sender, GridView).ID = "GvCxC" Then e.Row.Cells(4).ForeColor = Drawing.Color.Red + If e.Row.DBCampo("Original").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldoOriginal"), Literal).Text = "" + If e.Row.DBCampo("Abonado").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlAbonado"), Literal).Text = "" + + If e.Row.DBCampo("Saldo").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldo"), Literal).Text = "" + + If e.Row.DBCampo("CveVenta") <> "" Then + e.Row.FCHyperLink("LtlAux").NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=420&width=1000", CveCliente, e.Row.DBCampo("CveVenta")) + e.Row.FCHyperLink("ImgAbonar").NavigateUrl = String.Format("/Bancos/PopIEVentas.aspx?CveVenta={0}&TB_iframe=true&height=550&width=700", e.Row.DBCampo("CveVenta")) + e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("SerieFolio")) + Else + e.Row.FCLiteral("LtlFactura").Text = e.Row.DBCampo("SerieFolio") + e.Row.FCHyperLink("LtlAux").Visible = False + e.Row.BackColor = Drawing.Color.LightGray + e.Row.FCHyperLink("ImgAbonar").Visible = False + End If + + If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 72) Then + e.Row.Cells(9).Visible = True + e.Row.Cells(9).Font.Bold = True + Dim OBjClientes As New ClsClientes + If OBjClientes.GetVisitasCobranza(-1, e.Row.DBCampo("CveVenta").ToEntero, -1) Then + If OBjClientes.DtResultados.Rows.Count > 0 Then + e.Row.FCLinkButton("ImgVisitas").Visible = True + GvVisitas.DataSource = OBjClientes.DtResultados + GvVisitas.DataBind() + Else + e.Row.FCLinkButton("ImgVisitas").Visible = False + End If + End If + OBjClientes.Dispose() + End If + + If UsuarioActual.TienePermisoProceso(100) And e.Row.DBCampo("CveVenta") <> "" Then + e.Row.FCHyperLink("ImgAbonar").Visible = True + Else + e.Row.FCHyperLink("ImgAbonar").Visible = False + End If + + End If + End Sub + Protected Sub GvCxCHistorial_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCxCHistorial.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.RowIndex = 1 Then + e.Row.Cells(0).Width = Unit.Pixel(90) + e.Row.Cells(1).Width = Unit.Pixel(125) + e.Row.Cells(2).Width = Unit.Pixel(155) + e.Row.Cells(3).Width = Unit.Pixel(232) + e.Row.Cells(4).Width = Unit.Pixel(302) + e.Row.Cells(5).Width = Unit.Pixel(90) + e.Row.Cells(6).Width = Unit.Pixel(90) + e.Row.Cells(7).Width = Unit.Pixel(90) + End If + e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Right + e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Right + + If e.Row.DBCampo("Saldo").ToDouble < 0 Then e.Row.Cells(6).ForeColor = Drawing.Color.Red + If e.Row.DBCampo("DiasVencidos").ToDouble > 0 AndAlso CType(sender, GridView).ID = "GvCxC" Then e.Row.Cells(4).ForeColor = Drawing.Color.Red + If e.Row.DBCampo("Original").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldoOriginal"), Literal).Text = "" + If e.Row.DBCampo("Abonado").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlAbonado"), Literal).Text = "" + If e.Row.DBCampo("Saldo").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlSaldo"), Literal).Text = "" + + If e.Row.DBCampo("CveVenta") <> "" Then + e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("SerieFolio")) + Else + e.Row.FCLiteral("LtlFactura").Text = e.Row.DBCampo("SerieFolio") + e.Row.BackColor = Drawing.Color.LightGray + End If + + + End If + End Sub + Protected Sub GVAnticipos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAnticipos.RowDataBound, GVAnticiposHistorial.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.DataKey("ISTotal") = "1" Then + e.Row.FCLiteral("LtlFecha").Text = String.Format("Total {0} ", e.Row.DataKey("Tipo")) + e.Row.BackColor = Drawing.Color.LightGray + End If + + 'If e.Row.DataKey("Saldo").ToDouble < 0 Then e.Row.Cells(2).ForeColor = Drawing.Color.Red + 'If e.Row.DataKey("Saldo").ToDouble = 0 Then DirectCast(e.Row.FindControl("LtlAnticipos"), Literal).Text = "" + + If e.Row.RowIndex > -1 Then + If e.Row.DBCampo("Folio") = "N/D" Then + e.Row.FCLiteral("LtlFactura").Text = e.Row.DataKey("Folio") + Else + If e.Row.DataKey("CveIE").ToString.ToEntero > 0 Then + e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DataKey("CveIE"), e.Row.DataKey("Folio")) + Else + e.Row.FCLiteral("LtlFactura").Text = String.Format("{1}", e.Row.DataKey("CveVenta"), e.Row.DataKey("Folio")) + End If + End If + End If + + If UsuarioActual.TienePermisoProceso(247) Then + If CType(sender, GridView).ID = "GVAnticipos" And e.Row.DBCampo("CveVenta").ToEntero > 0 And e.Row.DBCampo("Tipo") = "NC" Then + Dim Parametros = Encripta($"CveVenta={e.Row.DBCampo("CveVenta").ToEntero}&SerieFolio={e.Row.DBCampo("Folio")}&CveMoneda={e.Row.DBCampo("CveMoneda")}&CveCliente={CveCliente}&Saldo={e.Row.DBCampo("Saldo")}&Original={e.Row.DBCampo("Original")}&CvePrePoliza={e.Row.DBCampo("CvePrePoliza")}") + e.Row.FCHyperLink("HLDevolverDinero").Visible = True + e.Row.FCHyperLink("HLDevolverDinero").NavigateUrl = $"/Bancos/IE.aspx?Opcion=DevDinV&P={Parametros}" + End If + End If + + End If + End Sub +#End Region + +#Region "R H" + + Private Sub CargaPersonalAsignado() + Dim ObjPersonal As New ClsRH + If ObjPersonal.GetPersonal(-1, "-1", "-1", "-1", "-1", -1, -1, -1, -1, -1, -1, -1, -1, -1, CveCliente, "-1", -1, -1, -1, -1, -1, -1, "-1", "-1", "-1", "-1", UsuarioActual.CveEmpresa) Then + GVPersonal.DataSource = ObjPersonal.DtResultados + Else + GVPersonal.DataSource = Nothing + End If + ObjPersonal.Dispose() + GVPersonal.DataBind() + End Sub + + Protected Sub GVPersonal_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVPersonal.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.RowIndex = 0 Then + e.Row.Cells(0).Width = Unit.Pixel(70) + e.Row.Cells(1).Width = Unit.Pixel(300) + e.Row.Cells(2).Width = Unit.Pixel(80) + e.Row.Cells(3).Width = Unit.Pixel(80) + e.Row.Cells(4).Width = Unit.Pixel(120) + e.Row.Cells(5).Width = Unit.Pixel(120) + e.Row.Cells(6).Width = Unit.Pixel(60) + End If + e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left + e.Row.Cells(2).HorizontalAlign = HorizontalAlign.Left + e.Row.Cells(3).HorizontalAlign = HorizontalAlign.Left + e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Left + e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Left + + Dim Liga As String = "" + e.Row.FCLiteral("LtlCodigo").Text = Liga & e.Row.FCLiteral("LtlCodigo").Text & "" + e.Row.FCLiteral("LtlPersonal").Text = Liga & e.Row.FCLiteral("LtlPersonal").Text & "" + End If + End Sub + + Protected Sub BtnConsultarAsistencia_Click(sender As Object, e As System.EventArgs) Handles BtnConsultarAsistencia.Click + Dim objpersonal As New ClsRH + If objpersonal.GetAsistencias(-1, CveCliente, -1, -1, -1, 1, txtFechaI.Text.Trim.ToDate, txtFechaF.Text.Trim.ToDate, UsuarioActual.CveEmpresa) Then + GVAsistencia.DataSource = objpersonal.DtResultados.FiltraParametros("Fecha IS NOT NULL") + Else + GVAsistencia.DataSource = Nothing + End If + objpersonal.Dispose() + GVAsistencia.DataBind() + UpDatos.Update() + End Sub + + Protected Sub GVAsistencia_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVAsistencia.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.RowIndex = 0 Then + e.Row.Cells(0).Width = Unit.Pixel(75) + e.Row.Cells(1).Width = Unit.Pixel(145) + e.Row.Cells(2).Width = Unit.Pixel(70) + e.Row.Cells(3).Width = Unit.Pixel(100) + e.Row.Cells(4).Width = Unit.Pixel(100) + e.Row.Cells(5).Width = Unit.Pixel(145) + e.Row.Cells(6).Width = Unit.Pixel(220) + End If + + e.Row.Cells(1).HorizontalAlign = HorizontalAlign.Left + e.Row.Cells(5).HorizontalAlign = HorizontalAlign.Left + e.Row.Cells(6).HorizontalAlign = HorizontalAlign.Left + + If IsDate(e.Row.DBCampo("Fecha")) Then e.Row.FCLiteral("LtlFecha").Text = e.Row.DBCampo("Fecha").ToDate.ToShortDateString + + If e.Row.DBCampo("SeModifico") = "0" Then + e.Row.BackColor = Drawing.Color.LightBlue + ElseIf e.Row.DBCampo("SeModifico") = "1" Then + e.Row.ForeColor = Drawing.Color.Red + End If + + End If + End Sub +#End Region + +#Region "S U C U R S A L E S" + Private Sub LbAgregarSucursal_Click(sender As Object, e As EventArgs) Handles LbAgregarSucursal.Click + ChkEstatusSucursal.Checked = True + DivEstatusSucursal.Visible = False + TxtNumeroCuenta.Text = "" + DdlMetodoPagoSucursal.SelectedIndex = 0 + UpAgregarSucursal.Update() + Me.CveClienteSuc = -1 + Me.Actualizar = False + txtLg.Text = "" + txtLt.Text = "" + HDMAPOP.Value = "2" + + UpModalDivMapa.Update() + + + RegistraScript("showDivEC();") + End Sub + Public Function CargaSucursalesCliente() As Boolean + Dim Retorno As Boolean = False + Dim ObjCliente As New ClsClientes + If ObjCliente.GetSucursales(CveCliente) Then + ViewState("DTSucursalesCliente") = ObjCliente.DtResultados + Retorno = True + Else + ViewState("DTSucursalesCliente") = Nothing + Me.GVSucursales.DataSource = Nothing + End If + + ObjCliente.Dispose() + + If ViewState("Orden").ToString() <> String.Empty Then + CargaGrid(ViewState("Orden").ToString(), 0) + Else + CargaGrid("", 0) + End If + Return Retorno + End Function + Protected Sub BtnAgregar_Click(sender As Object, e As System.EventArgs) Handles BtnAgregarSucursal.Click + Dim ObjCliente As New ClsClientes + + Dim LT As String = If(txtLt.Text.ToDouble <> 0, txtLt.Text, "0") + Dim LG As String = If(txtLg.Text.ToDouble <> 0, txtLg.Text, "0") + + If CveCliente > 0 Then + If Actualizar Then + + + Dim Estatus As Boolean = ChkEstatusSucursal.Checked + + + + If ObjCliente.UpdateSucursal(TxtNombreSucursal.Text.Trim, Estatus, CveCliente, CveClienteSuc, TxtCiudadSucursal.Text.Trim, TxtColoniaSucursal.Text.Trim, TxtCPSucursal.Text.Trim, TxtDireccionSucursal.Text.Trim, TxtEstadoSucursal.Text.Trim, TxtLocalidadSucursal.Text.Trim, TxtPaisSucursal.Text.Trim, TxtNumExtSucursal.Text.Trim, TxtNumIntSucursal.Text.Trim, + TxtTelefonoSucursal.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", ""), TxtCorreoSucursal.Text.Trim, TxtCorreoSucursalCotizacion.Text.Trim, TxtContactoSucursal.Text.Trim, DdlVendedorSucursal.SelectedValue.ToEntero, TxtNumeroCuenta.Text, DdlMetodoPagoSucursal.SelectedValue.ToEntero, TxtLimiteCreditoSucursal.Text.ToDecimal, DdlResponsableSucursal.SelectedValue.ToEntero, + DdlSucursalUsoCFDI.SelectedValue.ToEntero, DdlSucursalFormaPago33.SelectedValue.ToEntero, DdlSucursalMetodoPago33.SelectedValue.ToEntero, LT:=LT, LG:=LG) Then + GVSucursales.EditIndex = -1 + ViewState("DTSucursalesCliente") = ObjCliente.DtResultados + Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion) + End If + ObjCliente.Dispose() + + If ViewState("Orden").ToString() <> String.Empty Then + CargaGrid(ViewState("Orden").ToString(), 0) + Else + CargaGrid("", 0) + End If + + Else + If ObjCliente.AddSucursal(CveCliente, TxtNombreSucursal.Text.Trim, UsuarioActual.CveUsuario, TxtCiudadSucursal.Text.Trim, TxtColoniaSucursal.Text.Trim, TxtCPSucursal.Text.Trim, TxtDireccionSucursal.Text.Trim, TxtEstadoSucursal.Text.Trim, TxtLocalidadSucursal.Text.Trim, TxtPaisSucursal.Text.Trim, TxtNumExtSucursal.Text.Trim, TxtNumIntSucursal.Text.Trim, TxtTelefonoSucursal.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", ""), TxtCorreoSucursal.Text.Trim, TxtCorreoSucursalCotizacion.Text.Trim, TxtContactoSucursal.Text.Trim, + DdlVendedorSucursal.SelectedValue.ToEntero, TxtNumeroCuenta.Text, DdlMetodoPagoSucursal.SelectedValue.ToEntero, TxtLimiteCreditoSucursal.Text.ToDecimal, DdlResponsableSucursal.SelectedValue.ToEntero, + DdlSucursalUsoCFDI.SelectedValue.ToEntero, DdlSucursalFormaPago33.SelectedValue.ToEntero, DdlSucursalMetodoPago33.SelectedValue.ToEntero, LT:=LT, LG:=LG) Then + TxtNombreSucursal.Text = "" + TxtCiudadSucursal.Text = "" + TxtColoniaSucursal.Text = "" + TxtCPSucursal.Text = "" + TxtDireccionSucursal.Text = "" + TxtEstadoSucursal.Text = "" + TxtLocalidadSucursal.Text = "" + TxtPaisSucursal.Text = "" + TxtNumExtSucursal.Text = "" + TxtNumIntSucursal.Text = "" + TxtTelefonoSucursal.Text = "" + TxtCorreoSucursal.Text = "" + TxtCorreoSucursalCotizacion.Text = "" + TxtContactoSucursal.Text = "" + DdlVendedorSucursal.SelectedIndex = 0 + DdlMetodoPagoSucursal.SelectedIndex = 0 + TxtNumeroCuenta.Text = "" + TxtLimiteCreditoSucursal.Text = "" + DdlResponsableSucursal.SelectedIndex = 0 + DdlSucursalUsoCFDI.SelectedIndex = 0 + DdlSucursalFormaPago33.SelectedIndex = 0 + DdlSucursalMetodoPago33.SelectedIndex = 0 + Alert("La nueva Sucursal del Cliente se guardó correctamente.", TipoMensaje.MsgInformacion) + ViewState("DTSucursalesCliente") = ObjCliente.DtResultados + + If ViewState("Orden").ToString() <> String.Empty Then + CargaGrid(ViewState("Orden").ToString(), 0) + Else + CargaGrid("", 0) + End If + End If + End If + + Else + AddSucursalTemp() + End If + + txtLg.Text = "" + txtLt.Text = "" + + UpModalDivMapa.Update() + + + UpAgregarSucursal.Update() + CargaDdlSucursalCliente() + ObjCliente.Dispose() + Me.Actualizar = False Me.CveClienteSuc = -1 RegistraScript("hideDivEC();") - End Sub - Protected Sub LnkAgragarDireccion_Click(sender As Object, e As EventArgs) - - txtLg.Text = "0" - txtLt.Text = "0" - - RegistraScript("muestraMapa();") - HDMAPOP.Value = "1" - - UpModalDivMapa.Update() - - End Sub -#Region "G V S U C U R S A L E S" - Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVSucursales.RowDataBound - - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 0 Then - ' e.Row.Cells(0).Width = Unit.Pixel(150) - e.Row.Cells(1).Width = Unit.Pixel(40) - e.Row.Cells(2).Width = Unit.Pixel(40) - End If - e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left - - - - If Not CveCliente > 0 Then - e.Row.Cells(3).Visible = False - End If - End If - - End Sub - - Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GVSucursales.RowDeleting - Dim ObjCliente As New ClsClientes - - If CveCliente > 0 Then - If ObjCliente.RemoveSucursal(CveCliente, GVSucursales.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then - GVSucursales.EditIndex = -1 - ViewState("DTSucursalesCliente") = ObjCliente.DtResultados - Alert("La Sucursal del Cliente se eliminó correctamente.", TipoMensaje.MsgInformacion) - End If - Else - TempDTSucursales.Rows.RemoveAt(e.RowIndex) - TempDTSucursales.AcceptChanges() - GVSucursales.DataSource = TempDTSucursales - GVSucursales.DataBind() - UpDatos.Update() - End If - - ObjCliente.Dispose() - End Sub - Protected Sub GvDatos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GVSucursales.RowCancelingEdit - GVSucursales.EditIndex = -1 - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString(), 0) - Else - CargaGrid("", 0) - End If - End Sub - Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GVSucursales.RowUpdating - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString(), 0) - Else - CargaGrid("", 0) - End If - - End Sub - Protected Sub GvDatos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GVSucursales.RowEditing - - Me.Actualizar = True - Me.CveClienteSuc = GVSucursales.DataKeys(e.NewEditIndex).Value.ToString.ToEntero - - - Dim ObjCliente As New ClsClientes - - If ObjCliente.GetSucursales(CveCliente, CveClienteSuc) Then - - DivEstatusSucursal.Visible = True - TxtNombreSucursal.Text = ObjCliente.DtResultados.Rows(0)("SucursalCliente").ToString - ChkEstatusSucursal.Checked = If(ObjCliente.DtResultados.Rows(0)("Estatus").ToString = "Activo", True, False) - TxtCiudadSucursal.Text = ObjCliente.DtResultados.Rows(0)("Ciudad").ToString - TxtColoniaSucursal.Text = ObjCliente.DtResultados.Rows(0)("Colonia").ToString - TxtCPSucursal.Text = ObjCliente.DtResultados.Rows(0)("CP").ToString - TxtDireccionSucursal.Text = ObjCliente.DtResultados.Rows(0)("Direccion").ToString - TxtEstadoSucursal.Text = ObjCliente.DtResultados.Rows(0)("Estado").ToString - TxtLocalidadSucursal.Text = ObjCliente.DtResultados.Rows(0)("Localidad").ToString - TxtPaisSucursal.Text = ObjCliente.DtResultados.Rows(0)("Pais").ToString - TxtNumExtSucursal.Text = ObjCliente.DtResultados.Rows(0)("NoExt").ToString - TxtNumIntSucursal.Text = ObjCliente.DtResultados.Rows(0)("NoInt").ToString - TxtTelefonoSucursal.Text = ObjCliente.DtResultados.Rows(0)("Telefono").ToString - TxtCorreoSucursal.Text = ObjCliente.DtResultados.Rows(0)("Correo").ToString - TxtCorreoSucursalCotizacion.Text = ObjCliente.DtResultados(0)("CorreoCotizacion").ToString - TxtContactoSucursal.Text = ObjCliente.DtResultados.Rows(0)("Contacto").ToString - DdlVendedorSucursal.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveVendedor").ToString) - DdlMetodoPagoSucursal.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveMetodoPago").ToString) - TxtNumeroCuenta.Text = ObjCliente.DtResultados.Rows(0)("NumCtaPago").ToString - LblUsuarioSucursal.Text = String.Format("Usuario Registró: {0}", ObjCliente.DtResultados.Rows(0)("Usuario").ToString) - LblFechaSucursal.Text = String.Format("Fecha de Registro: {0}", ObjCliente.DtResultados.Rows(0)("FechaIng").ToString.ToDate.ToShortDateString) - TxtLimiteCreditoSucursal.Text = ObjCliente.DtResultados.Rows(0)("LimiteCredito").ToString.FormatoNumero - DdlResponsableSucursal.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveResponsableCobranza").ToString) - - DdlSucursalUsoCFDI.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveUsoCFDI").ToString) - DdlSucursalMetodoPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveMetodoPago33").ToString) - DdlSucursalFormaPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveFormaPago33").ToString) - - txtLg.Text = ObjCliente.DtResultados.Rows(0)("LG").ToString - txtLt.Text = ObjCliente.DtResultados.Rows(0)("LT").ToString - HDMAPOP.Value = "2" - - - UpAgregarSucursal.Update() - UpModalDivMapa.Update() - - 'Dim scriptReg As String = $" SelTxtLat = '#{ GVSucursales.Rows(e.NewEditIndex).FCTextBox("txtLt").ClientID}'; SelTxtLon = '#{ GVSucursales.Rows(e.NewEditIndex).FCTextBox("txtLg").ClientID}''" - 'RegistraScript("$('#divAgregarSucursal').modal();" & scriptReg) - - RegistraScript("$('#divAgregarSucursal').modal();") - - Else - Alert("No se pudieron cargar los datos de la sucursal") - End If - - ObjCliente.Dispose() - - If ViewState("Orden").ToString() <> String.Empty Then - CargaGrid(ViewState("Orden").ToString(), 0) - Else - CargaGrid("", 0) - End If - End Sub -#End Region - -#Region "G V U S U A R I O S P O R T A L" - Protected Sub GvUsuariosPortal_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvUsuariosPortal.RowCommand - If e.CommandName = "RestablecerContraseña" Then - Dim cveUsuarioPortal As Integer = e.CommandArgument.ToString.ToEntero - Dim Usuario As New ClsSisUsuarios - If Usuario.GetUsuariosPortal(cveUsuarioPortal, -1, -1) Then - Dim dr As DataRow = Usuario.DtResultados.FiltroPrimero("") - - If Usuario.UpdateUsuarioPortal(dr("Usuario").ToString, dr("Nombre").ToString, dr("Correo").ToString, CType(dr("Estatus"), Boolean), ContraseñaPredeterminadaEncriptada, CveCliente, -1, cveUsuarioPortal, UsuarioActual.CveUsuario) Then - - GvUsuariosPortal.EditIndex = -1 - ViewState("DTUsuariosCliente") = Usuario.DtResultados.FiltraParametros("Usuario <> 'Admin'") - Alert("Contraseña Restablecida.
    La nueva contraseña es: """ & ContraseñaPredeterminada & "", TipoMensaje.MsgInformacion) - End If - - End If - - Usuario.Dispose() - - End If - End Sub - - Protected Sub GvUsuariosPortal_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvUsuariosPortal.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - If e.Row.RowIndex = 0 Then - ''e.Row.Cells(0).Width = Unit.Pixel(180) - ''e.Row.Cells(1).Width = Unit.Pixel(180) - ''e.Row.Cells(2).Width = Unit.Pixel(180) - - ''e.Row.Cells(3).Width = Unit.Pixel(50) - ''e.Row.Cells(4).Width = Unit.Pixel(50) - ''e.Row.Cells(5).Width = Unit.Pixel(50) - ''e.Row.Cells(6).Width = Unit.Pixel(50) - ''e.Row.Cells(7).Width = Unit.Pixel(50) - ''e.Row.Cells(8).Width = Unit.Pixel(50) - ''e.Row.Cells(9).Width = Unit.Pixel(50) - ''e.Row.Cells(10).Width = Unit.Pixel(50) - ''e.Row.Cells(11).Width = Unit.Pixel(50) - ''e.Row.Cells(12).Width = Unit.Pixel(45) - - ''e.Row.Cells(3).Width = Unit.Pixel(68) - ''e.Row.Cells(4).Width = Unit.Pixel(70) - ''e.Row.Cells(5).Width = Unit.Pixel(130) - End If - - If e.Row.RowState = DataControlRowState.Alternate OrElse e.Row.RowState = DataControlRowState.Normal Then - If e.Row.DBCampo("Usuario") = "Admin" Then - - End If - End If - - End If - End Sub - - Protected Sub GvUsuariosPortal_RowEditing(ByVal sender As Object, ByVal e As GridViewEditEventArgs) Handles GvUsuariosPortal.RowEditing - - GvUsuariosPortal.EditIndex = e.NewEditIndex - - If ViewState("OrdenUsuarios").ToString() <> String.Empty Then - CargaGrid(ViewState("OrdenUsuarios").ToString(), 1) - Else - CargaGrid("", 1) - End If - 'CargaUsuariosPortal() - - End Sub - - Protected Sub GvUsuariosPortal_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Handles GvUsuariosPortal.RowUpdating - - Dim ObjUsuario As New ClsSisUsuarios - - Dim ErrorUsuario As Boolean = False - - Dim gvr As GridViewRow = GvUsuariosPortal.Rows(e.RowIndex) - - Dim Nombre As String = gvr.FCTextBox("TxtUsuarioPortalEdit").Text.Trim - Dim Correo As String = gvr.FCTextBox("TxtCorreoUsuarioPortalEdit").Text.Trim - Dim Estatus As Boolean = gvr.FCCheckBox("ChkEstatus").Checked - Dim CveUsuario As Integer = gvr.DataKey("CveUsuario").ToEntero - Dim pCveCliente As Integer = gvr.DataKey("CveCliente").ToEntero - - Dim PermisoHistorialCompras As Boolean = gvr.FCCheckBox("ChkPermiso1").Checked - Dim PermisoCxP As Boolean = gvr.FCCheckBox("ChkPermiso2").Checked - Dim PermisoAnticipo As Boolean = gvr.FCCheckBox("ChkPermiso3").Checked - Dim PermisoRH As Boolean = gvr.FCCheckBox("ChkPermiso4").Checked - Dim PermisoOS As Boolean = gvr.FCCheckBox("ChkPermiso5").Checked - Dim PermisoCotiza As Boolean = gvr.FCCheckBox("ChkPermiso6").Checked - Dim PermisoSistema As Boolean = gvr.FCCheckBox("ChkPermiso7").Checked - - ObjUsuario.IniciaTransacSQL() - - If ObjUsuario.UpdateUsuarioPortal(Correo, Nombre, Correo, Estatus, "-1", pCveCliente, -1, CveUsuario, UsuarioActual.CveUsuario) Then - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 229, PermisoHistorialCompras, UsuarioActual.CveUsuario) Then ErrorUsuario = True - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 230, PermisoCxP, UsuarioActual.CveUsuario) Then ErrorUsuario = True - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 231, PermisoAnticipo, UsuarioActual.CveUsuario) Then ErrorUsuario = True - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 232, PermisoOS, UsuarioActual.CveUsuario) Then ErrorUsuario = True - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 233, PermisoRH, UsuarioActual.CveUsuario) Then ErrorUsuario = True - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 234, PermisoSistema, UsuarioActual.CveUsuario) Then ErrorUsuario = True - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 235, PermisoCotiza, UsuarioActual.CveUsuario) Then ErrorUsuario = True - End If - - If ErrorUsuario Then - ObjUsuario.RollBack() - Else - ObjUsuario.Commit() - End If - - GvUsuariosPortal.EditIndex = -1 - - ObjUsuario.GetUsuariosPortal(-1, CveCliente, -1) - ViewState("DTUsuariosCliente") = ObjUsuario.DtResultados - - ObjUsuario.Dispose() - - If ViewState("OrdenUsuarios").ToString() <> String.Empty Then - CargaGrid(ViewState("OrdenUsuarios").ToString(), 1) - Else - CargaGrid("", 1) - End If - - End Sub - - Protected Sub GvUsuariosPortal_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GvUsuariosPortal.RowDeleting - - Dim Usuario As New ClsSisUsuarios - If Usuario.RemoveUsuarioPortal(GvUsuariosPortal.DataKeys(e.RowIndex).Value.ToString().ToEntero()) Then - GvUsuariosPortal.EditIndex = -1 - ViewState("DTUsuariosCliente") = Usuario.DtResultados - End If - - Usuario.Dispose() - - If ViewState("OrdenUsuarios").ToString() <> String.Empty Then - CargaGrid(ViewState("OrdenUsuarios").ToString(), 1) - Else - CargaGrid("", 1) - End If - - End Sub - - Protected Sub GvUsuariosPortal_RowCancelingEdit(ByVal sender As Object, ByVal e As GridViewCancelEditEventArgs) Handles GvUsuariosPortal.RowCancelingEdit - - GvUsuariosPortal.EditIndex = -1 - - If ViewState("OrdenUsuarios").ToString() <> String.Empty Then - CargaGrid(ViewState("OrdenUsuarios").ToString(), 1) - Else - CargaGrid("", 1) - End If - - End Sub -#End Region - -#Region "O R D E N A M I E N T O" - Private Sub CargaGrid(Orden As String, gvi As Integer) - If gvi = 0 Then - If CType(ViewState("DTSucursalesCliente"), DataTable).Rows.Count > 0 Then - If Orden <> String.Empty Then - Dim DV As New DataView(CType(ViewState("DTSucursalesCliente"), DataTable), "", Orden, DataViewRowState.CurrentRows) - GVSucursales.DataSource = DV.ToTable() - DV.Dispose() - Else - GVSucursales.DataSource = CType(ViewState("DTSucursalesCliente"), DataTable) - End If - ViewState("Orden") = Orden - GVSucursales.DataBind() - UpDatos.Update() - End If - ElseIf gvi = 1 Then - If CType(ViewState("DTUsuariosCliente"), DataTable).Rows.Count > 0 Then - If Orden <> String.Empty Then - Dim DV As New DataView(CType(ViewState("DTUsuariosCliente"), DataTable), "", Orden, DataViewRowState.CurrentRows) - GvUsuariosPortal.DataSource = DV.ToTable() - DV.Dispose() - Else - GvUsuariosPortal.DataSource = CType(ViewState("DTUsuariosCliente"), DataTable) - End If - - End If - ViewState("OrdenUsuarios") = Orden - GvUsuariosPortal.DataBind() - UPPUsuarios.Update() - End If - - End Sub -#End Region - - -#End Region - -#Region "U S U A R I O S" - Protected Sub LbSolicitudPortal_Click(sender As Object, e As EventArgs) Handles LbEnviarActivacionPortal.Click - Dim ObjUsuario As New ClsSisUsuarios - Dim CveUsr As Integer = HdnCveUsuarioPortalAdmin.Value.ToEntero - Dim Usuario As String = TxtEmail.Text - Dim NomUsuario As String = "Admin" - Dim CorreoUsuario As String = TxtEmail.Text - Dim CvePlataforma As Integer = 6 - Dim ErrorUsuario As Boolean = True - 'DECLARAMOS PERMISOS DE ADMIN - Dim Permisos() As Integer = {234, 233, 232, 231, 230, 229} - - If Not CveCliente > 0 Then - Alert("Favor de guardar los datos del cliente antes de activar el Portal del Cliente.", TipoMensaje.MsgAdvertencia) - Return - End If - - ObjUsuario.IniciaTransacSQL() - - 'AGREGAMOS USUARIO ADMIN NUEVO - If CveUsr = 0 Then - 'CREA USUARIO - CveUsr = ObjUsuario.AddUsuarioPortal(Usuario, ContraseñaPredeterminadaEncriptada, NomUsuario, CorreoUsuario, CveCliente, -1, CvePlataforma, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If CveUsr > 0 Then - ' AGREGA PERMISO A MODULO PORTALCLIENTE - If ObjUsuario.UpdateUsuariosModulos(CveUsr, 1101, True, UsuarioActual.CveUsuario) Then - 'AGREGAMOS PERMISOS A ADMIN - For Each permiso In Permisos - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsr, permiso, True, UsuarioActual.CveUsuario) Then - ErrorUsuario = True - Exit For - End If - ErrorUsuario = False - Next - If Not ErrorUsuario Then - HdnCveUsuarioPortalAdmin.Value = CveUsr.ToString - trDesactivarUsuario.Visible = True - trEnviarActivacion.Visible = False - LblUsuarioActivo.Text = "Si" - 'DivPermisosPortal.Visible = False - End If - End If - End If - Else - 'ACTUALIZAMOS ESTADO DE USARIO ADMIN INACTIVO - If ObjUsuario.UpdateUsuarioPortal(Usuario, "Admin", CorreoUsuario, True, ContraseñaPredeterminadaEncriptada, CveCliente, -1, CveUsr, UsuarioActual.CveUsuario) Then - - 'ACTUALIZAMOS PERMISOS A ADMIN - For Each permiso In Permisos - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsr, permiso, True, UsuarioActual.CveUsuario) Then - ErrorUsuario = True - Exit For - End If - ErrorUsuario = False - Next - If Not ErrorUsuario Then - HdnCveUsuarioPortalAdmin.Value = CveUsr.ToString - trDesactivarUsuario.Visible = True - trEnviarActivacion.Visible = False - LblUsuarioActivo.Text = "Si" - 'DivPermisosPortal.Visible = True - - End If - End If - End If - - 'VERIFICAMOS SI HUBO ERRORES - If ErrorUsuario Then - ObjUsuario.RollBack() - CveUsr = -1 - Else - ObjUsuario.Commit() - End If - - If CveUsr > 0 Then - 'ENVIA CORREO DE ACTIVACION - Dim ObjParametro As SisParametro = GlobalDTParametros(SisParametros.URL) - Dim Liga As String = ObjParametro.Cadena1 & "LogIn.aspx" - - If UsuarioActual.CveEmpresa = 43 Then - Liga = ObjParametro.Cadena1 & "AIMMGM/Portal.aspx" - End If - - Dim LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & CveUsr & "&Clave=" & "-acceso-" & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks& & "&CveE=" & UsuarioActual.CveEmpresa) - - If UsuarioActual.Empresa.CvePlataforma = 3 Then - EnviaCorreoGPS(Liga, LigaActivar) - Else - EnviaCorreo(Liga, LigaActivar) - End If - - 'HABILITA Y ACTUALIZA SECCION AGREGAR NUEVOS USUARIOS - ObjUsuario.GetUsuariosPortal(-1, CveCliente, -1) - - ViewState("DTUsuariosCliente") = ObjUsuario.DtResultados - GvUsuariosPortal.DataSource = ViewState("DTUsuariosCliente") - GvUsuariosPortal.DataBind() - 'divUsuariosPortal.Visible = True - ObjUsuario.Dispose() - - If UsuarioActual.Empresa.CvePlataforma = 1 Then - CargaUsuariosPortalCliente() - End If - - UpGvUsuarios.Update() - UPPUsuarios.Update() - End If - End Sub - - Protected Sub LnkAgregarUsuario_Click(sender As Object, e As EventArgs) Handles LnkAgregarUsuario.Click - Dim ObjParametro As SisParametro = GlobalDTParametros(SisParametros.URL) - Dim ObjUsuario As New ClsSisUsuarios - - Dim Liga As String = ObjParametro.Cadena1 & "Login.aspx" - Dim CveUsuario = -1 - Dim CvePlataforma As Integer = 6 - Dim ErrorUsuario As Boolean = False - - If UsuarioActual.CveEmpresa = 43 Then - Liga = ObjParametro.Cadena1 & "AIMMGM/Portal.aspx" - End If - - Dim PermisoHistorialCompras As Boolean = ChkPermiso1.Checked - Dim PermisoCxP As Boolean = ChkPermiso2.Checked - Dim PermisoAnticipo As Boolean = ChkPermiso3.Checked - Dim PermisoRH As Boolean = ChkPermiso4.Checked - Dim PermisoOS As Boolean = ChkPermiso5.Checked - Dim PermisoCotiza As Boolean = ChkPermiso6.Checked - Dim PermisoSistema As Boolean = ChkPermiso7.Checked - - ObjUsuario.IniciaTransacSQL() - - CveUsuario = ObjUsuario.AddUsuarioPortal(TxtCorreoUsuarioPortal.Text, ContraseñaPredeterminadaEncriptada, TxtNombreUsuarioPortal.Text, TxtCorreoUsuarioPortal.Text, CveCliente, -1, CvePlataforma, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - If CveUsuario > 0 Then - If ObjUsuario.UpdateUsuariosModulos(CveUsuario, 1101, True, UsuarioActual.CveUsuario) Then - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 229, PermisoHistorialCompras, UsuarioActual.CveUsuario) Then ErrorUsuario = True - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 230, PermisoCxP, UsuarioActual.CveUsuario) Then ErrorUsuario = True - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 231, PermisoAnticipo, UsuarioActual.CveUsuario) Then ErrorUsuario = True - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 232, PermisoOS, UsuarioActual.CveUsuario) Then ErrorUsuario = True - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 233, PermisoRH, UsuarioActual.CveUsuario) Then ErrorUsuario = True - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 234, PermisoSistema, UsuarioActual.CveUsuario) Then ErrorUsuario = True - If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 235, PermisoCotiza, UsuarioActual.CveUsuario) Then ErrorUsuario = True - End If - End If - - If ErrorUsuario Then - ObjUsuario.RollBack() - Else - ObjUsuario.Commit() - - Dim LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & CveUsuario & "&Clave=" & "-acceso-" & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks& & "&CveE=" & UsuarioActual.CveEmpresa) - EnviaCorreo2(Liga, LigaActivar) - - LimpiaAgregarUsuarioPortal() - - Alert("Usuario Creado.
    El usuario accesará con la contraseña '" & ContraseñaPredeterminada & "'", TipoMensaje.MsgInformacion) - End If - - ObjUsuario.GetUsuariosPortal(-1, CveCliente, -1) - ViewState("DTUsuariosCliente") = ObjUsuario.DtResultados - - ObjUsuario.Dispose() - - If ViewState("OrdenUsuarios").ToString() <> String.Empty Then - CargaGrid(ViewState("OrdenUsuarios").ToString(), 1) - Else - CargaGrid("", 1) - End If - End Sub - - Protected Sub LimpiaAgregarUsuarioPortal() - TxtNombreUsuarioPortal.Text = "" - TxtCorreoUsuarioPortal.Text = "" - - ChkPermiso1.Checked = False - ChkPermiso2.Checked = False - ChkPermiso3.Checked = False - ChkPermiso4.Checked = False - ChkPermiso5.Checked = False - ChkPermiso6.Checked = False - ChkPermiso7.Checked = False - End Sub -#End Region - -#Region "E V E N T O - B I T A C O R A" - Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.RowIndex = 0 Then - e.Row.Cells(0).Width = Unit.Pixel(175) - e.Row.Cells(1).Width = Unit.Pixel(175) - e.Row.Cells(2).Width = Unit.Pixel(100) - e.Row.Cells(4).Width = Unit.Pixel(30) - End If - - If e.Row.DBCampo("Archivo").ToString <> "" Then - e.Row.FCLinkButton("LinkArchivo").Visible = True - e.Row.FCLinkButton("LinkArchivo").CommandArgument = String.Format("OI\{0}", e.Row.DBCampo("Archivo").ToString) - ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LinkArchivo")) 'Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione - End If - - End If - End Sub - Protected Sub BtnGuardarEventoBitacora_Click(sender As Object, e As EventArgs) Handles BtnGuardarEventoBitacora.Click - Dim ObjEventoBitacora As New ClsOIEventos - - Dim FileExtension As String = "-1" - Dim filesgral As List(Of Archivo) = Anexo.getfiles().Archivos - Dim filemove As String = "" - - For Each fileItem As Archivo In filesgral - FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - filemove = fileItem.filename - Next - - If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then - If filemove <> "" Then - filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) - End If - - GvEB.DataSource = ObjEventoBitacora.DtResultados - TxtEventoDescripcion.Text = "" - Anexo.Text = "[]" - Alert("La bitácora/observación se guardó correctamente", TipoMensaje.MsgInformacion) - RegistraScript("$('#ModalBitacora').modal('hide')", "hidemodal") - End If - ObjEventoBitacora.Dispose() - GvEB.DataBind() - - UPEventoBitacora.Update() - CargaEventoBitacora() - UPAddEventoBitacora.Update() - End Sub - Private Sub CargaEventoBitacora() - Dim ObjEventoBitacora As New ClsOIEventos() - If ObjEventoBitacora.GetAgendaBitacora(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente:=CveCliente) Then - GvEB.DataSource = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento = 6 OR CveTipoEvento = 2") - Else - GvEB.DataSource = Nothing - End If - ObjEventoBitacora.Dispose() - GvEB.DataBind() - End Sub - - Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs) - Dim filePath As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, CType(sender, LinkButton).CommandArgument) - Dim Archivo As New System.IO.FileInfo(filePath) - - HttpContext.Current.Response.Clear() - HttpContext.Current.Response.ClearContent() - HttpContext.Current.Response.ContentType = "application/octet-stream" - HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" + Path.GetFileName(filePath)) - HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString()) - HttpContext.Current.Response.TransmitFile(filePath) - HttpContext.Current.Response.Flush() - HttpContext.Current.Response.End() - - Archivo = Nothing - End Sub - - - Private Sub BtnCancelarSucursal_Click(sender As Object, e As EventArgs) Handles BtnCancelarSucursal.ServerClick - GvDatos_RowCancelingEdit(Nothing, Nothing) - End Sub - - Public Sub BtnAgregaCuentaContable(sender As Object, e As EventArgs) Handles BtnActivaRegistroClientes.Click, BtnActivaRegistroAnticipos.Click, BtnActivaRegistroIVA.Click, BtnActivaRegistroISR.Click - Dim CuentaContable = DirectCast(sender, Button).CommandArgument.ToString - Dim Button = DirectCast(sender, Button) - Select Case CuentaContable - Case "Clientes" - AgregarCuentaContable(Button, DdlCtaContableClientes) - Case "Anticipos" - AgregarCuentaContable(Button, DdlCtaContableAnticipos) - Case "RetIVA" - AgregarCuentaContable(Button, DdlCtaContableRetIVA) - Case "RetISR" - AgregarCuentaContable(Button, DdlCtaContableRetISR) - End Select - - End Sub - - Private Function AgregarCuentaContable(btn As Button, ddl As DropDownList) As Boolean - Dim IdCuentaContable As Integer = -1 - Dim CtaCodigo As String = "" - Dim TieneError = False - Dim IdCtaContableClientes As Integer = -1, IdCtaContableAnticipos As Integer = -1, IdCtaContableRetIVA As Integer = -1, IdCtaContableRetISR As Integer = -1 - Dim ProcesoCorrecto As Boolean - - Dim ObjContaAC As New ClsContPAQi(UsuarioActual.Empresa) - - ObjContaAC.IniciaTransacSQL() - - Dim CuentaPadre = -1 - - Select Case btn.CommandArgument.ToString - Case "Clientes" - CuentaPadre = UsuarioActual.Empresa.Funcionalidad(211).ToEntero - Case "Anticipos" - CuentaPadre = UsuarioActual.Empresa.Funcionalidad(212).ToEntero - Case "RetIVA" - CuentaPadre = UsuarioActual.Empresa.Funcionalidad(213).ToEntero - Case "RetISR" - CuentaPadre = UsuarioActual.Empresa.Funcionalidad(214).ToEntero - - End Select - - 'SI EL NOMBRE DEL PROVEEDOR ES MAYOR DE 50 LO CORTAMOS - Dim NombreCuenta = If(TxtNombreComercial.Text.Trim.Length > 50, TxtNombreComercial.Text.Trim.Substring(0, 50), TxtNombreComercial.Text.Trim) - - IdCuentaContable = ObjContaAC.AddSiguienteCuentaHijo(CuentaPadre, NombreCuenta, Tipo:="A", CuentaMayor:=2) - If IdCuentaContable > 0 Then - - ObjContaAC.GetCuentas(IdCuentaContable, "-1", -1) - Dim dt = ObjContaAC.DtResultados - - If dt.Rows.Count = 1 Then - - Dim row As DataRow = dt.Rows(0) - CtaCodigo = CStr(row("CtaCodigo")) - - Select Case btn.CommandArgument.ToString - Case "Clientes" - IdCtaContableClientes = IdCuentaContable - Case "Anticipos" - IdCtaContableAnticipos = IdCuentaContable - Case "RetIVA" - IdCtaContableRetIVA = IdCuentaContable - Case "RetISR" - IdCtaContableRetISR = IdCuentaContable - End Select - - - Dim ObjClientes As New ClsClientes - If Not ObjClientes.VincularCuentasContables(IdCtaContableClientes, IdCtaContableAnticipos, IdCtaContableRetIVA, IdCtaContableRetISR, CveCliente) Then - TieneError = True - End If - - ObjClientes.Dispose() - - Else - TieneError = True - End If - - Else - TieneError = True - End If - - If Not TieneError Then - ObjContaAC.Commit() - Alert(String.Format("Se registo la Cuenta Contable: {0}", CtaCodigo, TipoMensaje.MsgInformacion)) - ddl.Items.Add(New ListItem(CtaCodigo, IdCuentaContable.ToString)) : ddl.SelectedValueExist(IdCuentaContable.ToString) - btn.Visible = False - ddl.Width = 206 - ProcesoCorrecto = True - Else - ObjContaAC.RollBack() - Alert("error", TipoMensaje.MsgError) - ProcesoCorrecto = False - End If - - - ObjContaAC.Dispose() - UpFiscalContable.Update() - - - Return ProcesoCorrecto - End Function - - Private Sub ActivarRegistroAutomatico() - - 'Clientes - If DdlCtaContableClientes.SelectedValue.ToEntero <= 0 And UsuarioActual.Empresa.Funcionalidad(211).ToEntero > 0 Then - BtnActivaRegistroClientes.Visible = True - End If - - 'Anticipos - If DdlCtaContableAnticipos.SelectedValue.ToEntero <= 0 And UsuarioActual.Empresa.Funcionalidad(212).ToEntero > 0 Then - BtnActivaRegistroAnticipos.Visible = True - End If - - 'Ret IVA - If DdlCtaContableRetIVA.SelectedValue.ToEntero <= 0 And UsuarioActual.Empresa.Funcionalidad(213).ToEntero > 0 Then - BtnActivaRegistroIVA.Visible = True - End If - - 'Ret ISR - If DdlCtaContableRetISR.SelectedValue.ToEntero <= 0 And UsuarioActual.Empresa.Funcionalidad(214).ToEntero > 0 Then - BtnActivaRegistroISR.Visible = True - End If - - End Sub -#End Region - -#Region " I M P R I M I R P D F" - - Protected Sub ChkAntIXCNC_CheckedChanged(sender As Object, e As EventArgs) - DdlTipoDocto.ClearSelection() - If ChkAntIXCNC.Checked Then - DdlTipoDocto.SelectedValuesIfExistM("Ing,Rem,Ant,Egs,IxC") - Else - DdlTipoDocto.SelectedValuesIfExistM("Ing,Rem") - End If - End Sub - Protected Sub LnkGenerarReporteCxC_Click(sender As Object, e As EventArgs) Handles LnkGenerarReporteCxC.Click - GenerarPDFCrystal(RBLGenerarReporteCxC.SelectedValue) - End Sub - - Protected Sub GenerarReporte(sender As Object, e As EventArgs) - GenerarRepCrystal() - End Sub - Private Sub GenerarRepCrystal() - Dim Archivo As New FileInfo(Server.MapPath("~/Empresas/Grales/Formatos/EquiposGPS.rpt")) - Dim lista = New List(Of CrystalParametro) - lista.Add(New CrystalParametro("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - lista.Add(New CrystalParametro("NombreUsuario", UsuarioActual.Nombre)) - - Dim ObjGPS As New ClsGPS - Dim tablaReporte As DataTable - If ObjGPS.DispositivosGet(-1, Estatus, CveCliente) Then - tablaReporte = ObjGPS.DtResultados - Dim VistaFiltro As DataView = New DataView(tablaReporte) - Dim reporteDatos As DataTable = VistaFiltro.ToTable("Selected", False, "TipoDispositivoDisplay", "Display", "Modelo", "Serie", "IMEI", "NumeroTelefono", "FechaIng") - Dim file As Byte() = ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/EquiposGPS.rpt"), reporteDatos, lista) - ImprimirbytesPDF(file) - Else - Alert("No hay lista de dispositivos para imprimir") - End If - - End Sub - - Private Sub GenerarPDFCrystal(Optional Formato As String = "PDF") - Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/RepClientesCxC.rpt", UsuarioActual.Empresa.Ruta)) - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - 'OBTENEMOS LOS DATOS - - Dim DtCxCFact As DataTable = Nothing - - Dim FI = If(TxtFechaInicioCxP.Text = "" Or TxtFechaInicioCxP.Text = "__/__/____", "-1", TxtFechaInicioCxP.Text) - Dim FF = If(TxtFechaFinCxP.Text = "" Or TxtFechaFinCxP.Text = "__/__/____", "-1", TxtFechaFinCxP.Text) - - Dim SaldoIngDolares As Double = 0 - Dim SaldoIngPesos As Double = 0 - Dim SaldoIngDolaresPesos As Double = 0 - Dim TotalIng As Double = 0 - - Dim SaldoAntDolares As Double = 0 - Dim SaldoAntPesos As Double = 0 - Dim SaldoAntDolaresPesos As Double = 0 - Dim TotalAnt As Double = 0 - Dim ContaIng As Integer = 0 - Dim ContaAnt As Integer = 0 - Dim FechaCorte As Date = ("9999/01/01").ToDate - Dim TipoDocto As String = If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM) - Dim TipoDocto2 As String = If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM(True)) - Dim FechaVencimientoI As String = If(TxtFechaVICxP.Text = "", "-1", TxtFechaVICxP.Text).ToString - Dim FechaVencimientoF As String = If(TxtFechaVFCxP.Text = "", "-1", TxtFechaVFCxP.Text).ToString - - Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetCxCClienteDetalle(CveCliente, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, DdlSucursalCliente.SelectedValue.ToEntero) Then - DtCxCFact = If(DdlTipoCuentasCxC.SelectedValue = "-1", ObjMovtos.DtResultados.FiltraParametros("", "TipoDocto").Copy, ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act'", "TipoDocto")) - 'cargo los anticipos NC - DtCxCFact.Columns.Add("SaldoAnticipo", GetType(Decimal)) - - Dim dtt As DataTable = Nothing - If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, -1, -1) Then - dtt = If(DdlTipoCuentasCxC.SelectedValue = "-1", ObjMovtos.DtResultados.FiltraParametros("SaldoVentaAnticipo = 0 AND ((Tipo = 'IxC' AND CveIE > 0) OR (Tipo = 'Ant' AND CveVenta > 0) OR (Tipo = 'NC' AND CveVenta > 0) OR (Tipo = 'Egs' AND CveVenta > 0) )"), ObjMovtos.DtResultados.FiltraParametros("Saldo > 0 AND SaldoVentaAnticipo = 0 AND ((Tipo = 'IxC' AND CveIE > 0) OR (Tipo = 'Ant' AND CveVenta > 0) OR (Tipo = 'NC' AND CveVenta > 0) OR (Tipo = 'Egs' AND CveVenta > 0) )")) ' que tenga saldo de anticipo y no de cliente - If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then - For Each drt As DataRow In dtt.Rows - Dim drr As DataRow = DtCxCFact.NewRow - - drr("TipoDocto") = drt("Tipo") - drr("SerieFolio") = drt("Folio") - drr("Original") = drt("Original") - drr("TipoCambio") = drt("TipoCambio") - drr("Saldo") = 0 - drr("SaldoAnticipo") = drt("Saldo") - drr("Fecha") = drt("Fecha") - drr("Moneda") = drt("Moneda") - drr("CveMoneda") = drt("CveMoneda") - DtCxCFact.Rows.Add(drr) - - Next - End If - - End If - - End If - ObjMovtos.Dispose() - - If DtCxCFact IsNot Nothing Then - For Each Row As DataRow In DtCxCFact.FiltraParametros($"TipoDocto IN ({TipoDocto2})").Rows - If Row("TipoDocto").ToString = "Ing" Or Row("TipoDocto").ToString = "Rem" Or (Row("TipoDocto").ToString = "Ant" And Row("Saldo").ToString.ToDouble > 0) Then 'Ingresos - ContaIng = ContaIng + 1 - If Row("CveMoneda").ToString.ToEntero = 1 Then - SaldoIngPesos = SaldoIngPesos + Row("Saldo").ToString.ToDouble - ElseIf Row("CveMoneda").ToString.ToEntero = 2 Then - SaldoIngDolares = SaldoIngDolares + Row("Saldo").ToString.ToDouble - SaldoIngDolaresPesos = SaldoIngDolaresPesos + (Row("Saldo").ToString.ToDouble * Row("TipoCambio").ToString.ToDouble) - End If - - ElseIf (Row("TipoDocto").ToString = "Ant" And Row("Saldo").ToString.ToDouble = 0) Or Row("TipoDocto").ToString = "IxC" Or Row("TipoDocto").ToString = "NC" Or Row("TipoDocto").ToString = "Dev" Then 'Anticipos, NC, IxC - ContaAnt = ContaAnt + 1 - If Row("CveMoneda").ToString.ToEntero = 1 Then - If Row("TipoDocto").ToString = "Dev" Then - SaldoAntPesos = SaldoAntPesos + Row("Saldo").ToString.ToDouble - Else - SaldoAntPesos = SaldoAntPesos + Row("SaldoAnticipo").ToString.ToDouble - End If - ElseIf Row("CveMoneda").ToString.ToEntero = 2 Then - SaldoAntDolares = SaldoAntDolares + Row("Saldo").ToString.ToDouble - SaldoAntDolaresPesos = SaldoAntDolaresPesos + (Row("SaldoAnticipo").ToString.ToDouble * Row("TipoCambio").ToString.ToDouble) - End If - End If - Next - End If - - TotalIng = SaldoIngPesos + SaldoIngDolaresPesos - TotalAnt = SaldoAntPesos + SaldoAntDolaresPesos - - Dim DtCxCFact2 As DataTable = DtCxCFact.FiltraParametros($"TipoDocto IN ({TipoDocto2})") - - 'INGRESOS - If SaldoIngPesos > 0 Then - Dim drr As DataRow = DtCxCFact2.NewRow - drr("SerieFolio") = "Total Ing Pesos" - drr("Original") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Original", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)") - drr("Abonado") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Abonado", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)") - drr("Saldo") = SaldoIngPesos - drr("CveMoneda") = 1 - DtCxCFact2.Rows.Add(drr) - End If - If SaldoIngDolares > 0 Then - Dim drr As DataRow = DtCxCFact2.NewRow - drr("SerieFolio") = "Total Ing Dólares" - drr("Original") = DtCxCFact2.FiltraParametros("CveMoneda = 2").SUM("Original", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)") - drr("Abonado") = DtCxCFact2.FiltraParametros("CveMoneda = 2").SUM("Abonado", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)") - drr("Saldo") = SaldoIngDolares - drr("CveMoneda") = 2 - DtCxCFact2.Rows.Add(drr) - End If - - 'ANTICIPOS - If SaldoAntPesos > 0 Then - Dim drr As DataRow = DtCxCFact2.NewRow - drr("SerieFolio") = "Total Pesos" - 'drr("Original") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Original", "TipoDocto IN ('IxC','Egs,'Dev') OR (TipoDocto = 'Ant' AND Saldo = 0)") - 'drr("Abonado") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Abonado", "TipoDocto IN ('IxC','Egs','Dev') OR (TipoDocto = 'Ant' AND Saldo = 0)") - drr("SaldoAnticipo") = SaldoAntPesos - drr("CveMoneda") = 1 - DtCxCFact2.Rows.Add(drr) - End If - If SaldoAntDolares > 0 Then - Dim drr As DataRow = DtCxCFact2.NewRow - drr("SerieFolio") = "Total Dólares" - ' drr("Original") = DtCxCFact2.FiltraParametros("CveMoneda = 2").SUM("Original", "TipoDocto IN ('IxC','Egs,'Dev') OR (TipoDocto = 'Ant' AND Saldo = 0)") - ' drr("Abonado") = DtCxCFact2.FiltraParametros("CveMoneda = 2").SUM("Abonado", "TipoDocto IN ('IxC','Egs,'Dev') OR (TipoDocto = 'Ant' AND Saldo = 0)") - drr("SaldoAnticipo") = SaldoAntDolares - drr("CveMoneda") = 2 - DtCxCFact2.Rows.Add(drr) - End If - - If DtCxCFact2 IsNot Nothing AndAlso DtCxCFact2.Rows.Count > 0 Then - Dim dr As DataRow = DtCxCFact2.Rows(0) - Dim lista = New List(Of CrystalParametro) - lista.Add(New CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa)) - lista.Add(New CrystalParametro("TipoCuentas", DdlTipoCuentasCxC.SelectedItem.Text)) - lista.Add(New CrystalParametro("NombreCliente", LtlCliente.Text)) - lista.Add(New CrystalParametro("FechaInicio", If(FI = "-1", "-", FI))) - lista.Add(New CrystalParametro("FechaFin", If(FF = "-1", DateTime.Now.ToShortDateString, FF))) - lista.Add(New CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre)) - lista.Add(New CrystalParametro("DireccionCliente", String.Format("Calle {0} #{1} Colonia {2}", TxtDireccion.Text, If(TxtNoExt.Text = "", "S/N", TxtNoExt.Text), TxtColonia.Text))) - lista.Add(New CrystalParametro("ClienteCP", TxtCP.Text)) - lista.Add(New CrystalParametro("ClienteCiudad", TxtCiudad.Text)) - lista.Add(New CrystalParametro("ClienteRFC", TxtRFC.Text)) - lista.Add(New CrystalParametro("ClienteTelefono", TxtTelefono.Text)) - lista.Add(New CrystalParametro("DiasCredito", TxtPlazoCobranza.Text)) - lista.Add(New CrystalParametro("LimiteCredito", TxtLimiteCredito.Text)) - lista.Add(New CrystalParametro("SaldoDisponible", (TxtLimiteCredito.Text.ToDouble - DtCxCFact2(0)("Saldo").ToString.ToDouble).FormatoNumero)) - - lista.Add(New CrystalParametro("SaldoIngDolares", SaldoIngDolares.FormatoNumero)) - lista.Add(New CrystalParametro("SaldoIngPesos", SaldoIngPesos.FormatoNumero)) - lista.Add(New CrystalParametro("TotalIng", TotalIng.FormatoNumero)) - lista.Add(New CrystalParametro("SaldoAntDolares", SaldoAntDolares.FormatoNumero)) - lista.Add(New CrystalParametro("SaldoAntPesos", SaldoAntPesos.FormatoNumero)) - lista.Add(New CrystalParametro("TotalAnt", TotalAnt.FormatoNumero)) - lista.Add(New CrystalParametro("ContaIng", ContaIng)) - lista.Add(New CrystalParametro("ContaAnt", ContaAnt)) - - - - If Imagen.Exists Then - lista.Add(New CrystalParametro("LogoPath", logouri)) - Else - lista.Add(New CrystalParametro("LogoPath", "")) - End If - - If ChkCobranzaEnviarCorreo.Checked Then - Try - Dim File As Byte() - If Archivo.Exists Then - File = ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato) - Else - File = ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/RepClientesCxC.rpt"), DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato) - End If - - Try - Dim Cuerpo As String = String.Format("Estimado cliente {0}, al presente del correo se anexa su estado actual de cartera en {1}.
    -
    - Quedamos a sus ordenes para cualquier duda o aclaración con su agente de Ventas.
    -
    -
    - Gracias por la atención brindada al presente.
    Reciba un cordial saludo.
    -
    - ESTE CORREO SE GENERO EN FORMA AUTOMATICA.", TxtNombreComercial.Text, UsuarioActual.Empresa.Empresa) - Dim Hilo As New System.Threading.Thread(Sub() MandaCorreoEstadoCuenta(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Me.CveCliente, File, TxtCobranzaCorreo.Text, $"Estado Actual de Cartera {UsuarioActual.Empresa.Empresa}", Cuerpo, GuardarBitacora:=True)) - Hilo.Start() - Alert("El correo se envió con éxito", TipoMensaje.MsgInformacion) - Catch ex As Exception - Alert("Ocurrió un error al enviar el correo", TipoMensaje.MsgAdvertencia) - - End Try - - Catch ex As Exception - OnError("Ocurrió error al mandar MAIL de Orden de Compra", ex) - End Try - Else - If Archivo.Exists Then - ImprimirbytesPDF(ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) - Else - ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/RepClientesCxC.rpt"), DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) - End If - - End If - Else - Dim lista = New List(Of CrystalParametro) - lista.Add(New CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa)) - lista.Add(New CrystalParametro("TipoCuentas", DdlTipoCuentasCxC.SelectedItem.Text)) - lista.Add(New CrystalParametro("NombreCliente", LtlCliente.Text)) - lista.Add(New CrystalParametro("FechaInicio", If(FI = "-1", "-", FI))) - lista.Add(New CrystalParametro("FechaFin", If(FF = "-1", DateTime.Now.ToShortDateString, FF))) - lista.Add(New CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre)) - lista.Add(New CrystalParametro("DireccionCliente", String.Format("Calle {0} #{1} Colonia {2}", TxtDireccion.Text, If(TxtNoExt.Text = "", "S/N", TxtNoExt.Text), TxtColonia.Text))) - lista.Add(New CrystalParametro("ClienteCP", TxtCP.Text)) - lista.Add(New CrystalParametro("ClienteCiudad", TxtCiudad.Text)) - lista.Add(New CrystalParametro("ClienteRFC", TxtRFC.Text)) - lista.Add(New CrystalParametro("ClienteTelefono", TxtTelefono.Text)) - lista.Add(New CrystalParametro("DiasCredito", TxtPlazoCobranza.Text)) - lista.Add(New CrystalParametro("LimiteCredito", TxtLimiteCredito.Text)) - lista.Add(New CrystalParametro("SaldoDisponible", (TxtLimiteCredito.Text.ToDouble).FormatoNumero)) - - lista.Add(New CrystalParametro("SaldoIngDolares", SaldoIngDolares.FormatoNumero)) - lista.Add(New CrystalParametro("SaldoIngPesos", SaldoIngPesos.FormatoNumero)) - lista.Add(New CrystalParametro("TotalIng", TotalIng.FormatoNumero)) - lista.Add(New CrystalParametro("SaldoAntDolares", SaldoAntDolares.FormatoNumero)) - lista.Add(New CrystalParametro("SaldoAntPesos", SaldoAntPesos.FormatoNumero)) - lista.Add(New CrystalParametro("TotalAnt", TotalAnt.FormatoNumero)) - lista.Add(New CrystalParametro("ContaIng", ContaIng)) - lista.Add(New CrystalParametro("ContaAnt", ContaAnt)) - - If Imagen.Exists Then - lista.Add(New CrystalParametro("LogoPath", logouri)) - Else - lista.Add(New CrystalParametro("LogoPath", "")) - End If - - Dim drr As DataRow = DtCxCFact2.NewRow - drr("SerieFolio") = "Total Ing Pesos" - drr("Original") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Original", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)") - drr("Abonado") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Abonado", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)") - drr("Saldo") = 0 - drr("SaldoAnticipo") = 0 - drr("CveMoneda") = 1 - DtCxCFact2.Rows.Add(drr) - - If Archivo.Exists Then - ImprimirbytesPDF(ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) - Else - ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/RepClientesCxC.rpt"), DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) - End If - End If - End Sub - Private Sub MandaCorreoEstadoCuenta(CveUsuario As Integer, CveEmpresa As Integer, CveCliente As Integer, File As Byte(), Para As String, Asunto As String, Body As String, Optional GuardarBitacora As Boolean = False) - - Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para) - 'a.GuardaLog() - Dim Mail As New ClsSisMail() - - Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = File, .NombreArchivo = "EstadoDeCuenta.pdf"}) - + End Sub + Protected Sub LnkAgragarDireccion_Click(sender As Object, e As EventArgs) + + txtLg.Text = "0" + txtLt.Text = "0" + + RegistraScript("muestraMapa();") + HDMAPOP.Value = "1" + + UpModalDivMapa.Update() + + End Sub +#Region "G V S U C U R S A L E S" + Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GVSucursales.RowDataBound + + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.RowIndex = 0 Then + ' e.Row.Cells(0).Width = Unit.Pixel(150) + e.Row.Cells(1).Width = Unit.Pixel(40) + e.Row.Cells(2).Width = Unit.Pixel(40) + End If + e.Row.Cells(0).HorizontalAlign = HorizontalAlign.Left + + + + If Not CveCliente > 0 Then + e.Row.Cells(3).Visible = False + End If + End If + + End Sub + + Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GVSucursales.RowDeleting + Dim ObjCliente As New ClsClientes + + If CveCliente > 0 Then + If ObjCliente.RemoveSucursal(CveCliente, GVSucursales.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then + GVSucursales.EditIndex = -1 + ViewState("DTSucursalesCliente") = ObjCliente.DtResultados + Alert("La Sucursal del Cliente se eliminó correctamente.", TipoMensaje.MsgInformacion) + End If + Else + TempDTSucursales.Rows.RemoveAt(e.RowIndex) + TempDTSucursales.AcceptChanges() + GVSucursales.DataSource = TempDTSucursales + GVSucursales.DataBind() + UpDatos.Update() + End If + + ObjCliente.Dispose() + End Sub + Protected Sub GvDatos_RowCancelingEdit(sender As Object, e As System.Web.UI.WebControls.GridViewCancelEditEventArgs) Handles GVSucursales.RowCancelingEdit + GVSucursales.EditIndex = -1 + If ViewState("Orden").ToString() <> String.Empty Then + CargaGrid(ViewState("Orden").ToString(), 0) + Else + CargaGrid("", 0) + End If + End Sub + Protected Sub GvDatos_RowUpdating(sender As Object, e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GVSucursales.RowUpdating + + If ViewState("Orden").ToString() <> String.Empty Then + CargaGrid(ViewState("Orden").ToString(), 0) + Else + CargaGrid("", 0) + End If + + End Sub + Protected Sub GvDatos_RowEditing(sender As Object, e As System.Web.UI.WebControls.GridViewEditEventArgs) Handles GVSucursales.RowEditing + + Me.Actualizar = True + Me.CveClienteSuc = GVSucursales.DataKeys(e.NewEditIndex).Value.ToString.ToEntero + + + Dim ObjCliente As New ClsClientes + + If ObjCliente.GetSucursales(CveCliente, CveClienteSuc) Then + + DivEstatusSucursal.Visible = True + TxtNombreSucursal.Text = ObjCliente.DtResultados.Rows(0)("SucursalCliente").ToString + ChkEstatusSucursal.Checked = If(ObjCliente.DtResultados.Rows(0)("Estatus").ToString = "Activo", True, False) + TxtCiudadSucursal.Text = ObjCliente.DtResultados.Rows(0)("Ciudad").ToString + TxtColoniaSucursal.Text = ObjCliente.DtResultados.Rows(0)("Colonia").ToString + TxtCPSucursal.Text = ObjCliente.DtResultados.Rows(0)("CP").ToString + TxtDireccionSucursal.Text = ObjCliente.DtResultados.Rows(0)("Direccion").ToString + TxtEstadoSucursal.Text = ObjCliente.DtResultados.Rows(0)("Estado").ToString + TxtLocalidadSucursal.Text = ObjCliente.DtResultados.Rows(0)("Localidad").ToString + TxtPaisSucursal.Text = ObjCliente.DtResultados.Rows(0)("Pais").ToString + TxtNumExtSucursal.Text = ObjCliente.DtResultados.Rows(0)("NoExt").ToString + TxtNumIntSucursal.Text = ObjCliente.DtResultados.Rows(0)("NoInt").ToString + TxtTelefonoSucursal.Text = ObjCliente.DtResultados.Rows(0)("Telefono").ToString + TxtCorreoSucursal.Text = ObjCliente.DtResultados.Rows(0)("Correo").ToString + TxtCorreoSucursalCotizacion.Text = ObjCliente.DtResultados(0)("CorreoCotizacion").ToString + TxtContactoSucursal.Text = ObjCliente.DtResultados.Rows(0)("Contacto").ToString + DdlVendedorSucursal.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveVendedor").ToString) + DdlMetodoPagoSucursal.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveMetodoPago").ToString) + TxtNumeroCuenta.Text = ObjCliente.DtResultados.Rows(0)("NumCtaPago").ToString + LblUsuarioSucursal.Text = String.Format("Usuario Registró: {0}", ObjCliente.DtResultados.Rows(0)("Usuario").ToString) + LblFechaSucursal.Text = String.Format("Fecha de Registro: {0}", ObjCliente.DtResultados.Rows(0)("FechaIng").ToString.ToDate.ToShortDateString) + TxtLimiteCreditoSucursal.Text = ObjCliente.DtResultados.Rows(0)("LimiteCredito").ToString.FormatoNumero + DdlResponsableSucursal.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveResponsableCobranza").ToString) + + DdlSucursalUsoCFDI.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveUsoCFDI").ToString) + DdlSucursalMetodoPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveMetodoPago33").ToString) + DdlSucursalFormaPago33.SelectedValueExist(ObjCliente.DtResultados.Rows(0)("CveFormaPago33").ToString) + + txtLg.Text = ObjCliente.DtResultados.Rows(0)("LG").ToString + txtLt.Text = ObjCliente.DtResultados.Rows(0)("LT").ToString + HDMAPOP.Value = "2" + + + UpAgregarSucursal.Update() + UpModalDivMapa.Update() + + 'Dim scriptReg As String = $" SelTxtLat = '#{ GVSucursales.Rows(e.NewEditIndex).FCTextBox("txtLt").ClientID}'; SelTxtLon = '#{ GVSucursales.Rows(e.NewEditIndex).FCTextBox("txtLg").ClientID}''" + 'RegistraScript("$('#divAgregarSucursal').modal();" & scriptReg) + + RegistraScript("$('#divAgregarSucursal').modal();") + + Else + Alert("No se pudieron cargar los datos de la sucursal") + End If + + ObjCliente.Dispose() + + If ViewState("Orden").ToString() <> String.Empty Then + CargaGrid(ViewState("Orden").ToString(), 0) + Else + CargaGrid("", 0) + End If + End Sub +#End Region + +#Region "G V U S U A R I O S P O R T A L" + Protected Sub GvUsuariosPortal_RowCommand(sender As Object, e As GridViewCommandEventArgs) Handles GvUsuariosPortal.RowCommand + If e.CommandName = "RestablecerContraseña" Then + Dim cveUsuarioPortal As Integer = e.CommandArgument.ToString.ToEntero + Dim Usuario As New ClsSisUsuarios + If Usuario.GetUsuariosPortal(cveUsuarioPortal, -1, -1) Then + Dim dr As DataRow = Usuario.DtResultados.FiltroPrimero("") + + If Usuario.UpdateUsuarioPortal(dr("Usuario").ToString, dr("Nombre").ToString, dr("Correo").ToString, CType(dr("Estatus"), Boolean), ContraseñaPredeterminadaEncriptada, CveCliente, -1, cveUsuarioPortal, UsuarioActual.CveUsuario) Then + + GvUsuariosPortal.EditIndex = -1 + ViewState("DTUsuariosCliente") = Usuario.DtResultados.FiltraParametros("Usuario <> 'Admin'") + Alert("Contraseña Restablecida.
    La nueva contraseña es: """ & ContraseñaPredeterminada & "", TipoMensaje.MsgInformacion) + End If + + End If + + Usuario.Dispose() + + End If + End Sub + + Protected Sub GvUsuariosPortal_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvUsuariosPortal.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.RowIndex = 0 Then + ''e.Row.Cells(0).Width = Unit.Pixel(180) + ''e.Row.Cells(1).Width = Unit.Pixel(180) + ''e.Row.Cells(2).Width = Unit.Pixel(180) + + ''e.Row.Cells(3).Width = Unit.Pixel(50) + ''e.Row.Cells(4).Width = Unit.Pixel(50) + ''e.Row.Cells(5).Width = Unit.Pixel(50) + ''e.Row.Cells(6).Width = Unit.Pixel(50) + ''e.Row.Cells(7).Width = Unit.Pixel(50) + ''e.Row.Cells(8).Width = Unit.Pixel(50) + ''e.Row.Cells(9).Width = Unit.Pixel(50) + ''e.Row.Cells(10).Width = Unit.Pixel(50) + ''e.Row.Cells(11).Width = Unit.Pixel(50) + ''e.Row.Cells(12).Width = Unit.Pixel(45) + + ''e.Row.Cells(3).Width = Unit.Pixel(68) + ''e.Row.Cells(4).Width = Unit.Pixel(70) + ''e.Row.Cells(5).Width = Unit.Pixel(130) + End If + + If e.Row.RowState = DataControlRowState.Alternate OrElse e.Row.RowState = DataControlRowState.Normal Then + If e.Row.DBCampo("Usuario") = "Admin" Then + + End If + End If + + End If + End Sub + + Protected Sub GvUsuariosPortal_RowEditing(ByVal sender As Object, ByVal e As GridViewEditEventArgs) Handles GvUsuariosPortal.RowEditing + + GvUsuariosPortal.EditIndex = e.NewEditIndex + + If ViewState("OrdenUsuarios").ToString() <> String.Empty Then + CargaGrid(ViewState("OrdenUsuarios").ToString(), 1) + Else + CargaGrid("", 1) + End If + 'CargaUsuariosPortal() + + End Sub + + Protected Sub GvUsuariosPortal_RowUpdating(ByVal sender As Object, ByVal e As GridViewUpdateEventArgs) Handles GvUsuariosPortal.RowUpdating + + Dim ObjUsuario As New ClsSisUsuarios + + Dim ErrorUsuario As Boolean = False + + Dim gvr As GridViewRow = GvUsuariosPortal.Rows(e.RowIndex) + + Dim Nombre As String = gvr.FCTextBox("TxtUsuarioPortalEdit").Text.Trim + Dim Correo As String = gvr.FCTextBox("TxtCorreoUsuarioPortalEdit").Text.Trim + Dim Estatus As Boolean = gvr.FCCheckBox("ChkEstatus").Checked + Dim CveUsuario As Integer = gvr.DataKey("CveUsuario").ToEntero + Dim pCveCliente As Integer = gvr.DataKey("CveCliente").ToEntero + + Dim PermisoHistorialCompras As Boolean = gvr.FCCheckBox("ChkPermiso1").Checked + Dim PermisoCxP As Boolean = gvr.FCCheckBox("ChkPermiso2").Checked + Dim PermisoAnticipo As Boolean = gvr.FCCheckBox("ChkPermiso3").Checked + Dim PermisoRH As Boolean = gvr.FCCheckBox("ChkPermiso4").Checked + Dim PermisoOS As Boolean = gvr.FCCheckBox("ChkPermiso5").Checked + Dim PermisoCotiza As Boolean = gvr.FCCheckBox("ChkPermiso6").Checked + Dim PermisoSistema As Boolean = gvr.FCCheckBox("ChkPermiso7").Checked + + ObjUsuario.IniciaTransacSQL() + + If ObjUsuario.UpdateUsuarioPortal(Correo, Nombre, Correo, Estatus, "-1", pCveCliente, -1, CveUsuario, UsuarioActual.CveUsuario) Then + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 229, PermisoHistorialCompras, UsuarioActual.CveUsuario) Then ErrorUsuario = True + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 230, PermisoCxP, UsuarioActual.CveUsuario) Then ErrorUsuario = True + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 231, PermisoAnticipo, UsuarioActual.CveUsuario) Then ErrorUsuario = True + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 232, PermisoOS, UsuarioActual.CveUsuario) Then ErrorUsuario = True + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 233, PermisoRH, UsuarioActual.CveUsuario) Then ErrorUsuario = True + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 234, PermisoSistema, UsuarioActual.CveUsuario) Then ErrorUsuario = True + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 235, PermisoCotiza, UsuarioActual.CveUsuario) Then ErrorUsuario = True + End If + + If ErrorUsuario Then + ObjUsuario.RollBack() + Else + ObjUsuario.Commit() + End If + + GvUsuariosPortal.EditIndex = -1 + + ObjUsuario.GetUsuariosPortal(-1, CveCliente, -1) + ViewState("DTUsuariosCliente") = ObjUsuario.DtResultados + + ObjUsuario.Dispose() + + If ViewState("OrdenUsuarios").ToString() <> String.Empty Then + CargaGrid(ViewState("OrdenUsuarios").ToString(), 1) + Else + CargaGrid("", 1) + End If + + End Sub + + Protected Sub GvUsuariosPortal_RowDeleting(ByVal sender As Object, ByVal e As GridViewDeleteEventArgs) Handles GvUsuariosPortal.RowDeleting + + Dim Usuario As New ClsSisUsuarios + If Usuario.RemoveUsuarioPortal(GvUsuariosPortal.DataKeys(e.RowIndex).Value.ToString().ToEntero()) Then + GvUsuariosPortal.EditIndex = -1 + ViewState("DTUsuariosCliente") = Usuario.DtResultados + End If + + Usuario.Dispose() + + If ViewState("OrdenUsuarios").ToString() <> String.Empty Then + CargaGrid(ViewState("OrdenUsuarios").ToString(), 1) + Else + CargaGrid("", 1) + End If + + End Sub + + Protected Sub GvUsuariosPortal_RowCancelingEdit(ByVal sender As Object, ByVal e As GridViewCancelEditEventArgs) Handles GvUsuariosPortal.RowCancelingEdit + + GvUsuariosPortal.EditIndex = -1 + + If ViewState("OrdenUsuarios").ToString() <> String.Empty Then + CargaGrid(ViewState("OrdenUsuarios").ToString(), 1) + Else + CargaGrid("", 1) + End If + + End Sub +#End Region + +#Region "O R D E N A M I E N T O" + Private Sub CargaGrid(Orden As String, gvi As Integer) + If gvi = 0 Then + If CType(ViewState("DTSucursalesCliente"), DataTable).Rows.Count > 0 Then + If Orden <> String.Empty Then + Dim DV As New DataView(CType(ViewState("DTSucursalesCliente"), DataTable), "", Orden, DataViewRowState.CurrentRows) + GVSucursales.DataSource = DV.ToTable() + DV.Dispose() + Else + GVSucursales.DataSource = CType(ViewState("DTSucursalesCliente"), DataTable) + End If + ViewState("Orden") = Orden + GVSucursales.DataBind() + UpDatos.Update() + End If + ElseIf gvi = 1 Then + If CType(ViewState("DTUsuariosCliente"), DataTable).Rows.Count > 0 Then + If Orden <> String.Empty Then + Dim DV As New DataView(CType(ViewState("DTUsuariosCliente"), DataTable), "", Orden, DataViewRowState.CurrentRows) + GvUsuariosPortal.DataSource = DV.ToTable() + DV.Dispose() + Else + GvUsuariosPortal.DataSource = CType(ViewState("DTUsuariosCliente"), DataTable) + End If + + End If + ViewState("OrdenUsuarios") = Orden + GvUsuariosPortal.DataBind() + UPPUsuarios.Update() + End If + + End Sub +#End Region + + +#End Region + +#Region "U S U A R I O S" + Protected Sub LbSolicitudPortal_Click(sender As Object, e As EventArgs) Handles LbEnviarActivacionPortal.Click + Dim ObjUsuario As New ClsSisUsuarios + Dim CveUsr As Integer = HdnCveUsuarioPortalAdmin.Value.ToEntero + Dim Usuario As String = TxtEmail.Text + Dim NomUsuario As String = "Admin" + Dim CorreoUsuario As String = TxtEmail.Text + Dim CvePlataforma As Integer = 6 + Dim ErrorUsuario As Boolean = True + 'DECLARAMOS PERMISOS DE ADMIN + Dim Permisos() As Integer = {234, 233, 232, 231, 230, 229} + + If Not CveCliente > 0 Then + Alert("Favor de guardar los datos del cliente antes de activar el Portal del Cliente.", TipoMensaje.MsgAdvertencia) + Return + End If + + ObjUsuario.IniciaTransacSQL() + + 'AGREGAMOS USUARIO ADMIN NUEVO + If CveUsr = 0 Then + 'CREA USUARIO + CveUsr = ObjUsuario.AddUsuarioPortal(Usuario, ContraseñaPredeterminadaEncriptada, NomUsuario, CorreoUsuario, CveCliente, -1, CvePlataforma, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CveUsr > 0 Then + ' AGREGA PERMISO A MODULO PORTALCLIENTE + If ObjUsuario.UpdateUsuariosModulos(CveUsr, 1101, True, UsuarioActual.CveUsuario) Then + 'AGREGAMOS PERMISOS A ADMIN + For Each permiso In Permisos + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsr, permiso, True, UsuarioActual.CveUsuario) Then + ErrorUsuario = True + Exit For + End If + ErrorUsuario = False + Next + If Not ErrorUsuario Then + HdnCveUsuarioPortalAdmin.Value = CveUsr.ToString + trDesactivarUsuario.Visible = True + trEnviarActivacion.Visible = False + LblUsuarioActivo.Text = "Si" + 'DivPermisosPortal.Visible = False + End If + End If + End If + Else + 'ACTUALIZAMOS ESTADO DE USARIO ADMIN INACTIVO + If ObjUsuario.UpdateUsuarioPortal(Usuario, "Admin", CorreoUsuario, True, ContraseñaPredeterminadaEncriptada, CveCliente, -1, CveUsr, UsuarioActual.CveUsuario) Then + + 'ACTUALIZAMOS PERMISOS A ADMIN + For Each permiso In Permisos + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsr, permiso, True, UsuarioActual.CveUsuario) Then + ErrorUsuario = True + Exit For + End If + ErrorUsuario = False + Next + If Not ErrorUsuario Then + HdnCveUsuarioPortalAdmin.Value = CveUsr.ToString + trDesactivarUsuario.Visible = True + trEnviarActivacion.Visible = False + LblUsuarioActivo.Text = "Si" + 'DivPermisosPortal.Visible = True + + End If + End If + End If + + 'VERIFICAMOS SI HUBO ERRORES + If ErrorUsuario Then + ObjUsuario.RollBack() + CveUsr = -1 + Else + ObjUsuario.Commit() + End If + + If CveUsr > 0 Then + 'ENVIA CORREO DE ACTIVACION + Dim ObjParametro As SisParametro = GlobalDTParametros(SisParametros.URL) + Dim Liga As String = ObjParametro.Cadena1 & "LogIn.aspx" + + If UsuarioActual.CveEmpresa = 43 Then + Liga = ObjParametro.Cadena1 & "AIMMGM/Portal.aspx" + End If + + Dim LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & CveUsr & "&Clave=" & "-acceso-" & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks& & "&CveE=" & UsuarioActual.CveEmpresa) + + If UsuarioActual.Empresa.CvePlataforma = 3 Then + EnviaCorreoGPS(Liga, LigaActivar) + Else + EnviaCorreo(Liga, LigaActivar) + End If + + 'HABILITA Y ACTUALIZA SECCION AGREGAR NUEVOS USUARIOS + ObjUsuario.GetUsuariosPortal(-1, CveCliente, -1) + + ViewState("DTUsuariosCliente") = ObjUsuario.DtResultados + GvUsuariosPortal.DataSource = ViewState("DTUsuariosCliente") + GvUsuariosPortal.DataBind() + 'divUsuariosPortal.Visible = True + ObjUsuario.Dispose() + + If UsuarioActual.Empresa.CvePlataforma = 1 Then + CargaUsuariosPortalCliente() + End If + + UpGvUsuarios.Update() + UPPUsuarios.Update() + End If + End Sub + + Protected Sub LnkAgregarUsuario_Click(sender As Object, e As EventArgs) Handles LnkAgregarUsuario.Click + Dim ObjParametro As SisParametro = GlobalDTParametros(SisParametros.URL) + Dim ObjUsuario As New ClsSisUsuarios + + Dim Liga As String = ObjParametro.Cadena1 & "Login.aspx" + Dim CveUsuario = -1 + Dim CvePlataforma As Integer = 6 + Dim ErrorUsuario As Boolean = False + + If UsuarioActual.CveEmpresa = 43 Then + Liga = ObjParametro.Cadena1 & "AIMMGM/Portal.aspx" + End If + + Dim PermisoHistorialCompras As Boolean = ChkPermiso1.Checked + Dim PermisoCxP As Boolean = ChkPermiso2.Checked + Dim PermisoAnticipo As Boolean = ChkPermiso3.Checked + Dim PermisoRH As Boolean = ChkPermiso4.Checked + Dim PermisoOS As Boolean = ChkPermiso5.Checked + Dim PermisoCotiza As Boolean = ChkPermiso6.Checked + Dim PermisoSistema As Boolean = ChkPermiso7.Checked + + ObjUsuario.IniciaTransacSQL() + + CveUsuario = ObjUsuario.AddUsuarioPortal(TxtCorreoUsuarioPortal.Text, ContraseñaPredeterminadaEncriptada, TxtNombreUsuarioPortal.Text, TxtCorreoUsuarioPortal.Text, CveCliente, -1, CvePlataforma, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + If CveUsuario > 0 Then + If ObjUsuario.UpdateUsuariosModulos(CveUsuario, 1101, True, UsuarioActual.CveUsuario) Then + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 229, PermisoHistorialCompras, UsuarioActual.CveUsuario) Then ErrorUsuario = True + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 230, PermisoCxP, UsuarioActual.CveUsuario) Then ErrorUsuario = True + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 231, PermisoAnticipo, UsuarioActual.CveUsuario) Then ErrorUsuario = True + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 232, PermisoOS, UsuarioActual.CveUsuario) Then ErrorUsuario = True + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 233, PermisoRH, UsuarioActual.CveUsuario) Then ErrorUsuario = True + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 234, PermisoSistema, UsuarioActual.CveUsuario) Then ErrorUsuario = True + If Not ObjUsuario.UpdateUsuariosProcesos(CveUsuario, 235, PermisoCotiza, UsuarioActual.CveUsuario) Then ErrorUsuario = True + End If + End If + + If ErrorUsuario Then + ObjUsuario.RollBack() + Else + ObjUsuario.Commit() + + Dim LigaActivar As String = Liga & "?p=" & Encripta("CveU=" & CveUsuario & "&Clave=" & "-acceso-" & "&Opcion=Activar&Hora=" & DateTime.Now.Ticks& & "&CveE=" & UsuarioActual.CveEmpresa) + EnviaCorreo2(Liga, LigaActivar) + + LimpiaAgregarUsuarioPortal() + + Alert("Usuario Creado.
    El usuario accesará con la contraseña '" & ContraseñaPredeterminada & "'", TipoMensaje.MsgInformacion) + End If + + ObjUsuario.GetUsuariosPortal(-1, CveCliente, -1) + ViewState("DTUsuariosCliente") = ObjUsuario.DtResultados + + ObjUsuario.Dispose() + + If ViewState("OrdenUsuarios").ToString() <> String.Empty Then + CargaGrid(ViewState("OrdenUsuarios").ToString(), 1) + Else + CargaGrid("", 1) + End If + End Sub + + Protected Sub LimpiaAgregarUsuarioPortal() + TxtNombreUsuarioPortal.Text = "" + TxtCorreoUsuarioPortal.Text = "" + + ChkPermiso1.Checked = False + ChkPermiso2.Checked = False + ChkPermiso3.Checked = False + ChkPermiso4.Checked = False + ChkPermiso5.Checked = False + ChkPermiso6.Checked = False + ChkPermiso7.Checked = False + End Sub +#End Region + +#Region "E V E N T O - B I T A C O R A" + Protected Sub GVEventoBitacora_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEB.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.RowIndex = 0 Then + e.Row.Cells(0).Width = Unit.Pixel(175) + e.Row.Cells(1).Width = Unit.Pixel(175) + e.Row.Cells(2).Width = Unit.Pixel(100) + e.Row.Cells(4).Width = Unit.Pixel(30) + End If + + If e.Row.DBCampo("Archivo").ToString <> "" Then + e.Row.FCLinkButton("LinkArchivo").Visible = True + e.Row.FCLinkButton("LinkArchivo").CommandArgument = String.Format("OI\{0}", e.Row.DBCampo("Archivo").ToString) + ScriptManager.GetCurrent(Me).RegisterPostBackControl(e.Row.FCLinkButton("LinkArchivo")) 'Registro un evento Postbacktrigger, que recargue toda la pagina para que funcione + End If + + End If + End Sub + Protected Sub BtnGuardarEventoBitacora_Click(sender As Object, e As EventArgs) Handles BtnGuardarEventoBitacora.Click + Dim ObjEventoBitacora As New ClsOIEventos + + Dim FileExtension As String = "-1" + Dim filesgral As List(Of Archivo) = Anexo.getfiles().Archivos + Dim filemove As String = "" + + For Each fileItem As Archivo In filesgral + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + filemove = fileItem.filename + Next + + If ObjEventoBitacora.AddEventoBitacora(TxtEventoDescripcion.Text.Trim, String.Format(".{0}", FileExtension), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, CveCliente, -1, -1, -1, -1, -1) Then + If filemove <> "" Then + filemove.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", UsuarioActual.CveEmpresa)) + End If + + GvEB.DataSource = ObjEventoBitacora.DtResultados + TxtEventoDescripcion.Text = "" + Anexo.Text = "[]" + Alert("La bitácora/observación se guardó correctamente", TipoMensaje.MsgInformacion) + RegistraScript("$('#ModalBitacora').modal('hide')", "hidemodal") + End If + ObjEventoBitacora.Dispose() + GvEB.DataBind() + + UPEventoBitacora.Update() + CargaEventoBitacora() + UPAddEventoBitacora.Update() + End Sub + Private Sub CargaEventoBitacora() + Dim ObjEventoBitacora As New ClsOIEventos() + If ObjEventoBitacora.GetAgendaBitacora(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente:=CveCliente) Then + GvEB.DataSource = ObjEventoBitacora.DtResultados.FiltraParametros("CveTipoEvento = 6 OR CveTipoEvento = 2") + Else + GvEB.DataSource = Nothing + End If + ObjEventoBitacora.Dispose() + GvEB.DataBind() + End Sub + + Protected Sub DownloadFile(ByVal sender As Object, ByVal e As EventArgs) + Dim filePath As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, CType(sender, LinkButton).CommandArgument) + Dim Archivo As New System.IO.FileInfo(filePath) + + HttpContext.Current.Response.Clear() + HttpContext.Current.Response.ClearContent() + HttpContext.Current.Response.ContentType = "application/octet-stream" + HttpContext.Current.Response.AppendHeader("Content-disposition", "attachment; filename=" + Path.GetFileName(filePath)) + HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString()) + HttpContext.Current.Response.TransmitFile(filePath) + HttpContext.Current.Response.Flush() + HttpContext.Current.Response.End() + + Archivo = Nothing + End Sub + + + Private Sub BtnCancelarSucursal_Click(sender As Object, e As EventArgs) Handles BtnCancelarSucursal.ServerClick + GvDatos_RowCancelingEdit(Nothing, Nothing) + End Sub + + Public Sub BtnAgregaCuentaContable(sender As Object, e As EventArgs) Handles BtnActivaRegistroClientes.Click, BtnActivaRegistroAnticipos.Click, BtnActivaRegistroIVA.Click, BtnActivaRegistroISR.Click + Dim CuentaContable = DirectCast(sender, Button).CommandArgument.ToString + Dim Button = DirectCast(sender, Button) + Select Case CuentaContable + Case "Clientes" + AgregarCuentaContable(Button, DdlCtaContableClientes) + Case "Anticipos" + AgregarCuentaContable(Button, DdlCtaContableAnticipos) + Case "RetIVA" + AgregarCuentaContable(Button, DdlCtaContableRetIVA) + Case "RetISR" + AgregarCuentaContable(Button, DdlCtaContableRetISR) + End Select + + End Sub + + Private Function AgregarCuentaContable(btn As Button, ddl As DropDownList) As Boolean + Dim IdCuentaContable As Integer = -1 + Dim CtaCodigo As String = "" + Dim TieneError = False + Dim IdCtaContableClientes As Integer = -1, IdCtaContableAnticipos As Integer = -1, IdCtaContableRetIVA As Integer = -1, IdCtaContableRetISR As Integer = -1 + Dim ProcesoCorrecto As Boolean + + Dim ObjContaAC As New ClsContPAQi(UsuarioActual.Empresa) + + ObjContaAC.IniciaTransacSQL() + + Dim CuentaPadre = -1 + + Select Case btn.CommandArgument.ToString + Case "Clientes" + CuentaPadre = UsuarioActual.Empresa.Funcionalidad(211).ToEntero + Case "Anticipos" + CuentaPadre = UsuarioActual.Empresa.Funcionalidad(212).ToEntero + Case "RetIVA" + CuentaPadre = UsuarioActual.Empresa.Funcionalidad(213).ToEntero + Case "RetISR" + CuentaPadre = UsuarioActual.Empresa.Funcionalidad(214).ToEntero + + End Select + + 'SI EL NOMBRE DEL PROVEEDOR ES MAYOR DE 50 LO CORTAMOS + Dim NombreCuenta = If(TxtNombreComercial.Text.Trim.Length > 50, TxtNombreComercial.Text.Trim.Substring(0, 50), TxtNombreComercial.Text.Trim) + + IdCuentaContable = ObjContaAC.AddSiguienteCuentaHijo(CuentaPadre, NombreCuenta, Tipo:="A", CuentaMayor:=2) + If IdCuentaContable > 0 Then + + ObjContaAC.GetCuentas(IdCuentaContable, "-1", -1) + Dim dt = ObjContaAC.DtResultados + + If dt.Rows.Count = 1 Then + + Dim row As DataRow = dt.Rows(0) + CtaCodigo = CStr(row("CtaCodigo")) + + Select Case btn.CommandArgument.ToString + Case "Clientes" + IdCtaContableClientes = IdCuentaContable + Case "Anticipos" + IdCtaContableAnticipos = IdCuentaContable + Case "RetIVA" + IdCtaContableRetIVA = IdCuentaContable + Case "RetISR" + IdCtaContableRetISR = IdCuentaContable + End Select + + + Dim ObjClientes As New ClsClientes + If Not ObjClientes.VincularCuentasContables(IdCtaContableClientes, IdCtaContableAnticipos, IdCtaContableRetIVA, IdCtaContableRetISR, CveCliente) Then + TieneError = True + End If + + ObjClientes.Dispose() + + Else + TieneError = True + End If + + Else + TieneError = True + End If + + If Not TieneError Then + ObjContaAC.Commit() + Alert(String.Format("Se registo la Cuenta Contable: {0}", CtaCodigo, TipoMensaje.MsgInformacion)) + ddl.Items.Add(New ListItem(CtaCodigo, IdCuentaContable.ToString)) : ddl.SelectedValueExist(IdCuentaContable.ToString) + btn.Visible = False + ddl.Width = 206 + ProcesoCorrecto = True + Else + ObjContaAC.RollBack() + Alert("error", TipoMensaje.MsgError) + ProcesoCorrecto = False + End If + + + ObjContaAC.Dispose() + UpFiscalContable.Update() + + + Return ProcesoCorrecto + End Function + + Private Sub ActivarRegistroAutomatico() + + 'Clientes + If DdlCtaContableClientes.SelectedValue.ToEntero <= 0 And UsuarioActual.Empresa.Funcionalidad(211).ToEntero > 0 Then + BtnActivaRegistroClientes.Visible = True + End If + + 'Anticipos + If DdlCtaContableAnticipos.SelectedValue.ToEntero <= 0 And UsuarioActual.Empresa.Funcionalidad(212).ToEntero > 0 Then + BtnActivaRegistroAnticipos.Visible = True + End If + + 'Ret IVA + If DdlCtaContableRetIVA.SelectedValue.ToEntero <= 0 And UsuarioActual.Empresa.Funcionalidad(213).ToEntero > 0 Then + BtnActivaRegistroIVA.Visible = True + End If + + 'Ret ISR + If DdlCtaContableRetISR.SelectedValue.ToEntero <= 0 And UsuarioActual.Empresa.Funcionalidad(214).ToEntero > 0 Then + BtnActivaRegistroISR.Visible = True + End If + + End Sub +#End Region + +#Region " I M P R I M I R P D F" + + Protected Sub ChkAntIXCNC_CheckedChanged(sender As Object, e As EventArgs) + DdlTipoDocto.ClearSelection() + If ChkAntIXCNC.Checked Then + DdlTipoDocto.SelectedValuesIfExistM("Ing,Rem,Ant,Egs,IxC") + Else + DdlTipoDocto.SelectedValuesIfExistM("Ing,Rem") + End If + End Sub + Protected Sub LnkGenerarReporteCxC_Click(sender As Object, e As EventArgs) Handles LnkGenerarReporteCxC.Click + GenerarPDFCrystal(RBLGenerarReporteCxC.SelectedValue) + End Sub + + Protected Sub GenerarReporte(sender As Object, e As EventArgs) + GenerarRepCrystal() + End Sub + Private Sub GenerarRepCrystal() + Dim Archivo As New FileInfo(Server.MapPath("~/Empresas/Grales/Formatos/EquiposGPS.rpt")) + Dim lista = New List(Of CrystalParametro) + lista.Add(New CrystalParametro("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + lista.Add(New CrystalParametro("NombreUsuario", UsuarioActual.Nombre)) + + Dim ObjGPS As New ClsGPS + Dim tablaReporte As DataTable + If ObjGPS.DispositivosGet(-1, Estatus, CveCliente) Then + tablaReporte = ObjGPS.DtResultados + Dim VistaFiltro As DataView = New DataView(tablaReporte) + Dim reporteDatos As DataTable = VistaFiltro.ToTable("Selected", False, "TipoDispositivoDisplay", "Display", "Modelo", "Serie", "IMEI", "NumeroTelefono", "FechaIng") + Dim file As Byte() = ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/EquiposGPS.rpt"), reporteDatos, lista) + ImprimirbytesPDF(file) + Else + Alert("No hay lista de dispositivos para imprimir") + End If + + End Sub + + Private Sub GenerarPDFCrystal(Optional Formato As String = "PDF") + Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/RepClientesCxC.rpt", UsuarioActual.Empresa.Ruta)) + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + 'OBTENEMOS LOS DATOS + + Dim DtCxCFact As DataTable = Nothing + + Dim FI = If(TxtFechaInicioCxP.Text = "" Or TxtFechaInicioCxP.Text = "__/__/____", "-1", TxtFechaInicioCxP.Text) + Dim FF = If(TxtFechaFinCxP.Text = "" Or TxtFechaFinCxP.Text = "__/__/____", "-1", TxtFechaFinCxP.Text) + + Dim SaldoIngDolares As Double = 0 + Dim SaldoIngPesos As Double = 0 + Dim SaldoIngDolaresPesos As Double = 0 + Dim TotalIng As Double = 0 + + Dim SaldoAntDolares As Double = 0 + Dim SaldoAntPesos As Double = 0 + Dim SaldoAntDolaresPesos As Double = 0 + Dim TotalAnt As Double = 0 + Dim ContaIng As Integer = 0 + Dim ContaAnt As Integer = 0 + Dim FechaCorte As Date = ("9999/01/01").ToDate + Dim TipoDocto As String = If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM) + Dim TipoDocto2 As String = If(DdlTipoDocto.GetSelectedValuesM = "", "-1", DdlTipoDocto.GetSelectedValuesM(True)) + Dim FechaVencimientoI As String = If(TxtFechaVICxP.Text = "", "-1", TxtFechaVICxP.Text).ToString + Dim FechaVencimientoF As String = If(TxtFechaVFCxP.Text = "", "-1", TxtFechaVFCxP.Text).ToString + + Dim ObjMovtos As New ClsMovimientos() + If ObjMovtos.GetCxCClienteDetalle(CveCliente, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, DdlSucursalCliente.SelectedValue.ToEntero) Then + DtCxCFact = If(DdlTipoCuentasCxC.SelectedValue = "-1", ObjMovtos.DtResultados.FiltraParametros("", "TipoDocto").Copy, ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act'", "TipoDocto")) + 'cargo los anticipos NC + DtCxCFact.Columns.Add("SaldoAnticipo", GetType(Decimal)) + + Dim dtt As DataTable = Nothing + If ObjMovtos.GetAnticiposNCIxCCliente(CveCliente, -1, -1) Then + dtt = If(DdlTipoCuentasCxC.SelectedValue = "-1", ObjMovtos.DtResultados.FiltraParametros("SaldoVentaAnticipo = 0 AND ((Tipo = 'IxC' AND CveIE > 0) OR (Tipo = 'Ant' AND CveVenta > 0) OR (Tipo = 'NC' AND CveVenta > 0) OR (Tipo = 'Egs' AND CveVenta > 0) )"), ObjMovtos.DtResultados.FiltraParametros("Saldo > 0 AND SaldoVentaAnticipo = 0 AND ((Tipo = 'IxC' AND CveIE > 0) OR (Tipo = 'Ant' AND CveVenta > 0) OR (Tipo = 'NC' AND CveVenta > 0) OR (Tipo = 'Egs' AND CveVenta > 0) )")) ' que tenga saldo de anticipo y no de cliente + If dtt IsNot Nothing AndAlso dtt.Rows.Count > 0 Then + For Each drt As DataRow In dtt.Rows + Dim drr As DataRow = DtCxCFact.NewRow + + drr("TipoDocto") = drt("Tipo") + drr("SerieFolio") = drt("Folio") + drr("Original") = drt("Original") + drr("TipoCambio") = drt("TipoCambio") + drr("Saldo") = 0 + drr("SaldoAnticipo") = drt("Saldo") + drr("Fecha") = drt("Fecha") + drr("Moneda") = drt("Moneda") + drr("CveMoneda") = drt("CveMoneda") + DtCxCFact.Rows.Add(drr) + + Next + End If + + End If + + End If + ObjMovtos.Dispose() + + If DtCxCFact IsNot Nothing Then + For Each Row As DataRow In DtCxCFact.FiltraParametros($"TipoDocto IN ({TipoDocto2})").Rows + If Row("TipoDocto").ToString = "Ing" Or Row("TipoDocto").ToString = "Rem" Or (Row("TipoDocto").ToString = "Ant" And Row("Saldo").ToString.ToDouble > 0) Then 'Ingresos + ContaIng = ContaIng + 1 + If Row("CveMoneda").ToString.ToEntero = 1 Then + SaldoIngPesos = SaldoIngPesos + Row("Saldo").ToString.ToDouble + ElseIf Row("CveMoneda").ToString.ToEntero = 2 Then + SaldoIngDolares = SaldoIngDolares + Row("Saldo").ToString.ToDouble + SaldoIngDolaresPesos = SaldoIngDolaresPesos + (Row("Saldo").ToString.ToDouble * Row("TipoCambio").ToString.ToDouble) + End If + + ElseIf (Row("TipoDocto").ToString = "Ant" And Row("Saldo").ToString.ToDouble = 0) Or Row("TipoDocto").ToString = "IxC" Or Row("TipoDocto").ToString = "NC" Or Row("TipoDocto").ToString = "Dev" Then 'Anticipos, NC, IxC + ContaAnt = ContaAnt + 1 + If Row("CveMoneda").ToString.ToEntero = 1 Then + If Row("TipoDocto").ToString = "Dev" Then + SaldoAntPesos = SaldoAntPesos + Row("Saldo").ToString.ToDouble + Else + SaldoAntPesos = SaldoAntPesos + Row("SaldoAnticipo").ToString.ToDouble + End If + ElseIf Row("CveMoneda").ToString.ToEntero = 2 Then + SaldoAntDolares = SaldoAntDolares + Row("Saldo").ToString.ToDouble + SaldoAntDolaresPesos = SaldoAntDolaresPesos + (Row("SaldoAnticipo").ToString.ToDouble * Row("TipoCambio").ToString.ToDouble) + End If + End If + Next + End If + + TotalIng = SaldoIngPesos + SaldoIngDolaresPesos + TotalAnt = SaldoAntPesos + SaldoAntDolaresPesos + + Dim DtCxCFact2 As DataTable = DtCxCFact.FiltraParametros($"TipoDocto IN ({TipoDocto2})") + + 'INGRESOS + If SaldoIngPesos > 0 Then + Dim drr As DataRow = DtCxCFact2.NewRow + drr("SerieFolio") = "Total Ing Pesos" + drr("Original") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Original", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)") + drr("Abonado") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Abonado", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)") + drr("Saldo") = SaldoIngPesos + drr("CveMoneda") = 1 + DtCxCFact2.Rows.Add(drr) + End If + If SaldoIngDolares > 0 Then + Dim drr As DataRow = DtCxCFact2.NewRow + drr("SerieFolio") = "Total Ing Dólares" + drr("Original") = DtCxCFact2.FiltraParametros("CveMoneda = 2").SUM("Original", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)") + drr("Abonado") = DtCxCFact2.FiltraParametros("CveMoneda = 2").SUM("Abonado", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)") + drr("Saldo") = SaldoIngDolares + drr("CveMoneda") = 2 + DtCxCFact2.Rows.Add(drr) + End If + + 'ANTICIPOS + If SaldoAntPesos > 0 Then + Dim drr As DataRow = DtCxCFact2.NewRow + drr("SerieFolio") = "Total Pesos" + 'drr("Original") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Original", "TipoDocto IN ('IxC','Egs,'Dev') OR (TipoDocto = 'Ant' AND Saldo = 0)") + 'drr("Abonado") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Abonado", "TipoDocto IN ('IxC','Egs','Dev') OR (TipoDocto = 'Ant' AND Saldo = 0)") + drr("SaldoAnticipo") = SaldoAntPesos + drr("CveMoneda") = 1 + DtCxCFact2.Rows.Add(drr) + End If + If SaldoAntDolares > 0 Then + Dim drr As DataRow = DtCxCFact2.NewRow + drr("SerieFolio") = "Total Dólares" + ' drr("Original") = DtCxCFact2.FiltraParametros("CveMoneda = 2").SUM("Original", "TipoDocto IN ('IxC','Egs,'Dev') OR (TipoDocto = 'Ant' AND Saldo = 0)") + ' drr("Abonado") = DtCxCFact2.FiltraParametros("CveMoneda = 2").SUM("Abonado", "TipoDocto IN ('IxC','Egs,'Dev') OR (TipoDocto = 'Ant' AND Saldo = 0)") + drr("SaldoAnticipo") = SaldoAntDolares + drr("CveMoneda") = 2 + DtCxCFact2.Rows.Add(drr) + End If + + If DtCxCFact2 IsNot Nothing AndAlso DtCxCFact2.Rows.Count > 0 Then + Dim dr As DataRow = DtCxCFact2.Rows(0) + Dim lista = New List(Of CrystalParametro) + lista.Add(New CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa)) + lista.Add(New CrystalParametro("TipoCuentas", DdlTipoCuentasCxC.SelectedItem.Text)) + lista.Add(New CrystalParametro("NombreCliente", LtlCliente.Text)) + lista.Add(New CrystalParametro("FechaInicio", If(FI = "-1", "-", FI))) + lista.Add(New CrystalParametro("FechaFin", If(FF = "-1", DateTime.Now.ToShortDateString, FF))) + lista.Add(New CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre)) + lista.Add(New CrystalParametro("DireccionCliente", String.Format("Calle {0} #{1} Colonia {2}", TxtDireccion.Text, If(TxtNoExt.Text = "", "S/N", TxtNoExt.Text), TxtColonia.Text))) + lista.Add(New CrystalParametro("ClienteCP", TxtCP.Text)) + lista.Add(New CrystalParametro("ClienteCiudad", TxtCiudad.Text)) + lista.Add(New CrystalParametro("ClienteRFC", TxtRFC.Text)) + lista.Add(New CrystalParametro("ClienteTelefono", TxtTelefono.Text)) + lista.Add(New CrystalParametro("DiasCredito", TxtPlazoCobranza.Text)) + lista.Add(New CrystalParametro("LimiteCredito", TxtLimiteCredito.Text)) + lista.Add(New CrystalParametro("SaldoDisponible", (TxtLimiteCredito.Text.ToDouble - DtCxCFact2(0)("Saldo").ToString.ToDouble).FormatoNumero)) + + lista.Add(New CrystalParametro("SaldoIngDolares", SaldoIngDolares.FormatoNumero)) + lista.Add(New CrystalParametro("SaldoIngPesos", SaldoIngPesos.FormatoNumero)) + lista.Add(New CrystalParametro("TotalIng", TotalIng.FormatoNumero)) + lista.Add(New CrystalParametro("SaldoAntDolares", SaldoAntDolares.FormatoNumero)) + lista.Add(New CrystalParametro("SaldoAntPesos", SaldoAntPesos.FormatoNumero)) + lista.Add(New CrystalParametro("TotalAnt", TotalAnt.FormatoNumero)) + lista.Add(New CrystalParametro("ContaIng", ContaIng)) + lista.Add(New CrystalParametro("ContaAnt", ContaAnt)) + + + + If Imagen.Exists Then + lista.Add(New CrystalParametro("LogoPath", logouri)) + Else + lista.Add(New CrystalParametro("LogoPath", "")) + End If + + If ChkCobranzaEnviarCorreo.Checked Then + Try + Dim File As Byte() + If Archivo.Exists Then + File = ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato) + Else + File = ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/RepClientesCxC.rpt"), DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato) + End If + + Try + Dim Cuerpo As String = String.Format("Estimado cliente {0}, al presente del correo se anexa su estado actual de cartera en {1}.
    +
    + Quedamos a sus ordenes para cualquier duda o aclaración con su agente de Ventas.
    +
    +
    + Gracias por la atención brindada al presente.
    Reciba un cordial saludo.
    +
    + ESTE CORREO SE GENERO EN FORMA AUTOMATICA.", TxtNombreComercial.Text, UsuarioActual.Empresa.Empresa) + Dim Hilo As New System.Threading.Thread(Sub() MandaCorreoEstadoCuenta(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, Me.CveCliente, File, TxtCobranzaCorreo.Text, $"Estado Actual de Cartera {UsuarioActual.Empresa.Empresa}", Cuerpo, GuardarBitacora:=True)) + Hilo.Start() + Alert("El correo se envió con éxito", TipoMensaje.MsgInformacion) + Catch ex As Exception + Alert("Ocurrió un error al enviar el correo", TipoMensaje.MsgAdvertencia) + + End Try + + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL de Orden de Compra", ex) + End Try + Else + If Archivo.Exists Then + ImprimirbytesPDF(ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) + Else + ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/RepClientesCxC.rpt"), DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) + End If + + End If + Else + Dim lista = New List(Of CrystalParametro) + lista.Add(New CrystalParametro("Empresa", UsuarioActual.Empresa.Empresa)) + lista.Add(New CrystalParametro("TipoCuentas", DdlTipoCuentasCxC.SelectedItem.Text)) + lista.Add(New CrystalParametro("NombreCliente", LtlCliente.Text)) + lista.Add(New CrystalParametro("FechaInicio", If(FI = "-1", "-", FI))) + lista.Add(New CrystalParametro("FechaFin", If(FF = "-1", DateTime.Now.ToShortDateString, FF))) + lista.Add(New CrystalParametro("UsuarioImprimio", UsuarioActual.Nombre)) + lista.Add(New CrystalParametro("DireccionCliente", String.Format("Calle {0} #{1} Colonia {2}", TxtDireccion.Text, If(TxtNoExt.Text = "", "S/N", TxtNoExt.Text), TxtColonia.Text))) + lista.Add(New CrystalParametro("ClienteCP", TxtCP.Text)) + lista.Add(New CrystalParametro("ClienteCiudad", TxtCiudad.Text)) + lista.Add(New CrystalParametro("ClienteRFC", TxtRFC.Text)) + lista.Add(New CrystalParametro("ClienteTelefono", TxtTelefono.Text)) + lista.Add(New CrystalParametro("DiasCredito", TxtPlazoCobranza.Text)) + lista.Add(New CrystalParametro("LimiteCredito", TxtLimiteCredito.Text)) + lista.Add(New CrystalParametro("SaldoDisponible", (TxtLimiteCredito.Text.ToDouble).FormatoNumero)) + + lista.Add(New CrystalParametro("SaldoIngDolares", SaldoIngDolares.FormatoNumero)) + lista.Add(New CrystalParametro("SaldoIngPesos", SaldoIngPesos.FormatoNumero)) + lista.Add(New CrystalParametro("TotalIng", TotalIng.FormatoNumero)) + lista.Add(New CrystalParametro("SaldoAntDolares", SaldoAntDolares.FormatoNumero)) + lista.Add(New CrystalParametro("SaldoAntPesos", SaldoAntPesos.FormatoNumero)) + lista.Add(New CrystalParametro("TotalAnt", TotalAnt.FormatoNumero)) + lista.Add(New CrystalParametro("ContaIng", ContaIng)) + lista.Add(New CrystalParametro("ContaAnt", ContaAnt)) + + If Imagen.Exists Then + lista.Add(New CrystalParametro("LogoPath", logouri)) + Else + lista.Add(New CrystalParametro("LogoPath", "")) + End If + + Dim drr As DataRow = DtCxCFact2.NewRow + drr("SerieFolio") = "Total Ing Pesos" + drr("Original") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Original", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)") + drr("Abonado") = DtCxCFact2.FiltraParametros("CveMoneda = 1").SUM("Abonado", "TipoDocto IN ('Ing','Rem') OR (TipoDocto = 'Ant' AND Saldo > 0)") + drr("Saldo") = 0 + drr("SaldoAnticipo") = 0 + drr("CveMoneda") = 1 + DtCxCFact2.Rows.Add(drr) + + If Archivo.Exists Then + ImprimirbytesPDF(ImprimirPDFCrystal($"{UsuarioActual.Empresa.Ruta}Formatos/RepClientesCxC.rpt", DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) + Else + ImprimirbytesPDF(ImprimirPDFCrystal(Server.MapPath("~/Empresas/Grales/Formatos/RepClientesCxC.rpt"), DtCxCFact2.FiltraParametros("", "CveMoneda,Fecha"), lista, "Estado de cuenta", Formato), "Estado de cuenta", Formato) + End If + End If + End Sub + Private Sub MandaCorreoEstadoCuenta(CveUsuario As Integer, CveEmpresa As Integer, CveCliente As Integer, File As Byte(), Para As String, Asunto As String, Body As String, Optional GuardarBitacora As Boolean = False) + + Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para) + 'a.GuardaLog() + Dim Mail As New ClsSisMail() + + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.ArchivoBinario = File, .NombreArchivo = "EstadoDeCuenta.pdf"}) + Dim Envio As Boolean = Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, Archivos:=LSRutasMail) If Envio AndAlso GuardarBitacora Then Using ObjBitacora As New ClsOIEventos ObjBitacora.AddEventoBitacora("Se envió correo con el estado de cuenta del cliente", "", CveUsuario, CveEmpresa, CveCliente:=CveCliente) End Using - End If - - End Sub -#End Region + End If -#Region "E N V I O C O R R E O" - Private Sub EnviaCorreo(Liga As String, LigaActivar As String) - - Try - Dim Para = TxtEmail.Text.Trim - Dim Asunto = "ACTIVACIÓN DEL PORTAL DE CLIENTE" - Dim Usuario = TxtEmail.Text.Trim - - Dim SBBody As New StringBuilder - 'Linia de estilos - SBBody.Append("") - 'incio Cuerpo del correo - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.Append("ALTA DE CUENTA") - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.AppendFormat(" Estimado {0}:
    ", TxtNombre.Text.ToUpper) - SBBody.AppendFormat("El presente correo es para informarle que se le han asignado los siguientes datos para el acceso al Portal del Cliente de: {0}

    ", UsuarioActual.Empresa.Empresa) - - SBBody.Append("
    ") - SBBody.Append("
    Datos de Usuario:
    ") - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.Append("
    Dirección de Acceso
    ") - SBBody.AppendFormat("", Liga) - SBBody.Append("
    ") - SBBody.Append("
    ") - - SBBody.Append("
    Usuario:
    ") - SBBody.AppendFormat("
    {0}
    ", Usuario) - SBBody.Append("
    ") - SBBody.Append("
    ") - - SBBody.Append("
    ") - SBBody.Append("
    Haga click para activar su cuenta
    ") - SBBody.AppendFormat("", LigaActivar) - SBBody.Append("
    ") - - - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.Append("Para Activar su cuenta debera cambiar su contraseña.

    ") - SBBody.Append("
    ") - SBBody.Append("Nota Favor de NO responder este correo. ") - SBBody.Append("


    ") - SBBody.AppendFormat("", UrlSitio) - SBBody.Append("
    ") - SBBody.Append("
    ") - 'Termino Cuerpo del correo - - Dim Hilo As New System.Threading.Thread(Sub() MandaCorreo(Asunto, Para, SBBody.ToString)) - Hilo.Start() - Alert("El correo se ha enviado correctamente a: " + TxtEmail.Text + ".", TipoMensaje.MsgInformacion) - Catch ex As Exception - OnError("Ocurrió error al mandar MAIL", ex) - End Try - End Sub - - - Private Sub MandaCorreo(Asunto As String, Para As String, Body As String) - Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para) - a.GuardaLog() - Dim Mail As New ClsSisMail() - Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) - End Sub -#End Region - -#Region " COTIZACIONES " - - Protected Sub BtnVerMasCot_Click(sender As Object, e As EventArgs) - If BtnVerMasCot.Text = "Ver Más" Then - CargaCotizaciones(-1) - BtnVerMasCot.Text = "Ver Menos" - Else - CargaCotizaciones(21) - BtnVerMasCot.Text = "Ver Más" - End If - End Sub - Private Function CargaCotizaciones(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1) As Boolean - Dim Retorno As Boolean = False - Dim ObjClientes As New ClsClientes() - If ObjClientes.GetCotizaciones(CveCliente, SelectTop, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then - If ObjClientes.DtResultados.Rows.Count > 0 Then - 'Carga Generales - LtlCantidadCotizaciones.Text = ObjClientes.DtResultados.Rows(0)("CountTotal").ToString.FormatoNumero(2) - LtlFactorCotVentas.Text = If(LtlCantidad.Text.ToEntero > 0, (LtlCantidadCotizaciones.Text.ToEntero / LtlCantidad.Text.ToEntero).FormatoNumero, "0.00") - 'Carga Grid - GvCot.DataSource = ObjClientes.DtResultados - DtCotizaciones = ObjClientes.DtResultados - - If UsuarioActual.Empresa.UsaOS Then - GvCot.Columns(9).Visible = True - Else - GvCot.Columns(9).Visible = True - End If - - - Else - LtlCantidadCotizaciones.Text = "0" - LtlFactorCotVentas.Text = "0.00" - GvCot.DataSource = Nothing - DtCotizaciones = Nothing - End If - Else - GvCot.DataSource = Nothing - DtCotizaciones = Nothing - End If - ObjClientes.Dispose() - GvCot.DataBind() - Return Retorno - End Function - Protected Sub GVCotizaciones_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCot.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - Dim HLFacturar As HtmlAnchor = DirectCast(e.Row.FindControl("HLFacturarCot"), HtmlAnchor) - - - 'CABECERA - If e.Row.RowIndex = 0 Then - e.Row.BackColor = Drawing.Color.LightGray - DirectCast(e.Row.FindControl("HLSendMail2"), HtmlAnchor).Visible = False - e.Row.FindControl("HlOS").Visible = False - HLFacturar.Visible = False - End If - - e.Row.FCLiteral("LtlCotizacion").Text = String.Format("{1}", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("SerieFolio")) - e.Row.FCLiteral("LtlFolioVenta").Text = String.Format("{1}", e.Row.DBCampo("CveVentaPadre"), e.Row.DBCampo("FolioVenta")) - DirectCast(e.Row.FindControl("HLSendMail2"), HtmlAnchor).HRef = String.Format("javascript:$get('HdnTipoDocto2').value='Cot';$get('HdnCveVenta2').value='{0}';$get('HdnFolioVenta2').value='{1}';$get('TxtParaMail2').value='{2}';$get('HdnSerieFolio2').value='{2}';$get('HdnSubProyecto2').value='{2}'; $('#ModalDivMail2').modal();", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("Correo"), e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("SubProyecto")) - - - - 'FACTURAR COTIZACION - If e.Row.DBCampo("FolioVenta") <> "" Then - HLFacturar.Visible = False - Else - HLFacturar.HRef = $"/Ventas/Ventas.aspx?CveCotizacion={e.Row.DBCampo("CveVenta")}" - End If - End If - End Sub -#End Region - -#Region "D I R E C C I O N E N V I O " - Public Sub Edit_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - CveDireccionEnvio = GvRow.DataKey("CveDireccionEnvio").ToEntero - TxtEnvioDireccion.Text = GvRow.DataKey("EnvioDireccion") - TxtEnvioNoExt.Text = GvRow.DataKey("EnvioNoExt") - TxtEnvioNoInt.Text = GvRow.DataKey("EnvioNoInt") - TxtEnvioColonia.Text = GvRow.DataKey("EnvioColonia") - TxtEnvioCiudad.Text = GvRow.DataKey("EnvioCiudad") - TxtEnvioEstado.Text = GvRow.DataKey("EnvioEstado") - TxtEnvioContacto.Text = GvRow.DataKey("EnvioContacto") - 'TxtDepartamento.Text = GvRow.DataKey("EnvioDepartamento") - TxtEnvioCP.Text = GvRow.DataKey("EnvioCP") - TxtEnvioTel.Text = GvRow.DataKey("EnvioTel") - ChkEstatus.Checked = If(GvRow.DataKey("Estatus").ToString = "True", True, False) - If GvRow.DataKey("CveClienteSucursal").ToEntero > 0 Then DdlClienteSucursalEnvio.SelectedValueExist(GvRow.DataKey("CveClienteSucursal")) Else DdlClienteSucursalEnvio.SelectedValueExist("-1") - UpAddDireccion.Update() - RegistraScript("$('#divAddDireccionEnvio').modal();") - End Sub - Private Sub BtnAgregarDireccion_Click(sender As Object, e As EventArgs) Handles BtnAgregarDireccion.Click - Dim ObjClientes As New ClsClientes - Dim TieneError = False - Dim Estatus = If(ChkEstatus.Checked, 1, 0) - - If CveDireccionEnvio < 0 Then - CveDireccionEnvio = ObjClientes.DireccionEnvioAdd(CveCliente, TxtEnvioDireccion.Text.Trim, TxtEnvioNoExt.Text.Trim, TxtEnvioNoInt.Text.Trim, TxtEnvioColonia.Text.Trim, TxtEnvioCiudad.Text.Trim, TxtEnvioEstado.Text.Trim, TxtEnvioCP.Text.ToEntero, TxtEnvioContacto.Text.Trim, UsuarioActual.CveUsuario, Estatus, CveClienteSucursal:=DdlClienteSucursalEnvio.SelectedValue.ToEntero, EnvioTel:=TxtEnvioTel.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", "")) - - If CveDireccionEnvio < 0 Then - TieneError = True - End If - Else - - If Not ObjClientes.DireccionEnvioUpdate(CveCliente, TxtEnvioDireccion.Text.Trim, TxtEnvioNoExt.Text.Trim, TxtEnvioNoInt.Text.Trim, TxtEnvioColonia.Text.Trim, TxtEnvioCiudad.Text.Trim, TxtEnvioEstado.Text.Trim, TxtEnvioCP.Text.ToEntero, TxtEnvioContacto.Text.Trim, UsuarioActual.CveUsuario, Estatus, CveDireccionEnvio, CveClienteSucursal:=DdlClienteSucursalEnvio.SelectedValue.ToEntero, EnvioTel:=TxtEnvioTel.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", "")) Then - TieneError = True - End If - - End If - - If TieneError Then - Alert("Ocurrio un error al agregar/actualizar la dirección de envío", TipoMensaje.MsgError) - Else - RegistraScript("$('#divAddDireccionEnvio').modal('hide');") - CveDireccionEnvio = -1 - CargaDireccionesEnvio() - End If - End Sub - Private Sub BtnAgregarDireccionModal_Click(sender As Object, e As EventArgs) Handles BtnAgregarDireccionModal.Click - TxtEnvioDireccion.Text = "" - TxtEnvioNoExt.Text = "" - TxtEnvioNoInt.Text = "" - TxtEnvioColonia.Text = "" - TxtEnvioCiudad.Text = "" - TxtEnvioEstado.Text = "" - TxtEnvioContacto.Text = "" - 'TxtDepartamento.Text = "" - TxtEnvioCP.Text = "" - TxtEnvioTel.Text = "" - DdlClienteSucursalEnvio.SelectedValue = "-1" - UpAddDireccion.Update() - RegistraScript("$('#divAddDireccionEnvio').modal();") - End Sub - Private Sub GvDireccionesEnvio_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvDireccionesEnvio.RowDeleting - Dim ObjClientes As New ClsClientes - Dim TieneError = False - - Dim CveDireccionEnvio As Integer = GvDireccionesEnvio.Rows(e.RowIndex).DataKey("CveDireccionEnvio").ToEntero - - If Not ObjClientes.DireccionEnvioRemove(CveDireccionEnvio) Then - TieneError = True - End If - - If Not TieneError Then - GvDireccionesEnvio.EditIndex = -1 - Alert("Se eliminó correctamente la dirección de envío.", TipoMensaje.MsgInformacion) - Else - Alert("Ocurrió un error al eliminar la dirección de envío.", TipoMensaje.MsgAdvertencia) - End If - - CargaDireccionesEnvio() - End Sub - -#End Region - -#Region " IMPORTAR SALDOS " - - Private Sub HLImportarSaldos_Click(sender As Object, e As EventArgs) Handles HLImportarSaldos.Click - CargaClientesImportarSaldos() - RegistraScript(String.Format("$('#{0}').modal();", "DivImportarSaldos")) - End Sub - - Private Sub CargaClientesImportarSaldos() - DdlClienteImportarSaldos.setEsWebService(True) '(UsuarioActual.Empresa.Funcionalidad(105) = "1") - 'DdlClienteImportarSaldos.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) - 'DdlClienteImportarSaldos.DataBind() - UpImportarSaldos.Update() - 'DdlClienteImportarSaldos.Items.Insert(0, New ListItem("Seleccione", "-1")) - End Sub - Protected Sub BtnConsultarSaldoCliente_Click(sender As Object, e As EventArgs) - ConsultarAnticiposSaldosClientes() - End Sub - Private Sub ConsultarAnticiposSaldosClientes() - Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetAnticiposNCIxCCliente(DdlClienteImportarSaldos.SelectedValue.ToEntero) Then - GvImportarSaldos.DataSource = ObjMovtos.DtResultados.FiltraParametros("Saldo > 0 AND Saldo > 0 AND CveIE > 0") - Else - GvImportarSaldos.DataSource = Nothing - End If - ObjMovtos.Dispose() - - TxtSaldoImportar.Text = "" - - GvImportarSaldos.DataBind() - UpImportarSaldos.Update() - End Sub - Protected Sub BtnGuardarTransferencias_Click(sender As Object, e As EventArgs) - Dim EsValida = False - - For Each Gvr As GridViewRow In GvImportarSaldos.Rows - If Gvr.FCCheckBox("Chk").Checked AndAlso Gvr.FCTextBox("TxtImporte").Text.ToDouble > 0 Then - EsValida = True - End If - Next - - If Not EsValida Then - Alert("El importe a importar de saldos debe ser mayor a cero. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim ObjConta As New ClsContabilidad - ObjConta.IniciaTransacSQL() - Dim TieneError = False - - - Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Clientes/ImportarSaldos", 53, TxtCantidad.Text.Trim.ToDouble, TxtCantidad.Text.Trim.ToDouble, 1, TxtFechaImportarSaldos.Text.ToDate, "Traspaso de saldos de anticipos", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - Dim IVA As Decimal = 0 - Dim Importe As Decimal = 0 - Dim ImporteAplicar As Decimal = 0 - If CvePrePoliza > 0 Then - For Each Gvr As GridViewRow In GvImportarSaldos.Rows - If Gvr.FCCheckBox("Chk").Checked AndAlso Gvr.FCTextBox("TxtImporte").Text.ToDouble > 0 Then - - Importe = Gvr.FCTextBox("TxtImporte").Text.ToDecimal - IVA = Importe / Gvr.DataKey("Original").ToString.ToDecimal * Gvr.DataKey("IVA").ToString.ToDecimal 'TOMA EN CUENTA EL IVA - CONCEPTO DIFERENTE - ImporteAplicar = -(Importe - IVA) - If ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, "Traspaso de saldos de anticipos", 92, "Traspaso de saldos de anticipos.IVA", Now, 0, -1, CveCliente:=Gvr.DataKey("CveCliente").ToString.ToEntero, CveIE:=Gvr.DataKey("CveIE").ToString.ToEntero, ImporteMX:=ImporteAplicar) Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar, "Traspaso de saldos de anticipos", 66, "Traspaso de saldos de anticipos.IVA", Now, 0, -1, CveCliente:=CveCliente, CveIE:=Gvr.DataKey("CveIE").ToString.ToEntero, ImporteMX:=ImporteAplicar) Then - TieneError = True - End If - Else - TieneError = True - End If - - If Not TieneError Then - If IVA > 0 Then - If ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, -IVA, "Traspaso de saldos de anticipos.IVA", 61, "Traspaso de saldos de anticipos.IVA", Now, 0, -1, CveCliente:=Gvr.DataKey("CveCliente").ToString.ToEntero, CveIE:=Gvr.DataKey("CveIE").ToString.ToEntero, ImporteMX:=-IVA) Then - If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, "Traspaso de saldos de anticipos. IVA", 61, "Traspaso de saldos de anticipos.IVA", Now, 0, -1, CveCliente:=CveCliente, CveIE:=Gvr.DataKey("CveIE").ToString.ToEntero, ImporteMX:=IVA) Then - TieneError = True - End If - Else - TieneError = True - End If - End If - End If - - - End If - Next - Else - TieneError = True - End If - - - If Not TieneError Then - ObjConta.Commit() - Alert($"La importación de saldos se hizo correctamente.", TipoMensaje.MsgInformacion) - TxtSaldoImportar.Text = "" - ConsultarAnticiposSaldosClientes() - Else - ObjConta.RollBack() - Alert("Ocurrió un error al importar los saldos. Por favor vuelva a intentar.", TipoMensaje.MsgError) - End If - - ObjConta.Dispose() - End Sub - - Protected Sub GvImportarSaldos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvImportarSaldos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("ChkSaldo(this,{0},{1});", e.Row.FCTextBox("TxtImporte").ClientID, e.Row.DBCampo("Saldo"))) - e.Row.FCTextBox("TxtImporte").Attributes.Add("onKeyUp", String.Format("CambiaSaldo({0},this,{1});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"))) - End If - End Sub -#End Region - -#Region "Cuentas/Equipos" - Public Sub BtnAgregarCtaEquipo_Click(sender As Object, e As EventArgs) - HdnModalidad.Value = "I" - DivCicloComercial.Visible = False - TxtIdentificador.Text = "" - TxtNoSerie.Text = "" - DdlTipoCuentaDetalle.SelectedIndex = 0 - ChkAnticipo.Checked = False - PnlCicloComercial.Visible = False - CargaCuentasCaracteristicas() - UpBodyAgregarCuenta.Update() - UpDatos.Update() - RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarCuenta")) - End Sub - Private Sub BtnGuardarCuenta_Click(sender As Object, e As EventArgs) Handles BtnGuardarCuenta.Click - Dim objCuentasEquipos As New ClsGenerales() - Dim TieneError = False - objCuentasEquipos.IniciaTransacSQL() - - If HdnModalidad.Value = "I" Then - If Not objCuentasEquipos.AddCuentaEquipo(CveCliente, DdlTipoCuentaDetalle.SelectedValue.ToEntero, TxtIdentificador.Text.Trim, TxtNoSerie.Text.Trim, DdlClienteSucursal.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then - TieneError = True - End If - - If Not GuardaCaracteristicas(HdnModalidad.Value.ToString, objCuentasEquipos.CveCuentaEquipo, objCuentasEquipos) Then - TieneError = True - End If - - ElseIf HdnModalidad.Value = "U" Then - - If Not objCuentasEquipos.UpdateCuentaEquipo(TxtIdentificador.Text, TxtNoSerie.Text, True, DdlClienteSucursal.SelectedValue.ToEntero, CveCuentaEquipo) Then - TieneError = True - End If - - If Not GuardaCaracteristicas(HdnModalidad.Value.ToString, CveCuentaEquipo, objCuentasEquipos) Then - TieneError = True - End If - - End If - - If Not TieneError Then - objCuentasEquipos.Commit() - CargaCuentasEquipos() - TxtIdentificador.Text = "" - TxtNoSerie.Text = "" - DdlTipoCuentaDetalle.SelectedIndex = 0 - ChkAnticipo.Checked = False - Alert("Se agregó/Actualizó correctamente la Cuenta/Equipo.", TipoMensaje.MsgInformacion) - UpBodyAgregarCuenta.Update() - Else - Alert("Ocurrió un erro al Agregar/Actualizar la Cuenta/Equipo.", TipoMensaje.MsgInformacion) - objCuentasEquipos.RollBack() - End If - - objCuentasEquipos.Dispose() - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarCuenta")) - UpDatos.Update() - End Sub - Private Sub ChkCicloComercial_CheckedChanged(sender As Object, e As EventArgs) Handles ChkCicloComercial.CheckedChanged - If ChkCicloComercial.Checked = True Then - PnlCicloComercial.Visible = True - - DdlPS.Items.Clear() - DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) - DdlPS.DataBind() - DdlPS.Items.Insert(0, New ListItem("Seleccione", "-1")) - - Else - PnlCicloComercial.Visible = False - End If - End Sub - Private Sub BtnAgregarPS_Click(sender As Object, e As EventArgs) Handles BtnAgregarPS.Click - Dim Objeto As New ClsGenerales - If Objeto.AddCuentaEquipoPS(DdlPS.SelectedValue.ToEntero, CveCuentaEquipo) Then - Alert("Se ha agregado correctamente.", TipoMensaje.MsgInformacion) - CargaGridPS() - End If - Objeto.Dispose() - End Sub - Private Sub CargaGridPS() - Dim Objeto As New ClsGenerales() - If Objeto.GetCuentaEquipoPS(CveCuentaEquipo) Then - GvPS.DataSource = Objeto.DtResultados - GvPS.DataBind() - Objeto.Dispose() - End If - UpDatos.Update() - - End Sub - Public Sub imgE_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim Objeto As New ClsGenerales() - - HdnModalidad.Value = "U" - CveCuentaEquipo = GvRow.DataKey("CveCuentaEquipo").ToString.ToEntero - TxtIdentificador.Text = GvRow.DataKey("CuentaEquipo") - TxtNoSerie.Text = GvRow.DataKey("NoSerie") - DdlTipoCuentaDetalle.SelectedValueExist(GvRow.DataKey("CveTipoCuentaEquipo")) - BtnGuardarCuenta.Text = "Guardar" - DivCicloComercial.Visible = True - - If Objeto.GetCuentaEquipoPS(CveCuentaEquipo) Then - If Objeto.DtResultados.Rows.Count > 0 Then - GvPS.DataSource = Objeto.DtResultados - GvPS.DataBind() - ChkCicloComercial.Checked = True - PnlCicloComercial.Visible = True - DdlPS.Items.Clear() - DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) - DdlPS.DataBind() - DdlPS.Items.Insert(0, New ListItem("Seleccione", "-1")) - Else - ChkCicloComercial.Checked = False - PnlCicloComercial.Visible = False - End If - End If - - If Objeto.GetCaracteristicasValores(-1, -1, -1, -1, CveCuentaEquipo, -1, 6, UsuarioActual.CveEmpresa) Then - GvCuentasCaracteristicas.DataSource = Objeto.DtResultados - Else - GvCuentasCaracteristicas.DataSource = Nothing - End If - GvCuentasCaracteristicas.DataBind() - GvCuentasCaracteristicas.Visible = True - GvAddCuentaCaracteristica.Visible = False - - UpDatos.Update() - UpBodyAgregarCuenta.Update() - UpAgregarCuenta.Update() - Objeto.Dispose() - RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarCuenta")) - End Sub - Protected Sub GvCuentasEquipos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvCuentasEquipos.RowDeleting - Dim Objeto As New ClsGenerales - Dim TieneError = False - If Objeto.RemoveCuentaEquipo(GvCuentasEquipos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then - Alert("La cuenta Equipo se eliminó correctamente.", TipoMensaje.MsgInformacion) - Else - TieneError = True - Alert("Error al eliminar la cuenta/equipo.", TipoMensaje.MsgError) - End If - Objeto.Dispose() - UpDatos.Update() - CargaCuentasEquipos() - - - End Sub - Public Sub GvPS_Delete(sender As Object, e As EventArgs) - Dim Objeto As New ClsGenerales - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - - Dim CveCtaEq As Integer = GvRow.DataKey("CveCuentaEquipo").ToString.ToEntero - Dim CvePS As Integer = GvRow.DataKey("CvePS").ToString.ToEntero - - If Objeto.RemoveCuentaEquipoPS(CvePS, CveCtaEq) Then - Alert("El PS se eliminó correctamente.", TipoMensaje.MsgInformacion) - Else - Alert("Error al eliminar el PS", TipoMensaje.MsgError) - End If - - CargaGridPS() - UpDatos.Update() - Objeto.Dispose() - End Sub - Private Sub CargaCuentasCaracteristicas() - Dim ObjCaracteristicas As New ClsGenerales - - - If ObjCaracteristicas.GetCaracteristicas(-1, 6, UsuarioActual.CveEmpresa) Then - GvAddCuentaCaracteristica.DataSource = ObjCaracteristicas.DtResultados - Else - GvAddCuentaCaracteristica.DataSource = Nothing - End If - GvAddCuentaCaracteristica.DataBind() - GvAddCuentaCaracteristica.Visible = True - GvCuentasCaracteristicas.Visible = False - - ObjCaracteristicas.Dispose() - End Sub - Private Sub GvCuentasCaracteristicas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvCuentasCaracteristicas.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - Dim CveCaracteristicaTipo As Integer = e.Row.DataKey("CveCaracteristicaTipo").ToEntero - Dim dtTemp As New DataTable - Dim objCaracteristicas As New ClsGenerales - - Dim CveCaracteristica As Integer = e.Row.DataKey("CveCaracteristica").ToEntero - Dim CveCaracteristicaValor As Integer = e.Row.DataKey("CveCaracteristicaValor").ToEntero - Dim CveCaracteristicaOpcion As Integer = e.Row.DataKey("CveCaracteristicaOpcion").ToEntero - Dim CaracteristicaValor As String = e.Row.DataKey("CaracteristicaValor") - Dim Logitud As Integer = e.Row.DataKey("Longitud").ToString.ToEntero - - Dim DdlCarcateristicaOpcion As DropDownList = e.Row.FCDropDownList("DdlCarcateristicaOpcion") - Dim TxtCuentaValor As TextBox = e.Row.FCTextBox("TxtCuentaValor") - Dim RdlCarcateristicaOpcion As RadioButtonList = e.Row.FCRadioButtonList("RdlCarcateristicaOpcion") - Dim chkCaracteristicaValor As CheckBox = e.Row.FCCheckBox("chkCaracteristicaValor") - - Dim Requerido As Integer - If e.Row.DataKey("Requerido").ToString.ToUpper = "TRUE" Then - Requerido = 1 - Else - Requerido = 0 - End If - - TxtCuentaValor.Visible = False - Dim RFVCuentaValor1 As RequiredFieldValidator = e.Row.FCRequiredFieldValidator("RFVCuentaValor1") - RFVCuentaValor1.Enabled = False - - DdlCarcateristicaOpcion.Visible = False - Dim rfvDdlCarcateristicaOpcion1 As RequiredFieldValidator = e.Row.FCRequiredFieldValidator("rfvDdlCarcateristicaOpcion1") - rfvDdlCarcateristicaOpcion1.Enabled = False - - RdlCarcateristicaOpcion.Visible = False - Dim rfvRdlCarcateristicaOpcion = e.Row.FCRequiredFieldValidator("rfvRdlCarcateristicaOpcion") - rfvRdlCarcateristicaOpcion.Enabled = False - - Dim CalendarioCaractersiticas As AjaxControlToolkit.CalendarExtender = e.Row.FCCalendarExtender("CalendarioCaractersiticas") - CalendarioCaractersiticas.Enabled = False - - Dim _cvFechaF As CompareValidator = e.Row.FCCompareValidator("cvFechaF") - _cvFechaF.Enabled = False - - chkCaracteristicaValor.Visible = False - - If objCaracteristicas.GetCaracteriscasOpciones(-1, UsuarioActual.Empresa.CveEmpresa) Then - dtTemp = objCaracteristicas.DtResultados - End If - - If CaracteristicaValor.Length > 0 Then - TxtCuentaValor.Text = CaracteristicaValor - End If - - Select Case CveCaracteristicaTipo - Case 0 - 'txt - TxtCuentaValor.Visible = True - TxtCuentaValor.MaxLength = Logitud - If Requerido = 1 Then - RFVCuentaValor1.Enabled = True - End If - Exit Select - Case 1 - DdlCarcateristicaOpcion.Visible = True - dtTemp = dtTemp.FiltraParametros(" CveCaracteristica = " & CveCaracteristica) - DdlCarcateristicaOpcion.DataSource = dtTemp - DdlCarcateristicaOpcion.DataBind() - DdlCarcateristicaOpcion.Items.Insert(0, New ListItem("-", "-1")) - - If CveCaracteristicaValor <> -1 Then - DdlCarcateristicaOpcion.SelectedValueExist(CveCaracteristicaOpcion) - End If - - If Requerido = 1 Then - rfvDdlCarcateristicaOpcion1.Enabled = True - End If - Exit Select - Case 2 - 'radio - RdlCarcateristicaOpcion.Visible = True - dtTemp = dtTemp.FiltraParametros(" CveCaracteristica = " & CveCaracteristica) - RdlCarcateristicaOpcion.DataSource = dtTemp - RdlCarcateristicaOpcion.DataBind() - - If CveCaracteristicaValor <> -1 Then - RdlCarcateristicaOpcion.SelectedValuesIfExist(CveCaracteristicaOpcion.ToString) - End If - - If Requerido = 1 Then - rfvRdlCarcateristicaOpcion.Enabled = True - End If - Exit Select - Case 3 - 'Fecha txt Fecha - TxtCuentaValor.Visible = True - TxtCuentaValor.Width = 120 - cvFechaF.Enabled = True - CalendarioCaractersiticas.Enabled = True - RegistraScript(" $('#" & TxtCuentaValor.ClientID & "').mask('00/00/0000'); ") - If Requerido = 1 Then - RFVCuentaValor1.Enabled = True - End If - Exit Select - Case 4 - 'Multiline - TxtCuentaValor.Visible = True - TxtCuentaValor.MaxLength = Logitud - If Requerido = 1 Then - RFVCuentaValor1.Enabled = True - End If - Exit Select - Case 5 - 'CheckBox - chkCaracteristicaValor.Visible = True - If CaracteristicaValor = "1" Then - chkCaracteristicaValor.Checked = True - Else - chkCaracteristicaValor.Checked = False - End If - - Exit Select - Case 6 - TxtCuentaValor.Visible = True - TxtCuentaValor.TextMode = TextBoxMode.Number - - If Requerido = 1 Then - RFVCuentaValor1.Enabled = True - End If - Exit Select - End Select - - objCaracteristicas.Dispose() - End If - End Sub - Private Sub GvAddCuentaCaracteristica_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvAddCuentaCaracteristica.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - Dim CveCaracteristicaTipo As Integer = e.Row.DataKey("CveCaracteristicaTipo").ToEntero - Dim dtTemp As New DataTable - Dim objCaracteristicas As New ClsGenerales - - Dim CveCaracteristica As Integer = e.Row.DataKey("CveCaracteristica").ToEntero - Dim Logitud As Integer = e.Row.DataKey("Longitud").ToString.ToEntero - - Dim DdlCarcateristicaOpcion As DropDownList = e.Row.FCDropDownList("DdlCarcateristicaOpcion") - Dim TxtCuentaValor As TextBox = e.Row.FCTextBox("TxtCuentaValor") - Dim RdlCarcateristicaOpcion2 As RadioButtonList = e.Row.FCRadioButtonList("RdlCarcateristicaOpcion2") - Dim chkCaracteristicaValor2 As CheckBox = e.Row.FCCheckBox("chkCaracteristicaValor2") - - If objCaracteristicas.GetCaracteriscasOpciones(-1, UsuarioActual.Empresa.CveEmpresa) Then - dtTemp = objCaracteristicas.DtResultados - End If - - Dim Requerido As Integer - If e.Row.DataKey("Requerido").ToString.ToUpper = "TRUE" Then - Requerido = 1 - Else - Requerido = 0 - End If - - TxtCuentaValor.Visible = False - Dim RFVCuentaValor2 As RequiredFieldValidator = e.Row.FCRequiredFieldValidator("RFVCuentaValor2") - RFVCuentaValor2.Enabled = False - - DdlCarcateristicaOpcion.Visible = False - Dim rfvDdlCarcateristicaOpcion2 As RequiredFieldValidator = e.Row.FCRequiredFieldValidator("rfvDdlCarcateristicaOpcion2") - rfvDdlCarcateristicaOpcion2.Enabled = False - - RdlCarcateristicaOpcion2.Visible = False - Dim rfvRdlCarcateristicaOpcion = e.Row.FCRequiredFieldValidator("rfvRdlCarcateristicaOpcion2") - rfvRdlCarcateristicaOpcion.Enabled = False - - Dim cvFechaF As CompareValidator = e.Row.FCCompareValidator("cvFechaF2") - cvFechaF.Enabled = False - - Dim CalendarioCaractersiticas As AjaxControlToolkit.CalendarExtender = e.Row.FCCalendarExtender("CalendarioCaractersiticas1") - CalendarioCaractersiticas.Enabled = False - - chkCaracteristicaValor2.Visible = False - - Select Case CveCaracteristicaTipo - Case 0 - TxtCuentaValor.Visible = True - Exit Select - Case 1 - DdlCarcateristicaOpcion.Visible = True - dtTemp = dtTemp.FiltraParametros(" CveCaracteristica = " & CveCaracteristica) - DdlCarcateristicaOpcion.DataSource = dtTemp - DdlCarcateristicaOpcion.DataBind() - DdlCarcateristicaOpcion.Items.Insert(0, New ListItem("-", "-1")) - - If Requerido = 1 Then - rfvDdlCarcateristicaOpcion2.Enabled = True - End If - - Exit Select - Case 2 - 'radio - RdlCarcateristicaOpcion2.Visible = True - dtTemp = dtTemp.FiltraParametros(" CveCaracteristica = " & CveCaracteristica) - RdlCarcateristicaOpcion2.DataSource = dtTemp - RdlCarcateristicaOpcion2.DataBind() - - If Requerido = 1 Then - rfvRdlCarcateristicaOpcion.Enabled = True - End If - Exit Select - Case 3 - 'Fecha txt Fecha - TxtCuentaValor.Visible = True - TxtCuentaValor.Width = 120 - cvFechaF.Enabled = True - CalendarioCaractersiticas.Enabled = True - RegistraScript(" $('#" & TxtCuentaValor.ClientID & "').mask('00/00/0000'); ") - - If Requerido = 1 Then - RFVCuentaValor2.Enabled = True - End If - Exit Select - Case 4 - 'Multiline - TxtCuentaValor.Visible = True - TxtCuentaValor.MaxLength = Logitud - - If Requerido = 1 Then - RFVCuentaValor2.Enabled = True - End If - Exit Select - Case 5 - 'CheckBox - chkCaracteristicaValor2.Visible = True - Exit Select - Case 6 - TxtCuentaValor.Visible = True - TxtCuentaValor.TextMode = TextBoxMode.Number - - If Requerido = 1 Then - RFVCuentaValor2.Enabled = True - End If - Exit Select - End Select - objCaracteristicas.Dispose() - End If - End Sub - Private Function GuardaCaracteristicas(Modalidad As String, CveCuentaEquipo As Integer, ByRef ObjCarac As ClsGenerales) As Boolean - Dim Retorno = False - - If Modalidad.ToString = "I" Then - For Each gvr As GridViewRow In GvAddCuentaCaracteristica.Rows - Dim CveCaracteristica As Integer = gvr.DataKey("CveCaracteristica").ToEntero - Dim CveCaracteristicaTipo As Integer = gvr.DataKey("CveCaracteristicaTipo").ToEntero - - Dim _DdlCarcateristicaOpcion As DropDownList = gvr.FCDropDownList("DdlCarcateristicaOpcion") - Dim _TxtCaracteristicaOpcion As TextBox = gvr.FCTextBox("TxtCuentaValor") - Dim _RdlCarcateristicaOpcion As RadioButtonList = gvr.FCRadioButtonList("RdlCarcateristicaOpcion2") - Dim _chkCaracteristicaValor As CheckBox = gvr.FCCheckBox("chkCaracteristicaValor2") - - Dim CveCaracteristicaOpcion As Integer = -1 - Dim CaracteristicaValor As String = "" - Dim CaracteristicaValorDate As Date = Now - Dim CaracteristicaValorInt As Integer = -1 - - Dim AgregaCaracteristica As Boolean = False - - Select Case CveCaracteristicaTipo - Case 0 - 'txt - CaracteristicaValor = _TxtCaracteristicaOpcion.Text - - If CaracteristicaValor.Trim.Length > 0 Then - AgregaCaracteristica = True - Else - AgregaCaracteristica = False - End If - Exit Select - Case 1 - 'drop - CveCaracteristicaOpcion = _DdlCarcateristicaOpcion.SelectedValue.ToEntero - - If CveCaracteristicaOpcion > 0 Then - AgregaCaracteristica = True - Else - AgregaCaracteristica = False - End If - Exit Select - Case 2 - 'radio - CveCaracteristicaOpcion = _RdlCarcateristicaOpcion.SelectedValue.ToEntero - - If CveCaracteristicaOpcion > 0 Then - AgregaCaracteristica = True - Else - AgregaCaracteristica = False - End If - Exit Select - Case 3 - 'Fecha txt Fecha - If _TxtCaracteristicaOpcion.Text.Trim.Length > 0 Then - CaracteristicaValorDate = _TxtCaracteristicaOpcion.Text.Trim.ToDate - CaracteristicaValor = CaracteristicaValorDate.ToString("dd/MM/yyyy") - - If CaracteristicaValor.Trim.ToDate.ToString("dd/MM/yyyy").ToString.Length > 0 Then - AgregaCaracteristica = True - Else - AgregaCaracteristica = False - End If - Else - AgregaCaracteristica = False - End If - Case 4 - 'txt - CaracteristicaValor = _TxtCaracteristicaOpcion.Text - - If CaracteristicaValor.Trim.Length > 0 Then - AgregaCaracteristica = True - Else - AgregaCaracteristica = False - End If - Exit Select - Case 5 - 'CheckBox - If _chkCaracteristicaValor.Checked Then - CaracteristicaValor = "1" - Else - CaracteristicaValor = "0" - End If - AgregaCaracteristica = True - Exit Select - Case 6 - 'txt numerico - 'txt - CaracteristicaValor = _TxtCaracteristicaOpcion.Text.ToEntero.ToString - - AgregaCaracteristica = True - Exit Select - End Select - - If AgregaCaracteristica Then - If ObjCarac.AddUpdateCaracteristicasValores(CveCaracteristica, CveCaracteristicaOpcion, CaracteristicaValor, UsuarioActual.CveUsuario, CveCuentaEquipo:=CveCuentaEquipo) Then - Retorno = True - Else - Exit For - End If - End If - Next - ElseIf Modalidad.ToString = "U" Then - For Each gvr As GridViewRow In GvCuentasCaracteristicas.Rows - Dim _CaracteristicaValor As Integer = gvr.DataKey("CaracteristicaValor").ToEntero - Dim _CveCaracteristica As Integer = gvr.DataKey("CveCaracteristica").ToEntero - Dim _CveCaracteristicaValor As Integer = gvr.DataKey("CveCaracteristicaValor").ToEntero - Dim _CveCaracteristicaTipo As Integer = gvr.DataKey("CveCaracteristicaTipo").ToEntero - - Dim _DdlCarcateristicaOpcion As DropDownList = gvr.FCDropDownList("DdlCarcateristicaOpcion") - Dim _TxtCaracteristicaOpcion As TextBox = gvr.FCTextBox("TxtCuentaValor") - Dim _RdlCarcateristicaOpcion As RadioButtonList = gvr.FCRadioButtonList("RdlCarcateristicaOpcion") - Dim _chkCaracteristicaValor As CheckBox = gvr.FCCheckBox("chkCaracteristicaValor") - - Dim CveCaracteristicaOpcion As Integer = -1 - Dim CaracteristicaValor As String = "" - Dim CaracteristicaValorDate As Date = Now - Dim CaracteristicaValorInt As Integer = -1 - - Select Case _CveCaracteristicaTipo - Case 0 - 'txt - CaracteristicaValor = _TxtCaracteristicaOpcion.Text - Exit Select - Case 1 - 'drop - CveCaracteristicaOpcion = _DdlCarcateristicaOpcion.SelectedValue.ToEntero - Exit Select - Case 2 - 'radio - CveCaracteristicaOpcion = _RdlCarcateristicaOpcion.SelectedValue.ToEntero - Exit Select - Case 3 - 'Fecha txt Fecha - If _TxtCaracteristicaOpcion.Text.Trim.Length > 0 Then - CaracteristicaValorDate = _TxtCaracteristicaOpcion.Text.Trim.ToDate - CaracteristicaValor = CaracteristicaValorDate.ToString("dd/MM/yyyy") - Exit Select - End If - Case 4 - 'txt - CaracteristicaValor = _TxtCaracteristicaOpcion.Text - Exit Select - Case 5 - 'CheckBox - If _chkCaracteristicaValor.Checked Then - CaracteristicaValor = "1" - Else - CaracteristicaValor = "0" - End If - Exit Select - Case 6 - 'txt numerico - 'txt - CaracteristicaValor = _TxtCaracteristicaOpcion.Text.ToEntero.ToString - Exit Select - End Select - - If ObjCarac.AddUpdateCaracteristicasValores(_CveCaracteristica, CveCaracteristicaOpcion, CaracteristicaValor, UsuarioActual.CveUsuario, CveCaracteristicaValor:=_CveCaracteristicaValor, CveCuentaEquipo:=CveCuentaEquipo) Then - Retorno = True - Else - Exit For - End If - Next - End If - - Return Retorno - End Function -#End Region - -#Region "GPS" - Protected Sub btnCargaArrayDisp_Click(sender As Object, e As EventArgs) Handles btnCargaArrayDisp.Click - If hdnArrayDispositivo.Value.Length > 0 Then - CargaDispositivos(DdlEstatusDispositivos.SelectedValue.ToEntero()) - End If - End Sub - Protected Sub DdlEstatusDispositivos_SelectedIndexChanged(sender As Object, e As EventArgs) - CargaDispositivos(DdlEstatusDispositivos.SelectedValue.ToEntero()) - End Sub - Private Sub CargaDispositivos(Optional Estatus As Integer = 1) - Dim ObjGPS As New ClsGPS - If ObjGPS.DispositivosGet(-1, Estatus, CveCliente) Then - GvDatos.DataSource = ObjGPS.DtResultados - Else - GvDatos.DataSource = Nothing - End If - ObjGPS.Dispose() - GvDatos.DataBind() - UpDispositivos.Update() - End Sub - Private Sub CargaGlobalDispositos() - Dim ObjGPS As New ClsGPS - - If ObjGPS.DispositivosGet(-1, -1, -1, -1) Then - GlobalDTDispositivos(-1) = ObjGPS.DtResultados - End If - - If ObjGPS.DispositivosUsuariosGet(-1, -1, -1, -1, -1) Then - GlobalDTDispositivosUsuarios(-1, -1) = ObjGPS.DtResultados - End If - - ObjGPS.Dispose() - End Sub - Protected Sub GvDispositivos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - e.Row.VerticalAlign = VerticalAlign.Middle - If e.Row.DBCampo("Estatus").ToString.ToEntero = 1 Then - e.Row.FCLabel("LblEstatus").Text = "Activo" - e.Row.FCLabel("LblEstatus").CssClass = "label label-success" - Else - e.Row.FCLabel("LblEstatus").Text = "Inactivo" - e.Row.FCLabel("LblEstatus").CssClass = "label label-danger" - End If - e.Row.FCLinkButton("imgE").Attributes.Add("onclick", $"javascript:AbrirVentana('/GPS/WizardDispositivos.aspx?CveDispositivo={e.Row.DBCampo("CveDispositivo").ToString}&CveCliente={CveCliente}&EsPopup=1', 801, 701);") - End If - End Sub - - Protected Sub GvDispositivos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting - Dim GPS As New ClsGPS - Dim CveDispositivo As Integer = GvDatos.Rows(e.RowIndex).DataKey("CveDispositivo").ToEntero - If GPS.DispositivosDelete(CveDispositivo) Then - Alert("El Dispositivo se eliminó correctamente", TipoMensaje.MsgInformacion) - End If - GPS.Dispose() - CargaDispositivos() - CargaGlobalDispositos() - UpDispositivos.Update() - End Sub - Private Sub CargaEmpresasUsuario(CveEmpresa As Integer) - Dim Dt As DataTable = GlobalDTUsuarios(UsuarioActual.CveUsuario) - - If Dt IsNot Nothing Then - If Dt.Rows.Count > 0 Then - DdlEmpresaDispositivo.DataSource = Dt.FiltraParametros("CvePlataforma = 1 OR (CvePlataforma = 3 AND CveCliente IS NULL)", "Empresa") - - If DdlEmpresaDispositivo.SelectedValue.ToEntero() <= 0 Then - DdlEmpresaDispositivo.SelectedValueExist(CveEmpresa) - End If - - DdlClienteDispositivo.DataSource = Dt.FiltraParametros($"CvePlataforma = 3 AND CveEmpresa = {CveEmpresa}", "Empresa") - - DdlEmpresaDispositivo.DataBind() - DdlClienteDispositivo.DataBind() - - DdlClienteDispositivo.Items.Insert(0, New ListItem("Seleccione", "-1")) - End If - End If - End Sub - Private Sub CargaClienteDispositivos(CveEmpresa As Integer) - Dim Dt As DataTable = GlobalDTUsuarios(UsuarioActual.CveUsuario) - +#End Region + +#Region "E N V I O C O R R E O" + Private Sub EnviaCorreo(Liga As String, LigaActivar As String) + + Try + Dim Para = TxtEmail.Text.Trim + Dim Asunto = "ACTIVACIÓN DEL PORTAL DE CLIENTE" + Dim Usuario = TxtEmail.Text.Trim + + Dim SBBody As New StringBuilder + 'Linia de estilos + SBBody.Append("") + 'incio Cuerpo del correo + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("ALTA DE CUENTA") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.AppendFormat(" Estimado {0}:
    ", TxtNombre.Text.ToUpper) + SBBody.AppendFormat("El presente correo es para informarle que se le han asignado los siguientes datos para el acceso al Portal del Cliente de: {0}

    ", UsuarioActual.Empresa.Empresa) + + SBBody.Append("
    ") + SBBody.Append("
    Datos de Usuario:
    ") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("
    Dirección de Acceso
    ") + SBBody.AppendFormat("", Liga) + SBBody.Append("
    ") + SBBody.Append("
    ") + + SBBody.Append("
    Usuario:
    ") + SBBody.AppendFormat("
    {0}
    ", Usuario) + SBBody.Append("
    ") + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Haga click para activar su cuenta
    ") + SBBody.AppendFormat("", LigaActivar) + SBBody.Append("
    ") + + + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("Para Activar su cuenta debera cambiar su contraseña.

    ") + SBBody.Append("
    ") + SBBody.Append("Nota Favor de NO responder este correo. ") + SBBody.Append("


    ") + SBBody.AppendFormat("", UrlSitio) + SBBody.Append("
    ") + SBBody.Append("
    ") + 'Termino Cuerpo del correo + + Dim Hilo As New System.Threading.Thread(Sub() MandaCorreo(Asunto, Para, SBBody.ToString)) + Hilo.Start() + Alert("El correo se ha enviado correctamente a: " + TxtEmail.Text + ".", TipoMensaje.MsgInformacion) + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL", ex) + End Try + End Sub + + + Private Sub MandaCorreo(Asunto As String, Para As String, Body As String) + Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para) + a.GuardaLog() + Dim Mail As New ClsSisMail() + Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) + End Sub +#End Region + +#Region " COTIZACIONES " + + Protected Sub BtnVerMasCot_Click(sender As Object, e As EventArgs) + If BtnVerMasCot.Text = "Ver Más" Then + CargaCotizaciones(-1) + BtnVerMasCot.Text = "Ver Menos" + Else + CargaCotizaciones(21) + BtnVerMasCot.Text = "Ver Más" + End If + End Sub + Private Function CargaCotizaciones(Optional SelectTop As Integer = 21, Optional CveClienteSucursal As Integer = -1) As Boolean + Dim Retorno As Boolean = False + Dim ObjClientes As New ClsClientes() + If ObjClientes.GetCotizaciones(CveCliente, SelectTop, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) Then + If ObjClientes.DtResultados.Rows.Count > 0 Then + 'Carga Generales + LtlCantidadCotizaciones.Text = ObjClientes.DtResultados.Rows(0)("CountTotal").ToString.FormatoNumero(2) + LtlFactorCotVentas.Text = If(LtlCantidad.Text.ToEntero > 0, (LtlCantidadCotizaciones.Text.ToEntero / LtlCantidad.Text.ToEntero).FormatoNumero, "0.00") + 'Carga Grid + GvCot.DataSource = ObjClientes.DtResultados + DtCotizaciones = ObjClientes.DtResultados + + If UsuarioActual.Empresa.UsaOS Then + GvCot.Columns(9).Visible = True + Else + GvCot.Columns(9).Visible = True + End If + + + Else + LtlCantidadCotizaciones.Text = "0" + LtlFactorCotVentas.Text = "0.00" + GvCot.DataSource = Nothing + DtCotizaciones = Nothing + End If + Else + GvCot.DataSource = Nothing + DtCotizaciones = Nothing + End If + ObjClientes.Dispose() + GvCot.DataBind() + Return Retorno + End Function + Protected Sub GVCotizaciones_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvCot.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + Dim HLFacturar As HtmlAnchor = DirectCast(e.Row.FindControl("HLFacturarCot"), HtmlAnchor) + + + 'CABECERA + If e.Row.RowIndex = 0 Then + e.Row.BackColor = Drawing.Color.LightGray + DirectCast(e.Row.FindControl("HLSendMail2"), HtmlAnchor).Visible = False + e.Row.FindControl("HlOS").Visible = False + HLFacturar.Visible = False + End If + + e.Row.FCLiteral("LtlCotizacion").Text = String.Format("{1}", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("SerieFolio")) + e.Row.FCLiteral("LtlFolioVenta").Text = String.Format("{1}", e.Row.DBCampo("CveVentaPadre"), e.Row.DBCampo("FolioVenta")) + DirectCast(e.Row.FindControl("HLSendMail2"), HtmlAnchor).HRef = String.Format("javascript:$get('HdnTipoDocto2').value='Cot';$get('HdnCveVenta2').value='{0}';$get('HdnFolioVenta2').value='{1}';$get('TxtParaMail2').value='{2}';$get('HdnSerieFolio2').value='{2}';$get('HdnSubProyecto2').value='{2}'; $('#ModalDivMail2').modal();", e.Row.DBCampo("CveVenta"), e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("Correo"), e.Row.DBCampo("SerieFolio"), e.Row.DBCampo("SubProyecto")) + + + + 'FACTURAR COTIZACION + If e.Row.DBCampo("FolioVenta") <> "" Then + HLFacturar.Visible = False + Else + HLFacturar.HRef = $"/Ventas/Ventas.aspx?CveCotizacion={e.Row.DBCampo("CveVenta")}" + End If + End If + End Sub +#End Region + +#Region "D I R E C C I O N E N V I O " + Public Sub Edit_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + CveDireccionEnvio = GvRow.DataKey("CveDireccionEnvio").ToEntero + TxtEnvioDireccion.Text = GvRow.DataKey("EnvioDireccion") + TxtEnvioNoExt.Text = GvRow.DataKey("EnvioNoExt") + TxtEnvioNoInt.Text = GvRow.DataKey("EnvioNoInt") + TxtEnvioColonia.Text = GvRow.DataKey("EnvioColonia") + TxtEnvioCiudad.Text = GvRow.DataKey("EnvioCiudad") + TxtEnvioEstado.Text = GvRow.DataKey("EnvioEstado") + TxtEnvioContacto.Text = GvRow.DataKey("EnvioContacto") + 'TxtDepartamento.Text = GvRow.DataKey("EnvioDepartamento") + TxtEnvioCP.Text = GvRow.DataKey("EnvioCP") + TxtEnvioTel.Text = GvRow.DataKey("EnvioTel") + ChkEstatus.Checked = If(GvRow.DataKey("Estatus").ToString = "True", True, False) + If GvRow.DataKey("CveClienteSucursal").ToEntero > 0 Then DdlClienteSucursalEnvio.SelectedValueExist(GvRow.DataKey("CveClienteSucursal")) Else DdlClienteSucursalEnvio.SelectedValueExist("-1") + UpAddDireccion.Update() + RegistraScript("$('#divAddDireccionEnvio').modal();") + End Sub + Private Sub BtnAgregarDireccion_Click(sender As Object, e As EventArgs) Handles BtnAgregarDireccion.Click + Dim ObjClientes As New ClsClientes + Dim TieneError = False + Dim Estatus = If(ChkEstatus.Checked, 1, 0) + + If CveDireccionEnvio < 0 Then + CveDireccionEnvio = ObjClientes.DireccionEnvioAdd(CveCliente, TxtEnvioDireccion.Text.Trim, TxtEnvioNoExt.Text.Trim, TxtEnvioNoInt.Text.Trim, TxtEnvioColonia.Text.Trim, TxtEnvioCiudad.Text.Trim, TxtEnvioEstado.Text.Trim, TxtEnvioCP.Text.ToEntero, TxtEnvioContacto.Text.Trim, UsuarioActual.CveUsuario, Estatus, CveClienteSucursal:=DdlClienteSucursalEnvio.SelectedValue.ToEntero, EnvioTel:=TxtEnvioTel.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", "")) + + If CveDireccionEnvio < 0 Then + TieneError = True + End If + Else + + If Not ObjClientes.DireccionEnvioUpdate(CveCliente, TxtEnvioDireccion.Text.Trim, TxtEnvioNoExt.Text.Trim, TxtEnvioNoInt.Text.Trim, TxtEnvioColonia.Text.Trim, TxtEnvioCiudad.Text.Trim, TxtEnvioEstado.Text.Trim, TxtEnvioCP.Text.ToEntero, TxtEnvioContacto.Text.Trim, UsuarioActual.CveUsuario, Estatus, CveDireccionEnvio, CveClienteSucursal:=DdlClienteSucursalEnvio.SelectedValue.ToEntero, EnvioTel:=TxtEnvioTel.Text.Trim.Replace(" ", "").Replace("(", "").Replace(")", "").Replace("-", "").Replace("_", "")) Then + TieneError = True + End If + + End If + + If TieneError Then + Alert("Ocurrio un error al agregar/actualizar la dirección de envío", TipoMensaje.MsgError) + Else + RegistraScript("$('#divAddDireccionEnvio').modal('hide');") + CveDireccionEnvio = -1 + CargaDireccionesEnvio() + End If + End Sub + Private Sub BtnAgregarDireccionModal_Click(sender As Object, e As EventArgs) Handles BtnAgregarDireccionModal.Click + TxtEnvioDireccion.Text = "" + TxtEnvioNoExt.Text = "" + TxtEnvioNoInt.Text = "" + TxtEnvioColonia.Text = "" + TxtEnvioCiudad.Text = "" + TxtEnvioEstado.Text = "" + TxtEnvioContacto.Text = "" + 'TxtDepartamento.Text = "" + TxtEnvioCP.Text = "" + TxtEnvioTel.Text = "" + DdlClienteSucursalEnvio.SelectedValue = "-1" + UpAddDireccion.Update() + RegistraScript("$('#divAddDireccionEnvio').modal();") + End Sub + Private Sub GvDireccionesEnvio_RowDeleting(sender As Object, e As GridViewDeleteEventArgs) Handles GvDireccionesEnvio.RowDeleting + Dim ObjClientes As New ClsClientes + Dim TieneError = False + + Dim CveDireccionEnvio As Integer = GvDireccionesEnvio.Rows(e.RowIndex).DataKey("CveDireccionEnvio").ToEntero + + If Not ObjClientes.DireccionEnvioRemove(CveDireccionEnvio) Then + TieneError = True + End If + + If Not TieneError Then + GvDireccionesEnvio.EditIndex = -1 + Alert("Se eliminó correctamente la dirección de envío.", TipoMensaje.MsgInformacion) + Else + Alert("Ocurrió un error al eliminar la dirección de envío.", TipoMensaje.MsgAdvertencia) + End If + + CargaDireccionesEnvio() + End Sub + +#End Region + +#Region " IMPORTAR SALDOS " + + Private Sub HLImportarSaldos_Click(sender As Object, e As EventArgs) Handles HLImportarSaldos.Click + CargaClientesImportarSaldos() + RegistraScript(String.Format("$('#{0}').modal();", "DivImportarSaldos")) + End Sub + + Private Sub CargaClientesImportarSaldos() + DdlClienteImportarSaldos.setEsWebService(True) '(UsuarioActual.Empresa.Funcionalidad(105) = "1") + 'DdlClienteImportarSaldos.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa) + 'DdlClienteImportarSaldos.DataBind() + UpImportarSaldos.Update() + 'DdlClienteImportarSaldos.Items.Insert(0, New ListItem("Seleccione", "-1")) + End Sub + Protected Sub BtnConsultarSaldoCliente_Click(sender As Object, e As EventArgs) + ConsultarAnticiposSaldosClientes() + End Sub + Private Sub ConsultarAnticiposSaldosClientes() + Dim ObjMovtos As New ClsMovimientos() + If ObjMovtos.GetAnticiposNCIxCCliente(DdlClienteImportarSaldos.SelectedValue.ToEntero) Then + GvImportarSaldos.DataSource = ObjMovtos.DtResultados.FiltraParametros("Saldo > 0 AND Saldo > 0 AND CveIE > 0") + Else + GvImportarSaldos.DataSource = Nothing + End If + ObjMovtos.Dispose() + + TxtSaldoImportar.Text = "" + + GvImportarSaldos.DataBind() + UpImportarSaldos.Update() + End Sub + Protected Sub BtnGuardarTransferencias_Click(sender As Object, e As EventArgs) + Dim EsValida = False + + For Each Gvr As GridViewRow In GvImportarSaldos.Rows + If Gvr.FCCheckBox("Chk").Checked AndAlso Gvr.FCTextBox("TxtImporte").Text.ToDouble > 0 Then + EsValida = True + End If + Next + + If Not EsValida Then + Alert("El importe a importar de saldos debe ser mayor a cero. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Dim ObjConta As New ClsContabilidad + ObjConta.IniciaTransacSQL() + Dim TieneError = False + + + Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Clientes/ImportarSaldos", 53, TxtCantidad.Text.Trim.ToDouble, TxtCantidad.Text.Trim.ToDouble, 1, TxtFechaImportarSaldos.Text.ToDate, "Traspaso de saldos de anticipos", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + Dim IVA As Decimal = 0 + Dim Importe As Decimal = 0 + Dim ImporteAplicar As Decimal = 0 + If CvePrePoliza > 0 Then + For Each Gvr As GridViewRow In GvImportarSaldos.Rows + If Gvr.FCCheckBox("Chk").Checked AndAlso Gvr.FCTextBox("TxtImporte").Text.ToDouble > 0 Then + + Importe = Gvr.FCTextBox("TxtImporte").Text.ToDecimal + IVA = Importe / Gvr.DataKey("Original").ToString.ToDecimal * Gvr.DataKey("IVA").ToString.ToDecimal 'TOMA EN CUENTA EL IVA - CONCEPTO DIFERENTE + ImporteAplicar = -(Importe - IVA) + If ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, ImporteAplicar, "Traspaso de saldos de anticipos", 92, "Traspaso de saldos de anticipos.IVA", Now, 0, -1, CveCliente:=Gvr.DataKey("CveCliente").ToString.ToEntero, CveIE:=Gvr.DataKey("CveIE").ToString.ToEntero, ImporteMX:=ImporteAplicar) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, ImporteAplicar, "Traspaso de saldos de anticipos", 66, "Traspaso de saldos de anticipos.IVA", Now, 0, -1, CveCliente:=CveCliente, CveIE:=Gvr.DataKey("CveIE").ToString.ToEntero, ImporteMX:=ImporteAplicar) Then + TieneError = True + End If + Else + TieneError = True + End If + + If Not TieneError Then + If IVA > 0 Then + If ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, -IVA, "Traspaso de saldos de anticipos.IVA", 61, "Traspaso de saldos de anticipos.IVA", Now, 0, -1, CveCliente:=Gvr.DataKey("CveCliente").ToString.ToEntero, CveIE:=Gvr.DataKey("CveIE").ToString.ToEntero, ImporteMX:=-IVA) Then + If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, IVA, "Traspaso de saldos de anticipos. IVA", 61, "Traspaso de saldos de anticipos.IVA", Now, 0, -1, CveCliente:=CveCliente, CveIE:=Gvr.DataKey("CveIE").ToString.ToEntero, ImporteMX:=IVA) Then + TieneError = True + End If + Else + TieneError = True + End If + End If + End If + + + End If + Next + Else + TieneError = True + End If + + + If Not TieneError Then + ObjConta.Commit() + Alert($"La importación de saldos se hizo correctamente.", TipoMensaje.MsgInformacion) + TxtSaldoImportar.Text = "" + ConsultarAnticiposSaldosClientes() + Else + ObjConta.RollBack() + Alert("Ocurrió un error al importar los saldos. Por favor vuelva a intentar.", TipoMensaje.MsgError) + End If + + ObjConta.Dispose() + End Sub + + Protected Sub GvImportarSaldos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvImportarSaldos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("ChkSaldo(this,{0},{1});", e.Row.FCTextBox("TxtImporte").ClientID, e.Row.DBCampo("Saldo"))) + e.Row.FCTextBox("TxtImporte").Attributes.Add("onKeyUp", String.Format("CambiaSaldo({0},this,{1});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"))) + End If + End Sub +#End Region + +#Region "Cuentas/Equipos" + Public Sub BtnAgregarCtaEquipo_Click(sender As Object, e As EventArgs) + HdnModalidad.Value = "I" + DivCicloComercial.Visible = False + TxtIdentificador.Text = "" + TxtNoSerie.Text = "" + DdlTipoCuentaDetalle.SelectedIndex = 0 + ChkAnticipo.Checked = False + PnlCicloComercial.Visible = False + CargaCuentasCaracteristicas() + UpBodyAgregarCuenta.Update() + UpDatos.Update() + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarCuenta")) + End Sub + Private Sub BtnGuardarCuenta_Click(sender As Object, e As EventArgs) Handles BtnGuardarCuenta.Click + Dim objCuentasEquipos As New ClsGenerales() + Dim TieneError = False + objCuentasEquipos.IniciaTransacSQL() + + If HdnModalidad.Value = "I" Then + If Not objCuentasEquipos.AddCuentaEquipo(CveCliente, DdlTipoCuentaDetalle.SelectedValue.ToEntero, TxtIdentificador.Text.Trim, TxtNoSerie.Text.Trim, DdlClienteSucursal.SelectedValue.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + TieneError = True + End If + + If Not GuardaCaracteristicas(HdnModalidad.Value.ToString, objCuentasEquipos.CveCuentaEquipo, objCuentasEquipos) Then + TieneError = True + End If + + ElseIf HdnModalidad.Value = "U" Then + + If Not objCuentasEquipos.UpdateCuentaEquipo(TxtIdentificador.Text, TxtNoSerie.Text, True, DdlClienteSucursal.SelectedValue.ToEntero, CveCuentaEquipo) Then + TieneError = True + End If + + If Not GuardaCaracteristicas(HdnModalidad.Value.ToString, CveCuentaEquipo, objCuentasEquipos) Then + TieneError = True + End If + + End If + + If Not TieneError Then + objCuentasEquipos.Commit() + CargaCuentasEquipos() + TxtIdentificador.Text = "" + TxtNoSerie.Text = "" + DdlTipoCuentaDetalle.SelectedIndex = 0 + ChkAnticipo.Checked = False + Alert("Se agregó/Actualizó correctamente la Cuenta/Equipo.", TipoMensaje.MsgInformacion) + UpBodyAgregarCuenta.Update() + Else + Alert("Ocurrió un erro al Agregar/Actualizar la Cuenta/Equipo.", TipoMensaje.MsgInformacion) + objCuentasEquipos.RollBack() + End If + + objCuentasEquipos.Dispose() + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAgregarCuenta")) + UpDatos.Update() + End Sub + Private Sub ChkCicloComercial_CheckedChanged(sender As Object, e As EventArgs) Handles ChkCicloComercial.CheckedChanged + If ChkCicloComercial.Checked = True Then + PnlCicloComercial.Visible = True + + DdlPS.Items.Clear() + DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) + DdlPS.DataBind() + DdlPS.Items.Insert(0, New ListItem("Seleccione", "-1")) + + Else + PnlCicloComercial.Visible = False + End If + End Sub + Private Sub BtnAgregarPS_Click(sender As Object, e As EventArgs) Handles BtnAgregarPS.Click + Dim Objeto As New ClsGenerales + If Objeto.AddCuentaEquipoPS(DdlPS.SelectedValue.ToEntero, CveCuentaEquipo) Then + Alert("Se ha agregado correctamente.", TipoMensaje.MsgInformacion) + CargaGridPS() + End If + Objeto.Dispose() + End Sub + Private Sub CargaGridPS() + Dim Objeto As New ClsGenerales() + If Objeto.GetCuentaEquipoPS(CveCuentaEquipo) Then + GvPS.DataSource = Objeto.DtResultados + GvPS.DataBind() + Objeto.Dispose() + End If + UpDatos.Update() + + End Sub + Public Sub imgE_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim Objeto As New ClsGenerales() + + HdnModalidad.Value = "U" + CveCuentaEquipo = GvRow.DataKey("CveCuentaEquipo").ToString.ToEntero + TxtIdentificador.Text = GvRow.DataKey("CuentaEquipo") + TxtNoSerie.Text = GvRow.DataKey("NoSerie") + DdlTipoCuentaDetalle.SelectedValueExist(GvRow.DataKey("CveTipoCuentaEquipo")) + BtnGuardarCuenta.Text = "Guardar" + DivCicloComercial.Visible = True + + If Objeto.GetCuentaEquipoPS(CveCuentaEquipo) Then + If Objeto.DtResultados.Rows.Count > 0 Then + GvPS.DataSource = Objeto.DtResultados + GvPS.DataBind() + ChkCicloComercial.Checked = True + PnlCicloComercial.Visible = True + DdlPS.Items.Clear() + DdlPS.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa) + DdlPS.DataBind() + DdlPS.Items.Insert(0, New ListItem("Seleccione", "-1")) + Else + ChkCicloComercial.Checked = False + PnlCicloComercial.Visible = False + End If + End If + + If Objeto.GetCaracteristicasValores(-1, -1, -1, -1, CveCuentaEquipo, -1, 6, UsuarioActual.CveEmpresa) Then + GvCuentasCaracteristicas.DataSource = Objeto.DtResultados + Else + GvCuentasCaracteristicas.DataSource = Nothing + End If + GvCuentasCaracteristicas.DataBind() + GvCuentasCaracteristicas.Visible = True + GvAddCuentaCaracteristica.Visible = False + + UpDatos.Update() + UpBodyAgregarCuenta.Update() + UpAgregarCuenta.Update() + Objeto.Dispose() + RegistraScript(String.Format("$('#{0}').modal();", "DivAgregarCuenta")) + End Sub + Protected Sub GvCuentasEquipos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvCuentasEquipos.RowDeleting + Dim Objeto As New ClsGenerales + Dim TieneError = False + If Objeto.RemoveCuentaEquipo(GvCuentasEquipos.DataKeys(e.RowIndex).Value.ToString.ToEntero) Then + Alert("La cuenta Equipo se eliminó correctamente.", TipoMensaje.MsgInformacion) + Else + TieneError = True + Alert("Error al eliminar la cuenta/equipo.", TipoMensaje.MsgError) + End If + Objeto.Dispose() + UpDatos.Update() + CargaCuentasEquipos() + + + End Sub + Public Sub GvPS_Delete(sender As Object, e As EventArgs) + Dim Objeto As New ClsGenerales + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim CveCtaEq As Integer = GvRow.DataKey("CveCuentaEquipo").ToString.ToEntero + Dim CvePS As Integer = GvRow.DataKey("CvePS").ToString.ToEntero + + If Objeto.RemoveCuentaEquipoPS(CvePS, CveCtaEq) Then + Alert("El PS se eliminó correctamente.", TipoMensaje.MsgInformacion) + Else + Alert("Error al eliminar el PS", TipoMensaje.MsgError) + End If + + CargaGridPS() + UpDatos.Update() + Objeto.Dispose() + End Sub + Private Sub CargaCuentasCaracteristicas() + Dim ObjCaracteristicas As New ClsGenerales + + + If ObjCaracteristicas.GetCaracteristicas(-1, 6, UsuarioActual.CveEmpresa) Then + GvAddCuentaCaracteristica.DataSource = ObjCaracteristicas.DtResultados + Else + GvAddCuentaCaracteristica.DataSource = Nothing + End If + GvAddCuentaCaracteristica.DataBind() + GvAddCuentaCaracteristica.Visible = True + GvCuentasCaracteristicas.Visible = False + + ObjCaracteristicas.Dispose() + End Sub + Private Sub GvCuentasCaracteristicas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvCuentasCaracteristicas.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + Dim CveCaracteristicaTipo As Integer = e.Row.DataKey("CveCaracteristicaTipo").ToEntero + Dim dtTemp As New DataTable + Dim objCaracteristicas As New ClsGenerales + + Dim CveCaracteristica As Integer = e.Row.DataKey("CveCaracteristica").ToEntero + Dim CveCaracteristicaValor As Integer = e.Row.DataKey("CveCaracteristicaValor").ToEntero + Dim CveCaracteristicaOpcion As Integer = e.Row.DataKey("CveCaracteristicaOpcion").ToEntero + Dim CaracteristicaValor As String = e.Row.DataKey("CaracteristicaValor") + Dim Logitud As Integer = e.Row.DataKey("Longitud").ToString.ToEntero + + Dim DdlCarcateristicaOpcion As DropDownList = e.Row.FCDropDownList("DdlCarcateristicaOpcion") + Dim TxtCuentaValor As TextBox = e.Row.FCTextBox("TxtCuentaValor") + Dim RdlCarcateristicaOpcion As RadioButtonList = e.Row.FCRadioButtonList("RdlCarcateristicaOpcion") + Dim chkCaracteristicaValor As CheckBox = e.Row.FCCheckBox("chkCaracteristicaValor") + + Dim Requerido As Integer + If e.Row.DataKey("Requerido").ToString.ToUpper = "TRUE" Then + Requerido = 1 + Else + Requerido = 0 + End If + + TxtCuentaValor.Visible = False + Dim RFVCuentaValor1 As RequiredFieldValidator = e.Row.FCRequiredFieldValidator("RFVCuentaValor1") + RFVCuentaValor1.Enabled = False + + DdlCarcateristicaOpcion.Visible = False + Dim rfvDdlCarcateristicaOpcion1 As RequiredFieldValidator = e.Row.FCRequiredFieldValidator("rfvDdlCarcateristicaOpcion1") + rfvDdlCarcateristicaOpcion1.Enabled = False + + RdlCarcateristicaOpcion.Visible = False + Dim rfvRdlCarcateristicaOpcion = e.Row.FCRequiredFieldValidator("rfvRdlCarcateristicaOpcion") + rfvRdlCarcateristicaOpcion.Enabled = False + + Dim CalendarioCaractersiticas As AjaxControlToolkit.CalendarExtender = e.Row.FCCalendarExtender("CalendarioCaractersiticas") + CalendarioCaractersiticas.Enabled = False + + Dim _cvFechaF As CompareValidator = e.Row.FCCompareValidator("cvFechaF") + _cvFechaF.Enabled = False + + chkCaracteristicaValor.Visible = False + + If objCaracteristicas.GetCaracteriscasOpciones(-1, UsuarioActual.Empresa.CveEmpresa) Then + dtTemp = objCaracteristicas.DtResultados + End If + + If CaracteristicaValor.Length > 0 Then + TxtCuentaValor.Text = CaracteristicaValor + End If + + Select Case CveCaracteristicaTipo + Case 0 + 'txt + TxtCuentaValor.Visible = True + TxtCuentaValor.MaxLength = Logitud + If Requerido = 1 Then + RFVCuentaValor1.Enabled = True + End If + Exit Select + Case 1 + DdlCarcateristicaOpcion.Visible = True + dtTemp = dtTemp.FiltraParametros(" CveCaracteristica = " & CveCaracteristica) + DdlCarcateristicaOpcion.DataSource = dtTemp + DdlCarcateristicaOpcion.DataBind() + DdlCarcateristicaOpcion.Items.Insert(0, New ListItem("-", "-1")) + + If CveCaracteristicaValor <> -1 Then + DdlCarcateristicaOpcion.SelectedValueExist(CveCaracteristicaOpcion) + End If + + If Requerido = 1 Then + rfvDdlCarcateristicaOpcion1.Enabled = True + End If + Exit Select + Case 2 + 'radio + RdlCarcateristicaOpcion.Visible = True + dtTemp = dtTemp.FiltraParametros(" CveCaracteristica = " & CveCaracteristica) + RdlCarcateristicaOpcion.DataSource = dtTemp + RdlCarcateristicaOpcion.DataBind() + + If CveCaracteristicaValor <> -1 Then + RdlCarcateristicaOpcion.SelectedValuesIfExist(CveCaracteristicaOpcion.ToString) + End If + + If Requerido = 1 Then + rfvRdlCarcateristicaOpcion.Enabled = True + End If + Exit Select + Case 3 + 'Fecha txt Fecha + TxtCuentaValor.Visible = True + TxtCuentaValor.Width = 120 + cvFechaF.Enabled = True + CalendarioCaractersiticas.Enabled = True + RegistraScript(" $('#" & TxtCuentaValor.ClientID & "').mask('00/00/0000'); ") + If Requerido = 1 Then + RFVCuentaValor1.Enabled = True + End If + Exit Select + Case 4 + 'Multiline + TxtCuentaValor.Visible = True + TxtCuentaValor.MaxLength = Logitud + If Requerido = 1 Then + RFVCuentaValor1.Enabled = True + End If + Exit Select + Case 5 + 'CheckBox + chkCaracteristicaValor.Visible = True + If CaracteristicaValor = "1" Then + chkCaracteristicaValor.Checked = True + Else + chkCaracteristicaValor.Checked = False + End If + + Exit Select + Case 6 + TxtCuentaValor.Visible = True + TxtCuentaValor.TextMode = TextBoxMode.Number + + If Requerido = 1 Then + RFVCuentaValor1.Enabled = True + End If + Exit Select + End Select + + objCaracteristicas.Dispose() + End If + End Sub + Private Sub GvAddCuentaCaracteristica_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvAddCuentaCaracteristica.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + Dim CveCaracteristicaTipo As Integer = e.Row.DataKey("CveCaracteristicaTipo").ToEntero + Dim dtTemp As New DataTable + Dim objCaracteristicas As New ClsGenerales + + Dim CveCaracteristica As Integer = e.Row.DataKey("CveCaracteristica").ToEntero + Dim Logitud As Integer = e.Row.DataKey("Longitud").ToString.ToEntero + + Dim DdlCarcateristicaOpcion As DropDownList = e.Row.FCDropDownList("DdlCarcateristicaOpcion") + Dim TxtCuentaValor As TextBox = e.Row.FCTextBox("TxtCuentaValor") + Dim RdlCarcateristicaOpcion2 As RadioButtonList = e.Row.FCRadioButtonList("RdlCarcateristicaOpcion2") + Dim chkCaracteristicaValor2 As CheckBox = e.Row.FCCheckBox("chkCaracteristicaValor2") + + If objCaracteristicas.GetCaracteriscasOpciones(-1, UsuarioActual.Empresa.CveEmpresa) Then + dtTemp = objCaracteristicas.DtResultados + End If + + Dim Requerido As Integer + If e.Row.DataKey("Requerido").ToString.ToUpper = "TRUE" Then + Requerido = 1 + Else + Requerido = 0 + End If + + TxtCuentaValor.Visible = False + Dim RFVCuentaValor2 As RequiredFieldValidator = e.Row.FCRequiredFieldValidator("RFVCuentaValor2") + RFVCuentaValor2.Enabled = False + + DdlCarcateristicaOpcion.Visible = False + Dim rfvDdlCarcateristicaOpcion2 As RequiredFieldValidator = e.Row.FCRequiredFieldValidator("rfvDdlCarcateristicaOpcion2") + rfvDdlCarcateristicaOpcion2.Enabled = False + + RdlCarcateristicaOpcion2.Visible = False + Dim rfvRdlCarcateristicaOpcion = e.Row.FCRequiredFieldValidator("rfvRdlCarcateristicaOpcion2") + rfvRdlCarcateristicaOpcion.Enabled = False + + Dim cvFechaF As CompareValidator = e.Row.FCCompareValidator("cvFechaF2") + cvFechaF.Enabled = False + + Dim CalendarioCaractersiticas As AjaxControlToolkit.CalendarExtender = e.Row.FCCalendarExtender("CalendarioCaractersiticas1") + CalendarioCaractersiticas.Enabled = False + + chkCaracteristicaValor2.Visible = False + + Select Case CveCaracteristicaTipo + Case 0 + TxtCuentaValor.Visible = True + Exit Select + Case 1 + DdlCarcateristicaOpcion.Visible = True + dtTemp = dtTemp.FiltraParametros(" CveCaracteristica = " & CveCaracteristica) + DdlCarcateristicaOpcion.DataSource = dtTemp + DdlCarcateristicaOpcion.DataBind() + DdlCarcateristicaOpcion.Items.Insert(0, New ListItem("-", "-1")) + + If Requerido = 1 Then + rfvDdlCarcateristicaOpcion2.Enabled = True + End If + + Exit Select + Case 2 + 'radio + RdlCarcateristicaOpcion2.Visible = True + dtTemp = dtTemp.FiltraParametros(" CveCaracteristica = " & CveCaracteristica) + RdlCarcateristicaOpcion2.DataSource = dtTemp + RdlCarcateristicaOpcion2.DataBind() + + If Requerido = 1 Then + rfvRdlCarcateristicaOpcion.Enabled = True + End If + Exit Select + Case 3 + 'Fecha txt Fecha + TxtCuentaValor.Visible = True + TxtCuentaValor.Width = 120 + cvFechaF.Enabled = True + CalendarioCaractersiticas.Enabled = True + RegistraScript(" $('#" & TxtCuentaValor.ClientID & "').mask('00/00/0000'); ") + + If Requerido = 1 Then + RFVCuentaValor2.Enabled = True + End If + Exit Select + Case 4 + 'Multiline + TxtCuentaValor.Visible = True + TxtCuentaValor.MaxLength = Logitud + + If Requerido = 1 Then + RFVCuentaValor2.Enabled = True + End If + Exit Select + Case 5 + 'CheckBox + chkCaracteristicaValor2.Visible = True + Exit Select + Case 6 + TxtCuentaValor.Visible = True + TxtCuentaValor.TextMode = TextBoxMode.Number + + If Requerido = 1 Then + RFVCuentaValor2.Enabled = True + End If + Exit Select + End Select + objCaracteristicas.Dispose() + End If + End Sub + Private Function GuardaCaracteristicas(Modalidad As String, CveCuentaEquipo As Integer, ByRef ObjCarac As ClsGenerales) As Boolean + Dim Retorno = False + + If Modalidad.ToString = "I" Then + For Each gvr As GridViewRow In GvAddCuentaCaracteristica.Rows + Dim CveCaracteristica As Integer = gvr.DataKey("CveCaracteristica").ToEntero + Dim CveCaracteristicaTipo As Integer = gvr.DataKey("CveCaracteristicaTipo").ToEntero + + Dim _DdlCarcateristicaOpcion As DropDownList = gvr.FCDropDownList("DdlCarcateristicaOpcion") + Dim _TxtCaracteristicaOpcion As TextBox = gvr.FCTextBox("TxtCuentaValor") + Dim _RdlCarcateristicaOpcion As RadioButtonList = gvr.FCRadioButtonList("RdlCarcateristicaOpcion2") + Dim _chkCaracteristicaValor As CheckBox = gvr.FCCheckBox("chkCaracteristicaValor2") + + Dim CveCaracteristicaOpcion As Integer = -1 + Dim CaracteristicaValor As String = "" + Dim CaracteristicaValorDate As Date = Now + Dim CaracteristicaValorInt As Integer = -1 + + Dim AgregaCaracteristica As Boolean = False + + Select Case CveCaracteristicaTipo + Case 0 + 'txt + CaracteristicaValor = _TxtCaracteristicaOpcion.Text + + If CaracteristicaValor.Trim.Length > 0 Then + AgregaCaracteristica = True + Else + AgregaCaracteristica = False + End If + Exit Select + Case 1 + 'drop + CveCaracteristicaOpcion = _DdlCarcateristicaOpcion.SelectedValue.ToEntero + + If CveCaracteristicaOpcion > 0 Then + AgregaCaracteristica = True + Else + AgregaCaracteristica = False + End If + Exit Select + Case 2 + 'radio + CveCaracteristicaOpcion = _RdlCarcateristicaOpcion.SelectedValue.ToEntero + + If CveCaracteristicaOpcion > 0 Then + AgregaCaracteristica = True + Else + AgregaCaracteristica = False + End If + Exit Select + Case 3 + 'Fecha txt Fecha + If _TxtCaracteristicaOpcion.Text.Trim.Length > 0 Then + CaracteristicaValorDate = _TxtCaracteristicaOpcion.Text.Trim.ToDate + CaracteristicaValor = CaracteristicaValorDate.ToString("dd/MM/yyyy") + + If CaracteristicaValor.Trim.ToDate.ToString("dd/MM/yyyy").ToString.Length > 0 Then + AgregaCaracteristica = True + Else + AgregaCaracteristica = False + End If + Else + AgregaCaracteristica = False + End If + Case 4 + 'txt + CaracteristicaValor = _TxtCaracteristicaOpcion.Text + + If CaracteristicaValor.Trim.Length > 0 Then + AgregaCaracteristica = True + Else + AgregaCaracteristica = False + End If + Exit Select + Case 5 + 'CheckBox + If _chkCaracteristicaValor.Checked Then + CaracteristicaValor = "1" + Else + CaracteristicaValor = "0" + End If + AgregaCaracteristica = True + Exit Select + Case 6 + 'txt numerico + 'txt + CaracteristicaValor = _TxtCaracteristicaOpcion.Text.ToEntero.ToString + + AgregaCaracteristica = True + Exit Select + End Select + + If AgregaCaracteristica Then + If ObjCarac.AddUpdateCaracteristicasValores(CveCaracteristica, CveCaracteristicaOpcion, CaracteristicaValor, UsuarioActual.CveUsuario, CveCuentaEquipo:=CveCuentaEquipo) Then + Retorno = True + Else + Exit For + End If + End If + Next + ElseIf Modalidad.ToString = "U" Then + For Each gvr As GridViewRow In GvCuentasCaracteristicas.Rows + Dim _CaracteristicaValor As Integer = gvr.DataKey("CaracteristicaValor").ToEntero + Dim _CveCaracteristica As Integer = gvr.DataKey("CveCaracteristica").ToEntero + Dim _CveCaracteristicaValor As Integer = gvr.DataKey("CveCaracteristicaValor").ToEntero + Dim _CveCaracteristicaTipo As Integer = gvr.DataKey("CveCaracteristicaTipo").ToEntero + + Dim _DdlCarcateristicaOpcion As DropDownList = gvr.FCDropDownList("DdlCarcateristicaOpcion") + Dim _TxtCaracteristicaOpcion As TextBox = gvr.FCTextBox("TxtCuentaValor") + Dim _RdlCarcateristicaOpcion As RadioButtonList = gvr.FCRadioButtonList("RdlCarcateristicaOpcion") + Dim _chkCaracteristicaValor As CheckBox = gvr.FCCheckBox("chkCaracteristicaValor") + + Dim CveCaracteristicaOpcion As Integer = -1 + Dim CaracteristicaValor As String = "" + Dim CaracteristicaValorDate As Date = Now + Dim CaracteristicaValorInt As Integer = -1 + + Select Case _CveCaracteristicaTipo + Case 0 + 'txt + CaracteristicaValor = _TxtCaracteristicaOpcion.Text + Exit Select + Case 1 + 'drop + CveCaracteristicaOpcion = _DdlCarcateristicaOpcion.SelectedValue.ToEntero + Exit Select + Case 2 + 'radio + CveCaracteristicaOpcion = _RdlCarcateristicaOpcion.SelectedValue.ToEntero + Exit Select + Case 3 + 'Fecha txt Fecha + If _TxtCaracteristicaOpcion.Text.Trim.Length > 0 Then + CaracteristicaValorDate = _TxtCaracteristicaOpcion.Text.Trim.ToDate + CaracteristicaValor = CaracteristicaValorDate.ToString("dd/MM/yyyy") + Exit Select + End If + Case 4 + 'txt + CaracteristicaValor = _TxtCaracteristicaOpcion.Text + Exit Select + Case 5 + 'CheckBox + If _chkCaracteristicaValor.Checked Then + CaracteristicaValor = "1" + Else + CaracteristicaValor = "0" + End If + Exit Select + Case 6 + 'txt numerico + 'txt + CaracteristicaValor = _TxtCaracteristicaOpcion.Text.ToEntero.ToString + Exit Select + End Select + + If ObjCarac.AddUpdateCaracteristicasValores(_CveCaracteristica, CveCaracteristicaOpcion, CaracteristicaValor, UsuarioActual.CveUsuario, CveCaracteristicaValor:=_CveCaracteristicaValor, CveCuentaEquipo:=CveCuentaEquipo) Then + Retorno = True + Else + Exit For + End If + Next + End If + + Return Retorno + End Function +#End Region + +#Region "GPS" + Protected Sub btnCargaArrayDisp_Click(sender As Object, e As EventArgs) Handles btnCargaArrayDisp.Click + If hdnArrayDispositivo.Value.Length > 0 Then + CargaDispositivos(DdlEstatusDispositivos.SelectedValue.ToEntero()) + End If + End Sub + Protected Sub DdlEstatusDispositivos_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaDispositivos(DdlEstatusDispositivos.SelectedValue.ToEntero()) + End Sub + Private Sub CargaDispositivos(Optional Estatus As Integer = 1) + Dim ObjGPS As New ClsGPS + If ObjGPS.DispositivosGet(-1, Estatus, CveCliente) Then + GvDatos.DataSource = ObjGPS.DtResultados + Else + GvDatos.DataSource = Nothing + End If + ObjGPS.Dispose() + GvDatos.DataBind() + UpDispositivos.Update() + End Sub + Private Sub CargaGlobalDispositos() + Dim ObjGPS As New ClsGPS + + If ObjGPS.DispositivosGet(-1, -1, -1, -1) Then + GlobalDTDispositivos(-1) = ObjGPS.DtResultados + End If + + If ObjGPS.DispositivosUsuariosGet(-1, -1, -1, -1, -1) Then + GlobalDTDispositivosUsuarios(-1, -1) = ObjGPS.DtResultados + End If + + ObjGPS.Dispose() + End Sub + Protected Sub GvDispositivos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + e.Row.VerticalAlign = VerticalAlign.Middle + If e.Row.DBCampo("Estatus").ToString.ToEntero = 1 Then + e.Row.FCLabel("LblEstatus").Text = "Activo" + e.Row.FCLabel("LblEstatus").CssClass = "label label-success" + Else + e.Row.FCLabel("LblEstatus").Text = "Inactivo" + e.Row.FCLabel("LblEstatus").CssClass = "label label-danger" + End If + e.Row.FCLinkButton("imgE").Attributes.Add("onclick", $"javascript:AbrirVentana('/GPS/WizardDispositivos.aspx?CveDispositivo={e.Row.DBCampo("CveDispositivo").ToString}&CveCliente={CveCliente}&EsPopup=1', 801, 701);") + End If + End Sub + + Protected Sub GvDispositivos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting + Dim GPS As New ClsGPS + Dim CveDispositivo As Integer = GvDatos.Rows(e.RowIndex).DataKey("CveDispositivo").ToEntero + If GPS.DispositivosDelete(CveDispositivo) Then + Alert("El Dispositivo se eliminó correctamente", TipoMensaje.MsgInformacion) + End If + GPS.Dispose() + CargaDispositivos() + CargaGlobalDispositos() + UpDispositivos.Update() + End Sub + Private Sub CargaEmpresasUsuario(CveEmpresa As Integer) + Dim Dt As DataTable = GlobalDTUsuarios(UsuarioActual.CveUsuario) + + If Dt IsNot Nothing Then + If Dt.Rows.Count > 0 Then + DdlEmpresaDispositivo.DataSource = Dt.FiltraParametros("CvePlataforma = 1 OR (CvePlataforma = 3 AND CveCliente IS NULL)", "Empresa") + + If DdlEmpresaDispositivo.SelectedValue.ToEntero() <= 0 Then + DdlEmpresaDispositivo.SelectedValueExist(CveEmpresa) + End If + + DdlClienteDispositivo.DataSource = Dt.FiltraParametros($"CvePlataforma = 3 AND CveEmpresa = {CveEmpresa}", "Empresa") + + DdlEmpresaDispositivo.DataBind() + DdlClienteDispositivo.DataBind() + + DdlClienteDispositivo.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + End If + + End Sub + Private Sub CargaClienteDispositivos(CveEmpresa As Integer) + Dim Dt As DataTable = GlobalDTUsuarios(UsuarioActual.CveUsuario) + If Dt IsNot Nothing AndAlso Dt.Rows.Count > 0 Then DdlClienteDispositivo.DataSource = Dt.FiltraParametros($"CvePlataforma = 3 AND CveEmpresa = {CveEmpresa}", "Empresa") DdlClienteDispositivo.DataBind() - DdlClienteDispositivo.Items.Insert(0, New ListItem("Seleccione", "-1")) - End If - End Sub - Protected Sub DdlEmpresaDispositivo_SelectedIndexChanged(sender As Object, e As EventArgs) - CargaClienteDispositivos(DdlEmpresaDispositivo.SelectedValue.ToEntero()) + DdlClienteDispositivo.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If End Sub - - - Protected Sub ImgMoverDispositivo_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Me.NombreDispositivo = GvRow.DataKey("Display") - HTituloDispostivo.InnerText = $"Mover Dispositivo: {NombreDispositivo}" - - UpMoverDispositivo.Update() - RegistraScript($"CargaModalMoverDispositivo({GvRow.DataKey("CveDispositivo")});") - - End Sub - -#End Region - -#Region "Sucursales" - Public Sub CreaDTSucursales() - - If Not CveCliente > 0 Then - - TempDTSucursales = New DataTable - TempDTSucursales.Columns.Add("CveClienteSucursal", Type.GetType("System.Int32")) - TempDTSucursales.Columns.Add("SucursalCliente", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("CiudadSucursal", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("ColoniaSucursal", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("CPSucursal", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("DireccionSucursal", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("LocalidadSucursal", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("EstadoSucursal", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("PaisSucursal", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("NumExtSucursal", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("NumIntSucursal", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("TelefonoSucursal", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("CorreoSucursal", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("CorreoCotiziacionSucursal", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("ContactoSucursal", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("NumCuenta", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("CveVendedorSucursal", Type.GetType("System.Int32")) - TempDTSucursales.Columns.Add("CveUsuario", Type.GetType("System.Int32")) - TempDTSucursales.Columns.Add("CveMetodoPago", Type.GetType("System.Int32")) - TempDTSucursales.Columns.Add("FechaIng", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("Usuario", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("LT", Type.GetType("System.String")) - TempDTSucursales.Columns.Add("LG", Type.GetType("System.String")) - TempDTSucursales.Columns.Add() - - End If - End Sub - - Private Sub AddSucursalTemp() - Dim RowSucursal As DataRow = TempDTSucursales.NewRow() - RowSucursal("CveClienteSucursal") = 1 - RowSucursal("SucursalCliente") = TxtNombreSucursal.Text.Trim - RowSucursal("CiudadSucursal") = TxtCiudadSucursal.Text.Trim - RowSucursal("ColoniaSucursal") = TxtColoniaSucursal.Text.Trim - RowSucursal("CPSucursal") = TxtCPSucursal.Text.Trim - RowSucursal("DireccionSucursal") = TxtDireccionSucursal.Text.Trim - RowSucursal("LocalidadSucursal") = TxtLocalidadSucursal.Text.Trim - RowSucursal("EstadoSucursal") = TxtEstadoSucursal.Text.Trim - RowSucursal("PaisSucursal") = TxtPaisSucursal.Text.Trim - RowSucursal("NumExtSucursal") = TxtNumExtSucursal.Text.Trim - RowSucursal("NumIntSucursal") = TxtNumIntSucursal.Text.Trim - RowSucursal("TelefonoSucursal") = TxtTelefonoSucursal.Text.Trim - RowSucursal("CorreoSucursal") = TxtCorreoSucursal.Text.Trim - RowSucursal("CorreoCotiziacionSucursal") = TxtCorreoSucursalCotizacion.Text.Trim - RowSucursal("ContactoSucursal") = TxtContactoSucursal.Text.Trim - RowSucursal("NumCuenta") = TxtNumeroCuenta.Text - RowSucursal("CveVendedorSucursal") = DdlVendedorSucursal.SelectedValue.ToEntero - RowSucursal("CveMetodoPago") = DdlMetodoPagoSucursal.SelectedValue.ToEntero - RowSucursal("CveUsuario") = UsuarioActual.CveUsuario - RowSucursal("FechaIng") = Now.ToShortDateString - RowSucursal("Usuario") = UsuarioActual.Usuario - - RowSucursal("CveUsoCFDI") = DdlSucursalUsoCFDI.SelectedValue.ToEntero - RowSucursal("CveFormaPago33") = DdlSucursalFormaPago33.SelectedValue.ToEntero - RowSucursal("CveMetodoPago33") = DdlSucursalMetodoPago33.SelectedValue.ToEntero - - RowSucursal("LT") = If(txtLt.Text.ToDouble <> 0, txtLt.Text, "0") - RowSucursal("LG") = If(txtLg.Text.ToDouble <> 0, txtLg.Text, "0") - - TempDTSucursales.Rows.Add(RowSucursal) - - GVSucursales.DataSource = TempDTSucursales - GVSucursales.DataBind() - UpDatos.Update() - End Sub - - Private Sub BtnSendMail2_Click(sender As Object, e As EventArgs) Handles BtnSendMail2.Click - Try - If HdnCveVenta2.Value <> "-1" AndAlso HdnFolioVenta2.Value <> "-1" Then - - Dim ObjMail As New ClsSisMail() - Dim Ruta As String = AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\" - - Dim Cuerpo As String = TxtBody2.Text - Dim Asunto As String = "" - Dim TipoComprobante = "" - - If HdnTipoDocto2.Value.ToString = "Ing" Then TipoComprobante = "Factura" - If HdnTipoDocto2.Value.ToString = "Egs" Then TipoComprobante = "Nota de Crédito" - If HdnTipoDocto2.Value.ToString = "Dev" Then TipoComprobante = "Nota de Devolución" - If HdnTipoDocto2.Value.ToString = "Rem" Then TipoComprobante = "Remisión" - If HdnTipoDocto2.Value.ToString = "Cot" Then TipoComprobante = "Cotización" - If HdnTipoDocto2.Value.ToString = "Ant" Then TipoComprobante = "Anticipo" - - - Dim ObjVenta As New ClsVentas - Dim Dr As DataRow = Nothing - If ObjVenta.GetVenta(HdnCveVenta2.Value.ToEntero, UsuarioActual.CveEmpresa) Then - If ObjVenta.DtResultados.Rows.Count > 0 Then - Dr = ObjVenta.DtResultados.Rows(0) - End If - End If - ObjVenta.Dispose() - - If UsuarioActual.Empresa.PlantillaMailVenta.Trim.Length > 0 Then - Cuerpo = UsuarioActual.Empresa.PlantillaMailVenta - Cuerpo = Cuerpo.Replace("{""NombreEmpresa""}", UsuarioActual.Empresa.Empresa) - Cuerpo = Cuerpo.Replace("{""NombreCliente""}", LtlCliente.Text.Trim) - Cuerpo = Cuerpo.Replace("{""TipoDocumento""}", TipoComprobante) - Cuerpo = Cuerpo.Replace("{""SerieFolio""}", HdnSerieFolio2.Value.ToString) - If Dr IsNot Nothing Then - Cuerpo = Cuerpo.Replace("{""Fecha""}", Dr("Fecha").ToString.ToDate.ToShortDateString) - Cuerpo = Cuerpo.Replace("{""Total""}", Dr("Total").ToString.FormatoNumero) - Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString.ToDate.ToShortDateString) - End If - End If - - - If UsuarioActual.Empresa.AsuntoPlantillaMailVenta.Trim.Length > 0 Then - Asunto = UsuarioActual.Empresa.AsuntoPlantillaMailVenta - Asunto = Asunto.Replace("{""TipoDocumento""}", TipoComprobante) - Asunto = Asunto.Replace("{""Sucursal""}", HdnSubProyecto2.Value.ToString) - Asunto = Asunto.Replace("{""SerieFolio""}", HdnSerieFolio2.Value.ToString) - End If - - If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso HdnTipoDocto2.Value.Contiene("Ing", "Egs") Then - If File.Exists($"{Ruta}PDF\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.pdf") AndAlso File.Exists($"{Ruta}XML\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.xml") Then - Dim PDF As String = $"{Ruta}PDF\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.pdf" - Dim XML As String = $"{Ruta}XML\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.xml" - - - Dim ResultadoMail As Integer = 0 - Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) - - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = XML}) - - - - 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then - If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail2.Text.Trim, Asunto, Cuerpo, TxtCC2.Text.Trim, LSRutasMail) Then - ResultadoMail = 1 - TxtCC2.Text = "" - TxtBody2.Text = "" - RegistraScript("$('#ModalDivMail2').modal('hide');") - Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) - CargaHistorial() - 'UpnHistorial.Update() - Else - Alert("Ocurrió un error al enviar el correo", TipoMensaje.MsgError) - ResultadoMail = 3 - End If - - Dim ObjVentas As New ClsVentas - ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta2.Value.ToEntero) - ObjVentas.Dispose() - Else - Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) - End If - ElseIf UsuarioActual.Empresa.TipoFacturacion = "CBB" AndAlso HdnTipoDocto2.Value.Contiene("Ing", "Egs") Then - If File.Exists(Ruta & "PDF\" & HdnFolioVenta2.Value & ".pdf") Then - Dim PDF As String = Ruta & "PDF\" & HdnFolioVenta2.Value & ".pdf" - - Dim ResultadoMail As Integer = 0 - Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) - - 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then - If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail2.Text.Trim, Asunto, Cuerpo, TxtCC2.Text.Trim, LSRutasMail) Then - ResultadoMail = 1 - TxtCC2.Text = "" - TxtBody2.Text = "" - RegistraScript("$('#ModalDivMail2').modal('hide');") - Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) - CargaHistorial() - UpnHistorial.Update() - Else - ResultadoMail = 3 - End If - - Dim ObjVentas As New ClsVentas - ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta2.Value.ToEntero) - ObjVentas.Dispose() - Else - Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) - End If - ElseIf HdnTipoDocto2.Value = "Cot" Then - If File.Exists($"{Ruta}PDF\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.pdf") Then - Dim PDF As String = $"{Ruta}PDF\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.pdf" - - Dim ResultadoMail As Integer = 0 - Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) - LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) - - 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then - If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail2.Text.Trim, Asunto, Cuerpo, TxtCC2.Text.Trim, LSRutasMail) Then - ResultadoMail = 1 - TxtCC2.Text = "" - TxtBody2.Text = "" - RegistraScript("$('#ModalDivMail2').modal('hide');") - Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) - CargaHistorial() - UpnHistorial.Update() - Else - ResultadoMail = 3 - End If - - Dim ObjVentas As New ClsVentas - ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta2.Value.ToEntero) - ObjVentas.Dispose() - Else - Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) - End If - End If - - 'End If - 'ObjEmprea.Dispose() - Else - Alert("No se seleccionó ninguna factura para envíar.", TipoMensaje.MsgAdvertencia) - End If - Catch ex As Exception - OnError("Ocurrió error al mandar MAIL", ex) - Dim ObjVentas As New ClsVentas - ObjVentas.UpdateVentaMail(3, HdnCveVenta2.Value.ToEntero) - ObjVentas.Dispose() - End Try - End Sub - - Protected Sub DdlSubProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) - If DdlSubProyecto.SelectedValue.ToEntero > 0 Then - Dim Dr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa).Rows(0) - If Dr IsNot Nothing Then - If Dr("CvePrecioLista").ToString.ToEntero > 0 Then - DdlPrecioLista.SelectedValueExist(Dr("CvePrecioLista").ToString) - End If - End If - End If - End Sub - -#End Region - -#Region "G P S" - - - - Private Sub EnviaCorreoGPS(Liga As String, LigaActivar As String) - - Try - Dim Para = TxtEmail.Text.Trim - Dim Asunto = "ACTIVACIÓN DEL PORTAL GPS" - Dim SBBody As New StringBuilder - 'Linia de estilos - SBBody.Append("") - 'incio Cuerpo del correo - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.Append("ALTA DE CUENTA") - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.AppendFormat(" Estimado {0}:
    ", TxtNombre.Text.ToUpper) - SBBody.AppendFormat("El presente correo es para informarle que se le han asignado los siguientes datos para el acceso al Portal GPS de: {0}

    ", UsuarioActual.Empresa.Empresa) - SBBody.Append("
    ") - SBBody.Append("
    Datos de usuario
    ") - SBBody.Append("
    ") - - SBBody.Append("
    ") - SBBody.Append("
    Dirección de Acceso
    ") - SBBody.AppendFormat("", Liga) - SBBody.Append("
    ") - - SBBody.Append("
    ") - SBBody.Append("
    Clave
    ") - SBBody.AppendFormat("
    {0}
    ", CveCliente) - SBBody.Append("
    ") - - SBBody.Append("
    ") - SBBody.Append("
    Usuario
    ") - SBBody.AppendFormat("
    {0}
    ", "Admin") - SBBody.Append("
    ") - - SBBody.Append("
    ") - SBBody.Append("
    Haga click para activar su cuenta
    ") - SBBody.AppendFormat("", LigaActivar) - SBBody.Append("
    ") - - - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.Append("Para Activar su cuenta debera cambiar su contraseña.

    ") - SBBody.Append("
    ") - SBBody.Append("Nota Favor de NO responder este correo. ") - SBBody.Append("


    ") - SBBody.AppendFormat("", UrlSitio) - SBBody.Append("
    ") - SBBody.Append("
    ") - 'Termino Cuerpo del correo - - Dim Hilo As New System.Threading.Thread(Sub() MandaCorreo(Asunto, Para, SBBody.ToString)) - Hilo.Start() - Alert("El correo de activación se ha enviado correctamente a: " + TxtEmail.Text + ".", TipoMensaje.MsgInformacion) - Catch ex As Exception - OnError("Ocurrió error al mandar MAIL", ex) - End Try - End Sub - - Private Sub BtnRegistrarCliente_Click(sender As Object, e As EventArgs) Handles BtnRegistrarCliente.Click - Dim ObjClientes As New ClsClientes - - If ObjClientes.RegistrarCliente(CveCliente) Then - RegistraScript("location.reload();") - End If - - ObjClientes.Dispose() - End Sub - - -#End Region - -#Region "C O N T R A T O S" - Private Sub CargaDatosContrato() - If CveCliente <= 0 Then - Exit Sub - End If - - Dim ObjContratos As New ClsContratos - If ObjContratos.GetReporteContratosAvancesCP(UsuarioActual.CveEmpresa, CveCliente, -1, -1, -1, -1, 1) Then - GvDatosAvance.DataSource = ObjContratos.DtResultados - Else - Alert("Ocurrió un Error al obtener el Reporte de Avances. Por favor vuelva a intentar", TipoMensaje.MsgError) - End If - - If ObjContratos.GetReporteContratosAvancesCP(UsuarioActual.CveEmpresa, CveCliente, -1, -1, -1, -1, -2) Then - GvContratosClienteInactivos.DataSource = ObjContratos.DtResultados - Else - Alert("Ocurrió un Error al obtener el Reporte de Avances Inactivos. Por favor vuelva a intentar", TipoMensaje.MsgError) - End If - - ObjContratos.Dispose() - GvDatosAvance.DataBind() - UpContratosInactivos.DataBind() - - - If GvDatosAvance.Rows.Count > 0 Or GvContratosClienteInactivos.Rows.Count > 0 Then - TabContratos.Visible = True - End If - End Sub - - Private Sub GvDatosAvance_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosAvance.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("CveContrato").ToString.ToEntero = 0 Then - e.Row.Cells(0).Text = "Total:" - e.Row.CssClass = "Totales white" - End If - End If - End Sub - - Private Sub GvContratosClienteInactivos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvContratosClienteInactivos.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - If e.Row.DBCampo("CveContrato").ToString.ToEntero = 0 Then - e.Row.Cells(0).Text = "Total:" - e.Row.CssClass = "Totales white" - End If - End If - End Sub - -#End Region - -#Region "M E T O D O S " - Protected Sub RblTipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipo.SelectedIndexChanged - CargaHistorial(TipoDocto:=RblTipo.SelectedValue) - End Sub - Private Sub DdlSucursalCliente_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSucursalCliente.SelectedIndexChanged - CargaCotizaciones(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo - CargaHistorial(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo - CargaCxC(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo - CargaAnticipos(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo - CargaBancos(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo - - UpDatos.Update() - End Sub - Protected Sub LbDesactivaUsuario_Click(sender As Object, e As EventArgs) Handles LbDesactivaPortal.Click - 'Alert("Se Van a desativar todos o eliminar todos, junto con el Admin?") - Dim ObjUsuario As New ClsSisUsuarios - Dim ErrorUsuario As Boolean = False - - ObjUsuario.IniciaTransacSQL() - - For Each Dr As DataRow In DirectCast(ViewState("DTUsuariosCliente"), DataTable).Rows - 'se desactiva el usuario y se restablece la contraseña - If Not ObjUsuario.UpdateUsuarioPortal(Dr("Usuario").ToString, Dr("Nombre").ToString, Dr("Correo").ToString, False, ContraseñaPredeterminadaEncriptada, Dr("CveCliente").ToString.ToEntero, Dr("CveProveedor").ToString.ToEntero, Dr("CveUsuario").ToString.ToEntero, UsuarioActual.CveUsuario) Then - ErrorUsuario = True - End If - Next - - If ErrorUsuario Then - ObjUsuario.RollBack() - Else - LblUsuarioActivo.Text = "No" - HdnCveUsuarioPortalActivado.Value = "0" - trEnviarActivacion.Visible = True - trDesactivarUsuario.Visible = False - - 'DivPermisosPortal.Visible = False - - ObjUsuario.GetUsuariosPortal(-1, CveCliente, -1) - - ViewState("DTUsuariosCliente") = ObjUsuario.DtResultados - GvUsuariosPortal.DataSource = ViewState("DTUsuariosCliente") - GvUsuariosPortal.DataBind() - 'divUsuariosPortal.Visible = False - - ObjUsuario.Commit() - End If - - ObjUsuario.Dispose() - - If UsuarioActual.Empresa.CvePlataforma = 1 Then - CargaUsuariosPortalCliente() - End If - - UpGvUsuarios.Update() - UPPUsuarios.Update() - - End Sub - Private Sub AbonaaCuenta() - - 'si usa bancos, se va abrir el popupie para la recepci[on del pago - Dim MsgError As String = "" - - Dim ObjMov As New ClsContabilidad - ObjMov.IniciaTransacSQL() - Dim CvePrePoliza As Integer = ObjMov.AddPrePolizas("Cli", 2, TxtCantidad.Text.Trim.ToDouble, TxtCantidad.Text.Trim.ToDouble, 1, TxtFechaPago.Text.ToDate, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) - - If CvePrePoliza > 0 Then - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtCantidad.Text.ToDecimal, TxtReferencia.Text, 2, TxtReferencia.Text, Now, 0, -1, -1, CveVenta:=HdnCveVentaAbono.Value.ToEntero, CveCliente:=CveCliente) Then - If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtCantidad.Text.ToDecimal, TxtReferencia.Text, 4, TxtReferencia.Text, Now, 0, -1, -1, CveVenta:=HdnCveVentaAbono.Value.ToEntero, CveCliente:=CveCliente) Then - - Else - MsgError = "no se pudo insertar el detalle de la póliza2" - End If - Else - MsgError = "no se pudo insertar el detalle de la póliza" - End If - Else - MsgError = "No se pudo insertar la póliza" - End If - - If MsgError = "" Then - Alert("El Documento se guardó correctamente.", TipoMensaje.MsgInformacion, "window.opener.location.href = window.opener.location.href; window.close();") - ObjMov.Commit() - - UpDatos.Update() - - Else - ObjMov.RollBack() - End If - ObjMov.Dispose() - - - - End Sub - Private Sub ChecaPermiteCredito() - ' DivParametros.Disabled = Not ChkPermiteCredito.Checked - 'For Each Control As Control In UpParametros.Controls - ' Control.Visible = ChkPermiteCredito.Checked - 'Next - - DivPortal.Visible = UsuarioActual.TienePermisoProceso(162) - - TxtLimiteCredito.Enabled = UsuarioActual.TienePermisoProceso(162) - TxtPlazoCobranza.Enabled = UsuarioActual.TienePermisoProceso(162) - TxtPlazoCobranzaRemision.Enabled = UsuarioActual.TienePermisoProceso(162) - - DdlTipoPago.Enabled = UsuarioActual.TienePermisoProceso(162) - DdlResponsable.Enabled = UsuarioActual.TienePermisoProceso(162) - - ChkLunes.Enabled = UsuarioActual.TienePermisoProceso(162) - ChkMartes.Enabled = UsuarioActual.TienePermisoProceso(162) - ChkMiercoles.Enabled = UsuarioActual.TienePermisoProceso(162) - ChkJueves.Enabled = UsuarioActual.TienePermisoProceso(162) - ChkViernes.Enabled = UsuarioActual.TienePermisoProceso(162) - ChkSabado.Enabled = UsuarioActual.TienePermisoProceso(162) - - ChkRevLunes.Enabled = UsuarioActual.TienePermisoProceso(162) - ChkRevMartes.Enabled = UsuarioActual.TienePermisoProceso(162) - ChkRevMiercoles.Enabled = UsuarioActual.TienePermisoProceso(162) - ChkRevJueves.Enabled = UsuarioActual.TienePermisoProceso(162) - ChkRevViernes.Enabled = UsuarioActual.TienePermisoProceso(162) - ChkRevSabado.Enabled = UsuarioActual.TienePermisoProceso(162) - - TxtDiasEspecifico.Enabled = UsuarioActual.TienePermisoProceso(162) - TxtDocumentacion.Enabled = UsuarioActual.TienePermisoProceso(162) - TxtCobranzaContacto.Enabled = UsuarioActual.TienePermisoProceso(162) - TxtCobranzaTelefono.Enabled = UsuarioActual.TienePermisoProceso(162) - TxtCobranzaExt.Enabled = UsuarioActual.TienePermisoProceso(162) - TxtCobranzaCorreo.Enabled = UsuarioActual.TienePermisoProceso(162) - TxtHorario.Enabled = UsuarioActual.TienePermisoProceso(162) - - TxtPortalFacturacion.Enabled = UsuarioActual.TienePermisoProceso(162) - TxtObsDiasRevision.Enabled = UsuarioActual.TienePermisoProceso(162) - - UpParametros.Update() - End Sub - Private Function NombreCuenta(Id As Integer) As String - Dim Retorno As String = "" - - If UsuarioActual.Empresa.ServerContPAQi = "" Then Return "" - Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa) - If ObjContabilidad.GetCuentas(Id, "-1", -1) Then - Retorno = ObjContabilidad.DtResultados.FiltroPrimeroValor("CtaCodigo") - End If - - Return Retorno - End Function - Private Sub SetValues() - ViewState("Orden") = "" - ViewState("OrdenUsuarios") = "" - TxtFechaPago.Text = Now.ToShortDateString - txtFechaI.Text = Now.ToShortDateString - txtFechaF.Text = Now.ToShortDateString - TxtFechaImportarSaldos.Text = Now.ToShortDateString - TxtFechaIUsados.Text = Now.FirstDayOfMonth.ToShortDateString - TxtFechaFUsados.Text = Now.LastDayOfMonth.ToShortDateString - CobranzaTelefono = "" - CodigoCliente = "" - - End Sub - - Protected Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click - If TxtExcel.getfiles().Archivos.Count > 0 Then - Dim file As Archivo = TxtExcel.getfiles().Archivos(0) - Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.patch - Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") - CargarArchivo(Directorio, file.filename, Tipo) - Else - Alert("No existe el archivo.Favor de subir un archivo csv o excel a la plataforma", TipoMensaje.MsgError) - End If - End Sub - Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String) - Dim dt As New DataTable - Dim Conexion As Odbc.OdbcConnection = Nothing - Dim ErrorArchivo = False - Try - Select Case Tipo - Case "CSV" - Conexion = New Odbc.OdbcConnection("Driver={Microsoft Access Text Driver (*.txt, *.csv)};Dbq=" + Ruta + ";Extensions=asc,csv,tab,txt;") - Conexion.Open() - Dim cmd = Conexion.CreateCommand() - cmd.CommandType = CommandType.Text - cmd.CommandText = $"SELECT * FROM [{FileName}]" - Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) - DataAdapter.Fill(dt) - Case "EXCEL" - Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Ruta + FileName + ";") - Conexion.Open() - Dim cmd = Conexion.CreateCommand() - cmd.CommandType = CommandType.Text - cmd.CommandText = "SELECT * FROM [Hoja1$]" - Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) - DataAdapter.Fill(dt) - Case Else - Alert("El archivo no tiene el formato correcto", TipoMensaje.MsgError) - Exit Sub - End Select - Catch ex As Exception - ErrorArchivo = True - OnError("Ocurrio un error al leer el archivo
    " & ex.Message, ex) - End Try - Conexion.Close() - If Not ErrorArchivo Then - If Not dt.Columns(0).ColumnName = "SerieFolio" Then - Alert("El nombre de la primera columna debe ser 'SerieFolio'.Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dt.Columns(1).ColumnName = "Fecha" Then - Alert("El nombre de la segunda columna debe ser 'Fecha'.Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dt.Columns(2).ColumnName = "Importe" Then - Alert("El nombre de la tercera columna debe ser 'Importe'.Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - If Not dt.Columns(3).ColumnName = "Saldo" Then - Alert("El nombre de la cuarta columna debe ser 'Saldo'.Favor de corregirlo", TipoMensaje.MsgError) - Exit Sub - End If - Dim XmlStream As New System.IO.MemoryStream - dt.TableName = "Datos" - Dim ObjClientes As New ClsClientes - Dim writer As New System.IO.StringWriter - dt.WriteXml(writer) - If ObjClientes.GetVentasConciliacion(CveCliente, DataTableToXml(writer)) Then - ObjClientes.DtResultados.ExportToExcel("Resultados") - End If - ObjClientes.Dispose() - End If - End Sub - Private Function DataTableToXml(ByVal stream As System.IO.TextWriter) As String - Return stream.ToString() - End Function - Protected Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles BtnDescargar.Click - Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & "Empresas\Grales\FormatoClientes.csv" - Dim Archivo As New FileInfo(Directorio) - If Archivo.Exists Then - Response.Clear() - Response.ClearHeaders() - Response.ClearContent() - Response.AddHeader("Content-Disposition", "attachment; filename=" + Archivo.Name) - Response.AddHeader("Content-Length", Archivo.Length.ToString()) - Response.ContentType = "text/plain" - Response.Flush() - Response.TransmitFile(Archivo.FullName) - Response.End() - End If - End Sub - Private Sub EnviaCorreo2(Liga As String, LigaActivar As String) - - Try - Dim Para = TxtCorreoUsuarioPortal.Text.Trim - Dim Asunto = "ACTIVACIÓN DEL PORTAL DE CLIENTE" - Dim SBBody As New StringBuilder - 'Linia de estilos - SBBody.Append("") - 'incio Cuerpo del correo - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.Append("ALTA DE CUENTA") - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.AppendFormat(" Estimado {0}:
    ", TxtNombreUsuarioPortal.Text.ToUpper) - SBBody.AppendFormat("El presente correo es para informarle que se le han asignado los siguientes datos para el acceso al Portal del Cliente de: {0}

    ", UsuarioActual.Empresa.Empresa) - SBBody.Append("
    ") - SBBody.Append("
    Datos de usuario
    ") - SBBody.Append("
    ") - - SBBody.Append("
    ") - SBBody.Append("
    Dirección de Acceso
    ") - SBBody.AppendFormat("", Liga) - SBBody.Append("
    ") - - 'SBBody.Append("
    ") - 'SBBody.Append("
    Clave
    ") - 'SBBody.AppendFormat("
    {0}
    ", CveCliente) - 'SBBody.Append("
    ") - - SBBody.Append("
    ") - SBBody.Append("
    Usuario
    ") - SBBody.AppendFormat("
    {0}
    ", TxtCorreoUsuarioPortal.Text) - SBBody.Append("
    ") - - SBBody.Append("
    ") - SBBody.Append("
    Contraseña Predeterminada
    ") - SBBody.AppendFormat("
    {0}
    ", ContraseñaPredeterminada) - SBBody.Append("
    ") - - - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.Append("
    ") - - SBBody.Append("
    ") - SBBody.Append("
    Haga click para activar su cuenta
    ") - SBBody.AppendFormat("", LigaActivar) - SBBody.Append("
    ") - - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.Append("
    ") - SBBody.Append("Para Activar su cuenta debera cambiar su contraseña.

    ") - SBBody.Append("
    ") - SBBody.Append("Nota Favor de NO responder este correo. ") - SBBody.Append("


    ") - - SBBody.AppendFormat("", UrlSitio) - SBBody.Append("") - SBBody.Append("") - 'Termino Cuerpo del correo - - Dim Hilo As New System.Threading.Thread(Sub() MandaCorreo2(Asunto, Para, SBBody.ToString)) - Hilo.Start() - Alert("El correo se ha enviado correctamente a: " + TxtCorreoUsuarioPortal.Text + ".", TipoMensaje.MsgInformacion) - Catch ex As Exception - OnError("Ocurrió error al mandar MAIL", ex) - End Try - End Sub - Private Sub MandaCorreo2(Asunto As String, Para As String, Body As String) - Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para) - a.GuardaLog() - Dim Mail As New ClsSisMail() + Protected Sub DdlEmpresaDispositivo_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaClienteDispositivos(DdlEmpresaDispositivo.SelectedValue.ToEntero()) + End Sub + + + Protected Sub ImgMoverDispositivo_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Me.NombreDispositivo = GvRow.DataKey("Display") + HTituloDispostivo.InnerText = $"Mover Dispositivo: {NombreDispositivo}" + + UpMoverDispositivo.Update() + RegistraScript($"CargaModalMoverDispositivo({GvRow.DataKey("CveDispositivo")});") + + End Sub + +#End Region + +#Region "Sucursales" + Public Sub CreaDTSucursales() + + If Not CveCliente > 0 Then + + TempDTSucursales = New DataTable + TempDTSucursales.Columns.Add("CveClienteSucursal", Type.GetType("System.Int32")) + TempDTSucursales.Columns.Add("SucursalCliente", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("CiudadSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("ColoniaSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("CPSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("DireccionSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("LocalidadSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("EstadoSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("PaisSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("NumExtSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("NumIntSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("TelefonoSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("CorreoSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("CorreoCotiziacionSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("ContactoSucursal", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("NumCuenta", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("CveVendedorSucursal", Type.GetType("System.Int32")) + TempDTSucursales.Columns.Add("CveUsuario", Type.GetType("System.Int32")) + TempDTSucursales.Columns.Add("CveMetodoPago", Type.GetType("System.Int32")) + TempDTSucursales.Columns.Add("FechaIng", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("Usuario", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("LT", Type.GetType("System.String")) + TempDTSucursales.Columns.Add("LG", Type.GetType("System.String")) + TempDTSucursales.Columns.Add() + + End If + End Sub + + Private Sub AddSucursalTemp() + Dim RowSucursal As DataRow = TempDTSucursales.NewRow() + RowSucursal("CveClienteSucursal") = 1 + RowSucursal("SucursalCliente") = TxtNombreSucursal.Text.Trim + RowSucursal("CiudadSucursal") = TxtCiudadSucursal.Text.Trim + RowSucursal("ColoniaSucursal") = TxtColoniaSucursal.Text.Trim + RowSucursal("CPSucursal") = TxtCPSucursal.Text.Trim + RowSucursal("DireccionSucursal") = TxtDireccionSucursal.Text.Trim + RowSucursal("LocalidadSucursal") = TxtLocalidadSucursal.Text.Trim + RowSucursal("EstadoSucursal") = TxtEstadoSucursal.Text.Trim + RowSucursal("PaisSucursal") = TxtPaisSucursal.Text.Trim + RowSucursal("NumExtSucursal") = TxtNumExtSucursal.Text.Trim + RowSucursal("NumIntSucursal") = TxtNumIntSucursal.Text.Trim + RowSucursal("TelefonoSucursal") = TxtTelefonoSucursal.Text.Trim + RowSucursal("CorreoSucursal") = TxtCorreoSucursal.Text.Trim + RowSucursal("CorreoCotiziacionSucursal") = TxtCorreoSucursalCotizacion.Text.Trim + RowSucursal("ContactoSucursal") = TxtContactoSucursal.Text.Trim + RowSucursal("NumCuenta") = TxtNumeroCuenta.Text + RowSucursal("CveVendedorSucursal") = DdlVendedorSucursal.SelectedValue.ToEntero + RowSucursal("CveMetodoPago") = DdlMetodoPagoSucursal.SelectedValue.ToEntero + RowSucursal("CveUsuario") = UsuarioActual.CveUsuario + RowSucursal("FechaIng") = Now.ToShortDateString + RowSucursal("Usuario") = UsuarioActual.Usuario + + RowSucursal("CveUsoCFDI") = DdlSucursalUsoCFDI.SelectedValue.ToEntero + RowSucursal("CveFormaPago33") = DdlSucursalFormaPago33.SelectedValue.ToEntero + RowSucursal("CveMetodoPago33") = DdlSucursalMetodoPago33.SelectedValue.ToEntero + + RowSucursal("LT") = If(txtLt.Text.ToDouble <> 0, txtLt.Text, "0") + RowSucursal("LG") = If(txtLg.Text.ToDouble <> 0, txtLg.Text, "0") + + TempDTSucursales.Rows.Add(RowSucursal) + + GVSucursales.DataSource = TempDTSucursales + GVSucursales.DataBind() + UpDatos.Update() + End Sub + + Private Sub BtnSendMail2_Click(sender As Object, e As EventArgs) Handles BtnSendMail2.Click + Try + If HdnCveVenta2.Value <> "-1" AndAlso HdnFolioVenta2.Value <> "-1" Then + + Dim ObjMail As New ClsSisMail() + Dim Ruta As String = AppDomain.CurrentDomain.BaseDirectory & "Empresas\" & UsuarioActual.CveEmpresa & "\" + + Dim Cuerpo As String = TxtBody2.Text + Dim Asunto As String = "" + Dim TipoComprobante = "" + + If HdnTipoDocto2.Value.ToString = "Ing" Then TipoComprobante = "Factura" + If HdnTipoDocto2.Value.ToString = "Egs" Then TipoComprobante = "Nota de Crédito" + If HdnTipoDocto2.Value.ToString = "Dev" Then TipoComprobante = "Nota de Devolución" + If HdnTipoDocto2.Value.ToString = "Rem" Then TipoComprobante = "Remisión" + If HdnTipoDocto2.Value.ToString = "Cot" Then TipoComprobante = "Cotización" + If HdnTipoDocto2.Value.ToString = "Ant" Then TipoComprobante = "Anticipo" + + + Dim ObjVenta As New ClsVentas + Dim Dr As DataRow = Nothing + If ObjVenta.GetVenta(HdnCveVenta2.Value.ToEntero, UsuarioActual.CveEmpresa) Then + If ObjVenta.DtResultados.Rows.Count > 0 Then + Dr = ObjVenta.DtResultados.Rows(0) + End If + End If + ObjVenta.Dispose() + + If UsuarioActual.Empresa.PlantillaMailVenta.Trim.Length > 0 Then + Cuerpo = UsuarioActual.Empresa.PlantillaMailVenta + Cuerpo = Cuerpo.Replace("{""NombreEmpresa""}", UsuarioActual.Empresa.Empresa) + Cuerpo = Cuerpo.Replace("{""NombreCliente""}", LtlCliente.Text.Trim) + Cuerpo = Cuerpo.Replace("{""TipoDocumento""}", TipoComprobante) + Cuerpo = Cuerpo.Replace("{""SerieFolio""}", HdnSerieFolio2.Value.ToString) + If Dr IsNot Nothing Then + Cuerpo = Cuerpo.Replace("{""Fecha""}", Dr("Fecha").ToString.ToDate.ToShortDateString) + Cuerpo = Cuerpo.Replace("{""Total""}", Dr("Total").ToString.FormatoNumero) + Cuerpo = Cuerpo.Replace("{""FechaVencimiento""}", Dr("FechaVencimiento").ToString.ToDate.ToShortDateString) + End If + End If + + + If UsuarioActual.Empresa.AsuntoPlantillaMailVenta.Trim.Length > 0 Then + Asunto = UsuarioActual.Empresa.AsuntoPlantillaMailVenta + Asunto = Asunto.Replace("{""TipoDocumento""}", TipoComprobante) + Asunto = Asunto.Replace("{""Sucursal""}", HdnSubProyecto2.Value.ToString) + Asunto = Asunto.Replace("{""SerieFolio""}", HdnSerieFolio2.Value.ToString) + End If + + If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso HdnTipoDocto2.Value.Contiene("Ing", "Egs") Then + If File.Exists($"{Ruta}PDF\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.pdf") AndAlso File.Exists($"{Ruta}XML\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.xml") Then + Dim PDF As String = $"{Ruta}PDF\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.pdf" + Dim XML As String = $"{Ruta}XML\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.xml" + + + Dim ResultadoMail As Integer = 0 + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = XML}) + + + + 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then + If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail2.Text.Trim, Asunto, Cuerpo, TxtCC2.Text.Trim, LSRutasMail) Then + ResultadoMail = 1 + TxtCC2.Text = "" + TxtBody2.Text = "" + RegistraScript("$('#ModalDivMail2').modal('hide');") + Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + CargaHistorial() + 'UpnHistorial.Update() + Else + Alert("Ocurrió un error al enviar el correo", TipoMensaje.MsgError) + ResultadoMail = 3 + End If + + Dim ObjVentas As New ClsVentas + ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta2.Value.ToEntero) + ObjVentas.Dispose() + Else + Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) + End If + ElseIf UsuarioActual.Empresa.TipoFacturacion = "CBB" AndAlso HdnTipoDocto2.Value.Contiene("Ing", "Egs") Then + If File.Exists(Ruta & "PDF\" & HdnFolioVenta2.Value & ".pdf") Then + Dim PDF As String = Ruta & "PDF\" & HdnFolioVenta2.Value & ".pdf" + + Dim ResultadoMail As Integer = 0 + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) + + 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then + If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail2.Text.Trim, Asunto, Cuerpo, TxtCC2.Text.Trim, LSRutasMail) Then + ResultadoMail = 1 + TxtCC2.Text = "" + TxtBody2.Text = "" + RegistraScript("$('#ModalDivMail2').modal('hide');") + Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + CargaHistorial() + UpnHistorial.Update() + Else + ResultadoMail = 3 + End If + + Dim ObjVentas As New ClsVentas + ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta2.Value.ToEntero) + ObjVentas.Dispose() + Else + Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) + End If + ElseIf HdnTipoDocto2.Value = "Cot" Then + If File.Exists($"{Ruta}PDF\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.pdf") Then + Dim PDF As String = $"{Ruta}PDF\{HdnTipoDocto2.Value}\{HdnFolioVenta2.Value}.pdf" + + Dim ResultadoMail As Integer = 0 + Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail) + LSRutasMail.Add(New ClsSisMail.ArchivoMail With {.Ruta = PDF}) + + 'If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail.Text.Trim, "Entrega de Factura", PDF, XML, ArrayCC, TxtBody.Text.Trim) Then + If ObjMail.SendMail(UsuarioActual.Empresa, TxtParaMail2.Text.Trim, Asunto, Cuerpo, TxtCC2.Text.Trim, LSRutasMail) Then + ResultadoMail = 1 + TxtCC2.Text = "" + TxtBody2.Text = "" + RegistraScript("$('#ModalDivMail2').modal('hide');") + Alert("El correo se envió correctamente", TipoMensaje.MsgInformacion) + CargaHistorial() + UpnHistorial.Update() + Else + ResultadoMail = 3 + End If + + Dim ObjVentas As New ClsVentas + ObjVentas.UpdateVentaMail(ResultadoMail, HdnCveVenta2.Value.ToEntero) + ObjVentas.Dispose() + Else + Alert("No se pudo adjuntar el correo electrónico.", TipoMensaje.MsgError) + End If + End If + + 'End If + 'ObjEmprea.Dispose() + Else + Alert("No se seleccionó ninguna factura para envíar.", TipoMensaje.MsgAdvertencia) + End If + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL", ex) + Dim ObjVentas As New ClsVentas + ObjVentas.UpdateVentaMail(3, HdnCveVenta2.Value.ToEntero) + ObjVentas.Dispose() + End Try + End Sub + + Protected Sub DdlSubProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) + If DdlSubProyecto.SelectedValue.ToEntero > 0 Then + Dim Dr As DataRow = GlobalDTSubProyectos(-1, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa).Rows(0) + If Dr IsNot Nothing Then + If Dr("CvePrecioLista").ToString.ToEntero > 0 Then + DdlPrecioLista.SelectedValueExist(Dr("CvePrecioLista").ToString) + End If + End If + End If + End Sub + +#End Region + +#Region "G P S" + + + + Private Sub EnviaCorreoGPS(Liga As String, LigaActivar As String) + + Try + Dim Para = TxtEmail.Text.Trim + Dim Asunto = "ACTIVACIÓN DEL PORTAL GPS" + Dim SBBody As New StringBuilder + 'Linia de estilos + SBBody.Append("") + 'incio Cuerpo del correo + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("ALTA DE CUENTA") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.AppendFormat(" Estimado {0}:
    ", TxtNombre.Text.ToUpper) + SBBody.AppendFormat("El presente correo es para informarle que se le han asignado los siguientes datos para el acceso al Portal GPS de: {0}

    ", UsuarioActual.Empresa.Empresa) + SBBody.Append("
    ") + SBBody.Append("
    Datos de usuario
    ") + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Dirección de Acceso
    ") + SBBody.AppendFormat("", Liga) + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Clave
    ") + SBBody.AppendFormat("
    {0}
    ", CveCliente) + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Usuario
    ") + SBBody.AppendFormat("
    {0}
    ", "Admin") + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Haga click para activar su cuenta
    ") + SBBody.AppendFormat("", LigaActivar) + SBBody.Append("
    ") + + + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("Para Activar su cuenta debera cambiar su contraseña.

    ") + SBBody.Append("
    ") + SBBody.Append("Nota Favor de NO responder este correo. ") + SBBody.Append("


    ") + SBBody.AppendFormat("", UrlSitio) + SBBody.Append("
    ") + SBBody.Append("
    ") + 'Termino Cuerpo del correo + + Dim Hilo As New System.Threading.Thread(Sub() MandaCorreo(Asunto, Para, SBBody.ToString)) + Hilo.Start() + Alert("El correo de activación se ha enviado correctamente a: " + TxtEmail.Text + ".", TipoMensaje.MsgInformacion) + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL", ex) + End Try + End Sub + + Private Sub BtnRegistrarCliente_Click(sender As Object, e As EventArgs) Handles BtnRegistrarCliente.Click + Dim ObjClientes As New ClsClientes + + If ObjClientes.RegistrarCliente(CveCliente) Then + RegistraScript("location.reload();") + End If + + ObjClientes.Dispose() + End Sub + + +#End Region + +#Region "C O N T R A T O S" + Private Sub CargaDatosContrato() + If CveCliente <= 0 Then + Exit Sub + End If + + Dim ObjContratos As New ClsContratos + If ObjContratos.GetReporteContratosAvancesCP(UsuarioActual.CveEmpresa, CveCliente, -1, -1, -1, -1, 1) Then + GvDatosAvance.DataSource = ObjContratos.DtResultados + Else + Alert("Ocurrió un Error al obtener el Reporte de Avances. Por favor vuelva a intentar", TipoMensaje.MsgError) + End If + + If ObjContratos.GetReporteContratosAvancesCP(UsuarioActual.CveEmpresa, CveCliente, -1, -1, -1, -1, -2) Then + GvContratosClienteInactivos.DataSource = ObjContratos.DtResultados + Else + Alert("Ocurrió un Error al obtener el Reporte de Avances Inactivos. Por favor vuelva a intentar", TipoMensaje.MsgError) + End If + + ObjContratos.Dispose() + GvDatosAvance.DataBind() + UpContratosInactivos.DataBind() + + + If GvDatosAvance.Rows.Count > 0 Or GvContratosClienteInactivos.Rows.Count > 0 Then + TabContratos.Visible = True + End If + End Sub + + Private Sub GvDatosAvance_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatosAvance.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("CveContrato").ToString.ToEntero = 0 Then + e.Row.Cells(0).Text = "Total:" + e.Row.CssClass = "Totales white" + End If + End If + End Sub + + Private Sub GvContratosClienteInactivos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvContratosClienteInactivos.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("CveContrato").ToString.ToEntero = 0 Then + e.Row.Cells(0).Text = "Total:" + e.Row.CssClass = "Totales white" + End If + End If + End Sub + +#End Region + +#Region "M E T O D O S " + Protected Sub RblTipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles RblTipo.SelectedIndexChanged + CargaHistorial(TipoDocto:=RblTipo.SelectedValue) + End Sub + Private Sub DdlSucursalCliente_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSucursalCliente.SelectedIndexChanged + CargaCotizaciones(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo + CargaHistorial(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo + CargaCxC(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo + CargaAnticipos(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo + CargaBancos(CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero) 'listo + + UpDatos.Update() + End Sub + Protected Sub LbDesactivaUsuario_Click(sender As Object, e As EventArgs) Handles LbDesactivaPortal.Click + 'Alert("Se Van a desativar todos o eliminar todos, junto con el Admin?") + Dim ObjUsuario As New ClsSisUsuarios + Dim ErrorUsuario As Boolean = False + + ObjUsuario.IniciaTransacSQL() + + For Each Dr As DataRow In DirectCast(ViewState("DTUsuariosCliente"), DataTable).Rows + 'se desactiva el usuario y se restablece la contraseña + If Not ObjUsuario.UpdateUsuarioPortal(Dr("Usuario").ToString, Dr("Nombre").ToString, Dr("Correo").ToString, False, ContraseñaPredeterminadaEncriptada, Dr("CveCliente").ToString.ToEntero, Dr("CveProveedor").ToString.ToEntero, Dr("CveUsuario").ToString.ToEntero, UsuarioActual.CveUsuario) Then + ErrorUsuario = True + End If + Next + + If ErrorUsuario Then + ObjUsuario.RollBack() + Else + LblUsuarioActivo.Text = "No" + HdnCveUsuarioPortalActivado.Value = "0" + trEnviarActivacion.Visible = True + trDesactivarUsuario.Visible = False + + 'DivPermisosPortal.Visible = False + + ObjUsuario.GetUsuariosPortal(-1, CveCliente, -1) + + ViewState("DTUsuariosCliente") = ObjUsuario.DtResultados + GvUsuariosPortal.DataSource = ViewState("DTUsuariosCliente") + GvUsuariosPortal.DataBind() + 'divUsuariosPortal.Visible = False + + ObjUsuario.Commit() + End If + + ObjUsuario.Dispose() + + If UsuarioActual.Empresa.CvePlataforma = 1 Then + CargaUsuariosPortalCliente() + End If + + UpGvUsuarios.Update() + UPPUsuarios.Update() + + End Sub + Private Sub AbonaaCuenta() + + 'si usa bancos, se va abrir el popupie para la recepci[on del pago + Dim MsgError As String = "" + + Dim ObjMov As New ClsContabilidad + ObjMov.IniciaTransacSQL() + Dim CvePrePoliza As Integer = ObjMov.AddPrePolizas("Cli", 2, TxtCantidad.Text.Trim.ToDouble, TxtCantidad.Text.Trim.ToDouble, 1, TxtFechaPago.Text.ToDate, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) + + If CvePrePoliza > 0 Then + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, TxtCantidad.Text.ToDecimal, TxtReferencia.Text, 2, TxtReferencia.Text, Now, 0, -1, -1, CveVenta:=HdnCveVentaAbono.Value.ToEntero, CveCliente:=CveCliente) Then + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, TxtCantidad.Text.ToDecimal, TxtReferencia.Text, 4, TxtReferencia.Text, Now, 0, -1, -1, CveVenta:=HdnCveVentaAbono.Value.ToEntero, CveCliente:=CveCliente) Then + + Else + MsgError = "no se pudo insertar el detalle de la póliza2" + End If + Else + MsgError = "no se pudo insertar el detalle de la póliza" + End If + Else + MsgError = "No se pudo insertar la póliza" + End If + + If MsgError = "" Then + Alert("El Documento se guardó correctamente.", TipoMensaje.MsgInformacion, "window.opener.location.href = window.opener.location.href; window.close();") + ObjMov.Commit() + + UpDatos.Update() + + Else + ObjMov.RollBack() + End If + ObjMov.Dispose() + + + + End Sub + Private Sub ChecaPermiteCredito() + ' DivParametros.Disabled = Not ChkPermiteCredito.Checked + 'For Each Control As Control In UpParametros.Controls + ' Control.Visible = ChkPermiteCredito.Checked + 'Next + + DivPortal.Visible = UsuarioActual.TienePermisoProceso(162) + + TxtLimiteCredito.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtPlazoCobranza.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtPlazoCobranzaRemision.Enabled = UsuarioActual.TienePermisoProceso(162) + + DdlTipoPago.Enabled = UsuarioActual.TienePermisoProceso(162) + DdlResponsable.Enabled = UsuarioActual.TienePermisoProceso(162) + + ChkLunes.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkMartes.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkMiercoles.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkJueves.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkViernes.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkSabado.Enabled = UsuarioActual.TienePermisoProceso(162) + + ChkRevLunes.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkRevMartes.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkRevMiercoles.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkRevJueves.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkRevViernes.Enabled = UsuarioActual.TienePermisoProceso(162) + ChkRevSabado.Enabled = UsuarioActual.TienePermisoProceso(162) + + TxtDiasEspecifico.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtDocumentacion.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtCobranzaContacto.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtCobranzaTelefono.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtCobranzaExt.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtCobranzaCorreo.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtHorario.Enabled = UsuarioActual.TienePermisoProceso(162) + + TxtPortalFacturacion.Enabled = UsuarioActual.TienePermisoProceso(162) + TxtObsDiasRevision.Enabled = UsuarioActual.TienePermisoProceso(162) + + UpParametros.Update() + End Sub + Private Function NombreCuenta(Id As Integer) As String + Dim Retorno As String = "" + + If UsuarioActual.Empresa.ServerContPAQi = "" Then Return "" + Dim ObjContabilidad As New ClsContPAQi(UsuarioActual.Empresa) + If ObjContabilidad.GetCuentas(Id, "-1", -1) Then + Retorno = ObjContabilidad.DtResultados.FiltroPrimeroValor("CtaCodigo") + End If + + Return Retorno + End Function + Private Sub SetValues() + ViewState("Orden") = "" + ViewState("OrdenUsuarios") = "" + TxtFechaPago.Text = Now.ToShortDateString + txtFechaI.Text = Now.ToShortDateString + txtFechaF.Text = Now.ToShortDateString + TxtFechaImportarSaldos.Text = Now.ToShortDateString + TxtFechaIUsados.Text = Now.FirstDayOfMonth.ToShortDateString + TxtFechaFUsados.Text = Now.LastDayOfMonth.ToShortDateString + CobranzaTelefono = "" + CodigoCliente = "" + + End Sub + + Protected Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click + If TxtExcel.getfiles().Archivos.Count > 0 Then + Dim file As Archivo = TxtExcel.getfiles().Archivos(0) + Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & file.patch + Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV") + CargarArchivo(Directorio, file.filename, Tipo) + Else + Alert("No existe el archivo.Favor de subir un archivo csv o excel a la plataforma", TipoMensaje.MsgError) + End If + End Sub + Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String) + Dim dt As New DataTable + Dim Conexion As Odbc.OdbcConnection = Nothing + Dim ErrorArchivo = False + Try + Select Case Tipo + Case "CSV" + Conexion = New Odbc.OdbcConnection("Driver={Microsoft Access Text Driver (*.txt, *.csv)};Dbq=" + Ruta + ";Extensions=asc,csv,tab,txt;") + Conexion.Open() + Dim cmd = Conexion.CreateCommand() + cmd.CommandType = CommandType.Text + cmd.CommandText = $"SELECT * FROM [{FileName}]" + Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) + DataAdapter.Fill(dt) + Case "EXCEL" + Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Ruta + FileName + ";") + Conexion.Open() + Dim cmd = Conexion.CreateCommand() + cmd.CommandType = CommandType.Text + cmd.CommandText = "SELECT * FROM [Hoja1$]" + Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd) + DataAdapter.Fill(dt) + Case Else + Alert("El archivo no tiene el formato correcto", TipoMensaje.MsgError) + Exit Sub + End Select + Catch ex As Exception + ErrorArchivo = True + OnError("Ocurrio un error al leer el archivo
    " & ex.Message, ex) + End Try + Conexion.Close() + If Not ErrorArchivo Then + If Not dt.Columns(0).ColumnName = "SerieFolio" Then + Alert("El nombre de la primera columna debe ser 'SerieFolio'.Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(1).ColumnName = "Fecha" Then + Alert("El nombre de la segunda columna debe ser 'Fecha'.Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(2).ColumnName = "Importe" Then + Alert("El nombre de la tercera columna debe ser 'Importe'.Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(3).ColumnName = "Saldo" Then + Alert("El nombre de la cuarta columna debe ser 'Saldo'.Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + Dim XmlStream As New System.IO.MemoryStream + dt.TableName = "Datos" + Dim ObjClientes As New ClsClientes + Dim writer As New System.IO.StringWriter + dt.WriteXml(writer) + If ObjClientes.GetVentasConciliacion(CveCliente, DataTableToXml(writer)) Then + ObjClientes.DtResultados.ExportToExcel("Resultados") + End If + ObjClientes.Dispose() + End If + End Sub + Private Function DataTableToXml(ByVal stream As System.IO.TextWriter) As String + Return stream.ToString() + End Function + Protected Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles BtnDescargar.Click + Dim Directorio As String = AppDomain.CurrentDomain.BaseDirectory & "Empresas\Grales\FormatoClientes.csv" + Dim Archivo As New FileInfo(Directorio) + If Archivo.Exists Then + Response.Clear() + Response.ClearHeaders() + Response.ClearContent() + Response.AddHeader("Content-Disposition", "attachment; filename=" + Archivo.Name) + Response.AddHeader("Content-Length", Archivo.Length.ToString()) + Response.ContentType = "text/plain" + Response.Flush() + Response.TransmitFile(Archivo.FullName) + Response.End() + End If + End Sub + Private Sub EnviaCorreo2(Liga As String, LigaActivar As String) + + Try + Dim Para = TxtCorreoUsuarioPortal.Text.Trim + Dim Asunto = "ACTIVACIÓN DEL PORTAL DE CLIENTE" + Dim SBBody As New StringBuilder + 'Linia de estilos + SBBody.Append("") + 'incio Cuerpo del correo + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("ALTA DE CUENTA") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.AppendFormat(" Estimado {0}:
    ", TxtNombreUsuarioPortal.Text.ToUpper) + SBBody.AppendFormat("El presente correo es para informarle que se le han asignado los siguientes datos para el acceso al Portal del Cliente de: {0}

    ", UsuarioActual.Empresa.Empresa) + SBBody.Append("
    ") + SBBody.Append("
    Datos de usuario
    ") + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Dirección de Acceso
    ") + SBBody.AppendFormat("", Liga) + SBBody.Append("
    ") + + 'SBBody.Append("
    ") + 'SBBody.Append("
    Clave
    ") + 'SBBody.AppendFormat("
    {0}
    ", CveCliente) + 'SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Usuario
    ") + SBBody.AppendFormat("
    {0}
    ", TxtCorreoUsuarioPortal.Text) + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Contraseña Predeterminada
    ") + SBBody.AppendFormat("
    {0}
    ", ContraseñaPredeterminada) + SBBody.Append("
    ") + + + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    Haga click para activar su cuenta
    ") + SBBody.AppendFormat("", LigaActivar) + SBBody.Append("
    ") + + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("
    ") + SBBody.Append("Para Activar su cuenta debera cambiar su contraseña.

    ") + SBBody.Append("
    ") + SBBody.Append("Nota Favor de NO responder este correo. ") + SBBody.Append("


    ") + + SBBody.AppendFormat("", UrlSitio) + SBBody.Append("") + SBBody.Append("") + 'Termino Cuerpo del correo + + Dim Hilo As New System.Threading.Thread(Sub() MandaCorreo2(Asunto, Para, SBBody.ToString)) + Hilo.Start() + Alert("El correo se ha enviado correctamente a: " + TxtCorreoUsuarioPortal.Text + ".", TipoMensaje.MsgInformacion) + Catch ex As Exception + OnError("Ocurrió error al mandar MAIL", ex) + End Try + End Sub + Private Sub MandaCorreo2(Asunto As String, Para As String, Body As String) + Dim a As String = String.Format("{0} -- {1} ---- -->", Asunto, Para) + a.GuardaLog() + Dim Mail As New ClsSisMail() Dim Envio As Boolean = Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body) - - End Sub - Protected Sub BtnCobranzaSMS_Click(sender As Object, e As EventArgs) - Dim Telefono = CobranzaTelefono - If Telefono.Length <> 10 Then - Alert("El telefono de cobranza no tiene el formato correcto y es necesario.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Dim DtCxC As DataTable - Dim FI = If(TxtFechaInicioCxP.Text = "" Or TxtFechaInicioCxP.Text = "__/__/____", "-1", TxtFechaInicioCxP.Text) - Dim FF = If(TxtFechaFinCxP.Text = "" Or TxtFechaFinCxP.Text = "__/__/____", "-1", TxtFechaFinCxP.Text) - Dim StrSaldo As String = "" - - Dim ObjMovtos As New ClsMovimientos() - If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, -1) Then - DtCxC = If(DdlTipoCuentasCxC.SelectedValue = "-1", If(DdlTipoDocto.SelectedValue = "-1", ObjMovtos.DtResultados, ObjMovtos.DtResultados.FiltraParametros($"TipoDocto = '{DdlTipoDocto.SelectedValue}'")), - If(DdlTipoDocto.SelectedValue = "-1", ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act' ", "Moneda, OrdenVencimiento ,FechaVencimiento"), ObjMovtos.DtResultados.FiltraParametros($"Tipo = 'Act' AND TipoDocto = '{DdlTipoDocto.SelectedValue}'", "Moneda, OrdenVencimiento ,FechaVencimiento"))) - - Dim Pesos As Double = DtCxC.SUM("Saldo", "CveMoneda = 1 and CveVenta > 0") - Dim Dolares As Double = DtCxC.SUM("Saldo", "CveMoneda = 2 and CveVenta > 0") - If Pesos > 0 Then StrSaldo = $" $ {Pesos.FormatoNumero} pesos" - If Dolares > 0 Then StrSaldo = $"{StrSaldo} ${Dolares.FormatoNumero} dólares" - ObjMovtos.Dispose() - Else - DtCxC = Nothing - ObjMovtos.Dispose() - Exit Sub - End If - - If StrSaldo.Length > 0 Then - Dim Mensaje = "" - Select Case UsuarioActual.CveEmpresa - Case 4 - Mensaje = $"Cliente de VSH Seguridad su saldo pendiente es de $ {StrSaldo} fecha limite 25/{Now.ToString("MM/yyyy")} llamar al 6622106400 #REFERENCIA {CodigoCliente} " - End Select - - Dim ObjSMS As New ClsTecnoMovil - Dim ObjEventos As New ClsOIEventos - If ObjSMS.EnviarMensajeWS(Telefono, Mensaje) Then - If ObjEventos.AddEventoBitacora($"Estado de cuenta enviado al cliente via SMS. Telefono: {Telefono} Mensaje: {Mensaje}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente:=CveCliente) Then - Alert("El mensaje se envió correctamente", TipoMensaje.MsgInformacion) - Else - Alert("El mensaje se envió correctamente. Pero no se pudo guardar historial", TipoMensaje.MsgAdvertencia) - End If - End If - ObjEventos.Dispose() - CargaEventoBitacora() - UPEventoBitacora.Update() - Else - Alert("No hay saldo pendiente del cliente. Por lo cual no se envió el mensaje.", TipoMensaje.MsgInformacion) - End If - - - End Sub - -#End Region - -#Region "IMPRIMIR GVHistorial" - - - Protected Sub BtnExcelHistorial_Click(sender As Object, e As EventArgs) - Dim retorno As Byte() = Nothing - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - - - 'OBTENEMOS LOS DATOS - 'Dim DTHistorial As DataTable - 'If ObjClientes.GetHistorialVentas(UsuarioActual.CveCliente, TopRegistros) Then - ' DTHistorial = ObjClientes.DtResultados - 'Else - ' DTHistorial = Nothing - 'End If - - If DTHistorialVentas.Rows.Count > 0 Then - Dim dr As DataRow = DTHistorialVentas.Rows(0) - - Dim params As New List(Of ReportParameter) - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("DireccionEmpresa", UsuarioActual.Empresa.Direccion)) - params.Add(New ReportParameter("TelefonoEmpresa", UsuarioActual.Empresa.Telefono)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - - ImprimirPDF("Empresas/Grales/Formatos/ClienteHistorial.rdlc", DTHistorialVentas, params, "Reporte de Historial", "Excel") - Else - Alert("Ocurrió un error.", TipoMensaje.MsgAdvertencia) - End If - - End Sub - - - Protected Sub BtnPDFHistorial_Click(sender As Object, e As EventArgs) - Dim retorno As Byte() = ImprimirReporteHistorial() - If retorno IsNot Nothing Then - ImprimirbytesPDF(retorno, "Reporte de Historial", Descarga:=True) - End If - End Sub - - Protected Function ImprimirReporteHistorial() As Byte() - Dim retorno As Byte() = Nothing - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - Dim ObjClientes As New ClsClientes() - - 'OBTENEMOS LOS DATOS - 'Dim DTHistorial As DataTable - 'If ObjClientes.GetHistorialVentas(UsuarioActual.CveCliente, TopRegistros) Then - ' DTHistorial = ObjClientes.DtResultados - 'Else - ' DTHistorial = Nothing - 'End If - - If DTHistorialVentas.Rows.Count > 0 Then - Dim dr As DataRow = DTHistorialVentas.Rows(0) - - Dim params As New List(Of ReportParameter) - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("DireccionEmpresa", UsuarioActual.Empresa.Direccion)) - params.Add(New ReportParameter("TelefonoEmpresa", UsuarioActual.Empresa.Telefono)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - - retorno = StreamPDF("Empresas/Grales/Formatos/ClienteHistorial.rdlc", DTHistorialVentas, params, "Reporte de Historial") - Else - Alert("Ocurrió un error.", TipoMensaje.MsgAdvertencia) - End If - ObjClientes.Dispose() - - Return retorno - End Function - - -#End Region - -#Region "C O B R A N Z A" - Public Sub Visitas_Click(sender As Object, e As EventArgs) - RegistraScript(String.Format("$('#{0}').modal();", "DivVisitas")) - End Sub - -#End Region - -#Region "Usuarios" - Protected Sub GvUsuarios_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvUsuarios.RowDeleting - Dim CveUsuario As Integer = GvUsuarios.Rows(e.RowIndex).DataKey("CveUsuario").ToEntero - Dim ObjUsuarios As New ClsSisUsuarios - If ObjUsuarios.DeleteClienteUsuario(CveUsuario, CveCliente) Then - Alert("El Usuario se eliminó correctamente", TipoMensaje.MsgInformacion) - End If - ObjUsuarios.Dispose() - CargaGlobal() - CargaUsuarios() - UpDispositivos.Update() - End Sub - - Public Sub CargaGlobal() - Dim ObjUsuarios As New ClsSisUsuarios - If ObjUsuarios.GetUsuariosEmpresas(-1) Then - Application("GlobalDTUsuarios") = ObjUsuarios.DtResultados - End If - ObjUsuarios.Dispose() - End Sub - - Protected Sub GvUsuarios_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvUsuarios.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - e.Row.FCLinkButton("imgE").Attributes.Add("onclick", $"javascript:AbrirVentana('/Sistemas/PopUpAddUsuario.aspx?CveUsuario={e.Row.DBCampo("CveUsuario").ToString}&CveCliente={CveCliente}', 801, 701);") - If UsuarioActual.Empresa.CvePlataforma = 1 Then - e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Center - e.Row.Cells(5).Visible = False - End If - End If - If e.Row.RowType = DataControlRowType.Header Then - If UsuarioActual.Empresa.CvePlataforma = 1 Then - e.Row.Cells(5).Visible = False - End If - End If - End Sub -#End Region - - -#Region "C U E N T A S - B A N C A R I A S" - - Private Sub CargaCuentasBancarias() - Dim ObjCuentasBancos As New ClsGenerales - ViewState("OrdenCuentasBancos") = "" - DTCuentasBancos = New DataTable - TempDTCuentasBancos = New DataTable - - If ObjCuentasBancos.GetCuentasDepositos(CveCliente:=CveCliente) Then - DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados) - Else - Alert("No se pudieron cargar las cuentas bancarias. Por favor intente nuevamente.", TipoMensaje.MsgAdvertencia) - End If - - If CveCliente < 0 Then - TempDTCuentasBancos = DTCuentasBancos.Clone - - End If - - ObjCuentasBancos.Dispose() - CargaPSGridCuentasBancos() - - RecargaGlobalCuentasBancarias() - CargaMonedas() - End Sub - Protected Sub LbAgregarCuentaBanco_Click(sender As Object, e As EventArgs) - Dim EsBancomer = False - - If TxtNombreBanco.Text.ToUpper.Contains("BBVA") Or TxtNombreBanco.Text.ToUpper.Contains("BANCOMER") Or (TxtCLABE.Text.Length = 18 AndAlso TxtCLABE.Text.Substring(0, 3) = "012") Then - EsBancomer = True - End If - - - If TxtNumeroCuenta2.Text.Trim.Length = 0 AndAlso TxtCLABE.Text.Trim.Length = 0 AndAlso TxtSWIFT.Text.Trim.Length = 0 AndAlso TxtConvenioCIE.Text.Trim.Length = 0 Then - Alert("Debe especificar al menos un numero de cuenta.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'SI CLABE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 18 - If TxtCLABE.Text.Trim.Length <> 0 AndAlso TxtCLABE.Text.Trim.Length <> 18 Then - Alert("La CLABE debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'RESTRICCIONES - GLUYAS - If UsuarioActual.CveEmpresa = 66 Then - - 'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER - If TxtCLABE.Text.Trim.Length <> 18 And TxtCLABE.Text.Trim.Length = 0 And Not EsBancomer And TxtSWIFT.Text.Trim.Length = 0 Then - Alert("La CLABE es obligatoria y debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'SI CUENTA TIENE ALGO Y BANCO BANCOMER DEBE TENER UNA LOGITUD EXACTA DE 10 - If TxtNumeroCuenta2.Text.Trim.Length <> 0 AndAlso TxtNumeroCuenta2.Text.Trim.Length <> 10 AndAlso EsBancomer Then - Alert("El número de cuenta debe tener una longitud de 10 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'SI CIE TIENE ALGO REFERENCIA OBLIGATORIA - If TxtConvenioCIE2.Text.Trim.Length <> 0 And TxtReferencia2.Text.Trim.Length < 3 Then - Alert("Cuando se ingresa Convenio CIE se debe especificar una referencia. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - 'CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA" - If EsBancomer AndAlso Not (TxtNumeroCuenta2.Text.Trim.Length = 10 Or TxtConvenioCIE2.Text.Trim.Length <> 0) Then - Alert("Para cuentas BBVA BANCOMER es obligatorio el Número de Cuenta o CIE.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - Else - - 'SI CIE TIENE ALGO DEBE TENER UNA LOGITUD MINIMA DE 5 - If TxtConvenioCIE2.Text.Trim.Length <> 0 And TxtConvenioCIE2.Text.Trim.Length < 5 Then - Alert("El Convenio CIE debe tener una longitud de al menos 5 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Exit Sub - End If - - End If - Dim Estatus As Boolean - If ChkEstatus2.Checked = True Then Estatus = True Else Estatus = False - - AgregarCuentaBanco(TxtNombreBanco.Text.Trim, TxtNumeroSucursal.Text.Trim, TxtCLABE.Text.Trim, TxtSWIFT.Text.Trim, TxtPlaza.Text.Trim, TxtNumeroCuenta2.Text.Trim, TxtConvenioCIE2.Text.Trim, TxtReferencia2.Text.Trim, "", DdlMoneda.SelectedValue.ToEntero, DdlMoneda.SelectedItem.Text, Estatus) - End Sub - Private Sub AgregarCuentaBanco(NombreBanco As String, NumeroSucursal As String, CLABE As String, SWIFT As String, Plaza As String, NumeroCuenta As String, ConvenioCIE As String, Referencia As String, RefCrediProveedor As String, CveMoneda As Integer, Moneda As String, Estatus As Boolean) - Dim ObjCuentasBancos As New ClsGenerales - If Modalidad = "A" Then - - If CveCliente > 0 Then - - If ObjCuentasBancos.AddCuentasDepositos(NombreBanco, Plaza, NumeroSucursal, NumeroCuenta, CLABE, ConvenioCIE, SWIFT, Referencia, RefCrediProveedor, UsuarioActual.CveUsuario, CveMoneda, CveCliente:=CveCliente) Then - DTCuentasBancos.Clear() - DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados.FiltraParametros(String.Format("CveCliente = {0}", CveCliente))) - Alert("Cuenta Bancaria agregada con éxito.", TipoMensaje.MsgInformacion) - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddCuentasBancarias")) - Else - Alert("Error al registrar la cuenta bancaria. Por favor intente nuevamente", TipoMensaje.MsgError) - End If - - Else - Dim Row As DataRow - Row = TempDTCuentasBancos.NewRow - - Row("BancoNombre") = NombreBanco - Row("Sucursal") = NumeroSucursal - Row("CLABE") = CLABE - Row("SWIFT") = SWIFT - Row("Plaza") = Plaza - Row("Cuenta") = NumeroCuenta - Row("CIE") = ConvenioCIE - Row("Referencia") = Referencia - Row("RefCrediProveedor") = RefCrediProveedor - Row("CveMoneda") = CveMoneda - Row("Moneda") = Moneda - Row("EstatusPagoElectronico") = 0 - Row("Estatus") = "True" - TempDTCuentasBancos.Rows.Add(Row) - Alert("Cuenta Bancaria agregada con éxito.", TipoMensaje.MsgInformacion) - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddCuentasBancarias")) - - End If - - Else - - - If CveCliente > 0 Then - - If ObjCuentasBancos.UpdateCuentasDepositos(GvBancosCuentas.DataKeys(CveCuentaBancaria)("CveCuentaDeposito").ToString.ToEntero, NombreBanco, Plaza, NumeroSucursal, NumeroCuenta, CLABE, ConvenioCIE, SWIFT, Referencia, "", False, Estatus, CveMoneda) Then - DTCuentasBancos.Clear() - DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados.FiltraParametros(String.Format("CveCliente = {0}", CveCliente))) - Alert("Cuenta actualizada con éxito.", TipoMensaje.MsgInformacion) - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddCuentasBancarias")) - Else - Alert("Error al actualizar la cuenta bancaria. Por favor intente nuevamente.", TipoMensaje.MsgError) - End If - - Else - - Dim index = CveCuentaBancaria - Dim Row As DataRow = TempDTCuentasBancos.Rows(index) - Row("BancoNombre") = NombreBanco - Row("Sucursal") = NumeroSucursal - Row("CLABE") = CLABE - Row("SWIFT") = SWIFT - Row("Plaza") = Plaza - Row("Cuenta") = NumeroCuenta - Row("CIE") = ConvenioCIE - Row("Referencia") = Referencia - Row("CveMoneda") = CveMoneda - Row("Moneda") = Moneda - Row("Estatus") = Estatus - TempDTCuentasBancos.AcceptChanges() - Alert("Cuenta actualizada con éxito.", TipoMensaje.MsgInformacion) - RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddCuentasBancarias")) - End If - - End If - ObjCuentasBancos.Dispose() - LimpiaCuentasBancarias() - CargaPSGridCuentasBancos() - RecargaGlobalCuentasBancarias() - End Sub - Private Sub LimpiaCuentasBancarias() - TxtNombreBanco.Text = "" - TxtNumeroSucursal.Text = "" - TxtCLABE.Text = "" - TxtSWIFT.Text = "" - TxtPlaza.Text = "" - TxtNumeroCuenta2.Text = "" - TxtConvenioCIE2.Text = "" - TxtReferencia2.Text = "" - End Sub - -#Region "GRIDVIEW - CUENTAS BANCARIAS" - Protected Sub GvBancosCuentas_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvBancosCuentas.RowDataBound - If e.Row.RowType = DataControlRowType.DataRow Then - - If CveCliente < 0 Then - For index = 1 To TempDTCuentasBancos.Rows.Count - TempDTCuentasBancos.Rows(index - 1)("CveCuentaDeposito") = index - Next - TempDTCuentasBancos.AcceptChanges() - End If - - - If e.Row.DBCampo("Estatus") = "True" Then - e.Row.FCLabel("LlbEstatusTexto").Text = "Activo" - Else - e.Row.FCLabel("LlbEstatusTexto").Text = "Inactivo" - End If - - End If - End Sub - - - Public Sub Delete_Click(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim ObjCuentasBancos As New ClsGenerales - - If CveCliente > 0 Then - If ObjCuentasBancos.RemoveCuentasDepositos(GvRow.DataKey("CveCuentaDeposito").ToEntero) Then - DTCuentasBancos.Clear() - DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados.FiltraParametros(String.Format("CveCliente = {0}", CveCliente))) - - Alert("Cuenta Bancaria borrada con éxito.", TipoMensaje.MsgInformacion) - Else - Alert("No se pudo borrar la Cuenta Bancaria. Por favor intente nuevamente.", TipoMensaje.MsgError) - End If - Else - Dim index = GvRow.RowIndex - TempDTCuentasBancos.Rows.RemoveAt(index) - Alert("Cuenta Bancaria borrada con éxito.", TipoMensaje.MsgInformacion) - End If - - 'If ObjCuentasBancos.GetCuentasDepositos Then - ' GlobalDTProveedoresCuentas(CveCliente, True) = ObjCuentasBancos.DtResultados - 'End If - - CargaPSGridCuentasBancos() - ObjCuentasBancos.Dispose() - RecargaGlobalCuentasBancarias() - End Sub - Private Sub RecargaGlobalCuentasBancarias(Optional ByVal CveCuenta As Integer = -1) - If CveCliente > 0 Then - Dim ObjCuentasBancos As New ClsGenerales - - If ObjCuentasBancos.GetCuentasDepositos() Then - GlobalDTProveedoresCuentas(-1, True) = ObjCuentasBancos.DtResultados - End If - ObjCuentasBancos.Dispose() - End If - End Sub - -#End Region - - Private Sub CargaPSGridCuentasBancos() - If CveCliente > 0 Then - GvBancosCuentas.DataSource = DTCuentasBancos - Else - GvBancosCuentas.DataSource = TempDTCuentasBancos - End If - - GvBancosCuentas.DataBind() - UpCuentasBancos.Update() - End Sub - - - Private Sub CargaMonedas() - DdlMoneda.DataSource = GlobalDTMonedas - DdlMoneda.DataBind() - DdlMoneda.Items.Insert(0, New ListItem("Seleccione", "-1")) - End Sub - - - - - Private Sub LnkCuentasBancarias_Click(sender As Object, e As EventArgs) Handles LnkCuentasBancarias.Click - Modalidad = "A" - TxtNombreBanco.Text = "" - LbAgregarCuentaBanco.Text = "Agregar" - TxtNumeroSucursal.Text = "" - TxtNumeroCuenta2.Text = "" - TxtCLABE.Text = "" - TxtSWIFT.Text = "" - TxtPlaza.Text = "" - TxtConvenioCIE2.Text = "" - TxtReferencia2.Text = "" - DdlMoneda.SelectedIndex = 0 - ChkEstatus2.Checked = True - divestatus.Visible = False - UpAddBancos.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddCuentasBancarias")) - End Sub - - Public Sub Edit_Click2(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - TxtNombreBanco.Text = GvRow.DataKey("BancoNombre") - Modalidad = "U" - LbAgregarCuentaBanco.Text = "Actualizar" - CveCuentaBancaria = GvRow.RowIndex - TxtNumeroSucursal.Text = GvRow.DataKey("Sucursal") - TxtNumeroCuenta2.Text = GvRow.DataKey("Cuenta") - TxtCLABE.Text = GvRow.DataKey("CLABE") - TxtSWIFT.Text = GvRow.DataKey("SWIFT") - TxtPlaza.Text = GvRow.DataKey("Plaza") - TxtConvenioCIE2.Text = GvRow.DataKey("CIE") - TxtReferencia2.Text = GvRow.DataKey("Referencia") - DdlMoneda.SelectedValueExist(GvRow.DataKey("CveMoneda")) - ChkEstatus2.Checked = CBool(GvRow.DataKey("Estatus")) - divestatus.Visible = True - UpAddBancos.Update() - RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddCuentasBancarias")) - End Sub -#End Region - -#Region "C L I E N T E S P A G O S R E A L I Z A D O S I M P R I M I R P D F/Excel" - Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosExcel.Click - GenerarPDF("Excel") - End Sub - Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosPDF.Click - GenerarPDF() - End Sub - Private Sub GenerarPDF(Optional Formato As String = "PDF") - Dim params As New List(Of ReportParameter) - - Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) - Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) - params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) - params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) - params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) - - If Imagen.Exists Then - params.Add(New ReportParameter("LogoPath", logouri)) - Else - params.Add(New ReportParameter("LogoPath", "")) - End If - ImprimirPDF("Empresas\Grales\Formatos\RepClientesPagosBancos.rdlc", DTCobrosRealizados, params, "RepClientesPagosBancos_" & Now.ToString("yyyyMMddhhmmss"), Formato:=Formato) - - + End Sub -#End Region + Protected Sub BtnCobranzaSMS_Click(sender As Object, e As EventArgs) + Dim Telefono = CobranzaTelefono + If Telefono.Length <> 10 Then + Alert("El telefono de cobranza no tiene el formato correcto y es necesario.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If -#Region "VENTAS" + Dim DtCxC As DataTable + Dim FI = If(TxtFechaInicioCxP.Text = "" Or TxtFechaInicioCxP.Text = "__/__/____", "-1", TxtFechaInicioCxP.Text) + Dim FF = If(TxtFechaFinCxP.Text = "" Or TxtFechaFinCxP.Text = "__/__/____", "-1", TxtFechaFinCxP.Text) + Dim StrSaldo As String = "" - Public Function imprimirFacturaVenta(CveVenta As Integer) As Byte() - Dim ObjVentas As New ClsVentas - Dim Vta As Modelos.Factura = Nothing - - Dim TmpDTImpuestos = New DataTable - TmpDTImpuestos.Columns.Add("ImpuestoLocal", GetType(String)) - TmpDTImpuestos.Columns.Add("Importe", GetType(Double)) - TmpDTImpuestos.Columns.Add("Orden", GetType(Integer)) - - Dim TmpDTImpuestosIVAIEPS = New DataTable - TmpDTImpuestosIVAIEPS.Columns.Add("Impuesto", GetType(String)) - TmpDTImpuestosIVAIEPS.Columns.Add("tasa", GetType(String)) - TmpDTImpuestosIVAIEPS.Columns.Add("Importe", GetType(Double)) - TmpDTImpuestosIVAIEPS.Columns.Add("Orden", GetType(Integer)) - - If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then - Dim dtVentas As DataTable = ObjVentas.DtResultados - - ' se rellenan los campos de la factura - Vta = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.Factura) - - Vta.MonedaAbreviatura = dtVentas(0)("Abreviatura").ToString - 'se rellena la sucursal - 'Vta.Subproyecto = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.SucursalModel) - Vta.SubProyecto = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.SubProyectoModel) - Vta.Cliente = New Modelos.ClienteModel - Vta.Cliente.Nombre = dtVentas(0)("ClienteNombre").ToString - Vta.Cliente.Telefono = dtVentas(0)("Telefono").ToString - Vta.Cliente.Direccion = dtVentas(0)("ClienteDireccion").ToString - Vta.Cliente.CP = dtVentas(0)("CPCliente").ToString - Vta.Cliente.Ciudad = dtVentas(0)("ClienteCiudad").ToString - Vta.Cliente.Localidad = dtVentas(0)("ClienteLocalidad").ToString - Vta.Cliente.Estado = dtVentas(0)("ClienteEstado").ToString - Vta.Cliente.Pais = dtVentas(0)("ClientePais").ToString - Vta.Cliente.RFC = dtVentas(0)("ClienteRFC").ToString - Vta.Cliente.Colonia = dtVentas(0)("ColoniaCliente").ToString - Vta.AtencionA = dtVentas(0)("AtencionA").ToString - Vta.Cliente.NoExt = dtVentas(0)("ClienteNoExt").ToString - Vta.Cliente.NoInt = dtVentas(0)("ClienteNoInt").ToString - Vta.Cliente.Codigo = dtVentas(0)("ClienteCodigo").ToString - Vta.Cliente.Mail = dtVentas(0)("Mail").ToString - Vta.RefDocto = dtVentas(0)("Ref").ToString - Vta.CveVenta = dtVentas(0)("CveVenta").ToString.ToEntero - Vta.Version = dtVentas(0)("Version").ToString - - Vta.NumeroContrato = dtVentas(0)("NumeroContrato").ToString - Vta.DescripcionContrato = dtVentas(0)("DescripcionContrato").ToString - Vta.NumeroDescripcionContrato = If($"{dtVentas(0)("NumeroContrato").ToString} - {dtVentas(0)("NumeroLicitacion").ToString}" = " - ", "", $"{dtVentas(0)("NumeroContrato").ToString} {If(dtVentas(0)("NumeroLicitacion").ToString = "", "", $" - Licitación: {dtVentas(0)("NumeroLicitacion").ToString}")}") - - Vta.PedidoContrato = If(dtVentas(0)("PedidoContrato").ToString = "", Vta.NumeroDescripcionContrato, $"{dtVentas(0)("PedidoContrato").ToString} {If(Vta.NumeroDescripcionContrato = "", "", $" / {Vta.NumeroDescripcionContrato}") }") - 'Vta.PedidoContrato = dtVentas(0)("PedidoContrato").ToString - - Vta.ClienteSucursal = New Modelos.SucursalModel - Vta.ClienteSucursal.Direccion = dtVentas(0)("SucClienteDireccion").ToString - Vta.ClienteSucursal.NoExt = dtVentas(0)("SucClienteNoExt").ToString - Vta.ClienteSucursal.NoInt = dtVentas(0)("SucClienteNoInt").ToString - Vta.ClienteSucursal.Colonia = dtVentas(0)("SucClienteColonia").ToString - Vta.ClienteSucursal.CP = dtVentas(0)("SucClienteCP").ToString - Vta.ClienteSucursal.Municipio = dtVentas(0)("SucClienteCiudad").ToString - Vta.ClienteSucursal.Estado = dtVentas(0)("SucClienteEstado").ToString - Vta.ClienteSucursal.Pais = dtVentas(0)("SucClientePais").ToString - Vta.ClienteSucursal.Localidad = dtVentas(0)("SucClienteLocalidad").ToString - Vta.ClienteSucursal.CorreoSucursal = dtVentas(0)("SucClienteCorreo").ToString - Vta.ClienteSucursal.TelefonoSucursal = dtVentas(0)("SucClienteTelefono").ToString - Vta.ClienteSucursal.Sucursal = dtVentas(0)("SucursalCliente").ToString - Vta.ClienteSucursal.ImprimeNombreSucursal = dtVentas(0)("ImprimeNombreSucursal").ToString - - Vta.EnviarA = New Modelos.EnviarAModel - Vta.EnviarA.CveDireccionEnvio = dtVentas(0)("CveDireccionEnvio").ToString.ToEntero - Vta.EnviarA.EnvioDireccion = dtVentas(0)("EnvioDireccion").ToString - Vta.EnviarA.EnvioColonia = dtVentas(0)("EnvioColonia").ToString - Vta.EnviarA.EnvioCiudad = dtVentas(0)("EnvioCiudad").ToString - Vta.EnviarA.EnvioEstado = dtVentas(0)("EnvioEstado").ToString - Vta.EnviarA.EnvioCP = dtVentas(0)("EnvioCP").ToString - - Vta.EnviarA.EnvioNoExt = dtVentas(0)("EnvioNoExt").ToString - Vta.EnviarA.EnvioNoInt = dtVentas(0)("EnvioNoInt").ToString - Vta.EnviarA.EnvioContacto = dtVentas(0)("EnvioContacto").ToString - 'Vta.EnviarA.EnvioPedidoContrato = dtVentas(0)("EnvioPedidoContrato").ToString - - 'INE COMPLEMENTO - If dtVentas(0)("TipoComite").ToString <> "" Then - Dim INE As New Modelos.ComplementoINE - INE.INETipoComite = dtVentas(0)("TipoComite").ToString - INE.INETipoProceso = dtVentas(0)("TipoProceso").ToString - INE.INEIdContabilidad = dtVentas(0)("IdContabilidad").ToString.ToEntero - Vta.ComplementoINE = INE - End If - - - Dim DR As DataRow = TmpDTImpuestos.NewRow() - If dtVentas(0)("SubTotal").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Subtotal" : DR("Importe") = dtVentas(0)("SubTotal").ToString.ToDouble : DR("Orden") = 10 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("Descuento").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Descuentos" : DR("Importe") = dtVentas(0)("Descuento").ToString.ToDouble : DR("Orden") = 20 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("Amortizacion").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Amort.Ant" : DR("Importe") = dtVentas(0)("Amortizacion").ToString.ToDouble : DR("Orden") = 30 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("SubTotal").ToString.ToDouble <> (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) Then DR("ImpuestoLocal") = "SubTotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) : DR("Orden") = 40 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("IVA").ToString.ToDouble >= 0 Then DR("ImpuestoLocal") = "IVA" : DR("Importe") = dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 50 : TmpDTImpuestos.Rows.Add(DR) - - 'solo para eclipse, que muesre un subtotal debajo de IVA - If UsuarioActual.CveEmpresa = 15 Then DR = TmpDTImpuestos.NewRow() : DR("ImpuestoLocal") = "Subtotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) + dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 51 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("RetIVA").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.IVA" : DR("Importe") = dtVentas(0)("RetIVA").ToString.ToDouble : DR("Orden") = 60 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - If dtVentas(0)("RetISR").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.ISR" : DR("Importe") = dtVentas(0)("RetISR").ToString.ToDouble : DR("Orden") = 70 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - - If dtVentas(0)("IEPS").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "IEPS" : DR("Importe") = dtVentas(0)("IEPS").ToString.ToDouble : DR("Orden") = 80 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - - If dtVentas(0)("Total").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Total" : DR("Importe") = dtVentas(0)("Total").ToString.ToDouble : DR("Orden") = 100 : TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - - If ObjVentas.GetVentaDetalle(CveVenta) Then 'Obtenemos el Detalle de la Oorden de Compra - Vta.DtDetalle = ObjVentas.DtResultados - End If - - If ObjVentas.GetVentaImpuestosLocales(CveVenta) Then - - Dim dtImpuesto As DataTable = ObjVentas.DtResultados - If dtImpuesto.Rows.Count > 0 Then - For Each Row As DataRow In dtImpuesto.Rows - Dim Orden = 80 - If Row("Importe").ToString.ToDouble <> 0 Then - DR("ImpuestoLocal") = Row("ImpuestoLocal").ToString - DR("Importe") = Row("Importe").ToString.ToDouble - DR("Orden") = Orden - TmpDTImpuestos.Rows.Add(DR) - DR = TmpDTImpuestos.NewRow() - Orden = Orden + 1 - End If - Next - End If - Vta.DtDeduccion = TmpDTImpuestos.FiltraParametros("", Orderby:="Orden ASC") - - End If - - 'TmpDT DESGLOSE DE IMPUESTOS 3.3 - For Each dr1 As DataRow In Vta.DtDetalle.Rows - Dim DrIVA As DataRow = Nothing - Dim DrIEPS As DataRow = Nothing - - Try - DrIVA = TmpDTImpuestosIVAIEPS.Select("Impuesto = 'IVA'")(0) - Catch ex As Exception - DrIVA = Nothing - End Try - - If DrIVA IsNot Nothing Then - DrIVA("Importe") = DrIVA("Importe").ToString.ToDouble + dr1("ImporteIVA").ToString.ToDouble - TmpDTImpuestosIVAIEPS.AcceptChanges() - Else - Dim DR2 As DataRow = TmpDTImpuestosIVAIEPS.NewRow() - If dr1("PorcentajeIVA").ToString.ToDouble >= 0 Then - DR2("Impuesto") = "IVA" : DR2("tasa") = "16 %" : DR2("Importe") = dr1("ImporteIVA").ToString.ToDouble : DR2("Orden") = "1" - TmpDTImpuestosIVAIEPS.Rows.Add(DR2) - TmpDTImpuestosIVAIEPS.AcceptChanges() - End If - End If - - Try - DrIEPS = TmpDTImpuestosIVAIEPS.Select($"Impuesto = 'IEPS' AND tasa = '{dr1("PorcentajeIEPS").ToString.ToDouble * 100} %'")(0) - Catch ex As Exception - DrIEPS = Nothing - End Try - - If DrIEPS IsNot Nothing Then - DrIEPS("Importe") = DrIEPS("Importe").ToString.ToDouble + dr1("ImporteIEPS").ToString.ToDouble - TmpDTImpuestosIVAIEPS.AcceptChanges() - Else - Dim DR2 As DataRow = TmpDTImpuestosIVAIEPS.NewRow() - If dr1("PorcentajeIEPS").ToString.ToDouble > 0 Then - DR2("Impuesto") = "IEPS" : DR2("tasa") = String.Format("{0} {1}", dr1("PorcentajeIEPS").ToString.ToDouble * 100, "%") : DR2("Importe") = dr1("ImporteIEPS").ToString.ToDouble : DR2("Orden") = If(dr1("PorcentajeIEPS").ToString = "0.03", "2", If(dr1("PorcentajeIEPS").ToString = "0.06", "3", If(dr1("PorcentajeIEPS").ToString = "0.07", "4", If(dr1("PorcentajeIEPS").ToString = "0.09", "5", "")))) - TmpDTImpuestosIVAIEPS.Rows.Add(DR2) - TmpDTImpuestosIVAIEPS.AcceptChanges() - End If - End If - - Next - Vta.DtDesgloseImpuestos = TmpDTImpuestosIVAIEPS.FiltraParametros("", Orderby:="Orden ASC") - - If ObjVentas.GetVentasFirmas(CveVenta) Then - Vta.DtFirmas = ObjVentas.DtResultados - End If - - If UsuarioActual.CveEmpresa.Contiene(119) Then - If dtVentas(0)("TipoDocto").ToString.Contiene("Ing", "Ant", "Rem") Then - 'carga as notas de credito vinculadas - If ObjVentas.GetVentasAntNC(CveVenta, -1) Then - Vta.DtDocumentosRelacionados = ObjVentas.DtResultados - - End If - End If - - If dtVentas(0)("TipoDocto").ToString.Contiene("Egs", "Dev", "Ant") Then - If ObjVentas.GetVentasAntNC(-1, CveVenta) Then - Vta.DtDocumentosRelacionados = ObjVentas.DtResultados - End If - End If - End If - - - 'CFDI RELACIONADO - If dtVentas(0)("CveTipoRelacion").ToString.ToEntero > 0 Then - Vta.Timbre.Comprobante.TipoComprobante = If(Vta.TipoDocto.Contiene("Ing", "Ant"), "I", If(Vta.TipoDocto.Contiene("Egs", "Dev"), "E", "")) - If Vta.Timbre.Comprobante.TipoComprobante = "E" Then - If Vta.TipoDocto.Contiene("Egs") Then - Vta.Timbre.CFDIRelacionados.TipoRelacion = "01" - Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso" - End If - If Vta.TipoDocto.Contiene("Dev") Then - Vta.Timbre.CFDIRelacionados.TipoRelacion = "03" - Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso" - End If - Vta.Timbre.CFDIRelacionados.UUID.Add(dtVentas(0)("FolioFiscalPadre").ToString) - End If - ' cuando es refacturacoin es cfdirelacionado, con relacion 04 - If Vta.Timbre.Comprobante.TipoComprobante = "I" AndAlso (dtVentas(0)("Total").ToString.ToDouble = dtVentas(0)("TotalPadre").ToString.ToDouble) Then - Vta.Timbre.CFDIRelacionados.TipoRelacion = "04" - Vta.Timbre.CFDIRelacionados.UUID.Add(dtVentas(0)("FolioFiscalPadre").ToString) - Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Refacturación de Ingreso" - End If - End If - - End If - ObjVentas.Dispose() - - Return PdfFactura(Vta) - End Function - -#End Region - -#Region "COMERCIO EXTERIOR" - Public Sub CargaCombosComercioExterior() - - DdlTipoOperacion.Items.Clear() - DdlTipoOperacion.DataSource = GlobalDTTipoOperacion() - DdlTipoOperacion.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlTipoOperacion.DataBind() - - DdlIncoterm.Items.Clear() - DdlIncoterm.DataSource = GlobalDTIncoterm() - DdlIncoterm.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlIncoterm.DataBind() - - DdlClavePedimento.Items.Clear() - DdlClavePedimento.DataSource = GlobalDTClavePedimento() - DdlClavePedimento.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlClavePedimento.DataBind() - - DdlMotivoTraslado.Items.Clear() - DdlMotivoTraslado.DataSource = GlobalDTSATMotivoTraslado() - DdlMotivoTraslado.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlMotivoTraslado.DataBind() - - CargaPais() - CargaEstado() - CargaMunicipio() - CargaColonia() - - End Sub - - - Private Sub CargaPais() - DdlPais.Items.Clear() - DdlPais.DataSource = GlobalDTPais() - DdlPais.DataBind() - DdlPais.SelectedValueExist("151") - End Sub - - Private Sub CargaEstado() - DdlEstado.Items.Clear() - If DdlPais.SelectedValue.ToEntero > 0 Then - DdlEstado.DataSource = GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString) - End If - DdlEstado.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlEstado.DataBind() - End Sub - - Private Sub CargaMunicipio() - DdlMunicipio.Items.Clear() - If DdlEstado.SelectedValue.ToEntero > 0 Then - DdlMunicipio.DataSource = GlobalDTMunicipio(GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString).FiltraParametros($"CveEstado = {DdlEstado.SelectedValue.ToEntero}")(0)("ClaveSATEstado").ToString) - End If - DdlMunicipio.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlMunicipio.DataBind() - End Sub - - Private Sub CargaColonia() - DdlColonia.Items.Clear() - If DdlMunicipio.SelectedValue.ToEntero > 0 Then - DdlColonia.DataSource = GlobalDTColonia(GlobalDTMunicipio(GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString).FiltraParametros($"CveEstado = {DdlEstado.SelectedValue.ToEntero}")(0)("ClaveSATEstado").ToString).FiltraParametros($"CveMunicipio = {DdlMunicipio.SelectedValue.ToEntero}")(0)("ClaveSATMunicipio").ToString) - End If - DdlColonia.Items.Insert(0, New ListItem("Seleccione", "-1")) - DdlColonia.DataBind() - End Sub - - Protected Sub DdlPais_SelectedIndexChanged(sender As Object, e As EventArgs) - 'si contiene MX, USA o CANADA carga ddls, si no carga txt - CargaEstado() - - If DdlPais.SelectedValue.Contiene("151", "66", "40") Then - DdlEstado.Visible = True - DdlMunicipio.Visible = True - DdlColonia.Visible = True - - TxtComExtEstado.Visible = False - TxtComExtMunicipio.Visible = False - TxtComExtColonia.Visible = False - - TxtComExtEstado.Text = "" - TxtComExtMunicipio.Text = "" - TxtComExtColonia.Text = "" - - If DdlPais.SelectedValue.Contiene("66", "40") Then - DdlMunicipio.Visible = False - DdlColonia.Visible = False - - DdlMunicipio.SelectedValue = "-1" - DdlColonia.SelectedValue = "-1" - - TxtComExtMunicipio.Visible = True - TxtComExtColonia.Visible = True - End If - - Else - 'Limpia los DDLs - CargaMunicipio() - CargaColonia() - - DdlEstado.Visible = False - DdlMunicipio.Visible = False - DdlColonia.Visible = False - - TxtComExtEstado.Visible = True - TxtComExtMunicipio.Visible = True - TxtComExtColonia.Visible = True - End If - End Sub - Protected Sub DdlEstado_SelectedIndexChanged(sender As Object, e As EventArgs) - CargaMunicipio() - CargaColonia() - End Sub - Protected Sub DdlMunicipio_SelectedIndexChanged(sender As Object, e As EventArgs) - CargaColonia() - End Sub - -#End Region - -#Region "D O C U M E N T A C I O N " - - Private Sub CargaDocumentacionCliente() - Dim objRH As New ClsEdocumentacion() - - If objRH.DocumentacionElectronicaGet(-1, If(CveCliente = -1, 0, CveCliente), -1, UsuarioActual.Empresa.CveEmpresa, -1, Modulo:=2) Then - DTDocumentacion = objRH.DtResultados - GvDocumentosCliente.DataSource = objRH.DtResultados - End If - objRH.Dispose() - 'If DTDocumentacion.FiltraParametros(" CveDocumentacionTipo = 7 ").Rows.Count > 0 Then - ' GvDocumentosCliente.DataSource = DTDocumentacion.FiltraParametros(" CveDocumentacionTipo = 7 ") - 'Else - ' GvDocumentosCliente.DataSource = Nothing - 'End If - GvDocumentosCliente.DataBind() - - UPGvDocumentosCliente.Update() - 'UpGvDocumentosFirma2.Update() - End Sub - Public Sub UploadModal_ClickDocumentacionFirmaContrato(sender As Object, e As EventArgs) - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - - Dim chkEstatus As CheckBox - CveDocumentacionElectronica = GvRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero - CveDocumentacion = GvRow.DataKey("CveDocumentacion").ToString.ToEntero - Documentacion = GvRow.DataKey("Documentacion") - AdjuntoDocumentacion = GvRow.DataKey("Adjunto").ToString - - chkEstatus = GvRow.FCCheckBox("chkEstatus") - - - - ObservacionDocumentacion = GvRow.FCTextBox("TxtObservaciones").Text.Trim.ToUpper - FechaLimite = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate - - AdjuntoDocumentacion = GvRow.DataKey("Adjunto") - - LtlTitulofirmaContrato.Text = "Subir " & Documentacion - - UpTituloFirma.Update() - - RegistraScript("$('#ModalUploadFirmaContratoDocumento').modal({ backdrop: 'static', keyboard: false});") - End Sub - Private Sub GuardarDocumentosClientes(Optional _CveDocumentacionExcluir As Integer = -1) - - Dim hasError As Boolean = True - Dim objDocumentos As New ClsEdocumentacion - - For Each dRow As GridViewRow In GvDocumentosCliente.Rows - - Dim _CveDocumentacion As Integer = dRow.DataKey("CveDocumentacion").ToString.ToEntero - Dim _Adjunto As String = dRow.DataKey("Adjunto") - 'Dim _Documentacion As String = dRow.DataKey("Documentacion") - Dim _CveDocumentacionElectronica As Integer = dRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero - Dim _txtObservaciones As TextBox = dRow.FCTextBox("TxtObservaciones") - Dim _TxtFechaLimite As TextBox = dRow.FCTextBox("TxtFechaLimite") - Dim _TxtFechaVigencia As TextBox = dRow.FCTextBox("TxtFechaVigencia") - Dim chkEstatus As CheckBox = dRow.FCCheckBox("chkEstatus") - Dim _estatus As Integer - - _estatus = If(dRow.FCCheckBox("chkEstatus").Checked, 1, 0) - - Dim _FechaVigencia As Date - Dim _FechaLimite As Date - - Dim DiasLimite As Integer = dRow.DataKey("DiasLimite").ToString.ToEntero - Dim AplicaDiasLimite As Boolean = If(dRow.DataKey("AplicaDiasLimite").ToString = "1", True, False) - Dim AplicaFechaVencimiento As Boolean = If(dRow.DataKey("AplicaFechaVencimiento").ToString = "1", True, False) - - If _TxtFechaVigencia.Text.Length = 10 Then - _FechaVigencia = _TxtFechaVigencia.Text.ToDate - Else - _FechaVigencia = Nothing - End If - - If Not AplicaDiasLimite Then - _FechaLimite = MinFecha - Else - _FechaLimite = _TxtFechaLimite.Text.ToDate - End If - - If Not AplicaFechaVencimiento Then - _FechaVigencia = MinFecha - End If - - - If Not _CveDocumentacionExcluir = _CveDocumentacion Then - Try - If _CveDocumentacionElectronica = -1 Then - - If objDocumentos.DocumentacionElectronicaAdd(_CveDocumentacion, -1, CveCliente, -1, _estatus, _txtObservaciones.Text.Trim, _Adjunto, UsuarioActual.CveUsuario, _FechaLimite, _FechaVigencia) > 0 Then - Else - hasError = True - Exit For - End If - - Else - If objDocumentos.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, -1, CveCliente, -1, _estatus, _txtObservaciones.Text.Trim, _Adjunto, UsuarioActual.CveUsuario, _FechaLimite, _FechaVigencia) Then - Else - hasError = True - Exit For - End If - End If - - - hasError = False - Catch ex As Exception - hasError = True - Exit For - End Try - End If - Next - - 'refrescar grid datos investigacion - CargaDocumentacionCliente() - End Sub - - Protected Sub chkEstatus_CheckedChanged(sender As Object, e As EventArgs) - GuardarDocumentosClientes() - End Sub - - Protected Sub TxtObservaciones_TextChanged(sender As Object, e As EventArgs) - GuardarDocumentosClientes() - End Sub - Protected Sub BtnModalFirmaContratoDocumentoUpload_Click(sender As Object, e As EventArgs) Handles BtnModalFirmaContratoDocumentoUpload.Click - - Dim FileExtension As String = "-1" - Dim Filesgral As List(Of Archivo) = TxtFileFirmaContrato.getfiles().Archivos - Dim Filename As String = "" - - - For Each fileItem As Archivo In Filesgral - Try - - FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - Dim tempArray() As String - tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) - - Dim rutaDestino As String = UsuarioActual.Empresa.Ruta & "\DocElectronica\Clientes\" & CveCliente & "\" & Documentacion & "." & FileExtension - Dim rutaAdjuntoAnterior As String = UsuarioActual.Empresa.Ruta & "DocElectronica\Clientes\" & CveCliente & "\" & AdjuntoDocumentacion - - If Not System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta & "DocElectronica\Clientes\" & CveCliente & "\") Then - System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "DocElectronica\Clientes\" & CveCliente & "\") - End If - - If File.Exists(rutaAdjuntoAnterior) And AdjuntoDocumentacion.Trim.Length > 0 Then - File.Delete(rutaAdjuntoAnterior) - End If - - If System.IO.File.Exists(rutaDestino) Then - System.IO.File.Delete(rutaDestino) - End If - - System.IO.File.Move(fileItem.FileUrl, rutaDestino) - - Dim objRH As New ClsEdocumentacion - - - If CveDocumentacionElectronica = -1 Then - If objRH.DocumentacionElectronicaAdd(CveDocumentacion, -1, CveCliente, -1, 1, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite) > 0 Then - - End If - Else - If objRH.DocumentacionElectronicaUpdate(CveDocumentacionElectronica, CveDocumentacion, -1, CveCliente, -1, 1, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite) Then - - End If - End If - - objRH.Dispose() - - GuardarDocumentosClientes(CveDocumentacion) - CargaDocumentacionCliente() - - - TxtFileFirmaContrato.Text = "" - UpModalFirmaContratoDocumento.Update() - - Catch ex As Exception - OnError("Error al cargar archivo", ex) - End Try - - Next - RegistraScript("$('#ModalUploadFirmaContratoDocumento').modal('hide')", "hidemodal7") - - End Sub - - Public Sub Update_ClickDocumentacionFirmaContrato(sender As Object, e As EventArgs) - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim activo As Boolean = False - - Dim _CveDocumentacionElectronica As Integer = GvRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero - Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString.ToEntero - Dim _Adjunto As String = GvRow.DataKey("Adjunto").ToString - Dim _fechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate - - Dim obserbaciones As String = DirectCast(GvRow.FindControl("TxtObservaciones"), TextBox).Text - 'Dim DDLEstatus As DropDownList = DirectCast(GvRow.FindControl("DDLEstatus"), DropDownList) - Dim chkCompleto As CheckBox = DirectCast(GvRow.FindControl("chkEstatus"), CheckBox) - - If chkCompleto.Checked Then - Estatus = 1 - Else - Estatus = 0 - End If - - Dim ObjEdoc As New ClsEdocumentacion - - If Not _CveDocumentacionElectronica = -1 Then - If ObjEdoc.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, -1, CveCliente, -1, 1, obserbaciones, _Adjunto, UsuarioActual.CveUsuario, _fechaLimite) Then - Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) - End If - Else - If ObjEdoc.DocumentacionElectronicaAdd(_CveDocumentacion, -1, CveCliente, -1, 1, obserbaciones, _Adjunto, UsuarioActual.CveUsuario, _fechaLimite) > 0 Then - Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) - End If - End If - - CargaDocumentacionCliente() - ObjEdoc.Dispose() - - End Sub - - - Public Sub Update_ClickDocumentacionRemove(sender As Object, e As EventArgs) - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim activo As Boolean = False - - Dim _CveDocumentacionElectronica As Integer = GvRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero - Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString.ToEntero - Dim _Adjunto As String = GvRow.DataKey("Adjunto").ToString - Dim _fechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate - Dim obserbaciones As String = DirectCast(GvRow.FindControl("TxtObservaciones"), TextBox).Text - 'Dim DDLEstatus As DropDownList = DirectCast(GvRow.FindControl("DDLEstatus"), DropDownList) - Dim chkCompleto As CheckBox = DirectCast(GvRow.FindControl("chkEstatus"), CheckBox) - - Dim UrlArchivo = UsuarioActual.Empresa.Ruta & "\DocElectronica\Clientes\" & CveCliente & "/" & _Adjunto - - If File.Exists(UrlArchivo) Then - Try - File.Delete(UrlArchivo) - Catch ex As Exception - End Try - - End If - - Dim ObjEdoc As New ClsEdocumentacion - - If Not _CveDocumentacionElectronica = -1 Then - - If ObjEdoc.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, -1, CveCliente, -1, 0, "", "", UsuarioActual.CveUsuario, _fechaLimite) Then - Alert("Documento Eliminado Correctamente.", TipoMensaje.MsgInformacion) - End If - - End If - - CargaDocumentacionCliente() - ObjEdoc.Dispose() - - End Sub + Dim ObjMovtos As New ClsMovimientos() + If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, -1) Then + DtCxC = If(DdlTipoCuentasCxC.SelectedValue = "-1", If(DdlTipoDocto.SelectedValue = "-1", ObjMovtos.DtResultados, ObjMovtos.DtResultados.FiltraParametros($"TipoDocto = '{DdlTipoDocto.SelectedValue}'")), + If(DdlTipoDocto.SelectedValue = "-1", ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act' ", "Moneda, OrdenVencimiento ,FechaVencimiento"), ObjMovtos.DtResultados.FiltraParametros($"Tipo = 'Act' AND TipoDocto = '{DdlTipoDocto.SelectedValue}'", "Moneda, OrdenVencimiento ,FechaVencimiento"))) + + Dim Pesos As Double = DtCxC.SUM("Saldo", "CveMoneda = 1 and CveVenta > 0") + Dim Dolares As Double = DtCxC.SUM("Saldo", "CveMoneda = 2 and CveVenta > 0") + If Pesos > 0 Then StrSaldo = $" $ {Pesos.FormatoNumero} pesos" + If Dolares > 0 Then StrSaldo = $"{StrSaldo} ${Dolares.FormatoNumero} dólares" + ObjMovtos.Dispose() + Else + DtCxC = Nothing + ObjMovtos.Dispose() + Exit Sub + End If + + If StrSaldo.Length > 0 Then + Dim Mensaje = "" + Select Case UsuarioActual.CveEmpresa + Case 4 + Mensaje = $"Cliente de VSH Seguridad su saldo pendiente es de $ {StrSaldo} fecha limite 25/{Now.ToString("MM/yyyy")} llamar al 6622106400 #REFERENCIA {CodigoCliente} " + End Select + + Dim ObjSMS As New ClsTecnoMovil + Dim ObjEventos As New ClsOIEventos + If ObjSMS.EnviarMensajeWS(Telefono, Mensaje) Then + If ObjEventos.AddEventoBitacora($"Estado de cuenta enviado al cliente via SMS. Telefono: {Telefono} Mensaje: {Mensaje}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente:=CveCliente) Then + Alert("El mensaje se envió correctamente", TipoMensaje.MsgInformacion) + Else + Alert("El mensaje se envió correctamente. Pero no se pudo guardar historial", TipoMensaje.MsgAdvertencia) + End If + End If + ObjEventos.Dispose() + CargaEventoBitacora() + UPEventoBitacora.Update() + Else + Alert("No hay saldo pendiente del cliente. Por lo cual no se envió el mensaje.", TipoMensaje.MsgInformacion) + End If + + + End Sub + +#End Region + +#Region "IMPRIMIR GVHistorial" + + + Protected Sub BtnExcelHistorial_Click(sender As Object, e As EventArgs) + Dim retorno As Byte() = Nothing + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + + + 'OBTENEMOS LOS DATOS + 'Dim DTHistorial As DataTable + 'If ObjClientes.GetHistorialVentas(UsuarioActual.CveCliente, TopRegistros) Then + ' DTHistorial = ObjClientes.DtResultados + 'Else + ' DTHistorial = Nothing + 'End If + + If DTHistorialVentas.Rows.Count > 0 Then + Dim dr As DataRow = DTHistorialVentas.Rows(0) + + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("DireccionEmpresa", UsuarioActual.Empresa.Direccion)) + params.Add(New ReportParameter("TelefonoEmpresa", UsuarioActual.Empresa.Telefono)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + + ImprimirPDF("Empresas/Grales/Formatos/ClienteHistorial.rdlc", DTHistorialVentas, params, "Reporte de Historial", "Excel") + Else + Alert("Ocurrió un error.", TipoMensaje.MsgAdvertencia) + End If + + End Sub + + + Protected Sub BtnPDFHistorial_Click(sender As Object, e As EventArgs) + Dim retorno As Byte() = ImprimirReporteHistorial() + If retorno IsNot Nothing Then + ImprimirbytesPDF(retorno, "Reporte de Historial", Descarga:=True) + End If + End Sub + + Protected Function ImprimirReporteHistorial() As Byte() + Dim retorno As Byte() = Nothing + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + Dim ObjClientes As New ClsClientes() + + 'OBTENEMOS LOS DATOS + 'Dim DTHistorial As DataTable + 'If ObjClientes.GetHistorialVentas(UsuarioActual.CveCliente, TopRegistros) Then + ' DTHistorial = ObjClientes.DtResultados + 'Else + ' DTHistorial = Nothing + 'End If + + If DTHistorialVentas.Rows.Count > 0 Then + Dim dr As DataRow = DTHistorialVentas.Rows(0) + + Dim params As New List(Of ReportParameter) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("DireccionEmpresa", UsuarioActual.Empresa.Direccion)) + params.Add(New ReportParameter("TelefonoEmpresa", UsuarioActual.Empresa.Telefono)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario)) + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + + retorno = StreamPDF("Empresas/Grales/Formatos/ClienteHistorial.rdlc", DTHistorialVentas, params, "Reporte de Historial") + Else + Alert("Ocurrió un error.", TipoMensaje.MsgAdvertencia) + End If + ObjClientes.Dispose() + + Return retorno + End Function + + +#End Region + +#Region "C O B R A N Z A" + Public Sub Visitas_Click(sender As Object, e As EventArgs) + RegistraScript(String.Format("$('#{0}').modal();", "DivVisitas")) + End Sub + +#End Region + +#Region "Usuarios" + Protected Sub GvUsuarios_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvUsuarios.RowDeleting + Dim CveUsuario As Integer = GvUsuarios.Rows(e.RowIndex).DataKey("CveUsuario").ToEntero + Dim ObjUsuarios As New ClsSisUsuarios + If ObjUsuarios.DeleteClienteUsuario(CveUsuario, CveCliente) Then + Alert("El Usuario se eliminó correctamente", TipoMensaje.MsgInformacion) + End If + ObjUsuarios.Dispose() + CargaGlobal() + CargaUsuarios() + UpDispositivos.Update() + End Sub + + Public Sub CargaGlobal() + Dim ObjUsuarios As New ClsSisUsuarios + If ObjUsuarios.GetUsuariosEmpresas(-1) Then + Application("GlobalDTUsuarios") = ObjUsuarios.DtResultados + End If + ObjUsuarios.Dispose() + End Sub + + Protected Sub GvUsuarios_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvUsuarios.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + e.Row.FCLinkButton("imgE").Attributes.Add("onclick", $"javascript:AbrirVentana('/Sistemas/PopUpAddUsuario.aspx?CveUsuario={e.Row.DBCampo("CveUsuario").ToString}&CveCliente={CveCliente}', 801, 701);") + If UsuarioActual.Empresa.CvePlataforma = 1 Then + e.Row.Cells(4).HorizontalAlign = HorizontalAlign.Center + e.Row.Cells(5).Visible = False + End If + End If + If e.Row.RowType = DataControlRowType.Header Then + If UsuarioActual.Empresa.CvePlataforma = 1 Then + e.Row.Cells(5).Visible = False + End If + End If + End Sub +#End Region + + +#Region "C U E N T A S - B A N C A R I A S" + + Private Sub CargaCuentasBancarias() + Dim ObjCuentasBancos As New ClsGenerales + ViewState("OrdenCuentasBancos") = "" + DTCuentasBancos = New DataTable + TempDTCuentasBancos = New DataTable + + If ObjCuentasBancos.GetCuentasDepositos(CveCliente:=CveCliente) Then + DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados) + Else + Alert("No se pudieron cargar las cuentas bancarias. Por favor intente nuevamente.", TipoMensaje.MsgAdvertencia) + End If + + If CveCliente < 0 Then + TempDTCuentasBancos = DTCuentasBancos.Clone + + End If + + ObjCuentasBancos.Dispose() + CargaPSGridCuentasBancos() + + RecargaGlobalCuentasBancarias() + CargaMonedas() + End Sub + Protected Sub LbAgregarCuentaBanco_Click(sender As Object, e As EventArgs) + Dim EsBancomer = False + + If TxtNombreBanco.Text.ToUpper.Contains("BBVA") Or TxtNombreBanco.Text.ToUpper.Contains("BANCOMER") Or (TxtCLABE.Text.Length = 18 AndAlso TxtCLABE.Text.Substring(0, 3) = "012") Then + EsBancomer = True + End If + + + If TxtNumeroCuenta2.Text.Trim.Length = 0 AndAlso TxtCLABE.Text.Trim.Length = 0 AndAlso TxtSWIFT.Text.Trim.Length = 0 AndAlso TxtConvenioCIE.Text.Trim.Length = 0 Then + Alert("Debe especificar al menos un numero de cuenta.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + 'SI CLABE TIENE ALGO DEBE TENER UNA LOGITUD EXACTA DE 18 + If TxtCLABE.Text.Trim.Length <> 0 AndAlso TxtCLABE.Text.Trim.Length <> 18 Then + Alert("La CLABE debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + 'RESTRICCIONES - GLUYAS + If UsuarioActual.CveEmpresa = 66 Then + + 'CLABE SIEMPRE OBLIGATORIA SI NO ES BANCOMER + If TxtCLABE.Text.Trim.Length <> 18 And TxtCLABE.Text.Trim.Length = 0 And Not EsBancomer And TxtSWIFT.Text.Trim.Length = 0 Then + Alert("La CLABE es obligatoria y debe tener una longitud de 18 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + 'SI CUENTA TIENE ALGO Y BANCO BANCOMER DEBE TENER UNA LOGITUD EXACTA DE 10 + If TxtNumeroCuenta2.Text.Trim.Length <> 0 AndAlso TxtNumeroCuenta2.Text.Trim.Length <> 10 AndAlso EsBancomer Then + Alert("El número de cuenta debe tener una longitud de 10 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + 'SI CIE TIENE ALGO REFERENCIA OBLIGATORIA + If TxtConvenioCIE2.Text.Trim.Length <> 0 And TxtReferencia2.Text.Trim.Length < 3 Then + Alert("Cuando se ingresa Convenio CIE se debe especificar una referencia. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + 'CUANDO SEA "BBVA" O "BANCOMER" DEBE TENER "CIE" O "CUENTA" + If EsBancomer AndAlso Not (TxtNumeroCuenta2.Text.Trim.Length = 10 Or TxtConvenioCIE2.Text.Trim.Length <> 0) Then + Alert("Para cuentas BBVA BANCOMER es obligatorio el Número de Cuenta o CIE.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + Else + + 'SI CIE TIENE ALGO DEBE TENER UNA LOGITUD MINIMA DE 5 + If TxtConvenioCIE2.Text.Trim.Length <> 0 And TxtConvenioCIE2.Text.Trim.Length < 5 Then + Alert("El Convenio CIE debe tener una longitud de al menos 5 dígitos. Por favor rectifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Exit Sub + End If + + End If + Dim Estatus As Boolean + If ChkEstatus2.Checked = True Then Estatus = True Else Estatus = False + + AgregarCuentaBanco(TxtNombreBanco.Text.Trim, TxtNumeroSucursal.Text.Trim, TxtCLABE.Text.Trim, TxtSWIFT.Text.Trim, TxtPlaza.Text.Trim, TxtNumeroCuenta2.Text.Trim, TxtConvenioCIE2.Text.Trim, TxtReferencia2.Text.Trim, "", DdlMoneda.SelectedValue.ToEntero, DdlMoneda.SelectedItem.Text, Estatus) + End Sub + Private Sub AgregarCuentaBanco(NombreBanco As String, NumeroSucursal As String, CLABE As String, SWIFT As String, Plaza As String, NumeroCuenta As String, ConvenioCIE As String, Referencia As String, RefCrediProveedor As String, CveMoneda As Integer, Moneda As String, Estatus As Boolean) + Dim ObjCuentasBancos As New ClsGenerales + If Modalidad = "A" Then + + If CveCliente > 0 Then + + If ObjCuentasBancos.AddCuentasDepositos(NombreBanco, Plaza, NumeroSucursal, NumeroCuenta, CLABE, ConvenioCIE, SWIFT, Referencia, RefCrediProveedor, UsuarioActual.CveUsuario, CveMoneda, CveCliente:=CveCliente) Then + DTCuentasBancos.Clear() + DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados.FiltraParametros(String.Format("CveCliente = {0}", CveCliente))) + Alert("Cuenta Bancaria agregada con éxito.", TipoMensaje.MsgInformacion) + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddCuentasBancarias")) + Else + Alert("Error al registrar la cuenta bancaria. Por favor intente nuevamente", TipoMensaje.MsgError) + End If + + Else + Dim Row As DataRow + Row = TempDTCuentasBancos.NewRow + + Row("BancoNombre") = NombreBanco + Row("Sucursal") = NumeroSucursal + Row("CLABE") = CLABE + Row("SWIFT") = SWIFT + Row("Plaza") = Plaza + Row("Cuenta") = NumeroCuenta + Row("CIE") = ConvenioCIE + Row("Referencia") = Referencia + Row("RefCrediProveedor") = RefCrediProveedor + Row("CveMoneda") = CveMoneda + Row("Moneda") = Moneda + Row("EstatusPagoElectronico") = 0 + Row("Estatus") = "True" + TempDTCuentasBancos.Rows.Add(Row) + Alert("Cuenta Bancaria agregada con éxito.", TipoMensaje.MsgInformacion) + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddCuentasBancarias")) + + End If + + Else + + + If CveCliente > 0 Then + + If ObjCuentasBancos.UpdateCuentasDepositos(GvBancosCuentas.DataKeys(CveCuentaBancaria)("CveCuentaDeposito").ToString.ToEntero, NombreBanco, Plaza, NumeroSucursal, NumeroCuenta, CLABE, ConvenioCIE, SWIFT, Referencia, "", False, Estatus, CveMoneda) Then + DTCuentasBancos.Clear() + DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados.FiltraParametros(String.Format("CveCliente = {0}", CveCliente))) + Alert("Cuenta actualizada con éxito.", TipoMensaje.MsgInformacion) + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddCuentasBancarias")) + Else + Alert("Error al actualizar la cuenta bancaria. Por favor intente nuevamente.", TipoMensaje.MsgError) + End If + + Else + + Dim index = CveCuentaBancaria + Dim Row As DataRow = TempDTCuentasBancos.Rows(index) + Row("BancoNombre") = NombreBanco + Row("Sucursal") = NumeroSucursal + Row("CLABE") = CLABE + Row("SWIFT") = SWIFT + Row("Plaza") = Plaza + Row("Cuenta") = NumeroCuenta + Row("CIE") = ConvenioCIE + Row("Referencia") = Referencia + Row("CveMoneda") = CveMoneda + Row("Moneda") = Moneda + Row("Estatus") = Estatus + TempDTCuentasBancos.AcceptChanges() + Alert("Cuenta actualizada con éxito.", TipoMensaje.MsgInformacion) + RegistraScript(String.Format("$('#{0}').modal('hide');", "DivAddCuentasBancarias")) + End If + + End If + ObjCuentasBancos.Dispose() + LimpiaCuentasBancarias() + CargaPSGridCuentasBancos() + RecargaGlobalCuentasBancarias() + End Sub + Private Sub LimpiaCuentasBancarias() + TxtNombreBanco.Text = "" + TxtNumeroSucursal.Text = "" + TxtCLABE.Text = "" + TxtSWIFT.Text = "" + TxtPlaza.Text = "" + TxtNumeroCuenta2.Text = "" + TxtConvenioCIE2.Text = "" + TxtReferencia2.Text = "" + End Sub + +#Region "GRIDVIEW - CUENTAS BANCARIAS" + Protected Sub GvBancosCuentas_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvBancosCuentas.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + + If CveCliente < 0 Then + For index = 1 To TempDTCuentasBancos.Rows.Count + TempDTCuentasBancos.Rows(index - 1)("CveCuentaDeposito") = index + Next + TempDTCuentasBancos.AcceptChanges() + End If + + + If e.Row.DBCampo("Estatus") = "True" Then + e.Row.FCLabel("LlbEstatusTexto").Text = "Activo" + Else + e.Row.FCLabel("LlbEstatusTexto").Text = "Inactivo" + End If + + End If + End Sub + + + Public Sub Delete_Click(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim ObjCuentasBancos As New ClsGenerales + + If CveCliente > 0 Then + If ObjCuentasBancos.RemoveCuentasDepositos(GvRow.DataKey("CveCuentaDeposito").ToEntero) Then + DTCuentasBancos.Clear() + DTCuentasBancos.Merge(ObjCuentasBancos.DtResultados.FiltraParametros(String.Format("CveCliente = {0}", CveCliente))) + + Alert("Cuenta Bancaria borrada con éxito.", TipoMensaje.MsgInformacion) + Else + Alert("No se pudo borrar la Cuenta Bancaria. Por favor intente nuevamente.", TipoMensaje.MsgError) + End If + Else + Dim index = GvRow.RowIndex + TempDTCuentasBancos.Rows.RemoveAt(index) + Alert("Cuenta Bancaria borrada con éxito.", TipoMensaje.MsgInformacion) + End If + + 'If ObjCuentasBancos.GetCuentasDepositos Then + ' GlobalDTProveedoresCuentas(CveCliente, True) = ObjCuentasBancos.DtResultados + 'End If + + CargaPSGridCuentasBancos() + ObjCuentasBancos.Dispose() + RecargaGlobalCuentasBancarias() + End Sub + Private Sub RecargaGlobalCuentasBancarias(Optional ByVal CveCuenta As Integer = -1) + If CveCliente > 0 Then + Dim ObjCuentasBancos As New ClsGenerales + + If ObjCuentasBancos.GetCuentasDepositos() Then + GlobalDTProveedoresCuentas(-1, True) = ObjCuentasBancos.DtResultados + End If + ObjCuentasBancos.Dispose() + End If + End Sub + +#End Region + + Private Sub CargaPSGridCuentasBancos() + If CveCliente > 0 Then + GvBancosCuentas.DataSource = DTCuentasBancos + Else + GvBancosCuentas.DataSource = TempDTCuentasBancos + End If + + GvBancosCuentas.DataBind() + UpCuentasBancos.Update() + End Sub + + + Private Sub CargaMonedas() + DdlMoneda.DataSource = GlobalDTMonedas + DdlMoneda.DataBind() + DdlMoneda.Items.Insert(0, New ListItem("Seleccione", "-1")) + End Sub + + + + + Private Sub LnkCuentasBancarias_Click(sender As Object, e As EventArgs) Handles LnkCuentasBancarias.Click + Modalidad = "A" + TxtNombreBanco.Text = "" + LbAgregarCuentaBanco.Text = "Agregar" + TxtNumeroSucursal.Text = "" + TxtNumeroCuenta2.Text = "" + TxtCLABE.Text = "" + TxtSWIFT.Text = "" + TxtPlaza.Text = "" + TxtConvenioCIE2.Text = "" + TxtReferencia2.Text = "" + DdlMoneda.SelectedIndex = 0 + ChkEstatus2.Checked = True + divestatus.Visible = False + UpAddBancos.Update() + RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddCuentasBancarias")) + End Sub + + Public Sub Edit_Click2(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + TxtNombreBanco.Text = GvRow.DataKey("BancoNombre") + Modalidad = "U" + LbAgregarCuentaBanco.Text = "Actualizar" + CveCuentaBancaria = GvRow.RowIndex + TxtNumeroSucursal.Text = GvRow.DataKey("Sucursal") + TxtNumeroCuenta2.Text = GvRow.DataKey("Cuenta") + TxtCLABE.Text = GvRow.DataKey("CLABE") + TxtSWIFT.Text = GvRow.DataKey("SWIFT") + TxtPlaza.Text = GvRow.DataKey("Plaza") + TxtConvenioCIE2.Text = GvRow.DataKey("CIE") + TxtReferencia2.Text = GvRow.DataKey("Referencia") + DdlMoneda.SelectedValueExist(GvRow.DataKey("CveMoneda")) + ChkEstatus2.Checked = CBool(GvRow.DataKey("Estatus")) + divestatus.Visible = True + UpAddBancos.Update() + RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddCuentasBancarias")) + End Sub +#End Region + +#Region "C L I E N T E S P A G O S R E A L I Z A D O S I M P R I M I R P D F/Excel" + Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosExcel.Click + GenerarPDF("Excel") + End Sub + Private Sub LinkPDF_Click(sender As Object, e As EventArgs) Handles LnkPagosClientesBancosPDF.Click + GenerarPDF() + End Sub + Private Sub GenerarPDF(Optional Formato As String = "PDF") + Dim params As New List(Of ReportParameter) + + Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)) + Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa) + params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa)) + params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre)) + params.Add(New ReportParameter("FechaImpresion", Now.ToDateTime.ToShortDateString)) + + If Imagen.Exists Then + params.Add(New ReportParameter("LogoPath", logouri)) + Else + params.Add(New ReportParameter("LogoPath", "")) + End If + ImprimirPDF("Empresas\Grales\Formatos\RepClientesPagosBancos.rdlc", DTCobrosRealizados, params, "RepClientesPagosBancos_" & Now.ToString("yyyyMMddhhmmss"), Formato:=Formato) + + + End Sub +#End Region + +#Region "VENTAS" + + Public Function imprimirFacturaVenta(CveVenta As Integer) As Byte() + Dim ObjVentas As New ClsVentas + Dim Vta As Modelos.Factura = Nothing + + Dim TmpDTImpuestos = New DataTable + TmpDTImpuestos.Columns.Add("ImpuestoLocal", GetType(String)) + TmpDTImpuestos.Columns.Add("Importe", GetType(Double)) + TmpDTImpuestos.Columns.Add("Orden", GetType(Integer)) + + Dim TmpDTImpuestosIVAIEPS = New DataTable + TmpDTImpuestosIVAIEPS.Columns.Add("Impuesto", GetType(String)) + TmpDTImpuestosIVAIEPS.Columns.Add("tasa", GetType(String)) + TmpDTImpuestosIVAIEPS.Columns.Add("Importe", GetType(Double)) + TmpDTImpuestosIVAIEPS.Columns.Add("Orden", GetType(Integer)) + + If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then + Dim dtVentas As DataTable = ObjVentas.DtResultados + + ' se rellenan los campos de la factura + Vta = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.Factura) + + Vta.MonedaAbreviatura = dtVentas(0)("Abreviatura").ToString + 'se rellena la sucursal + 'Vta.Subproyecto = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.SucursalModel) + Vta.SubProyecto = ObjVentas.DtResultados.Rows(0).DataRowToObject(Of Modelos.SubProyectoModel) + Vta.Cliente = New Modelos.ClienteModel + Vta.Cliente.Nombre = dtVentas(0)("ClienteNombre").ToString + Vta.Cliente.Telefono = dtVentas(0)("Telefono").ToString + Vta.Cliente.Direccion = dtVentas(0)("ClienteDireccion").ToString + Vta.Cliente.CP = dtVentas(0)("CPCliente").ToString + Vta.Cliente.Ciudad = dtVentas(0)("ClienteCiudad").ToString + Vta.Cliente.Localidad = dtVentas(0)("ClienteLocalidad").ToString + Vta.Cliente.Estado = dtVentas(0)("ClienteEstado").ToString + Vta.Cliente.Pais = dtVentas(0)("ClientePais").ToString + Vta.Cliente.RFC = dtVentas(0)("ClienteRFC").ToString + Vta.Cliente.Colonia = dtVentas(0)("ColoniaCliente").ToString + Vta.AtencionA = dtVentas(0)("AtencionA").ToString + Vta.Cliente.NoExt = dtVentas(0)("ClienteNoExt").ToString + Vta.Cliente.NoInt = dtVentas(0)("ClienteNoInt").ToString + Vta.Cliente.Codigo = dtVentas(0)("ClienteCodigo").ToString + Vta.Cliente.Mail = dtVentas(0)("Mail").ToString + Vta.RefDocto = dtVentas(0)("Ref").ToString + Vta.CveVenta = dtVentas(0)("CveVenta").ToString.ToEntero + Vta.Version = dtVentas(0)("Version").ToString + + Vta.NumeroContrato = dtVentas(0)("NumeroContrato").ToString + Vta.DescripcionContrato = dtVentas(0)("DescripcionContrato").ToString + Vta.NumeroDescripcionContrato = If($"{dtVentas(0)("NumeroContrato").ToString} - {dtVentas(0)("NumeroLicitacion").ToString}" = " - ", "", $"{dtVentas(0)("NumeroContrato").ToString} {If(dtVentas(0)("NumeroLicitacion").ToString = "", "", $" - Licitación: {dtVentas(0)("NumeroLicitacion").ToString}")}") + + Vta.PedidoContrato = If(dtVentas(0)("PedidoContrato").ToString = "", Vta.NumeroDescripcionContrato, $"{dtVentas(0)("PedidoContrato").ToString} {If(Vta.NumeroDescripcionContrato = "", "", $" / {Vta.NumeroDescripcionContrato}") }") + 'Vta.PedidoContrato = dtVentas(0)("PedidoContrato").ToString + + Vta.ClienteSucursal = New Modelos.SucursalModel + Vta.ClienteSucursal.Direccion = dtVentas(0)("SucClienteDireccion").ToString + Vta.ClienteSucursal.NoExt = dtVentas(0)("SucClienteNoExt").ToString + Vta.ClienteSucursal.NoInt = dtVentas(0)("SucClienteNoInt").ToString + Vta.ClienteSucursal.Colonia = dtVentas(0)("SucClienteColonia").ToString + Vta.ClienteSucursal.CP = dtVentas(0)("SucClienteCP").ToString + Vta.ClienteSucursal.Municipio = dtVentas(0)("SucClienteCiudad").ToString + Vta.ClienteSucursal.Estado = dtVentas(0)("SucClienteEstado").ToString + Vta.ClienteSucursal.Pais = dtVentas(0)("SucClientePais").ToString + Vta.ClienteSucursal.Localidad = dtVentas(0)("SucClienteLocalidad").ToString + Vta.ClienteSucursal.CorreoSucursal = dtVentas(0)("SucClienteCorreo").ToString + Vta.ClienteSucursal.TelefonoSucursal = dtVentas(0)("SucClienteTelefono").ToString + Vta.ClienteSucursal.Sucursal = dtVentas(0)("SucursalCliente").ToString + Vta.ClienteSucursal.ImprimeNombreSucursal = dtVentas(0)("ImprimeNombreSucursal").ToString + + Vta.EnviarA = New Modelos.EnviarAModel + Vta.EnviarA.CveDireccionEnvio = dtVentas(0)("CveDireccionEnvio").ToString.ToEntero + Vta.EnviarA.EnvioDireccion = dtVentas(0)("EnvioDireccion").ToString + Vta.EnviarA.EnvioColonia = dtVentas(0)("EnvioColonia").ToString + Vta.EnviarA.EnvioCiudad = dtVentas(0)("EnvioCiudad").ToString + Vta.EnviarA.EnvioEstado = dtVentas(0)("EnvioEstado").ToString + Vta.EnviarA.EnvioCP = dtVentas(0)("EnvioCP").ToString + + Vta.EnviarA.EnvioNoExt = dtVentas(0)("EnvioNoExt").ToString + Vta.EnviarA.EnvioNoInt = dtVentas(0)("EnvioNoInt").ToString + Vta.EnviarA.EnvioContacto = dtVentas(0)("EnvioContacto").ToString + 'Vta.EnviarA.EnvioPedidoContrato = dtVentas(0)("EnvioPedidoContrato").ToString + + 'INE COMPLEMENTO + If dtVentas(0)("TipoComite").ToString <> "" Then + Dim INE As New Modelos.ComplementoINE + INE.INETipoComite = dtVentas(0)("TipoComite").ToString + INE.INETipoProceso = dtVentas(0)("TipoProceso").ToString + INE.INEIdContabilidad = dtVentas(0)("IdContabilidad").ToString.ToEntero + Vta.ComplementoINE = INE + End If + + + Dim DR As DataRow = TmpDTImpuestos.NewRow() + If dtVentas(0)("SubTotal").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Subtotal" : DR("Importe") = dtVentas(0)("SubTotal").ToString.ToDouble : DR("Orden") = 10 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + If dtVentas(0)("Descuento").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Descuentos" : DR("Importe") = dtVentas(0)("Descuento").ToString.ToDouble : DR("Orden") = 20 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + If dtVentas(0)("Amortizacion").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Amort.Ant" : DR("Importe") = dtVentas(0)("Amortizacion").ToString.ToDouble : DR("Orden") = 30 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + If dtVentas(0)("SubTotal").ToString.ToDouble <> (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) Then DR("ImpuestoLocal") = "SubTotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) : DR("Orden") = 40 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + If dtVentas(0)("IVA").ToString.ToDouble >= 0 Then DR("ImpuestoLocal") = "IVA" : DR("Importe") = dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 50 : TmpDTImpuestos.Rows.Add(DR) + + 'solo para eclipse, que muesre un subtotal debajo de IVA + If UsuarioActual.CveEmpresa = 15 Then DR = TmpDTImpuestos.NewRow() : DR("ImpuestoLocal") = "Subtotal2" : DR("Importe") = (dtVentas(0)("SubTotal").ToString.ToDouble - dtVentas(0)("Descuento").ToString.ToDouble - dtVentas(0)("Amortizacion").ToString.ToDouble) + dtVentas(0)("IVA").ToString.ToDouble : DR("Orden") = 51 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + If dtVentas(0)("RetIVA").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.IVA" : DR("Importe") = dtVentas(0)("RetIVA").ToString.ToDouble : DR("Orden") = 60 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + If dtVentas(0)("RetISR").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Ret.ISR" : DR("Importe") = dtVentas(0)("RetISR").ToString.ToDouble : DR("Orden") = 70 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + + If dtVentas(0)("IEPS").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "IEPS" : DR("Importe") = dtVentas(0)("IEPS").ToString.ToDouble : DR("Orden") = 80 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + + If dtVentas(0)("Total").ToString.ToDouble <> 0 Then DR("ImpuestoLocal") = "Total" : DR("Importe") = dtVentas(0)("Total").ToString.ToDouble : DR("Orden") = 100 : TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + + If ObjVentas.GetVentaDetalle(CveVenta) Then 'Obtenemos el Detalle de la Oorden de Compra + Vta.DtDetalle = ObjVentas.DtResultados + End If + + If ObjVentas.GetVentaImpuestosLocales(CveVenta) Then + + Dim dtImpuesto As DataTable = ObjVentas.DtResultados + If dtImpuesto.Rows.Count > 0 Then + For Each Row As DataRow In dtImpuesto.Rows + Dim Orden = 80 + If Row("Importe").ToString.ToDouble <> 0 Then + DR("ImpuestoLocal") = Row("ImpuestoLocal").ToString + DR("Importe") = Row("Importe").ToString.ToDouble + DR("Orden") = Orden + TmpDTImpuestos.Rows.Add(DR) + DR = TmpDTImpuestos.NewRow() + Orden = Orden + 1 + End If + Next + End If + Vta.DtDeduccion = TmpDTImpuestos.FiltraParametros("", Orderby:="Orden ASC") + + End If + + 'TmpDT DESGLOSE DE IMPUESTOS 3.3 + For Each dr1 As DataRow In Vta.DtDetalle.Rows + Dim DrIVA As DataRow = Nothing + Dim DrIEPS As DataRow = Nothing + + Try + DrIVA = TmpDTImpuestosIVAIEPS.Select("Impuesto = 'IVA'")(0) + Catch ex As Exception + DrIVA = Nothing + End Try + + If DrIVA IsNot Nothing Then + DrIVA("Importe") = DrIVA("Importe").ToString.ToDouble + dr1("ImporteIVA").ToString.ToDouble + TmpDTImpuestosIVAIEPS.AcceptChanges() + Else + Dim DR2 As DataRow = TmpDTImpuestosIVAIEPS.NewRow() + If dr1("PorcentajeIVA").ToString.ToDouble >= 0 Then + DR2("Impuesto") = "IVA" : DR2("tasa") = "16 %" : DR2("Importe") = dr1("ImporteIVA").ToString.ToDouble : DR2("Orden") = "1" + TmpDTImpuestosIVAIEPS.Rows.Add(DR2) + TmpDTImpuestosIVAIEPS.AcceptChanges() + End If + End If + + Try + DrIEPS = TmpDTImpuestosIVAIEPS.Select($"Impuesto = 'IEPS' AND tasa = '{dr1("PorcentajeIEPS").ToString.ToDouble * 100} %'")(0) + Catch ex As Exception + DrIEPS = Nothing + End Try + + If DrIEPS IsNot Nothing Then + DrIEPS("Importe") = DrIEPS("Importe").ToString.ToDouble + dr1("ImporteIEPS").ToString.ToDouble + TmpDTImpuestosIVAIEPS.AcceptChanges() + Else + Dim DR2 As DataRow = TmpDTImpuestosIVAIEPS.NewRow() + If dr1("PorcentajeIEPS").ToString.ToDouble > 0 Then + DR2("Impuesto") = "IEPS" : DR2("tasa") = String.Format("{0} {1}", dr1("PorcentajeIEPS").ToString.ToDouble * 100, "%") : DR2("Importe") = dr1("ImporteIEPS").ToString.ToDouble : DR2("Orden") = If(dr1("PorcentajeIEPS").ToString = "0.03", "2", If(dr1("PorcentajeIEPS").ToString = "0.06", "3", If(dr1("PorcentajeIEPS").ToString = "0.07", "4", If(dr1("PorcentajeIEPS").ToString = "0.09", "5", "")))) + TmpDTImpuestosIVAIEPS.Rows.Add(DR2) + TmpDTImpuestosIVAIEPS.AcceptChanges() + End If + End If + + Next + Vta.DtDesgloseImpuestos = TmpDTImpuestosIVAIEPS.FiltraParametros("", Orderby:="Orden ASC") + + If ObjVentas.GetVentasFirmas(CveVenta) Then + Vta.DtFirmas = ObjVentas.DtResultados + End If + + If UsuarioActual.CveEmpresa.Contiene(119) Then + If dtVentas(0)("TipoDocto").ToString.Contiene("Ing", "Ant", "Rem") Then + 'carga as notas de credito vinculadas + If ObjVentas.GetVentasAntNC(CveVenta, -1) Then + Vta.DtDocumentosRelacionados = ObjVentas.DtResultados + + End If + End If + + If dtVentas(0)("TipoDocto").ToString.Contiene("Egs", "Dev", "Ant") Then + If ObjVentas.GetVentasAntNC(-1, CveVenta) Then + Vta.DtDocumentosRelacionados = ObjVentas.DtResultados + End If + End If + End If + + + 'CFDI RELACIONADO + If dtVentas(0)("CveTipoRelacion").ToString.ToEntero > 0 Then + Vta.Timbre.Comprobante.TipoComprobante = If(Vta.TipoDocto.Contiene("Ing", "Ant"), "I", If(Vta.TipoDocto.Contiene("Egs", "Dev"), "E", "")) + If Vta.Timbre.Comprobante.TipoComprobante = "E" Then + If Vta.TipoDocto.Contiene("Egs") Then + Vta.Timbre.CFDIRelacionados.TipoRelacion = "01" + Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso" + End If + If Vta.TipoDocto.Contiene("Dev") Then + Vta.Timbre.CFDIRelacionados.TipoRelacion = "03" + Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso" + End If + Vta.Timbre.CFDIRelacionados.UUID.Add(dtVentas(0)("FolioFiscalPadre").ToString) + End If + ' cuando es refacturacoin es cfdirelacionado, con relacion 04 + If Vta.Timbre.Comprobante.TipoComprobante = "I" AndAlso (dtVentas(0)("Total").ToString.ToDouble = dtVentas(0)("TotalPadre").ToString.ToDouble) Then + Vta.Timbre.CFDIRelacionados.TipoRelacion = "04" + Vta.Timbre.CFDIRelacionados.UUID.Add(dtVentas(0)("FolioFiscalPadre").ToString) + Vta.Timbre.CFDIRelacionados.TipoRelacionTexto = "Refacturación de Ingreso" + End If + End If + + End If + ObjVentas.Dispose() + + Return PdfFactura(Vta) + End Function + +#End Region + +#Region "COMERCIO EXTERIOR" + Public Sub CargaCombosComercioExterior() + + DdlTipoOperacion.Items.Clear() + DdlTipoOperacion.DataSource = GlobalDTTipoOperacion() + DdlTipoOperacion.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlTipoOperacion.DataBind() + + DdlIncoterm.Items.Clear() + DdlIncoterm.DataSource = GlobalDTIncoterm() + DdlIncoterm.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlIncoterm.DataBind() + + DdlClavePedimento.Items.Clear() + DdlClavePedimento.DataSource = GlobalDTClavePedimento() + DdlClavePedimento.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlClavePedimento.DataBind() + + DdlMotivoTraslado.Items.Clear() + DdlMotivoTraslado.DataSource = GlobalDTSATMotivoTraslado() + DdlMotivoTraslado.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlMotivoTraslado.DataBind() + + CargaPais() + CargaEstado() + CargaMunicipio() + CargaColonia() + + End Sub + + + Private Sub CargaPais() + DdlPais.Items.Clear() + DdlPais.DataSource = GlobalDTPais() + DdlPais.DataBind() + DdlPais.SelectedValueExist("151") + End Sub + + Private Sub CargaEstado() + DdlEstado.Items.Clear() + If DdlPais.SelectedValue.ToEntero > 0 Then + DdlEstado.DataSource = GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString) + End If + DdlEstado.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlEstado.DataBind() + End Sub + + Private Sub CargaMunicipio() + DdlMunicipio.Items.Clear() + If DdlEstado.SelectedValue.ToEntero > 0 Then + DdlMunicipio.DataSource = GlobalDTMunicipio(GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString).FiltraParametros($"CveEstado = {DdlEstado.SelectedValue.ToEntero}")(0)("ClaveSATEstado").ToString) + End If + DdlMunicipio.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlMunicipio.DataBind() + End Sub + + Private Sub CargaColonia() + DdlColonia.Items.Clear() + If DdlMunicipio.SelectedValue.ToEntero > 0 Then + DdlColonia.DataSource = GlobalDTColonia(GlobalDTMunicipio(GlobalDTEstado(GlobalDTPais.FiltraParametros($"CvePais = {DdlPais.SelectedValue.ToEntero}")(0)("ClaveSATPais").ToString).FiltraParametros($"CveEstado = {DdlEstado.SelectedValue.ToEntero}")(0)("ClaveSATEstado").ToString).FiltraParametros($"CveMunicipio = {DdlMunicipio.SelectedValue.ToEntero}")(0)("ClaveSATMunicipio").ToString) + End If + DdlColonia.Items.Insert(0, New ListItem("Seleccione", "-1")) + DdlColonia.DataBind() + End Sub + + Protected Sub DdlPais_SelectedIndexChanged(sender As Object, e As EventArgs) + 'si contiene MX, USA o CANADA carga ddls, si no carga txt + CargaEstado() + + If DdlPais.SelectedValue.Contiene("151", "66", "40") Then + DdlEstado.Visible = True + DdlMunicipio.Visible = True + DdlColonia.Visible = True + + TxtComExtEstado.Visible = False + TxtComExtMunicipio.Visible = False + TxtComExtColonia.Visible = False + + TxtComExtEstado.Text = "" + TxtComExtMunicipio.Text = "" + TxtComExtColonia.Text = "" + + If DdlPais.SelectedValue.Contiene("66", "40") Then + DdlMunicipio.Visible = False + DdlColonia.Visible = False + + DdlMunicipio.SelectedValue = "-1" + DdlColonia.SelectedValue = "-1" + + TxtComExtMunicipio.Visible = True + TxtComExtColonia.Visible = True + End If + + Else + 'Limpia los DDLs + CargaMunicipio() + CargaColonia() + + DdlEstado.Visible = False + DdlMunicipio.Visible = False + DdlColonia.Visible = False + + TxtComExtEstado.Visible = True + TxtComExtMunicipio.Visible = True + TxtComExtColonia.Visible = True + End If + End Sub + Protected Sub DdlEstado_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaMunicipio() + CargaColonia() + End Sub + Protected Sub DdlMunicipio_SelectedIndexChanged(sender As Object, e As EventArgs) + CargaColonia() + End Sub + +#End Region + +#Region "D O C U M E N T A C I O N " + + Private Sub CargaDocumentacionCliente() + Dim objRH As New ClsEdocumentacion() + + If objRH.DocumentacionElectronicaGet(-1, If(CveCliente = -1, 0, CveCliente), -1, UsuarioActual.Empresa.CveEmpresa, -1, Modulo:=2) Then + DTDocumentacion = objRH.DtResultados + GvDocumentosCliente.DataSource = objRH.DtResultados + End If + objRH.Dispose() + 'If DTDocumentacion.FiltraParametros(" CveDocumentacionTipo = 7 ").Rows.Count > 0 Then + ' GvDocumentosCliente.DataSource = DTDocumentacion.FiltraParametros(" CveDocumentacionTipo = 7 ") + 'Else + ' GvDocumentosCliente.DataSource = Nothing + 'End If + GvDocumentosCliente.DataBind() + + UPGvDocumentosCliente.Update() + 'UpGvDocumentosFirma2.Update() + End Sub + Public Sub UploadModal_ClickDocumentacionFirmaContrato(sender As Object, e As EventArgs) + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim chkEstatus As CheckBox + CveDocumentacionElectronica = GvRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero + CveDocumentacion = GvRow.DataKey("CveDocumentacion").ToString.ToEntero + Documentacion = GvRow.DataKey("Documentacion") + AdjuntoDocumentacion = GvRow.DataKey("Adjunto").ToString + + chkEstatus = GvRow.FCCheckBox("chkEstatus") + + + + ObservacionDocumentacion = GvRow.FCTextBox("TxtObservaciones").Text.Trim.ToUpper + FechaLimite = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate + + AdjuntoDocumentacion = GvRow.DataKey("Adjunto") + + LtlTitulofirmaContrato.Text = "Subir " & Documentacion + + UpTituloFirma.Update() + + RegistraScript("$('#ModalUploadFirmaContratoDocumento').modal({ backdrop: 'static', keyboard: false});") + End Sub + Private Sub GuardarDocumentosClientes(Optional _CveDocumentacionExcluir As Integer = -1) + + Dim hasError As Boolean = True + Dim objDocumentos As New ClsEdocumentacion + + For Each dRow As GridViewRow In GvDocumentosCliente.Rows + + Dim _CveDocumentacion As Integer = dRow.DataKey("CveDocumentacion").ToString.ToEntero + Dim _Adjunto As String = dRow.DataKey("Adjunto") + 'Dim _Documentacion As String = dRow.DataKey("Documentacion") + Dim _CveDocumentacionElectronica As Integer = dRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero + Dim _txtObservaciones As TextBox = dRow.FCTextBox("TxtObservaciones") + Dim _TxtFechaLimite As TextBox = dRow.FCTextBox("TxtFechaLimite") + Dim _TxtFechaVigencia As TextBox = dRow.FCTextBox("TxtFechaVigencia") + Dim chkEstatus As CheckBox = dRow.FCCheckBox("chkEstatus") + Dim _estatus As Integer + + _estatus = If(dRow.FCCheckBox("chkEstatus").Checked, 1, 0) + + Dim _FechaVigencia As Date + Dim _FechaLimite As Date + + Dim DiasLimite As Integer = dRow.DataKey("DiasLimite").ToString.ToEntero + Dim AplicaDiasLimite As Boolean = If(dRow.DataKey("AplicaDiasLimite").ToString = "1", True, False) + Dim AplicaFechaVencimiento As Boolean = If(dRow.DataKey("AplicaFechaVencimiento").ToString = "1", True, False) + + If _TxtFechaVigencia.Text.Length = 10 Then + _FechaVigencia = _TxtFechaVigencia.Text.ToDate + Else + _FechaVigencia = Nothing + End If + + If Not AplicaDiasLimite Then + _FechaLimite = MinFecha + Else + _FechaLimite = _TxtFechaLimite.Text.ToDate + End If + + If Not AplicaFechaVencimiento Then + _FechaVigencia = MinFecha + End If + + + If Not _CveDocumentacionExcluir = _CveDocumentacion Then + Try + If _CveDocumentacionElectronica = -1 Then + + If objDocumentos.DocumentacionElectronicaAdd(_CveDocumentacion, -1, CveCliente, -1, _estatus, _txtObservaciones.Text.Trim, _Adjunto, UsuarioActual.CveUsuario, _FechaLimite, _FechaVigencia) > 0 Then + Else + hasError = True + Exit For + End If + + Else + If objDocumentos.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, -1, CveCliente, -1, _estatus, _txtObservaciones.Text.Trim, _Adjunto, UsuarioActual.CveUsuario, _FechaLimite, _FechaVigencia) Then + Else + hasError = True + Exit For + End If + End If + + + hasError = False + Catch ex As Exception + hasError = True + Exit For + End Try + End If + Next + + 'refrescar grid datos investigacion + CargaDocumentacionCliente() + End Sub + + Protected Sub chkEstatus_CheckedChanged(sender As Object, e As EventArgs) + GuardarDocumentosClientes() + End Sub + + Protected Sub TxtObservaciones_TextChanged(sender As Object, e As EventArgs) + GuardarDocumentosClientes() + End Sub + Protected Sub BtnModalFirmaContratoDocumentoUpload_Click(sender As Object, e As EventArgs) Handles BtnModalFirmaContratoDocumentoUpload.Click + + Dim FileExtension As String = "-1" + Dim Filesgral As List(Of Archivo) = TxtFileFirmaContrato.getfiles().Archivos + Dim Filename As String = "" + + + For Each fileItem As Archivo In Filesgral + Try + + FileExtension = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + Dim tempArray() As String + tempArray = fileItem.filename.ToString().Split("-".ToCharArray()) + + Dim rutaDestino As String = UsuarioActual.Empresa.Ruta & "\DocElectronica\Clientes\" & CveCliente & "\" & Documentacion & "." & FileExtension + Dim rutaAdjuntoAnterior As String = UsuarioActual.Empresa.Ruta & "DocElectronica\Clientes\" & CveCliente & "\" & AdjuntoDocumentacion + + If Not System.IO.Directory.Exists(UsuarioActual.Empresa.Ruta & "DocElectronica\Clientes\" & CveCliente & "\") Then + System.IO.Directory.CreateDirectory(UsuarioActual.Empresa.Ruta & "DocElectronica\Clientes\" & CveCliente & "\") + End If + + If File.Exists(rutaAdjuntoAnterior) And AdjuntoDocumentacion.Trim.Length > 0 Then + File.Delete(rutaAdjuntoAnterior) + End If + + If System.IO.File.Exists(rutaDestino) Then + System.IO.File.Delete(rutaDestino) + End If + + System.IO.File.Move(fileItem.FileUrl, rutaDestino) + + Dim objRH As New ClsEdocumentacion + + + If CveDocumentacionElectronica = -1 Then + If objRH.DocumentacionElectronicaAdd(CveDocumentacion, -1, CveCliente, -1, 1, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite) > 0 Then + + End If + Else + If objRH.DocumentacionElectronicaUpdate(CveDocumentacionElectronica, CveDocumentacion, -1, CveCliente, -1, 1, ObservacionDocumentacion, Documentacion & "." & FileExtension, UsuarioActual.CveUsuario, FechaLimite) Then + + End If + End If + + objRH.Dispose() + + GuardarDocumentosClientes(CveDocumentacion) + CargaDocumentacionCliente() + + + TxtFileFirmaContrato.Text = "" + UpModalFirmaContratoDocumento.Update() + + Catch ex As Exception + OnError("Error al cargar archivo", ex) + End Try + + Next + RegistraScript("$('#ModalUploadFirmaContratoDocumento').modal('hide')", "hidemodal7") + + End Sub + + Public Sub Update_ClickDocumentacionFirmaContrato(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim activo As Boolean = False + + Dim _CveDocumentacionElectronica As Integer = GvRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero + Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString.ToEntero + Dim _Adjunto As String = GvRow.DataKey("Adjunto").ToString + Dim _fechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate + + Dim obserbaciones As String = DirectCast(GvRow.FindControl("TxtObservaciones"), TextBox).Text + 'Dim DDLEstatus As DropDownList = DirectCast(GvRow.FindControl("DDLEstatus"), DropDownList) + Dim chkCompleto As CheckBox = DirectCast(GvRow.FindControl("chkEstatus"), CheckBox) + + If chkCompleto.Checked Then + Estatus = 1 + Else + Estatus = 0 + End If + + Dim ObjEdoc As New ClsEdocumentacion + + If Not _CveDocumentacionElectronica = -1 Then + If ObjEdoc.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, -1, CveCliente, -1, 1, obserbaciones, _Adjunto, UsuarioActual.CveUsuario, _fechaLimite) Then + Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) + End If + Else + If ObjEdoc.DocumentacionElectronicaAdd(_CveDocumentacion, -1, CveCliente, -1, 1, obserbaciones, _Adjunto, UsuarioActual.CveUsuario, _fechaLimite) > 0 Then + Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) + End If + End If + + CargaDocumentacionCliente() + ObjEdoc.Dispose() + + End Sub + + + Public Sub Update_ClickDocumentacionRemove(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim activo As Boolean = False + + Dim _CveDocumentacionElectronica As Integer = GvRow.DataKey("CveDocumentacionElectronica").ToString.ToEntero + Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString.ToEntero + Dim _Adjunto As String = GvRow.DataKey("Adjunto").ToString + Dim _fechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate + Dim obserbaciones As String = DirectCast(GvRow.FindControl("TxtObservaciones"), TextBox).Text + 'Dim DDLEstatus As DropDownList = DirectCast(GvRow.FindControl("DDLEstatus"), DropDownList) + Dim chkCompleto As CheckBox = DirectCast(GvRow.FindControl("chkEstatus"), CheckBox) + + Dim UrlArchivo = UsuarioActual.Empresa.Ruta & "\DocElectronica\Clientes\" & CveCliente & "/" & _Adjunto + + If File.Exists(UrlArchivo) Then + Try + File.Delete(UrlArchivo) + Catch ex As Exception + End Try + + End If + + Dim ObjEdoc As New ClsEdocumentacion + + If Not _CveDocumentacionElectronica = -1 Then + + If ObjEdoc.DocumentacionElectronicaUpdate(_CveDocumentacionElectronica, _CveDocumentacion, -1, CveCliente, -1, 0, "", "", UsuarioActual.CveUsuario, _fechaLimite) Then + Alert("Documento Eliminado Correctamente.", TipoMensaje.MsgInformacion) + End If + + End If + + CargaDocumentacionCliente() + ObjEdoc.Dispose() + + End Sub Public Sub DownLoad_ClickDocumentacion(sender As Object, e As EventArgs) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim Adjunto As String = GvRow.DataKey("Adjunto") @@ -6883,8 +6883,8 @@ Partial Class Clientes TxtAval.Text = "" RegistraScript("$('#ModalDivPagare').modal('show')") - End Sub - + End Sub + Protected Sub ImprimirPagare(sender As Object, e As EventArgs) Handles BtnAgregarPagare.Click Dim memoryStreamDoc As New System.IO.MemoryStream Dim objGemBoxDocument As New clsGemBoxDocument(linkDescargaPagare) @@ -6942,2514 +6942,2514 @@ Partial Class Clientes memoryStream.WriteTo(Response.OutputStream) Response.End() - End Sub - - Protected Sub GvDocumentosFirma_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDocumentosCliente.RowDataBound - - - If e.Row.RowType = DataControlRowType.DataRow Then - - Dim Adjunto As String = e.Row.DBCampo("Adjunto").ToString - Dim ImgDownLoadFormato As LinkButton = e.Row.FCLinkButton("ImgDownLoadFormato") - 'Dim ImgDownLoad As Literal = e.Row.FCLiteral("ImgDownLoad") - Dim LnkDownLoadDoc As LinkButton = e.Row.FCLinkButton("LnkDownLoadDoc") - Dim ImgRequired As Literal = e.Row.FCLiteral("ImgRequired") - Dim txtFechaLimite As TextBox = e.Row.FCTextBox("TxtFechaLimite") - Dim requerido As Boolean = If(e.Row.DBCampo("Requerido").ToUpper = "TRUE", True, False) - Dim chkEstatus As CheckBox = e.Row.FCCheckBox("chkEstatus") - Dim documentacionFormato As String = e.Row.DBCampo("DocumentacionFormato").ToString - Dim Documentacion As String = e.Row.DBCampo("Documentacion").ToString - Dim _CveDocumentacion As Integer = e.Row.DBCampo("CveDocumentacion").ToString.ToEntero - Dim separado As Char() = ".".ToString.ToCharArray - Dim array() As String = Adjunto.Split(separado) - Dim extencion As String = "" - Dim existeAdjunto As Boolean = False - Dim TxtFechaVigencia As TextBox = e.Row.FCTextBox("TxtFechaVigencia") - - Dim imgCalendario As LinkButton = e.Row.FCLinkButton("imgCalendario") - - - - - - - ' FechaVigencia - - Dim DiasLimite As Integer = e.Row.DataKey("DiasLimite").ToString.ToEntero - Dim AplicaDiasLimite As Boolean = If(e.Row.DataKey("AplicaDiasLimite").ToString = "1", True, False) - Dim AplicaFechaVencimiento As Boolean = If(e.Row.DataKey("AplicaFechaVencimiento").ToString = "1", True, False) - - txtFechaLimite.Visible = If(AplicaDiasLimite, True, False) - TxtFechaVigencia.Visible = If(AplicaFechaVencimiento, True, False) - imgCalendario.Visible = If(AplicaFechaVencimiento, True, False) - - - 'Dim scripMascara = " $('#" & TxtFechaVigencia.ClientID & "').mask('00/00/0000');" - ' RegistraScript(scripMascara) - - If TxtFechaVigencia.Text.Length = 10 Then - TxtFechaVigencia.Text = TxtFechaVigencia.Text.ToDate.ToString("dd/MM/yyyy") - End If - - If array.Length > 0 Then - extencion = array(array.Length - 1) - End If - - If e.Row.DBCampo("Estatus").ToString.ToEntero = 1 Then - chkEstatus.Checked = True - Else - chkEstatus.Checked = False - End If - - If documentacionFormato = "" Then - 'ImgDownLoadFormato.Visible = False - LnkDownLoadDoc.Visible = False - Else - Dim linkDescarga = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "/Formatos/" & CveDocumentacion & "" & documentacionFormato - LnkDownLoadDoc.Visible = True - End If - - txtFechaLimite.Text = e.Row.DBCampo("FechaLimite").ToString.ToDate.ToString("dd/MM/yyyy") - - If Adjunto.Trim.Length > 0 Then - - Dim linkDescarga = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "\DocElectronica\Clientes\" & CveCliente & "/" & Adjunto - Dim linkDescargaArchivo = UsuarioActual.Empresa.Ruta & "\DocElectronica\Clientes\" & CveCliente & "/" & Adjunto - - If File.Exists(linkDescargaArchivo) Then - - LnkDownLoadDoc.Visible = True - ScriptManager.GetCurrent(Me).RegisterPostBackControl(LnkDownLoadDoc) - 'If extencion.Length > 0 Then - ' ImgDownLoad.Text = String.Format(" ", linkDescarga, CveCliente & Documentacion & "." & extencion) - 'Else - ' ImgDownLoad.Text = String.Format(" ", linkDescarga, CveCliente & Documentacion) - 'End If - Else - LnkDownLoadDoc.Visible = False - End If - Else - LnkDownLoadDoc.Visible = False - End If - - If requerido Then - ImgRequired.Text = " " - Else - ' ImgRequired.Text = " " - End If - - If UsuarioActual.TienePermisoProceso(248) And e.Row.DBCampo("Estatus").ToString.ToEntero = 1 And LnkDownLoadDoc.Visible Then - e.Row.FCLinkButton("LnkGvDocumentosEliminar").Visible = True - End If - - End If - - End Sub - Public Sub DownLoadFormato_ClickDocumentacion(sender As Object, e As EventArgs) - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - - Dim CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString.ToEntero - Dim DocumentacionFormato As String = CveDocumentacion & "_" & GvRow.DataKey("DocumentacionFormato") - - DescarFormato(DocumentacionFormato) - - End Sub - Public Sub DescarFormato(documento As String) - - Dim PathRoot As String = Server.MapPath("/") - Dim PathSource As String - Dim pathDesti As String - - PathSource = UsuarioActual.Empresa.Ruta & "Formatos\" & documento - pathDesti = PathRoot & "Temp\" & CveCliente & documento - - If File.Exists(pathDesti) Then - File.Delete(pathDesti) - End If - - File.Copy(PathSource, pathDesti) - - Dim objDoc As New clsGemBoxDocument(pathDesti) - Dim objRH As New ClsRH - Dim FechaActual As String = Now.Day.ToString("0#") & " de " & CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(1).ToString & " del " & Now.Year.ToString() - - - objDoc.SustituirTags(objRH.GetDatosTagsDocumentos(-1, UsuarioActual.CveEmpresa)) ' Pendiente - objRH.Dispose() - - - - objDoc.Guardar(pathDesti) - - Dim fileinfo As New FileInfo(pathDesti) - - Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority) - baseUrl = baseUrl & "/temp/" & fileinfo.Name - - RegistraDescargaJavaScript(baseUrl) - - End Sub - - - - 'Private Function GetDatosTagsDocumentos() As List(Of TagsDocumentos) - ' Dim ListaTagsDocumentost = New List(Of TagsDocumentos) - - ' If CvePersonal <> -1 Then - ' Dim objRH As New ClsRH - - - - ' If objRH.PersonalReclutamientoGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Nombres}", objRH.DtResultados(0)("Nombres").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{APaterno}", objRH.DtResultados(0)("APaterno").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{AMaterno}", objRH.DtResultados(0)("AMaterno").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{RFC}", objRH.DtResultados(0)("RFC").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreCompleto}", Cliente)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Estatura}", objRH.DtResultados(0)("Estatura").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Peso}", objRH.DtResultados(0)("Peso").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{LugarNacimiento}", objRH.DtResultados(0)("LugarNacimiento").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Edad}", objRH.DtResultados(0)("Edad").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreTelEmergencia}", objRH.DtResultados(0)("NombreTelEmergencia").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{TipoSangre}", objRH.DtResultados(0)("TipoSangre").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Vivienda}", objRH.DtResultados(0)("Vivienda").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{ViviendaDueno}", objRH.DtResultados(0)("ViviendaDueno").ToString)) - - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{CreditoInfonavit}", objRH.DtResultados(0)("CreditoInfonavit").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{RentaMensual}", objRH.DtResultados(0)("RentaMensual").ToString.ToDecimal.ToString("###,###,###.00"))) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{TransportePublico}", objRH.DtResultados(0)("TransportePublico").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormente}", objRH.DtResultados(0)("TrabajadoAnteriormente").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormenteObservaciones}", objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{ParientesEmpresa}", objRH.DtResultados(0)("ParientesEmpresa").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelito}", objRH.DtResultados(0)("AcusadoDelito").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelitoObservaciones}", objRH.DtResultados(0)("AcusadoDelitoObservaciones").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Calle}", objRH.DtResultados(0)("Calle").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Colonia}", objRH.DtResultados(0)("Colonia").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{CP}", objRH.DtResultados(0)("CP").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Telefono}", objRH.DtResultados(0)("Telefono").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Celular}", objRH.DtResultados(0)("Celular").ToString)) - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Correo}", objRH.DtResultados(0)("Correo").ToString)) - - - ' 'If Not IsDBNull(objRH.DtResultados(0)("CveSucursal")) Then - - ' ' ListaTagsDocumentost.Add(New TagsDocumentos("{CveSucursal}", DDLSucursal4.Text)) - ' 'End If - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{NumeroSS}", objRH.DtResultados(0)("NumeroSS").ToString)) - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Licencia}", objRH.DtResultados(0)("Licencia").ToString)) - - - - - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{CartillaMilitar}", objRH.DtResultados(0)("CartillaMilitar").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{CURP}", objRH.DtResultados(0)("CURP").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{AutorizaAntidoping}", objRH.DtResultados(0)("AutorizaAntidoping").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Observaciones}", objRH.DtResultados(0)("Observaciones").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaIngreso}", objRH.DtResultados(0)("FechaIngreso").ToString.ToDate.ToShortDateString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString.ToDate.ToShortDateString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Puesto}", objRH.DtResultados(0)("Puesto").ToString)) - - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{CUIP}", "")) - ' ListaTagsDocumentost.Add(New TagsDocumentos("{Denominacion}", "")) - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaNacimiento}", objRH.DtResultados(0)("FechaNacimiento").ToString.ToDate.ToString("dd/MM/yyyy"))) - - - ' Dim fechaActual As String = " " & Now.Day & " del mes " & Now.Month & " del año " & Now.Year - - ' Dim FechaActualDF As String = Now.ToString("dd/MM/yyyy") - - ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActual}", fechaActual)) - ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActualDF}", FechaActualDF)) - ' End If - - - ' objRH.Dispose() - ' End If - - ' Return ListaTagsDocumentost - 'End Function - - - - - - - - ''Private Function GetDatosTagsDocumentos() As List(Of TagsDocumentos) - '' Dim ListaTagsDocumentost = New List(Of TagsDocumentos) - - '' If CvePersonal <> -1 Then - '' Dim objRH As New ClsRH - - - - '' If objRH.PersonalReclutamientoGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then - - '' If Not IsDBNull(objRH.DtResultados(0)("Nombres")) Then - '' ListaTagsDocumentost.Add(New TagsDocumentos("{Nombres}", objRH.DtResultados(0)("Nombres").ToString)) - '' End If - - '' If Not objRH.DtResultados(0)("APaterno") Is Nothing Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{APaterno}", objRH.DtResultados(0)("APaterno").ToString)) - '' End If - - '' If Not objRH.DtResultados(0)("AMaterno") Is Nothing Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{AMaterno}", objRH.DtResultados(0)("AMaterno").ToString)) - '' End If - - '' If Not objRH.DtResultados(0)("NombreCompleto") Is Nothing Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreCompleto}", objRH.DtResultados(0)("NombreCompleto").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("Estatura")) Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{Estatura}", objRH.DtResultados(0)("Estatura").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("Peso")) Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{Peso}", objRH.DtResultados(0)("Peso").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("LugarNacimiento")) Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{LugarNacimiento}", objRH.DtResultados(0)("LugarNacimiento").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("Edad")) Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{Edad}", objRH.DtResultados(0)("Edad").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("NombreTelEmergencia")) Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreTelEmergencia}", objRH.DtResultados(0)("NombreTelEmergencia").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("TipoSangre")) Then - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{TipoSangre}", objRH.DtResultados(0)("TipoSangre").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("Vivienda")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Vivienda}", objRH.DtResultados(0)("Vivienda").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("ViviendaDueno")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{ViviendaDueno}", objRH.DtResultados(0)("ViviendaDueno").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("CreditoInfonavit")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CreditoInfonavit}", objRH.DtResultados(0)("CreditoInfonavit").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("RentaMensual")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{RentaMensual}", objRH.DtResultados(0)("RentaMensual").ToString.ToDecimal.ToString("###,###,###.00"))) - - '' If Not IsDBNull(objRH.DtResultados(0)("TransportePublico")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TransportePublico}", objRH.DtResultados(0)("TransportePublico").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("TrabajadoAnteriormente")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormente}", objRH.DtResultados(0)("TrabajadoAnteriormente").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormenteObservaciones}", objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("ParientesEmpresa")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{ParientesEmpresa}", objRH.DtResultados(0)("ParientesEmpresa").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("AcusadoDelito")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelito}", objRH.DtResultados(0)("AcusadoDelito").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("AcusadoDelitoObservaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelitoObservaciones}", objRH.DtResultados(0)("AcusadoDelitoObservaciones").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Direccion")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Calle")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Calle}", objRH.DtResultados(0)("Calle").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Colonia")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Colonia}", objRH.DtResultados(0)("Colonia").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("CP")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CP}", objRH.DtResultados(0)("CP").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Telefono")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Telefono}", objRH.DtResultados(0)("Telefono").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Celular")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Celular}", objRH.DtResultados(0)("Celular").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Correo")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Correo}", objRH.DtResultados(0)("Correo").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("CveSucursal")) Then - - '' ' ListaTagsDocumentost.Add(New TagsDocumentos("{CveSucursal}", DDLSucursal4.Text)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("NumeroSS")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{NumeroSS}", objRH.DtResultados(0)("NumeroSS").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Licencia")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Licencia}", objRH.DtResultados(0)("Licencia").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("CartillaMilitar")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CartillaMilitar}", objRH.DtResultados(0)("CartillaMilitar").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("CURP")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CURP}", objRH.DtResultados(0)("CURP").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("AutorizaAntidoping")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AutorizaAntidoping}", objRH.DtResultados(0)("AutorizaAntidoping").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Observaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Observaciones}", objRH.DtResultados(0)("Observaciones").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("CredencialElector")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CredencialElector}", objRH.DtResultados(0)("CredencialElector").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Sucursal")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Sucursal}", objRH.DtResultados(0)("Sucursal").ToString)) - - '' If Not IsDBNull(objRH.DtResultados(0)("Puesto")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Puesto}", objRH.DtResultados(0)("Puesto").ToString)) - - '' 'If Not IsDBNull(objRH.DtResultados(0)("InformacionFidedigno")) Then chkFidedigna4.Checked = objRH.DtResultados(0)("InformacionFidedigno") - '' ListaTagsDocumentost.Add(New TagsDocumentos("{InformacionFidedigno}", objRH.DtResultados(0)("InformacionFidedigno").ToString)) - '' End If - - '' If Not IsDBNull(objRH.DtResultados(0)("FechaNacimiento")) Then - '' ListaTagsDocumentost.Add(New TagsDocumentos("{InformacionFidedigno}", objRH.DtResultados(0)("FechaNacimiento").ToString.ToDate.ToString("dd/MM/yyyy"))) - '' End If - - - '' Dim fechaActual As String = " " & Now.Day & " del mes " & Now.Month & " del año " & Now.Year - '' Dim FechaActualDF As String = Now.ToString("dd/MM/yyyy") - - '' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActual}", fechaActual)) - '' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActualDF}", FechaActualDF)) - - - '' objRH.Dispose() - '' End If - - '' Return ListaTagsDocumentost - ''End Function - Private Sub RegistraDescargaJavaScript(baseUrl As String) - - RegistraScript("Download('" & baseUrl & "')") - - End Sub - -#End Region - -#Region "D O C U M E N T O S V E N T A S" - - Private Sub CargaDocumentosVenta(tCveCliente As Integer) - Dim objInv As New ClsEdocumentacion - - If objInv.DocumentacionElectronicaGet(-1, tCveCliente, -1, UsuarioActual.CveEmpresa, 14) Then - GvDocsVentas.DataSource = objInv.DtResultados - If objInv.DtResultados.Rows.Count > 0 Then BtnGuardarDocumentacion.Visible = True - Else - GvDocsVentas.DataSource = Nothing - End If - - objInv.Dispose() - GvDocsVentas.DataBind() - UpDocumentacion.Update() - - End Sub - - Private Sub BtnGuardarDocumentación_Click(sender As Object, e As EventArgs) Handles BtnGuardarDocumentacion.Click - Dim objDoc As New ClsEdocumentacion() - objDoc.IniciaTransacSQL() - Dim HuboError As Boolean = False - - If CveCliente <= 0 Then - For Each gvr As GridViewRow In GvDocsVentas.Rows - If gvr.FCCheckBox("ChkDoc").Checked Then - - If objDoc.DocumentacionElectronicaAdd(gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, Now, Observacion2:=gvr.FCTextBox("TxtObs2").Text) <= 0 Then HuboError = True - - End If - - Next - - Else - For Each gvr As GridViewRow In GvDocsVentas.Rows - 'sino está registrada y se selecciona, se va a insertar - If gvr.DataKey("CveDocumentacionElectronica").ToEntero <= 0 AndAlso gvr.FCCheckBox("ChkDoc").Checked Then - If objDoc.DocumentacionElectronicaAdd(gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, Now, Observacion2:=gvr.FCTextBox("TxtObs2").Text) <= 0 Then HuboError = True - Else - ', Observacion2:=gvr.FCTextBox("TxtObs2").Text - If Not objDoc.DocumentacionElectronicaUpdate(gvr.DataKey("CveDocumentacionElectronica").ToEntero, gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, gvr.DataKey("FechaLimite").ToDate, Observacion2:=gvr.FCTextBox("TxtObs2").Text) Then HuboError = True - End If - - 'si ya estaba registrada y no se selecciona, se va a insertar - If gvr.DataKey("CveDocumentacionElectronica").ToEntero > 0 AndAlso Not gvr.FCCheckBox("ChkDoc").Checked Then - If Not objDoc.DocumentacionElectronicaRemove(gvr.DataKey("CveDocumentacionElectronica").ToEntero, -1) Then HuboError = True - End If - - Next - - End If - - - If Not HuboError Then - Alert("Documentación guardada", TipoMensaje.MsgInformacion) - objDoc.Commit() - Else - objDoc.RollBack() - End If - objDoc.Dispose() - - End Sub - - Public Sub Upload_ClickDocumentacion(sender As Object, e As EventArgs) - RegistraScript("$('#ModalCXCDocumento').modal({ backdrop: 'static', keyboard: false});") - End Sub - - Protected Sub BtnModalCXCDocumentoClienteUpload_Click(sender As Object, e As EventArgs) Handles BtnModalCXCDocumentoClienteUpload.Click - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim _CveDocumentacionElectronica As Integer = GvRow.DataKey("CveDocumentacion").ToEntero - Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToEntero - Dim _Obserbaciones As String = GvRow.FCTextBox("TxtObservaciones").Text.Trim - Dim _FechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate - - SubirComprobante(_CveDocumentacionElectronica, _CveDocumentacion, _Obserbaciones, _FechaLimite) - 'CargaDocs() - - End Sub - - Private Function SubirComprobante(_CveDocumentacionElecronica As Integer, _CveDocumentacion As Integer, _Obserbaciones As String, _FechaLimite As Date) As Boolean - - Dim Respuesta As Boolean = False - Dim RutaDirectorio As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, "Clientes\") - - Dim filesgral As List(Of Archivo) = TxtCXCDocumentoCliente.getfiles().Archivos - Dim filemove As String = "" - Dim Comprobante As String = "" - Dim ShortFileName As String = "" - - - If filesgral.Count > 0 Then - - Dim RutaArchivo As String - - For Each fileItem As Archivo In filesgral - - Dim edoc As New ClsEdocumentacion - - Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") - filemove = fileItem.FileUrl - RutaArchivo = String.Format("{0}{1}_{2}", RutaDirectorio, CveCliente, _CveDocumentacion) - RutaArchivo = String.Format("{0}.{1}", RutaArchivo, fileItem.Extencion) - - Try - If Not Directory.Exists(RutaDirectorio) Then - Directory.CreateDirectory(RutaDirectorio) - End If - - If File.Exists(RutaArchivo) Then - File.Delete(RutaArchivo) - End If - - File.Move(filemove, RutaArchivo) - Respuesta = True - ShortFileName = System.IO.Path.GetFileName(RutaArchivo) - - If edoc.DocumentacionElectronicaUpdate(_CveDocumentacionElecronica, _CveDocumentacion, -1, CveCliente, -1, 1, _Obserbaciones, ShortFileName, UsuarioActual.CveEmpresa, _FechaLimite) Then - - - End If - - Catch ex As Exception - - OnError("Error al intentar guardar archivo ", ex) - Respuesta = False - RutaArchivo = "-1" - End Try - Anexo.Text = "" - - edoc.Dispose() - Next - Else - Respuesta = True - End If - - - - UpModalCXCClienteDocumento.Update() - Return Respuesta - - End Function - - Public Sub Update_ClickDocumentacion(sender As Object, e As EventArgs) - - Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) - Dim activo As Boolean = False - - Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToEntero - Dim _Adjunto As String = GvRow.DataKey("Adjunto").ToString - Dim _fechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate - - Dim observaciones As String = GvRow.FCTextBox("TxtObservaciones").Text ' DirectCast(GvRow.FindControl("TxtObservaciones"), TextBox).Text - 'Dim DDLEstatus As DropDownList = DirectCast(GvRow.FindControl("DDLEstatus"), DropDownList) - Dim chkCompleto As CheckBox = GvRow.FCCheckBox("chkEstatus") - Dim _Estatus As Integer - If chkCompleto.Checked Then _Estatus = 1 Else _Estatus = 0 - - - Dim objRH As New ClsEdocumentacion - - If Not GvRow.DataKey("CveDocumentacionElectronica").ToEntero = -1 Then - If objRH.DocumentacionElectronicaUpdate(GvRow.DataKey("CveDocumentacionElectronica").ToEntero, _CveDocumentacion, -1, CveCliente, -1, _Estatus, observaciones, _Adjunto, UsuarioActual.CveUsuario, GvRow.FCTextBox("TxtFechaLimite").Text.ToDate) Then - Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) - End If - Else - If objRH.DocumentacionElectronicaAdd(_CveDocumentacion, -1, CveCliente, -1, _Estatus, observaciones, _Adjunto, UsuarioActual.CveUsuario, GvRow.FCTextBox("TxtFechaLimite").Text.ToDate) > 0 Then - Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) - End If - End If - - objRH.Dispose() - - End Sub - - -#End Region - -#Region "PERSONA FISICA" - Protected Sub LnkPersonaFisica_Click(sender As Object, e As EventArgs) - RegistraScript("$('#DivModalPersonaFisica').modal();") - End Sub - Protected Sub LnkActualizarPersonaFisica_Click(sender As Object, e As EventArgs) - Dim ObjCliente As New ClsClientes - - If ObjCliente.UpdateClientePersonaFisica(CveCliente, TxtApellidoPaternoPF.Text, TxtApellidoMaternoPF.Text, TxtNombrePF.Text) Then - Alert("El Cliente se ha actualizado correctamente.", TipoMensaje.MsgInformacion) - - TxtNombre.Text = $"{TxtNombrePF.Text} {TxtApellidoPaternoPF.Text} {TxtApellidoMaternoPF.Text}" - - TxtApellidoPaterno.Text = TxtApellidoPaternoPF.Text - TxtApellidoMaterno.Text = TxtApellidoMaternoPF.Text - TxtNombres.Text = TxtNombrePF.Text - - DivRazonSocial.Visible = False - DivPersonaFisica.Visible = True - - RegistraScript("$('#DivModalPersonaFisica').modal('hide');") - End If - - ObjCliente.Dispose() - UpDatos.Update() - End Sub -#End Region - -#Region "USUARIOS PLATAFORMA CLIENTE - 6 " - Protected Sub CargaUsuariosPortalCliente() - Dim objUsuario As ClsSisUsuarios = New ClsSisUsuarios - If objUsuario.GetUsuariosPortal(-1, CveCliente, -1) Then - GvUsuarios.DataSource = objUsuario.DtResultados.FiltraParametros($"CveEmpresa={UsuarioActual.CveEmpresa}") - GvUsuarios.DataBind() - End If - objUsuario.Dispose() - End Sub -#End Region - -#Region " DEVOLVER DINERO ANT/NC " - Private Sub InicializaDevolverDinero() - If UsuarioActual.TienePermisoProceso(247) Then - GVAnticipos.Columns(6).Visible = True - End If - End Sub -#End Region - -#Region "MODAL GRAFICA/PEDIDOS" - - Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs) - If CargaDatatables() Then - RegistraScript("$('#DivModalGrafica').modal('show')") - CargaGrafica() - End If - End Sub - - Protected Sub LnkCancelar_Click(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - Dim ObjCliente As New ClsClientes - If ObjCliente.UpdateEstatusPedido(gvRow.DataKey("CveVenta").ToEntero, 17, -1, UsuarioActual.CveUsuario) Then - Alert("Cancelado correctamente.") - CargaPedido() - End If - ObjCliente.Dispose() - End Sub - - - Private Sub CargaPedido() - Dim ObjCliente As New ClsClientes - If ObjCliente.GetClienteVentasPedido(CveCliente, UsuarioActual.CveEmpresa) Then - GvPedidos.DataSource = ObjCliente.DtResultados - End If - ObjCliente.Dispose() - GvPedidos.DataBind() - UpPedido.Update() - End Sub - - Protected Sub LnkAutorizar_Click(sender As Object, e As EventArgs) - Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) - Dim ObjCliente As New ClsClientes - ObjCliente.IniciaTransacSQL() - Dim ErrorTrans As Boolean = False - Dim CveU As Integer = 0 - Dim MsgAut As String = "" - - If ObjCliente.UpdateEstatusPedido(gvRow.DataKey("CveVenta").ToEntero, 16, gvRow.FCTextBox("TxtDiasCredito").Text.ToEntero, UsuarioActual.CveUsuario) Then - CveU = gvRow.DataKey("CveUsuario").ToEntero - MsgAut = String.Format(" Solicitud Autorizada {0} ", gvRow.DataKey("SerieFolio")) - 'If Not ObjCliente.UpdateFechaPedido(gvRow.DataKey("CveVenta").ToEntero, gvRow.FCTextBox("TxtDiasCredito").Text.ToEntero) Then - ' ErrorTrans = True - 'End If - Else - ErrorTrans = True - End If - If Not ErrorTrans Then - ObjCliente.Commit() - Alert("Autorizado correctamente.") - - If CveU > 0 Then ClsSisNotificaciones.SendNotificacionERP(CveU, MsgAut, MsgAut, 1) - - CargaPedido() - Else - ObjCliente.RollBack() - End If - ObjCliente.Dispose() - End Sub - Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) - If CargaDatatables() Then - CargaGrafica() - End If - End Sub - - Private Function CargaDatatables() As Boolean - Dim ObjClientes As New ClsClientes - If ObjClientes.GetClienteVencido(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then - DtVencido = ObjClientes.DtResultados - End If - - If ObjClientes.GetRotacionCartera(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then - DtRotacion = ObjClientes.DtResultados - End If - - If ObjClientes.GetClienteSaldoMensual(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then - DtSaldoMensual = ObjClientes.DtResultados - End If - - If ObjClientes.GetClienteComportamientoVentaMensual(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then - DtComportamientoVentas = ObjClientes.DtResultados - End If - - If ObjClientes.GetClienteVentasPedido(CveCliente, UsuarioActual.CveEmpresa) Then - GvPedidos.DataSource = ObjClientes.DtResultados - End If - - ObjClientes.Dispose() - GvPedidos.DataBind() - UpPedido.Update() - - Return True - End Function - - Private Sub CargaGrafica() - Dim FactVencida As Boolean = False - Dim Saldo As Double = 0 - Dim LimiteCredito As Double = 0 - If DtVencido.Rows.Count > 0 Then - Saldo = DtVencido.SUM("Saldo") - LimiteCredito = DtVencido.Rows(0)("LimiteCredito").ToString.ToDouble - LblVencido.Text = DtVencido.SUM("Total", "DiasVencidos > 0").FormatoNumero - LblPorVencer.Text = DtVencido.SUM("Total", "DiasVencidos <= 0").FormatoNumero - Else - LimiteCredito = TxtLimiteCredito.Text.ToDouble - LblVencido.Text = "0" - LblPorVencer.Text = "0" - End If - - Dim Dt As New DataTable() - Dt.Columns.Add("value") - For Each Dr As DataRow In DtVencido.Rows - Dim Row As DataRow = Nothing - Row = Dt.NewRow() - Row("value") = Dr("DiasVencidos").ToString - Dt.Rows.Add(Row) - If Dr("DiasVencidos").ToString.ToEntero > 0 And Dr("Saldo").ToString.ToDouble > 0 Then - FactVencida = True - End If - Next - - - Dim query = From s In Dt.AsEnumerable() Select New With {.date = "", .value = s("value").ToString()} - Dim json = Newtonsoft.Json.JsonConvert.SerializeObject(query) - RegistraScript($"CargaGraficaVencido({json})", "22") - - Dim Dt2 As New DataTable() - Dt2.Columns.Add("limite") - Dt2.Columns.Add("saldo") - Dim Row2 As DataRow = Nothing - Row2 = Dt2.NewRow() - LtlLimiteCreditoModal.Text = LimiteCredito.FormatoNumero - Row2("limite") = LimiteCredito - Saldo - Row2("saldo") = Saldo - Dt2.Rows.Add(Row2) - Dim query2 = From s In Dt2.AsEnumerable() Select New With {.year = "", .limite = s("limite").ToString(), .saldo = s("saldo").ToString()} - Dim json2 = Newtonsoft.Json.JsonConvert.SerializeObject(query2) - - RegistraScript($"CargaGraficaLimiteCredito({json2})", "33") - - If DtRotacion.Rows.Count > 0 Then - LblVentasModal.Text = DtRotacion.Rows(0)("Ventas").ToString.FormatoNumero - LblPagadoModal.Text = DtRotacion.Rows(0)("Pagado").ToString.FormatoNumero - LblRotacionModal.Text = DtRotacion.Rows(0)("Rotacion").ToString.FormatoNumero - LblDiasModal.Text = DtRotacion.Rows(0)("Dias").ToString.FormatoNumero - LblDiasCreditoModal.Text = DtRotacion.Rows(0)("DiasCredito").ToString.FormatoNumero - Else - LblVentasModal.Text = "0" - LblPagadoModal.Text = "0" - LblRotacionModal.Text = "0" - LblDiasModal.Text = "0" - LblDiasCreditoModal.Text = "0" - End If - - If FactVencida Or (Saldo > LimiteCredito) Then - LblEstatusModal.Text = "Vencido" - LblEstatusModal.ForeColor = Drawing.Color.Red - Else - LblEstatusModal.Text = "Al Corriente" - LblEstatusModal.ForeColor = Drawing.Color.Green - End If - - Dim Dt3 As New DataTable() - Dt3.Columns.Add("mes") - - Dim Dt4 As New DataTable() - Dt4.Columns.Add("balloonText") - Dt4.Columns.Add("bullet") - Dt4.Columns.Add("title") - Dt4.Columns.Add("valueField") - Dt4.Columns.Add("fillAlphas") - Dt4.Columns.Add("hidden") - - - Dim Cont As Integer = 1 - For Each Dr As DataRow In DtComportamientoVentas.Rows - Dt3.Columns.Add(Dr("Ano").ToString) - Dim Row4 As DataRow = Nothing - Row4 = Dt4.NewRow() - Row4("balloonText") = "Ventas [[category]]: [[value]]" - Row4("bullet") = "round" - Row4("title") = Dr("Ano").ToString - Row4("valueField") = Dr("Ano").ToString - Row4("fillAlphas") = 0 - Row4("hidden") = If(Cont > DtComportamientoVentas.Rows.Count - 3, False, True) - Dt4.Rows.Add(Row4) - Cont += 1 - Next - - Dim RowEnero As DataRow = Nothing - RowEnero = Dt3.NewRow() - Dim RowFebrero As DataRow = Nothing - RowFebrero = Dt3.NewRow() - Dim RowMarzo As DataRow = Nothing - RowMarzo = Dt3.NewRow() - Dim RowAbril As DataRow = Nothing - RowAbril = Dt3.NewRow() - Dim RowMayo As DataRow = Nothing - RowMayo = Dt3.NewRow() - Dim RowJunio As DataRow = Nothing - RowJunio = Dt3.NewRow() - Dim RowJulio As DataRow = Nothing - RowJulio = Dt3.NewRow() - Dim RowAgosto As DataRow = Nothing - RowAgosto = Dt3.NewRow() - Dim RowSeptiembre As DataRow = Nothing - RowSeptiembre = Dt3.NewRow() - Dim RowOctubre As DataRow = Nothing - RowOctubre = Dt3.NewRow() - Dim RowNoviembre As DataRow = Nothing - RowNoviembre = Dt3.NewRow() - Dim RowDiciembre As DataRow = Nothing - RowDiciembre = Dt3.NewRow() - For Each Dr As DataRow In DtComportamientoVentas.Rows - RowEnero(Dr("Ano").ToString) = Dr("Enero").ToString - RowEnero("mes") = "Enero" - RowFebrero(Dr("Ano").ToString) = Dr("Febrero").ToString - RowFebrero("mes") = "Febrero" - RowMarzo(Dr("Ano").ToString) = Dr("Marzo").ToString - RowMarzo("mes") = "Marzo" - RowAbril(Dr("Ano").ToString) = Dr("Abril").ToString - RowAbril("mes") = "Abril" - RowMayo(Dr("Ano").ToString) = Dr("Mayo").ToString - RowMayo("mes") = "Mayo" - RowJunio(Dr("Ano").ToString) = Dr("Junio").ToString - RowJunio("mes") = "Junio" - RowJulio(Dr("Ano").ToString) = Dr("Julio").ToString - RowJulio("mes") = "Julio" - RowAgosto(Dr("Ano").ToString) = Dr("Agosto").ToString - RowAgosto("mes") = "Agosto" - RowSeptiembre(Dr("Ano").ToString) = Dr("Septiembre").ToString - RowSeptiembre("mes") = "Septiembre" - RowOctubre(Dr("Ano").ToString) = Dr("Octubre").ToString - RowOctubre("mes") = "Octubre" - RowNoviembre(Dr("Ano").ToString) = Dr("Noviembre").ToString - RowNoviembre("mes") = "Noviembre" - RowDiciembre(Dr("Ano").ToString) = Dr("Diciembre").ToString - RowDiciembre("mes") = "Diciembre" - Next - Dt3.Rows.Add(RowEnero) - Dt3.Rows.Add(RowFebrero) - Dt3.Rows.Add(RowMarzo) - Dt3.Rows.Add(RowAbril) - Dt3.Rows.Add(RowMayo) - Dt3.Rows.Add(RowJunio) - Dt3.Rows.Add(RowJulio) - Dt3.Rows.Add(RowAgosto) - Dt3.Rows.Add(RowSeptiembre) - Dt3.Rows.Add(RowOctubre) - Dt3.Rows.Add(RowNoviembre) - Dt3.Rows.Add(RowDiciembre) - - RegistraScript($"CargaGraficaComportamientoVentas({Dt3.ToJson},{Dt4.ToJson.Replace($"{Chr(34)}True{Chr(34)}", "true").Replace($"{Chr(34)}False{Chr(34)}", "false")})", "44") - - Dim Dt5 As New DataTable() - Dt5.Columns.Add("mes") - - Dim Dt6 As New DataTable() - Dt6.Columns.Add("balloonText") - Dt6.Columns.Add("bullet") - Dt6.Columns.Add("title") - Dt6.Columns.Add("valueField") - Dt6.Columns.Add("fillAlphas") - Dt6.Columns.Add("hidden") - - Cont = 1 - For Each Dr As DataRow In DtSaldoMensual.Rows - Dt5.Columns.Add(Dr("Ano").ToString) - Dim Row6 As DataRow = Nothing - Row6 = Dt6.NewRow() - Row6("balloonText") = "Saldo [[category]]: [[value]]" - Row6("bullet") = "round" - Row6("title") = Dr("Ano").ToString - Row6("valueField") = Dr("Ano").ToString - Row6("fillAlphas") = 0 - Row6("hidden") = If(Cont > DtSaldoMensual.Rows.Count - 3, False, True) - Dt6.Rows.Add(Row6) - Cont += 1 - Next - RowEnero = Dt5.NewRow() - RowFebrero = Dt5.NewRow() - RowMarzo = Dt5.NewRow() - RowAbril = Dt5.NewRow() - RowMayo = Dt5.NewRow() - RowJunio = Dt5.NewRow() - RowJulio = Dt5.NewRow() - RowAgosto = Dt5.NewRow() - RowSeptiembre = Dt5.NewRow() - RowOctubre = Dt5.NewRow() - RowNoviembre = Dt5.NewRow() - RowDiciembre = Dt5.NewRow() - For Each Dr As DataRow In DtSaldoMensual.Rows - RowEnero(Dr("Ano").ToString) = Dr("Enero").ToString - RowEnero("mes") = "Enero" - RowFebrero(Dr("Ano").ToString) = Dr("Febrero").ToString - RowFebrero("mes") = "Febrero" - RowMarzo(Dr("Ano").ToString) = Dr("Marzo").ToString - RowMarzo("mes") = "Marzo" - RowAbril(Dr("Ano").ToString) = Dr("Abril").ToString - RowAbril("mes") = "Abril" - RowMayo(Dr("Ano").ToString) = Dr("Mayo").ToString - RowMayo("mes") = "Mayo" - RowJunio(Dr("Ano").ToString) = Dr("Junio").ToString - RowJunio("mes") = "Junio" - RowJulio(Dr("Ano").ToString) = Dr("Julio").ToString - RowJulio("mes") = "Julio" - RowAgosto(Dr("Ano").ToString) = Dr("Agosto").ToString - RowAgosto("mes") = "Agosto" - RowSeptiembre(Dr("Ano").ToString) = Dr("Septiembre").ToString - RowSeptiembre("mes") = "Septiembre" - RowOctubre(Dr("Ano").ToString) = Dr("Octubre").ToString - RowOctubre("mes") = "Octubre" - RowNoviembre(Dr("Ano").ToString) = Dr("Noviembre").ToString - RowNoviembre("mes") = "Noviembre" - RowDiciembre(Dr("Ano").ToString) = Dr("Diciembre").ToString - RowDiciembre("mes") = "Diciembre" - Next - Dt5.Rows.Add(RowEnero) - Dt5.Rows.Add(RowFebrero) - Dt5.Rows.Add(RowMarzo) - Dt5.Rows.Add(RowAbril) - Dt5.Rows.Add(RowMayo) - Dt5.Rows.Add(RowJunio) - Dt5.Rows.Add(RowJulio) - Dt5.Rows.Add(RowAgosto) - Dt5.Rows.Add(RowSeptiembre) - Dt5.Rows.Add(RowOctubre) - Dt5.Rows.Add(RowNoviembre) - Dt5.Rows.Add(RowDiciembre) - - - RegistraScript($"CargaGraficaCompratamientoSaldoMensual({Dt5.ToJson},{Dt6.ToJson.Replace($"{Chr(34)}True{Chr(34)}", "true").Replace($"{Chr(34)}False{Chr(34)}", "false")})", "55") - - UPModalProd.Update() - End Sub - - -#End Region - -#Region "TAB - COMPORTAMIENTO DE VENTAS" - - Private Sub CargaGrupo() - DdlGrupo.Items.Insert(0, New ListItem("Categoria", "3")) - DdlGrupo.Items.Insert(1, New ListItem("Clasificacion", "4")) - DdlGrupo.Items.Insert(2, New ListItem("Productos-Servicios", "5")) - DdlGrupo.Items.Insert(3, New ListItem("Año", "6")) - DdlGrupo.Items.Insert(4, New ListItem("Mes", "7")) - DdlGrupo.Items.Insert(5, New ListItem("Año/Mes", "8")) - DdlGrupo.Items.Insert(6, New ListItem("Fecha", "9")) - DdlGrupo.Items.Insert(7, New ListItem("Cliente", "10")) - DdlGrupo.Items.Insert(8, New ListItem("Vendedor", "12")) - DdlGrupo.Items.Insert(9, New ListItem("Usuario", "13")) - DdlGrupo.Items.Insert(10, New ListItem("Estatus Fact.", "14")) - DdlGrupo.Items.Insert(11, New ListItem("Año Ejec.", "15")) - DdlGrupo.Items.Insert(12, New ListItem("Mes Ejec.", "16")) - DdlGrupo.Items.Insert(13, New ListItem("Año/Mes Ejec.", "17")) - DdlGrupo.Items.Insert(14, New ListItem("Fecha Ejec.", "18")) - DdlGrupo.Items.Insert(15, New ListItem("Cliente - PS", "20")) - DdlGrupo.DataBind() - DdlGrupo.SelectedValueExist("8") - End Sub - - Private Sub CargaTipoCentroCosto() - - If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Then - DdlSubProyectoFiltro.Items.Clear() - DivProyecto.Visible = False - LblProyecto.Visible = False - LblSubProyecto.InnerText = "Sucursal:" - DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) - DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) - DdlSubProyectoFiltro.DataBind() - - DdlGrupo.Items.Insert(0, New ListItem("Sucursal", "2")) - DdlGrupo.Items.Insert(16, New ListItem("Sucursal Ejec.", "19")) - DdlGrupo.DataBind() - - ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then - DdlSubProyectoFiltro.Items.Clear() - DivProyecto.Visible = False - LblProyecto.Visible = False - LblSubProyecto.InnerText = "Proyecto:" - DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) - DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) - DdlSubProyectoFiltro.DataBind() - - DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "2")) - DdlGrupo.Items.Insert(16, New ListItem("Proyecto Ejec.", "19")) - DdlGrupo.DataBind() - ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 3 Then - DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) - DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) - DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) - DdlGrupo.DataBind() - ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 4 Then - LblProyecto.InnerText = "Sucursal:" - LblSubProyecto.InnerText = "Proyecto:" - - - DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) - DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) - DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) - DdlGrupo.DataBind() - - ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then - LblProyecto.InnerText = "Proyecto:" - LblSubProyecto.InnerText = "Sucursal:" - - DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) - DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) - DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) - DdlGrupo.DataBind() - End If - End Sub - - Private Sub CargaFiltros() - 'Cargo Proyectos - DdlProyecto.DataSource = GlobalDTProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1) - DdlProyecto.DataBind() - - 'Cargo Clasificaciones - DdlClasificacionFilto.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) - DdlClasificacionFilto.DataBind() - - 'CargaSubProyectos - DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) - DdlSubProyectoFiltro.DataBind() - - 'Vendedor - DdlVendedorFiltro.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) - DdlVendedorFiltro.DataBind() - - 'CargaUsuarios - DdlUsuario.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) - DdlUsuario.DataBind() - - 'Carga Productos - DdlPSFiltro.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") - - If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then - DdlPSFiltro.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacionFilto.SelectedValue) - DdlPSFiltro.SelectedText = "" - DdlPSFiltro.SelectedValue = "-1" - Else - DdlPSFiltro.ddl.Items.Clear() - DdlPSFiltro.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacionFilto.SelectedValue.ToEntero) - DdlPSFiltro.ddl.DataBind() - DdlPSFiltro.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) - End If - - CargaGrupo() - CargaTipoCentroCosto() - - End Sub - - Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProyecto.SelectedIndexChanged - CargaSubProyecto() - End Sub - - Private Sub CargaSubProyecto() - DdlSubProyectoFiltro.Items.Clear() - If DdlProyecto.SelectedValue <> "-1" Then - DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, DdlProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, -1, 1) - DdlSubProyectoFiltro.DataBind() - End If - DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) - End Sub - - Protected Sub DdlClasificacionFilto_SelectedIndexChanged(sender As Object, e As EventArgs) - If UsuarioActual.Empresa.Funcionalidad(105) = "" Then - DdlPSFiltro.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacionFilto.SelectedValue.ToEntero) - DdlPSFiltro.DataBind() - DdlPSFiltro.ddl.Items.Insert(0, New ListItem("Todos", "-1")) - Else - DdlPSFiltro.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacionFilto.SelectedValue) - DdlPSFiltro.SelectedText = "Todos" - DdlPSFiltro.SelectedValue = "-1" - End If - End Sub - - Protected Sub GvComportamientoVenta_RowDataBound(sender As Object, e As GridViewRowEventArgs) - If e.Row.RowType = DataControlRowType.DataRow Then - - If DdlGrupo.SelectedValue.ToEntero = 20 Then - - If e.Row.DBCampo("PS").ToString = "" Then - e.Row.CssClass = "Totales" - End If - Else - If Not e.Row.DBCampo("CveVenta").ToEntero > 0 Then - e.Row.Cells(5).Text = e.Row.DBCampo("Gpo").ToString - e.Row.CssClass = "Totales" - - End If - End If - End If - End Sub - - Protected Sub BtnConsultarComportamiento_Click(sender As Object, e As EventArgs) - CargaGvComportamientoVenta() - End Sub - - Private Sub CargaGvComportamientoVenta() - Dim ObjVentas As New ClsVentas() - Dim FechaI, FechaF As Date - FechaI = If(IsDate(TxtFechaIFiltro.Text.Trim()), TxtFechaIFiltro.Text.ToDate, MinFecha) - FechaF = If(IsDate(TxtFechaFFiltro.Text.Trim()), TxtFechaFFiltro.Text.ToDate, MaxFecha) - - If ObjVentas.GetRepProductosServiciosDetalle(DdlProyecto.SelectedValue.ToEntero, DdlSubProyectoFiltro.SelectedValue.ToEntero, -1, DdlClasificacionFilto.SelectedValue.ToEntero, - DdlPSFiltro.SelectedValue.ToEntero, FechaI, FechaF, -1, MinFecha, MaxFecha, -1, - CveCliente, -1, DdlVendedorFiltro.SelectedValue.ToEntero, DdlUsuario.SelectedValue.ToEntero, -1, - UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, TipoDocto:="Ing", GPO:=DdlGrupo.SelectedValue.ToEntero) Then - GvComportamientoVenta.DataSource = ObjVentas.DtResultados - Else - GvComportamientoVenta.DataSource = Nothing - End If - - ObjVentas.Dispose() - GvComportamientoVenta.DataBind() - UpDatosComportamientoVenta.Update() - End Sub - -#End Region - -#Region "DISPOSITIVOS" - - Protected Sub LnkMoverDispositivo_Click(sender As Object, e As EventArgs) - Dim CveDispositivo As Integer = HdnCveDispositivoMover.Value.ToEntero() - Dim CveCliente As Integer = DdlClienteDispositivo.SelectedValue.ToEntero() - - If CveDispositivo <= 0 Then - Alert("Se debe seleccionar un dispositivo.", TipoMensaje.MsgAdvertencia) - Return - End If - If CveCliente <= 0 Then - Alert("Se debe seleccionar un cliente.", TipoMensaje.MsgAdvertencia) - Return - End If - Dim TieneError As Boolean = False - Dim ObjGPS = New ClsGPS() - Dim ObjEventos As New ClsOIEventos(ObjGPS.IniciaTransacSQL()) - - If ObjGPS.UpdateClienteDispositivo(CveDispositivo, CveCliente) Then - TieneError = Not ObjEventos.AddEventoBitacora($"Se movió el dispositivo: {NombreDispositivo} de cliente. Valor Anterior:{UsuarioActual.Empresa.Empresa}, {LtlCliente.Text} Valor Actual:{DdlEmpresaDispositivo.SelectedItem.Text}, {DdlClienteDispositivo.SelectedItem.Text}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente:=CveCliente) - Else - TieneError = True - End If - - If TieneError Then - ObjGPS.RollBack() - Alert($"Ocurrió un error al mover el dispostivo.", TipoMensaje.MsgError) - Else - ObjGPS.Commit() - Alert($"El dispositivo '{NombreDispositivo}' se movió correctamente.") - End If - - ObjGPS.Dispose() - ObjEventos.Dispose() - - CargaDispositivos(DdlEstatusDispositivos.SelectedValue.ToEntero()) - CargaEventoBitacora() - NombreDispositivo = "" - RegistraScript("$('#DivMoverDispositivo').modal('hide');") - End Sub - -#End Region - -#Region "CRM" - Protected Sub CargaDatosCRM() - Dim ObjCRM = New ClsCRM() - - If ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa, CveEmpresaCRM) And ObjCRM.DtResultados.Rows.Count > 0 Then - TxtNombre.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Empresa").ToString - TxtNombreComercial.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Empresa").ToString - TxtRFC.Text = ObjCRM.DtResultados.FiltroPrimeroValor("RFC").ToString - - TxtEmail.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Correo").ToString - TxtEmailCotizacion.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Correo").ToString - - DdlVendedor.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveVendedorAsignado").ToString) - DdlSubProyecto.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveSubProyecto").ToString) - Else - Alert("La empresa CRM solicitada no existe, porfavor verifique", TipoMensaje.MsgAdvertencia) - CveEmpresaCRM = -1 - End If - ObjCRM.Dispose() - End Sub - - Protected Sub VerificaVinculacion() - Dim ObjCRM = New ClsCRM() - - If ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa, -1) And ObjCRM.DtResultados.Rows.Count > 0 Then - If ObjCRM.DtResultados.FiltraParametros(String.Format("CveCliente = {0}", CveCliente)).Rows.Count > 0 Then - LiLnkUnificarCRM.Visible = False - Else - LiLnkUnificarCRM.Visible = True - End If - End If - ObjCRM.Dispose() - End Sub - - Protected Function VincularEmpresaCRM() As Boolean - Dim Ok As Boolean = False - Dim ObjCRM = New ClsCRM() - Dim ObjBitacora = New ClsOIEventos(ObjCRM.IniciaTransacSQL()) - If (CveCliente > 0) Then - - Dim CveEmpresaCRMVincular As Integer = If(CveEmpresaCRM > 0, CveEmpresaCRM, If(CveEmpresaCRMUnificar > 0, CveEmpresaCRMUnificar, -1)) - - If ObjCRM.UpdateEmpresCRM("-2", "-2", -2, CveEmpresaCRMVincular, -2, UsuarioActual.CveUsuario, CveCliente, -1, "-1") Then - If CveEmpresaCRM > 0 Then - ObjBitacora.AddEventoBitacora(String.Format("Se Creó el Cliente: {0} a partir de la Empresa CRM", TxtNombre.Text), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM:=CveEmpresaCRM) - End If - If CveEmpresaCRMUnificar > 0 Then - ObjBitacora.AddEventoBitacora(String.Format("Se Unificó el Cliente: {0} con la Empresa CRM", TxtNombre.Text), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM:=CveEmpresaCRMUnificar) - End If - Ok = True - End If - End If - - If (Ok) Then - ObjCRM.Commit() - Else - ObjCRM.RollBack() - End If - ObjCRM.Dispose() - ObjBitacora.Dispose() - - Return Ok - End Function - - Protected Sub CargaModalEmpresasCRM() - Dim ObjCRM = New ClsCRM() - - If (ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa) And ObjCRM.DtResultados.Rows.Count > 0) Then - DtEmpresasCRM = ObjCRM.DtResultados.FiltraParametros(String.Format("CveCliente IS NULL")) - GvEmpresasCRM.DataSource = DtEmpresasCRM - End If - ObjCRM.Dispose() - GvEmpresasCRM.DataBind() - UpEmpresasCRM.Update() - End Sub - - Protected Sub LnkUnificarCRM_Click(sender As Object, e As EventArgs) - CveEmpresaCRMUnificar = -1 - CargaModalEmpresasCRM() - RegistraScript("$('#DivModalUnificarCRM').modal();") - End Sub - - Protected Sub BtnUnificarCRM_Click(sender As Object, e As EventArgs) - For Each row As GridViewRow In GvEmpresasCRM.Rows - Dim chkSeleccionado As RadioButton = CType(row.FindControl("RBSeleccion"), RadioButton) - If chkSeleccionado.Checked Then - CveEmpresaCRMUnificar = row.DataKey("CveEmpresaCRM").ToEntero - End If - Next - - If CveEmpresaCRMUnificar > 0 Then - If (VincularEmpresaCRM()) Then - LiLnkUnificarCRM.Visible = False - UpAccionesCRM.Update() - - RegistraScript("$('#DivModalUnificarCRM').modal('hide');") - Alert("Se Unificó correctamente al Cliente con la Empresa CRM.") - End If - End If - End Sub -#End Region - -#Region "PORCENTAJE PRECIO DE MARCAS" - Private Sub LnkPorcentajeMarcas_Click(sender As Object, e As EventArgs) Handles LnkPorcentajeMarcas.Click - RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajeMarcas")) - - CreaDT() - - CargaMarcas() - LimpiaModalPorcentaje() - End Sub - Private Sub CreaDT() - Dim DTPorcentajeTemp As New DataTable - - Dim column As DataColumn = New DataColumn("No") - column.DataType = Type.GetType("System.Int32") - With column - .AutoIncrement = True - .AutoIncrementSeed = 1 - .AutoIncrementStep = 1 - End With - - DTPorcentajeTemp.Columns.Add(column) - DTPorcentajeTemp.Columns.Add("CveMarca", GetType(Integer)) - DTPorcentajeTemp.Columns.Add("Marca", GetType(String)) - DTPorcentajeTemp.Columns.Add("PorcentajeProducto", GetType(Decimal)) - DTPorcentajeTemp.Columns.Add("PorcentajeProducto2", GetType(Decimal)) - DTPorcentajeTemp.Columns.Add("PorcentajeProducto3", GetType(Decimal)) - DTPorcentajeTemp.Columns.Add("ProntoPago", GetType(Decimal)) - DTPorcentajeTemp.Columns.Add("Plazo", GetType(Integer)) - DTPorcentajeTemp.Columns.Add("Estatus", GetType(String)) - DTPorcentajePrecios = DTPorcentajeTemp.Clone - End Sub - Private Sub CargaMarcas() - Dim ObjMarcas As New ClsProductosServicios - ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) - DdlMarcaPS.DataSource = ObjMarcas.DtResultados - ObjMarcas.Dispose() - DdlMarcaPS.DataBind() - DdlMarcaPS.Items.Insert(0, New ListItem("Seleccione", "-1")) - - CargaGridPorcentajes() - UpPorcentaje.Update() - End Sub - - Private Sub CargaGridPorcentajes() - Dim ObjPS As New ClsProductosServicios - - If ObjPS.GetPorcentajeMarcas(CveCliente) Then - DTPorcentajePrecios = ObjPS.DtResultados - GvM.DataSource = DTPorcentajePrecios - End If - ObjPS.Dispose() - - GvM.DataBind() - UppGrid.Update() - - End Sub - Private Sub CargaDTPorcentajePrecios(DtTemp As DataTable) - GvM.DataSource = DtTemp - GvM.DataBind() - - UppGrid.Update() - End Sub - - Private Sub LimpiaModalPorcentaje() - txtPorcentaje.Text = "" - txtPorcentaje2.Text = "" - txtPorcentaje3.Text = "" - txtProntoPago.Text = "" - txtPlazo.Text = "" - DdlMarcaPS.SelectedValue = "-1" - End Sub - - Protected Sub LbAgregarMarca_Click(sender As Object, e As EventArgs) Handles LbAgregarMarca.Click - If txtPorcentaje.Text.ToDecimal > 0 And txtPorcentaje.Text.ToDecimal <= 100 And txtPorcentaje2.Text.ToDecimal >= 0 And txtPorcentaje2.Text.ToDecimal <= 100 And txtPorcentaje3.Text.ToDecimal >= 0 And txtPorcentaje3.Text.ToDecimal <= 100 Then - - Dim registro As DataRow = DTPorcentajePrecios.NewRow - - registro.Item("No") = DTPorcentajePrecios.Rows.Count + 1 - registro.Item("CveMarca") = DdlMarcaPS.SelectedValue.ToEntero - registro.Item("Marca") = DdlMarcaPS.SelectedItem.Text - registro.Item("PorcentajeProducto") = txtPorcentaje.Text.ToDecimal - registro.Item("PorcentajeProducto2") = txtPorcentaje2.Text.ToDecimal - registro.Item("PorcentajeProducto3") = txtPorcentaje3.Text.ToDecimal - registro.Item("ProntoPago") = txtProntoPago.Text.ToDecimal - registro.Item("Plazo") = txtPlazo.Text.ToEntero - registro.Item("Estatus") = "I" - DTPorcentajePrecios.Rows.Add(registro) - CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - Else - Alert("El Porcentaje debe estar en un rango mayor a 0 y menor o igual a 100", TipoMensaje.MsgAdvertencia) - End If - - LimpiaModalPorcentaje() - End Sub - - Protected Sub DeleteRowMarca(sender As Object, e As EventArgs) - - Dim lnkRemove As LinkButton = DirectCast(sender, LinkButton) - - - If DTPorcentajePrecios.Rows.Count > 0 And lnkRemove.CommandArgument.ToString.Length > 0 Then - Dim i As Integer - i = lnkRemove.CommandArgument.ToString.ToEntero - Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", i)) - If Drs.Count > 0 Then - If CveCliente > 0 AndAlso Drs(0)("CveMarca").ToString.ToEntero > 0 Then - Drs(0)("Estatus") = "D" - Else - Drs(0).Delete() - End If - - End If - DTPorcentajePrecios.AcceptChanges() - End If - - GvM.EditIndex = -1 - - CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - - End Sub - - Protected Sub GvM_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvM.RowEditing - GvM.EditIndex = e.NewEditIndex - - CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - End Sub - Protected Sub GvM_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvM.RowCancelingEdit - GvM.EditIndex = -1 - - CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - End Sub - Protected Sub GvM_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvM.RowUpdating - - Dim PorcentajeProducto As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP").Text.ToDouble - Dim PorcentajeProducto2 As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP2").Text.ToDouble - Dim PorcentajeProducto3 As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP3").Text.ToDouble - Dim ProntoPago As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtProntoPagoP").Text.ToDouble - Dim Plazo As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPlazoP").Text.ToDouble - - If PorcentajeProducto > 0 And PorcentajeProducto <= 100 And PorcentajeProducto2 >= 0 And PorcentajeProducto2 <= 100 And PorcentajeProducto3 >= 0 And PorcentajeProducto3 <= 100 Then - Dim No As Integer = GvM.Rows(e.RowIndex).DataKey("No").ToEntero - - Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", No)) - - If Drs.Count > 0 Then - Drs(0)("PorcentajeProducto") = PorcentajeProducto - Drs(0)("PorcentajeProducto2") = PorcentajeProducto2 - Drs(0)("PorcentajeProducto3") = PorcentajeProducto3 - Drs(0)("ProntoPago") = ProntoPago - Drs(0)("Plazo") = Plazo - If Drs(0)("Estatus").ToString <> "I" Then - Drs(0)("Estatus") = "U" - End If - End If - - DTPorcentajePrecios.AcceptChanges() - GvM.EditIndex = -1 - - CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - Else - Alert("El Porcentaje debe estar en un rango mayor a 0 y menor o igual a 100", TipoMensaje.MsgAdvertencia) - End If - - End Sub - - Protected Sub BtnGuardarPorcentajesMarca_Click(sender As Object, e As EventArgs) Handles BtnGuardarPorcentajesMarca.Click - - Dim TieneError As Boolean = False - - Dim ObjPS As New ClsProductosServicios - ObjPS.IniciaTransacSQL() - - For Each Dr As DataRow In DTPorcentajePrecios.Rows - - If Dr("Estatus").ToString <> "" Then - - If Dr("Estatus").ToString = "I" Then - If Not ObjPS.AddPorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal, Dr("PorcentajeProducto2").ToString.ToDecimal, Dr("PorcentajeProducto3").ToString.ToDecimal, UsuarioActual.CveUsuario, Dr("ProntoPago").ToString.ToDecimal, Dr("Plazo").ToString.ToEntero) Then - TieneError = True - End If - ElseIf Dr("Estatus").ToString = "U" Then - If Not ObjPS.UpdatePorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal, Dr("PorcentajeProducto2").ToString.ToDecimal, Dr("PorcentajeProducto3").ToString.ToDecimal, Dr("ProntoPago").ToString.ToDecimal, Dr("Plazo").ToString.ToEntero) Then - TieneError = True - End If - ElseIf Dr("Estatus").ToString = "D" Then - If Not ObjPS.RemovePorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero) Then - TieneError = True - End If - End If - - End If - Next - - If TieneError Then - ObjPS.RollBack() - Else - ObjPS.Commit() - Alert("Los Porcentajes se guardaron correctamente.", TipoMensaje.MsgInformacion) - RegistraScript("$('#DivPorcentajeMarcas').modal('hide')", "hidemodal") - End If - - ObjPS.Dispose() - - End Sub -#End Region - -#Region "PORCENTAJE PRECIO DE PRODUCTOS" - Private Sub LnkPorcentajePrecios_Click(sender As Object, e As EventArgs) Handles LnkPorcentajePrecios.Click - RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajePrecios")) - - CreaDT2() - - TxtPorcentajePS.Attributes.Add("onchange", String.Format("FnCambiaPorcentaje({0});", "5")) - CargaPorcentajesProductos() - LimpiaModalPorcentaje2() - End Sub - Private Sub CreaDT2() - Dim DTPorcentajeTemp As New DataTable - - Dim column As DataColumn = New DataColumn("No") - column.DataType = Type.GetType("System.Int32") - With column - .AutoIncrement = True - .AutoIncrementSeed = 1 - .AutoIncrementStep = 1 - End With - - DTPorcentajeTemp.Columns.Add(column) - DTPorcentajeTemp.Columns.Add("CvePS", GetType(Integer)) - DTPorcentajeTemp.Columns.Add("Producto", GetType(String)) - DTPorcentajeTemp.Columns.Add("PrecioG", GetType(Decimal)) - DTPorcentajeTemp.Columns.Add("PorcentajeProducto", GetType(Decimal)) - DTPorcentajeTemp.Columns.Add("PrecioA", GetType(Decimal)) - DTPorcentajeTemp.Columns.Add("Estatus", GetType(String)) - DTPorcentajePrecios = DTPorcentajeTemp.Clone - End Sub - Private Sub CargaPorcentajesProductos() - 'Llenar el dropdownlist de Secciones - If UsuarioActual.CveEmpresa = 66 Then - DdlClasificacion2.DataSource = GlobalDTSubFamilias(UsuarioActual.CveEmpresa).FiltraParametros("", Orderby:="Clasificacion") - Else - Dim ObjClasificaciones As New ClsClasificaciones - If ObjClasificaciones.GetClasificacionesExistencias(UsuarioActual.CveEmpresa) Then - DdlClasificacion2.DataSource = ObjClasificaciones.DtResultados - End If - ObjClasificaciones.Dispose() - End If - DdlClasificacion2.DataBind() - - CargaPS() - CargaGridPorcentajes2() - - UpPorcentajeP.Update() - End Sub - Private Sub CargaPS() - DdlProducto2.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") - - If UsuarioActual.CveEmpresa = 66 Then - DdlProducto2.ddlWS.Attributes.Add("data-pagina", "Inventarios") - End If - - If Not DdlProducto2.UsaWebService AndAlso CType(DdlProducto2.DataSource, DataTable) Is Nothing Then - DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoPS = 2") - - DdlProducto2.DataBind() - - DdlProducto2.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) - End If - - End Sub - - Protected Sub DdlProducto2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlProducto2.selectedindexchange - DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero, DdlProducto2) - End Sub - Private Sub DdlProducto2IndexChange(CvePSParametro As Integer, Ddl As ADServerControl.Dropdownlost) - Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("") - - If drPS IsNot Nothing Then - Dim Precio = drPS("Precio").ToString.ToDouble - LbPrecioG.Text = Precio.FormatoNumero() - LbPrecioA.Text = ((Precio * TxtPorcentajePS.Text.ToDecimal) / 100).FormatoNumero - End If - End Sub - - Private Sub CargaGridPorcentajes2() - Dim ObjPS As New ClsProductosServicios - - If ObjPS.GetPorcentajeProductos(CveCliente) Then - DTPorcentajePrecios = ObjPS.DtResultados - GvP.DataSource = DTPorcentajePrecios - End If - ObjPS.Dispose() - - GvP.DataBind() - UpPorcentajePS.Update() - - End Sub - Private Sub CargaDTPorcentajePrecios2(DtTemp As DataTable) - GvP.DataSource = DtTemp - GvP.DataBind() - - UpPorcentajePS.Update() - End Sub - - Private Sub LimpiaModalPorcentaje2() - TxtPorcentajePS.Text = "" - DdlClasificacion2.SelectedValue = "-1" - DdlProducto2.SelectedText = "" - End Sub - - Protected Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click - - If DdlProducto2.SelectedText <> "" Then - If TxtPorcentajePS.Text.ToDecimal >= 0 And TxtPorcentajePS.Text.ToDecimal <= 100 Then - - Dim registro As DataRow = DTPorcentajePrecios.NewRow - - registro.Item("No") = DTPorcentajePrecios.Rows.Count + 1 - registro.Item("CvePS") = DdlProducto2.SelectedValue.ToEntero - registro.Item("Producto") = DdlProducto2.SelectedText - registro.Item("PrecioG") = LbPrecioG.Text.ToDecimal - registro.Item("PrecioA") = LbPrecioG.Text.ToDecimal * TxtPorcentajePS.Text.ToDecimal / 100 - registro.Item("PorcentajeProducto") = TxtPorcentajePS.Text.ToDecimal - registro.Item("Estatus") = "I" - DTPorcentajePrecios.Rows.Add(registro) - CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - Else - Alert("El Porcentaje debe estar en un rango entre 0 y 100", TipoMensaje.MsgAdvertencia) - End If - Else - Alert("El campo ''Producto'' es necesario, por favor ingréselo.", TipoMensaje.MsgAdvertencia) - End If - - LimpiaModalPorcentaje() - End Sub - - Protected Sub DeleteRow(sender As Object, e As EventArgs) - - Dim lnkRemove As LinkButton = DirectCast(sender, LinkButton) - - - If DTPorcentajePrecios.Rows.Count > 0 And lnkRemove.CommandArgument.ToString.Length > 0 Then - Dim i As Integer - i = lnkRemove.CommandArgument.ToString.ToEntero - Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", i)) - If Drs.Count > 0 Then - If CveCliente > 0 AndAlso Drs(0)("CvePS").ToString.ToEntero > 0 Then - Drs(0)("Estatus") = "D" - Else - Drs(0).Delete() - End If - - End If - DTPorcentajePrecios.AcceptChanges() - End If - - GvP.EditIndex = -1 - - CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - - End Sub - - Protected Sub GvP_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvP.RowEditing - GvP.EditIndex = e.NewEditIndex - - CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - End Sub - Protected Sub GvP_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvP.RowCancelingEdit - GvP.EditIndex = -1 - - CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - End Sub - Protected Sub GvP_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvP.RowUpdating - - Dim PorcentajeProducto As Double = GvP.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP").Text.ToDouble - - If PorcentajeProducto >= 0 And PorcentajeProducto <= 100 Then - Dim No As Integer = GvP.Rows(e.RowIndex).DataKey("No").ToEntero - - Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", No)) - - If Drs.Count > 0 Then - Drs(0)("PorcentajeProducto") = PorcentajeProducto - Drs(0)("PrecioA") = Drs(0)("PrecioG").ToString.ToDouble * PorcentajeProducto / 100 - If Drs(0)("Estatus").ToString <> "I" Then - Drs(0)("Estatus") = "U" - End If - End If - - DTPorcentajePrecios.AcceptChanges() - GvP.EditIndex = -1 - - CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) - Else - Alert("El Porcentaje debe estar en un rango entre 0 y 100", TipoMensaje.MsgAdvertencia) - End If - - End Sub - - Protected Sub BtnGuardarPorcentajes_Click(sender As Object, e As EventArgs) Handles BtnGuardarPorcentajes.Click - - Dim TieneError As Boolean = False - - Dim ObjPS As New ClsProductosServicios - ObjPS.IniciaTransacSQL() - - For Each Dr As DataRow In DTPorcentajePrecios.Rows - - If Dr("Estatus").ToString <> "" Then - - If Dr("Estatus").ToString = "I" Then - If Not ObjPS.AddPorcentajeProductos(CveCliente, Dr("CvePS").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal, UsuarioActual.CveUsuario) Then - TieneError = True - End If - ElseIf Dr("Estatus").ToString = "U" Then - If Not ObjPS.UpdatePorcentajeProductos(CveCliente, Dr("CvePS").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal) Then - TieneError = True - End If - ElseIf Dr("Estatus").ToString = "D" Then - If Not ObjPS.RemovePorcentajeProductos(CveCliente, Dr("CvePS").ToString.ToEntero) Then - TieneError = True - End If - End If - - End If - Next - - If TieneError Then - ObjPS.RollBack() - Else - ObjPS.Commit() - Alert("Los Porcentajes se guardaron correctamente.", TipoMensaje.MsgInformacion) - RegistraScript("$('#DivPorcentajePrecios').modal('hide')", "hidemodal") - End If - - ObjPS.Dispose() - - End Sub - - Protected Sub BtnCambiaPorcentaje_Click(sender As Object, e As EventArgs) - DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero, DdlProducto2) - End Sub -#End Region - -#Region " A C U M U L A D O R E S" - - - Protected Sub LnkFacturaUsadosCargos_Click(sender As Object, e As EventArgs) - 'CveVentaNota = 0 - - 'Dim Cargos As Decimal = 0D - 'Dim Iva As Decimal = 0D - - 'For Each GvRow As GridViewRow In GvAcum.Rows - - ' If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkCargo").Checked Then - ' Cargos = Cargos + GvRow.DataKey("ImporteCargo").ToDecimal - ' End If - 'Next - - 'Dim CvePS As Integer = UsuarioActual.Empresa.Funcionalidad(534).ToEntero 'CvePS Distruibuidor Cargo Nota - 'Dim CveUnidadMedida As Integer - 'Dim CveClasificacion As Integer - - 'If CvePS > 0 Then - - ' If Cargos > 0 Then - - ' CveUnidadMedida = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveUnidadMedida").ToString.ToEntero - ' CveClasificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveClasificacion").ToString.ToEntero - ' Iva = Cargos * 0.16D - - ' If GenerarNotaCredito(CvePS, 1, CveUnidadMedida, Cargos, Iva, "Clientes/Usados", CveClasificacion) Then - ' Alert($"LA nota de crédito fue generada correctamente {SerieNotaAcumulador}-{FolioNotaAcumulador}") - ' Else - ' Alert("Se presento un error al generar la nota de creédito", TipoMensaje.MsgError) - ' End If - ' End If - - 'Else - ' Alert("No esta asignada la funcionalidad CvePS Distruibuidor Cargo Nota") - 'End If - - CreaObjetosVenta(1) - - 'If ObjFactura.CveCliente > 0 Then - ' If TmpDT.Rows.Count > 0 Then - ' Dim Retorno = ObjFactura.EmitirFactura(false) - ' For Each Mensaje In Retorno.Mensajes - ' Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion)) - ' Next - ' End If - 'End If - - CargaUsados() - - End Sub - Protected Sub LnkFacturaUsadosBonificacion_Click(sender As Object, e As EventArgs) - - 'CveVentaNota = 0 - 'Dim Bonificacion As Decimal = 0D - 'Dim Iva As Decimal = 0D - - 'For Each GvRow As GridViewRow In GvAcum.Rows - ' If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkBonificacion").Checked Then - ' Bonificacion = Bonificacion + GvRow.DataKey("ImporteBonificacion").ToDecimal - ' End If - 'Next - - - 'Dim CvePS As Integer = UsuarioActual.Empresa.Funcionalidad(534).ToEntero 'CvePS Distruibuidor Bonificación Nota - 'Dim CveUnidadMedida As Integer - 'Dim CveClasificacion As Integer - 'If CvePS > 0 Then - ' If Bonificacion > 0 Then - - ' CveUnidadMedida = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveUnidadMedida").ToString.ToEntero - ' CveClasificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveClasificacion").ToString.ToEntero - ' Iva = Bonificacion * 0.16D - - ' If GenerarNotaCredito(CvePS, 2, CveUnidadMedida, Bonificacion, Iva, "Clientes/Usados", CveClasificacion) Then - ' Alert($"LA nota de crédito fue generada correctamente {SerieNotaAcumulador}-{FolioNotaAcumulador}") - ' Else - ' Alert("Se presento un error al generar la nota de creédito", TipoMensaje.MsgError) - ' End If - - ' End If - - 'Else - ' Alert("No esta asignada la funcionalidad CvePS Distruibuidor Bonificación Nota") - 'End If - - CreaObjetosVenta(2) - - If ObjFactura.CveCliente > 0 Then - If TmpDT.Rows.Count > 0 Then - Dim Retorno = ObjFactura.EmitirFactura(False) - For Each Mensaje In Retorno.Mensajes - Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion)) - Next - End If - End If - - Alert("Listo") - - CargaUsados() - - - End Sub - - - Function FolioNotaCredito(Tipo As Integer) As Boolean - - FolioNotaAcumulador = 0 - SerieNotaAcumulador = "" - Dim Respuesta As Boolean = False - - Dim ObjFolios As New ClsGralFolios() - - Dim DTSucursales As DataTable = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1).FiltraParametros("EsSucursal = True ") - - If DTSucursales.Rows.Count > 0 Then - - If ObjFolios.GetFolios("RNC", UsuarioActual.CveEmpresa) Then - Dim CveSubProyecto As Integer = DTSucursales.FiltroPrimeroValor("CveSubProyecto", "").ToEntero - Dim DT As DataTable - If CveSubProyecto > 0 Then - DT = ObjFolios.DtResultados.FiltraParametros(" Estado = 'Activo' AND LEN(Serie) > 0 AND CveSubProyecto = " & CveSubProyecto) - Else - DT = ObjFolios.DtResultados.FiltraParametros(" Estado = 'Activo' AND LEN(Serie) > 0 ") - End If - - If DT.Rows.Count > 0 Then - FolioNotaAcumulador = DT.Rows(0)("FActual").ToString.ToEntero - SerieNotaAcumulador = DT.Rows(0)("Serie").ToString - Respuesta = True - End If - - End If - End If - - ObjFolios.Dispose() - - Return Respuesta - - End Function - - Private Sub GvAcum_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvAcum.RowDataBound - - If e.Row.RowType = DataControlRowType.DataRow Then - - If e.Row.DataKey("CveConcepto").ToEntero = 1 Then - - Dim FacturadoCargo As Boolean = Boolean.Parse(e.Row.DataKey("FacturadoCargo")) - Dim FacturadoBonificacion As Boolean = Boolean.Parse(e.Row.DataKey("FacturadoBonificacion")) - - If FacturadoCargo Then - e.Row.FCCheckBox("ChkCargo").Checked = False - e.Row.FCCheckBox("ChkCargo").Visible = False - Else - e.Row.FCCheckBox("ChkCargo").Checked = False + End Sub + + Protected Sub GvDocumentosFirma_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDocumentosCliente.RowDataBound + + + If e.Row.RowType = DataControlRowType.DataRow Then + + Dim Adjunto As String = e.Row.DBCampo("Adjunto").ToString + Dim ImgDownLoadFormato As LinkButton = e.Row.FCLinkButton("ImgDownLoadFormato") + 'Dim ImgDownLoad As Literal = e.Row.FCLiteral("ImgDownLoad") + Dim LnkDownLoadDoc As LinkButton = e.Row.FCLinkButton("LnkDownLoadDoc") + Dim ImgRequired As Literal = e.Row.FCLiteral("ImgRequired") + Dim txtFechaLimite As TextBox = e.Row.FCTextBox("TxtFechaLimite") + Dim requerido As Boolean = If(e.Row.DBCampo("Requerido").ToUpper = "TRUE", True, False) + Dim chkEstatus As CheckBox = e.Row.FCCheckBox("chkEstatus") + Dim documentacionFormato As String = e.Row.DBCampo("DocumentacionFormato").ToString + Dim Documentacion As String = e.Row.DBCampo("Documentacion").ToString + Dim _CveDocumentacion As Integer = e.Row.DBCampo("CveDocumentacion").ToString.ToEntero + Dim separado As Char() = ".".ToString.ToCharArray + Dim array() As String = Adjunto.Split(separado) + Dim extencion As String = "" + Dim existeAdjunto As Boolean = False + Dim TxtFechaVigencia As TextBox = e.Row.FCTextBox("TxtFechaVigencia") + + Dim imgCalendario As LinkButton = e.Row.FCLinkButton("imgCalendario") + + + + + + + ' FechaVigencia + + Dim DiasLimite As Integer = e.Row.DataKey("DiasLimite").ToString.ToEntero + Dim AplicaDiasLimite As Boolean = If(e.Row.DataKey("AplicaDiasLimite").ToString = "1", True, False) + Dim AplicaFechaVencimiento As Boolean = If(e.Row.DataKey("AplicaFechaVencimiento").ToString = "1", True, False) + + txtFechaLimite.Visible = If(AplicaDiasLimite, True, False) + TxtFechaVigencia.Visible = If(AplicaFechaVencimiento, True, False) + imgCalendario.Visible = If(AplicaFechaVencimiento, True, False) + + + 'Dim scripMascara = " $('#" & TxtFechaVigencia.ClientID & "').mask('00/00/0000');" + ' RegistraScript(scripMascara) + + If TxtFechaVigencia.Text.Length = 10 Then + TxtFechaVigencia.Text = TxtFechaVigencia.Text.ToDate.ToString("dd/MM/yyyy") + End If + + If array.Length > 0 Then + extencion = array(array.Length - 1) + End If + + If e.Row.DBCampo("Estatus").ToString.ToEntero = 1 Then + chkEstatus.Checked = True + Else + chkEstatus.Checked = False + End If + + If documentacionFormato = "" Then + 'ImgDownLoadFormato.Visible = False + LnkDownLoadDoc.Visible = False + Else + Dim linkDescarga = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "/Formatos/" & CveDocumentacion & "" & documentacionFormato + LnkDownLoadDoc.Visible = True + End If + + txtFechaLimite.Text = e.Row.DBCampo("FechaLimite").ToString.ToDate.ToString("dd/MM/yyyy") + + If Adjunto.Trim.Length > 0 Then + + Dim linkDescarga = "/Empresas/" & UsuarioActual.Empresa.CveEmpresa & "\DocElectronica\Clientes\" & CveCliente & "/" & Adjunto + Dim linkDescargaArchivo = UsuarioActual.Empresa.Ruta & "\DocElectronica\Clientes\" & CveCliente & "/" & Adjunto + + If File.Exists(linkDescargaArchivo) Then + + LnkDownLoadDoc.Visible = True + ScriptManager.GetCurrent(Me).RegisterPostBackControl(LnkDownLoadDoc) + 'If extencion.Length > 0 Then + ' ImgDownLoad.Text = String.Format(" ", linkDescarga, CveCliente & Documentacion & "." & extencion) + 'Else + ' ImgDownLoad.Text = String.Format(" ", linkDescarga, CveCliente & Documentacion) + 'End If + Else + LnkDownLoadDoc.Visible = False + End If + Else + LnkDownLoadDoc.Visible = False + End If + + If requerido Then + ImgRequired.Text = " " + Else + ' ImgRequired.Text = " " + End If + + If UsuarioActual.TienePermisoProceso(248) And e.Row.DBCampo("Estatus").ToString.ToEntero = 1 And LnkDownLoadDoc.Visible Then + e.Row.FCLinkButton("LnkGvDocumentosEliminar").Visible = True + End If + + End If + + End Sub + Public Sub DownLoadFormato_ClickDocumentacion(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + Dim CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToString.ToEntero + Dim DocumentacionFormato As String = CveDocumentacion & "_" & GvRow.DataKey("DocumentacionFormato") + + DescarFormato(DocumentacionFormato) + + End Sub + Public Sub DescarFormato(documento As String) + + Dim PathRoot As String = Server.MapPath("/") + Dim PathSource As String + Dim pathDesti As String + + PathSource = UsuarioActual.Empresa.Ruta & "Formatos\" & documento + pathDesti = PathRoot & "Temp\" & CveCliente & documento + + If File.Exists(pathDesti) Then + File.Delete(pathDesti) + End If + + File.Copy(PathSource, pathDesti) + + Dim objDoc As New clsGemBoxDocument(pathDesti) + Dim objRH As New ClsRH + Dim FechaActual As String = Now.Day.ToString("0#") & " de " & CultureInfo.CurrentCulture.DateTimeFormat.GetMonthName(1).ToString & " del " & Now.Year.ToString() + + + objDoc.SustituirTags(objRH.GetDatosTagsDocumentos(-1, UsuarioActual.CveEmpresa)) ' Pendiente + objRH.Dispose() + + + + objDoc.Guardar(pathDesti) + + Dim fileinfo As New FileInfo(pathDesti) + + Dim baseUrl As String = Request.Url.GetLeftPart(UriPartial.Authority) + baseUrl = baseUrl & "/temp/" & fileinfo.Name + + RegistraDescargaJavaScript(baseUrl) + + End Sub + + + + 'Private Function GetDatosTagsDocumentos() As List(Of TagsDocumentos) + ' Dim ListaTagsDocumentost = New List(Of TagsDocumentos) + + ' If CvePersonal <> -1 Then + ' Dim objRH As New ClsRH + + + + ' If objRH.PersonalReclutamientoGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Nombres}", objRH.DtResultados(0)("Nombres").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{APaterno}", objRH.DtResultados(0)("APaterno").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{AMaterno}", objRH.DtResultados(0)("AMaterno").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{RFC}", objRH.DtResultados(0)("RFC").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreCompleto}", Cliente)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Estatura}", objRH.DtResultados(0)("Estatura").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Peso}", objRH.DtResultados(0)("Peso").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{LugarNacimiento}", objRH.DtResultados(0)("LugarNacimiento").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Edad}", objRH.DtResultados(0)("Edad").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreTelEmergencia}", objRH.DtResultados(0)("NombreTelEmergencia").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{TipoSangre}", objRH.DtResultados(0)("TipoSangre").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Vivienda}", objRH.DtResultados(0)("Vivienda").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{ViviendaDueno}", objRH.DtResultados(0)("ViviendaDueno").ToString)) + + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{CreditoInfonavit}", objRH.DtResultados(0)("CreditoInfonavit").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{RentaMensual}", objRH.DtResultados(0)("RentaMensual").ToString.ToDecimal.ToString("###,###,###.00"))) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{TransportePublico}", objRH.DtResultados(0)("TransportePublico").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormente}", objRH.DtResultados(0)("TrabajadoAnteriormente").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormenteObservaciones}", objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{ParientesEmpresa}", objRH.DtResultados(0)("ParientesEmpresa").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelito}", objRH.DtResultados(0)("AcusadoDelito").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelitoObservaciones}", objRH.DtResultados(0)("AcusadoDelitoObservaciones").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Calle}", objRH.DtResultados(0)("Calle").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Colonia}", objRH.DtResultados(0)("Colonia").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{CP}", objRH.DtResultados(0)("CP").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Telefono}", objRH.DtResultados(0)("Telefono").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Celular}", objRH.DtResultados(0)("Celular").ToString)) + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Correo}", objRH.DtResultados(0)("Correo").ToString)) + + + ' 'If Not IsDBNull(objRH.DtResultados(0)("CveSucursal")) Then + + ' ' ListaTagsDocumentost.Add(New TagsDocumentos("{CveSucursal}", DDLSucursal4.Text)) + ' 'End If + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{NumeroSS}", objRH.DtResultados(0)("NumeroSS").ToString)) + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Licencia}", objRH.DtResultados(0)("Licencia").ToString)) + + + + + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{CartillaMilitar}", objRH.DtResultados(0)("CartillaMilitar").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{CURP}", objRH.DtResultados(0)("CURP").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{AutorizaAntidoping}", objRH.DtResultados(0)("AutorizaAntidoping").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Observaciones}", objRH.DtResultados(0)("Observaciones").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaIngreso}", objRH.DtResultados(0)("FechaIngreso").ToString.ToDate.ToShortDateString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString.ToDate.ToShortDateString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Puesto}", objRH.DtResultados(0)("Puesto").ToString)) + + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{CUIP}", "")) + ' ListaTagsDocumentost.Add(New TagsDocumentos("{Denominacion}", "")) + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaNacimiento}", objRH.DtResultados(0)("FechaNacimiento").ToString.ToDate.ToString("dd/MM/yyyy"))) + + + ' Dim fechaActual As String = " " & Now.Day & " del mes " & Now.Month & " del año " & Now.Year + + ' Dim FechaActualDF As String = Now.ToString("dd/MM/yyyy") + + ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActual}", fechaActual)) + ' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActualDF}", FechaActualDF)) + ' End If + + + ' objRH.Dispose() + ' End If + + ' Return ListaTagsDocumentost + 'End Function + + + + + + + + ''Private Function GetDatosTagsDocumentos() As List(Of TagsDocumentos) + '' Dim ListaTagsDocumentost = New List(Of TagsDocumentos) + + '' If CvePersonal <> -1 Then + '' Dim objRH As New ClsRH + + + + '' If objRH.PersonalReclutamientoGet(CvePersonal, UsuarioActual.Empresa.CveEmpresa) Then + + '' If Not IsDBNull(objRH.DtResultados(0)("Nombres")) Then + '' ListaTagsDocumentost.Add(New TagsDocumentos("{Nombres}", objRH.DtResultados(0)("Nombres").ToString)) + '' End If + + '' If Not objRH.DtResultados(0)("APaterno") Is Nothing Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{APaterno}", objRH.DtResultados(0)("APaterno").ToString)) + '' End If + + '' If Not objRH.DtResultados(0)("AMaterno") Is Nothing Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{AMaterno}", objRH.DtResultados(0)("AMaterno").ToString)) + '' End If + + '' If Not objRH.DtResultados(0)("NombreCompleto") Is Nothing Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreCompleto}", objRH.DtResultados(0)("NombreCompleto").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("Estatura")) Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{Estatura}", objRH.DtResultados(0)("Estatura").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("Peso")) Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{Peso}", objRH.DtResultados(0)("Peso").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("LugarNacimiento")) Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{LugarNacimiento}", objRH.DtResultados(0)("LugarNacimiento").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("Edad")) Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{Edad}", objRH.DtResultados(0)("Edad").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("NombreTelEmergencia")) Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{NombreTelEmergencia}", objRH.DtResultados(0)("NombreTelEmergencia").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("TipoSangre")) Then + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{TipoSangre}", objRH.DtResultados(0)("TipoSangre").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("Vivienda")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Vivienda}", objRH.DtResultados(0)("Vivienda").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("ViviendaDueno")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{ViviendaDueno}", objRH.DtResultados(0)("ViviendaDueno").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("CreditoInfonavit")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CreditoInfonavit}", objRH.DtResultados(0)("CreditoInfonavit").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("RentaMensual")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{RentaMensual}", objRH.DtResultados(0)("RentaMensual").ToString.ToDecimal.ToString("###,###,###.00"))) + + '' If Not IsDBNull(objRH.DtResultados(0)("TransportePublico")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TransportePublico}", objRH.DtResultados(0)("TransportePublico").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("TrabajadoAnteriormente")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormente}", objRH.DtResultados(0)("TrabajadoAnteriormente").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{TrabajadoAnteriormenteObservaciones}", objRH.DtResultados(0)("TrabajadoAnteriormenteObservaciones").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("ParientesEmpresa")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{ParientesEmpresa}", objRH.DtResultados(0)("ParientesEmpresa").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("AcusadoDelito")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelito}", objRH.DtResultados(0)("AcusadoDelito").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("AcusadoDelitoObservaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AcusadoDelitoObservaciones}", objRH.DtResultados(0)("AcusadoDelitoObservaciones").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Direccion")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Direccion}", objRH.DtResultados(0)("Direccion").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Calle")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Calle}", objRH.DtResultados(0)("Calle").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Colonia")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Colonia}", objRH.DtResultados(0)("Colonia").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("CP")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CP}", objRH.DtResultados(0)("CP").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Telefono")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Telefono}", objRH.DtResultados(0)("Telefono").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Celular")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Celular}", objRH.DtResultados(0)("Celular").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Correo")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Correo}", objRH.DtResultados(0)("Correo").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("CveSucursal")) Then + + '' ' ListaTagsDocumentost.Add(New TagsDocumentos("{CveSucursal}", DDLSucursal4.Text)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("NumeroSS")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{NumeroSS}", objRH.DtResultados(0)("NumeroSS").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Licencia")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Licencia}", objRH.DtResultados(0)("Licencia").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("CartillaMilitar")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CartillaMilitar}", objRH.DtResultados(0)("CartillaMilitar").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("CURP")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CURP}", objRH.DtResultados(0)("CURP").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("AutorizaAntidoping")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{AutorizaAntidoping}", objRH.DtResultados(0)("AutorizaAntidoping").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Observaciones")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Observaciones}", objRH.DtResultados(0)("Observaciones").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("CredencialElector")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{CredencialElector}", objRH.DtResultados(0)("CredencialElector").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Sucursal")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Sucursal}", objRH.DtResultados(0)("Sucursal").ToString)) + + '' If Not IsDBNull(objRH.DtResultados(0)("Puesto")) Then ListaTagsDocumentost.Add(New TagsDocumentos("{Puesto}", objRH.DtResultados(0)("Puesto").ToString)) + + '' 'If Not IsDBNull(objRH.DtResultados(0)("InformacionFidedigno")) Then chkFidedigna4.Checked = objRH.DtResultados(0)("InformacionFidedigno") + '' ListaTagsDocumentost.Add(New TagsDocumentos("{InformacionFidedigno}", objRH.DtResultados(0)("InformacionFidedigno").ToString)) + '' End If + + '' If Not IsDBNull(objRH.DtResultados(0)("FechaNacimiento")) Then + '' ListaTagsDocumentost.Add(New TagsDocumentos("{InformacionFidedigno}", objRH.DtResultados(0)("FechaNacimiento").ToString.ToDate.ToString("dd/MM/yyyy"))) + '' End If + + + '' Dim fechaActual As String = " " & Now.Day & " del mes " & Now.Month & " del año " & Now.Year + '' Dim FechaActualDF As String = Now.ToString("dd/MM/yyyy") + + '' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActual}", fechaActual)) + '' ListaTagsDocumentost.Add(New TagsDocumentos("{FechaActualDF}", FechaActualDF)) + + + '' objRH.Dispose() + '' End If + + '' Return ListaTagsDocumentost + ''End Function + Private Sub RegistraDescargaJavaScript(baseUrl As String) + + RegistraScript("Download('" & baseUrl & "')") + + End Sub + +#End Region + +#Region "D O C U M E N T O S V E N T A S" + + Private Sub CargaDocumentosVenta(tCveCliente As Integer) + Dim objInv As New ClsEdocumentacion + + If objInv.DocumentacionElectronicaGet(-1, tCveCliente, -1, UsuarioActual.CveEmpresa, 14) Then + GvDocsVentas.DataSource = objInv.DtResultados + If objInv.DtResultados.Rows.Count > 0 Then BtnGuardarDocumentacion.Visible = True + Else + GvDocsVentas.DataSource = Nothing + End If + + objInv.Dispose() + GvDocsVentas.DataBind() + UpDocumentacion.Update() + + End Sub + + Private Sub BtnGuardarDocumentación_Click(sender As Object, e As EventArgs) Handles BtnGuardarDocumentacion.Click + Dim objDoc As New ClsEdocumentacion() + objDoc.IniciaTransacSQL() + Dim HuboError As Boolean = False + + If CveCliente <= 0 Then + For Each gvr As GridViewRow In GvDocsVentas.Rows + If gvr.FCCheckBox("ChkDoc").Checked Then + + If objDoc.DocumentacionElectronicaAdd(gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, Now, Observacion2:=gvr.FCTextBox("TxtObs2").Text) <= 0 Then HuboError = True + + End If + + Next + + Else + For Each gvr As GridViewRow In GvDocsVentas.Rows + 'sino está registrada y se selecciona, se va a insertar + If gvr.DataKey("CveDocumentacionElectronica").ToEntero <= 0 AndAlso gvr.FCCheckBox("ChkDoc").Checked Then + If objDoc.DocumentacionElectronicaAdd(gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, Now, Observacion2:=gvr.FCTextBox("TxtObs2").Text) <= 0 Then HuboError = True + Else + ', Observacion2:=gvr.FCTextBox("TxtObs2").Text + If Not objDoc.DocumentacionElectronicaUpdate(gvr.DataKey("CveDocumentacionElectronica").ToEntero, gvr.DataKey("CveDocumentacion").ToEntero, -1, CveCliente, -1, 1, gvr.FCTextBox("TxtObs").Text, "", UsuarioActual.CveUsuario, gvr.DataKey("FechaLimite").ToDate, Observacion2:=gvr.FCTextBox("TxtObs2").Text) Then HuboError = True + End If + + 'si ya estaba registrada y no se selecciona, se va a insertar + If gvr.DataKey("CveDocumentacionElectronica").ToEntero > 0 AndAlso Not gvr.FCCheckBox("ChkDoc").Checked Then + If Not objDoc.DocumentacionElectronicaRemove(gvr.DataKey("CveDocumentacionElectronica").ToEntero, -1) Then HuboError = True + End If + + Next + + End If + + + If Not HuboError Then + Alert("Documentación guardada", TipoMensaje.MsgInformacion) + objDoc.Commit() + Else + objDoc.RollBack() + End If + objDoc.Dispose() + + End Sub + + Public Sub Upload_ClickDocumentacion(sender As Object, e As EventArgs) + RegistraScript("$('#ModalCXCDocumento').modal({ backdrop: 'static', keyboard: false});") + End Sub + + Protected Sub BtnModalCXCDocumentoClienteUpload_Click(sender As Object, e As EventArgs) Handles BtnModalCXCDocumentoClienteUpload.Click + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim _CveDocumentacionElectronica As Integer = GvRow.DataKey("CveDocumentacion").ToEntero + Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToEntero + Dim _Obserbaciones As String = GvRow.FCTextBox("TxtObservaciones").Text.Trim + Dim _FechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate + + SubirComprobante(_CveDocumentacionElectronica, _CveDocumentacion, _Obserbaciones, _FechaLimite) + 'CargaDocs() + + End Sub + + Private Function SubirComprobante(_CveDocumentacionElecronica As Integer, _CveDocumentacion As Integer, _Obserbaciones As String, _FechaLimite As Date) As Boolean + + Dim Respuesta As Boolean = False + Dim RutaDirectorio As String = String.Format("{0}{1}", UsuarioActual.Empresa.Ruta, "Clientes\") + + Dim filesgral As List(Of Archivo) = TxtCXCDocumentoCliente.getfiles().Archivos + Dim filemove As String = "" + Dim Comprobante As String = "" + Dim ShortFileName As String = "" + + + If filesgral.Count > 0 Then + + Dim RutaArchivo As String + + For Each fileItem As Archivo In filesgral + + Dim edoc As New ClsEdocumentacion + + Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "") + filemove = fileItem.FileUrl + RutaArchivo = String.Format("{0}{1}_{2}", RutaDirectorio, CveCliente, _CveDocumentacion) + RutaArchivo = String.Format("{0}.{1}", RutaArchivo, fileItem.Extencion) + + Try + If Not Directory.Exists(RutaDirectorio) Then + Directory.CreateDirectory(RutaDirectorio) + End If + + If File.Exists(RutaArchivo) Then + File.Delete(RutaArchivo) + End If + + File.Move(filemove, RutaArchivo) + Respuesta = True + ShortFileName = System.IO.Path.GetFileName(RutaArchivo) + + If edoc.DocumentacionElectronicaUpdate(_CveDocumentacionElecronica, _CveDocumentacion, -1, CveCliente, -1, 1, _Obserbaciones, ShortFileName, UsuarioActual.CveEmpresa, _FechaLimite) Then + + + End If + + Catch ex As Exception + + OnError("Error al intentar guardar archivo ", ex) + Respuesta = False + RutaArchivo = "-1" + End Try + Anexo.Text = "" + + edoc.Dispose() + Next + Else + Respuesta = True + End If + + + + UpModalCXCClienteDocumento.Update() + Return Respuesta + + End Function + + Public Sub Update_ClickDocumentacion(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + Dim activo As Boolean = False + + Dim _CveDocumentacion As Integer = GvRow.DataKey("CveDocumentacion").ToEntero + Dim _Adjunto As String = GvRow.DataKey("Adjunto").ToString + Dim _fechaLimite As Date = GvRow.FCTextBox("TxtFechaLimite").Text.ToDate + + Dim observaciones As String = GvRow.FCTextBox("TxtObservaciones").Text ' DirectCast(GvRow.FindControl("TxtObservaciones"), TextBox).Text + 'Dim DDLEstatus As DropDownList = DirectCast(GvRow.FindControl("DDLEstatus"), DropDownList) + Dim chkCompleto As CheckBox = GvRow.FCCheckBox("chkEstatus") + Dim _Estatus As Integer + If chkCompleto.Checked Then _Estatus = 1 Else _Estatus = 0 + + + Dim objRH As New ClsEdocumentacion + + If Not GvRow.DataKey("CveDocumentacionElectronica").ToEntero = -1 Then + If objRH.DocumentacionElectronicaUpdate(GvRow.DataKey("CveDocumentacionElectronica").ToEntero, _CveDocumentacion, -1, CveCliente, -1, _Estatus, observaciones, _Adjunto, UsuarioActual.CveUsuario, GvRow.FCTextBox("TxtFechaLimite").Text.ToDate) Then + Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) + End If + Else + If objRH.DocumentacionElectronicaAdd(_CveDocumentacion, -1, CveCliente, -1, _Estatus, observaciones, _Adjunto, UsuarioActual.CveUsuario, GvRow.FCTextBox("TxtFechaLimite").Text.ToDate) > 0 Then + Alert("Documento actualizado correctamente.", TipoMensaje.MsgInformacion) + End If + End If + + objRH.Dispose() + + End Sub + + +#End Region + +#Region "PERSONA FISICA" + Protected Sub LnkPersonaFisica_Click(sender As Object, e As EventArgs) + RegistraScript("$('#DivModalPersonaFisica').modal();") + End Sub + Protected Sub LnkActualizarPersonaFisica_Click(sender As Object, e As EventArgs) + Dim ObjCliente As New ClsClientes + + If ObjCliente.UpdateClientePersonaFisica(CveCliente, TxtApellidoPaternoPF.Text, TxtApellidoMaternoPF.Text, TxtNombrePF.Text) Then + Alert("El Cliente se ha actualizado correctamente.", TipoMensaje.MsgInformacion) + + TxtNombre.Text = $"{TxtNombrePF.Text} {TxtApellidoPaternoPF.Text} {TxtApellidoMaternoPF.Text}" + + TxtApellidoPaterno.Text = TxtApellidoPaternoPF.Text + TxtApellidoMaterno.Text = TxtApellidoMaternoPF.Text + TxtNombres.Text = TxtNombrePF.Text + + DivRazonSocial.Visible = False + DivPersonaFisica.Visible = True + + RegistraScript("$('#DivModalPersonaFisica').modal('hide');") + End If + + ObjCliente.Dispose() + UpDatos.Update() + End Sub +#End Region + +#Region "USUARIOS PLATAFORMA CLIENTE - 6 " + Protected Sub CargaUsuariosPortalCliente() + Dim objUsuario As ClsSisUsuarios = New ClsSisUsuarios + If objUsuario.GetUsuariosPortal(-1, CveCliente, -1) Then + GvUsuarios.DataSource = objUsuario.DtResultados.FiltraParametros($"CveEmpresa={UsuarioActual.CveEmpresa}") + GvUsuarios.DataBind() + End If + objUsuario.Dispose() + End Sub +#End Region + +#Region " DEVOLVER DINERO ANT/NC " + Private Sub InicializaDevolverDinero() + If UsuarioActual.TienePermisoProceso(247) Then + GVAnticipos.Columns(6).Visible = True + End If + End Sub +#End Region + +#Region "MODAL GRAFICA/PEDIDOS" + + Protected Sub LnkVerGrafica_Click(sender As Object, e As EventArgs) + If CargaDatatables() Then + RegistraScript("$('#DivModalGrafica').modal('show')") + CargaGrafica() + End If + End Sub + + Protected Sub LnkCancelar_Click(sender As Object, e As EventArgs) + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + Dim ObjCliente As New ClsClientes + If ObjCliente.UpdateEstatusPedido(gvRow.DataKey("CveVenta").ToEntero, 17, -1, UsuarioActual.CveUsuario) Then + Alert("Cancelado correctamente.") + CargaPedido() + End If + ObjCliente.Dispose() + End Sub + + + Private Sub CargaPedido() + Dim ObjCliente As New ClsClientes + If ObjCliente.GetClienteVentasPedido(CveCliente, UsuarioActual.CveEmpresa) Then + GvPedidos.DataSource = ObjCliente.DtResultados + End If + ObjCliente.Dispose() + GvPedidos.DataBind() + UpPedido.Update() + End Sub + + Protected Sub LnkAutorizar_Click(sender As Object, e As EventArgs) + Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow) + Dim ObjCliente As New ClsClientes + ObjCliente.IniciaTransacSQL() + Dim ErrorTrans As Boolean = False + Dim CveU As Integer = 0 + Dim MsgAut As String = "" + + If ObjCliente.UpdateEstatusPedido(gvRow.DataKey("CveVenta").ToEntero, 16, gvRow.FCTextBox("TxtDiasCredito").Text.ToEntero, UsuarioActual.CveUsuario) Then + CveU = gvRow.DataKey("CveUsuario").ToEntero + MsgAut = String.Format(" Solicitud Autorizada {0} ", gvRow.DataKey("SerieFolio")) + 'If Not ObjCliente.UpdateFechaPedido(gvRow.DataKey("CveVenta").ToEntero, gvRow.FCTextBox("TxtDiasCredito").Text.ToEntero) Then + ' ErrorTrans = True + 'End If + Else + ErrorTrans = True + End If + If Not ErrorTrans Then + ObjCliente.Commit() + Alert("Autorizado correctamente.") + + If CveU > 0 Then ClsSisNotificaciones.SendNotificacionERP(CveU, MsgAut, MsgAut, 1) + + CargaPedido() + Else + ObjCliente.RollBack() + End If + ObjCliente.Dispose() + End Sub + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) + If CargaDatatables() Then + CargaGrafica() + End If + End Sub + + Private Function CargaDatatables() As Boolean + Dim ObjClientes As New ClsClientes + If ObjClientes.GetClienteVencido(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then + DtVencido = ObjClientes.DtResultados + End If + + If ObjClientes.GetRotacionCartera(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then + DtRotacion = ObjClientes.DtResultados + End If + + If ObjClientes.GetClienteSaldoMensual(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then + DtSaldoMensual = ObjClientes.DtResultados + End If + + If ObjClientes.GetClienteComportamientoVentaMensual(CveCliente, UsuarioActual.CveEmpresa, TxtFechaICredito.Text.ToDate, TxtFechaFCredito.Text.ToDate) Then + DtComportamientoVentas = ObjClientes.DtResultados + End If + + If ObjClientes.GetClienteVentasPedido(CveCliente, UsuarioActual.CveEmpresa) Then + GvPedidos.DataSource = ObjClientes.DtResultados + End If + + ObjClientes.Dispose() + GvPedidos.DataBind() + UpPedido.Update() + + Return True + End Function + + Private Sub CargaGrafica() + Dim FactVencida As Boolean = False + Dim Saldo As Double = 0 + Dim LimiteCredito As Double = 0 + If DtVencido.Rows.Count > 0 Then + Saldo = DtVencido.SUM("Saldo") + LimiteCredito = DtVencido.Rows(0)("LimiteCredito").ToString.ToDouble + LblVencido.Text = DtVencido.SUM("Total", "DiasVencidos > 0").FormatoNumero + LblPorVencer.Text = DtVencido.SUM("Total", "DiasVencidos <= 0").FormatoNumero + Else + LimiteCredito = TxtLimiteCredito.Text.ToDouble + LblVencido.Text = "0" + LblPorVencer.Text = "0" + End If + + Dim Dt As New DataTable() + Dt.Columns.Add("value") + For Each Dr As DataRow In DtVencido.Rows + Dim Row As DataRow = Nothing + Row = Dt.NewRow() + Row("value") = Dr("DiasVencidos").ToString + Dt.Rows.Add(Row) + If Dr("DiasVencidos").ToString.ToEntero > 0 And Dr("Saldo").ToString.ToDouble > 0 Then + FactVencida = True + End If + Next + + + Dim query = From s In Dt.AsEnumerable() Select New With {.date = "", .value = s("value").ToString()} + Dim json = Newtonsoft.Json.JsonConvert.SerializeObject(query) + RegistraScript($"CargaGraficaVencido({json})", "22") + + Dim Dt2 As New DataTable() + Dt2.Columns.Add("limite") + Dt2.Columns.Add("saldo") + Dim Row2 As DataRow = Nothing + Row2 = Dt2.NewRow() + LtlLimiteCreditoModal.Text = LimiteCredito.FormatoNumero + Row2("limite") = LimiteCredito - Saldo + Row2("saldo") = Saldo + Dt2.Rows.Add(Row2) + Dim query2 = From s In Dt2.AsEnumerable() Select New With {.year = "", .limite = s("limite").ToString(), .saldo = s("saldo").ToString()} + Dim json2 = Newtonsoft.Json.JsonConvert.SerializeObject(query2) + + RegistraScript($"CargaGraficaLimiteCredito({json2})", "33") + + If DtRotacion.Rows.Count > 0 Then + LblVentasModal.Text = DtRotacion.Rows(0)("Ventas").ToString.FormatoNumero + LblPagadoModal.Text = DtRotacion.Rows(0)("Pagado").ToString.FormatoNumero + LblRotacionModal.Text = DtRotacion.Rows(0)("Rotacion").ToString.FormatoNumero + LblDiasModal.Text = DtRotacion.Rows(0)("Dias").ToString.FormatoNumero + LblDiasCreditoModal.Text = DtRotacion.Rows(0)("DiasCredito").ToString.FormatoNumero + Else + LblVentasModal.Text = "0" + LblPagadoModal.Text = "0" + LblRotacionModal.Text = "0" + LblDiasModal.Text = "0" + LblDiasCreditoModal.Text = "0" + End If + + If FactVencida Or (Saldo > LimiteCredito) Then + LblEstatusModal.Text = "Vencido" + LblEstatusModal.ForeColor = Drawing.Color.Red + Else + LblEstatusModal.Text = "Al Corriente" + LblEstatusModal.ForeColor = Drawing.Color.Green + End If + + Dim Dt3 As New DataTable() + Dt3.Columns.Add("mes") + + Dim Dt4 As New DataTable() + Dt4.Columns.Add("balloonText") + Dt4.Columns.Add("bullet") + Dt4.Columns.Add("title") + Dt4.Columns.Add("valueField") + Dt4.Columns.Add("fillAlphas") + Dt4.Columns.Add("hidden") + + + Dim Cont As Integer = 1 + For Each Dr As DataRow In DtComportamientoVentas.Rows + Dt3.Columns.Add(Dr("Ano").ToString) + Dim Row4 As DataRow = Nothing + Row4 = Dt4.NewRow() + Row4("balloonText") = "Ventas [[category]]: [[value]]" + Row4("bullet") = "round" + Row4("title") = Dr("Ano").ToString + Row4("valueField") = Dr("Ano").ToString + Row4("fillAlphas") = 0 + Row4("hidden") = If(Cont > DtComportamientoVentas.Rows.Count - 3, False, True) + Dt4.Rows.Add(Row4) + Cont += 1 + Next + + Dim RowEnero As DataRow = Nothing + RowEnero = Dt3.NewRow() + Dim RowFebrero As DataRow = Nothing + RowFebrero = Dt3.NewRow() + Dim RowMarzo As DataRow = Nothing + RowMarzo = Dt3.NewRow() + Dim RowAbril As DataRow = Nothing + RowAbril = Dt3.NewRow() + Dim RowMayo As DataRow = Nothing + RowMayo = Dt3.NewRow() + Dim RowJunio As DataRow = Nothing + RowJunio = Dt3.NewRow() + Dim RowJulio As DataRow = Nothing + RowJulio = Dt3.NewRow() + Dim RowAgosto As DataRow = Nothing + RowAgosto = Dt3.NewRow() + Dim RowSeptiembre As DataRow = Nothing + RowSeptiembre = Dt3.NewRow() + Dim RowOctubre As DataRow = Nothing + RowOctubre = Dt3.NewRow() + Dim RowNoviembre As DataRow = Nothing + RowNoviembre = Dt3.NewRow() + Dim RowDiciembre As DataRow = Nothing + RowDiciembre = Dt3.NewRow() + For Each Dr As DataRow In DtComportamientoVentas.Rows + RowEnero(Dr("Ano").ToString) = Dr("Enero").ToString + RowEnero("mes") = "Enero" + RowFebrero(Dr("Ano").ToString) = Dr("Febrero").ToString + RowFebrero("mes") = "Febrero" + RowMarzo(Dr("Ano").ToString) = Dr("Marzo").ToString + RowMarzo("mes") = "Marzo" + RowAbril(Dr("Ano").ToString) = Dr("Abril").ToString + RowAbril("mes") = "Abril" + RowMayo(Dr("Ano").ToString) = Dr("Mayo").ToString + RowMayo("mes") = "Mayo" + RowJunio(Dr("Ano").ToString) = Dr("Junio").ToString + RowJunio("mes") = "Junio" + RowJulio(Dr("Ano").ToString) = Dr("Julio").ToString + RowJulio("mes") = "Julio" + RowAgosto(Dr("Ano").ToString) = Dr("Agosto").ToString + RowAgosto("mes") = "Agosto" + RowSeptiembre(Dr("Ano").ToString) = Dr("Septiembre").ToString + RowSeptiembre("mes") = "Septiembre" + RowOctubre(Dr("Ano").ToString) = Dr("Octubre").ToString + RowOctubre("mes") = "Octubre" + RowNoviembre(Dr("Ano").ToString) = Dr("Noviembre").ToString + RowNoviembre("mes") = "Noviembre" + RowDiciembre(Dr("Ano").ToString) = Dr("Diciembre").ToString + RowDiciembre("mes") = "Diciembre" + Next + Dt3.Rows.Add(RowEnero) + Dt3.Rows.Add(RowFebrero) + Dt3.Rows.Add(RowMarzo) + Dt3.Rows.Add(RowAbril) + Dt3.Rows.Add(RowMayo) + Dt3.Rows.Add(RowJunio) + Dt3.Rows.Add(RowJulio) + Dt3.Rows.Add(RowAgosto) + Dt3.Rows.Add(RowSeptiembre) + Dt3.Rows.Add(RowOctubre) + Dt3.Rows.Add(RowNoviembre) + Dt3.Rows.Add(RowDiciembre) + + RegistraScript($"CargaGraficaComportamientoVentas({Dt3.ToJson},{Dt4.ToJson.Replace($"{Chr(34)}True{Chr(34)}", "true").Replace($"{Chr(34)}False{Chr(34)}", "false")})", "44") + + Dim Dt5 As New DataTable() + Dt5.Columns.Add("mes") + + Dim Dt6 As New DataTable() + Dt6.Columns.Add("balloonText") + Dt6.Columns.Add("bullet") + Dt6.Columns.Add("title") + Dt6.Columns.Add("valueField") + Dt6.Columns.Add("fillAlphas") + Dt6.Columns.Add("hidden") + + Cont = 1 + For Each Dr As DataRow In DtSaldoMensual.Rows + Dt5.Columns.Add(Dr("Ano").ToString) + Dim Row6 As DataRow = Nothing + Row6 = Dt6.NewRow() + Row6("balloonText") = "Saldo [[category]]: [[value]]" + Row6("bullet") = "round" + Row6("title") = Dr("Ano").ToString + Row6("valueField") = Dr("Ano").ToString + Row6("fillAlphas") = 0 + Row6("hidden") = If(Cont > DtSaldoMensual.Rows.Count - 3, False, True) + Dt6.Rows.Add(Row6) + Cont += 1 + Next + RowEnero = Dt5.NewRow() + RowFebrero = Dt5.NewRow() + RowMarzo = Dt5.NewRow() + RowAbril = Dt5.NewRow() + RowMayo = Dt5.NewRow() + RowJunio = Dt5.NewRow() + RowJulio = Dt5.NewRow() + RowAgosto = Dt5.NewRow() + RowSeptiembre = Dt5.NewRow() + RowOctubre = Dt5.NewRow() + RowNoviembre = Dt5.NewRow() + RowDiciembre = Dt5.NewRow() + For Each Dr As DataRow In DtSaldoMensual.Rows + RowEnero(Dr("Ano").ToString) = Dr("Enero").ToString + RowEnero("mes") = "Enero" + RowFebrero(Dr("Ano").ToString) = Dr("Febrero").ToString + RowFebrero("mes") = "Febrero" + RowMarzo(Dr("Ano").ToString) = Dr("Marzo").ToString + RowMarzo("mes") = "Marzo" + RowAbril(Dr("Ano").ToString) = Dr("Abril").ToString + RowAbril("mes") = "Abril" + RowMayo(Dr("Ano").ToString) = Dr("Mayo").ToString + RowMayo("mes") = "Mayo" + RowJunio(Dr("Ano").ToString) = Dr("Junio").ToString + RowJunio("mes") = "Junio" + RowJulio(Dr("Ano").ToString) = Dr("Julio").ToString + RowJulio("mes") = "Julio" + RowAgosto(Dr("Ano").ToString) = Dr("Agosto").ToString + RowAgosto("mes") = "Agosto" + RowSeptiembre(Dr("Ano").ToString) = Dr("Septiembre").ToString + RowSeptiembre("mes") = "Septiembre" + RowOctubre(Dr("Ano").ToString) = Dr("Octubre").ToString + RowOctubre("mes") = "Octubre" + RowNoviembre(Dr("Ano").ToString) = Dr("Noviembre").ToString + RowNoviembre("mes") = "Noviembre" + RowDiciembre(Dr("Ano").ToString) = Dr("Diciembre").ToString + RowDiciembre("mes") = "Diciembre" + Next + Dt5.Rows.Add(RowEnero) + Dt5.Rows.Add(RowFebrero) + Dt5.Rows.Add(RowMarzo) + Dt5.Rows.Add(RowAbril) + Dt5.Rows.Add(RowMayo) + Dt5.Rows.Add(RowJunio) + Dt5.Rows.Add(RowJulio) + Dt5.Rows.Add(RowAgosto) + Dt5.Rows.Add(RowSeptiembre) + Dt5.Rows.Add(RowOctubre) + Dt5.Rows.Add(RowNoviembre) + Dt5.Rows.Add(RowDiciembre) + + + RegistraScript($"CargaGraficaCompratamientoSaldoMensual({Dt5.ToJson},{Dt6.ToJson.Replace($"{Chr(34)}True{Chr(34)}", "true").Replace($"{Chr(34)}False{Chr(34)}", "false")})", "55") + + UPModalProd.Update() + End Sub + + +#End Region + +#Region "TAB - COMPORTAMIENTO DE VENTAS" + + Private Sub CargaGrupo() + DdlGrupo.Items.Insert(0, New ListItem("Categoria", "3")) + DdlGrupo.Items.Insert(1, New ListItem("Clasificacion", "4")) + DdlGrupo.Items.Insert(2, New ListItem("Productos-Servicios", "5")) + DdlGrupo.Items.Insert(3, New ListItem("Año", "6")) + DdlGrupo.Items.Insert(4, New ListItem("Mes", "7")) + DdlGrupo.Items.Insert(5, New ListItem("Año/Mes", "8")) + DdlGrupo.Items.Insert(6, New ListItem("Fecha", "9")) + DdlGrupo.Items.Insert(7, New ListItem("Cliente", "10")) + DdlGrupo.Items.Insert(8, New ListItem("Vendedor", "12")) + DdlGrupo.Items.Insert(9, New ListItem("Usuario", "13")) + DdlGrupo.Items.Insert(10, New ListItem("Estatus Fact.", "14")) + DdlGrupo.Items.Insert(11, New ListItem("Año Ejec.", "15")) + DdlGrupo.Items.Insert(12, New ListItem("Mes Ejec.", "16")) + DdlGrupo.Items.Insert(13, New ListItem("Año/Mes Ejec.", "17")) + DdlGrupo.Items.Insert(14, New ListItem("Fecha Ejec.", "18")) + DdlGrupo.Items.Insert(15, New ListItem("Cliente - PS", "20")) + DdlGrupo.DataBind() + DdlGrupo.SelectedValueExist("8") + End Sub + + Private Sub CargaTipoCentroCosto() + + If UsuarioActual.Empresa.Tipo_CentroCosto = 1 Then + DdlSubProyectoFiltro.Items.Clear() + DivProyecto.Visible = False + LblProyecto.Visible = False + LblSubProyecto.InnerText = "Sucursal:" + DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) + DdlSubProyectoFiltro.DataBind() + + DdlGrupo.Items.Insert(0, New ListItem("Sucursal", "2")) + DdlGrupo.Items.Insert(16, New ListItem("Sucursal Ejec.", "19")) + DdlGrupo.DataBind() + + ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 2 Then + DdlSubProyectoFiltro.Items.Clear() + DivProyecto.Visible = False + LblProyecto.Visible = False + LblSubProyecto.InnerText = "Proyecto:" + DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) + DdlSubProyectoFiltro.DataBind() + + DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "2")) + DdlGrupo.Items.Insert(16, New ListItem("Proyecto Ejec.", "19")) + DdlGrupo.DataBind() + ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 3 Then + DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) + DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) + DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) + DdlGrupo.DataBind() + ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 4 Then + LblProyecto.InnerText = "Sucursal:" + LblSubProyecto.InnerText = "Proyecto:" + + + DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) + DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) + DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) + DdlGrupo.DataBind() + + ElseIf UsuarioActual.Empresa.Tipo_CentroCosto = 5 Then + LblProyecto.InnerText = "Proyecto:" + LblSubProyecto.InnerText = "Sucursal:" + + DdlGrupo.Items.Insert(0, New ListItem("Proyecto", "1")) + DdlGrupo.Items.Insert(1, New ListItem("SubProyecto", "2")) + DdlGrupo.Items.Insert(17, New ListItem("SubProyecto Ejec.", "19")) + DdlGrupo.DataBind() + End If + End Sub + + Private Sub CargaFiltros() + 'Cargo Proyectos + DdlProyecto.DataSource = GlobalDTProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1) + DdlProyecto.DataBind() + + 'Cargo Clasificaciones + DdlClasificacionFilto.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) + DdlClasificacionFilto.DataBind() + + 'CargaSubProyectos + DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyectoFiltro.DataBind() + + 'Vendedor + DdlVendedorFiltro.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa) + DdlVendedorFiltro.DataBind() + + 'CargaUsuarios + DdlUsuario.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) + DdlUsuario.DataBind() + + 'Carga Productos + DdlPSFiltro.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + + If UsuarioActual.Empresa.Funcionalidad(105) = "1" Then + DdlPSFiltro.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacionFilto.SelectedValue) + DdlPSFiltro.SelectedText = "" + DdlPSFiltro.SelectedValue = "-1" + Else + DdlPSFiltro.ddl.Items.Clear() + DdlPSFiltro.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacionFilto.SelectedValue.ToEntero) + DdlPSFiltro.ddl.DataBind() + DdlPSFiltro.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1")) + End If + + CargaGrupo() + CargaTipoCentroCosto() + + End Sub + + Protected Sub DdlProyecto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlProyecto.SelectedIndexChanged + CargaSubProyecto() + End Sub + + Private Sub CargaSubProyecto() + DdlSubProyectoFiltro.Items.Clear() + If DdlProyecto.SelectedValue <> "-1" Then + DdlSubProyectoFiltro.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, DdlProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, -1, 1) + DdlSubProyectoFiltro.DataBind() + End If + DdlSubProyectoFiltro.Items.Insert(0, New ListItem("Todos", "-1")) + End Sub + + Protected Sub DdlClasificacionFilto_SelectedIndexChanged(sender As Object, e As EventArgs) + If UsuarioActual.Empresa.Funcionalidad(105) = "" Then + DdlPSFiltro.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=DdlClasificacionFilto.SelectedValue.ToEntero) + DdlPSFiltro.DataBind() + DdlPSFiltro.ddl.Items.Insert(0, New ListItem("Todos", "-1")) + Else + DdlPSFiltro.ddlWS.Attributes.Add("data-cveclasificacion", DdlClasificacionFilto.SelectedValue) + DdlPSFiltro.SelectedText = "Todos" + DdlPSFiltro.SelectedValue = "-1" + End If + End Sub + + Protected Sub GvComportamientoVenta_RowDataBound(sender As Object, e As GridViewRowEventArgs) + If e.Row.RowType = DataControlRowType.DataRow Then + + If DdlGrupo.SelectedValue.ToEntero = 20 Then + + If e.Row.DBCampo("PS").ToString = "" Then + e.Row.CssClass = "Totales" + End If + Else + If Not e.Row.DBCampo("CveVenta").ToEntero > 0 Then + e.Row.Cells(5).Text = e.Row.DBCampo("Gpo").ToString + e.Row.CssClass = "Totales" + + End If + End If + End If + End Sub + + Protected Sub BtnConsultarComportamiento_Click(sender As Object, e As EventArgs) + CargaGvComportamientoVenta() + End Sub + + Private Sub CargaGvComportamientoVenta() + Dim ObjVentas As New ClsVentas() + Dim FechaI, FechaF As Date + FechaI = If(IsDate(TxtFechaIFiltro.Text.Trim()), TxtFechaIFiltro.Text.ToDate, MinFecha) + FechaF = If(IsDate(TxtFechaFFiltro.Text.Trim()), TxtFechaFFiltro.Text.ToDate, MaxFecha) + + If ObjVentas.GetRepProductosServiciosDetalle(DdlProyecto.SelectedValue.ToEntero, DdlSubProyectoFiltro.SelectedValue.ToEntero, -1, DdlClasificacionFilto.SelectedValue.ToEntero, + DdlPSFiltro.SelectedValue.ToEntero, FechaI, FechaF, -1, MinFecha, MaxFecha, -1, + CveCliente, -1, DdlVendedorFiltro.SelectedValue.ToEntero, DdlUsuario.SelectedValue.ToEntero, -1, + UsuarioActual.CveEmpresa, CveUsuarioConsulta:=UsuarioActual.CveUsuario, TipoDocto:="Ing", GPO:=DdlGrupo.SelectedValue.ToEntero) Then + GvComportamientoVenta.DataSource = ObjVentas.DtResultados + Else + GvComportamientoVenta.DataSource = Nothing + End If + + ObjVentas.Dispose() + GvComportamientoVenta.DataBind() + UpDatosComportamientoVenta.Update() + End Sub + +#End Region + +#Region "DISPOSITIVOS" + + Protected Sub LnkMoverDispositivo_Click(sender As Object, e As EventArgs) + Dim CveDispositivo As Integer = HdnCveDispositivoMover.Value.ToEntero() + Dim CveCliente As Integer = DdlClienteDispositivo.SelectedValue.ToEntero() + + If CveDispositivo <= 0 Then + Alert("Se debe seleccionar un dispositivo.", TipoMensaje.MsgAdvertencia) + Return + End If + If CveCliente <= 0 Then + Alert("Se debe seleccionar un cliente.", TipoMensaje.MsgAdvertencia) + Return + End If + Dim TieneError As Boolean = False + Dim ObjGPS = New ClsGPS() + Dim ObjEventos As New ClsOIEventos(ObjGPS.IniciaTransacSQL()) + + If ObjGPS.UpdateClienteDispositivo(CveDispositivo, CveCliente) Then + TieneError = Not ObjEventos.AddEventoBitacora($"Se movió el dispositivo: {NombreDispositivo} de cliente. Valor Anterior:{UsuarioActual.Empresa.Empresa}, {LtlCliente.Text} Valor Actual:{DdlEmpresaDispositivo.SelectedItem.Text}, {DdlClienteDispositivo.SelectedItem.Text}", "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCliente:=CveCliente) + Else + TieneError = True + End If + + If TieneError Then + ObjGPS.RollBack() + Alert($"Ocurrió un error al mover el dispostivo.", TipoMensaje.MsgError) + Else + ObjGPS.Commit() + Alert($"El dispositivo '{NombreDispositivo}' se movió correctamente.") + End If + + ObjGPS.Dispose() + ObjEventos.Dispose() + + CargaDispositivos(DdlEstatusDispositivos.SelectedValue.ToEntero()) + CargaEventoBitacora() + NombreDispositivo = "" + RegistraScript("$('#DivMoverDispositivo').modal('hide');") + End Sub + +#End Region + +#Region "CRM" + Protected Sub CargaDatosCRM() + Dim ObjCRM = New ClsCRM() + + If ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa, CveEmpresaCRM) And ObjCRM.DtResultados.Rows.Count > 0 Then + TxtNombre.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Empresa").ToString + TxtNombreComercial.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Empresa").ToString + TxtRFC.Text = ObjCRM.DtResultados.FiltroPrimeroValor("RFC").ToString + + TxtEmail.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Correo").ToString + TxtEmailCotizacion.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Correo").ToString + + DdlVendedor.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveVendedorAsignado").ToString) + DdlSubProyecto.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveSubProyecto").ToString) + Else + Alert("La empresa CRM solicitada no existe, porfavor verifique", TipoMensaje.MsgAdvertencia) + CveEmpresaCRM = -1 + End If + ObjCRM.Dispose() + End Sub + + Protected Sub VerificaVinculacion() + Dim ObjCRM = New ClsCRM() + + If ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa, -1) And ObjCRM.DtResultados.Rows.Count > 0 Then + If ObjCRM.DtResultados.FiltraParametros(String.Format("CveCliente = {0}", CveCliente)).Rows.Count > 0 Then + LiLnkUnificarCRM.Visible = False + Else + LiLnkUnificarCRM.Visible = True + End If + End If + ObjCRM.Dispose() + End Sub + + Protected Function VincularEmpresaCRM() As Boolean + Dim Ok As Boolean = False + Dim ObjCRM = New ClsCRM() + Dim ObjBitacora = New ClsOIEventos(ObjCRM.IniciaTransacSQL()) + If (CveCliente > 0) Then + + Dim CveEmpresaCRMVincular As Integer = If(CveEmpresaCRM > 0, CveEmpresaCRM, If(CveEmpresaCRMUnificar > 0, CveEmpresaCRMUnificar, -1)) + + If ObjCRM.UpdateEmpresCRM("-2", "-2", -2, CveEmpresaCRMVincular, -2, UsuarioActual.CveUsuario, CveCliente, -1, "-1") Then + If CveEmpresaCRM > 0 Then + ObjBitacora.AddEventoBitacora(String.Format("Se Creó el Cliente: {0} a partir de la Empresa CRM", TxtNombre.Text), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM:=CveEmpresaCRM) + End If + If CveEmpresaCRMUnificar > 0 Then + ObjBitacora.AddEventoBitacora(String.Format("Se Unificó el Cliente: {0} con la Empresa CRM", TxtNombre.Text), "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveEmpresaCRM:=CveEmpresaCRMUnificar) + End If + Ok = True + End If + End If + + If (Ok) Then + ObjCRM.Commit() + Else + ObjCRM.RollBack() + End If + ObjCRM.Dispose() + ObjBitacora.Dispose() + + Return Ok + End Function + + Protected Sub CargaModalEmpresasCRM() + Dim ObjCRM = New ClsCRM() + + If (ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa) And ObjCRM.DtResultados.Rows.Count > 0) Then + DtEmpresasCRM = ObjCRM.DtResultados.FiltraParametros(String.Format("CveCliente IS NULL")) + GvEmpresasCRM.DataSource = DtEmpresasCRM + End If + ObjCRM.Dispose() + GvEmpresasCRM.DataBind() + UpEmpresasCRM.Update() + End Sub + + Protected Sub LnkUnificarCRM_Click(sender As Object, e As EventArgs) + CveEmpresaCRMUnificar = -1 + CargaModalEmpresasCRM() + RegistraScript("$('#DivModalUnificarCRM').modal();") + End Sub + + Protected Sub BtnUnificarCRM_Click(sender As Object, e As EventArgs) + For Each row As GridViewRow In GvEmpresasCRM.Rows + Dim chkSeleccionado As RadioButton = CType(row.FindControl("RBSeleccion"), RadioButton) + If chkSeleccionado.Checked Then + CveEmpresaCRMUnificar = row.DataKey("CveEmpresaCRM").ToEntero + End If + Next + + If CveEmpresaCRMUnificar > 0 Then + If (VincularEmpresaCRM()) Then + LiLnkUnificarCRM.Visible = False + UpAccionesCRM.Update() + + RegistraScript("$('#DivModalUnificarCRM').modal('hide');") + Alert("Se Unificó correctamente al Cliente con la Empresa CRM.") + End If + End If + End Sub +#End Region + +#Region "PORCENTAJE PRECIO DE MARCAS" + Private Sub LnkPorcentajeMarcas_Click(sender As Object, e As EventArgs) Handles LnkPorcentajeMarcas.Click + RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajeMarcas")) + + CreaDT() + + CargaMarcas() + LimpiaModalPorcentaje() + End Sub + Private Sub CreaDT() + Dim DTPorcentajeTemp As New DataTable + + Dim column As DataColumn = New DataColumn("No") + column.DataType = Type.GetType("System.Int32") + With column + .AutoIncrement = True + .AutoIncrementSeed = 1 + .AutoIncrementStep = 1 + End With + + DTPorcentajeTemp.Columns.Add(column) + DTPorcentajeTemp.Columns.Add("CveMarca", GetType(Integer)) + DTPorcentajeTemp.Columns.Add("Marca", GetType(String)) + DTPorcentajeTemp.Columns.Add("PorcentajeProducto", GetType(Decimal)) + DTPorcentajeTemp.Columns.Add("PorcentajeProducto2", GetType(Decimal)) + DTPorcentajeTemp.Columns.Add("PorcentajeProducto3", GetType(Decimal)) + DTPorcentajeTemp.Columns.Add("ProntoPago", GetType(Decimal)) + DTPorcentajeTemp.Columns.Add("Plazo", GetType(Integer)) + DTPorcentajeTemp.Columns.Add("Estatus", GetType(String)) + DTPorcentajePrecios = DTPorcentajeTemp.Clone + End Sub + Private Sub CargaMarcas() + Dim ObjMarcas As New ClsProductosServicios + ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) + DdlMarcaPS.DataSource = ObjMarcas.DtResultados + ObjMarcas.Dispose() + DdlMarcaPS.DataBind() + DdlMarcaPS.Items.Insert(0, New ListItem("Seleccione", "-1")) + + CargaGridPorcentajes() + UpPorcentaje.Update() + End Sub + + Private Sub CargaGridPorcentajes() + Dim ObjPS As New ClsProductosServicios + + If ObjPS.GetPorcentajeMarcas(CveCliente) Then + DTPorcentajePrecios = ObjPS.DtResultados + GvM.DataSource = DTPorcentajePrecios + End If + ObjPS.Dispose() + + GvM.DataBind() + UppGrid.Update() + + End Sub + Private Sub CargaDTPorcentajePrecios(DtTemp As DataTable) + GvM.DataSource = DtTemp + GvM.DataBind() + + UppGrid.Update() + End Sub + + Private Sub LimpiaModalPorcentaje() + txtPorcentaje.Text = "" + txtPorcentaje2.Text = "" + txtPorcentaje3.Text = "" + txtProntoPago.Text = "" + txtPlazo.Text = "" + DdlMarcaPS.SelectedValue = "-1" + End Sub + + Protected Sub LbAgregarMarca_Click(sender As Object, e As EventArgs) Handles LbAgregarMarca.Click + If txtPorcentaje.Text.ToDecimal > 0 And txtPorcentaje.Text.ToDecimal <= 100 And txtPorcentaje2.Text.ToDecimal >= 0 And txtPorcentaje2.Text.ToDecimal <= 100 And txtPorcentaje3.Text.ToDecimal >= 0 And txtPorcentaje3.Text.ToDecimal <= 100 Then + + Dim registro As DataRow = DTPorcentajePrecios.NewRow + + registro.Item("No") = DTPorcentajePrecios.Rows.Count + 1 + registro.Item("CveMarca") = DdlMarcaPS.SelectedValue.ToEntero + registro.Item("Marca") = DdlMarcaPS.SelectedItem.Text + registro.Item("PorcentajeProducto") = txtPorcentaje.Text.ToDecimal + registro.Item("PorcentajeProducto2") = txtPorcentaje2.Text.ToDecimal + registro.Item("PorcentajeProducto3") = txtPorcentaje3.Text.ToDecimal + registro.Item("ProntoPago") = txtProntoPago.Text.ToDecimal + registro.Item("Plazo") = txtPlazo.Text.ToEntero + registro.Item("Estatus") = "I" + DTPorcentajePrecios.Rows.Add(registro) + CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + Else + Alert("El Porcentaje debe estar en un rango mayor a 0 y menor o igual a 100", TipoMensaje.MsgAdvertencia) + End If + + LimpiaModalPorcentaje() + End Sub + + Protected Sub DeleteRowMarca(sender As Object, e As EventArgs) + + Dim lnkRemove As LinkButton = DirectCast(sender, LinkButton) + + + If DTPorcentajePrecios.Rows.Count > 0 And lnkRemove.CommandArgument.ToString.Length > 0 Then + Dim i As Integer + i = lnkRemove.CommandArgument.ToString.ToEntero + Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", i)) + If Drs.Count > 0 Then + If CveCliente > 0 AndAlso Drs(0)("CveMarca").ToString.ToEntero > 0 Then + Drs(0)("Estatus") = "D" + Else + Drs(0).Delete() + End If + + End If + DTPorcentajePrecios.AcceptChanges() + End If + + GvM.EditIndex = -1 + + CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + + End Sub + + Protected Sub GvM_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvM.RowEditing + GvM.EditIndex = e.NewEditIndex + + CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + End Sub + Protected Sub GvM_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvM.RowCancelingEdit + GvM.EditIndex = -1 + + CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + End Sub + Protected Sub GvM_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvM.RowUpdating + + Dim PorcentajeProducto As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP").Text.ToDouble + Dim PorcentajeProducto2 As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP2").Text.ToDouble + Dim PorcentajeProducto3 As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP3").Text.ToDouble + Dim ProntoPago As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtProntoPagoP").Text.ToDouble + Dim Plazo As Double = GvM.Rows(e.RowIndex).FCTextBox("TxtPlazoP").Text.ToDouble + + If PorcentajeProducto > 0 And PorcentajeProducto <= 100 And PorcentajeProducto2 >= 0 And PorcentajeProducto2 <= 100 And PorcentajeProducto3 >= 0 And PorcentajeProducto3 <= 100 Then + Dim No As Integer = GvM.Rows(e.RowIndex).DataKey("No").ToEntero + + Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", No)) + + If Drs.Count > 0 Then + Drs(0)("PorcentajeProducto") = PorcentajeProducto + Drs(0)("PorcentajeProducto2") = PorcentajeProducto2 + Drs(0)("PorcentajeProducto3") = PorcentajeProducto3 + Drs(0)("ProntoPago") = ProntoPago + Drs(0)("Plazo") = Plazo + If Drs(0)("Estatus").ToString <> "I" Then + Drs(0)("Estatus") = "U" + End If + End If + + DTPorcentajePrecios.AcceptChanges() + GvM.EditIndex = -1 + + CargaDTPorcentajePrecios(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + Else + Alert("El Porcentaje debe estar en un rango mayor a 0 y menor o igual a 100", TipoMensaje.MsgAdvertencia) + End If + + End Sub + + Protected Sub BtnGuardarPorcentajesMarca_Click(sender As Object, e As EventArgs) Handles BtnGuardarPorcentajesMarca.Click + + Dim TieneError As Boolean = False + + Dim ObjPS As New ClsProductosServicios + ObjPS.IniciaTransacSQL() + + For Each Dr As DataRow In DTPorcentajePrecios.Rows + + If Dr("Estatus").ToString <> "" Then + + If Dr("Estatus").ToString = "I" Then + If Not ObjPS.AddPorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal, Dr("PorcentajeProducto2").ToString.ToDecimal, Dr("PorcentajeProducto3").ToString.ToDecimal, UsuarioActual.CveUsuario, Dr("ProntoPago").ToString.ToDecimal, Dr("Plazo").ToString.ToEntero) Then + TieneError = True + End If + ElseIf Dr("Estatus").ToString = "U" Then + If Not ObjPS.UpdatePorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal, Dr("PorcentajeProducto2").ToString.ToDecimal, Dr("PorcentajeProducto3").ToString.ToDecimal, Dr("ProntoPago").ToString.ToDecimal, Dr("Plazo").ToString.ToEntero) Then + TieneError = True + End If + ElseIf Dr("Estatus").ToString = "D" Then + If Not ObjPS.RemovePorcentajeMarcas(CveCliente, Dr("CveMarca").ToString.ToEntero) Then + TieneError = True + End If + End If + + End If + Next + + If TieneError Then + ObjPS.RollBack() + Else + ObjPS.Commit() + Alert("Los Porcentajes se guardaron correctamente.", TipoMensaje.MsgInformacion) + RegistraScript("$('#DivPorcentajeMarcas').modal('hide')", "hidemodal") + End If + + ObjPS.Dispose() + + End Sub +#End Region + +#Region "PORCENTAJE PRECIO DE PRODUCTOS" + Private Sub LnkPorcentajePrecios_Click(sender As Object, e As EventArgs) Handles LnkPorcentajePrecios.Click + RegistraScript(String.Format("$('#{0}').modal();", "DivPorcentajePrecios")) + + CreaDT2() + + TxtPorcentajePS.Attributes.Add("onchange", String.Format("FnCambiaPorcentaje({0});", "5")) + CargaPorcentajesProductos() + LimpiaModalPorcentaje2() + End Sub + Private Sub CreaDT2() + Dim DTPorcentajeTemp As New DataTable + + Dim column As DataColumn = New DataColumn("No") + column.DataType = Type.GetType("System.Int32") + With column + .AutoIncrement = True + .AutoIncrementSeed = 1 + .AutoIncrementStep = 1 + End With + + DTPorcentajeTemp.Columns.Add(column) + DTPorcentajeTemp.Columns.Add("CvePS", GetType(Integer)) + DTPorcentajeTemp.Columns.Add("Producto", GetType(String)) + DTPorcentajeTemp.Columns.Add("PrecioG", GetType(Decimal)) + DTPorcentajeTemp.Columns.Add("PorcentajeProducto", GetType(Decimal)) + DTPorcentajeTemp.Columns.Add("PrecioA", GetType(Decimal)) + DTPorcentajeTemp.Columns.Add("Estatus", GetType(String)) + DTPorcentajePrecios = DTPorcentajeTemp.Clone + End Sub + Private Sub CargaPorcentajesProductos() + 'Llenar el dropdownlist de Secciones + If UsuarioActual.CveEmpresa = 66 Then + DdlClasificacion2.DataSource = GlobalDTSubFamilias(UsuarioActual.CveEmpresa).FiltraParametros("", Orderby:="Clasificacion") + Else + Dim ObjClasificaciones As New ClsClasificaciones + If ObjClasificaciones.GetClasificacionesExistencias(UsuarioActual.CveEmpresa) Then + DdlClasificacion2.DataSource = ObjClasificaciones.DtResultados + End If + ObjClasificaciones.Dispose() + End If + DdlClasificacion2.DataBind() + + CargaPS() + CargaGridPorcentajes2() + + UpPorcentajeP.Update() + End Sub + Private Sub CargaPS() + DdlProducto2.setEsWebService(UsuarioActual.Empresa.Funcionalidad(105) = "1") + + If UsuarioActual.CveEmpresa = 66 Then + DdlProducto2.ddlWS.Attributes.Add("data-pagina", "Inventarios") + End If + + If Not DdlProducto2.UsaWebService AndAlso CType(DdlProducto2.DataSource, DataTable) Is Nothing Then + DdlProducto2.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoPS = 2") + + DdlProducto2.DataBind() + + DdlProducto2.ddl.Items.Insert(0, New ListItem("Seleccione", "-1")) + End If + + End Sub + + Protected Sub DdlProducto2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlProducto2.selectedindexchange + DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero, DdlProducto2) + End Sub + Private Sub DdlProducto2IndexChange(CvePSParametro As Integer, Ddl As ADServerControl.Dropdownlost) + Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("") + + If drPS IsNot Nothing Then + Dim Precio = drPS("Precio").ToString.ToDouble + LbPrecioG.Text = Precio.FormatoNumero() + LbPrecioA.Text = ((Precio * TxtPorcentajePS.Text.ToDecimal) / 100).FormatoNumero + End If + End Sub + + Private Sub CargaGridPorcentajes2() + Dim ObjPS As New ClsProductosServicios + + If ObjPS.GetPorcentajeProductos(CveCliente) Then + DTPorcentajePrecios = ObjPS.DtResultados + GvP.DataSource = DTPorcentajePrecios + End If + ObjPS.Dispose() + + GvP.DataBind() + UpPorcentajePS.Update() + + End Sub + Private Sub CargaDTPorcentajePrecios2(DtTemp As DataTable) + GvP.DataSource = DtTemp + GvP.DataBind() + + UpPorcentajePS.Update() + End Sub + + Private Sub LimpiaModalPorcentaje2() + TxtPorcentajePS.Text = "" + DdlClasificacion2.SelectedValue = "-1" + DdlProducto2.SelectedText = "" + End Sub + + Protected Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click + + If DdlProducto2.SelectedText <> "" Then + If TxtPorcentajePS.Text.ToDecimal >= 0 And TxtPorcentajePS.Text.ToDecimal <= 100 Then + + Dim registro As DataRow = DTPorcentajePrecios.NewRow + + registro.Item("No") = DTPorcentajePrecios.Rows.Count + 1 + registro.Item("CvePS") = DdlProducto2.SelectedValue.ToEntero + registro.Item("Producto") = DdlProducto2.SelectedText + registro.Item("PrecioG") = LbPrecioG.Text.ToDecimal + registro.Item("PrecioA") = LbPrecioG.Text.ToDecimal * TxtPorcentajePS.Text.ToDecimal / 100 + registro.Item("PorcentajeProducto") = TxtPorcentajePS.Text.ToDecimal + registro.Item("Estatus") = "I" + DTPorcentajePrecios.Rows.Add(registro) + CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + Else + Alert("El Porcentaje debe estar en un rango entre 0 y 100", TipoMensaje.MsgAdvertencia) + End If + Else + Alert("El campo ''Producto'' es necesario, por favor ingréselo.", TipoMensaje.MsgAdvertencia) + End If + + LimpiaModalPorcentaje() + End Sub + + Protected Sub DeleteRow(sender As Object, e As EventArgs) + + Dim lnkRemove As LinkButton = DirectCast(sender, LinkButton) + + + If DTPorcentajePrecios.Rows.Count > 0 And lnkRemove.CommandArgument.ToString.Length > 0 Then + Dim i As Integer + i = lnkRemove.CommandArgument.ToString.ToEntero + Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", i)) + If Drs.Count > 0 Then + If CveCliente > 0 AndAlso Drs(0)("CvePS").ToString.ToEntero > 0 Then + Drs(0)("Estatus") = "D" + Else + Drs(0).Delete() + End If + + End If + DTPorcentajePrecios.AcceptChanges() + End If + + GvP.EditIndex = -1 + + CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + + End Sub + + Protected Sub GvP_RowEditing(sender As Object, e As GridViewEditEventArgs) Handles GvP.RowEditing + GvP.EditIndex = e.NewEditIndex + + CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + End Sub + Protected Sub GvP_RowCancelingEdit(sender As Object, e As GridViewCancelEditEventArgs) Handles GvP.RowCancelingEdit + GvP.EditIndex = -1 + + CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + End Sub + Protected Sub GvP_RowUpdating(sender As Object, e As GridViewUpdateEventArgs) Handles GvP.RowUpdating + + Dim PorcentajeProducto As Double = GvP.Rows(e.RowIndex).FCTextBox("TxtPorcentajeP").Text.ToDouble + + If PorcentajeProducto >= 0 And PorcentajeProducto <= 100 Then + Dim No As Integer = GvP.Rows(e.RowIndex).DataKey("No").ToEntero + + Dim Drs As DataRow() = DTPorcentajePrecios.Select(String.Format("No = {0}", No)) + + If Drs.Count > 0 Then + Drs(0)("PorcentajeProducto") = PorcentajeProducto + Drs(0)("PrecioA") = Drs(0)("PrecioG").ToString.ToDouble * PorcentajeProducto / 100 + If Drs(0)("Estatus").ToString <> "I" Then + Drs(0)("Estatus") = "U" + End If + End If + + DTPorcentajePrecios.AcceptChanges() + GvP.EditIndex = -1 + + CargaDTPorcentajePrecios2(DTPorcentajePrecios.FiltraParametros("Estatus <> 'D' ")) + Else + Alert("El Porcentaje debe estar en un rango entre 0 y 100", TipoMensaje.MsgAdvertencia) + End If + + End Sub + + Protected Sub BtnGuardarPorcentajes_Click(sender As Object, e As EventArgs) Handles BtnGuardarPorcentajes.Click + + Dim TieneError As Boolean = False + + Dim ObjPS As New ClsProductosServicios + ObjPS.IniciaTransacSQL() + + For Each Dr As DataRow In DTPorcentajePrecios.Rows + + If Dr("Estatus").ToString <> "" Then + + If Dr("Estatus").ToString = "I" Then + If Not ObjPS.AddPorcentajeProductos(CveCliente, Dr("CvePS").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal, UsuarioActual.CveUsuario) Then + TieneError = True + End If + ElseIf Dr("Estatus").ToString = "U" Then + If Not ObjPS.UpdatePorcentajeProductos(CveCliente, Dr("CvePS").ToString.ToEntero, Dr("PorcentajeProducto").ToString.ToDecimal) Then + TieneError = True + End If + ElseIf Dr("Estatus").ToString = "D" Then + If Not ObjPS.RemovePorcentajeProductos(CveCliente, Dr("CvePS").ToString.ToEntero) Then + TieneError = True + End If + End If + + End If + Next + + If TieneError Then + ObjPS.RollBack() + Else + ObjPS.Commit() + Alert("Los Porcentajes se guardaron correctamente.", TipoMensaje.MsgInformacion) + RegistraScript("$('#DivPorcentajePrecios').modal('hide')", "hidemodal") + End If + + ObjPS.Dispose() + + End Sub + + Protected Sub BtnCambiaPorcentaje_Click(sender As Object, e As EventArgs) + DdlProducto2IndexChange(DdlProducto2.SelectedValue.ToEntero, DdlProducto2) + End Sub +#End Region + +#Region " A C U M U L A D O R E S" + + + Protected Sub LnkFacturaUsadosCargos_Click(sender As Object, e As EventArgs) + 'CveVentaNota = 0 + + 'Dim Cargos As Decimal = 0D + 'Dim Iva As Decimal = 0D + + 'For Each GvRow As GridViewRow In GvAcum.Rows + + ' If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkCargo").Checked Then + ' Cargos = Cargos + GvRow.DataKey("ImporteCargo").ToDecimal + ' End If + 'Next + + 'Dim CvePS As Integer = UsuarioActual.Empresa.Funcionalidad(534).ToEntero 'CvePS Distruibuidor Cargo Nota + 'Dim CveUnidadMedida As Integer + 'Dim CveClasificacion As Integer + + 'If CvePS > 0 Then + + ' If Cargos > 0 Then + + ' CveUnidadMedida = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveUnidadMedida").ToString.ToEntero + ' CveClasificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveClasificacion").ToString.ToEntero + ' Iva = Cargos * 0.16D + + ' If GenerarNotaCredito(CvePS, 1, CveUnidadMedida, Cargos, Iva, "Clientes/Usados", CveClasificacion) Then + ' Alert($"LA nota de crédito fue generada correctamente {SerieNotaAcumulador}-{FolioNotaAcumulador}") + ' Else + ' Alert("Se presento un error al generar la nota de creédito", TipoMensaje.MsgError) + ' End If + ' End If + + 'Else + ' Alert("No esta asignada la funcionalidad CvePS Distruibuidor Cargo Nota") + 'End If + + CreaObjetosVenta(1) + + 'If ObjFactura.CveCliente > 0 Then + ' If TmpDT.Rows.Count > 0 Then + ' Dim Retorno = ObjFactura.EmitirFactura(false) + ' For Each Mensaje In Retorno.Mensajes + ' Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion)) + ' Next + ' End If + 'End If + + CargaUsados() + + End Sub + Protected Sub LnkFacturaUsadosBonificacion_Click(sender As Object, e As EventArgs) + + 'CveVentaNota = 0 + 'Dim Bonificacion As Decimal = 0D + 'Dim Iva As Decimal = 0D + + 'For Each GvRow As GridViewRow In GvAcum.Rows + ' If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkBonificacion").Checked Then + ' Bonificacion = Bonificacion + GvRow.DataKey("ImporteBonificacion").ToDecimal + ' End If + 'Next + + + 'Dim CvePS As Integer = UsuarioActual.Empresa.Funcionalidad(534).ToEntero 'CvePS Distruibuidor Bonificación Nota + 'Dim CveUnidadMedida As Integer + 'Dim CveClasificacion As Integer + 'If CvePS > 0 Then + ' If Bonificacion > 0 Then + + ' CveUnidadMedida = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveUnidadMedida").ToString.ToEntero + ' CveClasificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).FiltroPrimeroValor("CveClasificacion").ToString.ToEntero + ' Iva = Bonificacion * 0.16D + + ' If GenerarNotaCredito(CvePS, 2, CveUnidadMedida, Bonificacion, Iva, "Clientes/Usados", CveClasificacion) Then + ' Alert($"LA nota de crédito fue generada correctamente {SerieNotaAcumulador}-{FolioNotaAcumulador}") + ' Else + ' Alert("Se presento un error al generar la nota de creédito", TipoMensaje.MsgError) + ' End If + + ' End If + + 'Else + ' Alert("No esta asignada la funcionalidad CvePS Distruibuidor Bonificación Nota") + 'End If + + CreaObjetosVenta(2) + + If ObjFactura.CveCliente > 0 Then + If TmpDT.Rows.Count > 0 Then + Dim Retorno = ObjFactura.EmitirFactura(False) + For Each Mensaje In Retorno.Mensajes + Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion)) + Next + End If + End If + + Alert("Listo") + + CargaUsados() + + + End Sub + + + Function FolioNotaCredito(Tipo As Integer) As Boolean + + FolioNotaAcumulador = 0 + SerieNotaAcumulador = "" + Dim Respuesta As Boolean = False + + Dim ObjFolios As New ClsGralFolios() + + Dim DTSucursales As DataTable = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1).FiltraParametros("EsSucursal = True ") + + If DTSucursales.Rows.Count > 0 Then + + If ObjFolios.GetFolios("RNC", UsuarioActual.CveEmpresa) Then + Dim CveSubProyecto As Integer = DTSucursales.FiltroPrimeroValor("CveSubProyecto", "").ToEntero + Dim DT As DataTable + If CveSubProyecto > 0 Then + DT = ObjFolios.DtResultados.FiltraParametros(" Estado = 'Activo' AND LEN(Serie) > 0 AND CveSubProyecto = " & CveSubProyecto) + Else + DT = ObjFolios.DtResultados.FiltraParametros(" Estado = 'Activo' AND LEN(Serie) > 0 ") + End If + + If DT.Rows.Count > 0 Then + FolioNotaAcumulador = DT.Rows(0)("FActual").ToString.ToEntero + SerieNotaAcumulador = DT.Rows(0)("Serie").ToString + Respuesta = True + End If + + End If + End If + + ObjFolios.Dispose() + + Return Respuesta + + End Function + + Private Sub GvAcum_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvAcum.RowDataBound + + If e.Row.RowType = DataControlRowType.DataRow Then + + If e.Row.DataKey("CveConcepto").ToEntero = 1 Then + + Dim FacturadoCargo As Boolean = Boolean.Parse(e.Row.DataKey("FacturadoCargo")) + Dim FacturadoBonificacion As Boolean = Boolean.Parse(e.Row.DataKey("FacturadoBonificacion")) + + If FacturadoCargo Then + e.Row.FCCheckBox("ChkCargo").Checked = False + e.Row.FCCheckBox("ChkCargo").Visible = False + Else + e.Row.FCCheckBox("ChkCargo").Checked = False e.Row.FCCheckBox("ChkCargo").Visible = False 'True - End If - - If FacturadoBonificacion Then - e.Row.FCCheckBox("ChkBonificacion").Checked = False - e.Row.FCCheckBox("ChkBonificacion").Visible = False - Else - e.Row.FCCheckBox("ChkBonificacion").Checked = False - e.Row.FCCheckBox("ChkBonificacion").Visible = True - End If - - Else - e.Row.FCCheckBox("ChkCargo").Checked = False - e.Row.FCCheckBox("ChkCargo").Visible = False - - e.Row.FCCheckBox("ChkBonificacion").Checked = False - e.Row.FCCheckBox("ChkBonificacion").Visible = False - End If - - End If - - End Sub - - Protected Sub BtnConsultaUsados_Click(sender As Object, e As EventArgs) - CargaUsados() - End Sub - - Private Sub CargaUsados() - - If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then ' Funcionalidad Es Distribuidor - - DivEsDistribuidor.Visible = True - TabUsados.Visible = True - - Dim ObjAcum As New ClsAcumuladores - Dim ImporteCargo As Decimal = 0D - Dim ImporteBonificacion As Decimal = 0D - - If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, TxtFechaIUsados.Text.ToDate, TxtFechaFUsados.Text.ToDate) Then - - GvAcum.DataSource = ObjAcum.DtResultados - - LblUsadosPuntos.Text = (ObjAcum.DtResultados.SUM("Puntos", " CveConcepto = 2 ") - ObjAcum.DtResultados.SUM("Puntos", " CveConcepto IN (1,3) ")).ToDecimal.FormatoNumero(2) - - ImporteCargo = ObjAcum.DtResultados.SUM("ImporteCargo", "(FacturadoCargo = 0 OR FacturadoCargo IS NULL) AND CveConcepto = 1 ").ToDecimal - ImporteBonificacion = ObjAcum.DtResultados.SUM("ImporteBonificacion", "(FacturadoBonificacion = 0 OR FacturadoBonificacion IS NULL) AND CveConcepto = 1 ").ToDecimal - - LblUsadosImpCargo.Text = ImporteCargo.FormatoNumero(2) - LblusadosImpBonificacion.Text = ImporteBonificacion.FormatoNumero(2) - - Else - GvAcum.DataSource = Nothing - - ImporteCargo = 0D - ImporteBonificacion = 0D - - LblUsadosImpCargo.Text = "" - LblusadosImpBonificacion.Text = "" - LblUsadosPuntos.Text = "" - - End If - - 'LnkFacturaUsadosCargos.Visible = If(ImporteCargo > 0, True, False) - LnkFacturaUsadosBonificacion.Visible = If(ImporteBonificacion > 0, True, False) - - ObjAcum.Dispose() - GvAcum.DataBind() - - UpAcciones.Update() - UpUsadosResumen.Update() - UpAcum.Update() - - End If - - End Sub - - Private Sub CreaDTVentas() - TmpDT = New DataTable - TmpDT.Columns.Add("CveVenta", GetType(Integer)) - TmpDT.Columns.Add("Consec", GetType(Integer)) - TmpDT.Columns.Add("Cantidad", GetType(Decimal)) - TmpDT.Columns.Add("Codigo", GetType(String)) - TmpDT.Columns.Add("CveUM", GetType(Integer)) - TmpDT.Columns.Add("UM", GetType(String)) - TmpDT.Columns.Add("SATClaveUM", GetType(String)) - TmpDT.Columns.Add("CveClasificacion", GetType(Integer)) - TmpDT.Columns.Add("Clasificacion", GetType(String)) - TmpDT.Columns.Add("CvePS", GetType(Integer)) - TmpDT.Columns.Add("PS", GetType(String)) - TmpDT.Columns.Add("CodigoPS", GetType(String)) - TmpDT.Columns.Add("SATClaveProdServ", GetType(String)) - TmpDT.Columns.Add("NoIdentificacion", GetType(String)) - TmpDT.Columns.Add("CveTipoPS", GetType(Integer)) - TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer)) - TmpDT.Columns.Add("SerieLote", GetType(String)) - TmpDT.Columns.Add("CuentaPredial", GetType(String)) - TmpDT.Columns.Add("Obs", GetType(String)) - TmpDT.Columns.Add("TiempoEntrega", GetType(String)) - TmpDT.Columns.Add("PU", GetType(Decimal)) - TmpDT.Columns.Add("IVA", GetType(Decimal)) - TmpDT.Columns.Add("ImporteIVA", GetType(Decimal)) - TmpDT.Columns.Add("PorcentajeIVA", GetType(Decimal)) - TmpDT.Columns.Add("ImporteRetIVA", GetType(Decimal)) - TmpDT.Columns.Add("ImporteRetISR", GetType(Decimal)) - TmpDT.Columns.Add("PorcentajeRetIVA", GetType(Decimal)) - TmpDT.Columns.Add("PorcentajeRetISR", GetType(Decimal)) - TmpDT.Columns.Add("ImporteIEPS", GetType(Decimal)) - TmpDT.Columns.Add("IEPS", GetType(Decimal)) - TmpDT.Columns.Add("PorcentajeIEPS", GetType(Decimal)) - TmpDT.Columns.Add("Descuento", GetType(Decimal)) - TmpDT.Columns.Add("TipoDescuento", GetType(Integer)) - TmpDT.Columns.Add("TotalImporte", GetType(Decimal)) - TmpDT.Columns.Add("Total", GetType(Decimal)) - 'Para uso del módulo contable - TmpDT.Columns.Add("AsientoContableVentas", GetType(Integer)) - TmpDT.Columns.Add("IdCtaContVentas", GetType(Integer)) - TmpDT.Columns.Add("AplicaParaConcepto", GetType(Boolean)) - TmpDT.Columns.Add("CveProyecto", GetType(Integer)) - TmpDT.Columns.Add("Proyecto", GetType(String)) - TmpDT.Columns.Add("CveSubProyecto", GetType(Integer)) - TmpDT.Columns.Add("SubProyecto", GetType(String)) - TmpDT.Columns.Add("CveVentaDetallePadre", GetType(Integer)) - - 'TipoDescuento: 1 = Descuento * PU; 2 = Descuento por Total del concepto - TmpDT.Columns.Add("CvePresupuestoIngreso", GetType(Integer)) - TmpDT.Columns.Add("CveFuenteRecaudacion", GetType(Integer)) - 'Contratos - TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer)) - 'Remisiones a Facturas - TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer)) - TmpDT.Columns.Add("CveVentaDetalleRemision", GetType(Integer)) - TmpDT.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer)) - - 'Pedido2 a Facturas - TmpDT.Columns.Add("CveVentaDetallePedido2", GetType(Integer)) - - TmpDT.Columns.Add("Origen", GetType(Integer)) - 'Ordenes Servicio - TmpDT.Columns.Add("CveOS", GetType(Integer)) - TmpDT.Columns.Add("CveOSDetalle", GetType(Integer)) - TmpDT.Columns.Add("SeFacturara", GetType(Integer)) - TmpDT.Columns.Add("Folio", GetType(Integer)) - TmpDT.Columns.Add("Estatus", GetType(String)) - 'Ordenamiento - TmpDT.Columns.Add("Orden", GetType(Integer)) - TmpDT.Columns.Add("TipoDocto", GetType(String)) - 'OC - TmpDT.Columns.Add("CveOrdenCompraDetalle", GetType(Integer)) - TmpDT.Columns.Add("EntregaDirecta", GetType(Integer)) - - TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) - TmpDT.Columns.Add("CantidadFacturadaRem", GetType(Decimal)) - TmpDT.Columns.Add("CantidadFacturadaCot", GetType(Decimal)) - TmpDT.Columns.Add("CantidadFacturadaPed2", GetType(Decimal)) - TmpDT.Columns.Add("CantidadInventario", GetType(Decimal)) - - TmpDT.Columns.Add("ClaveSATFraccionArancelaria", GetType(String)) - TmpDT.Columns.Add("ClaveSATUnidadAduana", GetType(String)) - TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String)) - TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String)) - - TmpDT.Columns.Add("CveTamaño", GetType(Integer)) - TmpDT.Columns.Add("EsCargo", GetType(Boolean)) - - End Sub - Private Function AgregarProductoServicio(Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String, - PU As Decimal, Descuento As Decimal, - CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, - Optional SerieLote As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0, - Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0, - Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, - Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False, Optional PorcentajeIVA As Decimal = 0D) As Boolean - - Dim Retorno As Boolean = False - If Not CvePS > 0 Then - Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Return False - End If - - If (Obs.Length + PS.Length > 1000) Then - Alert(String.Format("El Nombre y observación del producto tiene longitud de {0} caracteres y excede los 1000 caracteres permitidos.", Obs.Length + PS.Length), TipoMensaje.MsgAdvertencia) - Return False - End If - - - Dim Row As DataRow = Nothing - Dim TotalCalculableImpuestos As Decimal = 0 - PU = Math.Round(PU, 6) ' el precio unitario puede llevar hasta 6 decimales permitidos - - Row = TmpDT.NewRow() - Row("CveProyecto") = CveProyecto - Row("Proyecto") = Proyecto - Row("CveSubProyecto") = CveSubProyecto - Row("SubProyecto") = SubProyecto - Row("SerieLote") = SerieLote - Row("TiempoEntrega") = TiempoEntrega - Row("Orden") = TmpDT.Rows.Count + 1 - Row("Cantidad") = Cantidad - Row("CveUM") = CveUM - Row("UM") = UM - Row("CveClasificacion") = CveClasificacion - Row("Clasificacion") = Clasificacion - Row("CvePS") = CvePS - Row("Obs") = Obs - - - - Dim DrPS As DataRow = Nothing - - DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1 - - If DrPS Is Nothing Then - Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia) - Return False - End If - - - DrPS("IEPSPorcentaje") = 0 - - 'verifica si tiene ventaminima - If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDecimal > 0 Then - 'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15... - If Cantidad Mod DrPS("VentaMinima").ToString.ToDecimal <> 0 Then - Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString)) - Return False - End If - End If - - TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento - - Row("PU") = PU - Row("Codigo") = DrPS("Codigo") - Row("NoIdentificacion") = DrPS("Codigo") - Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria") - Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana") - Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion") - Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion") - Row("Consec") = TmpDT.Rows.Count + 1 - - Row("PS") = DrPS("PS") - Row("CodigoPS") = DrPS("PSCodigo").ToString - Row("CveTipoPS") = DrPS("CveTipoPS") - Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario") - Row("CveTamaño") = DrPS("CveTamaño") - - If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion") - If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion") - - Row("PorcentajeIVA") = PorcentajeIVA - - Row("IVA") = Row("PorcentajeIVA") - Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) - - - Row("ImporteRetIVA") = 0 - Row("ImporteRetISR") = 0 - Row("PorcentajeRetIVA") = 0 - Row("PorcentajeRetISR") = 0 - Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje") - Row("ImporteIEPS") = Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) - Row("IEPS") = Row("ImporteIEPS") - Row("Descuento") = Math.Round(Descuento, NumeroDecimales) - Row("TipoDescuento") = 0 - Row("Total") = (Cantidad * PU) - Row("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales) - 'Row("AsientoContableVentas") = DrPS("AsientoContableVentas") - ' Row("IdCtaContVentas") = IdCtaContable - ' Row("AplicaParaConcepto") = AplicaParaConcepto - - Row("SATClaveProdServ") = DrPS("SATClavePS") - Row("SATClaveUM") = DrPS("SATClaveUnidadMedida") - - - Row("EntregaDirecta") = EntregaDirecta - 'Contratos - Row("CveContratoDetalle") = CveContratoDetalle - Row("CveVentaDetalle") = CveVentaDetalle - Row("CveMovimientoDetallePedido") = CveVentaDetalle - Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle - Row("CveVentaDetalleRemision") = CveVentaDetalleRemision - Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion - Row("CveVentaDetallePedido2") = CveVentaDetallePedido2 - Row("CuentaPredial") = CuentaPredial - Row("EsCargo") = EsCargo - - 'RECARGAR GV - TmpDT.Rows.Add(Row) - TmpDT.AcceptChanges() - Retorno = True - Return Retorno - - End Function - Private Sub CreaObjetosVenta(Tipo As Integer) - - Dim SubTotal As Decimal = 0D - Dim IVA As Decimal = 0D - - For Each GvRow As GridViewRow In GvAcum.Rows - If Tipo = 1 Then - If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkCargo").Checked Then - SubTotal = SubTotal + GvRow.DataKey("ImporteCargo").ToDecimal - End If - ElseIf Tipo = 2 Then - If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkBonificacion").Checked Then - SubTotal = SubTotal + GvRow.DataKey("ImporteBonificacion").ToDecimal - End If - End If - Next - - Dim CvePS As Integer = UsuarioActual.Empresa.Funcionalidad(534).ToEntero 'CvePS Distruibuidor Bonificación Nota - Dim CveUnidadMedida As Integer = 0 - Dim CveClasificacion As Integer = 0 - Dim UnidadMedida As String = "" - Dim Clasificacion As String = "" - Dim PS As String = "" - Dim PorcentajeIVA As Decimal = 0D - If CvePS > 0 Then - If SubTotal > 0 Then - Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).Rows(0) - If Dr IsNot Nothing Then - CveUnidadMedida = Dr("CveUnidadMedida").ToString.ToEntero - CveClasificacion = Dr("CveClasificacion").ToString.ToEntero - PS = Dr("PSCodigo").ToString - UnidadMedida = Dr("UnidadMedida").ToString - Clasificacion = Dr("Clasificacion").ToString - End If - PorcentajeIVA = 0.16D - IVA = SubTotal * PorcentajeIVA - End If - End If - - TmpDT.Rows.Clear() - TmpDT.AcceptChanges() - AgregarProductoServicio(1, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePS, PS, "Clientes/Usados", SubTotal, 0, -1, "", DdlSubProyecto.SelectedValue.ToEntero, - DdlSubProyecto.SelectedItem.Text, PorcentajeIVA:=PorcentajeIVA) - - Dim Folio As Integer = -1 - Dim Serie As String = "" - - 'If FolioNotaCredito(Tipo) Then - ' Folio = FolioNotaAcumulador - ' Serie = SerieNotaAcumulador - 'End If - + End If + + If FacturadoBonificacion Then + e.Row.FCCheckBox("ChkBonificacion").Checked = False + e.Row.FCCheckBox("ChkBonificacion").Visible = False + Else + e.Row.FCCheckBox("ChkBonificacion").Checked = False + e.Row.FCCheckBox("ChkBonificacion").Visible = True + End If + + Else + e.Row.FCCheckBox("ChkCargo").Checked = False + e.Row.FCCheckBox("ChkCargo").Visible = False + + e.Row.FCCheckBox("ChkBonificacion").Checked = False + e.Row.FCCheckBox("ChkBonificacion").Visible = False + End If + + End If + + End Sub + + Protected Sub BtnConsultaUsados_Click(sender As Object, e As EventArgs) + CargaUsados() + End Sub + + Private Sub CargaUsados() + + If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then ' Funcionalidad Es Distribuidor + + DivEsDistribuidor.Visible = True + TabUsados.Visible = True + + Dim ObjAcum As New ClsAcumuladores + Dim ImporteCargo As Decimal = 0D + Dim ImporteBonificacion As Decimal = 0D + + If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, TxtFechaIUsados.Text.ToDate, TxtFechaFUsados.Text.ToDate) Then + + GvAcum.DataSource = ObjAcum.DtResultados + + LblUsadosPuntos.Text = (ObjAcum.DtResultados.SUM("Puntos", " CveConcepto = 2 ") - ObjAcum.DtResultados.SUM("Puntos", " CveConcepto IN (1,3) ")).ToDecimal.FormatoNumero(2) + + ImporteCargo = ObjAcum.DtResultados.SUM("ImporteCargo", "(FacturadoCargo = 0 OR FacturadoCargo IS NULL) AND CveConcepto = 1 ").ToDecimal + ImporteBonificacion = ObjAcum.DtResultados.SUM("ImporteBonificacion", "(FacturadoBonificacion = 0 OR FacturadoBonificacion IS NULL) AND CveConcepto = 1 ").ToDecimal + + LblUsadosImpCargo.Text = ImporteCargo.FormatoNumero(2) + LblusadosImpBonificacion.Text = ImporteBonificacion.FormatoNumero(2) + + Else + GvAcum.DataSource = Nothing + + ImporteCargo = 0D + ImporteBonificacion = 0D + + LblUsadosImpCargo.Text = "" + LblusadosImpBonificacion.Text = "" + LblUsadosPuntos.Text = "" + + End If + + 'LnkFacturaUsadosCargos.Visible = If(ImporteCargo > 0, True, False) + LnkFacturaUsadosBonificacion.Visible = If(ImporteBonificacion > 0, True, False) + + ObjAcum.Dispose() + GvAcum.DataBind() + + UpAcciones.Update() + UpUsadosResumen.Update() + UpAcum.Update() + + End If + + End Sub + + Private Sub CreaDTVentas() + TmpDT = New DataTable + TmpDT.Columns.Add("CveVenta", GetType(Integer)) + TmpDT.Columns.Add("Consec", GetType(Integer)) + TmpDT.Columns.Add("Cantidad", GetType(Decimal)) + TmpDT.Columns.Add("Codigo", GetType(String)) + TmpDT.Columns.Add("CveUM", GetType(Integer)) + TmpDT.Columns.Add("UM", GetType(String)) + TmpDT.Columns.Add("SATClaveUM", GetType(String)) + TmpDT.Columns.Add("CveClasificacion", GetType(Integer)) + TmpDT.Columns.Add("Clasificacion", GetType(String)) + TmpDT.Columns.Add("CvePS", GetType(Integer)) + TmpDT.Columns.Add("PS", GetType(String)) + TmpDT.Columns.Add("CodigoPS", GetType(String)) + TmpDT.Columns.Add("SATClaveProdServ", GetType(String)) + TmpDT.Columns.Add("NoIdentificacion", GetType(String)) + TmpDT.Columns.Add("CveTipoPS", GetType(Integer)) + TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer)) + TmpDT.Columns.Add("SerieLote", GetType(String)) + TmpDT.Columns.Add("CuentaPredial", GetType(String)) + TmpDT.Columns.Add("Obs", GetType(String)) + TmpDT.Columns.Add("TiempoEntrega", GetType(String)) + TmpDT.Columns.Add("PU", GetType(Decimal)) + TmpDT.Columns.Add("IVA", GetType(Decimal)) + TmpDT.Columns.Add("ImporteIVA", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeIVA", GetType(Decimal)) + TmpDT.Columns.Add("ImporteRetIVA", GetType(Decimal)) + TmpDT.Columns.Add("ImporteRetISR", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeRetIVA", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeRetISR", GetType(Decimal)) + TmpDT.Columns.Add("ImporteIEPS", GetType(Decimal)) + TmpDT.Columns.Add("IEPS", GetType(Decimal)) + TmpDT.Columns.Add("PorcentajeIEPS", GetType(Decimal)) + TmpDT.Columns.Add("Descuento", GetType(Decimal)) + TmpDT.Columns.Add("TipoDescuento", GetType(Integer)) + TmpDT.Columns.Add("TotalImporte", GetType(Decimal)) + TmpDT.Columns.Add("Total", GetType(Decimal)) + 'Para uso del módulo contable + TmpDT.Columns.Add("AsientoContableVentas", GetType(Integer)) + TmpDT.Columns.Add("IdCtaContVentas", GetType(Integer)) + TmpDT.Columns.Add("AplicaParaConcepto", GetType(Boolean)) + TmpDT.Columns.Add("CveProyecto", GetType(Integer)) + TmpDT.Columns.Add("Proyecto", GetType(String)) + TmpDT.Columns.Add("CveSubProyecto", GetType(Integer)) + TmpDT.Columns.Add("SubProyecto", GetType(String)) + TmpDT.Columns.Add("CveVentaDetallePadre", GetType(Integer)) + + 'TipoDescuento: 1 = Descuento * PU; 2 = Descuento por Total del concepto + TmpDT.Columns.Add("CvePresupuestoIngreso", GetType(Integer)) + TmpDT.Columns.Add("CveFuenteRecaudacion", GetType(Integer)) + 'Contratos + TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer)) + 'Remisiones a Facturas + TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer)) + TmpDT.Columns.Add("CveVentaDetalleRemision", GetType(Integer)) + TmpDT.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer)) + + 'Pedido2 a Facturas + TmpDT.Columns.Add("CveVentaDetallePedido2", GetType(Integer)) + + TmpDT.Columns.Add("Origen", GetType(Integer)) + 'Ordenes Servicio + TmpDT.Columns.Add("CveOS", GetType(Integer)) + TmpDT.Columns.Add("CveOSDetalle", GetType(Integer)) + TmpDT.Columns.Add("SeFacturara", GetType(Integer)) + TmpDT.Columns.Add("Folio", GetType(Integer)) + TmpDT.Columns.Add("Estatus", GetType(String)) + 'Ordenamiento + TmpDT.Columns.Add("Orden", GetType(Integer)) + TmpDT.Columns.Add("TipoDocto", GetType(String)) + 'OC + TmpDT.Columns.Add("CveOrdenCompraDetalle", GetType(Integer)) + TmpDT.Columns.Add("EntregaDirecta", GetType(Integer)) + + TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer)) + TmpDT.Columns.Add("CantidadFacturadaRem", GetType(Decimal)) + TmpDT.Columns.Add("CantidadFacturadaCot", GetType(Decimal)) + TmpDT.Columns.Add("CantidadFacturadaPed2", GetType(Decimal)) + TmpDT.Columns.Add("CantidadInventario", GetType(Decimal)) + + TmpDT.Columns.Add("ClaveSATFraccionArancelaria", GetType(String)) + TmpDT.Columns.Add("ClaveSATUnidadAduana", GetType(String)) + TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String)) + TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String)) + + TmpDT.Columns.Add("CveTamaño", GetType(Integer)) + TmpDT.Columns.Add("EsCargo", GetType(Boolean)) + + End Sub + Private Function AgregarProductoServicio(Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String, + PU As Decimal, Descuento As Decimal, + CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, + Optional SerieLote As String = "", Optional TiempoEntrega As String = "", Optional EntregaDirecta As Integer = 0, + Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0, + Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, + Optional CuentaPredial As String = "", Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional EsCargo As Boolean = False, Optional PorcentajeIVA As Decimal = 0D) As Boolean + + Dim Retorno As Boolean = False + If Not CvePS > 0 Then + Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Return False + End If + + If (Obs.Length + PS.Length > 1000) Then + Alert(String.Format("El Nombre y observación del producto tiene longitud de {0} caracteres y excede los 1000 caracteres permitidos.", Obs.Length + PS.Length), TipoMensaje.MsgAdvertencia) + Return False + End If + + + Dim Row As DataRow = Nothing + Dim TotalCalculableImpuestos As Decimal = 0 + PU = Math.Round(PU, 6) ' el precio unitario puede llevar hasta 6 decimales permitidos + + Row = TmpDT.NewRow() + Row("CveProyecto") = CveProyecto + Row("Proyecto") = Proyecto + Row("CveSubProyecto") = CveSubProyecto + Row("SubProyecto") = SubProyecto + Row("SerieLote") = SerieLote + Row("TiempoEntrega") = TiempoEntrega + Row("Orden") = TmpDT.Rows.Count + 1 + Row("Cantidad") = Cantidad + Row("CveUM") = CveUM + Row("UM") = UM + Row("CveClasificacion") = CveClasificacion + Row("Clasificacion") = Clasificacion + Row("CvePS") = CvePS + Row("Obs") = Obs + + + + Dim DrPS As DataRow = Nothing + + DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1 + + If DrPS Is Nothing Then + Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia) + Return False + End If + + + DrPS("IEPSPorcentaje") = 0 + + 'verifica si tiene ventaminima + If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDecimal > 0 Then + 'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15... + If Cantidad Mod DrPS("VentaMinima").ToString.ToDecimal <> 0 Then + Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString)) + Return False + End If + End If + + TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento + + Row("PU") = PU + Row("Codigo") = DrPS("Codigo") + Row("NoIdentificacion") = DrPS("Codigo") + Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria") + Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana") + Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion") + Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion") + Row("Consec") = TmpDT.Rows.Count + 1 + + Row("PS") = DrPS("PS") + Row("CodigoPS") = DrPS("PSCodigo").ToString + Row("CveTipoPS") = DrPS("CveTipoPS") + Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario") + Row("CveTamaño") = DrPS("CveTamaño") + + If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion") + If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion") + + Row("PorcentajeIVA") = PorcentajeIVA + + Row("IVA") = Row("PorcentajeIVA") + Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + + + Row("ImporteRetIVA") = 0 + Row("ImporteRetISR") = 0 + Row("PorcentajeRetIVA") = 0 + Row("PorcentajeRetISR") = 0 + Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje") + Row("ImporteIEPS") = Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales) + Row("IEPS") = Row("ImporteIEPS") + Row("Descuento") = Math.Round(Descuento, NumeroDecimales) + Row("TipoDescuento") = 0 + Row("Total") = (Cantidad * PU) + Row("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales) + 'Row("AsientoContableVentas") = DrPS("AsientoContableVentas") + ' Row("IdCtaContVentas") = IdCtaContable + ' Row("AplicaParaConcepto") = AplicaParaConcepto + + Row("SATClaveProdServ") = DrPS("SATClavePS") + Row("SATClaveUM") = DrPS("SATClaveUnidadMedida") + + + Row("EntregaDirecta") = EntregaDirecta + 'Contratos + Row("CveContratoDetalle") = CveContratoDetalle + Row("CveVentaDetalle") = CveVentaDetalle + Row("CveMovimientoDetallePedido") = CveVentaDetalle + Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle + Row("CveVentaDetalleRemision") = CveVentaDetalleRemision + Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion + Row("CveVentaDetallePedido2") = CveVentaDetallePedido2 + Row("CuentaPredial") = CuentaPredial + Row("EsCargo") = EsCargo + + 'RECARGAR GV + TmpDT.Rows.Add(Row) + TmpDT.AcceptChanges() + Retorno = True + Return Retorno + + End Function + Private Sub CreaObjetosVenta(Tipo As Integer) + + Dim SubTotal As Decimal = 0D + Dim IVA As Decimal = 0D + + For Each GvRow As GridViewRow In GvAcum.Rows + If Tipo = 1 Then + If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkCargo").Checked Then + SubTotal = SubTotal + GvRow.DataKey("ImporteCargo").ToDecimal + End If + ElseIf Tipo = 2 Then + If GvRow.DataKey("CveConcepto").ToEntero = 1 And GvRow.FCCheckBox("ChkBonificacion").Checked Then + SubTotal = SubTotal + GvRow.DataKey("ImporteBonificacion").ToDecimal + End If + End If + Next + + Dim CvePS As Integer = UsuarioActual.Empresa.Funcionalidad(534).ToEntero 'CvePS Distruibuidor Bonificación Nota + Dim CveUnidadMedida As Integer = 0 + Dim CveClasificacion As Integer = 0 + Dim UnidadMedida As String = "" + Dim Clasificacion As String = "" + Dim PS As String = "" + Dim PorcentajeIVA As Decimal = 0D + If CvePS > 0 Then + If SubTotal > 0 Then + Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).Rows(0) + If Dr IsNot Nothing Then + CveUnidadMedida = Dr("CveUnidadMedida").ToString.ToEntero + CveClasificacion = Dr("CveClasificacion").ToString.ToEntero + PS = Dr("PSCodigo").ToString + UnidadMedida = Dr("UnidadMedida").ToString + Clasificacion = Dr("Clasificacion").ToString + End If + PorcentajeIVA = 0.16D + IVA = SubTotal * PorcentajeIVA + End If + End If + + TmpDT.Rows.Clear() + TmpDT.AcceptChanges() + AgregarProductoServicio(1, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePS, PS, "Clientes/Usados", SubTotal, 0, -1, "", DdlSubProyecto.SelectedValue.ToEntero, + DdlSubProyecto.SelectedItem.Text, PorcentajeIVA:=PorcentajeIVA) + + Dim Folio As Integer = -1 + Dim Serie As String = "" + + 'If FolioNotaCredito(Tipo) Then + ' Folio = FolioNotaAcumulador + ' Serie = SerieNotaAcumulador + 'End If + If ObjFactura IsNot Nothing Then ObjFactura.Dispose() ObjFactura = Nothing - End If - - ObjFactura = New Modelos.Factura(UsuarioActual) - ObjFactura.CveUsuario = UsuarioActual.CveUsuario - ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa - ObjFactura.CveVenta = -1 - ObjFactura.Version = "3.3" - ObjFactura.TipoCambio = 1 - ObjFactura.TipoCambioDolares = 0 - ObjFactura.ConvertirPesos = False - ObjFactura.ConvertirDolares = False - ObjFactura.CveMoneda = 1 - ObjFactura.Moneda = "Pesos" - ObjFactura.MonedaSAT = "MXN" - ObjFactura.TipoDocto = "RNC" - - ObjFactura.Folio = Folio - ObjFactura.Serie = Serie - - ObjFactura.Fecha = Now - ObjFactura.CvePrePoliza = -1 - ObjFactura.CveMetodoPago = DdlMetodoPago.SelectedValue.ToEntero - ObjFactura.MetodoPago = DdlMetodoPago.SelectedItem.Text - ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {DdlMetodoPago.SelectedValue}") - ObjFactura.FechaVencimiento = TxtFechaPago.Text.ToDate - - ObjFactura.CveMetodoPago33 = DdlMetodoPago33.SelectedValue.ToEntero - ObjFactura.MetodoPago33 = If(DdlMetodoPago33.SelectedValue.ToEntero > 0, DdlMetodoPago33.SelectedItem.Text, "") - ObjFactura.ClaveMetodoPagoSAT = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", $"CveMetodoPago = {DdlMetodoPago33.SelectedValue}") - - ObjFactura.CveFormaPago33 = DdlFormaPago33.SelectedValue.ToEntero - ObjFactura.FormaPago33 = If(DdlFormaPago33.SelectedValue.ToEntero > 0, DdlFormaPago33.SelectedItem.Text, "") - ObjFactura.FormaPagoSAT33 = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", $"CveFormaPago = {DdlFormaPago33.SelectedValue}") - - ObjFactura.CveUsoCFDI = DdlUsoCFDI.SelectedValue.ToEntero - ObjFactura.UsoCFDI = If(DdlUsoCFDI.SelectedValue.ToEntero > 0, DdlUsoCFDI.SelectedItem.Text, "") - ObjFactura.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}") - - ObjFactura.UsuarioCreo = UsuarioActual.Nombre - ObjFactura.CveCondicionEntrega = -1 - ObjFactura.CondicionEntrega = "" - - ObjFactura.CondicionesPago = 0 ' 0 - Contado, 1 - Credito, 2 - termianl - ObjFactura.FormaPago = 0 - - ObjFactura.AtnA = "" - ObjFactura.FordGSDB = "" - - ObjFactura.NumeroContrato = "" - ObjFactura.DescripcionContrato = "" - ObjFactura.NumeroDescripcionContrato = "" - ObjFactura.PedidoContrato = "" - ObjFactura.OrdenCompra = "" - - Select Case ObjFactura.TipoDocto - Case "Ing" - ObjFactura.TipoDocumento = "Factura" - Case "Rem" - ObjFactura.TipoDocumento = "Remision" - Case "Cot" - ObjFactura.TipoDocumento = "Cotizacion" - Case "Egs" - ObjFactura.TipoDocumento = "Nota de Crédito" - Case "Dev" - ObjFactura.TipoDocumento = "Nota de Devolución" - Case "DPe" - ObjFactura.TipoDocumento = "Devolución de pedido" - Case "PeC" - ObjFactura.TipoDocumento = "Consignación de Pedido" - Case Else - ObjFactura.TipoDocumento = "" - End Select - - ObjFactura.Fech1 = Now - ObjFactura.Fech2 = Now - ObjFactura.Fech3 = Now - - ObjFactura.Alfa1 = "" - ObjFactura.Alfa2 = "" - ObjFactura.Alfa3 = "" - - ObjFactura.Num1 = 0 - ObjFactura.Num2 = 0 - - ObjFactura.Num3 = 0 - ObjFactura.FechaPago = Now - - ObjFactura.CveCorte = -1 - ObjFactura.CveMesa = -1 - ObjFactura.NumeroPersonas = 0 - ObjFactura.CveContrato = -1 - - ObjFactura.CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero - ObjFactura.Entrega = "" - ObjFactura.Vigencia = Now - - ObjFactura.CveVentaPadre = -1 - - ObjFactura.CveVendedor = DdlVendedor.SelectedValue.ToEntero - If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then - DdlVendedor.Enabled = False - End If - - ObjFactura.FechaEjecucion = Now - ObjFactura.CveSubProyecto = UsuarioActual.CveSubProyecto - ObjFactura.CveSubProyectoCobranza = UsuarioActual.CveSubProyecto - ObjFactura.CveSubProyectoEjecucion = UsuarioActual.CveSubProyecto - ObjFactura.AtencionA = "-1" - ObjFactura.MotivoDescuento = "" - ObjFactura.Observaciones = "" - ObjFactura.Det_OrdenCompra = "" - ObjFactura.Det_FechaOrdenCompra = "" - ObjFactura.MonedaAbreviatura = "" - - ObjFactura.SubTotal = SubTotal - ObjFactura.Descuento = 0 - ObjFactura.Amortizacion = 0 - ObjFactura.IVA = IVA - ObjFactura.RetIVA = 0 - ObjFactura.RetISR = 0 - ObjFactura.IEPS = 0 - ObjFactura.Total = SubTotal + IVA - ObjFactura.DtDetalle = TmpDT - ObjFactura.DtPagos = DtPagos - ObjFactura.DtPromociones = DtPromociones - - '' CLIENTE - ObjFactura.CveCliente = CveCliente - ObjFactura.SetCliente() - - ''SUCURSAL - - ObjFactura.SetSubProyectoMatriz(Me) - ObjFactura.SetSubProyecto(Me) - ObjFactura.ClienteSucursal = New Modelos.SucursalModel - - If ObjFactura.Timbre.Comprobante.TipoComprobante = "E" Then - If ObjFactura.TipoDocumento.Contiene("Nota de Crédito") Then - ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "01" - ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso" - End If - If ObjFactura.TipoDocumento.Contiene("Nota de Devolución") Then - ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "03" - ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso" - End If - - End If - - If ObjFactura.TipoDocto.Contiene("Egs", "RNC") Then - ObjFactura.CveTipoRelacion = -1 - End If - - Dim UsadosBonificacion As List(Of Integer) = New List(Of Integer) - For Each GvRow As GridViewRow In GvAcum.Rows - Dim CveMovto As Integer = GvRow.DataKey("CveMovto").ToEntero - If (Tipo = 1 And GvRow.FCCheckBox("ChkCargo").Checked) Or (Tipo = 2 And GvRow.FCCheckBox("ChkBonificacion").Checked) Then - UsadosBonificacion.Add(CveMovto) - End If - Next - - ObjFactura.UsadosBonificacion = UsadosBonificacion - ObjFactura.TipoBonificacion = Tipo - - Dim FM As New Modelos.FemsaFactura - Dim TmpDT7Eleven As New DataTable - Dim TmpDTComplementosTimbrado As New DataTable - - 'PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado) - + End If + + ObjFactura = New Modelos.Factura(UsuarioActual) + ObjFactura.CveUsuario = UsuarioActual.CveUsuario + ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa + ObjFactura.CveVenta = -1 + ObjFactura.Version = "3.3" + ObjFactura.TipoCambio = 1 + ObjFactura.TipoCambioDolares = 0 + ObjFactura.ConvertirPesos = False + ObjFactura.ConvertirDolares = False + ObjFactura.CveMoneda = 1 + ObjFactura.Moneda = "Pesos" + ObjFactura.MonedaSAT = "MXN" + ObjFactura.TipoDocto = "RNC" + + ObjFactura.Folio = Folio + ObjFactura.Serie = Serie + + ObjFactura.Fecha = Now + ObjFactura.CvePrePoliza = -1 + ObjFactura.CveMetodoPago = DdlMetodoPago.SelectedValue.ToEntero + ObjFactura.MetodoPago = DdlMetodoPago.SelectedItem.Text + ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {DdlMetodoPago.SelectedValue}") + ObjFactura.FechaVencimiento = TxtFechaPago.Text.ToDate + + ObjFactura.CveMetodoPago33 = DdlMetodoPago33.SelectedValue.ToEntero + ObjFactura.MetodoPago33 = If(DdlMetodoPago33.SelectedValue.ToEntero > 0, DdlMetodoPago33.SelectedItem.Text, "") + ObjFactura.ClaveMetodoPagoSAT = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", $"CveMetodoPago = {DdlMetodoPago33.SelectedValue}") + + ObjFactura.CveFormaPago33 = DdlFormaPago33.SelectedValue.ToEntero + ObjFactura.FormaPago33 = If(DdlFormaPago33.SelectedValue.ToEntero > 0, DdlFormaPago33.SelectedItem.Text, "") + ObjFactura.FormaPagoSAT33 = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", $"CveFormaPago = {DdlFormaPago33.SelectedValue}") + + ObjFactura.CveUsoCFDI = DdlUsoCFDI.SelectedValue.ToEntero + ObjFactura.UsoCFDI = If(DdlUsoCFDI.SelectedValue.ToEntero > 0, DdlUsoCFDI.SelectedItem.Text, "") + ObjFactura.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}") + + ObjFactura.UsuarioCreo = UsuarioActual.Nombre + ObjFactura.CveCondicionEntrega = -1 + ObjFactura.CondicionEntrega = "" + + ObjFactura.CondicionesPago = 0 ' 0 - Contado, 1 - Credito, 2 - termianl + ObjFactura.FormaPago = 0 + + ObjFactura.AtnA = "" + ObjFactura.FordGSDB = "" + + ObjFactura.NumeroContrato = "" + ObjFactura.DescripcionContrato = "" + ObjFactura.NumeroDescripcionContrato = "" + ObjFactura.PedidoContrato = "" + ObjFactura.OrdenCompra = "" + + Select Case ObjFactura.TipoDocto + Case "Ing" + ObjFactura.TipoDocumento = "Factura" + Case "Rem" + ObjFactura.TipoDocumento = "Remision" + Case "Cot" + ObjFactura.TipoDocumento = "Cotizacion" + Case "Egs" + ObjFactura.TipoDocumento = "Nota de Crédito" + Case "Dev" + ObjFactura.TipoDocumento = "Nota de Devolución" + Case "DPe" + ObjFactura.TipoDocumento = "Devolución de pedido" + Case "PeC" + ObjFactura.TipoDocumento = "Consignación de Pedido" + Case Else + ObjFactura.TipoDocumento = "" + End Select + + ObjFactura.Fech1 = Now + ObjFactura.Fech2 = Now + ObjFactura.Fech3 = Now + + ObjFactura.Alfa1 = "" + ObjFactura.Alfa2 = "" + ObjFactura.Alfa3 = "" + + ObjFactura.Num1 = 0 + ObjFactura.Num2 = 0 + + ObjFactura.Num3 = 0 + ObjFactura.FechaPago = Now + + ObjFactura.CveCorte = -1 + ObjFactura.CveMesa = -1 + ObjFactura.NumeroPersonas = 0 + ObjFactura.CveContrato = -1 + + ObjFactura.CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero + ObjFactura.Entrega = "" + ObjFactura.Vigencia = Now + + ObjFactura.CveVentaPadre = -1 + + ObjFactura.CveVendedor = DdlVendedor.SelectedValue.ToEntero + If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then + DdlVendedor.Enabled = False + End If + + ObjFactura.FechaEjecucion = Now + ObjFactura.CveSubProyecto = UsuarioActual.CveSubProyecto + ObjFactura.CveSubProyectoCobranza = UsuarioActual.CveSubProyecto + ObjFactura.CveSubProyectoEjecucion = UsuarioActual.CveSubProyecto + ObjFactura.AtencionA = "-1" + ObjFactura.MotivoDescuento = "" + ObjFactura.Observaciones = "" + ObjFactura.Det_OrdenCompra = "" + ObjFactura.Det_FechaOrdenCompra = "" + ObjFactura.MonedaAbreviatura = "" + + ObjFactura.SubTotal = SubTotal + ObjFactura.Descuento = 0 + ObjFactura.Amortizacion = 0 + ObjFactura.IVA = IVA + ObjFactura.RetIVA = 0 + ObjFactura.RetISR = 0 + ObjFactura.IEPS = 0 + ObjFactura.Total = SubTotal + IVA + ObjFactura.DtDetalle = TmpDT + ObjFactura.DtPagos = DtPagos + ObjFactura.DtPromociones = DtPromociones + + '' CLIENTE + ObjFactura.CveCliente = CveCliente + ObjFactura.SetCliente() + + ''SUCURSAL + + ObjFactura.SetSubProyectoMatriz(Me) + ObjFactura.SetSubProyecto(Me) + ObjFactura.ClienteSucursal = New Modelos.SucursalModel + + If ObjFactura.Timbre.Comprobante.TipoComprobante = "E" Then + If ObjFactura.TipoDocumento.Contiene("Nota de Crédito") Then + ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "01" + ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso" + End If + If ObjFactura.TipoDocumento.Contiene("Nota de Devolución") Then + ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "03" + ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso" + End If + + End If + + If ObjFactura.TipoDocto.Contiene("Egs", "RNC") Then + ObjFactura.CveTipoRelacion = -1 + End If + + Dim UsadosBonificacion As List(Of Integer) = New List(Of Integer) + For Each GvRow As GridViewRow In GvAcum.Rows + Dim CveMovto As Integer = GvRow.DataKey("CveMovto").ToEntero + If (Tipo = 1 And GvRow.FCCheckBox("ChkCargo").Checked) Or (Tipo = 2 And GvRow.FCCheckBox("ChkBonificacion").Checked) Then + UsadosBonificacion.Add(CveMovto) + End If + Next + + ObjFactura.UsadosBonificacion = UsadosBonificacion + ObjFactura.TipoBonificacion = Tipo + + Dim FM As New Modelos.FemsaFactura + Dim TmpDT7Eleven As New DataTable + Dim TmpDTComplementosTimbrado As New DataTable + + 'PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado) + ObjFactura.FemsaFactura = FM ' ObjFactura.Timbre = PreParaTimbre(ObjFactura) @@ -9942,52 +9942,52 @@ Partial Class Clientes ' Return Timbre 'End Function -#End Region +#End Region -#Region "C L I E N T E S G R I D S I M P R I M I R P D F/Excel" - Private Sub LnkCotizacionesPDF_Click(sender As Object, e As EventArgs) Handles LnkCotizacionesPDF.Click - ImprimeGridsProveedores("PDF", DtCotizaciones, "RepClientesCotizaciones") +#Region "C L I E N T E S G R I D S I M P R I M I R P D F/Excel" + Private Sub LnkCotizacionesPDF_Click(sender As Object, e As EventArgs) Handles LnkCotizacionesPDF.Click + ImprimeGridsProveedores("PDF", DtCotizaciones, "RepClientesCotizaciones") End Sub - Private Sub LnkCotizacionesExcel_Click(sender As Object, e As EventArgs) Handles LnkCotizacionesExcel.Click - ImprimeGridsProveedores("Excel", DtCotizaciones, "RepClientesCotizaciones") + Private Sub LnkCotizacionesExcel_Click(sender As Object, e As EventArgs) Handles LnkCotizacionesExcel.Click + ImprimeGridsProveedores("Excel", DtCotizaciones, "RepClientesCotizaciones") End Sub - Private Sub LnkCxCActivasPDF_Click(sender As Object, e As EventArgs) Handles LnkCxCActivasPDF.Click - ImprimeGridsProveedores("PDF", DtCxCActivas, "RepClientesCxCActivas") + Private Sub LnkCxCActivasPDF_Click(sender As Object, e As EventArgs) Handles LnkCxCActivasPDF.Click + ImprimeGridsProveedores("PDF", DtCxCActivas, "RepClientesCxCActivas") End Sub - Private Sub LnkCxCActivasExcel_Click(sender As Object, e As EventArgs) Handles LnkCxCActivasExcel.Click - ImprimeGridsProveedores("Excel", DtCxCActivas, "RepClientesCxCActivas") + Private Sub LnkCxCActivasExcel_Click(sender As Object, e As EventArgs) Handles LnkCxCActivasExcel.Click + ImprimeGridsProveedores("Excel", DtCxCActivas, "RepClientesCxCActivas") End Sub - Private Sub LnkHistorialCxCPDF_Click(sender As Object, e As EventArgs) Handles LnkHistorialCxCPDF.Click - ImprimeGridsProveedores("PDF", DtHistorialCxC, "RepClientesHistorialCxC") + Private Sub LnkHistorialCxCPDF_Click(sender As Object, e As EventArgs) Handles LnkHistorialCxCPDF.Click + ImprimeGridsProveedores("PDF", DtHistorialCxC, "RepClientesHistorialCxC") End Sub - Private Sub LnkHistorialCxCExcel_Click(sender As Object, e As EventArgs) Handles LnkHistorialCxCExcel.Click - ImprimeGridsProveedores("Excel", DtHistorialCxC, "RepClientesHistorialCxC") + Private Sub LnkHistorialCxCExcel_Click(sender As Object, e As EventArgs) Handles LnkHistorialCxCExcel.Click + ImprimeGridsProveedores("Excel", DtHistorialCxC, "RepClientesHistorialCxC") End Sub - Private Sub LnkAnticipoClientePDF_Click(sender As Object, e As EventArgs) Handles LnkAnticipoClientePDF.Click - ImprimeGridsProveedores("PDF", DtClientesAnticipo, "RepClientesAnticipos") + Private Sub LnkAnticipoClientePDF_Click(sender As Object, e As EventArgs) Handles LnkAnticipoClientePDF.Click + ImprimeGridsProveedores("PDF", DtClientesAnticipo, "RepClientesAnticipos") End Sub - Private Sub LnkAnticipoClienteExcel_Click(sender As Object, e As EventArgs) Handles LnkAnticipoClienteExcel.Click - ImprimeGridsProveedores("Excel", DtClientesAnticipo, "RepClientesAnticipos") + Private Sub LnkAnticipoClienteExcel_Click(sender As Object, e As EventArgs) Handles LnkAnticipoClienteExcel.Click + ImprimeGridsProveedores("Excel", DtClientesAnticipo, "RepClientesAnticipos") End Sub - Private Sub LnkAnticipoHistorialPDF_Click(sender As Object, e As EventArgs) Handles LnkAnticipoHistorialPDF.Click - ImprimeGridsProveedores("PDF", DtAnticipoHistorial, "RepClientesAnticipoHistorial") + Private Sub LnkAnticipoHistorialPDF_Click(sender As Object, e As EventArgs) Handles LnkAnticipoHistorialPDF.Click + ImprimeGridsProveedores("PDF", DtAnticipoHistorial, "RepClientesAnticipoHistorial") End Sub - Private Sub LnkAnticipoHistorialExcel_Click(sender As Object, e As EventArgs) Handles LnkAnticipoHistorialExcel.Click - ImprimeGridsProveedores("Excel", DtAnticipoHistorial, "RepClientesAnticipoHistorial") + Private Sub LnkAnticipoHistorialExcel_Click(sender As Object, e As EventArgs) Handles LnkAnticipoHistorialExcel.Click + ImprimeGridsProveedores("Excel", DtAnticipoHistorial, "RepClientesAnticipoHistorial") End Sub - Private Sub LnkCuentasBancariasPDF_Click(sender As Object, e As EventArgs) Handles LnkCuentasBancariasPDF.Click - ImprimeGridsProveedores("PDF", DTCuentasBancos, "RepClientesCuentasBancarias") + Private Sub LnkCuentasBancariasPDF_Click(sender As Object, e As EventArgs) Handles LnkCuentasBancariasPDF.Click + ImprimeGridsProveedores("PDF", DTCuentasBancos, "RepClientesCuentasBancarias") End Sub - Private Sub LnkCuentasBancariasExcel_Click(sender As Object, e As EventArgs) Handles LnkCuentasBancariasExcel.Click - ImprimeGridsProveedores("Excel", DTCuentasBancos, "RepClientesCuentasBancarias") + Private Sub LnkCuentasBancariasExcel_Click(sender As Object, e As EventArgs) Handles LnkCuentasBancariasExcel.Click + ImprimeGridsProveedores("Excel", DTCuentasBancos, "RepClientesCuentasBancarias") End Sub - Private Sub ImprimeGridsProveedores(Formato As String, DtTemp As DataTable, NombreFormato As String) + Private Sub ImprimeGridsProveedores(Formato As String, DtTemp As DataTable, NombreFormato As String) If DtTemp IsNot Nothing And DtTemp.Rows.Count > 0 Then Dim params As New List(Of ReportParameter) @@ -10006,7 +10006,7 @@ Partial Class Clientes ImprimirPDF("Empresas\Grales\Formatos\" & NombreFormato & ".rdlc", DtTemp, params, NombreFormato & "_" & Now.ToString("yyyyMMddhhmmss"), Formato:=Formato) Else Alert("No se encontró información.", TipoMensaje.MsgAdvertencia) - End If + End If End Sub Private Sub LnkUsadosReset_Click(sender As Object, e As EventArgs) Handles LnkUsadosReset.Click @@ -10038,5 +10038,5 @@ Partial Class Clientes End If End Sub -End Class - +End Class +