-- carga masiva layout de folios de facturas,
-- si mandan importe cero, selecciona el total de la factura
This commit is contained in:
@@ -653,16 +653,6 @@
|
|||||||
|
|
||||||
<div class="modal-body">
|
<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 />
|
<br />
|
||||||
|
|
||||||
<asp:UpdatePanel runat="server" ID="UpModalSeleccionLayout" UpdateMode="Conditional">
|
<asp:UpdatePanel runat="server" ID="UpModalSeleccionLayout" UpdateMode="Conditional">
|
||||||
@@ -680,8 +670,13 @@
|
|||||||
<div class="modal-footer">
|
<div class="modal-footer">
|
||||||
<asp:UpdatePanel runat="server" UpdateMode="Conditional">
|
<asp:UpdatePanel runat="server" UpdateMode="Conditional">
|
||||||
<ContentTemplate>
|
<ContentTemplate>
|
||||||
<asp:LinkButton ID="LnkSeleccionLayout" runat="server" CssClass="btn btn-primary" Text="Aceptar" OnClick="LnkSeleccionLayout_Click" />
|
<div class="col-md-2" style="text-align: left">
|
||||||
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
|
<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>
|
</ContentTemplate>
|
||||||
</asp:UpdatePanel>
|
</asp:UpdatePanel>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -3139,11 +3139,8 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Protected Sub LnkAccionesModalSeleccionLayout_Click(sender As Object, e As EventArgs)
|
Protected Sub LnkAccionesModalSeleccionLayout_Click(sender As Object, e As EventArgs)
|
||||||
|
|
||||||
|
|
||||||
TxtModalLayoutExcel.Text = "[]"
|
TxtModalLayoutExcel.Text = "[]"
|
||||||
UpModalSeleccionLayout.Update()
|
UpModalSeleccionLayout.Update()
|
||||||
RegistraScript("$('#ModalSeleccionLayout').modal('show');")
|
RegistraScript("$('#ModalSeleccionLayout').modal('show');")
|
||||||
@@ -3165,23 +3162,19 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
Dim Directorio As String = Server.MapPath("~") & file.path
|
Dim Directorio As String = Server.MapPath("~") & file.path
|
||||||
Dim Tipo As String = If(file.Extension.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV")
|
Dim Tipo As String = If(file.Extension.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Dim DT As New DataTable
|
Dim DT As New DataTable
|
||||||
Dim ErrorArchivo = False
|
Dim ErrorArchivo = False
|
||||||
Dim ErrorExcel = False
|
Dim ErrorExcel = False
|
||||||
|
|
||||||
|
DT = ReadExcelFile(Directorio + file.filename, True)
|
||||||
|
|
||||||
DT = ReadSeleccionExcelFile(Directorio + file.filename, True)
|
|
||||||
|
|
||||||
If Not dt.Columns(0).ColumnName.ToUpper = "FOLIO" Then
|
If Not dt.Columns(0).ColumnName.ToUpper = "FOLIO" Then
|
||||||
Alert("El nombre de la primera columna debe ser 'Folio'. Favor de corregirlo", TipoMensaje.MsgAdvertencia)
|
Alert("El nombre de la primera columna debe ser 'Folio'. Favor de corregirlo", TipoMensaje.MsgAdvertencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If Not dt.Columns(1).ColumnName.ToUpper = "IMPORTE PAGO" Then
|
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)
|
Alert("El nombre de la segunda columna debe ser 'Importe Pago'.Favor de corregirlo." & DT.Columns(1).ColumnName, TipoMensaje.MsgAdvertencia)
|
||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -3191,17 +3184,16 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
Dim ImportePago As Decimal = Drow("Importe Pago").ToString.ToDecimal.RoundSQL(2)
|
Dim ImportePago As Decimal = Drow("Importe Pago").ToString.ToDecimal.RoundSQL(2)
|
||||||
Dim SerieFolioEncontrado As Boolean = False
|
Dim SerieFolioEncontrado As Boolean = False
|
||||||
|
|
||||||
If ImportePago > 0 Then
|
If ImportePago >= 0 Then
|
||||||
|
|
||||||
For Each GvRow As GridViewRow In GvCxC.Rows
|
For Each GvRow As GridViewRow In GvCxC.Rows
|
||||||
|
|
||||||
Dim SerieFolioGv As String = GvRow.DataKey("SerieFolio").Trim.ToUpper
|
Dim SerieFolioGv As String = GvRow.DataKey("SerieFolio").Trim.ToUpper
|
||||||
|
|
||||||
|
|
||||||
If SerieFolioBusqueda = SerieFolioGv Then
|
If SerieFolioBusqueda = SerieFolioGv Then
|
||||||
SerieFolioEncontrado = True
|
SerieFolioEncontrado = True
|
||||||
Dim SaldoGV As Decimal = GvRow.DataKey("Saldo").ToDecimal
|
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
|
Dim Diferencia As Decimal = SaldoGV - ImportePago
|
||||||
|
|
||||||
If Diferencia < 0 Then
|
If Diferencia < 0 Then
|
||||||
@@ -3215,30 +3207,19 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
GvRow.FCCheckBox("Chk").Checked = True
|
||||||
|
GvRow.FCTextBox("TxtAbonar").Text = ImportePago.ToString("###,###,###.00")
|
||||||
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
|
TotalSeleccion = TotalSeleccion + ImportePago
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
CountRegistros = CountRegistros + 1
|
CountRegistros = CountRegistros + 1
|
||||||
|
|
||||||
Exit For
|
Exit For
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
|
|
||||||
If Not SerieFolioEncontrado Then
|
If Not SerieFolioEncontrado Then
|
||||||
SBNoEncotradosEnLista.AppendLine($"{SerieFolioBusqueda}<br>")
|
SBNoEncotradosEnLista.AppendLine($"{SerieFolioBusqueda}<br>")
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
Next
|
Next
|
||||||
|
|
||||||
@@ -3246,9 +3227,6 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
Alert("Se debe seleccionar un archivo", TipoMensaje.MsgError)
|
Alert("Se debe seleccionar un archivo", TipoMensaje.MsgError)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
If ProcesoOK Then
|
If ProcesoOK Then
|
||||||
|
|
||||||
Alert($"Facturas seleccionadas: {CountRegistros} <br/>{SBNoEncotradosEnLista.ToString}")
|
Alert($"Facturas seleccionadas: {CountRegistros} <br/>{SBNoEncotradosEnLista.ToString}")
|
||||||
@@ -3269,55 +3247,6 @@ Partial Class Ventas_ClientesAbonar
|
|||||||
End Sub
|
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)
|
Protected Sub LnkDescargaFormato_Click(sender As Object, e As EventArgs)
|
||||||
|
|||||||
Reference in New Issue
Block a user