This commit is contained in:
2021-07-22 20:33:18 -07:00
20 changed files with 896 additions and 242 deletions

View File

@@ -2607,7 +2607,8 @@ Public Class ClsInventarios
#Region "I N V E N T A R I O - F I S I C O - D E T A L L E"
Public Function UpdateInventarioFisicoDetalles(CveInventarioFisicoDetalle As Integer, CvePS As Integer, CveUM As Integer, Cantidad As Double) As Boolean
Public Function UpdateInventarioFisicoDetalles(CveInventarioFisicoDetalle As Integer, CvePS As Integer, CveUM As Integer, Cantidad As Double, Optional Serie As String = "-1",
Optional Lote As String = "-1", Optional FechaCaducidad As Date = MinFecha) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Inv_InventarioFisicoDetalleUpdate")
@@ -2617,6 +2618,9 @@ Public Class ClsInventarios
.Add("@CveUM", SqlDbType.Int).Value = CveUM
.Add("@Cantidad", SqlDbType.Money).Value = Cantidad
.Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@Serie", SqlDbType.VarChar).Value = Serie
.Add("@Lote", SqlDbType.NVarChar).Value = Lote
.Add("@FechaCaducidad", SqlDbType.Date).Value = FechaCaducidad
End With
Try

View File

@@ -5170,7 +5170,7 @@ Public Class ClsVentas
#End Region
Public Function AddAutorizacionLimite(CveEmpresa As Integer, CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveEstatus As Integer, CveUsuario As Integer, TipoAutorizacion As Integer, TipoDocumento As String) As Boolean
Public Function AddAutorizacionLimite(CveEmpresa As Integer, CveCliente As Integer, CveVendedor As Integer, Importe As Decimal, CveEstatus As Integer, CveUsuario As Integer, TipoAutorizacion As Integer, TipoDocumento As String, Optional DiasVencidos As Integer = 0) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_AutorizacionLimitesAdd")
With SqlAdapter.SelectCommand.Parameters
@@ -5182,6 +5182,7 @@ Public Class ClsVentas
.Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario
.Add("@TipoAutorizacion", SqlDbType.Int).Value = TipoAutorizacion
.Add("@TipoDocumento", SqlDbType.VarChar).Value = TipoDocumento
.Add("@DiasVencidos", SqlDbType.Int).Value = DiasVencidos
End With
Try
SqlAdapter.Fill(Data)

View File

@@ -10283,6 +10283,7 @@ Partial Class Compras_Compras
(row1("CveTipoGasto").ToString.ToEntero <> row2("CveTipoGasto").ToString.ToEntero) Or
(row1("Total").ToString.ToDouble <> row2("Total").ToString.ToDouble) Or
(row1("NoDeducible").ToString <> row2("NoDeducible").ToString) Or
(row1("CveActivoFijo").ToString.ToEntero <> row2("CveActivoFijo").ToString.ToEntero) Or
(row1("CvePS").ToString.ToEntero <> row2("CvePS").ToString.ToEntero) Then
Return False
End If

View File

@@ -365,11 +365,13 @@
<div class="row" >
<label class="col-md-3 truncate ">
<asp:Label ID="LblCliente" runat="server" Text="Cliente:"></asp:Label></label>
<div class="col-md-9">
<ADS:Dropdownlost ID="DdlCliente" runat="server" AutoPostBack="False" DataTextField="NombreComercial" IncluyeTodos="false" DataValueField="CveCliente" CssClassDdl="select2me" CssStyle="width: 250px; "></ADS:Dropdownlost>
</div>
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpCliente">
<ContentTemplate>
<div class="col-md-9">
<ADS:Dropdownlost ID="DdlCliente" runat="server" AutoPostBack="False" DataTextField="NombreComercial" IncluyeTodos="false" DataValueField="CveCliente" CssClassDdl="select2me" CssStyle="width: 250px; "></ADS:Dropdownlost>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div class="row" style="display: none;">
@@ -480,16 +482,13 @@
<div class="caption uppercase" style="position: relative;"><i class="fa fa-info-circle"></i>Información</div>
</div>
<div class="portlet-body rowpadding">
<div class="portlet-body rowpadding">
<div class="row" id="TrCliente" runat="server" visible="False">
<label class="col-md-3 ">
<asp:Label ID="Label1" runat="server" Text="Cliente:"></asp:Label></label>
<div class="col-md-9">
</div>
</div>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<div class="row" id="TrClienteSucursal" runat="server" visible="False">

View File

@@ -735,8 +735,9 @@ Partial Class Contratos_ContratoObra
TxtNumeroLicitacion.Text = ObjContratos.NumeroLicitacion
TipoContrato = ObjContratos.CveContratoTipo
CveTipoContrato = ObjContratos.DtResultados.Rows(0)("CveContratoTipo").ToString.ToEntero
TxtCorreoNotificacion.Text = ObjContratos.DtResultados.Rows(0)("CorreoNotificacionPedDev").ToString
DdlCliente.ddl.SelectedValueExist(ObjContratos.CveCliente)
TxtCorreoNotificacion.Text = ObjContratos.DtResultados.Rows(0)("CorreoNotificacionPedDev").ToString
DdlCliente.SelectedValue = ObjContratos.CveCliente.ToString
DdlCliente.SelectedText = ObjContratos.NombreComercial.ToString
If ObjContratos.CveProveedor > 0 Then
' TrProveedor.Visible = True
@@ -744,8 +745,9 @@ Partial Class Contratos_ContratoObra
CargaContratista()
DdlContratista.SelectedValue = ObjContratos.CveProveedor.ToString
Else
cargaClientes()
DdlCliente.ddl.SelectedValueExist(ObjContratos.CveCliente)
cargaClientes()
DdlCliente.SelectedValue = ObjContratos.CveCliente.ToString
UpCliente.Update()
UpGral.Update()
CargaSucursalCliente()
DdlSucursalCliente.SelectedValue = ObjContratos.CveSucursalCliente.ToString

View File

@@ -166,7 +166,7 @@
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvAlmacen" runat="server" GridLines="None" DataKeyNames="CveAlmacen,Almacen" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn scrollAD" Width="100%" AutoGenerateColumns="False" EmptyDataText="No ha seleccionado un almacen" ToolTip="Listado de Almacenes">
<asp:GridView ID="GvAlmacen" runat="server" GridLines="None" DataKeyNames="CveAlmacen,Almacen" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ScrollAD" data-heightfijo="150" data-height="150" Width="380px" AutoGenerateColumns="False" EmptyDataText="No ha seleccionado un almacen" ToolTip="Listado de Almacenes">
<Columns>
<asp:BoundField DataField="Almacen" HeaderText="Almacen" ItemStyle-HorizontalAlign="Left" />
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Comandos">
@@ -211,7 +211,7 @@
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvClasificacion" runat="server" GridLines="None" DataKeyNames="CveClasificacion,Clasificacion" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ADSCroll" Width="100%" AutoGenerateColumns="False" ToolTip="Listado de Clasificaciones" >
<asp:GridView ID="GvClasificacion" runat="server" GridLines="None" DataKeyNames="CveClasificacion,Clasificacion" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ScrollAD" data-heightfijo="150" data-height="150" Width="380px" AutoGenerateColumns="False" ToolTip="Listado de Clasificaciones" >
<Columns>
<asp:BoundField DataField="Clasificacion" HeaderText="Clasificacion" ItemStyle-HorizontalAlign="Left" />
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Comandos">
@@ -258,10 +258,10 @@
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvPS" runat="server" GridLines="None" DataKeyNames="CvePS" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ScrollAD" data-heightfijo="150" data-height="150" Width="100%" AutoGenerateColumns="False" EmptyDataText="">
<asp:GridView ID="GvPS" runat="server" GridLines="None" DataKeyNames="CvePS" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ScrollAD" data-heightfijo="150" data-height="150" Width="380px" AutoGenerateColumns="False" EmptyDataText="">
<Columns>
<asp:BoundField DataField="CodigoPS" HeaderText="Productos" ItemStyle-HorizontalAlign="Left" />
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Comandos">
<asp:BoundField DataField="CodigoPS" HeaderText="Productos" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="310px" HeaderStyle-Width="310px"/>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Comandos" ItemStyle-Width="70px" HeaderStyle-Width="70px">
<ItemTemplate>
<asp:LinkButton ID="imgD" runat="server" AlternateText="Eliminar" OnClick="DeleteProductosServicios_Click" CausesValidation="False" CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="Confirmar" data-btn-ok-label="si" />
</ItemTemplate>
@@ -302,7 +302,7 @@
</div>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvClasificacionExcluida" runat="server" GridLines="None" DataKeyNames="CveClasificacion,Clasificacion" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ADSCroll" Width="100%" AutoGenerateColumns="False" ToolTip="Listado de Clasificaciones Excluidas">
<asp:GridView ID="GvClasificacionExcluida" runat="server" GridLines="None" DataKeyNames="CveClasificacion,Clasificacion" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ScrollAD" data-heightfijo="150" data-height="150" Width="380px" AutoGenerateColumns="False" ToolTip="Listado de Clasificaciones Excluidas">
<Columns>
<asp:BoundField DataField="Clasificacion" HeaderText="Clasificacion" ItemStyle-HorizontalAlign="Left" />
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Comandos">
@@ -349,7 +349,7 @@
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvPSExcluye" runat="server" GridLines="None" DataKeyNames="CvePS" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ScrollAD" data-heightfijo="150" data-height="150" Width="100%" max-heigth="" AutoGenerateColumns="False" EmptyDataText="">
<asp:GridView ID="GvPSExcluye" runat="server" GridLines="None" DataKeyNames="CvePS" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ScrollAD" data-heightfijo="150" data-height="150" Width="380px" AutoGenerateColumns="False" EmptyDataText="">
<Columns>
<asp:BoundField DataField="CodigoPS" HeaderText="Productos" ItemStyle-HorizontalAlign="Left" />
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Comandos">
@@ -394,7 +394,7 @@
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvProveedor" runat="server" GridLines="None" DataKeyNames="CveProveedor,RazonSocial" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ADSCroll" Width="100%" AutoGenerateColumns="False" ToolTip="Listado de Clasificaciones" >
<asp:GridView ID="GvProveedor" runat="server" GridLines="None" DataKeyNames="CveProveedor,RazonSocial" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ScrollAD" data-heightfijo="150" data-height="150" Width="380px" AutoGenerateColumns="False" ToolTip="Listado de Proveedores" >
<Columns>
<asp:BoundField DataField="RazonSocial" HeaderText="Proveedor" ItemStyle-HorizontalAlign="Left" />
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Comandos">

View File

@@ -83,6 +83,15 @@
.SinColor th {
background-color: white;
}
.divmodal{
width: 500px;
}
.center {
float: none;
margin-left: auto;
margin-right: auto;
}
</style>
</asp:Content>
@@ -106,6 +115,7 @@
<li>
<asp:LinkButton ID="LnkExcel" runat="server"><i class="fa fa-ad-excel"></i> Imprimir EXCEL</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkPDF" />
@@ -113,7 +123,9 @@
<asp:PostBackTrigger ControlID="LnkExcel" />
</Triggers>
</asp:UpdatePanel>
<li>
<asp:LinkButton ID="LnkExcelUniverso" runat="server" ToolTip="Descarga listado de todos los productos que se consideran para la verificación de existencias"><i class="fa fa-ad-excel"></i> Descargar productos</asp:LinkButton>
</li>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
Inventario Físico Detalle
@@ -357,7 +369,7 @@
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvIFD.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
<div style="display: inline-block;" id="SumFiltra"></div>
</div>
<asp:GridView ID="GvIFD" ClientIDMode="Static" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False" GridLines="None" DataKeyNames="CveInventarioFisicoDetalle" ShowHeaderWhenEmpty="True" CssClass="table table-striped table-hover Widthall">
<asp:GridView ID="GvIFD" ClientIDMode="Static" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False" GridLines="None" DataKeyNames="CveInventarioFisicoDetalle, CvePS, SerieLote, Lote, FechaCaducidad, Cantidad, CveUnidadMedida" ShowHeaderWhenEmpty="True" CssClass="table table-striped table-hover Widthall">
<Columns>
<asp:BoundField HeaderText="Fecha" DataField="FechaInvFisico" DataFormatString="{0:g}"></asp:BoundField>
<asp:BoundField HeaderText="Código Barras" DataField="CodigoBarras" ItemStyle-HorizontalAlign="Left"></asp:BoundField>
@@ -368,6 +380,11 @@
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-HorizontalAlign="Left" Visible="false"></asp:BoundField>
<asp:BoundField HeaderText="Fecha Caducidad" DataField="FechaCaducidad" ItemStyle-HorizontalAlign="Left" Visible="false" DataFormatString="{0:d}"></asp:BoundField>
<asp:BoundField HeaderText="Cantidad" DataField="Cantidad" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right"></asp:BoundField>
<asp:TemplateField HeaderText="Editar" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="LnkEditar" OnClick="LnkEditar_Click" runat="server" AlternateText="Editar" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Eliminar" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" CssClass="btn btn-circle btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="¿Estas seguro que desea eliminar el registro?" data-btn-ok-label="si" />
@@ -381,6 +398,55 @@
</Triggers>
</asp:UpdatePanel>
<div id="ModalEditarPS" class="modal ADS fade centered" role="dialog">
<div class="modal-dialog" id="modal">
<asp:UpdatePanel ID="UpAddInventarioFisico" class="modal-content divmodal" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabel" runat="server">Editar PS</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel ID="UpEditarPS" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<asp:HiddenField ID="HfCveInventarioFisicoDetalle" Value="" runat="server"/>
<asp:HiddenField ID="HfCvePS" Value="" runat="server"/>
<asp:HiddenField ID="HfCveUM" Value="" runat="server"/>
<div class="form-group form-md-line-input input-iconright" id="DivSerieEdit" runat="server">
<asp:TextBox ID="TxtSerieLote" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="500" Width="175px"></asp:TextBox>
<label for="<%= TxtSerieLote.ClientID.ToString()%>">Serie:</label>
</div>
<div class="form-group form-md-line-input input-iconright" id="DivLoteEdit" runat="server">
<asp:TextBox ID="TxtLoteEdit" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="500" Width="175px"></asp:TextBox>
<label for="<%= TxtLoteEdit.ClientID.ToString()%>">Lote:</label>
</div>
<div class="form-group form-md-line-input input-iconright" id="DivFechaEdit" runat="server">
<asp:TextBox ID="TxtFechaCaducida" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="500" Width="175px"></asp:TextBox>
<label for="<%= TxtFechaCaducida.ClientID.ToString()%>">Fecha Caducida:</label>
</div>
<div class="form-group form-md-line-input input-iconright" id="DivCantidadEdit" runat="server">
<asp:TextBox ID="TxtCantidad" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="500" Width="175px"></asp:TextBox>
<label for="<%= TxtCantidad.ClientID.ToString()%>">Cantidad:</label>
</div>
<div class="modal-footer">
<asp:UpdatePanel ID="UpFooter" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:LinkButton ID="BtnGuadarEditarPS" OnClick="BtnGuadarEditarPS_Click" runat="server" CssClass="btn btn-primary" ValidationGroup="GrpObligatorio"> <i class='material-icons'>done_all</i> Guardar</asp:LinkButton>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">

View File

@@ -3,6 +3,7 @@ Option Explicit On
Imports System.Data
Imports Extensiones
Imports GemBox.Spreadsheet
Imports Microsoft.Reporting.WebForms
Partial Class Inventarios_InventarioFisicoDetalle
@@ -49,6 +50,7 @@ Partial Class Inventarios_InventarioFisicoDetalle
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -153,7 +155,14 @@ Partial Class Inventarios_InventarioFisicoDetalle
CveAlmacenesStr.AppendFormat("{0},", dr("CveAlmacen"))
Next
End If
LblAlmacenes.Text = str.ToString
If str.ToString.Length > 500 Then
LblAlmacenes.Text = str.ToString.Substring(0, 500)
LblAlmacenes.ToolTip = str.ToString
Else
LblAlmacenes.Text = str.ToString
End If
str.Clear()
CveAlmacenes = CveAlmacenesStr.ToString.Substring(0, CveAlmacenesStr.Length - 1)
End If
@@ -165,12 +174,24 @@ Partial Class Inventarios_InventarioFisicoDetalle
For Each dr As DataRow In dt.FiltraParametros("Incluye = 1").Rows
str.AppendFormat("{0},", dr("Clasificacion"))
Next
LblClasif.Text = str.ToString
If str.ToString.Length > 500 Then
LblClasif.Text = str.ToString.Substring(0, 29)
LblClasif.ToolTip = str.ToString
Else
LblClasif.Text = str.ToString
End If
str.Clear()
For Each dr As DataRow In dt.FiltraParametros("Incluye = 0").Rows
str.AppendFormat("{0},", dr("Clasificacion"))
Next
LblClasificacionesExcluidas.Text = str.ToString
Next
If str.ToString.Length > 500 Then
LblClasificacionesExcluidas.Text = str.ToString.Substring(0, 500)
LblClasificacionesExcluidas.ToolTip = str.ToString
Else
LblClasificacionesExcluidas.Text = str.ToString
End If
str.Clear()
End If
End If
@@ -182,13 +203,26 @@ Partial Class Inventarios_InventarioFisicoDetalle
For Each dr As DataRow In dt.FiltraParametros("Incluye = 1").Rows
str.AppendFormat("{0},", dr("CodigoPS"))
Next
LblProductos.Text = str.ToString
Next
If str.ToString.Length > 500 Then
LblProductos.Text = str.ToString.Substring(0, 500)
LblProductos.ToolTip = str.ToString
Else
LblProductos.Text = str.ToString
End If
str.Clear()
For Each dr As DataRow In dt.FiltraParametros("Incluye = 0").Rows
str.AppendFormat("{0},", dr("CodigoPS"))
Next
LblProductosExcluidos.Text = str.ToString
Next
If str.ToString.Length > 500 Then
LblProductosExcluidos.Text = str.ToString.Substring(0, 500)
LblProductosExcluidos.ToolTip = str.ToString
Else
LblProductosExcluidos.Text = str.ToString
End If
str.Clear()
End If
End If
@@ -200,8 +234,13 @@ Partial Class Inventarios_InventarioFisicoDetalle
For Each dr As DataRow In dt.FiltraParametros("Incluye = 1").Rows
str.AppendFormat("{0},", dr("RazonSocial"))
Next
LblProveedores.Text = str.ToString
Next
If str.ToString.Length > 500 Then
LblProveedores.Text = str.ToString.Substring(0, 500)
LblProveedores.ToolTip = str.ToString
Else
LblProveedores.Text = str.ToString
End If
str.Clear()
End If
@@ -566,7 +605,6 @@ Partial Class Inventarios_InventarioFisicoDetalle
Private Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click
Impimir(Formato:="EXCEL")
End Sub
Protected Sub Impimir(Optional Formato As String = "PDF", Optional Agrupar As Boolean = False)
Dim DtDatos As New DataTable
Dim ObjInventario As New ClsInventarios()
@@ -607,6 +645,86 @@ Partial Class Inventarios_InventarioFisicoDetalle
End If
End Sub
Private Sub LnkExcelUniverso_Click(sender As Object, e As EventArgs) Handles LnkExcelUniverso.Click
Dim IncluyePS, ExcluyePS, IncluyeClasificacion, ExcluyeClasificacion, IncluyeProveedor As New StringBuilder
Dim ObjInventario As New ClsInventarios
If ObjInventario.GetInventarioFisicoDetallesClasificacion(CveInventarioFisico, UsuarioActual.CveEmpresa) Then
Dim dt As DataTable = ObjInventario.DtResultados
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
For Each dr As DataRow In dt.FiltraParametros("Incluye = 1").Rows
IncluyeClasificacion.AppendFormat("{0},", dr("CveClasificacion"))
Next
For Each dr As DataRow In dt.FiltraParametros("Incluye = 0").Rows
ExcluyeClasificacion.AppendFormat("{0},", dr("CveClasificacion"))
Next
End If
End If
If ObjInventario.GetInventarioFisicoDetallesProductosServicios(CveInventarioFisico, UsuarioActual.CveEmpresa) Then
Dim dt As DataTable = ObjInventario.DtResultados
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
For Each dr As DataRow In dt.FiltraParametros("Incluye = 1").Rows
IncluyePS.AppendFormat("{0},", dr("CvePS"))
Next
For Each dr As DataRow In dt.FiltraParametros("Incluye = 0").Rows
ExcluyePS.AppendFormat("{0},", dr("CvePS"))
Next
End If
End If
If ObjInventario.GetInventarioFisicoDetallesProveedores(CveInventarioFisico, UsuarioActual.CveEmpresa) Then
Dim dt As DataTable = ObjInventario.DtResultados
Dim str As New StringBuilder
If dt IsNot Nothing AndAlso dt.Rows.Count > 0 Then
For Each dr As DataRow In dt.FiltraParametros("Incluye = 1").Rows
IncluyeProveedor.AppendFormat("{0},", dr("CveProveedor"))
Next
End If
End If
Dim dtPS As DataTable = GlobalDTPS(UsuarioActual.CveEmpresa)
If IncluyePS.ToString <> "" Then
dtPS = dtPS.FiltraParametros(String.Format("CvePS IN ({0})", IncluyePS.ToString.TrimEnd(",")))
End If
If ExcluyePS.ToString <> "" Then
dtPS = dtPS.FiltraParametros(String.Format("CvePS NOT IN ({0})", ExcluyePS.ToString.TrimEnd(",")))
End If
If IncluyeClasificacion.ToString <> "" Then
dtPS = dtPS.FiltraParametros(String.Format("CveClasificacion IN ({0})", IncluyeClasificacion.ToString.TrimEnd(",")))
End If
If ExcluyeClasificacion.ToString <> "" Then
dtPS = dtPS.FiltraParametros(String.Format("CveClasificacion NOT IN ({0})", ExcluyeClasificacion.ToString.TrimEnd(",")))
End If
If IncluyeProveedor.ToString <> "" Then
dtPS = dtPS.FiltraParametros(String.Format("CveProveedorCompra IN ({0})", IncluyeProveedor.ToString.TrimEnd(",")))
End If
dtPS = dtPS.FiltraParametros("", "PS", {"Codigo", "PS", "Clasificacion", "ProveedorCompra"})
Dim NombreArchivo As String
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim workbook As New ExcelFile()
Dim worksheet = workbook.Worksheets.Add("Productos")
worksheet.InsertDataTable(dtPS, New InsertDataTableOptions() With
{
.ColumnHeaders = True,
.StartRow = 0,
.StartColumn = 0
})
'worksheet.Columns("B").Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(217, 217, 217), SpreadsheetColor.FromArgb(255, 255, 255))
'worksheet.Columns("C").Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(217, 217, 217), SpreadsheetColor.FromArgb(255, 255, 255))
'worksheet.Columns("Q").Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(217, 217, 217), SpreadsheetColor.FromArgb(255, 255, 255))
worksheet.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(217, 217, 217), SpreadsheetColor.FromArgb(255, 255, 255))
Dim columnCount = worksheet.CalculateMaxUsedColumns()
For i = 0 To columnCount
worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1))
Next
NombreArchivo = "Productos"
workbook.Save(Response, $"{NombreArchivo}.xlsx", SaveOptions.XlsxDefault)
End Sub
#End Region
Protected Sub BtnBuscarCodVarras_Click(sender As Object, e As EventArgs)
@@ -647,4 +765,68 @@ Partial Class Inventarios_InventarioFisicoDetalle
' UPAgregarPro.Update()
'End Sub
Protected Sub LnkEditar_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast((DirectCast(sender, LinkButton)).NamingContainer, GridViewRow)
LimpiarModal()
HfCveInventarioFisicoDetalle.Value = GvRow.DataKey("CveInventarioFisicoDetalle").ToString
HfCvePS.Value = GvRow.DataKey("CvePS").ToString
HfCveUM.Value = GvRow.DataKey("CveUnidadMedida").ToString
TxtSerieLote.Text = GvRow.DataKey("SerieLote").ToString
TxtLoteEdit.Text = GvRow.DataKey("Lote").ToString
TxtFechaCaducida.Text = GvRow.DataKey("FechaCaducidad").ToString
TxtCantidad.Text = GvRow.DataKey("Cantidad").ToString
UpEditarPS.Update()
RegistraScript("$('#ModalEditarPS').modal('show')")
End Sub
Private Sub LimpiarModal()
HfCveInventarioFisicoDetalle.Value = ""
HfCvePS.Value = ""
HfCveUM.Value = ""
TxtSerieLote.Text = ""
TxtLoteEdit.Text = ""
TxtFechaCaducida.Text = ""
TxtCantidad.Text = ""
End Sub
Protected Sub BtnGuadarEditarPS_Click(sender As Object, e As EventArgs)
Dim objInventario As New ClsInventarios
If Not TxtCantidad.Text.ToEntero > 0 Then
Alert("La cantidad debe ser mayor a 0", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim serie As String = IIf(TxtSerieLote.Text.ToString = "", "-1", TxtSerieLote.Text.ToString)
Dim Lote As String = IIf(TxtLoteEdit.Text.ToString = "", "-1", TxtLoteEdit.Text.ToString)
Dim FechaCaducida As Date = IIf(TxtFechaCaducida.Text.ToString = "", MinFecha, TxtFechaCaducida.Text.ToString.ToDate)
If objInventario.UpdateInventarioFisicoDetalles(HfCveInventarioFisicoDetalle.Value.ToEntero, HfCvePS.Value.ToEntero, HfCveUM.Value.ToEntero, TxtCantidad.Text.ToEntero, serie, Lote, FechaCaducida) Then
If objInventario.GetInventarioFisicoDetalle(CveInventarioFisico, ddlUsuario.SelectedValue.ToString.ToEntero) Then
GvIFD.DataSource = objInventario.DtResultados
End If
GvIFD.DataBind()
If (GvIFD.Rows.Count > 0) Then
GvIFD.UseAccessibleHeader = True
GvIFD.HeaderRow.TableSection = TableRowSection.TableHeader
RegistraScript("OrdenarGV();")
End If
UPPInventario.Update()
UPAgregarPro.Update()
RegistraScript("$('#ModalEditarPS').modal('hide')")
Alert("Se modico el producto correctamente", TipoMensaje.MsgInformacion)
Else
Alert("Ocurrio un error al actuliazar", TipoMensaje.MsgError)
End If
objInventario.Dispose()
End Sub
End Class

View File

@@ -148,8 +148,8 @@ Partial Class Inventarios_RepAnomalias
End If
Inventario.Dispose()
If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then GvS.Columns(7).HeaderText = UsuarioActual.Empresa.Funcionalidad(147)
If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then GvF.Columns(7).HeaderText = UsuarioActual.Empresa.Funcionalidad(147)
If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then GvS.Columns(8).HeaderText = UsuarioActual.Empresa.Funcionalidad(147)
If Not String.IsNullOrWhiteSpace(UsuarioActual.Empresa.Funcionalidad(147)) Then GvF.Columns(8).HeaderText = UsuarioActual.Empresa.Funcionalidad(147)
GvS.DataSource = dt.FiltraParametros("Diferencia < 0")
@@ -295,10 +295,10 @@ Partial Class Inventarios_RepAnomalias
#End Region
Private Sub BanderaSerieLoteCad(Gv As GridView, resultado As DataTable)
Gv.Columns(4).Visible = resultado.MAX("CveSeccionAlmacen").ToEntero > 0
Gv.Columns(5).Visible = resultado.MAX("Serie") <> ""
Gv.Columns(6).Visible = resultado.MAX("Lote") <> ""
Gv.Columns(7).Visible = resultado.MAX("FechaCaducidad").ToDate > MinFecha
Gv.Columns(5).Visible = resultado.MAX("CveSeccionAlmacen").ToEntero > 0
Gv.Columns(6).Visible = resultado.MAX("Serie") <> ""
Gv.Columns(7).Visible = resultado.MAX("Lote") <> ""
Gv.Columns(8).Visible = resultado.MAX("FechaCaducidad").ToDate > MinFecha
End Sub
Private Sub LnkCrear_Click(sender As Object, e As EventArgs) Handles LnkCrear.Click

View File

@@ -2055,7 +2055,7 @@ public partial class Nomina_Nomina2 : ClsPaginas
&& (dtempleadosConceptos.COUNT("CveConcepto", string.Format("CveConcepto={0} AND CvePersonal ={1} AND Estatus =2", CveConcepto, SRCvePersonal)) == 0)
)
{
if(!row["CveSistema"].ToString().ToEntero().Contiene(new int[] { 20,21,112,202, 203 }))
if(!row["CveSistema"].ToString().ToEntero().Contiene(new int[] { 20,21,112,202, 203,204,205,206,207,50,51 }))
{
BorradoLogico = 1;
}

View File

@@ -365,7 +365,7 @@ Partial Class Site
For Each drN As DataRow In Nietos
LinkNieto = drN("LIGA").ToString()
If (drH("IsAngular").ToString() = "1") Then
LinkNieto = String.Format("{1}:4200{0}", drN("LIGA"), strdomain)
LinkNieto = String.Format("{1}:84{0}", drN("LIGA"), strdomain)
End If
If CveModulo = drN("CveModulo").ToString().ToEntero Then
CveModuloPadreSeleccionado = CveModuloPadre : CveModuloHijoSeleccionado = CveModuloHijo

View File

@@ -48,6 +48,7 @@
</asp:DropDownList>
</li>
<li>Cliente:
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClienteFiltro" Width="200px" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;"></ADS:Dropdownlost>
</li>
<li>Vendedor:
@@ -73,6 +74,7 @@
<asp:BoundField DataField="Saldo" ItemStyle-Width="15%" HeaderText="Saldo" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:N2}" />
<asp:BoundField DataField="FechaIng" ItemStyle-Width="10%" HeaderText="Fecha de Ingreso" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:d}" />
<asp:BoundField DataField="TipoAutorizacionTexto" HeaderText="Tipo" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="10%" />
<asp:BoundField DataField="DiasVencidos" ItemStyle-Width="15%" HeaderText="Dias Vencidos" ItemStyle-HorizontalAlign="Center" DataFormatString="{0:N0}" />
<asp:BoundField DataField="TipoDocumento" HeaderText="Tipo Documento" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="10%" />
<asp:BoundField DataField="Usuario" HeaderText="Usuario" ItemStyle-Width="15%" ItemStyle-HorizontalAlign="Left" />
<asp:TemplateField HeaderText="Estatus" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="10%">
@@ -141,12 +143,23 @@
<asp:TextBox ID="TxtPrecio" inputmode="numeric" runat="server" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GrpAddVenta" Width="200px" CssClass="form-control "></asp:TextBox>
<%--<ajax:MaskedEditExtender ID="MEEPrecio" runat="server" TargetControlID="TxtPrecio" ClearMaskOnLostFocus="false" MaskType="Number" Mask="9,999.99" InputDirection="RightToLeft" DisplayMoney="Left"></ajax:MaskedEditExtender>--%>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtPrecio" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVPrecio" runat="server" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
<asp:RequiredFieldValidator ID="RFVPrecio" runat="server" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="VgmGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCPrecio" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVPrecio" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GrpAddVenta"></asp:CustomValidator>
<asp:CustomValidator ID="CVPrecio" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="VgmGuardar"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VCEPrecio" runat="server" HighlightCssClass="vco" TargetControlID="CVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= TxtPrecio.ClientID.ToString()%>">Importe:</label>
</div>
<div id="DivDiasVencidos" runat="server" visible="false" class="row">
<label class="col-md-2 truncate">Días Vencidos:</label>
<div class="col-md-10">
<asp:TextBox ID="TxtDiasVencidos" Text="" runat="server" />
<ajax:FilteredTextBoxExtender ID="SoloNumerosCantidad" runat="server" TargetControlID="TxtDiasVencidos" FilterType="Custom, Numbers" />
<asp:RequiredFieldValidator ID="RFVCantiMinima" runat="server" ControlToValidate="TxtDiasVencidos" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Días Vencidos''</b> es necesario, por favor ingréselo." ValidationGroup="VgmGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCECantMinima" runat="server" HighlightCssClass="vco" TargetControlID="RFVCantiMinima" Width="350px"></ajax:ValidatorCalloutExtender>
<asp:RequiredFieldValidator ID="RFVDiasVencidos2" runat="server" ControlToValidate="TxtDiasVencidos" Display="None" InitialValue="0" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El valor del campo <b>''Días Vencidos''</b> debe ser mayor a 0." ValidationGroup="VgmGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDiasVencidos2" runat="server" HighlightCssClass="vco" TargetControlID="RFVDiasVencidos2" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnGuardar" OnClick="BtnGuardar_Click" runat="server" Text="Agregar" CssClass="btn btn-primary" ValidationGroup="VgmGuardar" />

View File

@@ -99,14 +99,17 @@ Partial Class Ventas_CatAutorizacionLimites
Protected Sub LnkAgregar_Click(sender As Object, e As EventArgs)
LimpiaModal()
Modalidad = "A"
BtnGuardar.Text = "Agregar"
BtnGuardar.Text = "Agregar"
ltlMotititulo.Text = "Agregar autorización"
UpModal.Update()
RegistraScript("$('#DModal').modal()")
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
If DdlTipoAutorizacion.SelectedValue.ToEntero() <= 0 Then
Alert("Debe seleccionar un tipo de autorización", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Alert("Debe seleccionar un tipo de autorización", TipoMensaje.MsgAdvertencia)
Dim DiasVencidos As Integer = 0
Dim CveEstatus As Integer = 1
Dim TipoDocto As String = DdlTipoDocto.SelectedValue
Dim CveTipoAutorizacion As Integer = DdlTipoAutorizacion.SelectedValue.ToEntero()
@@ -196,6 +199,7 @@ Partial Class Ventas_CatAutorizacionLimites
Dim CveAutorizacion = gvRow.DataKey("CveAutorizacion").ToEntero()
Dim CveCliente = gvRow.DataKey("CveCliente").ToEntero()
Dim CveVendedor = gvRow.DataKey("CveVendedor").ToEntero()
Dim Importe = gvRow.DataKey("Importe").ToEntero()
Dim CveEstatusAutorizacion As Integer = 3

View File

@@ -4289,7 +4289,7 @@
<ContentTemplate>
<asp:GridView ID="GvAcum" Width="100%" runat="server" GridLines="None"
DataKeyNames="CveMovto, CveCliente,Cantidad,CveTamaño,Puntos,ImporteCargo,ImporteBonificacion,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"
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

@@ -9511,51 +9511,55 @@ Partial Class Clientes
End Function
Private Sub CreaObjetosVenta(Tipo As Integer)
Dim SubTotal As Decimal = 0D
Dim IVA As Decimal = 0D
Dim CveSubProyecto As Integer = -1
TmpDT.Rows.Clear()
TmpDT.AcceptChanges()
For Each GvRow As GridViewRow In GvAcum.Rows
If Tipo = 1 Then
If GvRow.DataKey("CveConcepto").ToEntero() = 1 And GvRow.FCCheckBox("ChkCargo").Checked Then
SubTotal = SubTotal + GvRow.DataKey("ImporteCargo").ToDecimal()
End If
ElseIf Tipo = 2 Then
If GvRow.DataKey("CveConcepto").ToEntero() = 1 And GvRow.FCCheckBox("ChkBonificacion").Checked Then
SubTotal = SubTotal + GvRow.DataKey("ImporteBonificacion").ToDecimal()
End If
End If
CveSubProyecto = GvRow.DataKey("CveSubProyecto").ToEntero()
If GvRow.FCCheckBox("ChkBonificacion").Checked OrElse GvRow.FCCheckBox("ChkCargo").Checked Then
CveSubProyecto = GvRow.DataKey("CveSubProyecto").ToEntero()
Dim Cantidad As Decimal = GvRow.DataKey("Cantidad").ToDecimal
Dim PU As Decimal = 0
Dim CvePSCargo As Integer = GvRow.DataKey("CvePSCargo").ToEntero()
Dim CveUnidadMedida As Integer = 0
Dim CveClasificacion As Integer = 0
Dim UnidadMedida As String = ""
Dim Clasificacion As String = ""
Dim PS As String = ""
Dim PorcentajeIVA As Decimal = 0.16D
If Tipo = 1 Then
If GvRow.DataKey("CveConcepto").ToEntero() = 1 And GvRow.FCCheckBox("ChkCargo").Checked Then
PU = GvRow.DataKey("Cargo").ToDecimal()
End If
ElseIf Tipo = 2 Then
If GvRow.DataKey("CveConcepto").ToEntero() = 1 And GvRow.FCCheckBox("ChkBonificacion").Checked Then
PU = GvRow.DataKey("Bonificacion").ToDecimal()
End If
End If
If CvePSCargo > 0 AndAlso PU > 0 Then
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePSCargo).Rows(0)
If Dr IsNot Nothing Then
CveUnidadMedida = Dr("CveUnidadMedida").ToString().ToEntero()
CveClasificacion = Dr("CveClasificacion").ToString().ToEntero()
PS = Dr("PSCodigo").ToString()
UnidadMedida = Dr("UnidadMedida").ToString()
Clasificacion = Dr("Clasificacion").ToString()
End If
AgregarProductoServicio(Cantidad, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePSCargo, PS, "Clientes/Usados", PU, 0, -1, "", DdlSubProyecto.SelectedValue.ToEntero(),
DdlSubProyecto.SelectedItem.Text, PorcentajeIVA:=PorcentajeIVA)
End If
End If
Next
Dim CvePS As Integer = UsuarioActual.Empresa.Funcionalidad(534).ToEntero() 'CvePS Distruibuidor Bonificación Nota
Dim CveUnidadMedida As Integer = 0
Dim CveClasificacion As Integer = 0
Dim UnidadMedida As String = ""
Dim Clasificacion As String = ""
Dim PS As String = ""
Dim PorcentajeIVA As Decimal = 0D
If CvePS > 0 Then
If SubTotal > 0 Then
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS).Rows(0)
If Dr IsNot Nothing Then
CveUnidadMedida = Dr("CveUnidadMedida").ToString().ToEntero()
CveClasificacion = Dr("CveClasificacion").ToString().ToEntero()
PS = Dr("PSCodigo").ToString()
UnidadMedida = Dr("UnidadMedida").ToString()
Clasificacion = Dr("Clasificacion").ToString()
End If
PorcentajeIVA = 0.16D
IVA = SubTotal * PorcentajeIVA
End If
End If
TmpDT.Rows.Clear()
TmpDT.AcceptChanges()
AgregarProductoServicio(1, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePS, PS, "Clientes/Usados", SubTotal, 0, -1, "", DdlSubProyecto.SelectedValue.ToEntero(),
DdlSubProyecto.SelectedItem.Text, PorcentajeIVA:=PorcentajeIVA)
Dim SubTotalFactura As Decimal = TmpDT.SUMD("Total")
Dim IVAFactura As Decimal = TmpDT.SUMD("ImporteIVA")
Dim Folio As Integer = -1
Dim Serie As String = ""
@@ -9683,14 +9687,14 @@ Partial Class Clientes
ObjFactura.Det_FechaOrdenCompra = ""
ObjFactura.MonedaAbreviatura = ""
ObjFactura.SubTotal = SubTotal
ObjFactura.SubTotal = SubTotalFactura
ObjFactura.Descuento = 0
ObjFactura.Amortizacion = 0
ObjFactura.IVA = IVA
ObjFactura.IVA = IVAFactura
ObjFactura.RetIVA = 0
ObjFactura.RetISR = 0
ObjFactura.IEPS = 0
ObjFactura.Total = SubTotal + IVA
ObjFactura.Total = SubTotalFactura + IVAFactura
ObjFactura.DtDetalle = TmpDT
ObjFactura.DtPagos = DtPagos
ObjFactura.DtPromociones = DtPromociones

View File

@@ -775,7 +775,7 @@
<td><b>Descuentos:</b></td>
<td>
<asp:Label ID="LblDescuentos" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
<td align="right">&nbsp;<asp:LinkButton ID="ImgDescTotal" runat="server" Text="<i class='fa fa-comment-o'></i>" Style="cursor: pointer;" AlternateText="Agregar Descuento" /></td>
<td align="right">&nbsp;<%--<asp:LinkButton ID="ImgDescTotal" runat="server" Text="<i class='fa fa-comment-o'></i>" Style="cursor: pointer;" AlternateText="Agregar Descuento" />--%></td>
</tr>
<tr align="right">
<td style="border: 1px none white"><b>Amort. Ant.:</b></td>

View File

@@ -688,7 +688,7 @@ Partial Class PV
Get
Return New Dictionary(Of Integer, Decimal) From {
{20516, 0.23D}, 'Descuento para lubricantes LTH
{20515, 0.28D} 'Descuento para filtros LTH
{20515, 0.24D} 'Descuento para filtros LTH
}
End Get
End Property
@@ -1114,7 +1114,7 @@ Partial Class PV
TxtPrecio.Attributes.Add("onKeyUp ", "Recalcula();")
ImgDescPU.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '0'; $get('LblPrecio1').style.display = ''; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';")
'ImgDescConcepto.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '1'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = ''; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';")
ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';")
'ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';")
ImgOtrosConceptos.Attributes.Add("onclick", "javascript:$('#ModalOtrosConceptos').modal();")
LkbAgregarComplementos.Attributes.Add("onclick", "javascript:$('#ModalComplementos').modal();")
'ImgCerrar.Attributes.Add("OnClick", "$('#DivAnticipos').hide();")
@@ -1653,7 +1653,7 @@ Partial Class PV
TxtObsPS.Enabled = False
TxtPrecio.Enabled = False
ImgDescPU.Attributes.Clear()
ImgDescTotal.Attributes.Clear()
'ImgDescTotal.Attributes.Clear()
LbAgregar.Enabled = False
DdlCuentasTerminal.Enabled = False
@@ -1716,7 +1716,7 @@ Partial Class PV
TxtObsPS.Enabled = True
TxtPrecio.Enabled = True
ImgDescPU.Attributes.Clear()
ImgDescTotal.Attributes.Clear()
'ImgDescTotal.Attributes.Clear()
LbAgregar.Enabled = True
DdlCuentasTerminal.Enabled = True
@@ -1793,7 +1793,7 @@ Partial Class PV
TxtObsPS.Enabled = True
TxtPrecio.Enabled = True
LbAgregar.Enabled = True
ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';")
'ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';")
LblSubTotal1.Text = TxtSubTotal.Text
LblAmort.Text = TxtSubTotal.Text
@@ -5050,13 +5050,13 @@ Partial Class PV
If CveVentaDetalle <= 0 AndAlso Not EsCargo Then
Dim ListaPSCargo = CalculaUsados(Consec)
If ListaPSCargo.Count > 0 Then
CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad)
CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad, Consec)
End If
ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then
EliminarUsados()
Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False)
If ListaPSCargo.Count > 0 Then
CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad)
CalculaRecepcionUsados(CvePS, ListaPSCargo, Cantidad, Consec)
End If
End If
@@ -7148,7 +7148,7 @@ Partial Class PV
EmitirImprimirNew()
End Sub
Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer), CantidadUsado As Decimal)
Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer), CantidadUsado As Decimal, ConsecPSPadre As Integer)
If Modalidad = "U" Then
If TmpDTRecepcionUsados.Rows.Count > 0 Then
@@ -7168,7 +7168,7 @@ Partial Class PV
Dim TotalCargos As Decimal = 0
Dim TotalCantidad As Decimal = 0
Dim StrTamanios As New StringBuilder()
StrTamanios.Append("Se recibieron los siguientes usados:")
StrTamanios.Append("Se recibierón los siguientes usados:")
'For Each Gvr As GridViewRow In Gv.Rows
' If Gvr.RowType = DataControlRowType.DataRow Then
@@ -7233,8 +7233,8 @@ Partial Class PV
' Exit Sub
'End If
Dim DtUsadosFiltro As DataTable = TmpDT.FiltraParametros($"EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos})")
Dim DivisorUsado = DtUsadosFiltro.Rows.Count.ToString().ToDecimal()
Dim DtUsadosFiltro As DataTable = TmpDT.FiltraParametros($"ConsecPSPadre = {ConsecPSPadre} AND EsCargo = True AND EliminarDB = False AND CvePS IN ({StrCargos}) AND (Total - Descuento) > 0.0000")
Dim DivisorUsado As Decimal = 1
For Each Dr As DataRow In DtUsadosFiltro.Rows
@@ -7278,8 +7278,8 @@ Partial Class PV
Next
TmpDT.AcceptChanges()
If TotalCargos > 0 Then ' cuando se entrega más valor de usados, que los cargos hechos, se descuenta sobre el PU del producto de venta
Dim DtPSFiltro As DataTable = TmpDT.FiltraParametros($"EsCargo = False AND EliminarDB = False AND CvePS={CvePS}")
Dim Divisor = DtPSFiltro.Rows.Count.ToString().ToDecimal()
Dim DtPSFiltro As DataTable = TmpDT.FiltraParametros($"Consec = {ConsecPSPadre} AND EsCargo = False AND EliminarDB = False AND CvePS={CvePS} AND (Total - Descuento) > 0.0000", Orderby:="Consec DESC")
Dim Divisor As Decimal = 1
For Each Dr As DataRow In DtPSFiltro.Rows

View File

@@ -6317,7 +6317,8 @@
<div class="row">
<div class="col-md-2">Folio Fiscal</div>
<div class="col-md-10">
<asp:TextBox ID="TxtModalFolioFiscal" runat="server" Width="100%"></asp:TextBox></div>
<asp:TextBox ID="TxtModalFolioFiscal" runat="server" Width="100%"></asp:TextBox>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
@@ -7322,12 +7323,13 @@
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom">
<div class="row" style="margin-right: 10px;" align="right">
<input type="text" id="TxtBusquedaNCBonificaciones" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaNCBonificaciones','{0}')", GvDescNCBonificaciones.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaNCBonificaciones','{0}')", GvDescNCBonificaciones.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
<div class="row">
<div class="col-md-12">
<asp:CheckBox ID="ChkMostarProductosRNCDesBonificacion" runat="server" AutoPostBack="true" Text="Mostrar Productos" OnCheckedChanged="ChkMostarProductosRNCDesBonificacion_CheckedChanged" />
</div>
<div class="row">
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom">
<div id="DivRNCBonDescTotal" runat="server" visible="false" class="row">
<div class="col-md-12" style="max-height: 440px; overflow: auto">
<asp:GridView ID="GvDescNCBonificaciones" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveVenta,CveVentaRNCCargo" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
@@ -7359,19 +7361,37 @@
</asp:GridView>
</div>
</div>
<%-- <div class="row">
<div class="col-md-12">
<table border="0" rules="none" class="well TextTab" style="float: right;" runat="server">
<tr align="right">
<td style="border: 1px none white"><b>Saldo Maximo Utilizable.:</b></td>
<td>
<asp:Label ID="LblSaldoMaximoBonificacion" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00"></asp:Label></td>
<td align="right">&nbsp;
</td>
</tr>
</table>
<div class="row" id="DivRNCBonDescDetalle" runat="server" visible="false">
<div class="col-md-12" style="max-height: 440px; overflow: auto">
<asp:GridView ID="GvDescNCBonDetalle" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveVenta,CveVentaDetalleRNC,CvePS,PU,PorcentajeIVA" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="ChkAplicar" runat="server" />
<asp:HiddenField ID="HdnPorcentajeIVA" ClientIDMode="Static" runat="server" Value='<%# Eval("PorcentajeIVA").ToString %>' />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cantidad">
<ItemTemplate>
<asp:TextBox ID="TxtCantidadRNC" runat="server" Text='<%#Eval("CantidadPendiente").ToString%>' MaxLength="12" Width="46px" Height="24px"></asp:TextBox>
<asp:RangeValidator ID="RVCantRNC" runat="server" Type="Double" MinimumValue="0" MaximumValue='<%#Eval("CantidadPendiente").ToString%>' ErrorMessage="Cantidad Excedida" ControlToValidate="TxtCantidadRNC" Display="None" ValidationGroup="VGAplicarRNC"></asp:RangeValidator>
<ajax:ValidatorCalloutExtender ID="VCECantidad3" runat="server" HighlightCssClass="vco" TargetControlID="RVCantRNC" Width="300px"></ajax:ValidatorCalloutExtender>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Producto" DataField="CodigoPS" ItemStyle-HorizontalAlign="Left" />
<asp:HyperLinkField DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="Folio" HeaderText="Folio" ItemStyle-Width="150px" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:HiddenField ID="HdnPU" ClientIDMode="Static" runat="server" Value='<%# Eval("PU").ToString %>' />
<asp:Literal ID="TtlTotal" runat="server" Text='<%# Eval("Total", "{0:N2}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>--%>
</div>
</div>
</div>
</div>
@@ -7566,6 +7586,17 @@
</asp:DropDownList>
<label for="<%= DdlTipoAutorizacion.ClientID.ToString()%>">Tipo Autorización:</label>
</div>
<div id="DivDiasVencidos" runat="server" visible="false" class="row">
<label class="col-md-2 truncate">Días Vencidos:</label>
<div class="col-md-10">
<asp:TextBox ID="TxtDiasVencidos" Text="" runat="server" />
<ajax:FilteredTextBoxExtender ID="FTBDiasVencidos" runat="server" TargetControlID="TxtDiasVencidos" FilterType="Custom, Numbers" />
<asp:RequiredFieldValidator ID="RFVDiasVencidos" runat="server" ControlToValidate="TxtDiasVencidos" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Días Vencidos''</b> es necesario, por favor ingréselo." ValidationGroup="VgmGuardarAut"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDiasVencidos" runat="server" HighlightCssClass="vco" TargetControlID="RFVDiasVencidos" Width="350px"></ajax:ValidatorCalloutExtender>
<asp:RequiredFieldValidator ID="RFVDiasVencidos2" runat="server" ControlToValidate="TxtDiasVencidos" Display="None" InitialValue="0" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El valor del campo <b>''Días Vencidos''</b> debe ser mayor a 0." ValidationGroup="VgmGuardarAut"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDiasVencidos2" runat="server" HighlightCssClass="vco" TargetControlID="RFVDiasVencidos2" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div id="DivImporteSolicitud" runat="server" class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtImporteSolicitud" inputmode="numeric" runat="server" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="VgmGuardarAut" Width="200px" CssClass="form-control "></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTBImporteSolicitud" runat="server" TargetControlID="TxtImporteSolicitud" FilterType="Custom, Numbers" ValidChars="." />
@@ -7737,6 +7768,74 @@
}
}
function CalculaSaldoRNCChkDetalleBonificacion(TxtCantidad, CantidadPendiente, ImporteTotal, Chk) {
//ImportesRNCCargo
let Importe = 0;
if (Chk.checked) {
let SaldoMaximoUtilizable = 999999999;
let ImportesAsignados = 0;
$('.ImportesRNCDetalleBonificacion').each(function () {
if (Chk.id != $(this).find("td").eq(0).find(":checkbox").attr('id')) {
let seleccionado = $(this).find("td").eq(0).find(":checkbox").is(':checked');
if (seleccionado) {
let cantidad = ToDouble($(this).find("td").eq(1).find(":text").val());
let porcentajeIVA = ToDouble($(this).find("td").eq(0).find(":hidden").val());
let precio = ToDouble($(this).find("td").eq(5).find(":hidden").val());
let totalcalculableImpuestos = (cantidad * precio);
let iva = ToDouble((totalcalculableImpuestos * porcentajeIVA).toFixed(2));
ImportesAsignados += totalcalculableImpuestos + iva;
}
}
});
Importe = SaldoMaximoUtilizable - ImportesAsignados;
if (Importe > 0) {
} else {
if (SaldoMaximoUtilizable > 0) {
Importe = 0;
Chk.checked = false;
} else {
Importe = 0;
}
}
} else {
Importe = 0;
}
Importe = ToDouble(Importe.toFixed(2));
if (Importe > 0) {
let pu = (ImporteTotal / CantidadPendiente);
if (pu > 0) {
const cantidadSugerida = (Importe / pu);
if (cantidadSugerida > CantidadPendiente) {
TxtCantidad.value = CantidadPendiente.toString();
}else {
TxtCantidad.value = cantidadSugerida.toString();
}
}else {
TxtCantidad.value = "0";
}
}else {
TxtCantidad.value = "0";
}
}
function LimitaSaldoRNCChk(TxtImporte, Saldo) {

View File

@@ -160,6 +160,25 @@ Partial Class Ventas
ViewState("TmpDTRNCDetalleSelecciondas") = value
End Set
End Property
Private Property TmpDTRNCBonificacionDetalle As DataTable
Get
Return If(IsNothing(ViewState("TmpDTRNCBonificacionDetalle")), Nothing, CType(ViewState("TmpDTRNCBonificacionDetalle"), DataTable))
End Get
Set(value As DataTable)
ViewState("TmpDTRNCBonificacionDetalle") = value
End Set
End Property
Private Property TmpDTRNCBonificacionDetalleSeleccionadas As DataTable
Get
Return If(IsNothing(ViewState("TmpDTRNCBonificacionDetalleSeleccionadas")), Nothing, CType(ViewState("TmpDTRNCBonificacionDetalleSeleccionadas"), DataTable))
End Get
Set(value As DataTable)
ViewState("TmpDTRNCBonificacionDetalleSeleccionadas") = value
End Set
End Property
Private Property TmpDTError As DataTable
Get
Return If(IsNothing(ViewState("TmpDTError")), Nothing, CType(ViewState("TmpDTError"), DataTable))
@@ -1839,6 +1858,15 @@ Partial Class Ventas
ViewState("TieneDiasVencidos") = value
End Set
End Property
Private Property DiasVencidosCliente As Integer
Get
Return IfNull(ViewState("DiasVencidosCliente"), "0", ViewState("DiasVencidosCliente")).ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("DiasVencidosCliente") = value
End Set
End Property
Private Property VentaSaldoAlmacen As Decimal
Get
Return ViewState("VentaSaldoAlmacen").ToString().ToDecimal
@@ -1923,6 +1951,14 @@ Partial Class Ventas
ViewState("AplicaRNCXDetalle") = value
End Set
End Property
Private Property AplicaRNCBonificacionXDetalle As Boolean
Get
Return CBool(IfNull(ViewState("AplicaRNCBonificacionXDetalle"), "False", ViewState("AplicaRNCBonificacionXDetalle")))
End Get
Set(value As Boolean)
ViewState("AplicaRNCBonificacionXDetalle") = value
End Set
End Property
Private Property AplicaRelacionManual As Boolean
Get
Return CBool(IfNull(ViewState("AplicaRelacionManual"), "False", ViewState("AplicaRelacionManual")))
@@ -5518,6 +5554,7 @@ Partial Class Ventas
ClienteEsDistribuidor = Boolean.Parse(ObjCliente.DtResultados.Rows(0)("EsDistribuidor").ToString())
TieneDiasVencidos = Boolean.Parse(ObjCliente.DtResultados.Rows(0)("TieneDiasVencidos").ToString())
DiasVencidosCliente = ObjCliente.DtResultados.Rows(0)("DiasVencidosCliente").ToString().ToEntero()
If EstatusCliente = False And Not DdlTipoComprobante.SelectedValue.Contiene("Cot", "DPe") And (CveVenta <= 0 Or EsCreaApartirDe) Then
Alert("El Cliente seleccionado no esta activo", TipoMensaje.MsgAdvertencia)
@@ -5926,7 +5963,7 @@ Partial Class Ventas
DivVentasUsados.Visible = True
Dim ObjClientes As New ClsClientes
If ObjClientes.GetHistorialVentas(CveCliente, CveClienteSucursal:=-1, TipoDocto:="Ing", CveEstatusFactura:=-1, FechaI:=Now.AddMonths(-1)) Then
If ObjClientes.GetHistorialVentas(CveCliente, CveClienteSucursal:=-1, TipoDocto:="Ing", CveEstatusFactura:=-1) Then
DdlVentaUsado.DataSource = ObjClientes.DtResultados.FiltraParametros("UsadoMarcado = 0")
End If
ObjClientes.Dispose()
@@ -7809,6 +7846,7 @@ Partial Class Ventas
Dim TipoDocumentoAutorizacion As String = ""
Dim ImporteAutorizacion As Decimal = 0
Dim TipoAutorizacion As Integer = 0
Dim DiasVencidosAutorizacion As Integer = 0
Dim CveVendedor As Integer = DdlVendedor.SelectedValue.ToEntero()
Dim ObjVentas As New ClsVentas
Try
@@ -7826,6 +7864,7 @@ Partial Class Ventas
ImporteAutorizacion = RowAutorizacion("Importe").ToString().ToDecimal()
CveAutorizacion = RowAutorizacion("CveAutorizacion").ToString().ToEntero()
TipoAutorizacion = RowAutorizacion("TipoAutorizacion").ToString().ToEntero()
DiasVencidosAutorizacion = RowAutorizacion("DiasVencidos").ToString().ToEntero()
End If
End If
@@ -7849,6 +7888,14 @@ Partial Class Ventas
End If
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
@@ -16601,7 +16648,7 @@ Partial Class Ventas
Private Function CalcularDescuentos(CvePS As Integer, Cantidad As Decimal, PU As Decimal) As Descuentos
Dim Descuento As Decimal = HdnDescuento.Value.ToDecimal
If UsuarioActual.Empresa.Funcionalidad(572) = "1" AndAlso Not TbDescuentosRNC.Visible Then
If UsuarioActual.Empresa.Funcionalidad(572) = "1" AndAlso UsuarioActual.TienePermisoProceso(328) AndAlso Not TbDescuentosRNC.Visible Then
TbDescuentosRNC.Visible = True
End If
@@ -18058,10 +18105,10 @@ Partial Class Ventas
TotalSubTotalRef = TotalSubTotal - TotalDescuentos
End If
If TotalAmortizacion > 0 AndAlso TotalSubTotalRef = TotalAmortizacion Then ' si se amortizó completa la factura, debe de limpiar los impuestos
If TotalAmortizacion > 0 AndAlso TotalSubTotalRef = TotalAmortizacion Then ' si se amortizó completa la factura, debe de limpiar los impuestos PorcentajeRetIVA
If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("3") Then
For Each dr As DataRow In TmpDT.Rows
dr("ImporteIVA") = 0 : dr("ImporteIEPS") = 0 : dr("ImporteRetIVA") = 0 : dr("ImporteRetISR") = 0 : dr("PorcentajeIVA") = 0 : dr("IVA") = 0
dr("ImporteIVA") = 0 : dr("ImporteIEPS") = 0 : dr("PorcentajeIEPS") = 0 : dr("ImporteRetIVA") = 0 : dr("PorcentajeRetIVA") = 0 : dr("ImporteRetISR") = 0 : dr("PorcentajeIVA") = 0 : dr("IVA") = 0
Next
If TmpDTImpuestos IsNot Nothing Then
@@ -24983,8 +25030,12 @@ Partial Class Ventas
End Sub
Private Sub CargaCxC()
Dim CveClienteSucursal As Integer = -1
If DdlSucursalCliente.SelectedValue.ToEntero() > 0 Then
CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero()
End If
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString().ToEntero(), "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, DdlSucursalCliente.SelectedValue.ToEntero()) Then
If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString().ToEntero(), "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, CveClienteSucursal:=CveClienteSucursal) Then
Dim DtTemporal As DataTable = ObjMovtos.DtResultados.FiltraParametros("TipoDocto NOT IN ('RNC','Rem') AND Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento")
GvCxC.DataSource = DtTemporal
End If
@@ -25036,7 +25087,16 @@ Partial Class Ventas
Case "2" 'BONIFICACIONES
DivRNCCargoDesc.Visible = False
DivRNCBonDesc.Visible = True
CargaRNCDesc(True, False)
If ChkMostarProductosRNCDesBonificacion.Checked Then
DivRNCBonDescTotal.Visible = False
DivRNCBonDescDetalle.Visible = True
CargaRNCDetalleDescBonificacion()
Else
DivRNCBonDescTotal.Visible = True
DivRNCBonDescDetalle.Visible = False
CargaRNCDesc(True, False)
End If
Case "3" 'AJUSTE/GARANTIAS
LtlCargoDesc.Text = "AJUSTES/GARANTIAS"
DivRNCCargoDesc.Visible = True
@@ -25073,6 +25133,13 @@ Partial Class Ventas
UpModalRemisionesNC.Update()
End Sub
Protected Sub ChkMostarProductosRNCDesBonificacion_CheckedChanged(sender As Object, e As EventArgs)
RblRNCTipoDesc_SelectedIndexChanged(RblRNCTipo, EventArgs.Empty)
UpModalRemisionesNC.Update()
End Sub
Private Sub CargaRNC(Optional CveVentaUsado As Integer = -1, Optional CargarBonificaciones As Boolean = False, Optional CargarSoloGarantias As Boolean = False)
Dim DtNC As DataTable = Nothing
@@ -25273,6 +25340,37 @@ Partial Class Ventas
UpDescNC.Update()
End Sub
Private Sub CargaRNCDetalleDescBonificacion()
Dim DtNC As DataTable = Nothing
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetRemisionesNCCliente(CveCliente, True, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
Me.TmpDTRNCBonificacionDetalle = ObjMovtos.DtResultados.Copy()
End If
ObjMovtos.Dispose()
Me.TmpDTRNCBonificacionDetalle.Columns.Add(New DataColumn("CveVentaDetalleNCGenerada", GetType(Integer)))
Me.TmpDTRNCBonificacionDetalleSeleccionadas = Nothing
Me.TmpDTRNCBonificacionDetalleSeleccionadas = TmpDTRNCBonificacionDetalle.Clone()
Me.TmpDTRNCBonificacionDetalleSeleccionadas.Clear()
GvDescNCBonDetalle.DataSource = TmpDTRNCBonificacionDetalle.FiltraParametros("TipoRNC = 2")
GvDescNCBonDetalle.DataBind()
'Dim SaldoMaximoUsados As Decimal = Me.TmpDT.SUM("Total", "EsCargo = True").ToDecimal() + Me.TmpDT.SUM("ImporteIVA", "EsCargo = True").ToDecimal()
'If SaldoMaximoUsados > 0 Then
' HdnSaldoMaximoUsados.Value = SaldoMaximoUsados.ToString()
' LblSaldoMaximoUsados.Text = String.Format("{0:N2}", SaldoMaximoUsados)
'Else
' HdnSaldoMaximoUsados.Value = "0"
' LblSaldoMaximoUsados.Text = "0"
'End If
UpDescNC.Update()
End Sub
Private Sub CargaBonificaciones(CveVentaRNCCargo As Integer, AplicarRNC As Boolean)
If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
@@ -25391,110 +25489,99 @@ Partial Class Ventas
Private Sub CargaBonificacionesDesc(CvesVentaRNCCargo As String, AplicarRNC As Boolean)
If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
If ChkMostarProductosRNCDesBonificacion.Checked Then
DivRNCBonDescTotal.Visible = False
DivRNCBonDescDetalle.Visible = True
CargaRNCDetalleDescBonificacion()
Else
TmpDTRNCBonificacionesSeleccionadas.Clear()
End If
DivRNCBonDescTotal.Visible = True
DivRNCBonDescDetalle.Visible = False
Dim ListaVentasRNCCargos As String() = {}
If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
Else
TmpDTRNCBonificacionesSeleccionadas.Clear()
End If
If CvesVentaRNCCargo <> "-1" OrElse Not String.IsNullOrEmpty(CvesVentaRNCCargo) Then
ListaVentasRNCCargos = CvesVentaRNCCargo.Split(","c)
End If
Dim ListaVentasRNCCargos As String() = {}
Dim ListaBon As New List(Of VentasBonificaciones)
Dim DtBon As DataTable = Nothing
Dim SbFiltro As New StringBuilder()
SbFiltro.Append("CveVenta IN(")
If CvesVentaRNCCargo <> "-1" OrElse Not String.IsNullOrEmpty(CvesVentaRNCCargo) Then
ListaVentasRNCCargos = CvesVentaRNCCargo.Split(","c)
End If
Using ObjAcum As New ClsAcumuladores
For Each CveVentaRNC As String In ListaVentasRNCCargos
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNC.ToEntero()) Then
Dim DtDist = ObjAcum.DtResultados.Copy()
Dim ListaBon As New List(Of VentasBonificaciones)
Dim DtBon As DataTable = Nothing
Dim SbFiltro As New StringBuilder()
SbFiltro.Append("CveVenta IN(")
If DtBon Is Nothing Then
DtBon = DtDist.Clone()
Using ObjAcum As New ClsAcumuladores
For Each CveVentaRNC As String In ListaVentasRNCCargos
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNC.ToEntero()) Then
Dim DtDist = ObjAcum.DtResultados.Copy()
If DtBon Is Nothing Then
DtBon = DtDist.Clone()
End If
DtBon.Merge(DtDist)
End If
Next
End Using
DtBon.Merge(DtDist)
End If
Next
End Using
If DtBon IsNot Nothing Then
Dim queryBonificacion = From dr In DtBon
Group By CveVentaBonificacion = dr("CveVentaBonificacion").ToString().ToEntero, CveVentaRNCCargo = dr("CveVentaRNCCargo").ToString().ToEntero
Into x = Group
Select New With {
.CveVentaRNCCargo = CveVentaRNCCargo,
.CveVentaBonificacion = CveVentaBonificacion,
.ImporteBonificacion = x.Sum(Function(s) s("ImporteBonificacion").ToString().ToDecimal),
.IVABonificacion = x.Sum(Function(s) s("IVABonificacion").ToString().ToDecimal)
}
If DtBon IsNot Nothing Then
Dim queryBonificacion = From dr In DtBon
Group By CveVentaBonificacion = dr("CveVentaBonificacion").ToString().ToEntero, CveVentaRNCCargo = dr("CveVentaRNCCargo").ToString().ToEntero
Into x = Group
Select New With {
.CveVentaRNCCargo = CveVentaRNCCargo,
.CveVentaBonificacion = CveVentaBonificacion,
.ImporteBonificacion = x.Sum(Function(s) s("ImporteBonificacion").ToString().ToDecimal),
.IVABonificacion = x.Sum(Function(s) s("IVABonificacion").ToString().ToDecimal)
}
For Each bon In queryBonificacion
SbFiltro.AppendFormat("'{0}',", bon.CveVentaBonificacion)
ListaBon.Add(New VentasBonificaciones() With {.CveVentaRNCCargo = bon.CveVentaRNCCargo, .CveVentaBonificacion = bon.CveVentaBonificacion, .ImporteBonificacion = bon.ImporteBonificacion, .IVABonificacion = bon.IVABonificacion})
Next
For Each bon In queryBonificacion
SbFiltro.AppendFormat("'{0}',", bon.CveVentaBonificacion)
ListaBon.Add(New VentasBonificaciones() With {.CveVentaRNCCargo = bon.CveVentaRNCCargo, .CveVentaBonificacion = bon.CveVentaBonificacion, .ImporteBonificacion = bon.ImporteBonificacion, .IVABonificacion = bon.IVABonificacion})
Next
SbFiltro.Remove(SbFiltro.Length - 1, 1)
SbFiltro.Append(")")
End If
SbFiltro.Remove(SbFiltro.Length - 1, 1)
SbFiltro.Append(")")
End If
If ListaBon.Count > 0 Then
Dim Bonificaciones = Me.TmpDTRNCBonificacionesCliente.Select(SbFiltro.ToString())
If ListaBon.Count > 0 Then
Dim Bonificaciones = Me.TmpDTRNCBonificacionesCliente.Select(SbFiltro.ToString())
For Each RowBonificacion As DataRow In Bonificaciones
Dim RNCBonificacion = ListaBon.Where(Function(x) x.CveVentaBonificacion = RowBonificacion("CveVenta").ToString().ToEntero())
For Each RowBonificacion As DataRow In Bonificaciones
Dim RNCBonificacion = ListaBon.Where(Function(x) x.CveVentaBonificacion = RowBonificacion("CveVenta").ToString().ToEntero())
RowBonificacion("ImporteBonificacion") = RNCBonificacion.Sum(Function(x) x.ImporteBonificacion)
RowBonificacion("IVABonificacion") = RNCBonificacion.Sum(Function(x) x.IVABonificacion)
RowBonificacion("CveVentaRNCCargo") = RNCBonificacion(0).CveVentaRNCCargo
RowBonificacion("ImporteBonificacion") = RNCBonificacion.Sum(Function(x) x.ImporteBonificacion)
RowBonificacion("IVABonificacion") = RNCBonificacion.Sum(Function(x) x.IVABonificacion)
RowBonificacion("CveVentaRNCCargo") = RNCBonificacion(0).CveVentaRNCCargo
If AplicarRNC Then
TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray)
Else
For Each RowEliminar In Me.TmpDTRNCBonificacionesSeleccionadas.Select(SbFiltro.ToString())
RowEliminar.Delete()
Next
End If
Next
If AplicarRNC Then
TmpDTRNCBonificacionesSeleccionadas.Rows.Add(RowBonificacion.ItemArray)
Else
For Each RowEliminar In Me.TmpDTRNCBonificacionesSeleccionadas.Select(SbFiltro.ToString())
RowEliminar.Delete()
Next
End If
Next
End If
'VERIFICA SI TIENE BONIFICACIONES PARA AGREGARLAS
If TmpDTRNCBonificacionesSeleccionadas IsNot Nothing AndAlso TmpDTRNCBonificacionesSeleccionadas.Rows.Count > 0 Then
DivRNCBonDesc.Visible = True
Else
DivRNCBonDesc.Visible = False
End If
GvDescNCBonificaciones.DataSource = TmpDTRNCBonificacionesSeleccionadas
GvDescNCBonificaciones.DataBind()
End If
'VERIFICA SI TIENE BONIFICACIONES PARA AGREGARLAS
If TmpDTRNCBonificacionesSeleccionadas IsNot Nothing AndAlso TmpDTRNCBonificacionesSeleccionadas.Rows.Count > 0 Then
DivRNCBonDesc.Visible = True
Else
DivRNCBonDesc.Visible = False
End If
GvDescNCBonificaciones.DataSource = TmpDTRNCBonificacionesSeleccionadas
GvDescNCBonificaciones.DataBind()
'SI ES CREDITO
'If RBLPago.SelectedValue = "1" Then
' Dim ImporteUsados As Decimal = Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal()
' HdnSMUBonDesc.Value = ImporteUsados.ToString()
' LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", ImporteUsados)
' 'SI ES CONTADO
'ElseIf RBLPago.SelectedValue = "2" Then
' Dim ImporteUsados As Decimal = 0
' For Each Row As DataRow In Me.TmpDT.FiltraParametros("EsCargo = True").Rows
' Dim PUBonificacion As Decimal = GlobalDTAcumTamaños().FiltroPrimeroValor("Bonificacion", $"CvePSCargo={Row("CvePS")}").ToDecimal()
' Dim TotalBonificacion As Decimal = (Row("Cantidad").ToString().ToDecimal() * PUBonificacion)
' Dim IVABonificacion As Decimal = (TotalBonificacion * Row("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2)
' ImporteUsados += TotalBonificacion + IVABonificacion
' Next
' HdnSMUBonDesc.Value = ImporteUsados.ToString()
' LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", ImporteUsados)
'End If
UpDescNC.Update()
End Sub
@@ -25520,6 +25607,22 @@ Partial Class Ventas
End If
End If
End Sub
Protected Sub GvDescNCBonDetalle_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCBonDetalle.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CveVentaDetalleRNC").ToEntero() = 0 Then
e.Row.CssClass = "Totales"
e.Row.FCCheckBox("ChkAplicar").Visible = False
e.Row.FCTextBox("TxtCantidadRNC").Visible = False
Else
e.Row.CssClass = "ImportesRNCDetalle"
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCChkDetalleBonificacion({e.Row.FCTextBox("TxtCantidadRNC").ClientID},{e.Row.DBCampo("CantidadPendiente").ToDouble},{e.Row.DBCampo("Total").ToDouble}, this);")
'e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
End If
End If
End Sub
Protected Sub GvRNCDevoluciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRNCDevoluciones.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCBonChkDesc({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
@@ -25848,13 +25951,21 @@ Partial Class Ventas
NCBonificacion = ArrayNC(4).ToEntero()
End If
Dim DrBonRef As DataRow = Nothing
'EN LA NC DE BONIFICACION EL CONCEPTO DEBE SER SIEMPRE 'BONIFICACION POR USADO'
Dim DrPSBonificacion = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCBonificacion).FiltroPrimero("")
If DrPSBonificacion IsNot Nothing Then
CrearDTNCBonificacionDesc(DtImpuestosBonificacion, TmpDTDescNC, DrPSBonificacion, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
DrBonRef = DrPSBonificacion
Else
DrBonRef = DrPS
Alert("No se encontró el concepto de BONIFICACION POR USADO", TipoMensaje.MsgAdvertencia)
CrearDTNCBonificacionDesc(DtImpuestosBonificacion, TmpDTDescNC, DrPS, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
End If
If AplicaRNCBonificacionXDetalle Then
CrearDTNCBonificacionDescDetalle(ListaNCBonificacion, TmpDTDescNC, DrBonRef, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
Else
CrearDTNCBonificacionDesc(DtImpuestosBonificacion, TmpDTDescNC, DrBonRef, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
End If
Else
@@ -26313,6 +26424,93 @@ Partial Class Ventas
Next
End If
End Sub
Private Sub CrearDTNCBonificacionDescDetalle(ListaNC As List(Of Modelos.Factura), ByRef TmpDTCargo As DataTable, DrPS As DataRow, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
TmpDTDescNCBonificacion = TmpDTCargo.Clone()
TmpDTDescNCBonificacion.Clear()
For Each RNC In ListaNC
Dim UltimoRenglonRNC As Integer = 1
Dim TotalAcumuladoRNC As Decimal = 0
Dim Terminar As Boolean = False
For Each RowUsado As DataRow In Me.TmpDTRNCBonificacionDetalleSeleccionadas.FiltraParametros($"CveVenta={RNC.CveVenta}", Orderby:="PU").Rows
Dim Cantidad As Decimal = RowUsado("Cantidad").ToString().ToDecimal()
Dim CvePSCargo As Integer = RowUsado("CvePS").ToString().ToEntero()
Dim Obs = ""
'SI ES ACUMULADOR LAS OBSERVACIOENS DEBEN SER EL NOMBRE DEL ACUMULADOR
If GlobalDTAcumTamaños().FiltroPrimero($"CvePSCargo = {CvePSCargo}") IsNot Nothing Then
Obs = RowUsado("CodigoPS").ToString()
'Else
' Obs = RowUsado("Obs").ToString()
End If
If Not String.IsNullOrEmpty(TxtNCObservaciones.Text.Trim()) Then
Obs = String.Format("{0} - {1}", Obs, TxtNCObservaciones.Text.Trim())
End If
Dim ImportePU = RowUsado("PU").ToString().ToDecimal
Dim TotalCalculableImpuestos As Decimal = (Cantidad * ImportePU)
Dim ImporteIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
Dim ImporteIEPS = 0 '(TotalCalculableImpuestos * RowUsado("PorcentajeIEPS").ToString().ToDecimal).RoundSQL(2)
Dim ImporteRetIVA = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetIVA").ToString().ToDecimal).RoundSQL(2)
Dim ImporteRetISR = 0 ' (TotalCalculableImpuestos * RowUsado("PorcentajeRetISR").ToString().ToDecimal).RoundSQL(2)
Dim ImporteTotal = TotalCalculableImpuestos
TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA)
'SI EL IMPORTE ES MAYOR REALIZA EL AJUSTE
If TotalAcumuladoRNC > RNC.TotalRemNCAplicado Then
Terminar = True
'RESTA LO SUMANDO DEL ACUMULADO
TotalAcumuladoRNC -= (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
Dim Diferencia As Decimal = RNC.TotalRemNCAplicado - TotalAcumuladoRNC
Dim TotalPartida As Decimal = (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
Dim PorcentajePorAplicar As Decimal = (Diferencia / TotalPartida)
Cantidad = Cantidad * PorcentajePorAplicar
TotalCalculableImpuestos = (Cantidad * ImportePU)
ImporteIVA = (TotalCalculableImpuestos * RowUsado("PorcentajeIVA").ToString().ToDecimal).RoundSQL(2)
ImporteTotal = TotalCalculableImpuestos
TotalAcumuladoRNC += (TotalCalculableImpuestos + ImporteIVA + ImporteIEPS - ImporteRetIVA - ImporteRetISR)
End If
'SI ES EL ULTIMO REGLON REALIZA UN AJUSTE
If UltimoRenglonRNC = Me.TmpDTRNCBonificacionDetalleSeleccionadas.FiltraParametros($"CveVenta={RNC.CveVenta}").Rows.Count OrElse Terminar Then
Dim Ajuste As Decimal = 0
If Math.Abs(RNC.TotalRemNCAplicado - TotalAcumuladoRNC) > 0.00 Then
Ajuste = RNC.TotalRemNCAplicado - TotalAcumuladoRNC
ImporteIVA += Ajuste
End If
End If
UltimoRenglonRNC += 1
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
Obs, Cantidad, ImportePU, RowUsado("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, 0, ImporteRetIVA,
0, ImporteRetISR, 0, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=RowUsado("CveVentaDetalleRNC").ToString().ToEntero())
If Terminar Then
Exit For
End If
Next
Next
End Sub
Private Sub CrearDTNCDevolucion(ListaNC As List(Of Modelos.Factura), ByRef TmpDTCargo As DataTable, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String)
For Each RNC In ListaNC
@@ -29811,6 +30009,7 @@ Partial Class Ventas
#Region "D E S C U E N T O S X R E M I S I O N D E N O T A D E C R E D I T O"
Protected Sub BtnAplicarRemisionNC_Click(sender As Object, e As EventArgs)
Me.AplicaRNCXDetalle = False
Me.AplicaRNCBonificacionXDetalle = False
If ListaRemisionesNC Is Nothing Then
ListaRemisionesNC = New List(Of Modelos.Factura)
@@ -30009,6 +30208,7 @@ Partial Class Ventas
Protected Sub BtnAplicarDesc_Click(sender As Object, e As EventArgs)
Try
Me.AplicaRNCXDetalle = False
Me.AplicaRNCBonificacionXDetalle = False
Dim DrPS As DataRow = Nothing
Dim ArrayNC As String() = UsuarioActual.Empresa.Funcionalidad(591).Split(",".ToCharArray())
@@ -30197,34 +30397,98 @@ Partial Class Ventas
Exit Sub
End If
For Each GvRow As GridViewRow In GvDescNCBonificaciones.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVentaRNCCargo").ToEntero()
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
'BONIFICACIONES
If ChkMostarProductosRNCDesBonificacion.Checked Then
If RemNC.TotalRemNCAplicado <= 0 Then
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
ListaNCBonificacion.Clear()
Exit Sub
TmpDTRNCBonificacionDetalleSeleccionadas.Clear()
Me.AplicaRNCBonificacionXDetalle = True
For Each GvRow As GridViewRow In GvDescNCBonDetalle.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim Rows = TmpDTRNCBonificacionDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}")
For Each row In Rows
row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal()
Dim TotalCalculableImpuestos As Decimal = row("Cantidad").ToString().ToDecimal() * row("PU").ToString().ToDecimal()
Dim IVA As Decimal = (TotalCalculableImpuestos * row("PorcentajeIVA").ToString().ToDecimal()).RoundSQL()
row("IVA") = IVA
row("Total") = (TotalCalculableImpuestos + IVA).RoundSQL
TmpDTRNCBonificacionDetalleSeleccionadas.Rows.Add(row.ItemArray)
Next
End If
ListaNCBonificacion.Add(RemNC)
End If
End If
Next
Next
'Dim LimiteBonficaciones As Decimal = LblSaldoMaximoBonificacion.Text.Trim().ToDecimal()
Dim TerminarCiclo As Boolean = False
''VERIFICA EL LIMITE DE LOS USADOS
'If ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado) > LimiteBonficaciones Then
' Alert($"La suma de las remisiones de nota de crédito de tipo 'Bonificación' no debe superar el limite.<br/>Total RNC: {ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado):N2}.<br/>Total Usados: {LimiteUsados:N2}", TipoMensaje.MsgAdvertencia)
' ListaNCDesc.Clear()
' ListaNCBonificacion.Clear()
' Exit Sub
'End If
For Each Dr As DataRow In TmpDTRNCBonificacionDetalleSeleccionadas.FiltraParametros("", DistinctColumns:={"CveVenta"}).Rows
Dim RemNC As New Modelos.Factura(UsuarioActual, Dr("CveVenta").ToString().ToEntero(), UsuarioActual.CveEmpresa)
Dim TotalRNC As Decimal = 0
For Each GvRow As GridViewRow In GvDescNCBonDetalle.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked AndAlso GvRow.DataKey("CveVenta").ToEntero() = Dr("CveVenta").ToString().ToEntero() Then
Dim Cantidad As Decimal = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal()
Dim PU = GvRow.DataKey("PU").ToDecimal()
Dim PorcentajeIVA As Decimal = GvRow.DataKey("PorcentajeIVA").ToDecimal()
Dim TotalCalculableImpuestos As Decimal = (Cantidad * PU)
Dim ImporteIVA As Decimal = (TotalCalculableImpuestos * PorcentajeIVA).RoundSQL(2)
Dim TotalRNCDetalle As Decimal = (TotalCalculableImpuestos + ImporteIVA)
TotalRNC += TotalRNCDetalle
If RemNC.CveVentaRNCCargo <= 0 Then
RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVenta").ToEntero()
End If
End If
End If
Next
RemNC.TotalRemNCAplicado = TotalRNC
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
If RemNC.TotalRemNCAplicado <= 0 Then
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
ListaNCBonificacion.Clear()
Exit Sub
End If
ListaNCBonificacion.Add(RemNC)
If TerminarCiclo Then
Exit For
End If
Next
Else
For Each GvRow As GridViewRow In GvDescNCBonificaciones.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
RemNC.CveVentaRNCCargo = GvRow.DataKey("CveVentaRNCCargo").ToEntero()
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
If RemNC.TotalRemNCAplicado <= 0 Then
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
ListaNCBonificacion.Clear()
Exit Sub
End If
ListaNCBonificacion.Add(RemNC)
End If
End If
Next
End If
ElseIf RblRNCTipoDesc.SelectedValue.Contiene("2") Then
@@ -31094,6 +31358,9 @@ Partial Class Ventas
DtVentasNC.Rows.Add(Drt)
DtVentasNC.AcceptChanges()
ObjFacturaProntoPago.DtVentasRelacionadas = New DataTable
ObjFacturaProntoPago.DtVentasRelacionadas.Columns.Add("CveVenta", GetType(Integer))
ObjFacturaProntoPago.DtVentasNC = DtVentasNC
Resp = ObjFacturaProntoPago.EmitirFactura(False, Transac:=SqlTransaccion, ObjContPaqTransac:=ObjConta)
@@ -31589,8 +31856,17 @@ Partial Class Ventas
UpModalSolicitud.Update()
End Sub
Protected Sub BtnSolicitarCredito_Click(sender As Object, e As EventArgs) Handles BtnSolicitarCredito.Click
Dim DiasVencidos As Integer = 0
Dim CveEstatus As Integer = 0
Dim TipoDocto As String = DdlTipoDocto.SelectedValue
Dim CveTipoAutorizacion As Integer = DdlTipoAutorizacion.SelectedValue.ToEntero()
If CveTipoAutorizacion = 2 Then
DiasVencidos = TxtDiasVencidos.Text.ToEntero()
End If
Dim ObjPS As New ClsVentas
If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtImporteSolicitud.Text.ToDecimal(), 0, UsuarioActual.CveUsuario, DdlTipoAutorizacion.SelectedValue.ToEntero(), TipoDocumento:=DdlTipoDocto.SelectedValue) Then
If ObjPS.AddAutorizacionLimite(UsuarioActual.CveEmpresa, CveCliente, DdlVendedor.SelectedValue.ToEntero(), TxtImporteSolicitud.Text.ToDecimal(), CveEstatus, UsuarioActual.CveUsuario, CveTipoAutorizacion, TipoDocumento:=DdlTipoDocto.SelectedValue, DiasVencidos:=DiasVencidos) Then
RegistraScript("$('#DivModalSolicitarCredito').modal('hide')")
Alert("La autorización se agregó correctamente.", TipoMensaje.MsgInformacion)
End If
@@ -31599,6 +31875,7 @@ Partial Class Ventas
End Sub
Protected Sub DdlTipoAutorizacion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAutorizacion.SelectedIndexChanged
DivImporteSolicitud.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 1
DivDiasVencidos.Visible = DdlTipoAutorizacion.SelectedValue.ToEntero() = 2
UpModalSolicitud.Update()
End Sub
'Protected Sub DdlTipoDocto_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoDocto.SelectedIndexChanged

View File

@@ -276,6 +276,8 @@