Crm Rep Acercamientos, Clientes Abonora seleccion por layout
This commit is contained in:
@@ -18,6 +18,11 @@
|
||||
<li>
|
||||
<asp:HyperLink ID="HplVincularIntermediario" data-toggle="modal" data-target="#ModalVincularIntermediario" title="Vincular Intermediario" runat="server"><i class="fa fa-money"></i> Vincular Intermediario</asp:HyperLink>
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<asp:LinkButton runat="server" ID="LnkAccionesModalSeleccionLayout" OnClick="LnkAccionesModalSeleccionLayout_Click" Visible="false"><i class="fa fa-file-excel-o" aria-hidden="true"></i> Cargar Layout</asp:LinkButton>
|
||||
</li>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</asp:Content>
|
||||
@@ -636,6 +641,54 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="ModalSeleccionLayout" class="modal ADS fade" role="dialog">
|
||||
<div class="modal-dialog">
|
||||
|
||||
<!-- Modal content-->
|
||||
<div class="modal-content">
|
||||
<div class="modal-header ">
|
||||
<button type="button" class="close" data-dismiss="ChkModalSeleccionLayout">×</button>
|
||||
<h4 class="modal-title">Cargar Layout</h4>
|
||||
</div>
|
||||
|
||||
<div class="modal-body">
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
|
||||
</div>
|
||||
<div class="col-md-4" style="text-align:right!important">
|
||||
<asp:LinkButton runat="server" ID="LnkDescargaFormato" OnClick="LnkDescargaFormato_Click" CssClass="blue Texto">
|
||||
Descargar Formato <i class="fa fa-download" aria-hidden="true"></i></asp:LinkButton>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
|
||||
<asp:UpdatePanel runat="server" ID="UpModalSeleccionLayout" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-11" style="margin-left: 30px; margin-right: 30px; margin-bottom: 50px;">
|
||||
<asp:TextBox ID="TxtModalLayoutExcel" CssClass="ADSdropzone hidden" Text="" data-maxFile="1" runat="server"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<asp:UpdatePanel runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:LinkButton ID="LnkSeleccionLayout" runat="server" CssClass="btn btn-primary" Text="Aceptar" OnClick="LnkSeleccionLayout_Click" />
|
||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<script src="/Metronic/assets/global/plugins/dropzone/dropzone.js"></script>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
||||
|
||||
@@ -302,6 +302,11 @@ Partial Class Ventas_ClientesAbonar
|
||||
RVTxtFechaDocumento.MaximumValue = Now.ToString("dd/MM/yyyy")
|
||||
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(13, 83) Then
|
||||
LnkAccionesModalSeleccionLayout.Visible = True
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If (CveMonedaFiltro = 2 And ChkPagarPesos.Checked) Then
|
||||
@@ -3133,4 +3138,208 @@ Partial Class Ventas_ClientesAbonar
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Protected Sub LnkAccionesModalSeleccionLayout_Click(sender As Object, e As EventArgs)
|
||||
|
||||
|
||||
TxtModalLayoutExcel.Text = "[]"
|
||||
UpModalSeleccionLayout.Update()
|
||||
RegistraScript("$('#ModalSeleccionLayout').modal('show');")
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Protected Sub LnkSeleccionLayout_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim ProcesoOK As Boolean = True
|
||||
Dim CountRegistros As Integer = 0
|
||||
Dim TotalSeleccion As Decimal = 0D
|
||||
|
||||
Dim SBNoEncotradosEnLista As New StringBuilder
|
||||
Dim SBPagoMAyorASaldo As New StringBuilder
|
||||
|
||||
If TxtModalLayoutExcel.getfiles().Archivos.Count > 0 Then
|
||||
Dim file As Archivo = TxtModalLayoutExcel.getfiles().Archivos(0)
|
||||
Dim Directorio As String = Server.MapPath("~") & file.path
|
||||
Dim Tipo As String = If(file.Extension.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV")
|
||||
|
||||
|
||||
|
||||
Dim DT As New DataTable
|
||||
Dim ErrorArchivo = False
|
||||
Dim ErrorExcel = False
|
||||
|
||||
|
||||
|
||||
DT = ReadSeleccionExcelFile(Directorio + file.filename, True)
|
||||
|
||||
If Not dt.Columns(0).ColumnName.ToUpper = "FOLIO" Then
|
||||
Alert("El nombre de la primera columna debe ser 'Folio'. Favor de corregirlo", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If Not dt.Columns(1).ColumnName.ToUpper = "IMPORTE PAGO" Then
|
||||
Alert("El nombre de la segunda columna debe ser 'Importe Pago'.Favor de corregirlo", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
For Each Drow As DataRow In DT.Rows
|
||||
|
||||
Dim SerieFolioBusqueda As String = Drow("Folio").ToString.Trim.ToUpper
|
||||
Dim ImportePago As Decimal = Drow("Importe Pago").ToString.ToDecimal.RoundSQL(2)
|
||||
Dim SerieFolioEncontrado As Boolean = False
|
||||
|
||||
If ImportePago > 0 Then
|
||||
|
||||
For Each GvRow As GridViewRow In GvCxC.Rows
|
||||
|
||||
Dim SerieFolioGv As String = GvRow.DataKey("SerieFolio").Trim.ToUpper
|
||||
|
||||
|
||||
If SerieFolioBusqueda = SerieFolioGv Then
|
||||
SerieFolioEncontrado = True
|
||||
Dim SaldoGV As Decimal = GvRow.DataKey("Saldo").ToDecimal
|
||||
|
||||
Dim Diferencia As Decimal = SaldoGV - ImportePago
|
||||
|
||||
If Diferencia < 0 Then
|
||||
|
||||
If Math.Abs(Diferencia) > 0.01 Then
|
||||
SBPagoMAyorASaldo.AppendLine($"Factura: {SerieFolioBusqueda} Importe de pago {ImportePago.ToString("###,###,###.00")} es mayor al saldo {SaldoGV.ToString("###,###,###.00")} <br/>")
|
||||
ProcesoOK = False
|
||||
Exit For
|
||||
Else
|
||||
ImportePago = SaldoGV
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Dim ChkGv As CheckBox = GvRow.FCCheckBox("Chk")
|
||||
Dim TxtAbonarGv As TextBox = GvRow.FCTextBox("TxtAbonar")
|
||||
|
||||
ChkGv.Checked = True
|
||||
TxtAbonarGv.Text = ImportePago.ToString("###,###,###.00")
|
||||
|
||||
TotalSeleccion = TotalSeleccion + ImportePago
|
||||
|
||||
|
||||
|
||||
CountRegistros = CountRegistros + 1
|
||||
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
|
||||
If Not SerieFolioEncontrado Then
|
||||
SBNoEncotradosEnLista.AppendLine($"{SerieFolioBusqueda}<br>")
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
Else
|
||||
Alert("Se debe seleccionar un archivo", TipoMensaje.MsgError)
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
If ProcesoOK Then
|
||||
|
||||
Alert($"Facturas seleccionadas: {CountRegistros} <br/>{SBNoEncotradosEnLista.ToString}")
|
||||
RegistraScript("$('#ModalSeleccionLayout').modal('hide');")
|
||||
TxtImporte.Text = TotalSeleccion.ToString("###,###,###.00")
|
||||
|
||||
UPVentas.Update()
|
||||
UpDatos.Update()
|
||||
Else
|
||||
|
||||
If SBPagoMAyorASaldo.ToString.Length > 0 Then
|
||||
Alert($"Facturas con pagos mayores a saldo:<br/>{SBPagoMAyorASaldo.ToString}", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Public Function ReadSeleccionExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean, Optional curRow As Integer = 0) As DataTable
|
||||
GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
Dim excelFile As GemBox.Spreadsheet.ExcelFile = GemBox.Spreadsheet.ExcelFile.Load(flatFilePath)
|
||||
|
||||
Dim unnamed As Integer = 0
|
||||
Dim cols As Integer
|
||||
Dim columns As String()
|
||||
'Dim curRow As Integer = 0
|
||||
Dim curCol As Integer = 0
|
||||
Dim dataTable As DataTable = New DataTable()
|
||||
Dim worksheet As GemBox.Spreadsheet.ExcelWorksheet = excelFile.Worksheets(0)
|
||||
|
||||
For cols = 0 To worksheet.Rows(0).AllocatedCells.Count - 1
|
||||
|
||||
If firstRowHasHeaders Then
|
||||
|
||||
If worksheet.Rows(curRow).Cells(cols).Value IsNot Nothing Then
|
||||
dataTable.Columns.Add(worksheet.Rows(curRow).Cells(cols).Value.ToString())
|
||||
Else
|
||||
dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed)))
|
||||
End If
|
||||
|
||||
|
||||
Else
|
||||
dataTable.Columns.Add("Column " & (cols + 1))
|
||||
End If
|
||||
Next
|
||||
|
||||
curRow = 1
|
||||
|
||||
While curRow < worksheet.Rows.Count
|
||||
columns = New String(cols - 1) {}
|
||||
|
||||
For curCol = 0 To cols - 1
|
||||
|
||||
If worksheet.Rows(curRow).Cells(curCol).Value Is Nothing Then
|
||||
columns(curCol) = ""
|
||||
Else
|
||||
columns(curCol) = worksheet.Rows(curRow).Cells(curCol).Value.ToString()
|
||||
End If
|
||||
Next
|
||||
|
||||
dataTable.Rows.Add(columns)
|
||||
curRow += 1
|
||||
End While
|
||||
|
||||
Return dataTable
|
||||
End Function
|
||||
|
||||
|
||||
|
||||
Protected Sub LnkDescargaFormato_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim Directorio As String = ""
|
||||
Directorio = ModExtensiones.DirectorioBaseEmpresas & "Empresas\Grales\LayoutSeleccion.xlsx"
|
||||
|
||||
If Not (Directorio = "") Then
|
||||
|
||||
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 If
|
||||
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
@@ -558,8 +558,11 @@ Partial Class Ventas_Promociones
|
||||
TieneError = True
|
||||
End If
|
||||
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(563) <> "" Then
|
||||
TieneError = ObjVentas.SincronizarPromocionesClonar(CvePromocion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1)
|
||||
If Not ObjVentas.SincronizarPromocionesClonar(CvePromocion, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1) Then
|
||||
TieneError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user