This commit is contained in:
Hector
2021-07-27 18:39:31 -07:00
22 changed files with 868 additions and 370 deletions

View File

@@ -5852,6 +5852,71 @@ Public Class ClsContabilidad
Return Retorno
End Function
#Region "Globales"
Public Function GetCuentasGlobales(CveEmpresa As Integer) As Boolean
Dim Retorno = False
DataAdapter("PA_Conta_CuentasGlobalesGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
Me.OnError("Ocurrió un error al obtener el catálogo de cuentas globales", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function AddCuentasGlobales(CveConceptoContable As Integer, CveCuenta As Integer, TipoGlobal As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno = False
DataAdapter("PA_Conta_CuentasGlobalesAdd")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable
.Add("@CveCuenta", SqlDbType.Int).Value = CveCuenta
.Add("@TipoGlobal", SqlDbType.Int).Value = TipoGlobal
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
Me.OnError("Ocurrió un error al eliminar el catálogo de cuentas asignación", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function RemoveCuentasGlobales(CveConceptoContable As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno = False
DataAdapter("PA_Conta_CuentasGlobalesDelete")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveConceptoContable", SqlDbType.Int).Value = CveConceptoContable
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
Me.OnError("Ocurrió un error al eliminar el catálogo de globales", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
#End Region
Public Function GetContaEjercicio(CveEmpresa As Integer) As Boolean
Dim Retorno = False

View File

@@ -1084,12 +1084,14 @@ Public Class ClsContratos
End Function
Public Function GetContratosDetalle(CveContrato As Integer) As Boolean
Public Function GetContratosDetalle(CveContrato As Integer, CveEmpresa As Integer, Optional Grupo As Integer = 1) As Boolean
Dim Retorno = False
DataAdapter("PA_Con_ContratosDetalleGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveContrato", SqlDbType.Int).Value = CveContrato
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
.Add("@Grupo", SqlDbType.Int).Value = Grupo
End With
Try

View File

@@ -1961,7 +1961,7 @@ Public Class E141 : Implements IHttpHandler
End If
End If
Threading.Thread.Sleep(3000)
Threading.Thread.Sleep(1000)
End While
End If
@@ -2219,8 +2219,7 @@ Public Class E141 : Implements IHttpHandler
CountPeticionesExitosas += 1
End If
End If
Threading.Thread.Sleep(3000)
Threading.Thread.Sleep(1000)
End While
End If
End If

View File

@@ -4281,10 +4281,12 @@ Partial Class Compras_Compras
Next
If ErrorValidacion Then Exit Sub
Dim dtPSInvalidos As String = ValidarPSContrato(TmpDT.FiltraParametros("", "", {"CveSubProyecto", "CvePS", "Cantidad", "PU"}))
If dtPSInvalidos <> "" Then
Alert(dtPSInvalidos, TipoMensaje.MsgAdvertencia)
Exit Sub
If UsuarioActual.Empresa.Funcionalidad(545) = "1" Then
Dim dtPSInvalidos As String = ValidarPSContrato(TmpDT.FiltraParametros("", "", {"CveSubProyecto", "CvePS", "Cantidad", "PU"}))
If dtPSInvalidos <> "" Then
Alert(dtPSInvalidos, TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
'RECORRO LOS PRODUCTOS O SERVICIOS PARA REGISTRARLOS LOS QUE NO EXISTEN EN EL CATÁLOGO
@@ -18106,25 +18108,31 @@ Partial Class Compras_Compras
End If
ActualizaTotales = True
Dim ObjContratos As New ClsContratos
Dim TieneError As Boolean = False
Dim dttemp As New DataTable ' GlobalDTContratos().FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyecto.SelectedValue.ToString))
dttemp.Columns.Add("CveSubProyecto", GetType(Integer))
dttemp.Columns.Add("CvePS", GetType(Integer))
dttemp.Columns.Add("Cantidad", GetType(Decimal))
dttemp.Columns.Add("PU", GetType(Decimal))
Dim DrPS = dttemp.NewRow
DrPS("CveSubProyecto") = DdlSubProyecto.SelectedValue.ToString.ToEntero
DrPS("CvePS") = DdlPS.SelectedValue.ToString.ToEntero
DrPS("Cantidad") = TxtCantidad.Text.Trim.ToDecimal
DrPS("PU") = TxtPrecio.Text.Trim.ToDecimal
dttemp.Rows.Add(DrPS)
If UsuarioActual.Empresa.Funcionalidad(545) = "1" Then
Dim TieneError As Boolean = False
Dim dttemp As New DataTable '= GlobalDTContratos().FiltraParametros(String.Format("CveSubProyecto = {0}", DdlSubProyecto.SelectedValue.ToString))
dttemp.Columns.Add("CveSubProyecto", GetType(Integer))
dttemp.Columns.Add("CvePS", GetType(Integer))
dttemp.Columns.Add("Cantidad", GetType(Decimal))
dttemp.Columns.Add("PU", GetType(Decimal))
Dim dtPSInvalidos As String = ValidarPSContrato(dttemp)
If dtPSInvalidos <> "" Then
TieneError = True
Dim DrPS = dttemp.NewRow
DrPS("CveSubProyecto") = DdlSubProyecto.SelectedValue.ToString.ToEntero
DrPS("CvePS") = DdlPS.SelectedValue.ToString.ToEntero
DrPS("Cantidad") = TxtCantidad.Text.Trim.ToDecimal
DrPS("PU") = TxtPrecio.Text.Trim.ToDecimal
dttemp.Rows.Add(DrPS)
Dim dtPSInvalidos As String = ValidarPSContrato(dttemp)
If dtPSInvalidos <> "" Then
TieneError = True
Alert(dtPSInvalidos, TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End If
'If dttemp IsNot Nothing AndAlso dttemp.Rows.Count > 0 Then
' Dim drContrato As DataRow = dttemp.Rows(0)
' If ObjContratos.GetContratosDetalle(drContrato("CveContrato").ToString.ToEntero) Then
@@ -18157,75 +18165,52 @@ Partial Class Compras_Compras
' End If
'End If
ObjContratos.Dispose()
If Not TieneError Then
Select Case Modalidad
Case "A" 'ADD
Dim SATClavePS = -1
Dim PSRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
If PSRow IsNot Nothing Then
SATClavePS = PSRow("SATClavePS").ToString.ToEntero
End If
Dim IVA As Double
If chkImportacion.Checked Then
IVA = (txtImportacion.Text.Trim.ToDouble / (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.Trim.ToDouble))
Else
IVA = Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)
End If
AddPS(TxtCantidad.Text.Trim.ToDouble, ddlUM.SelectedValue.ToEntero, ddlUM.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, DdlPS.SelectedValue.ToEntero, DdlPS.SelectedText, HdnTipoPS.Value.ToEntero,
Select Case Modalidad
Case "A" 'ADD
Dim SATClavePS = -1
Dim PSRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPS.SelectedValue.ToEntero).FiltroPrimero("")
If PSRow IsNot Nothing Then
SATClavePS = PSRow("SATClavePS").ToString.ToEntero
End If
Dim IVA As Double
If chkImportacion.Checked Then
IVA = (txtImportacion.Text.Trim.ToDouble / (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.Trim.ToDouble))
Else
IVA = Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)
End If
AddPS(TxtCantidad.Text.Trim.ToDouble, ddlUM.SelectedValue.ToEntero, ddlUM.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, DdlPS.SelectedValue.ToEntero, DdlPS.SelectedText, HdnTipoPS.Value.ToEntero,
DdlSubProyecto.SelectedValue.ToString, DdlSubProyecto.SelectedItem.Text, DdlProyecto.SelectedItem.Text, DdlProyecto.SelectedValue.ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, Total, IVA,
TxtRetIVAModal.Text.ToDouble / 100, TxtRetISRModal.Text.ToDouble / 100, TxtIEPSModal.Text.ToDouble / 100, 0, TxtDescuentoModal.Text.ToDouble, OtrosGastos:=TxtOtrosGastos.Text.ToDouble, CveTipoGasto:=DdlTipoGasto.SelectedValue.ToEntero, TipoGasto:=DdlTipoGasto.SelectedItem.Text,
NoDeducible:=ChkEsNoDeduciblePS.Checked, CveSATPS:=SATClavePS)
AddPS2()
LimpiaAgregar()
AddPS2()
LimpiaAgregar()
If ChkAgregar.Checked = True And Modalidad = "A" Then
RegistraScript("displayToastr(1);", "display")
Else
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto"))
End If
Case "U" 'UPDATE
UpdatePS()
Alert("Concepto actualizado Correctamente.", TipoMensaje.MsgInformacion)
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto"))
End Select
ActualizaTotales = False
If UsuarioActual.Empresa.Funcionalidad(562).ToEntero > 0 Then CargaGastosServicios(UsuarioActual.Empresa.Funcionalidad(562).ToEntero)
If UsuarioActual.Empresa.UsaAC Then
CompruebaAgregar()
GuardaAC()
End If
If ChkAgregar.Checked = True And Modalidad = "A" Then
RegistraScript("displayToastr(1);", "display")
Else
Alert(dtPSInvalidos, TipoMensaje.MsgAdvertencia)
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto"))
End If
Case "U" 'UPDATE
UpdatePS()
Alert("Concepto actualizado Correctamente.", TipoMensaje.MsgInformacion)
RegistraScript(String.Format("$('#{0}').modal('hide');", "divAddProducto"))
End Select
ActualizaTotales = False
'If UsuarioActual.Empresa.Funcionalidad(577).ToString = "1" Then
If UsuarioActual.Empresa.Funcionalidad(562).ToEntero > 0 Then CargaGastosServicios(UsuarioActual.Empresa.Funcionalidad(562).ToEntero)
' 'If UsuarioActual.CveRol = 1 Then
' ' Alert($"Ok funcionalidad 577 RetencionIVA { RetencionIVA} IVAOriginal {IVAOriginal}")
' 'End If
If UsuarioActual.Empresa.UsaAC Then
CompruebaAgregar()
GuardaAC()
End If
' If RetencionIVA = 0 And IVAOriginal > 0 Then
' For Each dRow As DataRow In TmpDT.Rows
' If dRow("CveTipoPS").ToString.ToEntero = 1 Then
' 'Comnetado para reubicar el boton
' 'tdIVA6.Visible = True
' Exit For
' End If
' Next
' End If
'End If
UpPS.Update()
UpPS.Update()
CargaGvPersonal()
End Sub
''' <summary>
@@ -20938,6 +20923,7 @@ Partial Class Compras_Compras
Next
End If
End If
objContratos.Dispose()
If MensajeProducto.Length <> 64 Then
Retorno = MensajeProducto

View File

@@ -14,7 +14,10 @@
<asp:UpdatePanel runat="server" ID="UpAgregar">
<ContentTemplate>
<li>
<asp:LinkButton runat="server" ID="BtnAgregarMotivoD" data-toggle="tooltip" data-placement="left" title="Agregar un Defecto" Text="<i class='fa fa-plus'></i>Agregar Cuenta Asignación"></asp:LinkButton>
<asp:LinkButton runat="server" ID="BtnAgregarAsignacion" data-toggle="tooltip" data-placement="left" title="Agregar Cuenta" Text="<i class='fa fa-plus'></i>Agregar Cuenta Asignación"></asp:LinkButton>
</li>
<li>
<asp:LinkButton runat="server" ID="BtnAgregarGlobal" data-toggle="tooltip" data-placement="left" title="Agregar Global" Text="<i class='fa fa-plus'></i>Agregar Global"></asp:LinkButton>
</li>
</ContentTemplate>
@@ -86,6 +89,27 @@
</asp:TemplateField>
</Columns>
</asp:GridView>
<br />
<asp:GridView runat="server" ID="GvGlobal" EmptyDataText="" ToolTip="" CssClass="table table-striped table-advance table-hover ScrollAD"
DataKeyNames="CveEmpresa,CveCuenta,CveConceptoContable" AutoGenerateColumns="False"
Style=" width:100%" GridLines="None">
<Columns>
<asp:BoundField DataField="ConceptoContable" ItemStyle-Width="150px" HeaderText="Concepto Contable" ItemStyle-HorizontalAlign="Left"/>
<asp:BoundField DataField="CuentaCodigo" ItemStyle-Width="100px" HeaderText="Código Cuenta" ItemStyle-HorizontalAlign="Left"/>
<asp:BoundField DataField="CuentaNombre" HeaderText="Nombre Cuenta" ItemStyle-HorizontalAlign="Left"/>
<asp:TemplateField ItemStyle-Width="49px">
<ItemTemplate>
<asp:LinkButton ID="ImgE" runat="server" AlternateText="Editar" CausesValidation="False" OnClick="ActualizaModulo" CssClass="btn btn-circle btn-xs green" Text="<i class='fa fa-pencil'></i>" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="49px">
<ItemTemplate>
<asp:LinkButton ID="ImgEliminar" runat="server" AlternateText="Eliminar" CausesValidation="False" OnClick="EliminarRowGlobal" CommandName="Delete" CssClass="btn btn-circle btn-xs red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpModal">
@@ -171,6 +195,53 @@
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UppModalGlobal">
<ContentTemplate>
<div id="ModalGlobal" class="modal ADS fade" role="dialog">
<div class="modal-dialog" style="width: 450px;">
<asp:UpdatePanel runat="server" class="modal-content" ID="UppGlobal2" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">×</button>
<h4 class="modal-title">
<asp:Literal ID="Literal1" runat="server">Cuentas Globales</asp:Literal>
</h4>
</div>
<div class="modal-body" style="text-align:center">
<div class="row">
<div class="col-md-1" style="width:50%;text-align:left">
<div class="form-group form-md-line-input input-iconright">
<asp:HiddenField ID="HiddenField1" runat="server" />
<asp:DropDownList ID="DdlConceptoGlobal" CssClass="form-control input-sm select2me js-cuenta-programmatic select2me" runat="server" AppendDataBoundItems="true" DataTextField="ConceptoContable" DataValueField="CveConceptoContable" Width="240px" ValidationGroup="GrpModulo2" ></asp:DropDownList>
<label for="<%= DdlConceptoGlobal.ClientID.ToString()%>">Concepto Contable: </label>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlCuentaGlobal" CssClass="form-control input-sm select2me js-cuenta-programmatic select2me" runat="server" AppendDataBoundItems="true" DataTextField="CtaCodigo" DataValueField="CveCuenta" Width="240px" ValidationGroup="GrpModulo2"></asp:DropDownList>
<label for="<%= DdlCuentaGlobal.ClientID.ToString()%>">Cuenta Contable: </label>
</div>
<div class="form-group form-md-line-input input-iconright" id="div3" runat="server" >
<asp:DropDownList ID="DdlTipoGlobal" CssClass="form-control input-sm select2me js-cuenta-programmatic select2me" runat="server" Width="240px" ValidationGroup="GrpModulo2" >
<asp:ListItem Text="Mayor" Value="1"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlTipoGlobal.ClientID.ToString()%>">Tipo Global: </label>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<asp:LinkButton ID="LBAgregaGlobal" runat="server" class="btn btn-success" Text="Agregar" OnClick="LBAgregaGlobal_Click" ValidationGroup="GrpModulo2" />
<button id="Button1" runat="server" type="button" class="btn default" data-dismiss="modal">Cancelar</button>
<asp:CheckBox ID="CheckBox1" Checked="true" Text="Seguir Registrando" runat="server" />
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>

View File

@@ -40,8 +40,14 @@ Partial Class Contabilidad2_CatCuentasAsignaciones
If ObjConta.GetCuentasAsignacionesSistema(UsuarioActual.CveEmpresa, DdlTipo.SelectedValue.ToEntero, DdlOpcion.SelectedValue.ToEntero) Then
GvDatos.DataSource = ObjConta.DtResultados
End If
If ObjConta.GetCuentasGlobales(UsuarioActual.CveEmpresa) Then
GvGlobal.DataSource = ObjConta.DtResultados
End If
ObjConta.Dispose()
GvDatos.DataBind()
GvGlobal.DataBind()
UpDatos.Update()
End Sub
@@ -53,10 +59,12 @@ Partial Class Contabilidad2_CatCuentasAsignaciones
If ObjConta.GetConta_ConceptosContables() Then
DdlCconceptosContables.DataSource = ObjConta.DtResultados
DdlConceptoGlobal.DataSource = ObjConta.DtResultados.FiltraParametros("EsCuentaUnica = false AND EsSistema = True AND EsGlobal = True")
End If
If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then
DdlCuenta.DataSource = ObjConta.DtResultados
DdlCuentaGlobal.DataSource = ObjConta.DtResultados
End If
ObjConta.Dispose()
DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
@@ -79,7 +87,9 @@ Partial Class Contabilidad2_CatCuentasAsignaciones
DdlCuentaBancaria.DataBind()
DdlCconceptosContables.DataBind()
DdlConceptoGlobal.DataBind()
DdlCuenta.DataBind()
DdlCuentaGlobal.DataBind()
DdlProveedor.DataBind()
'DdlPersonal.DataBind()
DdlClasificacion.DataBind()
@@ -145,6 +155,11 @@ Partial Class Contabilidad2_CatCuentasAsignaciones
End If
End If
If Dr("AplicaImpuesto").ToString = "True" Then
divPorcentajeIVA.Visible = True
End If
If Dr("AplicaClasificacion").ToString = "True" Then
divClasificacion.Visible = True
End If
@@ -184,7 +199,24 @@ Partial Class Contabilidad2_CatCuentasAsignaciones
ObjConta.Dispose()
End Sub
Protected Sub BtnAgregarMotivoD_Click(sender As Object, e As EventArgs) Handles BtnAgregarMotivoD.Click
Protected Sub BtnAgregarGlobal_Click(sender As Object, e As EventArgs) Handles BtnAgregarGlobal.Click
UppModalGlobal.Update()
RegistraScript("$('#ModalGlobal').modal();")
End Sub
Protected Sub EliminarRowGlobal(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Dim ObjConta As New ClsContabilidad
If ObjConta.RemoveCuentasGlobales(GvRow.DataKey("CveConceptoContable").ToEntero, GvRow.DataKey("CveEmpresa").ToEntero) Then
Alert("se elimino correctamente")
End If
CargaDatosSistema()
UpDatos.Update()
ObjConta.Dispose()
End Sub
Protected Sub BtnAgregarAsignacion_Click(sender As Object, e As EventArgs) Handles BtnAgregarAsignacion.Click
LimpiarDatos()
LbAgregar.Text = "Agregar"
@@ -238,4 +270,22 @@ Partial Class Contabilidad2_CatCuentasAsignaciones
CargaDatosSistema()
UpDatos.Update()
End Sub
Protected Sub LBAgregaGlobal_Click(sender As Object, e As EventArgs)
Dim ErrorString As String = ""
Dim ObjConta As New ClsContabilidad
If Not ObjConta.AddCuentasGlobales(DdlConceptoGlobal.SelectedValue.ToEntero, DdlCuentaGlobal.SelectedValue.ToEntero, DdlTipoGlobal.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
ErrorString = "Error al agregar"
End If
ObjConta.Dispose()
If ErrorString.Length > 0 Then
Alert(ErrorString)
Else
Alert("Agregado correctamente")
End If
CargaDatosSistema()
UpDatos.Update()
End Sub
End Class

View File

@@ -1182,7 +1182,7 @@ Partial Class Contratos_Default
If TipoContrato = 4 Then
TabPI.Visible = True
End If
If ObjContratos.GetContratosDetalle(CveContrato) Then
If ObjContratos.GetContratosDetalle(CveContrato, UsuarioActual.CveEmpresa) Then
TmpDT = ObjContratos.DtResultados
If TmpDT.MAX("Cantidad_Original").ToString.ToEntero > 0 OrElse TmpDT.MAX("PU_Original").ToString.ToEntero > 0 Then
BtnAutorizar.Visible = False

View File

@@ -529,7 +529,7 @@ Partial Class Contratos_Default
If TipoContrato = 4 Then
TabPI.Visible = True
End If
If ObjContratos.GetContratosDetalle(CveContrato) Then
If ObjContratos.GetContratosDetalle(CveContrato, UsuarioActual.CveEmpresa) Then
TmpDT = ObjContratos.DtResultados
If TmpDT.MAX("Cantidad_Original").ToString.ToEntero > 0 OrElse TmpDT.MAX("PU_Original").ToString.ToEntero > 0 Then
BtnAutorizar.Visible = False

View File

@@ -902,7 +902,7 @@ Partial Class Contratos_ContratoObra
If TipoContrato = 4 Then
TabPI.Visible = True
End If
If ObjContratos.GetContratosDetalle(CveContrato) Then
If ObjContratos.GetContratosDetalle(CveContrato, UsuarioActual.CveEmpresa) Then
TmpDT = ObjContratos.DtResultados
If TmpDT.MAX("Cantidad_Original").ToString.ToEntero > 0 OrElse TmpDT.MAX("PU_Original").ToString.ToEntero > 0 Then
BtnAutorizar.Visible = False

View File

@@ -467,7 +467,7 @@ Partial Class Contratos_FacturacionMasiva
SubProyecto = DR("SubProyectoContrato").ToString
Dim objContratos As New ClsContratos
If objContratos.GetContratosDetalle(DR("CveContrato").ToString.ToEntero) Then
If objContratos.GetContratosDetalle(DR("CveContrato").ToString.ToEntero, UsuarioActual.CveEmpresa) Then
DTDetalle = objContratos.DtResultados.FiltraParametros("CveTipoPresupuesto=2")
Else
DTDetalle = Nothing

View File

@@ -548,7 +548,7 @@ Partial Class Contratos_FacturacionMasiva
End If
ObjFolios.Dispose()
If objContratos.GetContratosDetalle(DR("CveContrato").ToString.ToEntero) Then
If objContratos.GetContratosDetalle(DR("CveContrato").ToString.ToEntero, UsuarioActual.CveEmpresa) Then
DTDetalle = objContratos.DtResultados
Else
DTDetalle = Nothing

View File

@@ -1,126 +1,139 @@
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepIgnicion.aspx.cs" Inherits="GPS_RepIgnicion" %>
<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">
Reporte de Ignición
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
<li>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:LinkButton ID="LnkImprimirPDF" Visible="false" OnClick="LnkImprimirPDF_Click" runat="server"><i class="fa fa-file-pdf-o"></i> Imprimir PDF</asp:LinkButton>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkImprimirPDF" />
</Triggers>
</asp:UpdatePanel>
</li>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" Runat="Server">
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter" style="">
<div class="portlet-title portlet-filterT smalltitle " style="">
<div class="tools">
<asp:Button ID="BtnConsultar" OnClick="BtnConsultar_Click" runat="server" ValidationGroup="GrpGuardar" Text="Consultar" class="btn btn-primary" />
</div>
<div class="titlefiltros caption" style="margin-top: -8px;">
<ul class="list-inline" style="font-size: 12px;">
<%@ Page Title="" Language="C#" MasterPageFile="~/Site.master" AutoEventWireup="true" CodeFile="RepIgnicion.aspx.cs" Inherits="GPS_RepIgnicion" %>
<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">
Reporte de Ignición
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<li>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:LinkButton ID="LnkImprimirPDF" Visible="false" OnClick="LnkImprimirPDF_Click" runat="server"><i class="fa fa-file-pdf-o"></i> Imprimir PDF</asp:LinkButton>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkImprimirPDF" />
</Triggers>
</asp:UpdatePanel>
</li>
<li>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:LinkButton ID="LnkImprimirEXCEL" Visible="false" OnClick="LnkImprimirEXCEL_Click" runat="server"><i class="fa fa-file-excel-o"></i> Imprimir EXCEL</asp:LinkButton>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkImprimirEXCEL" />
</Triggers>
</asp:UpdatePanel>
</li>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet solid grey-cascade portlet-filter" style="">
<div class="portlet-title portlet-filterT smalltitle " style="">
<div class="tools">
<asp:Button ID="BtnConsultar" OnClick="BtnConsultar_Click" runat="server" ValidationGroup="GrpGuardar" Text="Consultar" class="btn btn-primary" />
</div>
<div class="titlefiltros caption" style="margin-top: -8px;">
<ul class="list-inline" style="font-size: 12px;">
<li>Vehículo:
<asp:DropDownList AppendDataBoundItems="true" ID="DdlDispositivo" runat="server" Width="200px" DataTextField="Display" DataValueField="CveDispositivo" CssClass="form-control input-sm select2me">
<asp:ListItem Selected="True" Value="-1" Text="Seleccione"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVDispositivo" runat="server" ControlToValidate="DdlDispositivo" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Conductor''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDispositivo" runat="server" HighlightCssClass="vco" TargetControlID="RFVDispositivo" Width="350px"></ajax:ValidatorCalloutExtender>
</li>
<asp:DropDownList AppendDataBoundItems="true" ID="DdlDispositivo" runat="server" Width="200px" DataTextField="Display" DataValueField="CveDispositivo" CssClass="form-control input-sm select2me">
<asp:ListItem Selected="True" Value="-1" Text="Seleccione"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVDispositivo" runat="server" ControlToValidate="DdlDispositivo" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Conductor''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEDispositivo" runat="server" HighlightCssClass="vco" TargetControlID="RFVDispositivo" Width="350px"></ajax:ValidatorCalloutExtender>
</li>
<li>Fecha Inicio:
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy hh:mm" style="display: inline-block;">
<asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control input-sm ADDateTimePicker" CausesValidation="true" MaxLength="18" Width="132px "></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Inicio''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator4" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</li>
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy hh:mm" style="display: inline-block;">
<asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control input-sm ADDateTimePicker" CausesValidation="true" MaxLength="18" Width="132px "></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Inicio''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator4" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</li>
<li>Fecha Fin:
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy" style="display: inline-block;">
<asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control input-sm ADDateTimePicker" CausesValidation="true" MaxLength="18" Width="132px "></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Fin''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator5" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</li>
</ul>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet light smmallpadding traspasorow bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Igniciones</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body rowpadding">
<asp:GridView ID="GvIgnicion" runat="server" GridLines="None" OnRowDataBound="GvIgnicion_RowDataBound" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" data-rows ="1" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros" ToolTip="Listado de Numero de Vueltas Realizadas">
<Columns>
<asp:BoundField DataField="Vehiculo" ItemStyle-Width="12.5%" HeaderText="Vehículo" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="FechaEncendido" ItemStyle-Width="12.5%" HeaderText="Fecha Encendido" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="FechaApagado" ItemStyle-Width="12.5%" HeaderText="Fecha Apagado" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="VMedia" DataFormatString="{0:N2} Km/hr." ItemStyle-Width="12.5%" HeaderText="Velocidad Media" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="VMax" DataFormatString="{0:N2} Km/hr." ItemStyle-Width="12.5%" HeaderText="Velocidad Máxima" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="Kilometraje" DataFormatString="{0:N2} Km." ItemStyle-Width="12.5%" HeaderText="Kilometraje" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="Duracion" ItemStyle-Width="12.5%" HeaderText="Duración" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateField ItemStyle-Width="12.5%" HeaderText="Dirección Inicial" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Literal ID="LtlDireccionInicial" runat="server"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="12.5%" HeaderText="Dirección Final" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Literal ID="LtlDireccionFinal" runat="server"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DivModalGrafica" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpGraficaEventos" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-body">
<asp:HiddenField ID="HdnImagen" ClientIDMode="Static" Value="[]" runat="server" />
<asp:HiddenField ID="HdnGrafica" ClientIDMode="Static" Value="[]" runat="server" />
<div id="DvGrafica" style="min-width: 900px; height: 500px; margin: 0 auto"></div>
</div>
<div class="modal-footer">
<div class="modal-btn">
<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">
</asp:Content>
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy" style="display: inline-block;">
<asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control input-sm ADDateTimePicker" CausesValidation="true" MaxLength="18" Width="132px "></asp:TextBox>
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Fin''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator5" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</li>
</ul>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet light smmallpadding traspasorow bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Igniciones</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body rowpadding">
<asp:GridView ID="GvIgnicion" runat="server" GridLines="None" OnRowDataBound="GvIgnicion_RowDataBound" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" data-rows="1" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros" ToolTip="Listado de Numero de Vueltas Realizadas">
<Columns>
<asp:BoundField DataField="Vehiculo" ItemStyle-Width="12.5%" HeaderText="Vehículo" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="FechaEncendido" ItemStyle-Width="12.5%" HeaderText="Fecha Encendido" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="FechaApagado" ItemStyle-Width="12.5%" HeaderText="Fecha Apagado" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="VMedia" DataFormatString="{0:N2} Km/hr." ItemStyle-Width="12.5%" HeaderText="Velocidad Media" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="VMax" DataFormatString="{0:N2} Km/hr." ItemStyle-Width="12.5%" HeaderText="Velocidad Máxima" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="Kilometraje" DataFormatString="{0:N2} Km." ItemStyle-Width="12.5%" HeaderText="Kilometraje" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="Duracion" ItemStyle-Width="12.5%" HeaderText="Duración" ItemStyle-HorizontalAlign="Center" />
<asp:TemplateField ItemStyle-Width="12.5%" HeaderText="Dirección Inicial" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Literal ID="LtlDireccionInicial" runat="server"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="12.5%" HeaderText="Dirección Final" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:Literal ID="LtlDireccionFinal" runat="server"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DivModalGrafica" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpGraficaEventos" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<div class="modal-body">
<asp:HiddenField ID="HdnImagen" ClientIDMode="Static" Value="[]" runat="server" />
<asp:HiddenField ID="HdnGrafica" ClientIDMode="Static" Value="[]" runat="server" />
<div id="DvGrafica" style="min-width: 900px; height: 500px; margin: 0 auto"></div>
</div>
<div class="modal-footer">
<div class="modal-btn">
<button type="button" class="btn btn-danger" data-dismiss="modal">Cerrar</button>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
</asp:Content>

View File

@@ -58,7 +58,8 @@ public partial class GPS_RepIgnicion : ClsPaginas
DtIgniciones = ObjGPS.DtResultados;
GvIgnicion.DataSource = DtIgniciones;
GvIgnicion.DataBind();
LnkImprimirPDF.Visible = true;
LnkImprimirPDF.Visible = true;
LnkImprimirEXCEL.Visible = true;
}
}
UpDatos.Update();
@@ -104,14 +105,18 @@ public partial class GPS_RepIgnicion : ClsPaginas
protected void LnkImprimirPDF_Click(object sender, EventArgs e)
{
EnviarReporteProgramado();
EnviarReporteProgramado("PDF");
}
protected void LnkImprimirEXCEL_Click(object sender, EventArgs e)
{
EnviarReporteProgramado("EXCEL");
}
public void EnviarReporteProgramado()
public void EnviarReporteProgramado(string Formato = "PDF")
{
if (DtIgniciones != null)
{
byte[] retorno;
string RutaReporte = "Empresas/Grales/ReportesProgramados/RPIgnicion.rdlc";
string RutaReporte = ModExtensiones.DirectorioBaseEmpresas + "Empresas/Grales/ReportesProgramados/RPIgnicion.rdlc";
try
{
@@ -121,10 +126,10 @@ public partial class GPS_RepIgnicion : ClsPaginas
RptParametro.Add(new ReportParameter("UsuarioImprimio", UsuarioActual.Usuario));
RptParametro.Add(new ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy HH:mm tt")));
retorno = StreamPDF(RutaReporte, DtIgniciones, RptParametro, "ReporteEventos", "PDF", "DsOC");
retorno = StreamPDF(RutaReporte, DtIgniciones, RptParametro, "ReporteEventos", Formato, "DsOC");
// TODO: Labeled Arguments not supported. Argument: 6 := 'MR'
// TODO: Labeled Arguments not supported. Argument: 7 := 'RDSName'
ImprimirbytesPDF(retorno, "ReporteEventos");
ImprimirbytesPDF(retorno, "ReporteEventos", Formato: Formato);
}
catch (Exception ex)
{

View File

@@ -89,8 +89,11 @@
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField DataField="Estatus" HeaderText="Estatus" />
<asp:HyperLinkField DataNavigateUrlFields="CveInventarioFisico" DataNavigateUrlFormatString="~/Inventarios/RepAnomalias.aspx?CveInventarioFisico={0}"
Target="_blank" Text="Dif."></asp:HyperLinkField>
<asp:TemplateField HeaderText="">
<ItemTemplate>
<asp:HyperLink ID="HplDif" runat="server" NavigateUrl='<%# Eval("CveInventarioFisico", "~/Inventarios/RepAnomalias.aspx?CveInventarioFisico={0}") %>' Text="Dif."></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Comandos">
<ItemTemplate>
<asp:LinkButton ID="imgE" runat="server" AlternateText="Editar" CausesValidation="False" CssClass="btn btn-circle btn-sm green" OnClick="Edit_Click" Text="<i class='fa fa-pencil'></i>" />

View File

@@ -759,6 +759,10 @@ Partial Class Inventarios_InventarioFisico
If e.Row.DBCampo("CveEstatus") = "3" Then
e.Row.FCLinkButton("imgE").Visible = False
e.Row.FCLinkButton("imgD").Visible = False
ElseIf e.Row.DBCampo("CveEstatus") = "1" Then ' cuando es en proceso
e.Row.FCHyperLink("HplDif").NavigateUrl = String.Format("/Inventarios/RepAnomalias.aspx?CveInventarioFisico={0}&EsAvance=1", e.Row.DBCampo("CveInventarioFisico"))
ElseIf e.Row.DBCampo("CveEstatus") = "0" Then ' Nuevo
e.Row.FCHyperLink("HplDif").Visible = False
End If
End If

View File

@@ -207,22 +207,23 @@
</ContentTemplate>
</asp:UpdatePanel>
<br />
<div class="row">
<div class="col-md-12">
<label style="font-size: 16px"><b>Productos que Faltan</b></label>
<div class="row">
<div class="col-md-4" align="left" id="divRegistradosFaltan" runat="server">
<asp:Label runat="server">Número de registros: <b><asp:Literal ID="LtlTotalRegistrosFaltan" runat="server"></asp:Literal></b></asp:Label>
</div>
<div class="col-md-8" align="right" id="DivBuscadorFaltan" runat="server">
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvF.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvF.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
</div>
</div>
<asp:UpdatePanel ID="UPAnomalias" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<label style="font-size: 16px"><b>Productos que Faltan</b></label>
<div class="row">
<div class="col-md-4" align="left" id="divRegistradosFaltan" runat="server">
<asp:Label runat="server">Número de registros: <b><asp:Literal ID="LtlTotalRegistrosFaltan" runat="server"></asp:Literal></b></asp:Label>
</div>
<div class="col-md-8" align="right" id="DivBuscadorFaltan" runat="server">
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvF.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvF.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
</div>
</div>
<asp:GridView ID="GvF" data-sort="true" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False"
CssClass="table table-striped table-hover Widthall ScrollAD" Style="text-align: center;"
GridLines="None" DataKeyNames="CvePS">
@@ -256,22 +257,23 @@
</ContentTemplate>
</asp:UpdatePanel>
<br />
<div class="row">
<div class="col-md-12">
<label style="font-size: 16px"><b>Productos que Sobran</b></label>
<div class="row">
<div class="col-md-4" align="left" id="divRegistradosSobran" runat="server">
<asp:Label runat="server">Número de registros: <b><asp:Literal ID="LtlTotalRegistrosSobran" runat="server"></asp:Literal></b></asp:Label>
</div>
<div class="col-md-8" align="right" id="DivBuscadorSobran" runat="server">
<input type="text" id="TxtBusqueda2" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda2','{0}')", GvS.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda2','{0}')", GvS.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
</div>
</div>
<asp:UpdatePanel ID="UpdateGvS" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div class="row">
<div class="col-md-12">
<label style="font-size: 16px"><b>Productos que Sobran</b></label>
<div class="row">
<div class="col-md-4" align="left" id="divRegistradosSobran" runat="server">
<asp:Label runat="server">Número de registros: <b><asp:Literal ID="LtlTotalRegistrosSobran" runat="server"></asp:Literal></b></asp:Label>
</div>
<div class="col-md-8" align="right" id="DivBuscadorSobran" runat="server">
<input type="text" id="TxtBusqueda2" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda2','{0}')", GvS.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda2','{0}')", GvS.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
</div>
</div>
</div>
<asp:GridView ID="GvS" data-sort="true" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False"
CssClass="table table-striped table-hover Widthall ScrollAD" Style="text-align: center;" GridLines="None" DataKeyNames="CvePS">
<Columns>

View File

@@ -547,7 +547,7 @@ Partial Class Inventarios_TrasladoSolicitud
End Sub
Private Sub DdlContratos_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlContratos.SelectedIndexChanged
Dim ObjContratos As New ClsContratos
If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero) Then
If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
GvContratos.DataSource = ObjContratos.DtResultados
GvContratos.DataBind()
If ObjContratos.DtResultados.Rows.Count > 0 Then
@@ -974,7 +974,7 @@ Partial Class Inventarios_TrasladoSolicitud
Dim DTContratosTemporal As New DataTable
Dim ObjContratos As New ClsContratos
If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero) Then
If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
DTContratosTemporal = ObjContratos.DtResultados
End If
ObjContratos.Dispose()

View File

@@ -7435,7 +7435,7 @@ Partial Class OC
Private Sub CargaContratos()
Dim ObjContratos As New ClsContratos
If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero) Then
If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
GvContratos.DataSource = ObjContratos.DtResultados
End If
ObjContratos.Dispose()
@@ -7465,7 +7465,7 @@ Partial Class OC
Private Sub DdlContratos_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlContratos.SelectedIndexChanged
Dim ObjContratos As New ClsContratos
If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero) Then
If ObjContratos.GetContratosDetalle(DdlContratos.SelectedValue.ToEntero, UsuarioActual.CveEmpresa) Then
GvContratos.DataSource = ObjContratos.DtResultados
GvContratos.DataBind()
End If

View File

@@ -1571,6 +1571,7 @@
</div>
<div class="modal-body">
<asp:HiddenField ID="HdnDescuento" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnPorcentajeDescuentoMaximo" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnDescuentoGeneral" runat="server" ClientIDMode="Static" Value="-1" />
<asp:HiddenField ID="HdnTipoDescuento" runat="server" ClientIDMode="Static" Value="-1" />
<table>
@@ -3344,6 +3345,15 @@
}
var Descuento = parseFloat($get("TxtPorDescP").value);
var PorcentajeDescuentoMaximo = parseFloat($get("HdnPorcentajeDescuentoMaximo").value);
if (PorcentajeDescuentoMaximo > 0 && Descuento > PorcentajeDescuentoMaximo) {
$get("TxtDescP").value = "0";
$get("TxtPorDescP").value = "0";
Descuento = 0;
alert("No puede exceder el descuento maximo autorizado.");
}
$get("LblPrecioFinal").innerText = formato_numero(Monto - ((Monto * Descuento) / 100), 2, '.', ',');
$get("LblTotalPS").innerText = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ',');
var Total = Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""));
@@ -3354,6 +3364,7 @@
if (TipoDescuento == 2) {
$get("LblDescuentos").innerText = formato_numero(Total, 2, '.', ',');
}
}
else {
$get("LblPrecioFinal").innerText = "0.00";
@@ -3383,6 +3394,17 @@
}
var Descuento = parseFloat($get("TxtDescP").value);
var PorcentajeDescuento = (Descuento * 100 / Monto)
var PorcentajeDescuentoMaximo = parseFloat($get("HdnPorcentajeDescuentoMaximo").value);
if (PorcentajeDescuentoMaximo > 0 && PorcentajeDescuento > PorcentajeDescuentoMaximo) {
$get("TxtDescP").value = "0";
$get("TxtPorDescP").value = "0";
Descuento = 0;
alert("No puede exceder el descuento maximo autorizado.");
}
$get("TxtPorDescP").value = formato_numero((Descuento * 100 / Monto), 2, '.', ',');
$get("LblPrecioFinal").innerText = formato_numero(Monto - Descuento, 2, '.', ',');
$get("LblTotalPS").innerText = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ',');

View File

@@ -1062,6 +1062,7 @@ Partial Class PV
ViewState("ClienteRetIVA") = 0
ViewState("ClienteRetISR") = 0
ViewState("EnviarCorreoCliente") = False
HdnPorcentajeDescuentoMaximo.Value = UsuarioActual.DescuentoAutorizado.ToString()
CveVentaDetalle = -1
EstablecioFolio = False
EstatusCliente = False
@@ -5102,52 +5103,52 @@ Partial Class PV
End Sub
Protected Sub BtnAplicarDescG_Click(sender As Object, e As System.EventArgs) Handles BtnAplicarDescG.Click
If HdnTipoDescuento.Value = "2" Then
'If HdnTipoDescuento.Value = "2" Then
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then
Dim IVAPromedio As Double = Math.Round(TmpDT.SUM("IVA") / TmpDT.COUNT("Consec"), 2)
Dim IVA As Double = TmpDT.Rows(0)("IVA").ToString.ToDouble
' If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then
' Dim IVAPromedio As Double = Math.Round(TmpDT.SUM("IVA") / TmpDT.COUNT("Consec"), 2)
' Dim IVA As Double = TmpDT.Rows(0)("IVA").ToString.ToDouble
If IVAPromedio <> IVA Then
Alert("No se puede aplicar descuento general a la factura ya tiene conceptos con diferente tasa de IVA", TipoMensaje.MsgError)
Else
AplicarDescuentos()
'Dim Descuento As Double = HdnDescuento.Value.Trim.Replace(",", "").ToDouble
CalculaTotalesVenta()
'LblDescuentos.Text = Descuento.FormatoNumero(2)
'TxtIVA.Text = ((TxtSubTotal.Text.Trim.Replace(",", "").ToDouble - Descuento - LblAmortizacion.Text.Trim.Replace(",", "").ToDouble) * IVAPromedio).FormatoNumero(2)
'HdnIVAOriginal.Value = TxtIVA.Text
'CalculaTotales(True)
HdnTipoDescuento.Value = "-1"
HdnDescuento.Value = "0"
RegistraScript("BorraDescuentos();")
End If
End If
UpPS.Update()
' If IVAPromedio <> IVA Then
' Alert("No se puede aplicar descuento general a la factura ya tiene conceptos con diferente tasa de IVA", TipoMensaje.MsgError)
' Else
' AplicarDescuentos()
' 'Dim Descuento As Double = HdnDescuento.Value.Trim.Replace(",", "").ToDouble
' CalculaTotalesVenta()
' 'LblDescuentos.Text = Descuento.FormatoNumero(2)
' 'TxtIVA.Text = ((TxtSubTotal.Text.Trim.Replace(",", "").ToDouble - Descuento - LblAmortizacion.Text.Trim.Replace(",", "").ToDouble) * IVAPromedio).FormatoNumero(2)
' 'HdnIVAOriginal.Value = TxtIVA.Text
' 'CalculaTotales(True)
' HdnTipoDescuento.Value = "-1"
' HdnDescuento.Value = "0"
' RegistraScript("BorraDescuentos();")
' End If
' End If
' UpPS.Update()
ElseIf HdnTipoDescuento.Value = "3" Then
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then
Dim IVAPromedio As Double = Math.Round(TmpDT.SUM("IVA") / TmpDT.COUNT("Consec"), 2)
Dim IVA As Double = TmpDT.Rows(0)("IVA").ToString.ToDouble
'ElseIf HdnTipoDescuento.Value = "3" Then
' If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 Then
' Dim IVAPromedio As Double = Math.Round(TmpDT.SUM("IVA") / TmpDT.COUNT("Consec"), 2)
' Dim IVA As Double = TmpDT.Rows(0)("IVA").ToString.ToDouble
If IVAPromedio <> IVA Then
Alert("No se puede aplicar descuento general a la factura ya tiene conceptos con diferente tasa de IVA", TipoMensaje.MsgError)
Else
AplicarDescuentos()
'Dim Amortizacion As Decimal = HdnDescuento.Value.Trim.Replace(",", "").ToDecimal
'LblAmortizacion.Text = Amortizacion.FormatoNumero(2)
'TxtIVA.Text = ((TxtSubTotal.Text.Trim.Replace(",", "").ToDouble - Amortizacion - LblDescuentos.Text.Trim.Replace(",", "").ToDouble) * IVAPromedio).FormatoNumero(2)
'HdnIVAOriginal.Value = TxtIVA.Text
'CalculaTotales(True)
CalculaTotalesVenta()
HdnTipoDescuento.Value = "-1"
HdnDescuento.Value = "0"
RegistraScript("BorraDescuentos();")
End If
End If
UpPS.Update()
' If IVAPromedio <> IVA Then
' Alert("No se puede aplicar descuento general a la factura ya tiene conceptos con diferente tasa de IVA", TipoMensaje.MsgError)
' Else
' AplicarDescuentos()
' 'Dim Amortizacion As Decimal = HdnDescuento.Value.Trim.Replace(",", "").ToDecimal
' 'LblAmortizacion.Text = Amortizacion.FormatoNumero(2)
' 'TxtIVA.Text = ((TxtSubTotal.Text.Trim.Replace(",", "").ToDouble - Amortizacion - LblDescuentos.Text.Trim.Replace(",", "").ToDouble) * IVAPromedio).FormatoNumero(2)
' 'HdnIVAOriginal.Value = TxtIVA.Text
' 'CalculaTotales(True)
' CalculaTotalesVenta()
' HdnTipoDescuento.Value = "-1"
' HdnDescuento.Value = "0"
' RegistraScript("BorraDescuentos();")
' End If
' End If
' UpPS.Update()
End If
'End If
RegistraScript("$('#ModalDescuento').modal('hide')", "hidemodal")
End Sub
@@ -6463,7 +6464,7 @@ Partial Class PV
Else
'TxtPUFactura.Enabled = True
'TxtPUFactura.Text = ""
DdlPSAjuste.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, AplicaParaVenta:=1)
DdlPSAjuste.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
End If
DdlPSAjuste.DataBind()
' DdlPSAjuste.Items.Insert(0, New ListItem("Seleccione", "-1"))

View File

@@ -6680,11 +6680,16 @@
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom">
<div class="row">
<div class="col-md-12">
<asp:CheckBox ID="ChkMostarProductosRNCBon" runat="server" AutoPostBack="true" Text="Mostrar Productos" OnCheckedChanged="ChkMostarProductosRNCBon_CheckedChanged" />
</div>
</div>
<div class="row" style="margin-right: 10px;" align="right">
<input type="text" id="TxtBusquedaNCBon" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaNCBon','{0}')", GvRemisionesNCBon.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaNCBon','{0}')", GvRemisionesNCBon.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div>
<div class="row">
<div class="row" id="DivRNCBonificaciones" runat="server" visible="false">
<div class="col-md-12" style="max-height: 440px; overflow: auto">
<asp:GridView ID="GvRemisionesNCBon" runat="server" AutoGenerateColumns="False"
DataKeyNames="CveVenta,CveVentaRNCCargo" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
@@ -6716,6 +6721,35 @@
</asp:GridView>
</div>
</div>
<div class="row" id="DivRNCBonificacionesDetalle" runat="server" visible="false">
<div class="col-md-12" style="max-height: 440px; overflow: auto">
<asp:GridView ID="GvRemisionesNCBonDetalle" 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" />
</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:Literal ID="TtlTotal" runat="server" Text='<%# Eval("Total", "{0:N2}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</div>
</div>
<div class="row">
@@ -7769,7 +7803,6 @@
}
function CalculaSaldoRNCChkDetalleBonificacion(TxtCantidad, CantidadPendiente, ImporteTotal, Chk) {
//ImportesRNCCargo
let Importe = 0;
@@ -7836,6 +7869,73 @@
}
}
function CalculaSaldoRNCChkDetalleBon(TxtCantidad, CantidadPendiente, ImporteTotal, Chk) {
//ImportesRNCCargo
let Importe = 0;
if (Chk.checked) {
let SaldoMaximoUtilizable = ToDouble(HdnSMUBon.value);
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

@@ -3359,7 +3359,7 @@ Partial Class Ventas
Dim ObjContrato As New ClsContratos
Dim NoId As Integer = 0
If ObjContrato.GetContratosDetalle(DdlContratosModal.SelectedValue.ToEntero()) Then
If ObjContrato.GetContratosDetalle(DdlContratosModal.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then
'SI ES CONTRATO DE CONSIGNACION DE VENTA AGARRA LAS EXISTENCIAS DEL ALMACEN
CreaConsignacionSerieDetalle()
@@ -25127,6 +25127,18 @@ Partial Class Ventas
End If
UpModalRemisionesNC.Update()
End Sub
Protected Sub ChkMostarProductosRNCBon_CheckedChanged(sender As Object, e As EventArgs)
If ChkMostarProductosRNCBon.Checked Then
DivRNCBonificaciones.Visible = False
DivRNCBonificacionesDetalle.Visible = True
CargaRNCDetalleBonificacion(DdlVentaUsado.SelectedValue.ToEntero())
Else
DivRNCBonificaciones.Visible = True
DivRNCBonificacionesDetalle.Visible = False
RblRNCTipo_SelectedIndexChanged(RblRNCTipo, EventArgs.Empty)
End If
UpModalRemisionesNC.Update()
End Sub
Protected Sub ChkMostarProductosRNCDesc_CheckedChanged(sender As Object, e As EventArgs)
RblRNCTipoDesc_SelectedIndexChanged(RblRNCTipo, EventArgs.Empty)
@@ -25339,7 +25351,63 @@ Partial Class Ventas
UpDescNC.Update()
End Sub
Private Sub CargaRNCDetalleBonificacion(Optional CveVentaUsado As Integer = -1)
'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()
'GvRemisionesNCBonDetalle.DataSource = TmpDTRNCBonificacionDetalle.FiltraParametros("TipoRNC = 2")
'GvRemisionesNCBonDetalle.DataBind()
Dim ObjMovtos As New ClsMovimientos()
If ObjMovtos.GetRemisionesNCCliente(CveCliente, True, CveMoneda:=-1, CveClienteSucursal:=DdlSucursalCliente.SelectedValue.ToEntero()) Then
Me.TmpDTRNCDetalle = ObjMovtos.DtResultados.Copy()
End If
ObjMovtos.Dispose()
Me.TmpDTRNCDetalle.Columns.Add(New DataColumn("CveVentaDetalleNCGenerada", GetType(Integer)))
Me.TmpDTRNCDetalleSelecciondas = Nothing
Me.TmpDTRNCDetalleSelecciondas = TmpDTRNCDetalle.Clone()
Me.TmpDTRNCDetalleSelecciondas.Clear()
GvRemisionesNCBonDetalle.DataSource = TmpDTRNCDetalle.FiltraParametros("TipoRNC = 2")
GvRemisionesNCBonDetalle.DataBind()
Dim ObjAcum As New ClsAcumuladores
If ObjAcum.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
Dim RowUsadosNC As DataRow = ObjAcum.DtResultados.Rows(5)
DivSMU.Visible = True
HdnSMUBon.Value = RowUsadosNC("ValorConImpuestos").ToString()
LtlSMUBon.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
Else
'DivSMU.Visible = False
HdnSMUBon.Value = "0"
LtlSMUBon.Text = "0"
End If
ObjAcum.Dispose()
'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
UpModalRemisionesNC.Update()
End Sub
Private Sub CargaRNCDetalleDescBonificacion()
Dim DtNC As DataTable = Nothing
@@ -25375,74 +25443,95 @@ Partial Class Ventas
If TmpDTRNCBonificacionesSeleccionadas Is Nothing Then
TmpDTRNCBonificacionesSeleccionadas = Me.TmpDTRNCBonificacionesCliente.Clone()
End If
If ChkMostarProductosRNCBon.Checked Then
DivRNCBonificaciones.Visible = False
DivRNCBonificacionesDetalle.Visible = True
Dim ListaBon As New List(Of VentasBonificaciones)
Dim DtBon As DataTable = Nothing
Dim SbFiltro As New StringBuilder()
SbFiltro.Append("CveVenta IN(")
Using ObjAcum As New ClsAcumuladores
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNCCargo) Then
DtBon = ObjAcum.DtResultados.Copy()
End If
End Using
If DtBon IsNot Nothing Then
Dim queryBonificacion = From dr In DtBon
Where dr("CveVentaBonificacion").ToString().ToEntero > 0
Group By CveVentaBonificacion = dr("CveVentaBonificacion").ToString().ToEntero, CveVenta = dr("CveVenta").ToString().ToEntero
Into x = Group
Select New With {
.CveVentaRNCCargo = CveVenta,
.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
SbFiltro.Remove(SbFiltro.Length - 1, 1)
SbFiltro.Append(")")
End If
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())
RowBonificacion("ImporteBonificacion") = RNCBonificacion.Sum(Function(x) x.ImporteBonificacion)
RowBonificacion("IVABonificacion") = RNCBonificacion.Sum(Function(x) x.IVABonificacion)
RowBonificacion("CveVentaRNCCargo") = 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
End If
'VERIFICA SI TIENE BONIFICACIONES PARA AGREGARLAS
If TmpDTRNCBonificacionesSeleccionadas IsNot Nothing AndAlso TmpDTRNCBonificacionesSeleccionadas.Rows.Count > 0 Then
DivRNCBon.Visible = True
CargaRNCDetalleBonificacion()
Else
DivRNCBon.Visible = False
DivRNCBonificaciones.Visible = True
DivRNCBonificacionesDetalle.Visible = False
Dim ListaBon As New List(Of VentasBonificaciones)
Dim DtBon As DataTable = Nothing
Dim SbFiltro As New StringBuilder()
SbFiltro.Append("CveVenta IN(")
Using ObjAcum As New ClsAcumuladores
If ObjAcum.DistribuidorMovtosGet(CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNCCargo) Then
DtBon = ObjAcum.DtResultados.Copy()
End If
End Using
If DtBon IsNot Nothing Then
Dim queryBonificacion = From dr In DtBon
Where dr("CveVentaBonificacion").ToString().ToEntero > 0
Group By CveVentaBonificacion = dr("CveVentaBonificacion").ToString().ToEntero, CveVenta = dr("CveVenta").ToString().ToEntero
Into x = Group
Select New With {
.CveVentaRNCCargo = CveVenta,
.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
SbFiltro.Remove(SbFiltro.Length - 1, 1)
SbFiltro.Append(")")
End If
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())
RowBonificacion("ImporteBonificacion") = RNCBonificacion.Sum(Function(x) x.ImporteBonificacion)
RowBonificacion("IVABonificacion") = RNCBonificacion.Sum(Function(x) x.IVABonificacion)
RowBonificacion("CveVentaRNCCargo") = 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
End If
'VERIFICA SI TIENE BONIFICACIONES PARA AGREGARLAS
If TmpDTRNCBonificacionesSeleccionadas IsNot Nothing AndAlso TmpDTRNCBonificacionesSeleccionadas.Rows.Count > 0 Then
DivRNCBon.Visible = True
Else
DivRNCBon.Visible = False
End If
GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas
GvRemisionesNCBon.DataBind()
'Dim SMUBon As Decimal = Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal()
'LtlSMUBon.Text = String.Format("{0:N2}", SMUBon)
'HdnSMUBon.Value = SMUBon.ToString()
Dim ObjAcum2 As New ClsAcumuladores
If ObjAcum2.GetMovimientosDistribuidorResumen(CveCliente, UsuarioActual.CveEmpresa) Then
Dim RowUsadosNC As DataRow = ObjAcum2.DtResultados.Rows(5)
HdnSMUBon.Value = RowUsadosNC("ValorConImpuestos").ToString()
LtlSMUBon.Text = RowUsadosNC("ValorConImpuestos").ToString().ToDecimal().FormatoNumero(2)
Else
HdnSMUBon.Value = "0"
LtlSMUBon.Text = "0"
End If
ObjAcum2.Dispose()
UpModalRemisionesNC.Update()
End If
GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas
GvRemisionesNCBon.DataBind()
Dim SMUBon As Decimal = Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal()
LtlSMUBon.Text = String.Format("{0:N2}", SMUBon)
HdnSMUBon.Value = SMUBon.ToString()
UpModalRemisionesNC.Update()
End Sub
'Protected Sub ChkAplicarRNC_CheckedChanged(sender As Object, e As EventArgs)
@@ -25623,6 +25712,22 @@ Partial Class Ventas
End If
End If
End Sub
Protected Sub GvRemisionesNCBonDetalle_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRemisionesNCBonDetalle.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", $"CalculaSaldoRNCChkDetalleBon({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);")
@@ -30037,7 +30142,8 @@ Partial Class Ventas
NCConcepto = ArrayNC(1).ToEntero()
End Select
If ChkMostarProductosRNC.Checked Then
'CARGOS/AJUSTES POR GARANTIA POR PRODUCTO
If RblRNCTipo.SelectedValue.Contiene("1", "3") AndAlso ChkMostarProductosRNC.Checked Then
Dim TotalAcumulado As Decimal = 0
Me.AplicaRNCXDetalle = True
@@ -30105,8 +30211,8 @@ Partial Class Ventas
Exit For
End If
Next
Else
'CARGOS/AJUSTES POR GARANTIA POR TOTAL
ElseIf RblRNCTipo.SelectedValue.Contiene("1", "3") AndAlso Not ChkMostarProductosRNC.Checked Then
For Each GvRow As GridViewRow In GvRemisionesNC.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
@@ -30156,7 +30262,77 @@ Partial Class Ventas
Else
DdlNCPS.Enabled = True
End If
'BONIFICACIONES POR PRODUCTO
ElseIf RblRNCTipo.SelectedValue.Contiene("2") AndAlso ChkMostarProductosRNCBon.Checked Then
Dim TotalAcumulado As Decimal = 0
Me.AplicaRNCXDetalle = True
For Each GvRow As GridViewRow In GvRemisionesNCBonDetalle.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim Rows = TmpDTRNCDetalle.Select($"CveVentaDetalleRNC = {GvRow.DataKey("CveVentaDetalleRNC").ToEntero()}")
For Each row In Rows
row("Cantidad") = GvRow.FCTextBox("TxtCantidadRNC").Text.ToDecimal()
TmpDTRNCDetalleSelecciondas.Rows.Add(row.ItemArray)
Next
End If
End If
Next
Dim TerminarCiclo As Boolean = False
For Each Dr As DataRow In TmpDTRNCDetalleSelecciondas.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 GvRemisionesNCBonDetalle.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
End If
End If
Next
TotalAcumulado += TotalRNC
'SI SE EXECE RESTA AL ULTIMO
If TotalAcumulado > LtlSMUBon.Text.ToDecimal() Then
TerminarCiclo = True
TotalAcumulado -= TotalRNC
TotalRNC = LtlSMUBon.Text.ToDecimal() - TotalAcumulado
End If
RemNC.TotalRemNCAplicado = TotalRNC
'MARCA LA VENTA QUE FUE USADA PARA EL FILTRO
RemNC.Num3 = DdlVentaUsado.SelectedValue.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)
ListaRemisionesNC.Clear()
Exit Sub
End If
ListaRemisionesNC.Add(RemNC)
If TerminarCiclo Then
Exit For
End If
Next
'BONIFICACIONES POR TOTAL
ElseIf RblRNCTipo.SelectedValue.Contiene("2") AndAlso Not ChkMostarProductosRNCBon.Checked Then
For Each GvRow As GridViewRow In GvRemisionesNCBon.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
@@ -30167,21 +30343,20 @@ Partial Class Ventas
If RemNC.TotalRemNCAplicado <= 0 Then
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
ListaNCBonificacion.Clear()
ListaRemisionesNC.Clear()
Exit Sub
End If
ListaNCBonificacion.Add(RemNC)
ListaRemisionesNC.Add(RemNC)
End If
End If
Next
'SI SON SOLO BONIFICACIONES GENERA LA NC PRINCIPAL EN BASE A ESAS
If RblRNCTipo.SelectedValue.ToString() = "2" AndAlso ListaRemisionesNC.Count = 0 Then
ListaRemisionesNC.AddRange(ListaNCBonificacion)
ListaNCBonificacion.Clear()
End If
'If RblRNCTipo.SelectedValue.ToString() = "2" AndAlso ListaRemisionesNC.Count = 0 Then
' ListaRemisionesNC.AddRange(ListaNCBonificacion)
' ListaNCBonificacion.Clear()
'End If
End If
Dim DrPSSeleccionado As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=NCConcepto).FiltroPrimero("")