This commit is contained in:
2024-09-10 16:18:17 -07:00
12 changed files with 2226 additions and 1699 deletions

View File

@@ -6283,6 +6283,24 @@ Public Class ClsInventarios
Return Retorno Return Retorno
End Function End Function
Public Function GetUltimoCosto(CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Inv_UltimoCostoGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al consultar los productos por ultimo costo.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
#Region " IDisposable Support " #Region " IDisposable Support "
' IDisposable ' IDisposable
Protected Overridable Sub Dispose(ByVal disposing As Boolean) Protected Overridable Sub Dispose(ByVal disposing As Boolean)

View File

@@ -3385,7 +3385,7 @@ Public Class ClsVentas
Public Function GetReportePadreVentasUtilidad(CveVendedor As String, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Gpo As Integer, Public Function GetReportePadreVentasUtilidad(CveVendedor As String, CveCliente As Integer, CveSubProyecto As String, FechaInicio As Date, FechaFin As Date, CveEmpresa As Integer, Gpo As Integer,
CvePS As Integer, CveCategoria As Integer, CveClasificacion As Integer, CveMarca As Integer, EsGarantia As Integer, EsFilial As Integer) As Boolean CvePS As Integer, CveCategoria As Integer, CveClasificacion As Integer, CveMarca As Integer, EsGarantia As Integer, EsFilial As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_RepVentasUtilidadGet") DataAdapter("PA_Vta_RepVentasUtilidadGetOIC")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
.Add("@FechaI", SqlDbType.Date).Value = FechaInicio .Add("@FechaI", SqlDbType.Date).Value = FechaInicio

Binary file not shown.

View File

@@ -1,5 +1,75 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner"> <Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition">
<AutoRefresh>0</AutoRefresh>
<DataSources>
<DataSource Name="DataSet">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>f55ecc33-47ff-4fc5-a233-35ea9bb1f578</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<DataSourceName>DataSet</DataSourceName>
<CommandText>/* Local Query */</CommandText>
</Query>
<Fields>
<Field Name="TipoDocto">
<DataField>TipoDocto</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Folio">
<DataField>Folio</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Fecha">
<DataField>Fecha</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="FechaVencimiento">
<DataField>FechaVencimiento</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="DiasVencidos">
<DataField>DiasVencidos</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Original">
<DataField>Original</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Abonado">
<DataField>Abonado</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="PorRecuperado">
<DataField>PorRecuperado</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Saldo">
<DataField>Saldo</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="PorXRecuperar">
<DataField>PorXRecuperar</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>DataSet</rd:DataSetName>
<rd:SchemaPath>C:\Users\Caudillo\Documents\Visual Studio 2013\WebSites\WebSite9\App_Code\DataSet.xsd</rd:SchemaPath>
<rd:TableName>DataTable1</rd:TableName>
<rd:TableAdapterFillMethod />
<rd:TableAdapterGetDataMethod />
<rd:TableAdapterName />
</rd:DataSetInfo>
</DataSet>
</DataSets>
<ReportSections>
<ReportSection>
<Body> <Body>
<ReportItems> <ReportItems>
<Tablix Name="Tablix1"> <Tablix Name="Tablix1">
@@ -1478,74 +1548,8 @@
<ColumnSpacing>0.13cm</ColumnSpacing> <ColumnSpacing>0.13cm</ColumnSpacing>
<Style /> <Style />
</Page> </Page>
<AutoRefresh>0</AutoRefresh> </ReportSection>
<DataSources> </ReportSections>
<DataSource Name="DataSet">
<ConnectionProperties>
<DataProvider>System.Data.DataSet</DataProvider>
<ConnectString>/* Local Connection */</ConnectString>
</ConnectionProperties>
<rd:DataSourceID>f55ecc33-47ff-4fc5-a233-35ea9bb1f578</rd:DataSourceID>
</DataSource>
</DataSources>
<DataSets>
<DataSet Name="DataSet1">
<Query>
<DataSourceName>DataSet</DataSourceName>
<CommandText>/* Local Query */</CommandText>
</Query>
<Fields>
<Field Name="TipoDocto">
<DataField>TipoDocto</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Folio">
<DataField>Folio</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Fecha">
<DataField>Fecha</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="FechaVencimiento">
<DataField>FechaVencimiento</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="DiasVencidos">
<DataField>DiasVencidos</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Original">
<DataField>Original</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Abonado">
<DataField>Abonado</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="PorRecuperado">
<DataField>PorRecuperado</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Saldo">
<DataField>Saldo</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="PorXRecuperar">
<DataField>PorXRecuperar</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
</Fields>
<rd:DataSetInfo>
<rd:DataSetName>DataSet</rd:DataSetName>
<rd:SchemaPath>C:\Users\Caudillo\Documents\Visual Studio 2013\WebSites\WebSite9\App_Code\DataSet.xsd</rd:SchemaPath>
<rd:TableName>DataTable1</rd:TableName>
<rd:TableAdapterFillMethod />
<rd:TableAdapterGetDataMethod />
<rd:TableAdapterName />
</rd:DataSetInfo>
</DataSet>
</DataSets>
<ReportParameters> <ReportParameters>
<ReportParameter Name="NombreEmpresa"> <ReportParameter Name="NombreEmpresa">
<DataType>String</DataType> <DataType>String</DataType>

View File

@@ -2315,7 +2315,8 @@ select.input-sm {
.contabilidadbody .portlet-title .font-green, .contabilidadbody .portlet-title .font-green,
.contabilidadbody .portlet-title .font-green a { .contabilidadbody .portlet-title .font-green a {
color: #F7F7F7 !important; color: #26a69a !important;
/*color: #F7F7F7 !important;*/
} }
/*RH recursos humanos*/ /*RH recursos humanos*/
.rhumanosbody .page-bar .page-breadcrumb > li > a, .rhumanosbody .page-bar .page-breadcrumb > li > a,

View File

@@ -66,17 +66,23 @@ Partial Class ListadoContratos
End If End If
ObjContratos.Dispose() ObjContratos.Dispose()
'Generamos Folio - NumeroContrato
Dim CveSubProyecto As Integer = GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", "TipoSucursal = 1").ToEntero UpTitulos.Update()
End Sub
Private Sub CargaFolio()
'Dim CveSubProyecto As Integer = GlobalDTSubProyectos(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveSubProyecto", "TipoSucursal = 1").ToEntero
Dim ObjFolio As New ClsGralFolios Dim ObjFolio As New ClsGralFolios
If ObjFolio.GetFolios("Con", UsuarioActual.CveEmpresa, CveSubProyecto:=CveSubProyecto) Then If ObjFolio.GetFolios("Con", UsuarioActual.CveEmpresa, CveSubProyecto:=-1) Then
If ObjFolio.DtResultados.Rows.Count > 0 Then If ObjFolio.DtResultados.Rows.Count > 0 Then
Dim drr As DataRow = ObjFolio.DtResultados.FiltroPrimero("") Dim drr As DataRow = ObjFolio.DtResultados.FiltroPrimero("")
LbFolio.Text = $"{drr("Serie").ToString}-{drr("FActual").ToString}" LbFolio.Text = $"{drr("Serie").ToString}-{drr("FActual").ToString}"
End If End If
End If End If
ObjFolio.Dispose()
UpTitulos.Update() UpModal.Update()
End Sub End Sub
#End Region #End Region
#Region "Contrato" #Region "Contrato"
@@ -189,12 +195,13 @@ Partial Class ListadoContratos
ErrorProceso = True ErrorProceso = True
End If End If
If Not ErrorProceso Then
'Aumentamos Folio 'Aumentamos Folio
Dim ObjFolios As New ClsGralFolios(ObjContratos.IniciaTransacSQL()) Dim ObjFolios As New ClsGralFolios(ObjContratos.IniciaTransacSQL())
If Not ObjFolios.UpdateFolioActual(DdlSubProyectoModal.SelectedValue.ToEntero, "Con", True, UsuarioActual.CveEmpresa) Then If Not ObjFolios.UpdateFolioActual(-1, "Con", True, UsuarioActual.CveEmpresa) Then
ErrorProceso = True ErrorProceso = True
End If End If
End If
If Not ErrorProceso Then If Not ErrorProceso Then
@@ -400,7 +407,74 @@ Partial Class ListadoContratos
#End Region #End Region
Protected Sub LnkAgregarContrato_Click(sender As Object, e As EventArgs) Protected Sub LnkAgregarContrato_Click(sender As Object, e As EventArgs)
CargaFolio()
RegistraScript("$('#ModalAgregar').modal({ backdrop: 'static', keyboard: false });") RegistraScript("$('#ModalAgregar').modal({ backdrop: 'static', keyboard: false });")
UpTitulos.Update() UpTitulos.Update()
End Sub End Sub
'Private Sub CargaFolios(Optional FacturarDocumentoNuevo As Boolean = False)
' Dim ObjFolios As New ClsGralFolios()
' Dim TipoDoctoConsulta As String = ""
' If ObjFolios.GetFolios(TipoDoctoConsulta, UsuarioActual.CveEmpresa) Then
' Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue))
' If DT.Rows.Count > 0 Then
' ViewState("CveFolio") = DT.Rows(0)("CveFolio").ToString().ToEntero()
' 'ViewState("NumAprobacion") = CLng(DT.Rows(0)("Aprobacion").ToString())
' 'ViewState("FechaAprobacion") = DT.Rows(0)("FechaAprobacion").ToString().ToDate
' ViewState("FolioActual") = DT.Rows(0)("FActual").ToString()
' If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso CveVenta > 0 AndAlso Not EsCreaApartirDe AndAlso Not String.IsNullOrEmpty(SerieVenta) Then
' LblSerie.Text = SerieVenta
' Else
' LblSerie.Text = DT.Rows(0)("Serie").ToString()
' End If
' TxtFolio.Text = DT.Rows(0)("FActual").ToString()
' If Not FacturarDocumentoNuevo Then
' If Not CveEmpresaCRM > 0 Then
' 'SI ES UNA REMISION EXISTENTE, NO MOSTRAR LOS BOTONES
' If Not (CveVenta > 0 AndAlso DdlTipoComprobante.SelectedValue = "Rem") Then
' BtnCrearApartirDe.Enabled = EstatusCliente AndAlso TieneBloqueoPorCreditoVencimiento = 0
' BtnEmitirImprimir.Visible = EstatusCliente AndAlso TieneBloqueoPorCreditoVencimiento = 0
' TrVistaPrevia.Visible = EstatusCliente
' End If
' Else
' If TipoDoctoConsulta.Contiene("Ing", "Egs", "Ant", "Dev") Then
' BtnCrearApartirDe.Enabled = EstatusCliente AndAlso TieneBloqueoPorCreditoVencimiento = 0
' BtnEmitirImprimir.Visible = EstatusCliente AndAlso TieneBloqueoPorCreditoVencimiento = 0
' TrVistaPrevia.Visible = EstatusCliente
' Else
' BtnCrearApartirDe.Enabled = True
' BtnEmitirImprimir.Visible = True
' TrVistaPrevia.Visible = True
' End If
' End If
' End If
' UpFacturar.Update()
' Else
' If DdlTipoComprobante.Items.Count > 0 Then
' Alert("No tiene registrados Folios para " & DdlTipoComprobante.SelectedItem.Text & " en esta sucursal.", TipoMensaje.MsgAdvertencia)
' Else
' Alert("No tiene permisos para generar ningun tipo de documento.", TipoMensaje.MsgAdvertencia)
' End If
' TrEmitir.Visible = False
' TrVistaPrevia.Visible = False
' BtnCrearApartirDe.Enabled = False
' BtnEmitirImprimir.Visible = False
' UpFacturar.Update()
' End If
' DT.Dispose()
' End If
' ObjFolios.Dispose()
' 'End If
'End Sub
End Class End Class

View File

@@ -19,6 +19,11 @@
<asp:Content ID="Content3" ContentPlaceHolderID="CP" runat="Server"> <asp:Content ID="Content3" ContentPlaceHolderID="CP" runat="Server">
</asp:Content> </asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="CSS" runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="CSS" runat="Server">
<style>
.font-green {
color: #26a69a !important;
}
</style>
</asp:Content> </asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="E" runat="Server"> <asp:Content ID="Content5" ContentPlaceHolderID="E" runat="Server">
Promociones Promociones
@@ -35,7 +40,7 @@
<div class="portlet-title"> <div class="portlet-title">
<div class="caption font-green"> <div class="caption font-green">
<i class="icon-pin font-green"></i> <i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">DATOS GENERALES</span> <span class="caption-subject font-green bold uppercase">DATOS GENERALES</span>
</div> </div>
<div class="actions"> <div class="actions">
<div class="btn-group"> <div class="btn-group">
@@ -180,7 +185,7 @@
<div class="portlet-title"> <div class="portlet-title">
<div class="caption font-green"> <div class="caption font-green">
<i class="icon-pin font-green"></i> <i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">PRODUCTOS / SERVICIOS</span> <span class="caption-subject font-green bold uppercase">PRODUCTOS / SERVICIOS</span>
</div> </div>
<div class="tools"> <div class="tools">
@@ -195,7 +200,7 @@
<div class="portlet-body form"> <div class="portlet-body form">
<asp:GridView ID="GvDatos" <asp:GridView ID="GvDatos"
DataKeyNames="CvePromocionDetalle, CveClasificacion, CvePS, CodigoPS, HoraInicio, HoraFin, CveTipoPromocion, Promocion, PUAnterior, AplicaRestriccion, AplicaLunes, AplicaMartes, AplicaMiercoles, AplicaJueves, AplicaViernes, AplicaSabado, AplicaDomingo, CantidadMinima, CveRinTamaño,IncluyeImpuestos" DataKeyNames="CvePromocionDetalle, CveClasificacion, CvePS, CodigoPS, HoraInicio, HoraFin, CveTipoPromocion, Promocion, PUAnterior, AplicaRestriccion, AplicaLunes, AplicaMartes, AplicaMiercoles, AplicaJueves, AplicaViernes, AplicaSabado, AplicaDomingo, CantidadMinima, CveRinTamaño,IncluyeImpuestos, UltimoCosto, CostoPromedio"
CssClass="table table-striped table-hover Widthall mysmallbtn" AutoGenerateColumns="false" GridLines="None" EmptyDataText="Aun no se registran detalles" runat="server" CssClass="table table-striped table-hover Widthall mysmallbtn" AutoGenerateColumns="false" GridLines="None" EmptyDataText="Aun no se registran detalles" runat="server"
OnRowDataBound="GvDatos_RowDataBound" OnRowDataBound="GvDatos_RowDataBound"
> >
@@ -276,7 +281,6 @@
<asp:UpdatePanel runat="server"> <asp:UpdatePanel runat="server">
<ContentTemplate> <ContentTemplate>
<asp:Button ID="BtnGuardar" Text="Guardar" CssClass="btn btn-primary" ValidationGroup="GrpGuardar" OnClick="BtnGuardar_Click" runat="server" /> <asp:Button ID="BtnGuardar" Text="Guardar" CssClass="btn btn-primary" ValidationGroup="GrpGuardar" OnClick="BtnGuardar_Click" runat="server" />
<asp:Button ID="ButBtnEliminar" Text="Eliminar" CssClass="btn btn-danger" OnClick="BtnEliminar_Click" runat="server" Visible="false" <asp:Button ID="ButBtnEliminar" Text="Eliminar" CssClass="btn btn-danger" OnClick="BtnEliminar_Click" runat="server" Visible="false"
data-toggle="confirmation" data-popout="true" data-original-title="Confirmar" data-btn-ok-label="si" data-toggle="confirmation" data-popout="true" data-original-title="Confirmar" data-btn-ok-label="si"
/> />
@@ -306,13 +310,23 @@
<div class="row"> <div class="row">
<label class="col-md-3 truncate">Producto:</label> <label class="col-md-3 truncate">Producto:</label>
<div class="col-md-9"> <div class="col-md-9">
<ADS:Dropdownlost runat="server" Enabled="true" ID="DdlPS" CssStyle="width: 100%;" CssClassDdl="select2me" DataTextField="PSCodigo" DataValueField="CvePS"/> <ADS:Dropdownlost runat="server" Enabled="true" ID="DdlPS" CssStyle="width: 100%;" CssClassDdl="select2me" DataTextField="PSCodigo" DataValueField="CvePS" Onselectedindexchange="DdlPS_selectedindexchange" />
</div>
</div>
<div class="row" style="display:none">
<label class="col-md-3 truncate">Ultimo Costo:</label>
<div class="col-md-3">
<asp:Label Text="" ID="LbPUActual" runat="server" />
</div> </div>
</div> </div>
<div class="row"> <div class="row">
<label class="col-md-3 truncate">P.U. Actual:</label> <label class="col-md-3 truncate">Ultimo Costo:</label>
<div class="col-md-9"> <div class="col-md-3">
<asp:Label Text="" ID="LbPUActual" runat="server" /> <asp:Label Text="" ID="LblUltimoCosto" runat="server" />
</div>
<label class="col-md-3 truncate">Costo Promedio:</label>
<div class="col-md-3">
<asp:Label Text="" ID="LblCostoPromedio" runat="server" />
</div> </div>
</div> </div>
<div class="row"> <div class="row">

View File

@@ -1,11 +1,13 @@
Option Explicit On Option Explicit On
Option Strict On Option Strict On
Imports System.Activities.Expressions
Imports System.Data Imports System.Data
Imports DocumentFormat.OpenXml.Drawing.Diagrams Imports DocumentFormat.OpenXml.Drawing.Diagrams
Imports Extensiones Imports Extensiones
Imports iText.StyledXmlParser.Css.Resolve.Shorthand.Impl Imports iText.StyledXmlParser.Css.Resolve.Shorthand.Impl
Imports Microsoft.Owin.Security.Provider Imports Microsoft.Owin.Security.Provider
Imports Telerik.Web.UI
Partial Class Ventas_Promociones Partial Class Ventas_Promociones
Inherits ClsPaginas Inherits ClsPaginas
@@ -59,7 +61,6 @@ Partial Class Ventas_Promociones
Private Property CvePromocionPadre As Integer Private Property CvePromocionPadre As Integer
Get Get
If ViewState("CvePromocionPadre") Is Nothing Then If ViewState("CvePromocionPadre") Is Nothing Then
ViewState("CvePromocionPadre") = -1 ViewState("CvePromocionPadre") = -1
End If End If
@@ -70,21 +71,114 @@ Partial Class Ventas_Promociones
End Set End Set
End Property End Property
Private Property PorMinMasCostoVentaFnc129 As Decimal
Get
If ViewState("PorMinMasCostoVentaFnc129") Is Nothing Then
ViewState("PorMinMasCostoVentaFnc129") = -1
End If
Return ViewState("PorMinMasCostoVentaFnc129").ToString.ToDecimal
End Get
Set(value As Decimal)
ViewState("PorMinMasCostoVentaFnc129") = value
End Set
End Property
'Private Property DTPSUltimoCosto As DataTable
' Get
' If ViewState("DTPSUltimoCosto") Is Nothing Then
' ViewState("DTPSUltimoCosto") = New DataTable
' End If
' Return CType(ViewState("DTPSUltimoCosto"), DataTable)
' End Get
' Set(value As DataTable)
' ViewState("DTPSUltimoCosto") = value
' End Set
'End Property
Private Property PermisoAutorizPromocionPorcentaje As Boolean
Get
If ViewState("PermisoAutorizPromocionPorcentaje") Is Nothing Then
ViewState("PermisoAutorizPromocionPorcentaje") = False
End If
Return Boolean.Parse(ViewState("PermisoAutorizPromocionPorcentaje").ToString)
End Get
Set(value As Boolean)
ViewState("PermisoAutorizPromocionPorcentaje") = value
End Set
End Property
Private Property BloqueadoPromocionPorcentaje As Boolean
Get
If ViewState("BloqueadoPromocionPorcentaje") Is Nothing Then
ViewState("BloqueadoPromocionPorcentaje") = False
End If
Return Boolean.Parse(ViewState("BloqueadoPromocionPorcentaje").ToString)
End Get
Set(value As Boolean)
ViewState("BloqueadoPromocionPorcentaje") = value
End Set
End Property
Private Property EmpresaFnc382 As Boolean
Get
If ViewState("EmpresaFnc382") Is Nothing Then
ViewState("EmpresaFnc382") = False
End If
Return Boolean.Parse(ViewState("EmpresaFnc382").ToString)
End Get
Set(value As Boolean)
ViewState("EmpresaFnc382") = value
End Set
End Property
Private Property EstatusOriginal As Boolean
Get
If ViewState("EstatusOriginal") Is Nothing Then
ViewState("EstatusOriginal") = False
End If
Return Boolean.Parse(ViewState("EstatusOriginal").ToString)
End Get
Set(value As Boolean)
ViewState("EstatusOriginal") = value
End Set
End Property
#End Region #End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then If Not Page.IsPostBack Then
PorMinMasCostoVentaFnc129 = UsuarioActual.Empresa.Funcionalidad(129).ToDecimal
PermisoAutorizPromocionPorcentaje = UsuarioActual.TienePermisoProceso(386)
EmpresaFnc382 = If(UsuarioActual.Empresa.Funcionalidad(382) = "1", True, False) 'Grupo díaz
'EmpresaFnc382 = True ''Para pruebas
CvePromocion = -1 CvePromocion = -1
CargaValoresIniciales() CargaValoresIniciales()
CargaMonedas() CargaMonedas()
CargaDTUltimoCosto()
If Request("CvePromocion") IsNot Nothing AndAlso Request("CvePromocion").ToString.ToEntero > 0 Then If Request("CvePromocion") IsNot Nothing AndAlso Request("CvePromocion").ToString.ToEntero > 0 Then
CvePromocion = Request("CvePromocion").ToString.ToEntero CvePromocion = Request("CvePromocion").ToString.ToEntero
CargaDatos() CargaDatos()
LnkAgrgarPlantillaPS.Visible = False LnkAgrgarPlantillaPS.Visible = False
ValidaPromosiones(False)
If EmpresaFnc382 AndAlso ChkEstatus.Checked = False AndAlso BloqueadoPromocionPorcentaje AndAlso Not PermisoAutorizPromocionPorcentaje Then
ChkEstatus.Enabled = False
End If
Else Else
ChkEstatus.Enabled = True ChkEstatus.Enabled = True
ChkEstatus.Checked = True ChkEstatus.Checked = True
@@ -219,6 +313,9 @@ Partial Class Ventas_Promociones
TempDT.Columns.Add("IncluyeImpuestos", GetType(Boolean)) TempDT.Columns.Add("IncluyeImpuestos", GetType(Boolean))
TempDT.Columns.Add("UltimoCosto", GetType(Decimal))
TempDT.Columns.Add("CostoPromedio", GetType(Decimal))
TempDTOrigial = TempDT.Copy TempDTOrigial = TempDT.Copy
@@ -244,6 +341,26 @@ Partial Class Ventas_Promociones
End Sub
Private Sub CargaDTUltimoCosto()
If EmpresaFnc382 Then
Dim DTPSUltimoCosto = New DataTable
Dim ObjInv As New ClsInventarios
If ObjInv.GetUltimoCosto(UsuarioActual.CveEmpresa) Then
DTPSUltimoCosto = ObjInv.DtResultados
End If
ObjInv.Dispose()
End If
End Sub End Sub
#Region " PS " #Region " PS "
@@ -305,6 +422,7 @@ Partial Class Ventas_Promociones
End If End If
ChkEstatus.Checked = If(Dr("Estatus").ToString = "True", True, False) ChkEstatus.Checked = If(Dr("Estatus").ToString = "True", True, False)
EstatusOriginal = ChkEstatus.Checked
DdlMoneda.SelectedValueExist(Dr("CveMoneda").ToString) DdlMoneda.SelectedValueExist(Dr("CveMoneda").ToString)
DdlMarca.SelectedValueExist(Dr("CveMarca").ToString) DdlMarca.SelectedValueExist(Dr("CveMarca").ToString)
DdlTipoAplicacion.SelectedValueExist(Dr("TipoAplicacion").ToString) DdlTipoAplicacion.SelectedValueExist(Dr("TipoAplicacion").ToString)
@@ -356,6 +474,10 @@ Partial Class Ventas_Promociones
ChangeDdlProducto() ChangeDdlProducto()
LbPUActual.Text = "" LbPUActual.Text = ""
LblCostoPromedio.Text = ""
LblUltimoCosto.Text = ""
DdlTipoPromocion.SelectedValue = "-1" DdlTipoPromocion.SelectedValue = "-1"
TxtPromocionConcepto.Text = "" TxtPromocionConcepto.Text = ""
TxtCantMinima.Text = "1" TxtCantMinima.Text = "1"
@@ -423,6 +545,10 @@ Partial Class Ventas_Promociones
Dr("CodigoPS") = If(String.IsNullOrEmpty(DdlPS.SelectedText), "Todos", DdlPS.SelectedText) Dr("CodigoPS") = If(String.IsNullOrEmpty(DdlPS.SelectedText), "Todos", DdlPS.SelectedText)
Dr("PUAnterior") = LbPUActual.Text.ToDecimal Dr("PUAnterior") = LbPUActual.Text.ToDecimal
Dr("UltimoCosto") = LblUltimoCosto.Text.ToDecimal
Dr("CostoPromedio") = LblCostoPromedio.Text.ToDecimal
Dr("CveTipoPromocion") = DdlTipoPromocion.SelectedValue.ToEntero Dr("CveTipoPromocion") = DdlTipoPromocion.SelectedValue.ToEntero
Dr("TipoPromocion") = DdlTipoPromocion.SelectedItem.Text Dr("TipoPromocion") = DdlTipoPromocion.SelectedItem.Text
Dr("Promocion") = TxtPromocionConcepto.Text Dr("Promocion") = TxtPromocionConcepto.Text
@@ -478,7 +604,78 @@ Partial Class Ventas_Promociones
CargaGrid() CargaGrid()
RegistraScript("$('#DivAgregar').modal('hide')") RegistraScript("$('#DivAgregar').modal('hide')")
ValidaPromosiones(True)
End Sub End Sub
Private Sub ValidaPromosiones(Bloquear As Boolean)
If Not EmpresaFnc382 Then
BloqueadoPromocionPorcentaje = False
Exit Sub
End If
Dim DTPSUltimoCosto = New DataTable
Dim ObjInv As New ClsInventarios
If ObjInv.GetUltimoCosto(UsuarioActual.CveEmpresa) Then
DTPSUltimoCosto = ObjInv.DtResultados
End If
ObjInv.Dispose()
If PorMinMasCostoVentaFnc129 > 0 Then
For Each dRow As DataRow In TempDT.Rows
Dim CvePS As Integer = dRow("CvePS").ToString.ToEntero
Dim UltimoCosto As Decimal = dRow("UltimoCosto").ToString.ToDecimal
Dim CveTipoPromocion As Integer = dRow("CveTipoPromocion").ToString.ToEntero ' 1 importe 2 % descuento
Dim Promocion As Decimal = dRow("Promocion").ToString.ToDecimal
If UltimoCosto = 0 Then
UltimoCosto = DTPSUltimoCosto.FiltroPrimeroValor("UltimoCosto", $"CvePS = {CvePS}").ToDecimal
End If
If CvePS > 0 AndAlso UltimoCosto > 0 AndAlso CveTipoPromocion.Contiene(1, 2) Then
If CveTipoPromocion = 1 Then 'importe
'Sacamos el porcentaje
Dim PorDescuento As Decimal = 100 - ((Promocion * 100) / UltimoCosto)
If PorDescuento > PorMinMasCostoVentaFnc129 Then
BloqueadoPromocionPorcentaje = True
Exit For
End If
ElseIf CveTipoPromocion = 2 Then '% descuento
If Promocion > PorMinMasCostoVentaFnc129 Then
BloqueadoPromocionPorcentaje = True
Exit For
End If
End If
End If
Next
End If
If BloqueadoPromocionPorcentaje AndAlso Bloquear Then
ChkEstatus.Checked = False
ChkEstatus.Enabled = False
End If
UpGenerales.Update()
End Sub
Protected Sub ChkRestricciones_CheckedChanged(sender As Object, e As EventArgs) Protected Sub ChkRestricciones_CheckedChanged(sender As Object, e As EventArgs)
DivRestricciones.Visible = ChkRestricciones.Checked DivRestricciones.Visible = ChkRestricciones.Checked
End Sub End Sub
@@ -509,6 +706,9 @@ Partial Class Ventas_Promociones
End If End If
LbPUActual.Text = Gvr.DataKey("PUAnterior").FormatoNumero LbPUActual.Text = Gvr.DataKey("PUAnterior").FormatoNumero
LblUltimoCosto.Text = Gvr.DataKey("UltimoCosto").FormatoNumero
LblCostoPromedio.Text = Gvr.DataKey("CostoPromedio").FormatoNumero
DdlTipoPromocion.SelectedValue = Gvr.DataKey("CveTipoPromocion") DdlTipoPromocion.SelectedValue = Gvr.DataKey("CveTipoPromocion")
'DdlTipoPromocion_SelectedIndexChanged(sender, Nothing) 'DdlTipoPromocion_SelectedIndexChanged(sender, Nothing)
TxtPromocionConcepto.Text = Gvr.DataKey("Promocion").FormatoNumero(4) TxtPromocionConcepto.Text = Gvr.DataKey("Promocion").FormatoNumero(4)
@@ -560,6 +760,9 @@ Partial Class Ventas_Promociones
Private Sub GuardaPromocion() Private Sub GuardaPromocion()
ValidaPromosiones(True)
Dim CveCliente As Integer = If(DdlClientes.SelectedValue = "", -1, DdlClientes.SelectedValue.ToEntero) Dim CveCliente As Integer = If(DdlClientes.SelectedValue = "", -1, DdlClientes.SelectedValue.ToEntero)
Dim ObjVentas As New ClsVentas Dim ObjVentas As New ClsVentas
Dim TieneError As Boolean = False Dim TieneError As Boolean = False
@@ -599,6 +802,11 @@ Partial Class Ventas_Promociones
End If End If
ObjVentas.Dispose() ObjVentas.Dispose()
If Not TieneError AndAlso BloqueadoPromocionPorcentaje Then
MandaCorreoNotificacionPromocionBloqueo(CvePromocion, TxtPromocion.Text.Trim)
End If
End Sub End Sub
@@ -654,24 +862,6 @@ Partial Class Ventas_Promociones
If Not TieneError Then If Not TieneError Then
'366 Estatus
'367 CvePS
'368 PUPromocion
'369 CveTipoPromocion
'370 Cantidad Minima
'371 AplicaRestriccion
'372 HoraInicio
'373 HoraFin
'374 AplicaLunes
'375 AplicaMartes
'376 AplicaMiercoles
'377 AplicaJueves
'378 AplicaViernes
'379 AplicaSabado
'380 AplicaDomingo
'381 IncluyeImpuestos
Dim Dr2 As DataRow = TempDTOrigial.FiltraParametros($"CvePromocionDetalle = {Dr("CvePromocionDetalle").ToString}").Rows(0) Dim Dr2 As DataRow = TempDTOrigial.FiltraParametros($"CvePromocionDetalle = {Dr("CvePromocionDetalle").ToString}").Rows(0)
@@ -700,12 +890,7 @@ Partial Class Ventas_Promociones
End If End If
'If Not TieneError And Dr("AplicaRestriccion").ToString <> Dr2("AplicaRestriccion").ToString Then
' If Not ObjGral.AddHistorialBitacora(371, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Dr2("AplicaRestriccion").ToString, $"{Dr("CodigoPS").ToString} - {Dr("AplicaRestriccion").ToString}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, "Se elimino " & Dr("CodigoPS").ToString, "PS", "", CvePromocion:=CvePromocion) Then
' TieneError = True
' Exit For
' End If
'End If
If Not TieneError And Dr("HoraInicio").ToString <> Dr2("HoraInicio").ToString Then If Not TieneError And Dr("HoraInicio").ToString <> Dr2("HoraInicio").ToString Then
If Not ObjGral.AddHistorialBitacora(372, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Dr("HoraInicio").ToString, $"{Dr("CodigoPS").ToString} - {Dr2("HoraInicio").ToString}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, "Se elimino " & Dr("CodigoPS").ToString, "PS", "", CvePromocion:=CvePromocion) Then If Not ObjGral.AddHistorialBitacora(372, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Nothing, Dr("HoraInicio").ToString, $"{Dr("CodigoPS").ToString} - {Dr2("HoraInicio").ToString}", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, "Se elimino " & Dr("CodigoPS").ToString, "PS", "", CvePromocion:=CvePromocion) Then
@@ -847,6 +1032,15 @@ Partial Class Ventas_Promociones
TieneError = True TieneError = True
End If End If
If EmpresaFnc382 AndAlso EstatusOriginal = False AndAlso ChkEstatus.Checked And BloqueadoPromocionPorcentaje Then
Dim objGeneral As New ClsGenerales(ObjVentas.IniciaTransacSQL)
If Not objGeneral.AddHistorialBitacora(360, -1, -1, -1, -1, -1, -1, -1, "Se Autorizo con bloqueo", "No", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0, "", "", "", CvePromocion:=CvePromocion) Then
TieneError = True
End If
End If
If UsuarioActual.Empresa.Funcionalidad(563) <> "" Then If UsuarioActual.Empresa.Funcionalidad(563) <> "" Then
If Not ObjVentas.SincronizarPromocionesClonar(CvePromocion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 2) Then If Not ObjVentas.SincronizarPromocionesClonar(CvePromocion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 2) Then
@@ -867,6 +1061,51 @@ Partial Class Ventas_Promociones
End Sub End Sub
#End Region #End Region
#Region "ENVIAR CORREO PROMOSION BLOQUEADA"
Private Sub MandaCorreoNotificacionPromocionBloqueo(CvePromocionNueva As Integer, PromocionNueva As String)
Dim Asunto, Para, ArrayCC, Body, URL As String
Asunto = $"Promoción {PromocionNueva} requiere autorización"
Para = ""
ArrayCC = ""
URL = ""
If Request.Url.Port = 80 Then
URL = $"{Request.Url.Scheme}://{Request.Url.Host}{Request.Url.AbsolutePath}?CvePromocion={CvePromocionNueva}"
Else
URL = $"{Request.Url.Scheme}://{Request.Url.Host}:{Request.Url.Port}{Request.Url.AbsolutePath}?CvePromocion={CvePromocionNueva}"
End If
Body = $"Se a registrado promoción que requiere autorización <a href='{URL}' >{PromocionNueva}</a>"
Dim objUsu As New ClsSisUsuarios
Dim ListaCorreos As New List(Of String)
If objUsu.GetPermisosPorUsuarioProcesos(-1, -1, -1, -1, 386, CveEmpresa:=UsuarioActual.CveEmpresa) Then
For Each dRow As DataRow In objUsu.DtResultados.Rows
If dRow("Correo").ToString.Trim.Length > 0 Then
ListaCorreos.Add(dRow("Correo").ToString)
End If
Next
End If
objUsu.Dispose()
If ListaCorreos.Count > 0 Then
Para = String.Join(";", ListaCorreos)
Dim Mail As New ClsSisMail()
Dim LSRutasMail As New List(Of ClsSisMail.ArchivoMail)
Mail.SendMail(ClsPaginas.EmpresaNotificaciones, Para, Asunto, Body, ArrayCC, LSRutasMail)
End If
End Sub
#End Region
#Region " ELIMINAR " #Region " ELIMINAR "
Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs) Protected Sub BtnEliminar_Click(sender As Object, e As EventArgs)
@@ -912,22 +1151,6 @@ Partial Class Ventas_Promociones
End Sub End Sub
#End Region #End Region
'Protected Sub DdlTipoPromocion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoPromocion.SelectedIndexChanged
' If DdlTipoPromocion.SelectedValue = "3" Then
' DivCantMinima.Visible = True
' Else
' DivCantMinima.Visible = False
' End If
'End Sub
Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Protected Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs)
@@ -1092,11 +1315,6 @@ Partial Class Ventas_Promociones
ObjPS.Dispose() ObjPS.Dispose()
'Dim ObjGral As New ClsGenerales
'If ObjGral.GetRinTamanios(UsuarioActual.CveEmpresa) Then
' DTRines = ObjGral.DtResultados
'End If
'ObjGral.Dispose()
DTRines = GlobalDTPSRinTamaños(UsuarioActual.CveEmpresa) DTRines = GlobalDTPSRinTamaños(UsuarioActual.CveEmpresa)
Dim RegistroActual As Integer = 1 Dim RegistroActual As Integer = 1
@@ -1106,8 +1324,6 @@ Partial Class Ventas_Promociones
Dim ClasificacionStr, CodigoStr, TipoPromocionStr, PromocionStr, CantidadMinimaStr, RinStr, IncluyeImpuestosStr As String Dim ClasificacionStr, CodigoStr, TipoPromocionStr, PromocionStr, CantidadMinimaStr, RinStr, IncluyeImpuestosStr As String
ClasificacionStr = dRow("Clasificacion").ToString.Trim ClasificacionStr = dRow("Clasificacion").ToString.Trim
CodigoStr = dRow("Codigo").ToString.Trim CodigoStr = dRow("Codigo").ToString.Trim
TipoPromocionStr = dRow("TipoPromocion").ToString.Trim TipoPromocionStr = dRow("TipoPromocion").ToString.Trim
@@ -1185,7 +1401,6 @@ Partial Class Ventas_Promociones
Next Next
If Errores.ToString.Length = 0 Then If Errores.ToString.Length = 0 Then
DTPlantilla.AcceptChanges() DTPlantilla.AcceptChanges()
Return True Return True
@@ -1194,8 +1409,23 @@ Partial Class Ventas_Promociones
Return False Return False
End If End If
End Function End Function
Protected Sub DdlPS_selectedindexchange(sender As Object, e As EventArgs)
Dim DTPSUltimoCosto = New DataTable
Dim ObjInv As New ClsInventarios
If ObjInv.GetUltimoCosto(UsuarioActual.CveEmpresa) Then
DTPSUltimoCosto = ObjInv.DtResultados
End If
ObjInv.Dispose()
LblUltimoCosto.Text = DTPSUltimoCosto.FiltroPrimeroValor("UltimoCosto", $"CvePS = {DdlPS.SelectedValue}").FormatoNumero
LblCostoPromedio.Text = DTPSUltimoCosto.FiltroPrimeroValor("CostoPromedio", $"CvePS = {DdlPS.SelectedValue}").FormatoNumero
UpAgregar.Update()
End Sub
End Class End Class

View File

@@ -19,9 +19,19 @@
</asp:Content> </asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
<asp:UpdatePanel runat="server" ID="UpAcciones" UpdateMode="Always">
<ContentTemplate>
<li> <li>
<asp:LinkButton ID="LnkImprimirPedidos" runat="server" Visible="false" OnClick="LnkImprimirPedidos_Click"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Imprimir Pedidos</asp:LinkButton>
</li> </li>
<li>
<asp:LinkButton runat="server" ID="BtnHorariosPedidos" OnClick="BtnHorariosPedidos_Click" data-toggle="tooltip" data-placement="left" title="Agregar Horario" Text="Horarios de Pedidos"></asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkImprimirPedidos" />
</Triggers>
</asp:UpdatePanel>
</asp:Content> </asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server"> <asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
@@ -129,6 +139,10 @@
<asp:Label ID="LblCliente" runat="server" Text='<%#Eval("NombreComercial") %>'></asp:Label><br /> <asp:Label ID="LblCliente" runat="server" Text='<%#Eval("NombreComercial") %>'></asp:Label><br />
<asp:Label ID="LblDir" Font-Italic="true" runat="server" Text='<%#Eval("DireccionEnvio") %>'></asp:Label> <asp:Label ID="LblDir" Font-Italic="true" runat="server" Text='<%#Eval("DireccionEnvio") %>'></asp:Label>
</ItemTemplate> </ItemTemplate>
<HeaderTemplate>
Sucursal<br />
<asp:Label ID="LblDir3" Font-Italic="true" runat="server" Text="Dirección"></asp:Label>
</HeaderTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="SerieFolio" ItemStyle-HorizontalAlign="Left"> <asp:TemplateField HeaderText="SerieFolio" ItemStyle-HorizontalAlign="Left">
@@ -145,7 +159,7 @@
<asp:TemplateField ItemStyle-HorizontalAlign="Right" HeaderText="Cantidad"> <asp:TemplateField ItemStyle-HorizontalAlign="Right" HeaderText="Cantidad">
<EditItemTemplate> <EditItemTemplate>
<asp:TextBox ID="TxtCantidad" runat="server" CausesValidation="true" MaxLength="12" style="text-align:right" Text='<%# Eval("Cantidad", "{0:0.######}") %>' Width="45px" Height="24px"></asp:TextBox> <asp:TextBox ID="TxtCantidad" runat="server" CausesValidation="true" MaxLength="12" Style="text-align: right" Text='<%# Eval("Cantidad", "{0:0.######}") %>' Width="45px" Height="24px"></asp:TextBox>
<ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtCantidad" FilterType="Custom" ValidChars="1234567890." /> <ajax:FilteredTextBoxExtender runat="server" TargetControlID="TxtCantidad" FilterType="Custom" ValidChars="1234567890." />
</EditItemTemplate> </EditItemTemplate>
<ItemTemplate> <ItemTemplate>
@@ -163,7 +177,11 @@
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="Obs" ItemStyle-HorizontalAlign="Left">
<ItemTemplate>
<asp:Label ID="LblObs" runat="server" Text ='<%#Eval("Observaciones") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Vendedor" ItemStyle-HorizontalAlign="Left"> <asp:TemplateField HeaderText="Vendedor" ItemStyle-HorizontalAlign="Left">
<ItemTemplate> <ItemTemplate>
<asp:Label ID="LblVendedor" runat="server" Text='<%#Eval("Vendedor") %>'></asp:Label> <asp:Label ID="LblVendedor" runat="server" Text='<%#Eval("Vendedor") %>'></asp:Label>
@@ -228,6 +246,58 @@
</ajax:TabContainer> </ajax:TabContainer>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<div id="divHorariosPedidos" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<asp:UpdatePanel ID="UpHorariosPedidos" class="modal-content rowpadding" 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">Horario de Pedidos</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel ID="UpBodyHorariosPedidos" UpdateMode="Conditional" runat="server">
<ContentTemplate>
<div class="row">
<div class="col-lg-6">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtHorarioDe" runat="server" CausesValidation="true" CssClass="form-control" MaxLength="10" Width="104px"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVHorarioDe" runat="server" ControlToValidate="TxtHorarioDe" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Hr. Inicio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOHorarioDe1" runat="server" HighlightCssClass="vco" TargetControlID="RFVHorarioDe" Width="300px"></ajax:ValidatorCalloutExtender>
<ajax:MaskedEditExtender ID="MEEHorarioDe" runat="server" TargetControlID="TxtHorarioDe" Mask="99:99" MaskType="Time" InputDirection="RightToLeft"></ajax:MaskedEditExtender>
<ajax:MaskedEditValidator ID="MEVHorarioDe" runat="server" ControlExtender="MEEHorarioDe" ControlToValidate="TxtHorarioDe" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Hr. Inicio''</b> no tiene el formato correcto, por favor corrija (Formato 24 Horas)." IsValidEmpty="true" MaximumValue="23:59:59" MinimumValue="00:00:00" ToolTip="Formato 24 Horas" ValidationGroup="GrpObligatorio"></ajax:MaskedEditValidator>
<ajax:ValidatorCalloutExtender ID="VCOHorarioDe2" runat="server" HighlightCssClass="vco" TargetControlID="MEVHorarioDe"></ajax:ValidatorCalloutExtender>
<label for="<%= TxtHorarioDe.ClientID.ToString()%>">Hora Inicio:</label>
</div>
</div>
<div class="col-lg-6">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtHorarioA" runat="server" CausesValidation="true" CssClass="form-control" MaxLength="10" Width="84px" ValidationGroup="GrpObligatorio"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVHorarioA" runat="server" ControlToValidate="TxtHorarioA" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Hr. Fin''</b> es necesario, por favor ingréselo." ValidationGroup="GrpObligatorio"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOHorarioA1" runat="server" HighlightCssClass="vco" TargetControlID="RFVHorarioA" Width="300px"></ajax:ValidatorCalloutExtender>
<ajax:MaskedEditExtender ID="MEEHorarioA" runat="server" TargetControlID="TxtHorarioA" Mask="99:99" MaskType="Time" InputDirection="RightToLeft"></ajax:MaskedEditExtender>
<ajax:MaskedEditValidator ID="MEVHorarioA" runat="server" ControlExtender="MEEHorarioA" ControlToValidate="TxtHorarioA" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Hr. Fin''</b> no tiene el formato correcto, por favor corrija (Formato 24 Horas)." IsValidEmpty="true" MaximumValue="23:59:59" MinimumValue="00:00:00" ToolTip="Formato 24 Horas" ValidationGroup="GrpObligatorio"></ajax:MaskedEditValidator>
<ajax:ValidatorCalloutExtender ID="VCOHorarioA2" runat="server" HighlightCssClass="vco" TargetControlID="MEVHorarioA"></ajax:ValidatorCalloutExtender>
<label for="<%= TxtHorarioDe.ClientID.ToString()%>">Hora Fin:</label>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="modal-footer">
<asp:UpdatePanel ID="UpFooterHorariosPedidos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:LinkButton ID="BtnEditarHorariosPedidos" runat="server" CssClass="btn btn-primary" OnClick="BtnEditarHorariosPedidos_Click" ValidationGroup="GrpObligatorio">Guardar</asp:LinkButton>
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</asp:Content> </asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">

View File

@@ -5,6 +5,7 @@ Imports System.Activities.Expressions
Imports System.Data Imports System.Data
Imports DocumentFormat.OpenXml.Office.CustomUI Imports DocumentFormat.OpenXml.Office.CustomUI
Imports Extensiones Imports Extensiones
Imports Microsoft.Reporting.WebForms
Partial Class Ventas_RepPedidosSTF Partial Class Ventas_RepPedidosSTF
Inherits ClsPaginas Inherits ClsPaginas
@@ -66,6 +67,8 @@ Partial Class Ventas_RepPedidosSTF
End Sub End Sub
Protected Sub CargaDatos() Protected Sub CargaDatos()
LnkImprimirPedidos.Visible = False
DatosGV = New DataTable DatosGV = New DataTable
@@ -97,7 +100,9 @@ Partial Class Ventas_RepPedidosSTF
DatosGV.Columns.Add("CodigoPSOrg", GetType(String)) DatosGV.Columns.Add("CodigoPSOrg", GetType(String))
GvDatos.DataSource = DatosGV GvDatos.DataSource = DatosGV
If DatosGV IsNot Nothing AndAlso DatosGV.Rows.Count > 0 Then
LnkImprimirPedidos.Visible = True
End If
End If End If
ObjVentas.Dispose() ObjVentas.Dispose()
GvDatos.DataBind() GvDatos.DataBind()
@@ -113,7 +118,17 @@ Partial Class Ventas_RepPedidosSTF
DTProductosEdicion = New DataTable DTProductosEdicion = New DataTable
Dim ObjVentas As ClsVentas = New ClsVentas() Dim ObjVentas As ClsVentas = New ClsVentas()
If ObjVentas.GetPSSubProyectosVendedores(UsuarioActual.CveEmpresa) Then If ObjVentas.GetPSSubProyectosVendedores(UsuarioActual.CveEmpresa) Then
DTProductosEdicion = ObjVentas.DtResultados.FiltraParametros($" CveVendedor = {UsuarioActual.CveVendedor}")
DTProductosEdicion = ObjVentas.DtResultados
'If UsuarioActual.CveRol = 1 Then
' DTProductosEdicion = ObjVentas.DtResultados.FiltraParametros("", "CodigoPS", {"CvePS", "CodigoPS", "Precio"})
'Else
' DTProductosEdicion = ObjVentas.DtResultados.FiltraParametros($" CveVendedor = {UsuarioActual.CveVendedor}")
'End If
End If End If
ObjVentas.Dispose() ObjVentas.Dispose()
@@ -137,7 +152,7 @@ Partial Class Ventas_RepPedidosSTF
If e.Row.DBCampo("CveVendedor") = "" OrElse e.Row.DBCampo("CvePS") = "" Then If e.Row.DBCampo("CveVendedor") = "" OrElse e.Row.DBCampo("CvePS") = "" Then
Else Else
e.Row.FCDropDownList("DdlPS").DataSource = DTProductosEdicion e.Row.FCDropDownList("DdlPS").DataSource = DTProductosEdicion.FiltraParametros($"CveVendedor = {e.Row.DataKey("CveVendedor")}")
e.Row.FCDropDownList("DdlPS").DataBind() e.Row.FCDropDownList("DdlPS").DataBind()
e.Row.FCDropDownList("DdlPS").SelectedValueExist(e.Row.DBCampo("CvePS")) e.Row.FCDropDownList("DdlPS").SelectedValueExist(e.Row.DBCampo("CvePS"))
@@ -232,6 +247,7 @@ Partial Class Ventas_RepPedidosSTF
TmpDTRemis.Columns.Add("GastosEnvio", GetType(Decimal)) TmpDTRemis.Columns.Add("GastosEnvio", GetType(Decimal))
TmpDTRemis.Columns.Add("Observacion", GetType(String)) TmpDTRemis.Columns.Add("Observacion", GetType(String))
TmpDTRemis.Columns.Add("CantidadOrg", GetType(Decimal)) TmpDTRemis.Columns.Add("CantidadOrg", GetType(Decimal))
TmpDTRemis.Columns.Add("CvePSOrg", GetType(Integer)) TmpDTRemis.Columns.Add("CvePSOrg", GetType(Integer))
TmpDTRemis.Columns.Add("CodigoPSOrg", GetType(String)) TmpDTRemis.Columns.Add("CodigoPSOrg", GetType(String))
@@ -256,11 +272,22 @@ Partial Class Ventas_RepPedidosSTF
drp("CvePSOrg") = gvr.DataKey("CvePSOrg").ToEntero drp("CvePSOrg") = gvr.DataKey("CvePSOrg").ToEntero
drp("CodigoPSOrg") = gvr.DataKey("CodigoPSOrg") drp("CodigoPSOrg") = gvr.DataKey("CodigoPSOrg")
TmpDTRemis.Rows.Add(drp) TmpDTRemis.Rows.Add(drp)
End If End If
Next Next
Dim DTDeriesFolio As DataTable = TmpDTRemis.FiltraParametros("", "", {"Observacion"})
Dim Observaciones As String = ""
Dim lista As New List(Of String)
For Each drow As DataRow In DTDeriesFolio.Rows
lista.Add(drow("Observacion").ToString)
Next
Observaciones = String.Join(", ", lista)
If TmpDTRemis IsNot Nothing AndAlso TmpDTRemis.Rows.Count = 0 Then If TmpDTRemis IsNot Nothing AndAlso TmpDTRemis.Rows.Count = 0 Then
Alert("No se ha seleccionado ninguna partida, favor de seleccionar", TipoMensaje.MsgAdvertencia) Alert("No se ha seleccionado ninguna partida, favor de seleccionar", TipoMensaje.MsgAdvertencia)
@@ -275,7 +302,10 @@ Partial Class Ventas_RepPedidosSTF
For Each drt As DataRow In TmpDTRemis.FiltraParametros("", DistinctColumns:={"CveCliente", "CveSubProyecto", "CveVendedor", "GastosEnvio"}).Rows For Each drt As DataRow In TmpDTRemis.FiltraParametros("", DistinctColumns:={"CveCliente", "CveSubProyecto", "CveVendedor", "GastosEnvio"}).Rows
Dim ObjFactura As Modelos.Factura = Modelos.Factura.CrearVentaNueva(UsuarioActual, drt("CveSubProyecto").ToString.ToEntero, drt("CveCliente").ToString.ToEntero, 1, "Rem") Dim ObjFactura As Modelos.Factura = Modelos.Factura.CrearVentaNueva(UsuarioActual, drt("CveSubProyecto").ToString.ToEntero, drt("CveCliente").ToString.ToEntero, 1, "Rem")
ObjFactura.CveVendedor = drt("CveVendedor").ToString.ToEntero ObjFactura.CveVendedor = drt("CveVendedor").ToString.ToEntero
ObjFactura.Observaciones = Observaciones
For Each dr As DataRow In TmpDTRemis.FiltraParametros($"CveCliente ={drt("CveCliente")} AND CveVendedor = {drt("CveVendedor")} AND CveSubProyecto = {drt("CveSubProyecto")}").Rows For Each dr As DataRow In TmpDTRemis.FiltraParametros($"CveCliente ={drt("CveCliente")} AND CveVendedor = {drt("CveVendedor")} AND CveSubProyecto = {drt("CveSubProyecto")}").Rows
If ObjFactura IsNot Nothing Then If ObjFactura IsNot Nothing Then
@@ -296,7 +326,7 @@ Partial Class Ventas_RepPedidosSTF
TieneError = True TieneError = True
Exit For Exit For
Else Else
If Not ObjA.UpdateEstatusAlmacen(dr("CveVentaDetalle").ToString.ToEntero, 0) Then If Not ObjA.UpdateEstatusAlmacen(dr("CveVentaDetalle").ToString.ToEntero, 1) Then
TieneError = True TieneError = True
End If End If
End If End If
@@ -343,4 +373,83 @@ Partial Class Ventas_RepPedidosSTF
End If End If
End Sub End Sub
Protected Sub LnkImprimirPedidos_Click(sender As Object, e As EventArgs)
Dim FechaI As String = txtFechaI.Text
Dim FechaF As String = txtFechaF.Text
If txtFechaI.Text = "" Then FechaI = "-1"
If txtFechaF.Text = "" Then FechaF = "-1"
Dim Sucursal As String = If(DdlSubProyecto.SelectedValue = "-1", "", $"&emsp;<b>Sucursal:</b>&nbsp;{DdlSubProyecto.SelectedItem.Text}")
Dim Vendedor As String = If(DdlVendedor.SelectedValue = "-1", "", $"&emsp;<b>Vendedor:</b>&nbsp;{DdlVendedor.SelectedItem.Text}")
Dim FechaIn As String = If(txtFechaI.Text = "", "", $"&emsp;<b>Fecha Inicio:</b>&nbsp;{txtFechaI.Text}")
Dim FechaFn As String = If(txtFechaF.Text = "", "", $"&emsp;<b>Fecha Fin:</b>&nbsp;{txtFechaF.Text}")
Dim TituloReporte As String = "Reporte de Pedidos"
If DatosGV.Rows.Count > 0 Then
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/RepProveedorCxP.rpt", UsuarioActual.Empresa.Ruta))
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim params As New List(Of ReportParameter)
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("FechaInicio", FechaI))
params.Add(New ReportParameter("FechaFin", FechaF))
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", NowADS().ToDateTime.ToShortDateString))
params.Add(New ReportParameter("TituloReporte", TituloReporte))
params.Add(New ReportParameter("AgrupadoPor", $" {Sucursal}{Vendedor}{FechaIn}{FechaFn}"))
If Imagen.Exists Then ''POR EMPRESA
params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}"))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If
ImprimirPDF("Empresas/Grales/Formatos/RepPedidos.rdlc", DatosGV, params, "ReportePedidos")
Else
Alert("No hay datos consultados", TipoMensaje.MsgAdvertencia)
End If
End Sub
Protected Sub BtnEditarHorariosPedidos_Click(sender As Object, e As EventArgs)
Dim objSisEmpresas As New ClsSisEmpresas
If objSisEmpresas.UpdateEmpresaFuncionalidad(546, $"{TxtHorarioDe.Text}|{TxtHorarioA.Text}", UsuarioActual.CveEmpresa) Then
If objSisEmpresas.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then
Dim dttmp As Data.DataTable = objSisEmpresas.DtResultados
Dim EmpresasFuncionalidades As New HybridDictionary
For Each Row As Data.DataRow In dttmp.Rows
EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString)
Next
UsuarioActual.Empresa.SetFuncionalidades(EmpresasFuncionalidades)
End If
Alert("Guardado correctamente.")
RegistraScript("$('#divHorariosPedidos').modal('hide');")
End If
objSisEmpresas.Dispose()
End Sub
Protected Sub BtnHorariosPedidos_Click(sender As Object, e As EventArgs)
Dim objSisEmpresas As New ClsSisEmpresas
If objSisEmpresas.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then
Dim dttmp As Data.DataTable = objSisEmpresas.DtResultados
Dim EmpresasFuncionalidades As New HybridDictionary
For Each Row As Data.DataRow In dttmp.Rows
EmpresasFuncionalidades.Add(Convert.ToInt32(Row("CveFuncionalidad")), Row("Valor").ToString)
Next
UsuarioActual.Empresa.SetFuncionalidades(EmpresasFuncionalidades)
End If
objSisEmpresas.Dispose()
TxtHorarioDe.Text = UsuarioActual.Empresa.Funcionalidad(546).Split("|"c)(0)
TxtHorarioA.Text = UsuarioActual.Empresa.Funcionalidad(546).Split("|"c)(1)
UpBodyHorariosPedidos.Update()
RegistraScript("$('#divHorariosPedidos').modal({ backdrop: 'static', keyboard: false});")
End Sub
End Class End Class

View File

@@ -242,7 +242,9 @@
<asp:HyperLinkField ItemStyle-HorizontalAlign="Left" Target="_blank" HeaderText="Grupo" DataTextField="GPO" DataNavigateUrlFields="FechaI,FechaF,CveSubProyecto,CveCliente,CveVendedor,Grupo,GPO,CvePS,CveClasificacion,CveMarca,CveCategoria" DataNavigateUrlFormatString="RepVentasUtilidad.aspx?FechaI={0}&FechaF={1}&CveSubProyecto={2}&CveCliente={3}&CveVendedor={4}&Gpo={5}&CveGpo={6}&CvePS={7}&CveClasificacion={8}&CveMarca={9}&CveCategoria={10}" /> <asp:HyperLinkField ItemStyle-HorizontalAlign="Left" Target="_blank" HeaderText="Grupo" DataTextField="GPO" DataNavigateUrlFields="FechaI,FechaF,CveSubProyecto,CveCliente,CveVendedor,Grupo,GPO,CvePS,CveClasificacion,CveMarca,CveCategoria" DataNavigateUrlFormatString="RepVentasUtilidad.aspx?FechaI={0}&FechaF={1}&CveSubProyecto={2}&CveCliente={3}&CveVendedor={4}&Gpo={5}&CveGpo={6}&CvePS={7}&CveClasificacion={8}&CveMarca={9}&CveCategoria={10}" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="Ventas" DataField="Ventas" DataFormatString="{0:N2}" /> <asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="Ventas" DataField="Ventas" DataFormatString="{0:N2}" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="Crédito" DataField="Credito" DataFormatString="{0:N2}" /> <asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="Crédito" DataField="Credito" DataFormatString="{0:N2}" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="% Crédito" DataField="PorcentajeCredito" ItemStyle-Width="30px" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="Contado" DataField="Contado" DataFormatString="{0:N2}" /> <asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="Contado" DataField="Contado" DataFormatString="{0:N2}" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="% Contado" DataField="PorcentajeCredito" ItemStyle-Width="30px" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="%" DataField="ProcentajeVentas" DataFormatString="{0:N2}" ItemStyle-Width="30px" /> <asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="%" DataField="ProcentajeVentas" DataFormatString="{0:N2}" ItemStyle-Width="30px" />
<asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="Descuento" DataField="Descuento" DataFormatString="{0:N2}" /> <asp:BoundField ItemStyle-HorizontalAlign="Right" HeaderText="Descuento" DataField="Descuento" DataFormatString="{0:N2}" />

View File

@@ -32,6 +32,11 @@ Partial Class Ventas_RepVentasUtilidadPadre
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then If Not IsPostBack Then
If UsuarioActual.Empresa.Funcionalidad(382) <> "1" Then
GvDatos.Columns(3).Visible = False
GvDatos.Columns(5).Visible = False
End If
CargaCombos() CargaCombos()
End If End If
End Sub End Sub