Validacion de usados, filtro de pendientes por surtir en compras, validacion de procesos de apoyo logistico

This commit is contained in:
2021-03-09 12:07:38 -07:00
parent 0a66620d18
commit fc7e2271e7
5 changed files with 278 additions and 201 deletions

View File

@@ -846,8 +846,6 @@ Partial Class ProductosyServicios
DdlMoneda.SelectedValueExist(ObjProductosServicios.CveMoneda)
TxtRetISR.Text = (ObjProductosServicios.RetISR * 100).ToString
DdlTamanio.SelectedValueExist(ObjProductosServicios.DtResultados.Rows(0)("CveTamaño").ToString)
DdlModelo.SelectedValueExist(ObjProductosServicios.DtResultados.Rows(0)("CveModelo").ToString)
DdlMedida.SelectedValueExist(ObjProductosServicios.DtResultados.Rows(0)("CveMedida").ToString)
DdlRin.SelectedValueExist(ObjProductosServicios.DtResultados.Rows(0)("CveRinTamaño").ToString)
@@ -862,6 +860,34 @@ Partial Class ProductosyServicios
Try
DdlClasificacion_SelectedIndexChanged(DdlClasificacion, Nothing)
DdlTamanio.SelectedValueExist(ObjProductosServicios.DtResultados.Rows(0)("CveTamaño").ToString)
If DdlTamanio.SelectedValue.ToEntero() > 0 Then
Dim Dr = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveClasificacion={0}", DdlClasificacion.SelectedValue.ToEntero()))(0)
Dim DebeTenerTamanio As Boolean = Boolean.Parse(Dr("EsAcumulador").ToString)
'SI ES MOTOBATERIA
If DdlClasificacion.SelectedValue = "20517" Then
DebeTenerTamanio = True
End If
'VALIDA QUE EL PRODUCTO, NO ES ACUMULADOR QUE NO TENGA TAMAÑO
If Not DebeTenerTamanio AndAlso DdlTamanio.SelectedValue.ToEntero() > 0 Then
Alert($"Un producto/servicio con la clasificación '{Dr("Clasificacion")}' no debe tener especificado un tamaño.", TipoMensaje.MsgAdvertencia)
RfvDdlTamanio.Visible = False
CERfvDdlTamanio.Enabled = False
End If
'VALIDA QUE EL PRODUCTO, SI ES ACUMULADOR QUE TENGA TAMAÑO
If DebeTenerTamanio AndAlso DdlTamanio.SelectedValue.ToEntero() <= 0 Then
Alert($"Un producto/servicio con la clasificación '{Dr("Clasificacion")}' debe tener especificado un tamaño.", TipoMensaje.MsgAdvertencia)
End If
DvTamanio.Visible = True
End If
Catch ex As Exception
End Try
@@ -1195,182 +1221,209 @@ Partial Class ProductosyServicios
End If
Dim CveTamaño As Integer = DdlTamanio.SelectedValue.ToEntero
'VALIDAR TAMAÑOS Y ACUMULADORES
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim Dr = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveClasificacion={0}", DdlClasificacion.SelectedValue.ToEntero()))(0)
Dim DebeTenerTamanio As Boolean = Boolean.Parse(Dr("EsAcumulador").ToString)
'SI ES MOTOBATERIA
If DdlClasificacion.SelectedValue = "20517" Then
DebeTenerTamanio = True
End If
'VALIDA QUE EL PRODUCTO, NO ES ACUMULADOR QUE NO TENGA TAMAÑO
If Not DebeTenerTamanio AndAlso CveTamaño > 0 Then
Alert($"Un producto/servicio con la clasificación '{Dr("Clasificacion")}' no debe tener especificado un tamaño.", TipoMensaje.MsgAdvertencia)
Return
End If
'VALIDA QUE EL PRODUCTO, SI ES ACUMULADOR QUE TENGA TAMAÑO
If DebeTenerTamanio AndAlso CveTamaño <= 0 Then
Alert($"Un producto/servicio con la clasificación '{Dr("Clasificacion")}' debe tener especificado un tamaño.", TipoMensaje.MsgAdvertencia)
Return
End If
End If
Dim ObjProductosServicios As New ClsProductosServicios()
Dim ObjInv As New ClsInventarios(ObjProductosServicios.IniciaTransacSQL())
Dim TieneError = False
Dim AccionJS = ""
Dim EsPaquete As Integer = If(gvPaqueteDetalle.Rows.Count = 0, 0, 1)
Dim CveMetodoInv As Integer = If(UsuarioActual.Empresa.UsaInventarios, ddlMetodos.SelectedValue.ToEntero, -1)
Try
Dim CveProveedor As Integer = -1
If DdlProveedor.txtValue.Value.ToEntero > 0 Then
CveProveedor = DdlProveedor.txtValue.Value.ToEntero
End If
Dim EsPaquete As Integer = If(gvPaqueteDetalle.Rows.Count = 0, 0, 1)
Dim CveMetodoInv As Integer = If(UsuarioActual.Empresa.UsaInventarios, ddlMetodos.SelectedValue.ToEntero, -1)
Dim CveMarca As Integer = 0
If UsuarioActual.CveEmpresa.Contiene(1, 72, 80) And CvePS = -1 Then CveMarca = DdlMarcaPSDes.SelectedValue.ToEntero Else CveMarca = DdlMarca.SelectedValue.ToEntero
Dim TiempoCaducidad As Integer = -1
If ChkCaducidad.Checked Then
If TxtTiempoCaducidad.Text.Length > 0 AndAlso IsNumeric(TxtTiempoCaducidad.Text) Then
TiempoCaducidad = TxtTiempoCaducidad.Text.ToEntero()
Else
Alert("Falta indicar el tiempo de caducidad", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
If CvePS = -1 Then
Dim PSS As String = TxtPS.Text.Trim.Replace("|", "")
If UsuarioActual.CveEmpresa.Contiene(1, 72, 80) Then PSS = PSS.ToUpper
If ObjProductosServicios.AddPS(DdlClasificacion.SelectedValue.ToEntero, -1, DdlUnidadMedida.SelectedValue.ToEntero, TxtCodigo.Text.Trim, "", TxtCodigoBarras.Text.Trim, PSS,
TxtPrecio.Text.Trim.ToDouble, DdlIVA.SelectedValue.ToDouble, (TxtRetIVA.Text.Trim.ToDouble / 100), ChkInventariable.Checked, CveProveedor, True,
ChkAplicaParaVenta.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveMetodoInv, EsPaquete, CveTipoPS:=DdlTipoPS.SelectedValue.ToEntero,
FuePorXML:=False, TipoServicio:=-1, CveClasificacion2:=CveClasificacion2, CveMarca:=CveMarca, AlmacenSeccion:=TxtAlmacenSeccion.Text.Trim,
AplicaIEPS:=ChkAplicaIeps.Checked, IEPSPorcentaje:=DdlIEPSPorcentaje.SelectedValue.ToDecimal, CveConceptoContable:=DdlConceptoRelacionado.SelectedValue.ToEntero,
CveCompuesto:=DdlCompuesto.SelectedValue.ToEntero, CveSATPS:=DdlSATPS.SelectedValue.ToEntero, IEPSGrabaIVA:=ChkIepsIVA.Checked, VentaMinima:=TxtVentaMinima.Text.ToDecimal,
CveMoneda:=DdlMoneda.SelectedValue.ToEntero, RetISR:=(TxtRetISR.Text.Trim.ToDouble / 100), PrecioMinimo:=TxtPrecioMinimo.Text.ToDecimal,
CveTipoFactor:=DdlTipoFactor.SelectedValue.ToEntero, CveFraccionArancelaria:=DdlFraccionArancelaria.SelectedValue.ToEntero,
CveClasificacionDetalle:=DdlTipoPSDes.SelectedValue.ToEntero, CveTamaño:=DdlTamanio.SelectedValue.ToEntero,
CveModelo:=DdlModelo.SelectedValue.ToEntero(), CveMedida:=DdlMedida.SelectedValue.ToEntero(), CveRinTamaño:=DdlRin.SelectedValue.ToEntero(),
ClaveImpuestoEmpaque:=DdlImpEmpaque.SelectedValue.ToString, ClaveImpuestoUM:=DdlImpUM.SelectedValue.ToString, ClaveCategoriaToxicidad:=DdlCategoriaToxicidad.SelectedValue.ToString,
ClaveImpuestoTipoProducto:=DdlImpTipoProducto.SelectedValue.ToString, EsOutSourcing:=ChkEsOutSourcing.Checked, TiempoCaducidad:=TiempoCaducidad, CvePSAdicionalVigencia:=DdlPSAdicionalVigencia.SelectedValue.ToEntero(), PrecioLibre:=ChkPrecioLibre.Checked) > 0 Then
ViewState("CvePS") = ObjProductosServicios.CvePS
For Each GVR As GridViewRow In GvImpuestosLocales.Rows
If GVR.FCCheckBox("ChkDeduccion").Checked Then
ObjProductosServicios.AddPSImpuestosLocales(CvePS, GVR.DataKey("CveImpuestoLocal").ToEntero)
End If
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
If UsuarioActual.Empresa.Funcionalidad(563) <> "" AndAlso ChkAplicaParaVenta.Checked Then
TieneError = GuardarProductoEnFranquicia(ObjProductosServicios, PSS, CveMetodoInv, EsPaquete, True)
End If
Else
TieneError = True
Alert("Ocurrió un Error al agregar el Producto o Servicio. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If
Else
If CodigoBarrasCargado.Length > 0 And TxtCodigoBarras.Text.Length = 0 Then
TxtCodigoBarras.Text = CodigoBarrasCargado
Dim CveProveedor As Integer = -1
If DdlProveedor.txtValue.Value.ToEntero > 0 Then
CveProveedor = DdlProveedor.txtValue.Value.ToEntero
End If
Dim PSS As String = TxtPS.Text.Trim.Replace("|", "")
If UsuarioActual.CveEmpresa.Contiene(1, 72, 80) Then PSS = PSS.ToUpper
Dim CveMarca As Integer = 0
If UsuarioActual.CveEmpresa.Contiene(1, 72, 80) And CvePS = -1 Then CveMarca = DdlMarcaPSDes.SelectedValue.ToEntero Else CveMarca = DdlMarca.SelectedValue.ToEntero
If ObjProductosServicios.UpdatePS(DdlClasificacion.SelectedValue.ToEntero, -1, DdlUnidadMedida.SelectedValue.ToEntero, TxtCodigo.Text.Trim, txtcodigo2.text.trim, TxtCodigoBarras.Text.Trim, PSS,
TxtPrecio.Text.Trim.ToDouble, DdlIVA.SelectedValue.ToDouble, (TxtRetIVA.Text.Trim.ToDouble / 100), ChkInventariable.Checked, CveProveedor, True,
ChkAplicaParaVenta.Checked, ChkEstado.Checked, UsuarioActual.CveUsuario, CvePS, CveMetodoInv, EsPaquete, DdlSATPS.SelectedValue.ToEntero,
CveTipoPS:=DdlTipoPS.SelectedValue.ToEntero, TipoServicio:=-1, CveClasificacion2:=CveClasificacion2, CveMarca:=CveMarca, AlmacenSeccion:=TxtAlmacenSeccion.Text.Trim,
AplicaIEPS:=ChkAplicaIeps.Checked, IEPSPorcentaje:=DdlIEPSPorcentaje.SelectedValue.ToDecimal, CveConceptoContable:=DdlConceptoRelacionado.SelectedValue.ToEntero,
CveCompuesto:=DdlCompuesto.SelectedValue.ToEntero, IEPSGrabaIVA:=ChkIepsIVA.Checked, VentaMinima:=TxtVentaMinima.Text.ToDecimal,
CveMoneda:=DdlMoneda.SelectedValue.ToEntero, RetISR:=(TxtRetISR.Text.Trim.ToDouble / 100), PrecioMinimo:=TxtPrecioMinimo.Text.ToDecimal,
CveTipoFactor:=DdlTipoFactor.SelectedValue.ToEntero, CveFraccionArancelaria:=DdlFraccionArancelaria.SelectedValue.ToEntero,
CveUsuarioModifico:=UsuarioActual.CveUsuario, CveClasificacionDetalle:=DdlTipoPSDes.SelectedValue.ToEntero, CveTamaño:=DdlTamanio.SelectedValue.ToEntero,
CveModelo:=DdlModelo.SelectedValue.ToEntero(), CveMedida:=DdlMedida.SelectedValue.ToEntero(), CveRinTamaño:=DdlRin.SelectedValue.ToEntero(),
ClaveImpuestoEmpaque:=DdlImpEmpaque.SelectedValue.ToString, ClaveImpuestoUM:=DdlImpUM.SelectedValue.ToString, ClaveCategoriaToxicidad:=DdlCategoriaToxicidad.SelectedValue.ToString,
ClaveImpuestoTipoProducto:=DdlImpTipoProducto.SelectedValue.ToString, EsOutSourcing:=ChkEsOutSourcing.Checked,
AplicaSerie:=ChkSerie.Checked, AplicaLote:=ChkLote.Checked, AplicaCaducidad:=ChkCaducidad.Checked, AplicaSeccion:=ChkSeccion.Checked, TiempoCaducidad:=TiempoCaducidad, CvePSAdicionalVigencia:=DdlPSAdicionalVigencia.SelectedValue.ToEntero(), PrecioLibre:=ChkPrecioLibre.Checked) Then
If Not ObjProductosServicios.LimpiaImpuestosLocales(CvePS) Then
TieneError = True
Alert("Ocurrió un Error al regenerar los impuestos locales. Por favor vuelva a intentar.", TipoMensaje.MsgError)
Dim TiempoCaducidad As Integer = -1
If ChkCaducidad.Checked Then
If TxtTiempoCaducidad.Text.Length > 0 AndAlso IsNumeric(TxtTiempoCaducidad.Text) Then
TiempoCaducidad = TxtTiempoCaducidad.Text.ToEntero()
Else
Alert("Falta indicar el tiempo de caducidad", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
If Not TieneError Then
If CvePS = -1 Then
Dim PSS As String = TxtPS.Text.Trim.Replace("|", "")
If UsuarioActual.CveEmpresa.Contiene(1, 72, 80) Then PSS = PSS.ToUpper
If ObjProductosServicios.AddPS(DdlClasificacion.SelectedValue.ToEntero, -1, DdlUnidadMedida.SelectedValue.ToEntero, TxtCodigo.Text.Trim, "", TxtCodigoBarras.Text.Trim, PSS,
TxtPrecio.Text.Trim.ToDouble, DdlIVA.SelectedValue.ToDouble, (TxtRetIVA.Text.Trim.ToDouble / 100), ChkInventariable.Checked, CveProveedor, True,
ChkAplicaParaVenta.Checked, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveMetodoInv, EsPaquete, CveTipoPS:=DdlTipoPS.SelectedValue.ToEntero,
FuePorXML:=False, TipoServicio:=-1, CveClasificacion2:=CveClasificacion2, CveMarca:=CveMarca, AlmacenSeccion:=TxtAlmacenSeccion.Text.Trim,
AplicaIEPS:=ChkAplicaIeps.Checked, IEPSPorcentaje:=DdlIEPSPorcentaje.SelectedValue.ToDecimal, CveConceptoContable:=DdlConceptoRelacionado.SelectedValue.ToEntero,
CveCompuesto:=DdlCompuesto.SelectedValue.ToEntero, CveSATPS:=DdlSATPS.SelectedValue.ToEntero, IEPSGrabaIVA:=ChkIepsIVA.Checked, VentaMinima:=TxtVentaMinima.Text.ToDecimal,
CveMoneda:=DdlMoneda.SelectedValue.ToEntero, RetISR:=(TxtRetISR.Text.Trim.ToDouble / 100), PrecioMinimo:=TxtPrecioMinimo.Text.ToDecimal,
CveTipoFactor:=DdlTipoFactor.SelectedValue.ToEntero, CveFraccionArancelaria:=DdlFraccionArancelaria.SelectedValue.ToEntero,
CveClasificacionDetalle:=DdlTipoPSDes.SelectedValue.ToEntero, CveTamaño:=CveTamaño,
CveModelo:=DdlModelo.SelectedValue.ToEntero(), CveMedida:=DdlMedida.SelectedValue.ToEntero(), CveRinTamaño:=DdlRin.SelectedValue.ToEntero(),
ClaveImpuestoEmpaque:=DdlImpEmpaque.SelectedValue.ToString, ClaveImpuestoUM:=DdlImpUM.SelectedValue.ToString, ClaveCategoriaToxicidad:=DdlCategoriaToxicidad.SelectedValue.ToString,
ClaveImpuestoTipoProducto:=DdlImpTipoProducto.SelectedValue.ToString, EsOutSourcing:=ChkEsOutSourcing.Checked, TiempoCaducidad:=TiempoCaducidad, CvePSAdicionalVigencia:=DdlPSAdicionalVigencia.SelectedValue.ToEntero(), PrecioLibre:=ChkPrecioLibre.Checked) > 0 Then
ViewState("CvePS") = ObjProductosServicios.CvePS
For Each GVR As GridViewRow In GvImpuestosLocales.Rows
If GVR.FCCheckBox("ChkDeduccion").Checked Then
If Not ObjProductosServicios.AddPSImpuestosLocales(CvePS, GVR.DataKey("CveImpuestoLocal").ToEntero) Then
ObjProductosServicios.AddPSImpuestosLocales(CvePS, GVR.DataKey("CveImpuestoLocal").ToEntero)
End If
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
If UsuarioActual.Empresa.Funcionalidad(563) <> "" AndAlso ChkAplicaParaVenta.Checked Then
TieneError = GuardarProductoEnFranquicia(ObjProductosServicios, PSS, CveMetodoInv, EsPaquete, True)
End If
Else
TieneError = True
Alert("Ocurrió un Error al agregar el Producto o Servicio. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If
Else
If CodigoBarrasCargado.Length > 0 And TxtCodigoBarras.Text.Length = 0 Then
TxtCodigoBarras.Text = CodigoBarrasCargado
End If
Dim PSS As String = TxtPS.Text.Trim.Replace("|", "")
If UsuarioActual.CveEmpresa.Contiene(1, 72, 80) Then PSS = PSS.ToUpper
If ObjProductosServicios.UpdatePS(DdlClasificacion.SelectedValue.ToEntero, -1, DdlUnidadMedida.SelectedValue.ToEntero, TxtCodigo.Text.Trim, TxtCodigo2.Text.Trim, TxtCodigoBarras.Text.Trim, PSS,
TxtPrecio.Text.Trim.ToDouble, DdlIVA.SelectedValue.ToDouble, (TxtRetIVA.Text.Trim.ToDouble / 100), ChkInventariable.Checked, CveProveedor, True,
ChkAplicaParaVenta.Checked, ChkEstado.Checked, UsuarioActual.CveUsuario, CvePS, CveMetodoInv, EsPaquete, DdlSATPS.SelectedValue.ToEntero,
CveTipoPS:=DdlTipoPS.SelectedValue.ToEntero, TipoServicio:=-1, CveClasificacion2:=CveClasificacion2, CveMarca:=CveMarca, AlmacenSeccion:=TxtAlmacenSeccion.Text.Trim,
AplicaIEPS:=ChkAplicaIeps.Checked, IEPSPorcentaje:=DdlIEPSPorcentaje.SelectedValue.ToDecimal, CveConceptoContable:=DdlConceptoRelacionado.SelectedValue.ToEntero,
CveCompuesto:=DdlCompuesto.SelectedValue.ToEntero, IEPSGrabaIVA:=ChkIepsIVA.Checked, VentaMinima:=TxtVentaMinima.Text.ToDecimal,
CveMoneda:=DdlMoneda.SelectedValue.ToEntero, RetISR:=(TxtRetISR.Text.Trim.ToDouble / 100), PrecioMinimo:=TxtPrecioMinimo.Text.ToDecimal,
CveTipoFactor:=DdlTipoFactor.SelectedValue.ToEntero, CveFraccionArancelaria:=DdlFraccionArancelaria.SelectedValue.ToEntero,
CveUsuarioModifico:=UsuarioActual.CveUsuario, CveClasificacionDetalle:=DdlTipoPSDes.SelectedValue.ToEntero, CveTamaño:=CveTamaño,
CveModelo:=DdlModelo.SelectedValue.ToEntero(), CveMedida:=DdlMedida.SelectedValue.ToEntero(), CveRinTamaño:=DdlRin.SelectedValue.ToEntero(),
ClaveImpuestoEmpaque:=DdlImpEmpaque.SelectedValue.ToString, ClaveImpuestoUM:=DdlImpUM.SelectedValue.ToString, ClaveCategoriaToxicidad:=DdlCategoriaToxicidad.SelectedValue.ToString,
ClaveImpuestoTipoProducto:=DdlImpTipoProducto.SelectedValue.ToString, EsOutSourcing:=ChkEsOutSourcing.Checked,
AplicaSerie:=ChkSerie.Checked, AplicaLote:=ChkLote.Checked, AplicaCaducidad:=ChkCaducidad.Checked, AplicaSeccion:=ChkSeccion.Checked, TiempoCaducidad:=TiempoCaducidad, CvePSAdicionalVigencia:=DdlPSAdicionalVigencia.SelectedValue.ToEntero(), PrecioLibre:=ChkPrecioLibre.Checked) Then
If Not ObjProductosServicios.LimpiaImpuestosLocales(CvePS) Then
TieneError = True
Alert("Ocurrió un Error al regenerar los impuestos locales. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If
If Not TieneError Then
For Each GVR As GridViewRow In GvImpuestosLocales.Rows
If GVR.FCCheckBox("ChkDeduccion").Checked Then
If Not ObjProductosServicios.AddPSImpuestosLocales(CvePS, GVR.DataKey("CveImpuestoLocal").ToEntero) Then
TieneError = True
Alert("Ocurrió un Error al agregar los impuestos locales. Por favor vuelva a intentar.", TipoMensaje.MsgError)
Exit For
End If
End If
Next
End If
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
If UsuarioActual.Empresa.Funcionalidad(563) <> "" AndAlso ChkAplicaParaVenta.Checked Then
TieneError = GuardarProductoEnFranquicia(ObjProductosServicios, PSS, CveMetodoInv, EsPaquete, False)
End If
Else
TieneError = True
Alert("Ocurrió un Error al actualizar el Producto o Servicio. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If
ObjProductosServicios.CvePS = CvePS
End If
If ObjProductosServicios.CvePS > 0 And Not TieneError Then
For i As Integer = 0 To gvSucursal.Rows.Count - 1
If gvSucursal.Rows(i).FCCheckBox("chkSucursal").Checked = False Then
If Not ObjProductosServicios.RemovePSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).DataKey("CveSubProyecto").ToEntero) Then
TieneError = True
Alert("Ocurrió un Error al eliminar sucursales del producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
Exit For
End If
Else
If gvSucursal.Rows(i).FCHiddenField("hdnEnBD").Value.ToEntero = 1 Then
'Actualizarlo
If Not ObjProductosServicios.UpdatePSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).FCTextBox("txtImporte").Text.ToDouble, gvSucursal.Rows(i).FCTextBox("TxtMinimo").Text.ToDouble, gvSucursal.Rows(i).FCTextBox("TxtMaximo").Text.ToDouble, UsuarioActual.CveUsuario, gvSucursal.Rows(i).DataKey("CveSubProyecto").ToEntero, PrecioMinimo:=gvSucursal.Rows(i).FCTextBox("TxtPrecioMinimo").Text.ToDecimal) Then
TieneError = True
Alert("Ocurrió un Error al agregar los impuestos locales. Por favor vuelva a intentar.", TipoMensaje.MsgError)
Alert("Ocurrió un Error al actualizar sucursales del producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
Exit For
End If
'ObjProductosServicios.UpdatePSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).FCHiddenField("hdnCveSucursal").Value.ToEntero, gvSucursal.Rows(i).FCTextBox("txtImporte").Text.ToDouble, UsuarioActual.CveUsuario)
Else
'Insertarlo
'ObjProductosServicios.AddPSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).FCHiddenField("hdnCveSucursal").Value.ToEntero, gvSucursal.Rows(i).FCTextBox("txtImporte").Text.ToDouble, UsuarioActual.CveUsuario)
If Not ObjProductosServicios.AddPSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).FCTextBox("txtImporte").Text.ToDouble, gvSucursal.Rows(i).FCTextBox("TxtMinimo").Text.ToDouble, gvSucursal.Rows(i).FCTextBox("TxtMaximo").Text.ToDouble, UsuarioActual.CveUsuario, gvSucursal.Rows(i).DataKey("CveSubProyecto").ToEntero, PrecioMinimo:=gvSucursal.Rows(i).FCTextBox("TxtPrecioMinimo").Text.ToDecimal) Then
TieneError = True
Alert("Ocurrió un Error al agregar sucursales del producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
Exit For
End If
End If
Next
End If
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
If UsuarioActual.Empresa.Funcionalidad(563) <> "" AndAlso ChkAplicaParaVenta.Checked Then
TieneError = GuardarProductoEnFranquicia(ObjProductosServicios, PSS, CveMetodoInv, EsPaquete, False)
End If
Else
TieneError = True
Alert("Ocurrió un Error al actualizar el Producto o Servicio. Por favor vuelva a intentar.", TipoMensaje.MsgError)
End If
Next
End If
ObjProductosServicios.CvePS = CvePS
End If
If ObjProductosServicios.CvePS > 0 And Not TieneError Then
For i As Integer = 0 To gvSucursal.Rows.Count - 1
If gvSucursal.Rows(i).FCCheckBox("chkSucursal").Checked = False Then
If Not ObjProductosServicios.RemovePSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).DataKey("CveSubProyecto").ToEntero) Then
TieneError = True
Alert("Ocurrió un Error al eliminar sucursales del producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
Exit For
End If
Else
If gvSucursal.Rows(i).FCHiddenField("hdnEnBD").Value.ToEntero = 1 Then
'Actualizarlo
If Not ObjProductosServicios.UpdatePSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).FCTextBox("txtImporte").Text.ToDouble, gvSucursal.Rows(i).FCTextBox("TxtMinimo").Text.ToDouble, gvSucursal.Rows(i).FCTextBox("TxtMaximo").Text.ToDouble, UsuarioActual.CveUsuario, gvSucursal.Rows(i).DataKey("CveSubProyecto").ToEntero, PrecioMinimo:=gvSucursal.Rows(i).FCTextBox("TxtPrecioMinimo").Text.ToDecimal) Then
TieneError = True
Alert("Ocurrió un Error al actualizar sucursales del producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
Exit For
End If
'ObjProductosServicios.UpdatePSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).FCHiddenField("hdnCveSucursal").Value.ToEntero, gvSucursal.Rows(i).FCTextBox("txtImporte").Text.ToDouble, UsuarioActual.CveUsuario)
Else
'Insertarlo
'ObjProductosServicios.AddPSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).FCHiddenField("hdnCveSucursal").Value.ToEntero, gvSucursal.Rows(i).FCTextBox("txtImporte").Text.ToDouble, UsuarioActual.CveUsuario)
If Not ObjProductosServicios.AddPSSucursales(ObjProductosServicios.CvePS, gvSucursal.Rows(i).FCTextBox("txtImporte").Text.ToDouble, gvSucursal.Rows(i).FCTextBox("TxtMinimo").Text.ToDouble, gvSucursal.Rows(i).FCTextBox("TxtMaximo").Text.ToDouble, UsuarioActual.CveUsuario, gvSucursal.Rows(i).DataKey("CveSubProyecto").ToEntero, PrecioMinimo:=gvSucursal.Rows(i).FCTextBox("TxtPrecioMinimo").Text.ToDecimal) Then
TieneError = True
Alert("Ocurrió un Error al agregar sucursales del producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
Exit For
End If
End If
End If
Next
End If
If ObjProductosServicios.CvePS > 0 And Not TieneError Then
TieneError = GuardaEcommerce()
End If
If ObjProductosServicios.CvePS > 0 And Not TieneError Then
TieneError = GuardaEcommerce()
End If
Catch ex As Exception
TieneError = True
OnError("Ocurrió un error al guardar al guardar el producto/servicio.", ex)
End Try
If Not TieneError Then
ObjProductosServicios.Commit()
@@ -2103,13 +2156,11 @@ Partial Class ProductosyServicios
MostarOcultarDivTamanio(True)
End If
Catch ex As Exception
OnError("Ocurrió un error al mostrar los tamaños", ex)
End Try
End Sub
Sub MostarOcultarDivTamanio(Mostrar As Boolean)
Private Sub MostarOcultarDivTamanio(Mostrar As Boolean)
If Mostrar And UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
DvTamanio.Visible = True
Else
@@ -2117,7 +2168,6 @@ Partial Class ProductosyServicios
DdlTamanio.SelectedValueExist("-1")
End If
UpDatos.Update()
End Sub