Puntos GDiaz:
--Cotizaciones, cargas/descargas en excel.
This commit is contained in:
@@ -325,9 +325,17 @@
|
||||
<%-- <li>
|
||||
<asp:LinkButton ID="LbDescargarExcel" Visible="false" OnClick="LbDescargarExcel_Click" runat="server"><i class='fa fa-file-excel-o'></i> Descargar Formato</asp:LinkButton>
|
||||
</li>--%>
|
||||
<li>
|
||||
<asp:HyperLink ID="HlAgregarExcel" NavigateUrl="#" Visible="false" data-toggle="modal" data-target="#DivCargaExcel" runat="server"><i class='fa fa-server'></i> Cargar Concepto</asp:HyperLink>
|
||||
</li>
|
||||
<asp:UpdatePanel ID="UpCargaExceles" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
<asp:HyperLink ID="HlAgregarExcel" NavigateUrl="#" Visible="false" data-toggle="modal" data-target="#DivCargaExcel" runat="server"><i class='fa fa-server'></i> Cargar Concepto</asp:HyperLink>
|
||||
</li>
|
||||
<li>
|
||||
<asp:HyperLink ID="HLCargaCotizaciones" NavigateUrl="#" Visible="false" data-toggle="modal" data-target="#DivCargaExcelCotizaciones" runat="server"><i class='fa fa-server'></i> Cargar Excel</asp:HyperLink>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
<li>
|
||||
<%--<asp:LinkButton ID="LnkSaldarVenta" runat="server" CausesValidation="False" Text="<i class='fa fa-ban'></i> Saldar" data-toggle="confirmation" data-popout="true" data-original-title="¿Estás seguro que deseas saldar el Documento?" data-btn-ok-label="si" Visible="false" />--%>
|
||||
<asp:HyperLink ID="HLSaldarVenta" NavigateUrl="#" Visible="false" data-toggle="modal" data-target="#ModalSaldarVenta" runat="server"><i class='fa fa-ban'></i> Saldar</asp:HyperLink>
|
||||
@@ -6452,6 +6460,94 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="DivCargaExcelCotizaciones" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
<!-- Modal content-->
|
||||
<asp:UpdatePanel ID="UpConceptoCotizaciones" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="modal-header ">
|
||||
<button type="button" class="close" data-dismiss="modal">×</button>
|
||||
<h4 class="modal-title">Cargar Conceptos</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="portlet light xspadding bordered whitoutcol" style="width: 100%;">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<i class="icon-pin font-green"></i>
|
||||
<span class="caption-subject bold uppercase">Descargar Plantilla </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 formnombottom">
|
||||
<h4>Paso 1 : Descargar Plantilla</h4>
|
||||
<br />
|
||||
<div align="center">
|
||||
<asp:LinkButton ID="LbDescargarExcelCotizaciones" runat="server" CssClass="btn btn-warning" Text="Descargar Plantilla" />
|
||||
</div>
|
||||
<br />
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="portlet light xspadding bordered whitoutcol" style="width: 100%;">
|
||||
<div class="portlet-title">
|
||||
<div class="caption font-green">
|
||||
<i class="icon-pin font-green"></i>
|
||||
<span class="caption-subject bold uppercase">Cargar Plantilla </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 formnombottom">
|
||||
<h4>Paso 2: Cargar Plantilla</h4>
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="col-md-11" style="margin-left: 30px; margin-right: 30px; margin-bottom: 20px;">
|
||||
<asp:TextBox ID="TxtExcelCotizaciones" CssClass="ADSdropzone hidden" Text="" data-maxFile="1" runat="server"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="row">
|
||||
<%-- <div class="col-md-2" style="text-align: left">
|
||||
</div>--%>
|
||||
<div class="col-md-12" style="text-align: center">
|
||||
<asp:Button ID="BtnCargarExcelCotizaciones" runat="server" CssClass="btn btn-success" Text="Procesar"></asp:Button>
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="LbDescargarExcelCotizaciones" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<%--MODAL ADD PS --%>
|
||||
<div id="DivAddPS" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
@@ -7925,7 +8021,7 @@
|
||||
<Columns>
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
<asp:CheckBox ID="ChkAplicar" runat="server"/>
|
||||
<asp:CheckBox ID="ChkAplicar" runat="server" />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:HyperLinkField DataNavigateUrlFields="CveVenta" Target="_blank" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" DataTextField="Folio" HeaderText="Folio" ItemStyle-HorizontalAlign="Center" />
|
||||
|
||||
@@ -3486,7 +3486,13 @@ Partial Class Ventas
|
||||
''EN REALIDAD SE OCUPAN ESTAS COSAS DENTRO DEL POSTABCK ???
|
||||
If Not CveVenta > 0 Then
|
||||
'LbDescargarExcel.Visible = True
|
||||
HlAgregarExcel.Visible = True
|
||||
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
HLCargaCotizaciones.Visible = True
|
||||
HlAgregarExcel.Visible = False
|
||||
Else
|
||||
HLCargaCotizaciones.Visible = False
|
||||
HlAgregarExcel.Visible = True
|
||||
End If
|
||||
End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Rem") AndAlso UsuarioActual.Empresa.Funcionalidad(109) <> "1" Then
|
||||
@@ -21291,6 +21297,16 @@ Partial Class Ventas
|
||||
TdOrdenPago.Visible = True
|
||||
End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "Cot" AndAlso UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
|
||||
HLCargaCotizaciones.Visible = True
|
||||
HlAgregarExcel.Visible = False
|
||||
Else
|
||||
HLCargaCotizaciones.Visible = False
|
||||
HlAgregarExcel.Visible = True
|
||||
End If
|
||||
|
||||
UpCargaExceles.Update()
|
||||
|
||||
UpFacturar.Update()
|
||||
|
||||
End Sub
|
||||
@@ -26426,9 +26442,30 @@ Partial Class Ventas
|
||||
Response.End()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub DescargarFormatoCotizaciones()
|
||||
Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\Formatos\FormatoCotizaciones.xlsx"
|
||||
|
||||
Dim Archivo As New IO.FileInfo(Directorio)
|
||||
If Archivo.Exists Then
|
||||
Response.Clear()
|
||||
Response.ClearHeaders()
|
||||
Response.ClearContent()
|
||||
Response.AddHeader("Content-Disposition", "attachment; filename=" + Archivo.Name)
|
||||
Response.AddHeader("Content-Length", Archivo.Length.ToString())
|
||||
Response.ContentType = "text/plain"
|
||||
Response.Flush()
|
||||
Response.TransmitFile(Archivo.FullName)
|
||||
Response.End()
|
||||
End If
|
||||
End Sub
|
||||
Public Sub LbDescargarExcel_Click(sender As Object, e As EventArgs) Handles LbDescargarExcelVentas.Click
|
||||
DescargarFormato()
|
||||
End Sub
|
||||
|
||||
Public Sub LbDescargarExcelCotizaciones_Click(sender As Object, e As EventArgs) Handles LbDescargarExcelCotizaciones.Click
|
||||
DescargarFormatoCotizaciones()
|
||||
End Sub
|
||||
Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String, FileUrl As String)
|
||||
Dim dt As New DataTable
|
||||
Dim ErrorArchivo As Boolean = False
|
||||
@@ -26597,6 +26634,141 @@ Partial Class Ventas
|
||||
End If
|
||||
dt.Dispose()
|
||||
End Sub
|
||||
|
||||
Private Sub CargarArchivoCotizacion(Ruta As String, FileName As String, Tipo As String, FileUrl As String)
|
||||
Dim dt As New DataTable
|
||||
Dim ErrorArchivo As Boolean = False
|
||||
Dim n As Integer = 0
|
||||
dt = ReadExcelFile(FileUrl, True)
|
||||
If Not ErrorArchivo Then
|
||||
If Not dt.Columns(0).ColumnName = "Cantidad" Then
|
||||
Alert("El nombre de la primera columna debe ser 'Cantidad'.Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(1).ColumnName = "Código" Then
|
||||
Alert("El nombre de la segunda columna debe ser 'Código'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(2).ColumnName = "Codigo Barras" Then
|
||||
Alert("El nombre de la tecera columna debe ser 'Codigo Barras'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(3).ColumnName = "Precio Unitario" Then
|
||||
Alert("El nombre de la sexta columna debe ser 'Precio Unitario'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(4).ColumnName = "Descuento" Then
|
||||
Alert("El nombre de la sexta columna debe ser 'Descuento'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
dt.TableName = "Datos"
|
||||
|
||||
Dim DtSubProyecto As DataTable = GlobalDTSubProyectos(UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero())
|
||||
|
||||
If Not ErrorArchivo Then
|
||||
NumRow = 1
|
||||
Dim RowNoEncontrados As String = ""
|
||||
Dim NumAgregados As Integer = 0
|
||||
For Each Row As DataRow In dt.Rows
|
||||
NumAgregados = NumAgregados + 1
|
||||
|
||||
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
|
||||
Dim Codigo As String = Row("Código").ToString().Trim.ToUpper()
|
||||
Dim CodigoBarras As String = Row("Codigo Barras").ToString().Trim.ToUpper()
|
||||
Dim PrecioUnitario As Decimal = Row("Precio Unitario").ToString().ToDecimal()
|
||||
Dim Descuento As Decimal = Row("Descuento").ToString().ToDecimal()
|
||||
Dim Proyecto = ""
|
||||
Dim CvePS As Integer = 0
|
||||
Dim CveClasificacion As Integer = 0
|
||||
Dim CveUM As Integer = 0
|
||||
Dim UM As String = ""
|
||||
Dim PS As String = ""
|
||||
Dim DrProyecto As DataRow = DtSubProyecto.FiltroPrimero("")
|
||||
Dim SubProyecto As String = ""
|
||||
Dim CveProyecto As Integer = 0
|
||||
Dim CveSubProyecto As Integer = 0
|
||||
|
||||
NumRow = NumRow + 1
|
||||
|
||||
If DrProyecto IsNot Nothing Then
|
||||
CveSubProyecto = DrProyecto("CveSubProyecto").ToString().ToEntero()
|
||||
CveProyecto = DrProyecto("CveProyecto").ToString().ToEntero()
|
||||
SubProyecto = DrProyecto("SubProyecto").ToString()
|
||||
Proyecto = DrProyecto("Proyecto").ToString()
|
||||
End If
|
||||
|
||||
'If CveSubProyecto <= 0 Then
|
||||
' RowNoEncontrados = String.Format("{3} - No se encontró '{0}' en la fila {1}, columna '{2}'<\BR>(NoBD)", Proyecto, NumRow, "Proyecto", RowNoEncontrados)
|
||||
'End If
|
||||
|
||||
If CveSubProyecto > 0 Then
|
||||
If Codigo <> "" Then
|
||||
|
||||
Using ObjPS As New ClsProductosServicios
|
||||
If ObjPS.GetPS(-1, -1, UsuarioActual.CveEmpresa, Codigo:=Codigo) Then
|
||||
If ObjPS.CvePS > 0 Then
|
||||
CvePS = ObjPS.CvePS
|
||||
PS = ObjPS.PS
|
||||
CveUM = ObjPS.CveUnidadMedida
|
||||
CveClasificacion = ObjPS.CveClasificacion
|
||||
Else
|
||||
RowNoEncontrados = String.Format("{3} - No se encontró '{0}' en la fila {1}, columna '{2}'<\BR>", Codigo, NumRow, "Codigo", RowNoEncontrados)
|
||||
End If
|
||||
Else
|
||||
RowNoEncontrados = String.Format("{3} - No se encontró '{0}' en la fila {1}, columna '{2}'<\BR>(NoBD)", Codigo, NumRow, "Codigo", RowNoEncontrados)
|
||||
End If
|
||||
End Using
|
||||
|
||||
ElseIf CodigoBarras <> "" Then
|
||||
|
||||
Using ObjPS As New ClsProductosServicios
|
||||
If ObjPS.GetPS(-1, -1, UsuarioActual.CveEmpresa, CodigoBarras:=CodigoBarras) Then
|
||||
If ObjPS.CvePS > 0 Then
|
||||
CvePS = ObjPS.CvePS
|
||||
PS = ObjPS.PS
|
||||
CveUM = ObjPS.CveUnidadMedida
|
||||
CveClasificacion = ObjPS.CveClasificacion
|
||||
Else
|
||||
RowNoEncontrados = String.Format("{3} - No se encontró '{0}' en la fila {1}, columna '{2}'<\BR>", Codigo, NumRow, "Codigo", RowNoEncontrados)
|
||||
End If
|
||||
Else
|
||||
RowNoEncontrados = String.Format("{3} - No se encontró '{0}' en la fila {1}, columna '{2}'<\BR>(NoBD)", Codigo, NumRow, "Codigo", RowNoEncontrados)
|
||||
End If
|
||||
End Using
|
||||
RowNoEncontrados &= "<\BR> - En la fila " & NumRow & " no se especificó código, código de barras ó descripción."
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If CvePS > 0 Then
|
||||
|
||||
If PrecioUnitario <= 0 Then
|
||||
Dim ObjPrecioSugerido As Modelos.MPrecioSugerido = CalculaPrecioSugerido(CvePS, CveClasificacion)
|
||||
PrecioUnitario = ObjPrecioSugerido.PrecioSugerido
|
||||
End If
|
||||
|
||||
AgregarProductoServicio(Cantidad, CveUM, UM, -1, "",
|
||||
CvePS, PS, "", PrecioUnitario, Descuento,
|
||||
CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
|
||||
End If
|
||||
Next
|
||||
|
||||
CalculaTotalesVenta()
|
||||
|
||||
If RowNoEncontrados.Length > 0 Then
|
||||
Alert("Los siguientes productos o servicios no se encontraron en la Base de Datos.<\BR>" & RowNoEncontrados, TipoMensaje.MsgAdvertencia)
|
||||
Else
|
||||
Alert("Se cargaron " & NumAgregados & " productos o servicios correctamente.")
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
dt.Dispose()
|
||||
End Sub
|
||||
Private Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click
|
||||
If TxtExcel.getfiles().Archivos.Count > 0 Then
|
||||
Dim file As Archivo = TxtExcel.getfiles().Archivos(0)
|
||||
@@ -26608,6 +26780,17 @@ Partial Class Ventas
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Sub BtnCargarExcelCotizaciones_Click(sender As Object, e As EventArgs) Handles BtnCargarExcelCotizaciones.Click
|
||||
If TxtExcelCotizaciones.getfiles().Archivos.Count > 0 Then
|
||||
Dim file As Archivo = TxtExcelCotizaciones.getfiles().Archivos(0)
|
||||
Dim Directorio As String = ModExtensiones.DirectorioBaseEmpresas & file.path
|
||||
Dim Tipo As String = If(file.Extension.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV")
|
||||
CargarArchivoCotizacion(Directorio, file.filename, Tipo, file.FileUrl)
|
||||
Else
|
||||
Alert("No existe el archivo. Favor de subir un archivo excel a la plataforma.", TipoMensaje.MsgError)
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
'Private dtps As DataTable = Nothing
|
||||
'Private Function GetPS(Opt As String, Valor As String) As String
|
||||
@@ -30982,6 +31165,7 @@ Partial Class Ventas
|
||||
LiDevolucionAlmacen.Visible = False
|
||||
HLPagar.Visible = False
|
||||
HlAgregarExcel.Visible = False
|
||||
HLCargaCotizaciones.Visible = False
|
||||
HplDownXML.Visible = False
|
||||
HplDownPDF.Visible = False
|
||||
HLSaldarVenta.Visible = False
|
||||
@@ -31422,6 +31606,7 @@ Partial Class Ventas
|
||||
LiDevolucionAlmacen.Visible = False
|
||||
HLPagar.Visible = False
|
||||
HlAgregarExcel.Visible = False
|
||||
HLCargaCotizaciones.Visible = False
|
||||
HplDownXML.Visible = False
|
||||
HplDownPDF.Visible = False
|
||||
HLSaldarVenta.Visible = False
|
||||
@@ -33712,7 +33897,7 @@ Partial Class Ventas
|
||||
LiDevolucionAlmacen.Visible = False
|
||||
HLPagar.Visible = False
|
||||
HlAgregarExcel.Visible = False
|
||||
|
||||
HLCargaCotizaciones.Visible = False
|
||||
|
||||
'REINICIALIZA VALORES DE CANTIDAD FACTURADA - SOLO DEBEN MOSTRARSE AL CARGAR UNA REMISION/COTIZACIÓN
|
||||
GvPS.Columns(6).Visible = False
|
||||
|
||||
Reference in New Issue
Block a user