-- carga masiva layout de folios de facturas,

-- si mandan importe cero, selecciona el total de la factura
This commit is contained in:
2022-11-11 18:11:17 -07:00
parent 10dcbc5b1c
commit 1e7b7730a5
2 changed files with 15 additions and 91 deletions

View File

@@ -652,17 +652,7 @@
</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">
@@ -680,8 +670,13 @@
<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>
<div class="col-md-2" style="text-align: left">
<asp:Button ID="LnkDescargaFormato" OnClick="LnkDescargaFormato_Click" runat="server" CssClass="btn btn-warning" Text="Descargar Formato" />
</div>
<div class="col-md-10" style="text-align: right">
<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>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>

View File

@@ -3139,11 +3139,8 @@ Partial Class Ventas_ClientesAbonar
Protected Sub LnkAccionesModalSeleccionLayout_Click(sender As Object, e As EventArgs)
TxtModalLayoutExcel.Text = "[]"
UpModalSeleccionLayout.Update()
RegistraScript("$('#ModalSeleccionLayout').modal('show');")
@@ -3165,23 +3162,19 @@ Partial Class Ventas_ClientesAbonar
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)
DT = ReadExcelFile(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)
If Not DT.Columns(1).ColumnName.ToUpper = "IMPORTE PAGO" Then
Alert("El nombre de la segunda columna debe ser 'Importe Pago'.Favor de corregirlo." & DT.Columns(1).ColumnName, TipoMensaje.MsgAdvertencia)
Exit Sub
End If
@@ -3191,17 +3184,16 @@ Partial Class Ventas_ClientesAbonar
Dim ImportePago As Decimal = Drow("Importe Pago").ToString.ToDecimal.RoundSQL(2)
Dim SerieFolioEncontrado As Boolean = False
If ImportePago > 0 Then
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
If ImportePago = 0 Then ImportePago = SaldoGV 'si no se especifica cantidad toma la totalidad del saldo
Dim Diferencia As Decimal = SaldoGV - ImportePago
If Diferencia < 0 Then
@@ -3215,30 +3207,19 @@ Partial Class Ventas_ClientesAbonar
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")
GvRow.FCCheckBox("Chk").Checked = True
GvRow.FCTextBox("TxtAbonar").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
@@ -3246,9 +3227,6 @@ Partial Class Ventas_ClientesAbonar
Alert("Se debe seleccionar un archivo", TipoMensaje.MsgError)
End If
If ProcesoOK Then
Alert($"Facturas seleccionadas: {CountRegistros} <br/>{SBNoEncotradosEnLista.ToString}")
@@ -3269,55 +3247,6 @@ Partial Class Ventas_ClientesAbonar
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)