Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
93
Ventas/CatMotivosDevoluciones.aspx
Normal file
93
Ventas/CatMotivosDevoluciones.aspx
Normal file
@@ -0,0 +1,93 @@
|
||||
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="CatMotivosDevoluciones.aspx.vb" Inherits="Ventas_CatMotivosDevoluciones" %>
|
||||
|
||||
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
|
||||
Catálogo de motivos de devolución
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
<asp:UpdatePanel runat="server" ID="UpAgregar">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:LinkButton runat="server" ID="LnkAgregar" data-toggle="tooltip" data-placement="left" title="Agregar un motivo" Text="<i class='fa fa-plus'></i>Agregar motivo" OnClick="LnkAgregar_Click"></asp:LinkButton>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
<asp:UpdatePanel runat="server" ID="UpDatos" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
|
||||
<%--Seccion lista resultados--%>
|
||||
<div class="row">
|
||||
<div class="col-md-9">
|
||||
<div class="portlet light ">
|
||||
<div class="portlet-body">
|
||||
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right">
|
||||
<div style="margin-right: 15px">
|
||||
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDatos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
<asp:GridView ID="GvDatos" runat="server" GridLines="None" Width="100%" DataKeyNames="CveMotivoDevolucion,MotivoDevolucion,Estatus" CssClass=" table table-striped table-advance table-hover Widthall ScrollAD mysmallbtn" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros" OnRowDeleting="GvDatos_RowDeleting">
|
||||
<Columns>
|
||||
<asp:BoundField DataField="MotivoDevolucion" HeaderText="Motivo" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="50%" />
|
||||
<asp:BoundField DataField="EstatusTexto" HeaderText="Estatus" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" />
|
||||
<asp:BoundField DataField="FechaIng" DataFormatString="{0:d}" HeaderText="Fecha" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%" />
|
||||
<asp:BoundField DataField="Usuario" HeaderText="Usuario" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="20%" />
|
||||
<asp:TemplateField HeaderText="Acciones" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%">
|
||||
<ItemTemplate>
|
||||
<asp:LinkButton ID="imgE" runat="server" OnClick="imgE_Click" AlternateText="Editar" CommandArgument='<%# Eval("CveMotivoDevolucion")%>' CausesValidation="False" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
|
||||
<asp:LinkButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Desea eliminar este registro?" data-btn-ok-label="si" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
</Columns>
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
<div id="DivMotivo" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog" style="width: 450px;">
|
||||
<asp:UpdatePanel runat="server" class="modal-content" ID="UpModal" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-header ">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">
|
||||
<asp:Literal runat="server">Motivo de devolución</asp:Literal></h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtMotivo" CssClass="form-control " runat="server" MaxLength="50" CausesValidation="true"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RFVMotivo" runat="server" ControlToValidate="TxtMotivo" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Motivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
||||
<label for="TxtMotivo">Motivo:</label>
|
||||
<i></i>
|
||||
</div>
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<label for="ChkEstatus">Activo:</label>
|
||||
<asp:CheckBox ID="ChkEstatus" runat="server" CssClass="make-switchsd" data-size="small" Text=" " Checked="true" />
|
||||
<i></i>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<div class="modal-footer">
|
||||
<asp:Button ID="BtnGuardar" runat="server" class="btn btn-success" Text="Guardar" ValidationGroup="GrpGuardar" OnClick="BtnGuardar_Click" />
|
||||
<button id="Button3" runat="server" type="button" class="btn default" data-dismiss="modal">Cancelar</button>
|
||||
</div>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
|
||||
</asp:Content>
|
||||
|
||||
93
Ventas/CatMotivosDevoluciones.aspx.vb
Normal file
93
Ventas/CatMotivosDevoluciones.aspx.vb
Normal file
@@ -0,0 +1,93 @@
|
||||
|
||||
Option Explicit On
|
||||
Option Strict On
|
||||
|
||||
Imports Extensiones
|
||||
|
||||
Partial Class Ventas_CatMotivosDevoluciones
|
||||
Inherits ClsPaginas
|
||||
|
||||
Private Property CveMotivoDevolucion As Integer
|
||||
Get
|
||||
Return (IfNull(ViewState("CveMotivoDevolucion"), "-1", ViewState("CveMotivoDevolucion"))).ToString().ToEntero()
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("CveMotivoDevolucion") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not Page.IsPostBack Then
|
||||
CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub CargaDatos()
|
||||
LimpiaDatos()
|
||||
|
||||
Using ObjVentas As New ClsVentas
|
||||
If ObjVentas.GetMotivoDevolucion(-1, -1, UsuarioActual.CveEmpresa) Then
|
||||
GvDatos.DataSource = ObjVentas.DtResultados.Copy()
|
||||
End If
|
||||
End Using
|
||||
GvDatos.DataBind()
|
||||
|
||||
UpDatos.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDatos_RowDeleting(sender As Object, e As GridViewDeleteEventArgs)
|
||||
Dim GvRow As GridViewRow = GvDatos.Rows(e.RowIndex)
|
||||
|
||||
CveMotivoDevolucion = GvRow.DataKey("CveMotivoDevolucion").ToEntero()
|
||||
|
||||
Using ObjVentas As New ClsVentas
|
||||
If ObjVentas.RemoveMotivoDevolucion(CveMotivoDevolucion, UsuarioActual.CveEmpresa) Then
|
||||
Alert("Se eliminó correctamente")
|
||||
End If
|
||||
End Using
|
||||
|
||||
CargaDatos()
|
||||
End Sub
|
||||
Protected Sub imgE_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
|
||||
|
||||
CveMotivoDevolucion = GvRow.DataKey("CveMotivoDevolucion").ToEntero()
|
||||
TxtMotivo.Text = GvRow.DataKey("MotivoDevolucion")
|
||||
ChkEstatus.Checked = CBool(GvRow.DataKey("Estatus"))
|
||||
|
||||
UpModal.Update()
|
||||
|
||||
RegistraScript("$('#DivMotivo').modal('show');")
|
||||
End Sub
|
||||
|
||||
Private Sub LimpiaDatos()
|
||||
CveMotivoDevolucion = -1
|
||||
TxtMotivo.Text = ""
|
||||
ChkEstatus.Checked = True
|
||||
End Sub
|
||||
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
|
||||
Dim Motivo As String = TxtMotivo.Text
|
||||
|
||||
'AGREGAR
|
||||
Dim ObjVentas As New ClsVentas
|
||||
If CveMotivoDevolucion = -1 Then
|
||||
If ObjVentas.AddMotivoDevolucion(Motivo, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then
|
||||
Alert("El motivo se agrego correctamente")
|
||||
End If
|
||||
Else
|
||||
If ObjVentas.UpdateMotivoDevolucion(CveMotivoDevolucion, Motivo, ChkEstatus.Checked, UsuarioActual.CveEmpresa) Then
|
||||
Alert("El motivo se actualizó correctamente")
|
||||
End If
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
|
||||
RegistraScript("$('#DivMotivo').modal('hide');")
|
||||
|
||||
CargaDatos()
|
||||
End Sub
|
||||
Protected Sub LnkAgregar_Click(sender As Object, e As EventArgs)
|
||||
LimpiaDatos()
|
||||
|
||||
RegistraScript("$('#DivMotivo').modal('show');")
|
||||
End Sub
|
||||
End Class
|
||||
@@ -968,6 +968,11 @@
|
||||
<asp:HyperLink runat="server" ID="HplPresupuesto" Target="_blank" Text="Ir a Presupuesto"></asp:HyperLink>
|
||||
</td>
|
||||
</tr>
|
||||
<tr align="left" id="TrMotivoDev" runat="server" visible="false">
|
||||
<td><b class="truncate">Motivo de devolución:</b> </td>
|
||||
<td>
|
||||
<asp:Label ID="lblMotivoDev" runat="server"></asp:Label></td>
|
||||
</tr>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
@@ -7611,6 +7616,16 @@
|
||||
</div>
|
||||
<div class="col-md-6"></div>
|
||||
</div>
|
||||
<div class="row" id="DivMotivoDevolucion" visible="false" runat="server">
|
||||
<div class="col-md-2">
|
||||
<label>Motivo:</label>
|
||||
</div>
|
||||
<div class="col-md-6">
|
||||
<asp:DropDownList ID="DdlMotivoDevolucion" CssClass=" form-control input-sm select2me" runat="server" Width="100%" DataTextField="MotivoDevolucion" DataValueField="CveMotivoDevolucion">
|
||||
</asp:DropDownList>
|
||||
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" CssClass="help-block errorimput" Display="Dynamic" InitialValue="-1" ControlToValidate="DdlMotivoDevolucion" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Motivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAplicaDevolucion"></asp:RequiredFieldValidator>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row" style="margin-bottom: 10px;">
|
||||
<div class="text-right col-md-offset-8 col-md-4">
|
||||
<input type="text" id="TxtBusquedaDevolucion" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaDevolucion','{0}')", GvAplicaDevolucion.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
|
||||
|
||||
@@ -5284,6 +5284,8 @@ Partial Class Ventas
|
||||
Trsaldo.Visible = True
|
||||
HplSaldoAuxiliar.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta"))
|
||||
HplPagado.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta"))
|
||||
TrMotivoDev.Visible = True
|
||||
lblMotivoDev.Text = DbRowVenta("MotivoDevolucion").ToString()
|
||||
Case "Ped"
|
||||
DdlTipoComprobante.Items.Insert(0, New ListItem("Pedido", "Ped"))
|
||||
CvePedido = CveVenta
|
||||
@@ -5527,6 +5529,7 @@ Partial Class Ventas
|
||||
TxtObsFact.Text = DbRowVenta("Observaciones").ToString()
|
||||
LblUsuario.Text = DbRowVenta("Nombre").ToString().SubStringADS(30)
|
||||
LblFechaRegistro.Text = DbRowVenta("FechaIng").ToString().ToDate.ToShortDateString
|
||||
|
||||
LblSeTimbro.Text = DbRowVenta("SeTimbro").ToString()
|
||||
LblMail.Text = DbRowVenta("EnvioMail").ToString()
|
||||
TxtFechaPago.Text = DbRowVenta("FechaVencimiento").ToString()
|
||||
@@ -8881,11 +8884,20 @@ Partial Class Ventas
|
||||
Dim DatarowPS As DataRow = Nothing
|
||||
DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("") ' Estado = -1
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
If DdlTipoComprobante.SelectedValue = "Cot" Then
|
||||
If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then
|
||||
Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then
|
||||
If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then
|
||||
Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
If DdlTipoComprobante.SelectedValue = "Ant" Then
|
||||
Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString
|
||||
If PSCodigoSAT <> "84111506" Then
|
||||
Alert($"El producto y/o servicio no es valido para generar anticipos", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -8957,7 +8969,7 @@ Partial Class Ventas
|
||||
|
||||
If ValidaExistencia AndAlso DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then
|
||||
'VALIDA EXISTENCIA
|
||||
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153}) Then
|
||||
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153, 190, 192, 197}) Then
|
||||
'SI ES VENTA NUEVA TOMA EN CUENTA LO DEL TMPDT
|
||||
If CveVenta <= 0 Then
|
||||
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then
|
||||
@@ -9752,13 +9764,13 @@ Partial Class Ventas
|
||||
Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero()
|
||||
Dim ObjVentas As New ClsVentas
|
||||
|
||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, If(DdlTipoComprobante.SelectedValue = "Egs", "Egs", "Ing"), CveEstatus:=1) Then
|
||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, "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='{If(DdlTipoComprobante.SelectedValue = "Egs", "Egs", "Ing")}'", Orderby:="Importe DESC")
|
||||
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='{If(DdlTipoComprobante.SelectedValue = "Egs", "Egs", "Ing")}'", Orderby:="Importe DESC")
|
||||
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='{"Ing"}'", Orderby:="Importe DESC")
|
||||
End If
|
||||
|
||||
If RowAutorizacion IsNot Nothing Then
|
||||
@@ -9806,14 +9818,6 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
|
||||
'If TipoAutorizacion = 2 Then
|
||||
' If DiasVencidosCliente > DiasVencidosAutorizacion Then
|
||||
' CveAutorizacion = -1
|
||||
' Alert($"El crédito no esta autorizado. Los días vencidos del cliente son mayores a lo autorizado", TipoMensaje.MsgAdvertencia)
|
||||
' Exit Sub
|
||||
' End If
|
||||
'End If
|
||||
|
||||
'SI NO SE ENCONTRO NINGUA AUTORIZACION
|
||||
If TipoAutorizacion = 0 Then
|
||||
If TieneDiasVencidos Then
|
||||
@@ -9824,21 +9828,57 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
'If TieneDiasVencidos AndAlso DdlTipoComprobante.SelectedValue = "Egs" AndAlso CveAutorizacion <= 0 Then
|
||||
' CveAutorizacion = -1
|
||||
' Alert($"El crédito no esta autorizado. No tiene autorización para generar notas de crédito. El cliente tiene días vencidos", TipoMensaje.MsgAdvertencia)
|
||||
' Exit Sub
|
||||
'End If
|
||||
End If
|
||||
|
||||
'If TipoDocumentoAutorizacion = "Egs" Then
|
||||
' If TipoAutorizacion = 1 Then
|
||||
' If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
|
||||
' CveAutorizacion = -1
|
||||
' Alert($"El crédito autorizado es insuficiente. Crédito Disponible:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
|
||||
' Exit Sub
|
||||
' End If
|
||||
' End If
|
||||
'End If
|
||||
'VALIDACION DE AUTORIZACION PARA NC, POR AHORA SOLO BDH
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveCliente > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Egs") Then
|
||||
PermiteAutorizacion = False
|
||||
'SI NO ES GENERADA CON REMISIONES DE NC, UTILIZAR LA AUTORIZACION
|
||||
If (ListaRemisionesNC Is Nothing OrElse ListaRemisionesNC.Count = 0) Then
|
||||
PermiteAutorizacion = True
|
||||
End If
|
||||
|
||||
If PermiteAutorizacion Then
|
||||
|
||||
Dim ImporteAutorizacion As Decimal = 0
|
||||
Dim TipoAutorizacion As Integer = 0
|
||||
|
||||
Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero()
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
|
||||
If ObjVentas.GetAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, CveVendedor, "Egs", CveEstatus:=1) Then
|
||||
Dim RowAutorizacion As DataRow = Nothing
|
||||
'SI TIENE DIAS VENCIDOS BUSCAR POR TIPO VENCIMIENTO
|
||||
RowAutorizacion = ObjVentas.DtResultados.FiltroPrimero($"TipoAutorizacion = 1 AND CveVenta IS NULL AND CveTipoDocumento='Egs'", Orderby:="Importe DESC")
|
||||
|
||||
If RowAutorizacion IsNot Nothing Then
|
||||
ImporteAutorizacion = RowAutorizacion("Importe").ToString().ToDecimal()
|
||||
CveAutorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
|
||||
TipoAutorizacion = RowAutorizacion("TipoAutorizacion").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
ObjVentas.Dispose()
|
||||
|
||||
If TipoAutorizacion = 1 Then
|
||||
If ImporteAutorizacion < TxtTotal.Text.ToDecimal() Then
|
||||
Dim BloquearCredito As Boolean = True
|
||||
CveAutorizacion = -1
|
||||
|
||||
If BloquearCredito Then
|
||||
Alert($"El importe autorizado es insuficiente. Importe autorizado:{ImporteAutorizacion:N2}", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
CveAutorizacion = -1
|
||||
Alert($"No se encontro una autorización de crédito.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
'VALIDAR LINEAS ADICIONALES
|
||||
@@ -14008,6 +14048,11 @@ Partial Class Ventas
|
||||
'CveAlmacenTraspasoDestino
|
||||
End If
|
||||
|
||||
Dim CveMotivoDevolucion As Integer = -1
|
||||
If DdlMotivoDevolucion.SelectedValue.ToEntero() > 0 Then
|
||||
CveMotivoDevolucion = DdlMotivoDevolucion.SelectedValue.ToEntero()
|
||||
End If
|
||||
|
||||
|
||||
If Not ObjVentas.AddVenta(factura.TipoDocto, factura.Folio, factura.CveCliente, factura.CveClienteSucursal, factura.SubTotalTC, factura.DescuentoTC,
|
||||
factura.AmortizacionTC, factura.IVATC, factura.RetIVATC, factura.RetISRTC,
|
||||
@@ -14027,7 +14072,7 @@ Partial Class Ventas
|
||||
FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia, ServicioDomicilio:=TrServicioDomicilio.Visible,
|
||||
CveLineaAdicional:=DdlLineaAdicional.SelectedValue.ToEntero(), DescripcionVenta:=DescripcionVenta,
|
||||
CveMedico:=CveMedico, CveProcedimiento:=CveProcedimiento, CveTipoVenta:=CveTipoVentaGuardar, RequiereOS:=ChkRequiereTecnico.Checked, FechaParaSurtir:=factura.FechaParaSurtir,
|
||||
Paciente:=TxtPaciente.Text, Episodio:=TxtEpisodio.Text) Then
|
||||
Paciente:=TxtPaciente.Text, Episodio:=TxtEpisodio.Text, CveMotivoDevolucion:=CveMotivoDevolucion) Then
|
||||
ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
||||
Else
|
||||
If factura.TipoDocto.Contiene("Dev", "Egs") OrElse DtVentasNC IsNot Nothing OrElse CveEstatusRefacturacion > 0 OrElse CveAnticipoPadre > 0 Then
|
||||
@@ -16702,6 +16747,13 @@ Partial Class Ventas
|
||||
HdnTieneAnticipos.Value = "0"
|
||||
If CveCliente > 0 Then
|
||||
|
||||
'QUE NO SE PUEDA REALIZAR AMORTIZACIÓN DE ANTICIPO POR DESCUENTO
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
If DdlTipoAmortizacionAnticipo.Items.FindByValue("1") IsNot Nothing Then
|
||||
DdlTipoAmortizacionAnticipo.Items.Remove(DdlTipoAmortizacionAnticipo.Items.FindByValue("1"))
|
||||
End If
|
||||
End If
|
||||
|
||||
HdnIVACalculado.Value = "0"
|
||||
'SI ES REFACTURACION NO LIMPIAR EL FOLIO FISCAL
|
||||
If NuevaFactura <> 1 Then
|
||||
@@ -18108,7 +18160,7 @@ Partial Class Ventas
|
||||
End Sub
|
||||
Protected Sub DdlNCFactura_SelectedIndexChanged(sender As Object, e As System.EventArgs) Handles DdlNCFactura.SelectedIndexChanged
|
||||
Dim objcompras As New ClsCompras
|
||||
If objcompras.GetCompraDetallealmacen(0, DdlNCFactura.SelectedValue.ToEntero()) Then
|
||||
If objcompras.GetCompraDetalleAlmacen(0, DdlNCFactura.SelectedValue.ToEntero()) Then
|
||||
GvInvNC.DataSource = objcompras.DtResultados
|
||||
If objcompras.DtResultados.Rows.Count > 0 Then
|
||||
Tab.ActiveTabIndex = 1
|
||||
@@ -18802,13 +18854,24 @@ Partial Class Ventas
|
||||
Return False
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
Dim DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
If DatarowPS IsNot Nothing Then
|
||||
If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then
|
||||
Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
If DdlTipoComprobante.SelectedValue = "Cot" Then
|
||||
If PU < DatarowPS("PrecioMinimo").ToString().ToDecimal() Then
|
||||
Alert($"El precio no puede ser menor al precio mínimo. Precio Mínimo: {DatarowPS("PrecioMinimo"):N2}", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "Ant" Then
|
||||
Dim PSCodigoSAT As String = DatarowPS("SATClavePS").ToString
|
||||
If PSCodigoSAT <> "84111506" Then
|
||||
Alert($"El producto y/o servicio '{DatarowPS("CodigoPS").ToString}' no es valido para generar anticipos", TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -18887,7 +18950,7 @@ Partial Class Ventas
|
||||
If ValidaExistencia Then
|
||||
|
||||
'VALIDA EXISTENCIA
|
||||
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153, 140, 186, 190}) Then
|
||||
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153, 140, 186, 190, 192, 197}) Then
|
||||
|
||||
Dim BuscarEnTabla As Boolean = If(UsuarioActual.Empresa.Funcionalidad(715) = "1", True, False)
|
||||
|
||||
@@ -18899,7 +18962,14 @@ Partial Class Ventas
|
||||
CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=0, PendientePorSurtir:=1,
|
||||
RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla)
|
||||
Else
|
||||
Existencia = ObjInv2.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(),
|
||||
|
||||
Dim CveAlmacenConsulta As Integer = -1
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso DivAlmacen.Visible Then
|
||||
CveAlmacenConsulta = ddlAlmacen.SelectedValue.ToEntero()
|
||||
End If
|
||||
|
||||
Existencia = ObjInv2.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, CveAlmacenConsulta, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(),
|
||||
CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1,
|
||||
RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla)
|
||||
End If
|
||||
@@ -18907,7 +18977,19 @@ Partial Class Ventas
|
||||
|
||||
If CveVenta <= 0 OrElse Me.EsCreaApartirDe Then
|
||||
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < (If(CantidadModal > 0, CantidadModal, TxtCantidad.Text.ToDouble)) Then
|
||||
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
|
||||
|
||||
Dim CveAlmacenConsulta As Integer = -1
|
||||
Dim StrAlmacen As New StringBuilder
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso DivAlmacen.Visible Then
|
||||
CveAlmacenConsulta = ddlAlmacen.SelectedValue.ToEntero()
|
||||
If CveAlmacenConsulta > 0 Then
|
||||
Dim Almacen As String = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacenConsulta).FiltroPrimeroValor("Almacen")
|
||||
StrAlmacen.AppendFormat("<br/>Almacén: {0}", Almacen)
|
||||
End If
|
||||
End If
|
||||
|
||||
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + "." + StrAlmacen.ToString(), TipoMensaje.MsgAdvertencia)
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
@@ -24047,9 +24129,9 @@ Partial Class Ventas
|
||||
Dim AmortizacionNC As Decimal = 0
|
||||
|
||||
'SI ES AMORTIZACION POR NOTA DE CREDITO DEBE SUMAR LA TOTALIDAD PARA COMPARAR EL PAGO
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") AndAlso DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("2", "4") Then
|
||||
For Each gvr As GridViewRow In GVAnticipos.Rows
|
||||
If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3) Then
|
||||
If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3, 12) Then
|
||||
AmortizacionNC += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal
|
||||
End If
|
||||
Next
|
||||
@@ -37389,6 +37471,22 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
If PuedeAplicarDevolucion Then
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
DivMotivoDevolucion.Visible = True
|
||||
|
||||
Using ObjVenta As New ClsVentas
|
||||
If ObjVenta.GetMotivoDevolucion(-1, 1, UsuarioActual.CveEmpresa) Then
|
||||
DdlMotivoDevolucion.DataSource = ObjVenta.DtResultados.Copy()
|
||||
End If
|
||||
DdlMotivoDevolucion.DataBind()
|
||||
DdlMotivoDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
End Using
|
||||
|
||||
UpDevolucion.Update()
|
||||
End If
|
||||
|
||||
|
||||
RegistraScript("$('#DivAplicaDevolucion').modal('show');")
|
||||
End If
|
||||
|
||||
@@ -38405,9 +38503,12 @@ Partial Class Ventas
|
||||
DdlTipoAmortizacionAnticipo.Items.Remove(DdlTipoAmortizacionAnticipo.Items.FindByValue("2"))
|
||||
End If
|
||||
Else
|
||||
If DdlTipoAmortizacionAnticipo.Items.FindByValue("1") Is Nothing Then
|
||||
DdlTipoAmortizacionAnticipo.Items.Add(New ListItem("Amortización anticipo en descuento", "1"))
|
||||
If Not (UsuarioActual.Empresa.Funcionalidad(382) = "1") Then
|
||||
If DdlTipoAmortizacionAnticipo.Items.FindByValue("1") Is Nothing Then
|
||||
DdlTipoAmortizacionAnticipo.Items.Add(New ListItem("Amortización anticipo en descuento", "1"))
|
||||
End If
|
||||
End If
|
||||
|
||||
If DdlTipoAmortizacionAnticipo.Items.FindByValue("2") Is Nothing Then
|
||||
DdlTipoAmortizacionAnticipo.Items.Add(New ListItem("Amortización anticipo con nota de crédito", "2"))
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user