+
diff --git a/Ventas/ClientesAbonar.aspx.vb b/Ventas/ClientesAbonar.aspx.vb
index f1aa365e7..fa2856ef1 100644
--- a/Ventas/ClientesAbonar.aspx.vb
+++ b/Ventas/ClientesAbonar.aspx.vb
@@ -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")} ")
+ 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} ")
+ End If
+
+
+ End If
+ Next
+
+ Else
+ Alert("Se debe seleccionar un archivo", TipoMensaje.MsgError)
+ End If
+
+
+
+
+ If ProcesoOK Then
+
+ Alert($"Facturas seleccionadas: {CountRegistros} {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: {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
diff --git a/Ventas/Promociones.aspx.vb b/Ventas/Promociones.aspx.vb
index 1ed054fee..45514ef77 100644
--- a/Ventas/Promociones.aspx.vb
+++ b/Ventas/Promociones.aspx.vb
@@ -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