This commit is contained in:
Raul Pimienta
2019-08-27 11:34:06 -07:00
4 changed files with 197 additions and 87 deletions

View File

@@ -1103,6 +1103,7 @@ Partial Class Bancos_IE
If (Not VerificaComplementos(True)) And UsuarioActual.TienePermisoProceso(99) And ObjIE.CveEstatusIE <> 2 Then
BtnEditar.Visible = True
PermisoComplementoVigente = True
Else
BtnEditar.Visible = True
End If

View File

@@ -456,7 +456,7 @@
<Style>
<FontSize>8pt</FontSize>
<FontWeight>=iif(Fields!CveVenta.Value = "", "Bold", "Normal")</FontWeight>
<Color>=iif(Fields!CveVenta.Value= "", "White", "Black")</Color>
<Color>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black")</Color>
</Style>
</TextRun>
</TextRuns>
@@ -468,7 +468,7 @@
<Border>
<Style>None</Style>
</Border>
<BackgroundColor>=iif(Fields!CveVenta.Value = "", "#67809F", "Transparent")</BackgroundColor>
<BackgroundColor>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent")</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
@@ -490,7 +490,7 @@
<FontSize>8pt</FontSize>
<FontWeight>=iif(Fields!CveVenta.Value = "", "Bold", "Normal")</FontWeight>
<Format>dd/MM/yyyy</Format>
<Color>=iif(Fields!CveVenta.Value= "", "White", "Black")</Color>
<Color>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black")</Color>
</Style>
</TextRun>
</TextRuns>
@@ -504,7 +504,7 @@
<Border>
<Style>None</Style>
</Border>
<BackgroundColor>=iif(Fields!CveVenta.Value = "", "#67809F", "Transparent")</BackgroundColor>
<BackgroundColor>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent")</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
@@ -525,7 +525,7 @@
<Style>
<FontSize>8pt</FontSize>
<FontWeight>=iif(Fields!CveVenta.Value = "", "Bold", "Normal")</FontWeight>
<Color>=iif(Fields!CveVenta.Value= "", "White", "Black")</Color>
<Color>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black")</Color>
</Style>
</TextRun>
</TextRuns>
@@ -537,7 +537,7 @@
<Border>
<Style>None</Style>
</Border>
<BackgroundColor>=iif(Fields!CveVenta.Value = "", "#67809F", "Transparent")</BackgroundColor>
<BackgroundColor>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent")</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
@@ -555,11 +555,11 @@
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Fields!Nombre.Value</Value>
<Value>=IIf(Fields!Nombre.Value = "", IIf(Fields!Gpo.Value = "", Fields!Moneda.Value, Fields!Gpo.Value), Fields!Nombre.Value)</Value>
<Style>
<FontSize>8pt</FontSize>
<FontWeight>=iif(Fields!CveVenta.Value = "", "Bold", "Normal")</FontWeight>
<Color>=iif(Fields!CveVenta.Value= "", "White", "Black")</Color>
<Color>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black")</Color>
</Style>
</TextRun>
</TextRuns>
@@ -571,13 +571,14 @@
<Border>
<Style>None</Style>
</Border>
<BackgroundColor>=iif(Fields!CveVenta.Value = "", "#67809F", "Transparent")</BackgroundColor>
<BackgroundColor>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent")</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<rd:Selected>true</rd:Selected>
</CellContents>
</TablixCell>
<TablixCell>
@@ -592,7 +593,7 @@
<Style>
<FontSize>8pt</FontSize>
<FontWeight>=iif(Fields!CveVenta.Value = "", "Bold", "Normal")</FontWeight>
<Color>=iif(Fields!CveVenta.Value= "", "White", "Black")</Color>
<Color>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black")</Color>
</Style>
</TextRun>
</TextRuns>
@@ -606,7 +607,7 @@
<Border>
<Style>None</Style>
</Border>
<BackgroundColor>=iif(Fields!CveVenta.Value = "", "#67809F", "Transparent")</BackgroundColor>
<BackgroundColor>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent")</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
@@ -629,7 +630,7 @@
<FontSize>8pt</FontSize>
<FontWeight>=iif(Fields!CveVenta.Value = "", "Bold", "Normal")</FontWeight>
<Format>f2</Format>
<Color>=iif(Fields!CveVenta.Value= "", "White", "Black")</Color>
<Color>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black")</Color>
</Style>
</TextRun>
</TextRuns>
@@ -641,7 +642,7 @@
<Border>
<Style>None</Style>
</Border>
<BackgroundColor>=iif(Fields!CveVenta.Value = "", "#67809F", "Transparent")</BackgroundColor>
<BackgroundColor>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent")</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
@@ -664,7 +665,7 @@
<FontSize>8pt</FontSize>
<FontWeight>=iif(Fields!CveVenta.Value = "", "Bold", "Normal")</FontWeight>
<Format>#,0.00;- #,0.00;'-'</Format>
<Color>=iif(Fields!CveVenta.Value= "", "White", "Black")</Color>
<Color>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black")</Color>
</Style>
</TextRun>
</TextRuns>
@@ -678,7 +679,7 @@
<Border>
<Style>None</Style>
</Border>
<BackgroundColor>=iif(Fields!CveVenta.Value = "", "#67809F", "Transparent")</BackgroundColor>
<BackgroundColor>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent")</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
@@ -701,7 +702,7 @@
<FontSize>8pt</FontSize>
<FontWeight>=iif(Fields!CveVenta.Value = "", "Bold", "Normal")</FontWeight>
<Format>#,0.00;- #,0.00;'-'</Format>
<Color>=iif(Fields!CveVenta.Value= "", "White", "Black")</Color>
<Color>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black")</Color>
</Style>
</TextRun>
</TextRuns>
@@ -715,7 +716,7 @@
<Border>
<Style>None</Style>
</Border>
<BackgroundColor>=iif(Fields!CveVenta.Value = "", "#67809F", "Transparent")</BackgroundColor>
<BackgroundColor>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent")</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
@@ -737,7 +738,7 @@
<FontSize>8pt</FontSize>
<FontWeight>=iif(Fields!CveVenta.Value = "", "Bold", "Normal")</FontWeight>
<Format>#,0.00;-#,0.00;'-'</Format>
<Color>=iif(Fields!CveVenta.Value= "", "White", "Black")</Color>
<Color>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black")</Color>
</Style>
</TextRun>
</TextRuns>
@@ -751,7 +752,7 @@
<Border>
<Style>None</Style>
</Border>
<BackgroundColor>=iif(Fields!CveVenta.Value = "", "#67809F", "Transparent")</BackgroundColor>
<BackgroundColor>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent")</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
@@ -773,7 +774,7 @@
<FontSize>8pt</FontSize>
<FontWeight>=iif(Fields!CveVenta.Value = "", "Bold", "Normal")</FontWeight>
<Format>#,0.00;- #,0.00;'-'</Format>
<Color>=iif(Fields!CveVenta.Value= "", "White", "Black")</Color>
<Color>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black")</Color>
</Style>
</TextRun>
</TextRuns>
@@ -787,7 +788,7 @@
<Border>
<Style>None</Style>
</Border>
<BackgroundColor>=iif(Fields!CveVenta.Value = "", "#67809F", "Transparent")</BackgroundColor>
<BackgroundColor>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent")</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
@@ -810,7 +811,7 @@
<FontSize>8pt</FontSize>
<FontWeight>=iif(Fields!CveVenta.Value = "", "Bold", "Normal")</FontWeight>
<Format>#,0.00;-#,0.00;'-'</Format>
<Color>=iif(Fields!CveVenta.Value= "", "White", "Black")</Color>
<Color>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","White","#67809F"), "Black")</Color>
</Style>
</TextRun>
</TextRuns>
@@ -824,7 +825,7 @@
<Border>
<Style>None</Style>
</Border>
<BackgroundColor>=iif(Fields!CveVenta.Value = "", "#67809F", "Transparent")</BackgroundColor>
<BackgroundColor>=iif(Fields!CveVenta.Value = "",IIf(Fields!Gpo.Value = "","#67809F","#cccccc"), "Transparent")</BackgroundColor>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
@@ -896,14 +897,16 @@
</Style>
</TextRun>
</TextRuns>
<Style />
<Style>
<TextAlign>Center</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox1</rd:DefaultName>
<Top>0.18521cm</Top>
<Left>2.8349cm</Left>
<Left>3.37444cm</Left>
<Height>0.6cm</Height>
<Width>12.60299cm</Width>
<Width>21.20747cm</Width>
<Style>
<Border>
<Style>None</Style>
@@ -949,9 +952,9 @@
</Paragraphs>
<rd:DefaultName>Textbox2</rd:DefaultName>
<Top>1.10271cm</Top>
<Left>8.17404cm</Left>
<Left>9.22743cm</Left>
<Height>0.52945cm</Height>
<Width>10.36447cm</Width>
<Width>10.12635cm</Width>
<ZIndex>1</ZIndex>
<Style>
<Border>
@@ -1018,7 +1021,7 @@
</Style>
</PageHeader>
<PageFooter>
<Height>0.58209cm</Height>
<Height>1.04773cm</Height>
<PrintOnFirstPage>true</PrintOnFirstPage>
<PrintOnLastPage>true</PrintOnLastPage>
<ReportItems>
@@ -1140,9 +1143,9 @@
</Paragraphs>
<rd:DefaultName>Textbox10</rd:DefaultName>
<Top>0.0829cm</Top>
<Left>9.84544cm</Left>
<Left>10.83183cm</Left>
<Height>0.38981cm</Height>
<Width>2.92333cm</Width>
<Width>2.91804cm</Width>
<ZIndex>3</ZIndex>
<Style>
<Border>
@@ -1161,22 +1164,56 @@
<Paragraph>
<TextRuns>
<TextRun>
<Value>=Parameters!FechaImpresion.Value</Value>
<Value>=Globals!ExecutionTime</Value>
<Style>
<FontSize>9pt</FontSize>
<Format>g</Format>
</Style>
</TextRun>
</TextRuns>
<Style>
<TextAlign>Left</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox11</rd:DefaultName>
<Top>0.0829cm</Top>
<Left>13.56466cm</Left>
<Height>0.38981cm</Height>
<Width>6.47703cm</Width>
<ZIndex>4</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>2pt</PaddingLeft>
<PaddingRight>2pt</PaddingRight>
<PaddingTop>2pt</PaddingTop>
<PaddingBottom>2pt</PaddingBottom>
</Style>
</Textbox>
<Textbox Name="Textbox14">
<CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether>
<Paragraphs>
<Paragraph>
<TextRuns>
<TextRun>
<Value>IMPRESO EN SIG, Rep. Productos Servicios</Value>
<Style>
<FontSize>9pt</FontSize>
<Format>D</Format>
</Style>
</TextRun>
</TextRuns>
<Style />
</Paragraph>
</Paragraphs>
<rd:DefaultName>Textbox11</rd:DefaultName>
<Top>0.0829cm</Top>
<Left>12.75466cm</Left>
<rd:DefaultName>Textbox9</rd:DefaultName>
<Top>0.50799cm</Top>
<Left>0.06614cm</Left>
<Height>0.38981cm</Height>
<Width>4.32745cm</Width>
<ZIndex>4</ZIndex>
<Width>6.69369cm</Width>
<ZIndex>5</ZIndex>
<Style>
<Border>
<Style>None</Style>
@@ -1272,6 +1309,14 @@
<DataField>Nombre</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Gpo">
<DataField>Gpo</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Moneda">
<DataField>Moneda</DataField>
<rd:TypeName>System.String</rd:TypeName>
</Field>
<Field Name="Codigo">
<DataField>Codigo</DataField>
<rd:TypeName>System.String</rd:TypeName>
@@ -1331,6 +1376,7 @@
<Prompt>ReportParameter1</Prompt>
</ReportParameter>
</ReportParameters>
<Language>es-MX</Language>
<rd:ReportUnitType>Cm</rd:ReportUnitType>
<rd:ReportID>40c94aad-a12a-44fb-ab0d-ea36a9656792</rd:ReportID>
</Report>

View File

@@ -5,6 +5,8 @@ Imports System.Data
Imports Extensiones
Imports System.Xml
Imports Microsoft.Reporting.WebForms
Imports GemBox.Spreadsheet
Partial Class General_SaldosIniciales
Inherits ClsPaginas
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
@@ -25,44 +27,46 @@ Partial Class General_SaldosIniciales
Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String)
Dim dt As New DataTable
Dim Conexion As Odbc.OdbcConnection = Nothing
' Conexion As Odbc.OdbcConnection = Nothing
Dim ErrorArchivo = False
Dim ErrorExcel = False
Dim strConnString As String = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + Ruta + FileName + ";Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1;"""
Dim objDbFactory As Common.DbProviderFactory = Common.DbProviderFactories.GetFactory("System.Data.OleDb")
Dim objDbAdapter As Common.DbDataAdapter = objDbFactory.CreateDataAdapter()
Dim objDbConnection As Common.DbConnection = objDbFactory.CreateConnection()
objDbConnection.ConnectionString = strConnString
objDbConnection.Open()
Dim objSheetNames As DataTable = objDbConnection.GetSchema("Tables")
Dim HojaExcel As String = objSheetNames.FiltroPrimeroValor("TABLE_NAME")
Try
Select Case Tipo
Case "CSV"
Conexion = New Odbc.OdbcConnection("Driver={Microsoft Access Text Driver (*.txt, *.csv)};Dbq=" + Ruta + ";Extensions=asc,csv,tab,txt;")
Conexion.Open()
Dim cmd = Conexion.CreateCommand()
cmd.CommandType = CommandType.Text
cmd.CommandText = $"SELECT * FROM [{FileName}]"
Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd)
DataAdapter.Fill(dt)
Case "EXCEL"
Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Ruta + FileName + ";")
Conexion.Open()
Dim cmd = Conexion.CreateCommand()
cmd.CommandType = CommandType.Text
cmd.CommandText = $"SELECT * FROM [{HojaExcel}]"
Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd)
DataAdapter.Fill(dt)
Case Else
Alert("El archivo no tiene el formato correcto", TipoMensaje.MsgError)
Exit Sub
End Select
Catch ex As Exception
ErrorArchivo = True
OnError("Ocurrio un error al leer el archivo <br/>" & ex.Message, ex)
End Try
Conexion.Close()
dt = ReadExcelFile(Ruta + FileName, True)
'Dim strConnString As String = "Provider=Microsoft.ACE.OLEDB.12.0; Data Source=" + Ruta + FileName + ";Extended Properties=""Excel 12.0 Xml;HDR=YES;IMEX=1;"""
'Dim objDbFactory As Common.DbProviderFactory = Common.DbProviderFactories.GetFactory("System.Data.OleDb")
'Dim objDbAdapter As Common.DbDataAdapter = objDbFactory.CreateDataAdapter()
'Dim objDbConnection As Common.DbConnection = objDbFactory.CreateConnection()
'objDbConnection.ConnectionString = strConnString
'objDbConnection.Open()
'Dim objSheetNames As DataTable = objDbConnection.GetSchema("Tables")
'Dim HojaExcel As String = objSheetNames.FiltroPrimeroValor("TABLE_NAME")
'Try
' Select Case Tipo
' Case "CSV"
' Conexion = New Odbc.OdbcConnection("Driver={Microsoft Access Text Driver (*.txt, *.csv)};Dbq=" + Ruta + ";Extensions=asc,csv,tab,txt;")
' Conexion.Open()
' Dim cmd = Conexion.CreateCommand()
' cmd.CommandType = CommandType.Text
' cmd.CommandText = $"SELECT * FROM [{FileName}]"
' Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd)
' DataAdapter.Fill(dt)
' Case "EXCEL"
' Conexion = New Odbc.OdbcConnection("Driver={Microsoft Excel Driver (*.xls, *.xlsx, *.xlsm, *.xlsb)};DBQ=" + Ruta + FileName + ";")
' Conexion.Open()
' Dim cmd = Conexion.CreateCommand()
' cmd.CommandType = CommandType.Text
' cmd.CommandText = $"SELECT * FROM [{HojaExcel}]"
' Dim DataAdapter = New Odbc.OdbcDataAdapter(cmd)
' DataAdapter.Fill(dt)
' Case Else
' Alert("El archivo no tiene el formato correcto", TipoMensaje.MsgError)
' Exit Sub
' End Select
'Catch ex As Exception
' ErrorArchivo = True
' OnError("Ocurrio un error al leer el archivo <br/>" & ex.Message, ex)
'End Try
'Conexion.Close()
If Not ErrorArchivo Then
If RblFormato.SelectedValue = "1" Or RblFormato.SelectedValue = "2" Then
If Not dt.Columns(0).ColumnName = "Codigo" Then
@@ -1523,57 +1527,69 @@ Partial Class General_SaldosIniciales
ElseIf RblFormato.SelectedValue = "12" Then
Dim ObjMovimientos As New ClsInventarios
ObjMovimientos.IniciaTransacSQL()
Dim OcurrioError As Boolean = False
Dim ProductosServiciosRef As DataTable = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa)
Dim AlmacenRef As DataTable = GlobalDTAlmacen(UsuarioActual.CveEmpresa)
Dim contadorMovimientos As Integer = 0
Dim listadoMovimientos As String = ""
Dim mensajeError As String = ""
Try
For Each almacenSinRepetir As DataRow In dt.FiltraParametros("", DistinctColumns:={"Almacen"}).Rows
Dim almacenActual As String = almacenSinRepetir("Almacen").ToString
Dim CveAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"Almacen = '{almacenActual}'").ToEntero
'Dim CveAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveAlmacen", $"Almacen = '{almacenActual}'").ToEntero
Dim CveAlmacen As Integer = AlmacenRef.FiltroPrimeroValor("CveAlmacen", $"Almacen = '{almacenActual}'").ToEntero
Dim movimientoCabecera As Integer = ObjMovimientos.AddMovimiento(CveAlmacen, 1, 1, Date.Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1)
listadoMovimientos += $"movimiento con folio <a href='/Inventarios/EntradasSalidas.aspx?CveMovimiento={movimientoCabecera}' target='_blank' style='color:blue'>{ObjMovimientos.Folio}</a><br/>"
If CveAlmacen > 0 Then
contadorMovimientos += 1
For Each nuevaEntrada As DataRow In dt.FiltraParametros($"Almacen = '{almacenActual}'").Rows
Dim CvePS As Integer = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePS", $"Codigo = '{nuevaEntrada("CodigoPS")}'").ToEntero
Dim CveUM As Integer = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveUnidadMedida", $"Codigo = '{nuevaEntrada("CodigoPS")}'").ToEntero
Dim RowPS As DataRow = ProductosServiciosRef.FiltroPrimero($"Codigo = '{nuevaEntrada("CodigoPS")}' AND CveEmpresa = {UsuarioActual.CveEmpresa}")
Dim CvePS As Integer = RowPS("CvePS").ToString().ToEntero
Dim CveUM As Integer = RowPS("CveUnidadMedida").ToString().ToEntero
If CvePS > 0 Then
If CveUM > 0 Then
Dim Cantidad As Decimal = nuevaEntrada("Existencia").ToString.ToDecimal
Dim Valor As Decimal = nuevaEntrada("Valor").ToString.ToDecimal
If Not ObjMovimientos.AddMovimientoDetalle(movimientoCabecera, Cantidad, CveUM, CvePS, (Valor / Cantidad), -1, -1) Then
OcurrioError = True
mensajeError = "No se logró generar el detalle del movimiento"
Throw New Exception()
End If
Else
OcurrioError = True
mensajeError = $"La unidad de medida no se reconoce para el producto servicio:{nuevaEntrada("CodigoPS")}"
Throw New Exception()
End If
Else
OcurrioError = True
mensajeError = $"No se encontró el producto o servicio con código ""{nuevaEntrada("CodigoPS")}"""
Throw New Exception()
End If
Next
Else
OcurrioError = True
'alert amacén no existe
mensajeError = $"No se encontró el almacén con nombre ""{almacenActual}"""
Throw New Exception()
Exit For
End If
Next
Catch ex As Exception
OcurrioError = True
If mensajeError = "" Then
mensajeError = "Error técnico, informar a soporte"
End If
ObjMovimientos.RollBack()
End Try
If Not OcurrioError Then
If mensajeError = "" Then
ObjMovimientos.Commit()
Alert($"Se cargaron correctamente {contadorMovimientos} movimientos<br/><br/>{listadoMovimientos}")
Else
Alert("Ocurrió un error al cargar las existencias", TipoMensaje.MsgError)
Alert(mensajeError, TipoMensaje.MsgError)
ObjMovimientos.RollBack()
End If
ObjMovimientos.Dispose()
ProductosServiciosRef.Dispose()
AlmacenRef.Dispose()
End If
End If
@@ -1618,5 +1634,51 @@ Partial Class General_SaldosIniciales
End If
End Sub
Private Function ReadExcelFile(ByVal flatFilePath As String, ByVal firstRowHasHeaders As Boolean) As DataTable
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim excelFile As ExcelFile = 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 ExcelWorksheet = excelFile.Worksheets(0)
For cols = 0 To worksheet.Rows(0).AllocatedCells.Count - 1
If firstRowHasHeaders Then
If worksheet.Rows(0).Cells(cols).Value IsNot Nothing Then
dataTable.Columns.Add(worksheet.Rows(0).Cells(cols).Value.ToString())
Else
dataTable.Columns.Add("Unnamed Column " & (System.Threading.Interlocked.Increment(unnamed)))
End If
curRow = 1
Else
dataTable.Columns.Add("Column " & (cols + 1))
End If
Next
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
End Class

View File

@@ -661,6 +661,7 @@ Partial Class Ventas_RepProductosServiciosDetalle
params.Add(New ReportParameter("LogoPath", ""))
End If
params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToString("dd/MM/yyyy")))
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
ImprimirPDF("Empresas/Grales/Formatos/RepProductosServiciosDetalle.rdlc", TmpDT, params, "ReportePS")