Carga de almacen 1 sola vez al cargar venta, validacion de fechas de carta porte
This commit is contained in:
@@ -662,7 +662,7 @@
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="SATClaveProdServ">
|
||||
<Textbox Name="Codigo1">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
@@ -674,19 +674,13 @@
|
||||
<FontSize>7pt</FontSize>
|
||||
</Style>
|
||||
</TextRun>
|
||||
<TextRun>
|
||||
<Value xml:space="preserve"> </Value>
|
||||
<Style>
|
||||
<FontSize>7pt</FontSize>
|
||||
</Style>
|
||||
</TextRun>
|
||||
</TextRuns>
|
||||
<Style>
|
||||
<TextAlign>Left</TextAlign>
|
||||
</Style>
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>SATClaveProdServ</rd:DefaultName>
|
||||
<rd:DefaultName>Codigo1</rd:DefaultName>
|
||||
<Style>
|
||||
<Border>
|
||||
<Color>LightGrey</Color>
|
||||
@@ -742,7 +736,7 @@
|
||||
</TablixCell>
|
||||
<TablixCell>
|
||||
<CellContents>
|
||||
<Textbox Name="Codigo">
|
||||
<Textbox Name="SATClaveProdServ">
|
||||
<CanGrow>true</CanGrow>
|
||||
<KeepTogether>true</KeepTogether>
|
||||
<Paragraphs>
|
||||
@@ -760,7 +754,7 @@
|
||||
</Style>
|
||||
</Paragraph>
|
||||
</Paragraphs>
|
||||
<rd:DefaultName>Codigo</rd:DefaultName>
|
||||
<rd:DefaultName>SATClaveProdServ</rd:DefaultName>
|
||||
<Style>
|
||||
<Border>
|
||||
<Color>LightGrey</Color>
|
||||
@@ -3275,6 +3269,18 @@
|
||||
<Parameter Name="NumTotalMercancias">
|
||||
<Value>=Parameters!SRP_NumTotalMercancias.Value</Value>
|
||||
</Parameter>
|
||||
<Parameter Name="PermisoSCTRemolque1">
|
||||
<Value>=Parameters!SRP_PermisoSCTRemolque1.Value</Value>
|
||||
</Parameter>
|
||||
<Parameter Name="PermisoSCTRemolque2">
|
||||
<Value>=Parameters!SRP_PermisoSCTRemolque2.Value</Value>
|
||||
</Parameter>
|
||||
<Parameter Name="ConfATR1">
|
||||
<Value>=Parameters!SRP_ConfATR1.Value</Value>
|
||||
</Parameter>
|
||||
<Parameter Name="ConfATR2">
|
||||
<Value>=Parameters!SRP_ConfATR2.Value</Value>
|
||||
</Parameter>
|
||||
</Parameters>
|
||||
<Top>0.06863cm</Top>
|
||||
<Height>1.11461cm</Height>
|
||||
@@ -4668,6 +4674,30 @@
|
||||
<AllowBlank>true</AllowBlank>
|
||||
<Prompt>ReportParameter1</Prompt>
|
||||
</ReportParameter>
|
||||
<ReportParameter Name="SRP_PermisoSCTRemolque1">
|
||||
<DataType>String</DataType>
|
||||
<Nullable>true</Nullable>
|
||||
<AllowBlank>true</AllowBlank>
|
||||
<Prompt>ReportParameter1</Prompt>
|
||||
</ReportParameter>
|
||||
<ReportParameter Name="SRP_PermisoSCTRemolque2">
|
||||
<DataType>String</DataType>
|
||||
<Nullable>true</Nullable>
|
||||
<AllowBlank>true</AllowBlank>
|
||||
<Prompt>ReportParameter1</Prompt>
|
||||
</ReportParameter>
|
||||
<ReportParameter Name="SRP_ConfATR1">
|
||||
<DataType>String</DataType>
|
||||
<Nullable>true</Nullable>
|
||||
<AllowBlank>true</AllowBlank>
|
||||
<Prompt>ReportParameter1</Prompt>
|
||||
</ReportParameter>
|
||||
<ReportParameter Name="SRP_ConfATR2">
|
||||
<DataType>String</DataType>
|
||||
<Nullable>true</Nullable>
|
||||
<AllowBlank>true</AllowBlank>
|
||||
<Prompt>ReportParameter1</Prompt>
|
||||
</ReportParameter>
|
||||
</ReportParameters>
|
||||
<EmbeddedImages>
|
||||
<EmbeddedImage Name="Logo">
|
||||
|
||||
@@ -2719,15 +2719,15 @@ Partial Class Ventas
|
||||
LnkImprimirFormatoTelcel.Visible = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.TienePermisoProceso(269) AndAlso Not DevolucionAlmacen = 2 Then
|
||||
Dim ObjInventario As New ClsInventarios
|
||||
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
If ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
DivDevAlm.Visible = True
|
||||
End If
|
||||
End If
|
||||
ObjInventario.Dispose()
|
||||
End If
|
||||
'If UsuarioActual.TienePermisoProceso(269) AndAlso Not DevolucionAlmacen = 2 Then
|
||||
' Dim ObjInventario As New ClsInventarios
|
||||
' If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
' If ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
' DivDevAlm.Visible = True
|
||||
' End If
|
||||
' End If
|
||||
' ObjInventario.Dispose()
|
||||
'End If
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "Ing" Then
|
||||
CargaVentaCortePorte(Me.CveVenta)
|
||||
@@ -4404,7 +4404,7 @@ Partial Class Ventas
|
||||
Dim ObjVentas As New ClsVentas()
|
||||
|
||||
If ObjVentas.GetVentasRelacionadas(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
DtAntRelacionados = ObjVentas.DtResultados.Copy()
|
||||
DtAntRelacionados = ObjVentas.DtResultados.FiltraParametros("TipoDocto IN ('Ing','Ant','Egs','Dev')")
|
||||
End If
|
||||
|
||||
Dim SerieFolioPadre As String
|
||||
@@ -8396,6 +8396,12 @@ Partial Class Ventas
|
||||
Alert("La carta porte no tiene la F.Llegada definida.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If TxtFechaLlegadaCP.Text.ToDateTime() < TxtFechaEntregaCP.Text.ToDateTime() Then
|
||||
Alert("La fecha de llegada no puede ser menor al fecha de salida.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If DtMercancias Is Nothing OrElse DtMercancias.Rows.Count = 0 Then
|
||||
Alert("La carta porte no tiene mercancía definida.", TipoMensaje.MsgAdvertencia)
|
||||
Exit Sub
|
||||
@@ -14498,11 +14504,6 @@ Partial Class Ventas
|
||||
Filtro = "CveConcepto = 9"
|
||||
End Select
|
||||
|
||||
Dim DtExistencias As DataTable = Nothing
|
||||
If ObjInventario.GetInv_Mov(Me.CveVentaDevolucion, UsuarioActual.CveEmpresa) Then
|
||||
DtExistencias = ObjInventario.DtResultados.FiltraParametros($"CvePS Is Not NULL AND {Filtro}")
|
||||
End If
|
||||
|
||||
Dim CveConceptoAlmacen As Integer = 3
|
||||
If factura.TipoDocto = "Dev" Then
|
||||
CveConceptoAlmacen = 18
|
||||
@@ -14571,6 +14572,11 @@ Partial Class Ventas
|
||||
If CveProducto > 0 Then
|
||||
'SI ES ENTRADA DEBE TENER EL COSTO DE LA SALIDA
|
||||
If CveConceptoAlmacen.Contiene(18) Then
|
||||
Dim DtExistencias As DataTable = Nothing
|
||||
If ObjInventario.GetInv_Mov(Me.CveVentaDevolucion, UsuarioActual.CveEmpresa) Then
|
||||
DtExistencias = ObjInventario.DtResultados.FiltraParametros($"CvePS Is Not NULL AND {Filtro}")
|
||||
End If
|
||||
|
||||
PU = DtExistencias.FiltroPrimeroValor("PU", $"CvePS = {Dr("CvePS")} AND CveUM = {Dr("CveUM").ToString().ToEntero()}").ToString().ToDecimal
|
||||
If PU <= 0 Then
|
||||
ErrorList.Add("Ocurrió un error al obtener el costo.<br />")
|
||||
@@ -14980,45 +14986,6 @@ Partial Class Ventas
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
Select Case ConversionRemision
|
||||
Case "*"
|
||||
For Each Row As DataRow In TmpDT.Rows
|
||||
Row("PU") = Math.Round(Row("PU").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
|
||||
Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
|
||||
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
|
||||
Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
|
||||
Next
|
||||
|
||||
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
|
||||
If gvr.RowType = DataControlRowType.DataRow Then
|
||||
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TipoCambioRemision, NumeroDecimales)).FormatoNumero
|
||||
End If
|
||||
Next
|
||||
Case "/"
|
||||
For Each Row As DataRow In TmpDT.Rows
|
||||
Row("PU") = Math.Round(Row("PU").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
|
||||
Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
|
||||
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
|
||||
Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
|
||||
Next
|
||||
|
||||
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
|
||||
If gvr.RowType = DataControlRowType.DataRow Then
|
||||
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TipoCambioRemision, NumeroDecimales)).FormatoNumero
|
||||
End If
|
||||
Next
|
||||
Case Else
|
||||
|
||||
End Select
|
||||
|
||||
Dim CartaPorte As Modelos.MSubReportData = Nothing
|
||||
|
||||
If UsuarioActual.CveEmpresa = 13 Then
|
||||
@@ -15028,47 +14995,6 @@ Partial Class Ventas
|
||||
|
||||
ImprimirbytesPDF(PdfFactura(ObjFactura, Guardar:=False, SubReportData:=CartaPorte), "Factura", "PDF")
|
||||
|
||||
Select Case ConversionRemision
|
||||
Case "*"
|
||||
For Each Row As DataRow In TmpDT.Rows
|
||||
Row("PU") = Math.Round(Row("PU").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
|
||||
Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
|
||||
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
|
||||
Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble * TipoCambioRemision, NumeroDecimales)
|
||||
Next
|
||||
|
||||
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
|
||||
If gvr.RowType = DataControlRowType.DataRow Then
|
||||
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TipoCambioRemision, NumeroDecimales)).FormatoNumero
|
||||
End If
|
||||
Next
|
||||
Case "/"
|
||||
For Each Row As DataRow In TmpDT.Rows
|
||||
Row("PU") = Math.Round(Row("PU").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
|
||||
Row("Total") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
|
||||
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDouble * Row("PU").ToString().ToDouble, NumeroDecimales)
|
||||
Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
|
||||
Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDouble / TipoCambioRemision, NumeroDecimales)
|
||||
Next
|
||||
|
||||
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
|
||||
If gvr.RowType = DataControlRowType.DataRow Then
|
||||
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TipoCambioRemision, NumeroDecimales)).FormatoNumero
|
||||
End If
|
||||
Next
|
||||
Case Else
|
||||
|
||||
End Select
|
||||
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
@@ -16630,150 +16556,6 @@ Partial Class Ventas
|
||||
#End Region
|
||||
|
||||
#Region "I M A G E - B U T T O N S"
|
||||
Protected Function CancelarMovimientoInventario(ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, CveVentaNueva As Integer, CveVentaVieja As Integer) As Boolean
|
||||
|
||||
'SI YA ESTA QUEMADA DE ALMACEN LA VENTA, NO SE CANCELAN LOS MOVIMIENTOS DE INVENTARIO
|
||||
If ObjInventario.GetEstatusVentaPorSurtir(CveVentaVieja) Then
|
||||
If ObjInventario.EsDevolucionVenta = 2 Then
|
||||
Return True
|
||||
End If
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
|
||||
Dim DtMovimientos As DataTable
|
||||
Dim DTMovimientosDetalles As DataTable
|
||||
Dim OcurrioError As Boolean = False
|
||||
|
||||
'Verificamos que la venta tenga movimientos
|
||||
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
If ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
DtMovimientos = ObjInventario.DtResultados.FiltraParametros("CveConcepto = 3", DistinctColumns:={"CveMovimiento"})
|
||||
DTMovimientosDetalles = ObjInventario.DtResultados.FiltraParametros("CvePS > 0")
|
||||
|
||||
For Each Mov As DataRow In DtMovimientos.Rows
|
||||
If ObjInventario.GetMovimientos(Mov("CveMovimiento").ToString().ToEntero(), 3, -1, UsuarioActual.CveEmpresa) Then
|
||||
If ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
|
||||
Dim CveAlmacen As Integer = ObjInventario.DtResultados(0)("CveAlmacen").ToString().ToEntero()
|
||||
Dim CveMoneda As Integer = ObjInventario.DtResultados(0)("CveMoneda").ToString().ToEntero()
|
||||
Dim Fecha As Date = Now
|
||||
|
||||
'Creamos el movimiento de entrada y el movimiento de salida
|
||||
Dim CveMovimientoInventarioEntrada As Integer = ObjInventario.AddMovimiento(CveAlmacen, 18, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveDevolucion, -1, -1, MovimientoFijo:=True, Modulo:="Vta/E2")
|
||||
Dim CveMovimientoInventarioSalida As Integer = ObjInventario.AddMovimiento(CveAlmacen, 3, CveMoneda, Fecha, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaNueva, -1, -1, MovimientoFijo:=True, Modulo:="Vta/E3")
|
||||
|
||||
If CveMovimientoInventarioEntrada > 0 AndAlso CveMovimientoInventarioSalida > 0 Then
|
||||
|
||||
'Creamos sus detalles
|
||||
For Each MovDet As DataRow In DTMovimientosDetalles.FiltraParametros($"CveMovimiento = {Mov("CveMovimiento")}").Rows
|
||||
|
||||
Dim Cantidad As Double = MovDet("Cantidad").ToString().ToDouble
|
||||
Dim CveUnidad As Integer = MovDet("CveUM").ToString().ToEntero()
|
||||
Dim PU As Decimal = MovDet("PU").ToString().ToDecimal
|
||||
Dim CveProducto As Integer = MovDet("CvePS").ToString().ToEntero()
|
||||
Dim Serie As String = MovDet("Serie").ToString()
|
||||
Dim Lote As String = MovDet("Lote").ToString()
|
||||
Dim FechaCaducidad As Date = MovDet("FechaCaducidad").ToString().ToDate
|
||||
|
||||
|
||||
Dim CveVentaDetalle = MovDet("CveVentaDetalle").ToString().ToEntero()
|
||||
|
||||
'Entrada
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioEntrada, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveVentaDetalle:=CveVentaDetalle) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'Salida
|
||||
CveVentaDetalle = ObjInventario.VentaDetallePadreGet(CveVentaDetalle).ToString().ToEntero()
|
||||
If CveVentaDetalle > 0 Then
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventarioSalida, Cantidad, CveUnidad, CveProducto, PU, -1, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveVentaDetalle:=CveVentaDetalle) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
'Creamos sus prepolizas
|
||||
If Not OcurrioError Then
|
||||
Dim tmpCostos As DataTable = DTMovimientosDetalles.FiltraParametros($"CveMovimiento = {Mov("CveMovimiento")}", "", {"CveClasificacion"})
|
||||
Dim IdCtaContable As Integer = 0
|
||||
Dim CveCuenta As Integer = 0
|
||||
Dim ValorInventario As Decimal = 0
|
||||
|
||||
For Each RowInv As DataRow In tmpCostos.Rows
|
||||
ValorInventario = DTMovimientosDetalles.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL()
|
||||
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGasto", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
|
||||
CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
|
||||
|
||||
If ValorInventario <> 0 Then
|
||||
'Entrada
|
||||
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveDevolucion, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventarioEntrada, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
|
||||
'Salida
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventarioSalida, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
If OcurrioError Then
|
||||
Exit For
|
||||
End If
|
||||
|
||||
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", $"CveAlmacen = {ddlAlmacen.SelectedValue}").ToEntero()
|
||||
ValorInventario = DTMovimientosDetalles.SUMD("Total", $"CveMovimiento = {Mov("CveMovimiento")}").RoundSQL()
|
||||
|
||||
If ValorInventario <> 0 Then
|
||||
'Entrada
|
||||
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveDevolucion, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=-1, CveMovimientoAlmacen:=CveMovimientoInventarioEntrada, ImporteMX:=ValorInventario) Then
|
||||
'Salida
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, ValorInventario, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=-1, CveMovimientoAlmacen:=CveMovimientoInventarioSalida, ImporteMX:=ValorInventario) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Else
|
||||
'Si no tiene Movimientos de Salida no ocupamos mas
|
||||
Return Not OcurrioError
|
||||
End If
|
||||
|
||||
Else
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
Return Not OcurrioError
|
||||
End Function
|
||||
Protected Function CancelarFactura(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjAC As ClsContPAQi, ByRef ObjBancos As ClsBancos) As Boolean
|
||||
Dim IDPoliza As Integer = -1
|
||||
Dim CvePrePoliza As Integer
|
||||
@@ -20062,41 +19844,6 @@ Partial Class Ventas
|
||||
|
||||
Return MovDTCuadrados
|
||||
End Function
|
||||
Private Function SalidaEntradaAlmacen(ByRef ObjInventario As ClsInventarios, CveRemision As Integer, ByRef ObjConta As ClsContabilidad) As Boolean
|
||||
Dim OcurrioError As Boolean = False
|
||||
Dim DtMovimientos As DataTable
|
||||
Dim DtMovimientosDetalles As DataTable
|
||||
|
||||
'Obtenemos los movimientos detalle
|
||||
If ObjInventario.GetInv_Mov(CveRemision, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
If ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
|
||||
DtMovimientos = ObjInventario.DtResultados.FiltraParametros("", DistinctColumns:={"CveMovimiento"})
|
||||
DtMovimientosDetalles = ObjInventario.DtResultados.FiltraParametros("CvePS > 0")
|
||||
|
||||
For Each dr As DataRow In DtMovimientos.Rows
|
||||
|
||||
'Obtenemos los Movimientos de salida
|
||||
If ObjInventario.GetMovimientos(dr("CveMovimiento").ToString().ToEntero(), 3, -1, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
Dim CveAlmacenSalida As Integer = ObjInventario.DtResultados(0)("CveAlmacen").ToString().ToEntero()
|
||||
Dim CveMoneda As Integer = ObjInventario.DtResultados(0)("CveMoneda").ToString().ToEntero()
|
||||
|
||||
'Le damos entrada
|
||||
If Not GenerarMovimientoAlmacen(ObjInventario, DtMovimientosDetalles.FiltraParametros($"CveMovimiento = {dr("CveMovimiento")}"), CveAlmacenSalida, 2, CveMoneda, CveRemision) > 0 Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Return Not OcurrioError
|
||||
End Function
|
||||
Private Function GenerarMovimientoAlmacen(ByRef ObjInventario As ClsInventarios, DtMovDetalle As DataTable, CveAlmacen As Integer, ConceptoEntrada As Integer, CveMoneda As Integer, CveVenta As Integer, Optional MovimientoPrePoliza As Boolean = False,
|
||||
Optional ByRef ObjConta As ClsContabilidad = Nothing, Optional CveMovimientoRelacionado As Integer = -1, Optional AplicaMovimientoDetalleEntrada As Boolean = False, Optional ObjContPaq As ClsContPAQi = Nothing) As Integer
|
||||
Dim OcurrioError As Boolean = False
|
||||
@@ -22664,6 +22411,10 @@ Partial Class Ventas
|
||||
Dim ObjInv As New ClsInventarios
|
||||
If ObjInv.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
If ObjInv.DtResultados.Rows.Count > 0 Then
|
||||
If UsuarioActual.TienePermisoProceso(269) AndAlso Not DevolucionAlmacen = 2 Then
|
||||
DivDevAlm.Visible = True
|
||||
TieneAlmacen = True
|
||||
End If
|
||||
CargaGVInv(ObjInv.DtResultados)
|
||||
End If
|
||||
End If
|
||||
|
||||
Reference in New Issue
Block a user