This commit is contained in:
rakcsle
2022-02-09 21:13:48 -07:00
5 changed files with 142 additions and 15 deletions

View File

@@ -19,6 +19,14 @@ Partial Class OC
ViewState("CveEmpresaActual") = value
End Set
End Property
Private Property EmpresaActualOC As Empresa
Get
EmpresaActualOC = If(IsNothing(ViewState("EmpresaActualOC")), Nothing, DirectCast(ViewState("EmpresaActualOC"), Empresa))
End Get
Set(value As Empresa)
ViewState("EmpresaActualOC") = value
End Set
End Property
Private Property CveUsuarioAsignado As Integer
Get
Return If(IsNothing(ViewState("CveUsuarioAsignado")), -1, ViewState("CveUsuarioAsignado").ToString.ToEntero)
@@ -584,6 +592,9 @@ Partial Class OC
CveProveedorOriginal = -1
'MODALIDAD MULTIEMPRESA
CveEmpresaActual = UsuarioActual.CveEmpresa
If CveEmpresaActual > 0 Then
EmpresaActualOC = UsuarioActual.Empresa
End If
CargaEstatusUsuariosClasificaciones()
TxtObsPS.Attributes.Add("maxlength", "750")
@@ -1275,6 +1286,9 @@ Partial Class OC
If objOC.GetOC(pCveOrdenCompra, CveEmpresaActual, CveUsuario:=UsuarioActual.CveUsuario) AndAlso objOC.DtResultados.Rows.Count > 0 Then
CveEmpresaActual = objOC.CveEmpresa
If CveEmpresaActual > 0 Then
EmpresaActualOC = CreaObjetoEmpresa(CveEmpresaActual)
End If
InicializarValores()
ViewState("CveOrdenCompra") = pCveOrdenCompra
@@ -4956,6 +4970,27 @@ Partial Class OC
End Sub
Private Function CreaObjetoEmpresa(CveEmpresa As Integer) As Empresa
Dim Retorno As Empresa = Nothing
Dim ObjEmpresa As New ClsSisEmpresas()
If ObjEmpresa.GetEmpresas(CveEmpresa, "-1", "-1", "-1", "-1") Then
If ObjEmpresa.GetEmpresasFuncionalidades(CveEmpresa) Then
Dim dttmp As Data.DataTable = ObjEmpresa.DtResultados
Dim EmpresasFuncionalidades As New HybridDictionary
For Each Row As Data.DataRow In dttmp.Rows
EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString)
Next
ObjEmpresa.Empresa.SetFuncionalidades(EmpresasFuncionalidades)
End If
Retorno = ObjEmpresa.Empresa
End If
ObjEmpresa.Dispose()
Return Retorno
End Function
#Region " GUARDA DIRECTO "
Private Sub GuardaBitacora(Optional EsCotizacion As Boolean = False)
@@ -4974,7 +5009,12 @@ Partial Class OC
If ObjEventoBitacora.AddEventoBitacora(descripcion, String.Format("{0}", FileExtension), UsuarioActual.CveUsuario, CveEmpresaActual, CveOC:=CveOrdenCompra, Prioridad:=Prioridad) Then
If Filename <> "" Then
Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", CveEmpresaActual))
If EmpresaActualOC IsNot Nothing Then
Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("{0}\OI", EmpresaActualOC.Ruta), ConcatenarDirectorioBase:=False)
Else
Filename.FilesMove(String.Format("OI{0}", ObjEventoBitacora.CveEvento.ToString), String.Format("Empresas\{0}\OI", CveEmpresaActual))
End If
End If
GvEB.DataSource = ObjEventoBitacora.DtResultados
@@ -5061,7 +5101,11 @@ Partial Class OC
End If
If Filename <> "" Then
Filename.FilesMove(String.Format("OI{0}{1}", UsuarioActual.CveUsuario, DtDetalle.Rows.Count), String.Format("Empresas\{0}\OI\Temp", CveEmpresaActual))
If EmpresaActualOC IsNot Nothing Then
Filename.FilesMove(String.Format("OI{0}{1}", UsuarioActual.CveUsuario, DtDetalle.Rows.Count), String.Format("{0}OI\Temp", EmpresaActualOC.Ruta), ConcatenarDirectorioBase:=False)
Else
Filename.FilesMove(String.Format("OI{0}{1}", UsuarioActual.CveUsuario, DtDetalle.Rows.Count), String.Format("Empresas\{0}\OI\Temp", CveEmpresaActual))
End If
End If

View File

@@ -4434,7 +4434,7 @@
<ContentTemplate>
<asp:GridView ID="GvAcum" Width="100%" runat="server" GridLines="None"
DataKeyNames="CveMovto, CveCliente,Cantidad,CvePSCargo,CveTamaño,Puntos,ImporteCargo,ImporteBonificacion,Cargo,Bonificacion,ImporteCompra,CveConcepto,CveVenta,Observaciones,CveUsuario,FechaIng,FacturadoCargo,FacturadoBonificacion,CveSubProyecto"
DataKeyNames="CveMovto, CveCliente,Cantidad,CvePSCargo,CveTamaño,Puntos,ImporteCargo,ImporteBonificacion,Cargo,Bonificacion,ImporteCompra,CveConcepto,CveVenta,Observaciones,CveUsuario,FechaIng,FacturadoCargo,FacturadoBonificacion,CveSubProyecto,TipoEstatus"
CssClass="table table-striped table-advance table-hover ScrollAD " ShowHeader="True" EmptyDataText="No se encontraron resultados." ShowHeaderWhenEmpty="true"
AutoGenerateColumns="False" AllowPaging="False" ShowFooter="False">
<Columns>

View File

@@ -9420,7 +9420,7 @@ Partial Class Clientes
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DataKey("CveConcepto").ToEntero() = 1 Then
If e.Row.DataKey("CveConcepto").ToEntero() = 1 AndAlso e.Row.DataKey("TipoEstatus").ToEntero() <> 5 Then
Dim FacturadoCargo As Boolean = Boolean.Parse(e.Row.DataKey("FacturadoCargo"))
Dim FacturadoBonificacion As Boolean = Boolean.Parse(e.Row.DataKey("FacturadoBonificacion"))

View File

@@ -1286,6 +1286,7 @@ Partial Class PV
If UsuarioActual.Empresa.Funcionalidad(569) = "1" Then
DdlTipoComprobante.Items.Add(New ListItem("Remisión", "Rem"))
DdlTipoComprobante.SelectedValueExist("Rem")
DdlTipoComprobante_SelectedIndexChanged(DdlTipoComprobante, EventArgs.Empty)
End If
DdlTipoDefecto.Width = New Unit(260%)
@@ -5964,7 +5965,7 @@ Partial Class PV
Case 1 'CREDITO
TxtFechaPago.Text = Now.AddDays(PlazoCobranza).ToShortDateString
Case 2 'CONTADO
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") Then
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") Then
DivContado.Visible = True
TxtImporteContado.Text = TxtTotal.Text
End If
@@ -6165,6 +6166,11 @@ Partial Class PV
Retorno = True
End If
If DtPagos IsNot Nothing AndAlso DtPagos.SUM("Importe").ToString.ToDecimal() > 0 AndAlso DdlTipoComprobante.SelectedValue = "Rem" Then
Alert("Los pagos no deben ser aplicados a una remisión.", TipoMensaje.MsgAdvertencia)
Retorno = True
End If
Return Retorno
End Function
@@ -7315,12 +7321,10 @@ Partial Class PV
TxtPrecio.Text = TxtPrecio.Text
TxtObsPS.Text = "Descuento por garantía"
Else
'For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
' If Gvr.RowType = DataControlRowType.DataRow Then
' Gvr.FCTextBox("TxtCantidad").Text = ""
' Gvr.FCTextBox("TxtCantidad").Enabled = True
' End If
'Next
If TmpDTAjustes IsNot Nothing Then
TmpDTAjustes.Clear()
End If
TxtObsPS.Text = TxtObsPS.Text.Replace("Descuento por garantía", "")
DdlRecepcionUsados.SelectedValueExist("-1")
DdlRecepcionUsados.Enabled = True

View File

@@ -6602,6 +6602,30 @@ Partial Class Ventas
LnkOCs.Visible = False
End If
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim Autorizacion As Integer = 0
Dim ObjVentas As New ClsVentas
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then
Dim RowAutorizacion As DataRow = Nothing
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
If TieneDiasVencidos Then
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
Else
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
End If
If RowAutorizacion IsNot Nothing Then
Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
End If
End If
ObjVentas.Dispose()
'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
If Autorizacion > 0 Then
BtnsFacturar.Visible = True
End If
End If
Else
@@ -6620,6 +6644,32 @@ Partial Class Ventas
DdlTipoComprobante.SelectedValueExistInsert("Cot", "Cotización")
End If
TxtFechaPago.Text = If(DdlTipoComprobante.SelectedValue = "Rem", Now.AddDays(PlazoCobranzaRemision), Now.AddDays(PlazoCobranza)).ToShortDateString
If EsCotizacion AndAlso UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim Autorizacion As Integer = 0
Dim ObjVentas As New ClsVentas
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then
Dim RowAutorizacion As DataRow = Nothing
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
If TieneDiasVencidos Then
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
Else
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
End If
If RowAutorizacion IsNot Nothing Then
Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
End If
End If
ObjVentas.Dispose()
'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
If Autorizacion > 0 Then
BtnsFacturar.Visible = True
End If
End If
End If
@@ -6753,10 +6803,39 @@ Partial Class Ventas
Dim Opcion As Integer = Vta.ObtenerClienteLimitesVenta(CveCliente, UsuarioActual.CveEmpresa)
Dim OpcionMsg As String = String.Format("El Cliente se encuentra bloqueado por la siguiente razón: <br> <br> {0}", Vta.SerieVenta)
Vta.Dispose()
If Opcion > 0 Then
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
BtnsFacturar.Visible = False
BtnGenerarRemision.Visible = False
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
Dim Autorizacion As Integer = 0
Dim ObjVentas As New ClsVentas
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero, "Ing", CveEstatus:=1) Then
Dim RowAutorizacion As DataRow = Nothing
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
If TieneDiasVencidos Then
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion IN(1,2) AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
Else
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Ing'", Orderby:="Importe DESC")
End If
If RowAutorizacion IsNot Nothing Then
Autorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
End If
End If
ObjVentas.Dispose()
'SI NO TIENE AUTORIZACION, MANTIENE EL BLOQUEO POR CONDICIONES DE CREDITO
If Opcion > 0 AndAlso Autorizacion <= 0 Then
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
BtnsFacturar.Visible = False
BtnGenerarRemision.Visible = False
End If
Else
If Opcion > 0 Then
Alert(OpcionMsg, TipoMensaje.MsgAdvertencia)
BtnsFacturar.Visible = False
BtnGenerarRemision.Visible = False
End If
End If
End If
End If