This commit is contained in:
@@ -287,7 +287,6 @@ Partial Class ProductosyServicios
|
||||
|
||||
CargaCombosSeccionAlmacen()
|
||||
DivSeccionAlmacen.Visible = UsuarioActual.Empresa.Funcionalidad(563).ToString = "1"
|
||||
|
||||
CreaDtSeccionAlmacen()
|
||||
|
||||
If UsuarioActual.Empresa.UsaContabilidad Then
|
||||
@@ -1134,7 +1133,8 @@ Partial Class ProductosyServicios
|
||||
End If
|
||||
|
||||
Dim ObjProductosServicios As New ClsProductosServicios()
|
||||
ObjProductosServicios.IniciaTransacSQL()
|
||||
Dim ObjInv As New ClsInventarios(ObjProductosServicios.IniciaTransacSQL())
|
||||
|
||||
Dim TieneError = False
|
||||
Dim AccionJS = ""
|
||||
Dim EsPaquete As Integer = If(gvPaqueteDetalle.Rows.Count = 0, 0, 1)
|
||||
@@ -1171,6 +1171,18 @@ Partial Class ProductosyServicios
|
||||
Next
|
||||
'Alert("El Producto o Servicio se guardó correctamente.", TipoMensaje.MsgInformacion, "document.location.href= "" / ProductosServicios.aspx?CvePS=" & ObjProductosServcios.CvePS.ToString & """;")
|
||||
AccionJS = "document.location.href=""/Ventas/CatPS.aspx"";"
|
||||
|
||||
|
||||
If Not TieneError Then
|
||||
For Each Dr As DataRow In DtSeccionAlmacen.Rows
|
||||
If Dr("CveAlmacen").ToString.ToEntero > 0 Then
|
||||
If Not ObjInv.AddProductosServiciosAlmacenSeccion(CvePS, Dr("CveAlmacen").ToString.ToEntero, Dr("CveAlmacenSeccion").ToString.ToEntero) Then
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
Else
|
||||
TieneError = True
|
||||
Alert("Ocurrió un Error al agregar el Producto o Servicio. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||||
@@ -1216,6 +1228,22 @@ Partial Class ProductosyServicios
|
||||
AccionJS = If(Ret = "Comp", "ircompras();", "document.location.href=""/Ventas/CatPS.aspx"";")
|
||||
'UpDatos.Update()
|
||||
'Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, AccionJS)
|
||||
|
||||
If Not TieneError Then
|
||||
For Each Dr As DataRow In DtSeccionAlmacen.Rows
|
||||
If Dr("CveAlmacen").ToString.ToEntero > 0 AndAlso Not Dr("CvePSAlmacenSeccion").ToString.ToEntero > 0 Then
|
||||
If Not ObjInv.AddProductosServiciosAlmacenSeccion(CvePS, Dr("CveAlmacen").ToString.ToEntero, Dr("CveAlmacenSeccion").ToString.ToEntero) Then
|
||||
TieneError = True
|
||||
End If
|
||||
ElseIf Not Dr("CveAlmacen").ToString.ToEntero > 0 AndAlso Dr("CvePSAlmacenSeccion").ToString.ToEntero > 0 Then
|
||||
If Not ObjInv.RemoveProductosServiciosAlmacenSeccion(Dr("CvePSAlmacenSeccion").ToString.ToEntero) Then
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
|
||||
Else
|
||||
TieneError = True
|
||||
Alert("Ocurrió un Error al actualizar el Producto o Servicio. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
||||
@@ -2479,7 +2507,6 @@ Partial Class ProductosyServicios
|
||||
Private Sub CreaDtSeccionAlmacen()
|
||||
DtSeccionAlmacen = New DataTable
|
||||
DtSeccionAlmacen.Columns.Add("CvePSAlmacenSeccion", GetType(Integer))
|
||||
DtSeccionAlmacen.Columns.Add("CvePS", GetType(Integer))
|
||||
DtSeccionAlmacen.Columns.Add("CveAlmacen", GetType(Integer))
|
||||
DtSeccionAlmacen.Columns.Add("Almacen", GetType(String))
|
||||
DtSeccionAlmacen.Columns.Add("CveAlmacenSeccion", GetType(Integer))
|
||||
@@ -2498,14 +2525,15 @@ Partial Class ProductosyServicios
|
||||
|
||||
|
||||
Private Sub CargaCombosSeccionAlmacen()
|
||||
DdlAlmacen.DataSource = GlobalDTAlmacen(UsuarioActual.CveAlmacen)
|
||||
DdlAlmacen.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa)
|
||||
DdlAlmacen.Items.Add(New ListItem("Seleccione", "-1"))
|
||||
DdlAlmacen.DataBind()
|
||||
|
||||
DdlSeccionAlmacen.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveAlmacen)
|
||||
DdlSeccionAlmacen.DataSource = GlobalDTSeccionAlmacen(UsuarioActual.CveEmpresa)
|
||||
DdlSeccionAlmacen.Items.Add(New ListItem("Seleccione", "-1"))
|
||||
DdlSeccionAlmacen.DataBind()
|
||||
|
||||
UpModalSeccionAlmacen.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub LnkSeccionAlmacenAdd_Click(sender As Object, e As EventArgs)
|
||||
@@ -2514,30 +2542,58 @@ Partial Class ProductosyServicios
|
||||
RegistraScript("$('#DivAddSeccionAlmacen').modal();")
|
||||
UpModalSeccionAlmacen.Update()
|
||||
End Sub
|
||||
Protected Sub LnkEditarSeccionAlmacen_Click(sender As Object, e As EventArgs)
|
||||
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
DdlAlmacen.SelectedValueExist(gvRow.DataKey("CvAlmacen"))
|
||||
DdlSeccionAlmacen.SelectedValueExist(gvRow.DataKey("CveAlmacenSeccion"))
|
||||
RegistraScript("$('#DivAddSeccionAlmacen').modal();")
|
||||
UpModalSeccionAlmacen.Update()
|
||||
End Sub
|
||||
'Protected Sub LnkEditarSeccionAlmacen_Click(sender As Object, e As EventArgs)
|
||||
' Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
' DdlAlmacen.SelectedValueExist(gvRow.DataKey("CvAlmacen"))
|
||||
' DdlSeccionAlmacen.SelectedValueExist(gvRow.DataKey("CveAlmacenSeccion"))
|
||||
' RegistraScript("$('#DivAddSeccionAlmacen').modal();")
|
||||
' UpModalSeccionAlmacen.Update()
|
||||
'End Sub
|
||||
Protected Sub LnkRemoveSeccionAlmacen_Click(sender As Object, e As EventArgs)
|
||||
Dim gvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
If gvRow.DataKey("CvePSAlmacenSeccion").ToEntero > 0 Then
|
||||
DtSeccionAlmacen.Rows(gvRow.RowIndex)("CvePS") = -1
|
||||
DtSeccionAlmacen.Rows(gvRow.RowIndex)("CveAlmacen") = -1
|
||||
Else
|
||||
DtSeccionAlmacen.Rows(gvRow.RowIndex.ToEntero).Delete()
|
||||
End If
|
||||
DtSeccionAlmacen.AcceptChanges()
|
||||
GvSeccionAlmacen.DataSource = DtSeccionAlmacen
|
||||
GvSeccionAlmacen.DataBind()
|
||||
UpSeccionAlmacen.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnAddSeccionAlmacen_Click(sender As Object, e As EventArgs)
|
||||
If DtSeccionAlmacen.FiltraParametros($"CveAlmacen = {DdlAlmacen.SelectedValue}").Rows.Count > 0 Then
|
||||
Alert("No se puede especificar el mismo almacen en dos secciones", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Dim Row As DataRow = Nothing
|
||||
Row = DtSeccionAlmacen.NewRow
|
||||
Row("CvePSAlmacenSeccion") = -1
|
||||
Row("CveAlmacen") = DdlAlmacen.SelectedValue.ToEntero
|
||||
Row("Almacen") = DdlAlmacen.SelectedItem.Text
|
||||
Row("CveAlmacenSeccion") = DdlSeccionAlmacen.SelectedValue.ToEntero
|
||||
Row("AlmacenSeccion") = DdlSeccionAlmacen.SelectedItem.Text
|
||||
DtSeccionAlmacen.Rows.Add(Row)
|
||||
DtSeccionAlmacen.AcceptChanges()
|
||||
GvSeccionAlmacen.DataSource = DtSeccionAlmacen
|
||||
GvSeccionAlmacen.DataBind()
|
||||
UpSeccionAlmacen.Update()
|
||||
|
||||
RegistraScript("$('#DivAddSeccionAlmacen').modal('hide');")
|
||||
End Sub
|
||||
|
||||
Protected Sub GvSeccionAlmacen_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If Not e.Row.DBCampo("CveAlmacen").ToEntero > 0 Then
|
||||
e.Row.Visible = False
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user