--Al crear/actualizar ps, precios, clientes a la otra empresa FUNC 563
This commit is contained in:
@@ -890,6 +890,32 @@ Public Class ClsClientes
|
|||||||
' Return Retorno
|
' Return Retorno
|
||||||
'End Function
|
'End Function
|
||||||
|
|
||||||
|
Public Function UpdateClienteFranquicia(CveCliente As Integer, CveEmpresaActual As Integer, CveEmpresaFranquicia As Integer) As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
DataAdapter("PA_Vta_ClientesFranquiciaUpdate")
|
||||||
|
|
||||||
|
With SqlAdapter.SelectCommand.Parameters
|
||||||
|
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
|
||||||
|
.Add("@CveEmpresaActual", SqlDbType.Int).Value = CveEmpresaActual
|
||||||
|
.Add("@CveEmpresaFranquicia", SqlDbType.Int).Value = CveEmpresaFranquicia
|
||||||
|
End With
|
||||||
|
|
||||||
|
Try
|
||||||
|
SqlAdapter.Fill(Data)
|
||||||
|
Retorno = True
|
||||||
|
Catch Ex1 As SqlException
|
||||||
|
If Ex1.Message.Contains("Número: 2627;") Then
|
||||||
|
Alert("El Cliente no se guardo debido a que actualmente se encuentra registrado", TipoMensaje.MsgAdvertencia)
|
||||||
|
Else
|
||||||
|
Me.OnError("Ocurrió un error al intentar Actualizar los datos del Cliente.", Ex1, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al intentar Actualizar los datos del Cliente.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||||
|
End Try
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
Public Function UpdateClientePersonaFisica(CveCliente As Integer, ApellidoPaterno As String, ApellidoMaterno As String, Nombres As String) As Boolean
|
Public Function UpdateClientePersonaFisica(CveCliente As Integer, ApellidoPaterno As String, ApellidoMaterno As String, Nombres As String) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
|
|||||||
@@ -2052,7 +2052,7 @@ Public Class ClsVentas
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function AddPrecioLista(CveUsuario As Integer, CveEmpresa As Integer, PrecioLista As String, Predeterminada As Boolean, Porcentaje As Double, Optional CvePrecioListaClonar As Integer = -1) As Integer
|
Public Function AddPrecioLista(CveUsuario As Integer, CveEmpresa As Integer, PrecioLista As String, Predeterminada As Boolean, Porcentaje As Double, Optional CvePrecioListaClonar As Integer = -1, Optional UpdateFranquicia As Boolean = False) As Integer
|
||||||
Dim Retorno As Integer = -1
|
Dim Retorno As Integer = -1
|
||||||
|
|
||||||
DataAdapter("PA_Vta_PrecioListaAdd")
|
DataAdapter("PA_Vta_PrecioListaAdd")
|
||||||
@@ -2064,6 +2064,7 @@ Public Class ClsVentas
|
|||||||
.Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje
|
.Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje
|
||||||
.Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada
|
.Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada
|
||||||
.Add("@CvePrecioListaClonar", SqlDbType.Int).Value = CvePrecioListaClonar
|
.Add("@CvePrecioListaClonar", SqlDbType.Int).Value = CvePrecioListaClonar
|
||||||
|
.Add("@UpdateFranquicia", SqlDbType.Bit).Value = UpdateFranquicia
|
||||||
.Add("@CvePrecioLista", SqlDbType.Int).Direction = ParameterDirection.Output
|
.Add("@CvePrecioLista", SqlDbType.Int).Direction = ParameterDirection.Output
|
||||||
End With
|
End With
|
||||||
|
|
||||||
@@ -2084,7 +2085,7 @@ Public Class ClsVentas
|
|||||||
End Function
|
End Function
|
||||||
|
|
||||||
Public Function UpdatePrecioLista(PrecioLista As String, Estatus As Boolean, CveUsuario As Integer, Porcentaje As Double,
|
Public Function UpdatePrecioLista(PrecioLista As String, Estatus As Boolean, CveUsuario As Integer, Porcentaje As Double,
|
||||||
Predeterminada As Boolean, CvePrecioLista As Integer) As Boolean
|
Predeterminada As Boolean, CvePrecioLista As Integer, Optional UpdateFranquicia As Boolean = False) As Boolean
|
||||||
Dim Retorno As Boolean = False
|
Dim Retorno As Boolean = False
|
||||||
|
|
||||||
DataAdapter("PA_Vta_PrecioListaUpdate")
|
DataAdapter("PA_Vta_PrecioListaUpdate")
|
||||||
@@ -2096,6 +2097,7 @@ Public Class ClsVentas
|
|||||||
.Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje
|
.Add("@Porcentaje", SqlDbType.SmallMoney).Value = Porcentaje
|
||||||
.Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada
|
.Add("@Predeterminada", SqlDbType.Bit).Value = Predeterminada
|
||||||
.Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista
|
.Add("@CvePrecioLista", SqlDbType.Int).Value = CvePrecioLista
|
||||||
|
.Add("@UpdateFranquicia", SqlDbType.Bit).Value = UpdateFranquicia
|
||||||
End With
|
End With
|
||||||
|
|
||||||
Try
|
Try
|
||||||
|
|||||||
@@ -65,25 +65,44 @@ Partial Class Ventas_CatPreciosLista
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub BtnAgregarCatalogo_Click(sender As Object, e As EventArgs) Handles BtnAgregarCatalogo.Click
|
Protected Sub BtnAgregarCatalogo_Click(sender As Object, e As EventArgs) Handles BtnAgregarCatalogo.Click
|
||||||
Dim ObjVta As New ClsVentas
|
Dim ActualizarFranquicias As Boolean = False
|
||||||
|
|
||||||
If EsEditar = 0 Then
|
If UsuarioActual.Empresa.Funcionalidad(563) <> "" AndAlso UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||||
If ObjVta.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, ChkPredeterminada.Checked, 0) > 0 Then
|
ActualizarFranquicias = True
|
||||||
Alert("El Precio de Lista se agregó correctamente", TipoMensaje.MsgInformacion)
|
End If
|
||||||
Else
|
|
||||||
Alert("Ocurrió un error al agregar el Precio de Lista", TipoMensaje.MsgError)
|
Dim ObjVta As New ClsVentas
|
||||||
|
ObjVta.IniciaTransacSQL()
|
||||||
|
Dim TieneError As Boolean = False
|
||||||
|
Try
|
||||||
|
If EsEditar = 0 Then
|
||||||
|
If ObjVta.AddPrecioLista(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, TxtPrecioLista.Text, ChkPredeterminada.Checked, 0, UpdateFranquicia:=ActualizarFranquicias) > 0 Then
|
||||||
|
Alert("El Precio de Lista se agregó correctamente", TipoMensaje.MsgInformacion)
|
||||||
|
Else
|
||||||
|
Alert("Ocurrió un error al agregar el Precio de Lista", TipoMensaje.MsgError)
|
||||||
|
TieneError = True
|
||||||
|
End If
|
||||||
|
ElseIf EsEditar = 1 Then
|
||||||
|
If ObjVta.UpdatePrecioLista(TxtPrecioLista.Text, chkEstatus.Checked, UsuarioActual.CveUsuario, 0, ChkPredeterminada.Checked, CvePrecioLista, UpdateFranquicia:=ActualizarFranquicias) Then
|
||||||
|
Alert("El Precio de Lista se editó correctamente", TipoMensaje.MsgInformacion)
|
||||||
|
Else
|
||||||
|
Alert("Ocurrió un error al editar al Precio de Lista", TipoMensaje.MsgError)
|
||||||
|
TieneError = True
|
||||||
|
End If
|
||||||
|
EsEditar = 0
|
||||||
|
dvEstatus.Visible = False
|
||||||
|
BtnAgregarCatalogo.Text = "Agregar"
|
||||||
End If
|
End If
|
||||||
ElseIf EsEditar = 1 Then
|
Catch ex As Exception
|
||||||
If ObjVta.UpdatePrecioLista(TxtPrecioLista.Text, chkEstatus.Checked, UsuarioActual.CveUsuario, 0, ChkPredeterminada.Checked, CvePrecioLista) Then
|
TieneError = True
|
||||||
Alert("El Precio de Lista se editó correctamente", TipoMensaje.MsgInformacion)
|
GuardaLog(ex.ToString())
|
||||||
Else
|
End Try
|
||||||
Alert("Ocurrió un error al editar al Precio de Lista", TipoMensaje.MsgError)
|
|
||||||
End If
|
If TieneError Then
|
||||||
EsEditar = 0
|
ObjVta.RollBack()
|
||||||
dvEstatus.Visible = False
|
Else
|
||||||
BtnAgregarCatalogo.Text = "Agregar"
|
ObjVta.Commit()
|
||||||
End If
|
End If
|
||||||
GlobalDTPrecioListas(UsuarioActual.CveEmpresa) = Nothing
|
|
||||||
|
|
||||||
RegistraScript("$('#divAgregar').modal('hide')")
|
RegistraScript("$('#divAgregar').modal('hide')")
|
||||||
ObjVta.Dispose()
|
ObjVta.Dispose()
|
||||||
@@ -94,6 +113,7 @@ Partial Class Ventas_CatPreciosLista
|
|||||||
UpDatos.Update()
|
UpDatos.Update()
|
||||||
UpBodyCo.Update()
|
UpBodyCo.Update()
|
||||||
|
|
||||||
|
RecargaGlobal()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
|
Protected Sub GvDatos_RowDeleting(sender As Object, e As System.Web.UI.WebControls.GridViewDeleteEventArgs) Handles GvDatos.RowDeleting
|
||||||
@@ -105,6 +125,8 @@ Partial Class Ventas_CatPreciosLista
|
|||||||
ObjPrecioLista.Dispose()
|
ObjPrecioLista.Dispose()
|
||||||
CargaDatos()
|
CargaDatos()
|
||||||
UpDatos.Update()
|
UpDatos.Update()
|
||||||
|
|
||||||
|
RecargaGlobal()
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||||
@@ -132,6 +154,9 @@ Partial Class Ventas_CatPreciosLista
|
|||||||
UpBodyCo.Update()
|
UpBodyCo.Update()
|
||||||
UpFooter.Update()
|
UpFooter.Update()
|
||||||
End Sub
|
End Sub
|
||||||
|
Private Sub RecargaGlobal()
|
||||||
|
GlobalDTPrecioListas(UsuarioActual.CveEmpresa) = Nothing
|
||||||
|
End Sub
|
||||||
|
|
||||||
#Region "VIEJO"
|
#Region "VIEJO"
|
||||||
' Public Property PuedeEliminar As Boolean
|
' Public Property PuedeEliminar As Boolean
|
||||||
|
|||||||
@@ -781,7 +781,7 @@ Partial Class Clientes
|
|||||||
|
|
||||||
'JM 05-02-19: CRM
|
'JM 05-02-19: CRM
|
||||||
'If UsuarioActual.Empresa.UsaCRM Then
|
'If UsuarioActual.Empresa.UsaCRM Then
|
||||||
If GlobalDTCRMTipoProceso(UsuarioActual.CveEmpresa).Rows.Count > 0 Then
|
If GlobalDTCRMTipoProceso(UsuarioActual.CveEmpresa) IsNot Nothing AndAlso GlobalDTCRMTipoProceso(UsuarioActual.CveEmpresa).Rows.Count > 0 Then
|
||||||
VerificaVinculacion()
|
VerificaVinculacion()
|
||||||
UpAccionesCRM.Update()
|
UpAccionesCRM.Update()
|
||||||
End If
|
End If
|
||||||
@@ -2618,6 +2618,10 @@ Partial Class Clientes
|
|||||||
Next
|
Next
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If Not ErrorProceso AndAlso UsuarioActual.Empresa.Funcionalidad(563) <> "" AndAlso UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||||
|
ErrorProceso = Not ActualizarClienteFranquicia(ObjClientes, CveClienteNuevo)
|
||||||
|
End If
|
||||||
|
|
||||||
Else
|
Else
|
||||||
ErrorProceso = True
|
ErrorProceso = True
|
||||||
End If
|
End If
|
||||||
@@ -2671,6 +2675,10 @@ Partial Class Clientes
|
|||||||
If Not ErrorProceso AndAlso Not GuardarDocumentosClientes(objDoc, Me.CveCliente) Then
|
If Not ErrorProceso AndAlso Not GuardarDocumentosClientes(objDoc, Me.CveCliente) Then
|
||||||
ErrorProceso = True
|
ErrorProceso = True
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
If Not ErrorProceso AndAlso UsuarioActual.Empresa.Funcionalidad(563) <> "" AndAlso UsuarioActual.Empresa.Funcionalidad(109) = "1" Then
|
||||||
|
ErrorProceso = Not ActualizarClienteFranquicia(ObjClientes, Me.CveCliente)
|
||||||
|
End If
|
||||||
Else
|
Else
|
||||||
ErrorProceso = True
|
ErrorProceso = True
|
||||||
End If
|
End If
|
||||||
@@ -2773,6 +2781,23 @@ Partial Class Clientes
|
|||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|
||||||
|
Private Function ActualizarClienteFranquicia(ByRef ObjClientes As ClsClientes, CveClienteRef As Integer) As Boolean
|
||||||
|
Dim TieneError As Boolean = False
|
||||||
|
Dim FranquiciasStr As String = UsuarioActual.Empresa.Funcionalidad(563)
|
||||||
|
|
||||||
|
Dim Franquicias As String() = FranquiciasStr.Split(","c)
|
||||||
|
|
||||||
|
For Each Franquicia As String In Franquicias
|
||||||
|
Dim CveEmpresaFranquicia As Integer = Franquicia.ToEntero
|
||||||
|
If Not ObjClientes.UpdateClienteFranquicia(CveClienteRef, UsuarioActual.CveEmpresa, CveEmpresaFranquicia) Then
|
||||||
|
TieneError = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
Return Not TieneError
|
||||||
|
End Function
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3194,7 +3194,7 @@ Partial Class ProductosyServicios
|
|||||||
Dim CvePS As Integer = ObjPS.DtResultados.FiltroPrimeroValor("CvePS", String.Format(" Codigo = '{0}'", TxtCodigo.Text.Trim.ToUpper)).ToEntero()
|
Dim CvePS As Integer = ObjPS.DtResultados.FiltroPrimeroValor("CvePS", String.Format(" Codigo = '{0}'", TxtCodigo.Text.Trim.ToUpper)).ToEntero()
|
||||||
If Not ObjPS.UpdatePS(CveClasificacion, -1, CveUnidadMedida, TxtCodigo.Text.Trim, TxtNumeroParte.Text.Trim, TxtCodigoBarras.Text.Trim, PSS, TxtPrecio.Text.Trim.ToDouble, DdlIVA.SelectedValue.ToDouble,
|
If Not ObjPS.UpdatePS(CveClasificacion, -1, CveUnidadMedida, TxtCodigo.Text.Trim, TxtNumeroParte.Text.Trim, TxtCodigoBarras.Text.Trim, PSS, TxtPrecio.Text.Trim.ToDouble, DdlIVA.SelectedValue.ToDouble,
|
||||||
(TxtRetIVA.Text.Trim.ToDouble / 100), ChkInventariable.Checked, -1, True, ChkAplicaParaVenta.Checked, ChkEstado.Checked, UsuarioActual.CveUsuario, CvePS, CveMetodoInv,
|
(TxtRetIVA.Text.Trim.ToDouble / 100), ChkInventariable.Checked, -1, True, ChkAplicaParaVenta.Checked, ChkEstado.Checked, UsuarioActual.CveUsuario, CvePS, CveMetodoInv,
|
||||||
EsPaquete, DdlSATPS.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, CveTipoPS:=DdlTipoPS.SelectedValue.ToEntero, TipoServicio:=-1, CveClasificacion2:=CveClasificacion2, CveMarca:=CveMarcaFranquicia,
|
EsPaquete, DdlSATPS.SelectedValue.ToEntero, CveEmpresaFranquicia, CveTipoPS:=DdlTipoPS.SelectedValue.ToEntero, TipoServicio:=-1, CveClasificacion2:=CveClasificacion2, CveMarca:=CveMarcaFranquicia,
|
||||||
AlmacenSeccion:=TxtAlmacenSeccion.Text.Trim, AplicaIEPS:=ChkAplicaIeps.Checked, IEPSPorcentaje:=DdlIEPSPorcentaje.SelectedValue.ToDecimal,
|
AlmacenSeccion:=TxtAlmacenSeccion.Text.Trim, AplicaIEPS:=ChkAplicaIeps.Checked, IEPSPorcentaje:=DdlIEPSPorcentaje.SelectedValue.ToDecimal,
|
||||||
CveCompuesto:=DdlCompuesto.SelectedValue.ToEntero, IEPSGrabaIVA:=ChkIepsIVA.Checked,
|
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,
|
VentaMinima:=TxtVentaMinima.Text.ToDecimal, CveMoneda:=DdlMoneda.SelectedValue.ToEntero, RetISR:=(TxtRetISR.Text.Trim.ToDouble / 100), PrecioMinimo:=TxtPrecioMinimo.Text.ToDecimal,
|
||||||
|
|||||||
Reference in New Issue
Block a user