diff --git a/App_Code/ClsSubProyectos.vb b/App_Code/ClsSubProyectos.vb
index f07ce9213..97c8bd94d 100644
--- a/App_Code/ClsSubProyectos.vb
+++ b/App_Code/ClsSubProyectos.vb
@@ -335,7 +335,7 @@ Public Class ClsSubProyectos
Public Function AddCentroCosto(SubProyecto As String, IdSegNeg As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveProyecto As Integer, Optional Serie As String = "", Optional IVA As Double = 0.0, Optional Calle As String = "", Optional NoExt As String = "",
Optional NoInt As String = "", Optional Colonia As String = "", Optional Localidad As String = "", Optional Municipio As String = "", Optional Estado As String = "", Optional Pais As String = "", Optional CP As String = "", Optional TipoSucursal As Integer = 0, Optional EsSucursal As Integer = 0,
Optional CvePais As Integer = -1, Optional CveEstado As Integer = -1, Optional CveMunicipio As Integer = -1, Optional CveColonia As Integer = -1, Optional AplicaComercioExterior As Boolean = False, Optional Correo As String = "", Optional CvePrecioLista As Integer = -1,
- Optional Telefono As String = "", Optional NoVerificaAlmacen As Boolean = False, Optional CodigoSucursal As String = "") As Boolean
+ Optional Telefono As String = "", Optional NoVerificaAlmacen As Boolean = False, Optional CodigoSucursal As String = "", Optional CveLocalidad As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_CentroCostoAdd")
@@ -369,6 +369,7 @@ Public Class ClsSubProyectos
.Add("@Telefono", SqlDbType.VarChar).Value = Telefono
.Add("@NoVerificaAlmacen", SqlDbType.Bit).Value = NoVerificaAlmacen
.Add("@CodigoSucursal", SqlDbType.VarChar).Value = CodigoSucursal
+
.Add("@CveSubProyecto", SqlDbType.Int).Direction = ParameterDirection.Output
End With
@@ -391,7 +392,7 @@ Public Class ClsSubProyectos
Public Function UpdateCentroCosto(CveSubProyecto As Integer, SubProyecto As String, IdSegNeg As Integer, Estatus As Integer, CveUsuario As Integer, CveEmpresa As Integer, CveProyecto As Integer, Optional Serie As String = "", Optional IVA As Double = 0.0, Optional Calle As String = "", Optional NoExt As String = "",
Optional NoInt As String = "", Optional Colonia As String = "", Optional Localidad As String = "", Optional Municipio As String = "", Optional Estado As String = "", Optional Pais As String = "", Optional CP As String = "", Optional TipoSucursal As Integer = 0, Optional EsSucursal As Integer = 0,
Optional CvePais As Integer = -1, Optional CveEstado As Integer = -1, Optional CveMunicipio As Integer = -1, Optional CveColonia As Integer = -1, Optional AplicaComercioExterior As Boolean = False, Optional Correo As String = "", Optional CvePrecioLista As Integer = -1,
- Optional Telefono As String = "", Optional HorarioVerano As Integer = Nothing, Optional HorarioInvierno As Integer = Nothing, Optional NoVerificaAlmacen As Boolean = False, Optional CodigoSucursal As String = "") As Boolean
+ Optional Telefono As String = "", Optional HorarioVerano As Integer = Nothing, Optional HorarioInvierno As Integer = Nothing, Optional NoVerificaAlmacen As Boolean = False, Optional CodigoSucursal As String = "", Optional CveLocalidad As Integer = -1) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_CentroCostoUpdate")
@@ -429,6 +430,8 @@ Public Class ClsSubProyectos
.Add("@HorarioInvierno", SqlDbType.Int).Value = HorarioInvierno
.Add("@NoVerificaAlmacen", SqlDbType.Bit).Value = NoVerificaAlmacen
.Add("@CodigoSucursal", SqlDbType.VarChar).Value = CodigoSucursal
+ .Add("@CveLocalidad", SqlDbType.Int).Value = CveLocalidad
+
End With
Try
diff --git a/Planeacion/CatSubProyectos.aspx b/Planeacion/CatSubProyectos.aspx
index 03c8f97f5..4535b4e75 100644
--- a/Planeacion/CatSubProyectos.aspx
+++ b/Planeacion/CatSubProyectos.aspx
@@ -83,7 +83,7 @@
@@ -120,6 +120,11 @@
+
+
+
+
+
@@ -180,7 +185,7 @@
-
+
@@ -273,18 +278,81 @@
-
+
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -322,38 +390,19 @@
-
+
+
+
+
+
+<%--
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
+
+
-
+ --%>
@@ -375,7 +424,7 @@
-
diff --git a/Planeacion/CatSubProyectos.aspx.vb b/Planeacion/CatSubProyectos.aspx.vb
index 1d89bde3c..eff61c7fb 100644
--- a/Planeacion/CatSubProyectos.aspx.vb
+++ b/Planeacion/CatSubProyectos.aspx.vb
@@ -74,6 +74,7 @@ Partial Class CatSubProyectos
CargaEstado()
CargaMunicipio()
CargaColonia()
+ CargaLocalidad()
CargaPrecioLista()
@@ -301,7 +302,9 @@ Partial Class CatSubProyectos
DdlMunicipio.SelectedValueExist(GvRow.DataKey("CveMunicipio"))
CargaColonia()
DdlColonia.SelectedValueExist(GvRow.DataKey("CveColonia"))
- AplicaComercio()
+ CargaLocalidad()
+ DdlLocalidad.SelectedValueExist(GvRow.DataKey("CveLocalidad"))
+ 'AplicaComercio()
ChkNoVerificaAlmacen.Checked = If(GvRow.DataKey("NoVerificaAlmacen").ToString = "True", True, False)
TxtCodigoSucursal.Text = (GvRow.DataKey("CodigoSucursal"))
@@ -368,12 +371,52 @@ Partial Class CatSubProyectos
Dim IdSeg As Integer
If DdlSegmentoNegocio.Visible = True Then IdSeg = DdlSegmentoNegocio.SelectedValue.ToEntero Else IdSeg = 0
- 'CREA SUBPROYECTO
+
+
+ Dim StrPais As String = ""
+ Dim StrEstado As String = ""
+ Dim StrMunicipio As String = ""
+ Dim StrLocalidad As String = ""
+ Dim StrColonia As String = ""
+
+
+
+ If DdlPais.SelectedValue.ToEntero > 0 Then
+ StrPais = DdlPais.SelectedItem.Text
+ Else
+ StrPais = TxtPais.Text
+ End If
+
+ If DdlEstado.SelectedValue.ToEntero > 0 Then
+ StrEstado = DdlEstado.SelectedItem.Text
+ Else
+ StrEstado = TxtEstado.Text
+ End If
+
+ If DdlMunicipio.SelectedValue.ToEntero > 0 Then
+ StrMunicipio = DdlMunicipio.SelectedItem.Text
+ Else
+ StrMunicipio = TxtMunicipio.Text
+ End If
+
+ If DdlLocalidad.SelectedValue.ToEntero > 0 Then
+ StrLocalidad = DdlLocalidad.SelectedItem.Text
+ Else
+ StrLocalidad = TxtLocalidad.Text
+ End If
+
+ If DdlColonia.SelectedValue.ToEntero > 0 Then
+ StrColonia = DdlColonia.SelectedItem.Text
+ Else
+ StrColonia = TxtColonia.Text
+ End If
+
+ 'CREA SUBPROYECTO
If HdnModalidad.Value = "I" Then
If Not ObjSubproyectos.AddCentroCosto(TxtCentroCosto.Text.Trim, IdSeg, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlProyecto.SelectedValue.ToEntero, Serie:=TxtSerie.Text.Trim, IVA:=TxtIVA.Text.ToDecimal, Calle:=TxtCalle.Text.Trim, NoExt:=TxtNoExt.Text.Trim,
- NoInt:=TxtNoInt.Text.Trim, Colonia:=TxtColonia.Text.Trim, Localidad:=TxtLocalidad.Text.Trim, Municipio:=TxtMunicipio.Text.Trim, Estado:=TxtEstado.Text.Trim, Pais:=TxtPais.Text.Trim, CP:=TxtCP.Text.Trim, TipoSucursal:=TipoSucursal, EsSucursal:=EsSucursal,
+ NoInt:=TxtNoInt.Text.Trim, Colonia:=StrColonia, Localidad:=StrLocalidad, Municipio:=StrMunicipio, Estado:=StrEstado, Pais:=StrPais, CP:=TxtCP.Text.Trim, TipoSucursal:=TipoSucursal, EsSucursal:=EsSucursal,
CvePais:=DdlPais.SelectedValue.ToEntero, CveEstado:=DdlEstado.SelectedValue.ToEntero, CveMunicipio:=DdlMunicipio.SelectedValue.ToEntero, CveColonia:=DdlColonia.SelectedValue.ToEntero, AplicaComercioExterior:=ChkAplicaComercioExterior.Checked, Correo:=TxtCorreo.Text, CvePrecioLista:=DdlPrecioLista.SelectedValue.ToEntero,
- Telefono:=TxtTelefono.Text, NoVerificaAlmacen:=ChkNoVerificaAlmacen.Checked, CodigoSucursal:=TxtCodigoSucursal.Text.Trim) Then
+ Telefono:=TxtTelefono.Text, NoVerificaAlmacen:=ChkNoVerificaAlmacen.Checked, CodigoSucursal:=TxtCodigoSucursal.Text.Trim, CveLocalidad:=DdlLocalidad.SelectedValue.ToEntero) Then
TieneError = True
Else
CveSubProyecto = ObjSubproyectos.CveSubProyecto
@@ -381,9 +424,9 @@ Partial Class CatSubProyectos
Else
If (HorarioVerano > -13 And HorarioVerano < 13) And (HorarioInvierno > -13 And HorarioInvierno < 13) Then
If Not ObjSubproyectos.UpdateCentroCosto(CveCentroCosto, TxtCentroCosto.Text.Trim, IdSeg, If(ChkEstatus.Checked = True, 1, 0), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, DdlProyecto.SelectedValue.ToEntero, Serie:=TxtSerie.Text.Trim, IVA:=TxtIVA.Text.ToDecimal, Calle:=TxtCalle.Text.Trim, NoExt:=TxtNoExt.Text.Trim,
- NoInt:=TxtNoInt.Text.Trim, Colonia:=TxtColonia.Text.Trim, Localidad:=TxtLocalidad.Text.Trim, Municipio:=TxtMunicipio.Text.Trim, Estado:=TxtEstado.Text.Trim, Pais:=TxtPais.Text.Trim, CP:=TxtCP.Text.Trim, TipoSucursal:=TipoSucursal, EsSucursal:=EsSucursal,
+ NoInt:=TxtNoInt.Text.Trim, Colonia:=StrColonia, Localidad:=TxtLocalidad.Text.Trim, Municipio:=StrMunicipio, Estado:=StrEstado, Pais:=StrPais, CP:=TxtCP.Text.Trim, TipoSucursal:=TipoSucursal, EsSucursal:=EsSucursal,
CvePais:=DdlPais.SelectedValue.ToEntero, CveEstado:=DdlEstado.SelectedValue.ToEntero, CveMunicipio:=DdlMunicipio.SelectedValue.ToEntero, CveColonia:=DdlColonia.SelectedValue.ToEntero, AplicaComercioExterior:=ChkAplicaComercioExterior.Checked, Correo:=TxtCorreo.Text, CvePrecioLista:=DdlPrecioLista.SelectedValue.ToEntero,
- Telefono:=TxtTelefono.Text, HorarioVerano:=TxtHorarioVerano.Text.ToEntero, HorarioInvierno:=TxtHorarioInvierno.Text.ToEntero, NoVerificaAlmacen:=ChkNoVerificaAlmacen.Checked, CodigoSucursal:=TxtCodigoSucursal.Text.Trim) Then
+ Telefono:=TxtTelefono.Text, HorarioVerano:=TxtHorarioVerano.Text.ToEntero, HorarioInvierno:=TxtHorarioInvierno.Text.ToEntero, NoVerificaAlmacen:=ChkNoVerificaAlmacen.Checked, CodigoSucursal:=TxtCodigoSucursal.Text.Trim, CveLocalidad:=DdlLocalidad.SelectedValue.ToEntero) Then
TieneError = True
End If
Else
@@ -668,7 +711,7 @@ Partial Class CatSubProyectos
ChkEsMatriz.Checked = False
ChkEsSucursal.Checked = False
ChkAplicaComercioExterior.Checked = False
- TabComercioExterior.Visible = False
+ 'TabComercioExterior.Visible = False
TxtSerie.Text = ""
TxtIVA.Text = "0.16"
@@ -689,6 +732,7 @@ Partial Class CatSubProyectos
CargaEstado()
CargaMunicipio()
CargaColonia()
+ CargaLocalidad()
If UsuarioActual.Empresa.UsaContabilidad Then
CargaSegmentosNegocio()
@@ -790,36 +834,80 @@ Partial Class CatSubProyectos
End If
DdlColonia.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlColonia.DataBind()
+ End Sub
+
+
+ Protected Sub CargaLocalidad()
+
+ DdlLocalidad.Items.Clear()
+
+ If DdlEstado.SelectedValue.ToEntero > 0 Then
+ DdlLocalidad.DataSource = GlobalDTLocalidad(DdlEstado.SelectedValue.ToEntero, DdlMunicipio.SelectedValue.ToEntero)
+ DdlLocalidad.DataBind()
+ End If
+
+ DdlLocalidad.Items.Insert(0, New ListItem("Seleccione una", "-1"))
+
End Sub
Protected Sub DdlPais_SelectedIndexChanged(sender As Object, e As EventArgs)
CargaEstado()
CargaMunicipio()
CargaColonia()
+ CargaLocalidad()
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
-
- Protected Sub ChkAplicaComercioExterior_CheckedChanged(sender As Object, e As EventArgs)
- AplicaComercio()
- End Sub
-
- Private Sub AplicaComercio()
- If ChkAplicaComercioExterior.Checked Then
- TabComercioExterior.Visible = True
- Else
- TabComercioExterior.Visible = False
- End If
- UpBodyCentroCosto.Update()
- End Sub
-
+ CargaLocalidad()
+ End Sub
+
+ Protected Sub DdlMunicipio_SelectedIndexChanged(sender As Object, e As EventArgs)
+ CargaColonia()
+ CargaLocalidad()
+ End Sub
+
+ 'Protected Sub ChkAplicaComercioExterior_CheckedChanged(sender As Object, e As EventArgs)
+ ' AplicaComercio()
+ 'End Sub
+
+ 'Private Sub AplicaComercio()
+ ' If ChkAplicaComercioExterior.Checked Then
+ ' TabComercioExterior.Visible = True
+ ' Else
+ ' TabComercioExterior.Visible = False
+ ' End If
+ ' UpBodyCentroCosto.Update()
+ 'End Sub
+
#End Region
-
-
+
+ Protected Sub BtnValidar_Click(sender As Object, e As EventArgs)
+ validaCodigoPostal()
+ End Sub
+
+
+ Protected Sub DdlColonia_SelectedIndexChanged(sender As Object, e As EventArgs)
+ validaCodigoPostal()
+ End Sub
+
+ Private Sub validaCodigoPostal()
+
+ Dim CPTxt As Integer = TxtCP.Text.ToEntero()
+
+ Dim CveColonia As Integer = DdlColonia.SelectedValue.ToEntero
+
+ If CPTxt > 0 And CveColonia > 0 Then
+ Dim CP As Integer = GlobalDTColonia("-1").FiltroPrimeroValor("CP", $"CveColonia = {CveColonia}").ToEntero
+ If CPTxt <> CP Then
+ Alert("El codigo postal selecionado es diferente del codigo postal de la Colonia.", TipoMensaje.MsgAdvertencia)
+ End If
+ End If
+
+ End Sub
+
+
+
+
End Class