diff --git a/General/SaldosIniciales.aspx b/General/SaldosIniciales.aspx index 89ed63393..880cb1253 100644 --- a/General/SaldosIniciales.aspx +++ b/General/SaldosIniciales.aspx @@ -43,11 +43,12 @@ - - - - - + + + + + + diff --git a/General/SaldosIniciales.aspx.vb b/General/SaldosIniciales.aspx.vb index 3fbfc4bca..dc5e26407 100644 --- a/General/SaldosIniciales.aspx.vb +++ b/General/SaldosIniciales.aspx.vb @@ -449,7 +449,26 @@ Partial Class General_SaldosIniciales Alert("El nombre de la diescisieteava columna debe ser 'Clave Unidad'. Favor de corregirlo", TipoMensaje.MsgError) Exit Sub End If + ElseIf RblFormato.SelectedValue = "12" Then + If Not dt.Columns(0).ColumnName = "CodigoPS" Then + Alert("El nombre de la primera columna debe ser 'CodigoPS'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + If Not dt.Columns(1).ColumnName = "Almacen" Then + Alert("El nombre de la segunda columna debe ser 'Almacen'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + + If Not dt.Columns(2).ColumnName = "Existencia" Then + Alert("El nombre de la tercera columna debe ser 'Existencia'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If + + If Not dt.Columns(3).ColumnName = "Valor" Then + Alert("El nombre de la cuarta columna debe ser 'Valor'. Favor de corregirlo", TipoMensaje.MsgError) + Exit Sub + End If End If @@ -606,10 +625,10 @@ Partial Class General_SaldosIniciales 'If Not ObjPS.UpdatePS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", CodigoBarras, Descripcion, 0, 1, 1, False, 0, True, True, True, UsuarioActual.CveUsuario, CvePS, -1, -1, CveSATPS, ' CveTipoPS:=CveTipoPS, CveMarca:=CveMarca, CveTamaño:=CveTamaño, CveMedida:=CveMedida) Then ErrorPS = True - Codigo.GuardaLog - Exit For - Else - Contador += 1 + Codigo.GuardaLog + Exit For + Else + Contador += 1 End If Else If ObjPS.AddPS(CveClasificacion, 1, CveUnidadMedida, Codigo, "", "", Descripcion, 0, 0, 0, False, 0, False, True, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 1, 1, @@ -873,7 +892,7 @@ Partial Class General_SaldosIniciales End If Dim ConceptoContablePago As Integer = 17 If TipoDocto = "NC" Then ConceptoContablePago = 60 - + 'PrePólizaDetalle If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, Total, Folio, IIf(TipoDocto = "Fac", 5, 18).ToString.ToEntero, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=Total, CveSubProyecto:=Sucursal.ToEntero) Then ErrorCompras = True : Exit For If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, SubTotal, Folio, 6, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveCompra:=CveCompra, CveProveedor:=CveProveedor, ImporteMX:=SubTotal, CveClasificacion:=CveClasificacion, CveSubProyecto:=Sucursal.ToEntero) Then ErrorCompras = True : Exit For @@ -927,7 +946,7 @@ Partial Class General_SaldosIniciales If Not CvePS > 0 Then Alert(String.Format("No se encontró el Producto Servicio"), TipoMensaje.MsgError) : ErrorVentas = True ' If Not CveSucursal > 0 Then Alert("No se encontró la sucursal.", TipoMensaje.MsgError) : ErrorVentas = True If Not CveUnidadMedida > 0 Then Alert(String.Format("No se encontró la Unidad de Medida."), TipoMensaje.MsgError) : ErrorVentas = True - Dim dtsubp As DataTable = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) + Dim dtsubp As DataTable = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) For Each Row As DataRow In dt.FiltraParametros("RFC <> ''").Rows @@ -953,7 +972,7 @@ Partial Class General_SaldosIniciales Dim IEPS As Decimal = Row("IEPS").ToString.ToDecimal Dim CveClienteSucursal As Integer = Row("CveClienteSucursal").ToString.ToEntero - GuardaLog(Sucursal + "-" + Row("Sucursal").ToString) + GuardaLog(Sucursal + "-" + Row("Sucursal").ToString) 'Temporalmente SE BORRARA Dim Transaccion As String = "" ' Row("Transaccion2").ToString Dim Folio2 As String = "" ' Row("Folio2").ToString @@ -1015,7 +1034,7 @@ Partial Class General_SaldosIniciales ConceptoContablePago = 91 End If - + 'PrePólizaDetalle If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, True, SubTotal, Folio.ToString, 4, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveClasificacion:=CveClasificacion, ImporteMX:=SubTotal, CveSubProyecto:=Sucursal.ToEntero) Then ErrorVentas = True : Exit For If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, False, Total, Folio.ToString, ConceptoContable, String.Format("{0}-{1}", Serie, Folio), Fecha, -1, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, ImporteMX:=Total) Then ErrorVentas = True : Exit For @@ -1501,7 +1520,29 @@ Partial Class General_SaldosIniciales End Try ObjConta.Dispose() + ElseIf RblFormato.SelectedValue = "12" Then + Dim ObjMovimientos As New ClsInventarios + ObjMovimientos.IniciaTransacSQL() + 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).FiltraParametros("CveAlmacen", $"Almacen = {almacenActual}").ToEntero + For Each nuevaEntrada As DataRow In dt.FiltraParametros($"Almacen = {almacenActual}").Rows + Dim CvePS As Integer = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa).FiltraParametros("CvePS", $"PSCodigo = {nuevaEntrada("CodigoPS")}").ToEntero + If CvePS > 0 Then + Dim Cantidad As Double = nuevaEntrada("Existencia").ToString.ToDouble + Dim Valor As Double = nuevaEntrada("Valor").ToString.ToDouble + Dim movimientoCabecera As Integer = ObjMovimientos.AddMovimiento(CveAlmacen, 1, 1, Date.Now, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1) + If ObjMovimientos.AddMovimientoDetalle(movimientoCabecera, Cantidad, -1, CvePS, (Valor / Cantidad), -1, -1) Then + Alert("Movimiento terminado con exito") + End If + End If + Next + Next + Catch ex As Exception + End Try + ObjMovimientos.Dispose() End If End If @@ -1528,6 +1569,8 @@ Partial Class General_SaldosIniciales Directorio = AppDomain.CurrentDomain.BaseDirectory & "Empresas\Grales\SaldosIniciales\FormatoContabilidad.xlsx" ElseIf RblFormato.SelectedValue = "9" Then Directorio = AppDomain.CurrentDomain.BaseDirectory & "Empresas\Grales\SaldosIniciales\FormatoContabilidad.xlsx" + ElseIf RblFormato.SelectedValue = "12" Then + Directorio = AppDomain.CurrentDomain.BaseDirectory & "Empresas\Grales\SaldosIniciales\FormatoAlmacen.xlsx" End If Dim Archivo As New IO.FileInfo(Directorio)