Cambios pendientes por liberar
This commit is contained in:
@@ -100,6 +100,7 @@
|
||||
<asp:ListItem Text="Estatus Fact." Value="9"></asp:ListItem>
|
||||
<asp:ListItem Text="% IVA" Value="10"></asp:ListItem>
|
||||
<asp:ListItem Text="Forma de Pago" Value="15"></asp:ListItem>
|
||||
<asp:ListItem Text="Vendedor/Cliente" Value="16"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -48,7 +48,7 @@ Partial Class Ventas_RepRecuperacion
|
||||
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
|
||||
If Not IsPostBack Then
|
||||
CargaCombos()
|
||||
CargaDatos()
|
||||
'CargaDatos()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -75,6 +75,8 @@ Partial Class Ventas_RepRecuperacion
|
||||
'Carga Vendedor
|
||||
DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
|
||||
DdlVendedor.DataBind()
|
||||
DdlVendedor.Items.Insert(1, New ListItem("Sin Vendedor", "-2"))
|
||||
|
||||
DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor)
|
||||
If UsuarioActual.CveVendedor > 0 AndAlso Not UsuarioActual.TienePermisoProceso(263) Then
|
||||
DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString())
|
||||
@@ -177,7 +179,20 @@ Partial Class Ventas_RepRecuperacion
|
||||
DdlGrupo.SelectedValue, e.Row.DBCampo("CveCliente"), e.Row.DBCampo("CveSubProyecto"), e.Row.DBCampo("CveVendedor"),
|
||||
e.Row.DBCampo("CveUsuario"), e.Row.DBCampo("CveEstatusFactura"), e.Row.DBCampo("GPO_IVA"), FechaI, FechaF, DdlResponsable.SelectedValue, e.Row.DBCampo("TipoDocto"), CveClienteSucursal, e.Row.DBCampo("CveBanco"), e.Row.DBCampo("CveCuenta"), e.Row.DBCampo("GPO"), e.Row.DBCampo("TipoCambio"), e.Row.DBCampo("TCEspecifico"), e.Row.DBCampo("CveMoneda"), 1, e.Row.DBCampo("EsDistribuidor"))
|
||||
|
||||
e.Row.FCHyperLink("HplVendido").NavigateUrl = Liga5
|
||||
e.Row.FCHyperLink("HplVendido").NavigateUrl = Liga5
|
||||
|
||||
|
||||
If DdlGrupo.SelectedValue.ToEntero = 16 Then
|
||||
If e.Row.DBCampo("GPO").Contains("Total") Then
|
||||
e.Row.CssClass = "Totales"
|
||||
Else
|
||||
If e.Row.DBCampo("CveCliente") = "" Then
|
||||
e.Row.CssClass = "SubTotales"
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -16,10 +16,10 @@
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkPdf" OnClick="LnkPdf_Click" runat="server"> <i class="fa fa-ad-pdf"></i> Generar PDF</asp:LinkButton>
|
||||
<asp:LinkButton ID="LnkPdf" OnClick="LnkPdf_Click" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> PDF</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:LinkButton ID="ImgExcel" OnClick="ImgExcel_Click" runat="server"><i class="fa fa-ad-excel"></i> Exporta Excel</asp:LinkButton>
|
||||
<asp:LinkButton ID="ImgExcel" OnClick="ImgExcel_Click" runat="server"><i class="fa fa-file-excel-o" style="font-weight:bold;"></i> Excel</asp:LinkButton>
|
||||
</li>
|
||||
<li>
|
||||
<asp:HyperLink NavigateUrl="javascript:;" data-toggle="modal" data-target="#DivTipoCambio" ID="ImgTipoCambio" runat="server"> <i class="fa fa-money"></i> Ver Dlls en pesos</asp:HyperLink>
|
||||
|
||||
@@ -112,7 +112,8 @@ Partial Class Ventas_RepRecuperacionDetalle
|
||||
DdlVendedor.SelectedValueExist(UsuarioActual.CveVendedor.ToString())
|
||||
DdlVendedor.Attributes.Add("disabled", "disabled")
|
||||
DdlVendedor.Enabled = False
|
||||
End If
|
||||
End If
|
||||
DdlVendedor.Items.Insert(0, New ListItem("Sin Vendedor", "-2"))
|
||||
|
||||
'Carga Usuarios
|
||||
DdlUsuario.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
|
||||
@@ -274,7 +274,8 @@ Partial Class RepVentaDetalle
|
||||
DdlGrupo.Items.Insert(10, New ListItem("Año Ejec.", "11"))
|
||||
DdlGrupo.Items.Insert(11, New ListItem("Mes Ejec.", "12"))
|
||||
DdlGrupo.Items.Insert(12, New ListItem("Año/Mes Ejec.", "13"))
|
||||
DdlGrupo.Items.Insert(13, New ListItem("Fecha Ejec.", "14"))
|
||||
DdlGrupo.Items.Insert(13, New ListItem("Fecha Ejec.", "14"))
|
||||
DdlGrupo.Items.Insert(13, New ListItem("Vendedor/Cliente", "21"))
|
||||
DdlGrupo.DataBind()
|
||||
End Sub
|
||||
|
||||
|
||||
@@ -252,6 +252,7 @@ Partial Class Ventas_RepVentas
|
||||
DdlVendedor.DataSource = GlobalDTVendedores(UsuarioActual.CveEmpresa)
|
||||
DdlVendedor.DataBind()
|
||||
DdlVendedor.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
DdlVendedor.Items.Insert(1, New ListItem("Sin Vendedor", "-2"))
|
||||
|
||||
'CargaUsuarios
|
||||
DdlUsuario.DataSource = GlobalDTUsuarios.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
|
||||
|
||||
@@ -99,7 +99,7 @@
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
|
||||
|
||||
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />
|
||||
<%--<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true" />--%>
|
||||
|
||||
<asp:UpdatePanel ID="UPFiltros" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
|
||||
@@ -5,8 +5,8 @@ Imports System.Data
|
||||
Imports System.Drawing
|
||||
Imports Extensiones
|
||||
Imports Microsoft.Reporting.WebForms
|
||||
Imports CrystalDecisions.CrystalReports.Engine
|
||||
Imports CrystalDecisions.Shared
|
||||
'Imports CrystalDecisions.CrystalReports.Engine
|
||||
'Imports CrystalDecisions.Shared
|
||||
|
||||
Partial Class Ventas_RepVentasUtilidad
|
||||
Inherits ClsPaginas
|
||||
|
||||
@@ -1255,6 +1255,15 @@ Partial Class Ventas
|
||||
ViewState("PermiteCredito") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property CreditoDisponible As Double
|
||||
Get
|
||||
Return If(IsNothing(ViewState("CreditoDisponible")), 0, ViewState("CreditoDisponible")).ToString().ToDecimal
|
||||
End Get
|
||||
Set(value As Double)
|
||||
ViewState("CreditoDisponible") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property DtAnticipoAmortizacion As DataTable
|
||||
Get
|
||||
Return CType(ViewState("DtAnticipoAmortizacion"), DataTable)
|
||||
@@ -18435,7 +18444,7 @@ Partial Class Ventas
|
||||
|
||||
'SI LA REMISION SE SURTIO CON USADOS UTILIZAR ESTE MOVIMIENTO
|
||||
If ObjInventario.GetInv_Mov(CveRemision, UsuarioActual.CveEmpresa) Then
|
||||
Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND (CveTipoAlmacen = 24 AND CveConcepto = 2) AND CveVenta > 0")
|
||||
Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND (CveTipoAlmacen = 1 AND CveConcepto IN (3,8)) AND CveVenta > 0")
|
||||
|
||||
If RowMovimiento IsNot Nothing Then
|
||||
CveMovimientoReferencia = RowMovimiento("CveMovimiento").ToString().ToEntero()
|
||||
@@ -18450,7 +18459,7 @@ Partial Class Ventas
|
||||
'SI NO SE SURTIO LA REMSION CON USADOS, UTILIZAR EL MOVIMIENTO DE SALIDA DEL INGRESO
|
||||
If CveMovimientoReferencia <= 0 Then
|
||||
If ObjInventario.GetInv_Mov(ObjFactura.CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND ( (CveTipoAlmacen = 1 AND CveConcepto = 3) OR (CveTipoAlmacen = 10 AND CveConcepto = 40) ) AND CveVenta > 0")
|
||||
Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND ( (CveTipoAlmacen = 1 AND CveConcepto IN (3,8)) OR (CveTipoAlmacen = 10 AND CveConcepto = 40) ) AND CveVenta > 0")
|
||||
|
||||
If RowMovimiento IsNot Nothing Then
|
||||
CveMovimientoReferencia = RowMovimiento("CveMovimiento").ToString().ToEntero()
|
||||
@@ -18466,121 +18475,8 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoReferencia, UsuarioActual.CveEmpresa) Then
|
||||
DtPSVirtual = ObjInventario.DtResultados.Copy()
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
If Not OcurrioError AndAlso DtPSVirtual.Rows.Count > 0 Then
|
||||
|
||||
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, ObjFactura.CveVenta, -1, -1, Modulo:="Vta/VV", CveMovimientoRelacionado:=CveMovimientoReferencia)
|
||||
|
||||
If CveMovimientoVirtual > 0 Then
|
||||
For Each RowUsado As DataRow In DtPSVirtual.Rows
|
||||
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
|
||||
Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble()
|
||||
Dim PU As Decimal = RowUsado("Cargo").ToString().ToDecimal()
|
||||
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
'Agregamos las PrePolizas
|
||||
If Not OcurrioError Then
|
||||
If CveMovimientoVirtual > 0 Then
|
||||
'OcurrioError = Not GeneraPrePolizaMovimientoAlmacen(ObjInventario, ObjConta, ObjContPaq, ObjFactura, ObjFactura.CvePrePoliza, CveMovimientoInventario, CveAlmacen)
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoVirtual, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
Dim DtCostos = ObjInventario.DtResultados.Copy
|
||||
Dim DtCostosDistinct As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"})
|
||||
Dim IdCtaContable As Integer = 0
|
||||
Dim CveCuenta As Integer = 0
|
||||
Dim ValorInventario As Decimal
|
||||
Dim TotalCostoAcumulado As Decimal = 0D
|
||||
Dim Cont As Integer = 1
|
||||
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundSQL
|
||||
|
||||
For Each RowInv As DataRow In DtCostosDistinct.Rows
|
||||
ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL
|
||||
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
|
||||
CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
|
||||
TotalCostoAcumulado += ValorInventario
|
||||
|
||||
'cuando es el último movimiento y hay diferencias en los importes
|
||||
If Cont = DtCostosDistinct.Rows.Count AndAlso TotalCosto <> TotalCostoAcumulado Then
|
||||
ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado)
|
||||
End If
|
||||
|
||||
Try
|
||||
'If ValorInventario <> 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoVirtual, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
'End If
|
||||
Catch ex As Exception
|
||||
OcurrioError = True
|
||||
Alert("Error inesperado (15148). Por favor comuniquese con atención SIG.", TipoMensaje.ToastError)
|
||||
End Try
|
||||
Cont += 1
|
||||
Next
|
||||
|
||||
If Not OcurrioError Then
|
||||
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacenVirtual)).ToEntero()
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, TotalCosto, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveMovimientoAlmacen:=CveMovimientoVirtual, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al generar el almacen virtual.", ex)
|
||||
OcurrioError = True
|
||||
End Try
|
||||
|
||||
Return Not OcurrioError
|
||||
|
||||
End Function
|
||||
Private Function GenerarMovimientoAlmacenVirtualConsignacion(CveVenta As Integer, CveAlmacenContrato As Integer, ByRef ObjInventario As ClsInventarios, ObjFactura As Modelos.Factura, Optional ByRef ObjConta As ClsContabilidad = Nothing) As Boolean
|
||||
Dim OcurrioError As Boolean = False
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
|
||||
Try
|
||||
Dim CveMovimientoVirtual As Integer = -1
|
||||
Dim CveAlmacenVirtual As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacenContrato).FiltroPrimeroValor("CveAlmacenVirtual").ToEntero()
|
||||
|
||||
Dim CveConceptoMovimientoVirtual As Integer = 37
|
||||
Dim DtPSVirtual As DataTable = Nothing
|
||||
Dim DtTamanios As DataTable = Nothing
|
||||
Dim CveMovimientoReferencia As Integer = -1
|
||||
Dim CveSubProyecto As Integer = -1
|
||||
|
||||
|
||||
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND ((CveTipoAlmacen = 24 AND CveConcepto = 2) OR (CveTipoAlmacen = 17 AND CveConcepto = 8)) AND CveVenta > 0")
|
||||
|
||||
If RowMovimiento IsNot Nothing Then
|
||||
CveMovimientoReferencia = RowMovimiento("CveMovimiento").ToString().ToEntero()
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
'SI TIENE ALMACEN VIRTUAL ASIGNADO GENERA EL MOVIMIENTO VIRTUAL
|
||||
If CveAlmacenVirtual > 0 Then
|
||||
|
||||
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoReferencia, UsuarioActual.CveEmpresa) Then
|
||||
DtPSVirtual = ObjInventario.DtResultados.Copy()
|
||||
@@ -18660,6 +18556,125 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al generar el almacen virtual.", ex)
|
||||
OcurrioError = True
|
||||
End Try
|
||||
|
||||
Return Not OcurrioError
|
||||
|
||||
End Function
|
||||
Private Function GenerarMovimientoAlmacenVirtualConsignacion(CveVenta As Integer, CveAlmacenContrato As Integer, ByRef ObjInventario As ClsInventarios, ObjFactura As Modelos.Factura, Optional ByRef ObjConta As ClsContabilidad = Nothing) As Boolean
|
||||
Dim OcurrioError As Boolean = False
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(573) = "1" Then
|
||||
Try
|
||||
Dim CveMovimientoVirtual As Integer = -1
|
||||
Dim CveAlmacenVirtual As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacenContrato).FiltroPrimeroValor("CveAlmacenVirtual").ToEntero()
|
||||
|
||||
Dim CveConceptoMovimientoVirtual As Integer = 37
|
||||
Dim DtPSVirtual As DataTable = Nothing
|
||||
Dim DtTamanios As DataTable = Nothing
|
||||
Dim CveMovimientoReferencia As Integer = -1
|
||||
Dim CveSubProyecto As Integer = -1
|
||||
'SI TIENE UN ALMACEN VIRTUAL GENERA EL MOVIMIENTO
|
||||
If CveAlmacenVirtual > 0 Then
|
||||
|
||||
If ObjInventario.GetInv_Mov(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
Dim RowMovimiento As DataRow = ObjInventario.DtResultados.FiltroPrimero("CvePS IS NULL AND ((CveTipoAlmacen = 24 AND CveConcepto = 2) OR (CveTipoAlmacen = 17 AND CveConcepto = 8)) AND CveVenta > 0")
|
||||
|
||||
If RowMovimiento IsNot Nothing Then
|
||||
CveMovimientoReferencia = RowMovimiento("CveMovimiento").ToString().ToEntero()
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoReferencia, UsuarioActual.CveEmpresa) Then
|
||||
DtPSVirtual = ObjInventario.DtResultados.Copy()
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
If Not OcurrioError AndAlso DtPSVirtual.Rows.Count > 0 Then
|
||||
|
||||
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, ObjFactura.CveVenta, -1, -1, Modulo:="Vta/VV", CveMovimientoRelacionado:=CveMovimientoReferencia)
|
||||
|
||||
If CveMovimientoVirtual > 0 Then
|
||||
For Each RowUsado As DataRow In DtPSVirtual.Rows
|
||||
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
|
||||
Dim CantidadUsado As Double = RowUsado("Cantidad").ToString().ToDouble()
|
||||
Dim PU As Decimal = RowUsado("Cargo").ToString().ToDecimal()
|
||||
Dim CveUM As Integer = RowUsado("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtual, CantidadUsado, CveUM, CvePS, PU, -1) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
'Agregamos las PrePolizas
|
||||
If Not OcurrioError Then
|
||||
If CveMovimientoVirtual > 0 Then
|
||||
'OcurrioError = Not GeneraPrePolizaMovimientoAlmacen(ObjInventario, ObjConta, ObjContPaq, ObjFactura, ObjFactura.CvePrePoliza, CveMovimientoInventario, CveAlmacen)
|
||||
If ObjInventario.GetMovimientosDetalle(CveMovimientoVirtual, UsuarioActual.CveEmpresa) AndAlso ObjInventario.DtResultados.Rows.Count > 0 Then
|
||||
Dim DtCostos = ObjInventario.DtResultados.Copy
|
||||
Dim DtCostosDistinct As DataTable = ObjInventario.DtResultados.FiltraParametros("", "", {"CveClasificacion"})
|
||||
Dim IdCtaContable As Integer = 0
|
||||
Dim CveCuenta As Integer = 0
|
||||
Dim ValorInventario As Decimal
|
||||
Dim TotalCostoAcumulado As Decimal = 0D
|
||||
Dim Cont As Integer = 1
|
||||
Dim TotalCosto As Decimal = DtCostos.SUMD("Total").RoundSQL
|
||||
|
||||
For Each RowInv As DataRow In DtCostosDistinct.Rows
|
||||
ValorInventario = DtCostos.SUMD("Total", String.Format("CveClasificacion = {0}", RowInv("CveClasificacion"))).RoundSQL
|
||||
IdCtaContable = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
|
||||
CveCuenta = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
|
||||
TotalCostoAcumulado += ValorInventario
|
||||
|
||||
'cuando es el último movimiento y hay diferencias en los importes
|
||||
If Cont = DtCostosDistinct.Rows.Count AndAlso TotalCosto <> TotalCostoAcumulado Then
|
||||
ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado)
|
||||
End If
|
||||
|
||||
Try
|
||||
'If ValorInventario <> 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, False, ValorInventario, ObjFactura.SerieFolio, 69, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoVirtual, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
'End If
|
||||
Catch ex As Exception
|
||||
OcurrioError = True
|
||||
Alert("Error inesperado (15148). Por favor comuniquese con atención SIG.", TipoMensaje.ToastError)
|
||||
End Try
|
||||
Cont += 1
|
||||
Next
|
||||
|
||||
If Not OcurrioError Then
|
||||
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacenVirtual)).ToEntero()
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, True, TotalCosto, ObjFactura.SerieFolio, 68, ObjFactura.SerieFolio, ObjFactura.Fecha, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=ObjFactura.CveCliente, CveMovimientoAlmacen:=CveMovimientoVirtual, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=ObjFactura.CveSubProyecto) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al generar el almacen virtual.", ex)
|
||||
@@ -22823,29 +22838,32 @@ Partial Class Ventas
|
||||
Dim dtvirtual As DataTable = Nothing
|
||||
Dim CveAlmacenVirtual As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacenOrigenContrato).FiltroPrimeroValor("CveAlmacenVirtual", "").ToEntero()
|
||||
Dim CveMovimientoVirtualSalida As Integer
|
||||
'SI TIENE UN ALMACEN VIRTUAL ASIGNADO GENERA EL MOVIMIENTO VIRTUAL
|
||||
If CveAlmacenVirtual > 0 Then
|
||||
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoSalidaGeneral, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
If ObjInventario.GetMovimientosDetalleVirtual(CveMovimientoSalidaGeneral, UsuarioActual.CveEmpresa) Then
|
||||
dtvirtual = ObjInventario.DtResultados
|
||||
|
||||
dtvirtual = ObjInventario.DtResultados
|
||||
If dtvirtual.Rows.Count > 0 Then
|
||||
CveMovimientoVirtualSalida = ObjInventario.AddMovimiento(CveAlmacenVirtual, 37, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:="", Modulo:="VV2", CveMovimientoRelacionado:=CveMovimientoSalidaGeneral)
|
||||
'FolioVirtualSalida = ObjInventario.Folio
|
||||
|
||||
If dtvirtual.Rows.Count > 0 Then
|
||||
CveMovimientoVirtualSalida = ObjInventario.AddMovimiento(CveAlmacenVirtual, 37, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Observaciones:="", Modulo:="VV2", CveMovimientoRelacionado:=CveMovimientoSalidaGeneral)
|
||||
'FolioVirtualSalida = ObjInventario.Folio
|
||||
For Each RowVirtual As DataRow In dtvirtual.Rows
|
||||
Dim CvePS = RowVirtual("CvePS").ToString().ToEntero()
|
||||
Dim CantidadUsado As Double = RowVirtual("Cantidad").ToString().ToDouble()
|
||||
Dim PU As Decimal = RowVirtual("PU").ToString().ToDecimal()
|
||||
Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero()
|
||||
|
||||
For Each RowVirtual As DataRow In dtvirtual.Rows
|
||||
Dim CvePS = RowVirtual("CvePS").ToString().ToEntero()
|
||||
Dim CantidadUsado As Double = RowVirtual("Cantidad").ToString().ToDouble()
|
||||
Dim PU As Decimal = RowVirtual("PU").ToString().ToDecimal()
|
||||
Dim CveUM As Integer = RowVirtual("CveUM").ToString().ToEntero()
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualSalida, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
||||
Return False
|
||||
End If
|
||||
Next
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoVirtualSalida, CantidadUsado, CveUM, CvePS, PU, -1, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
||||
Return False
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
Else
|
||||
Return False
|
||||
End If
|
||||
|
||||
End If
|
||||
Else
|
||||
Return False
|
||||
@@ -28223,6 +28241,7 @@ Partial Class Ventas
|
||||
DTPSTemp.Columns.Add("CveSubProyecto", GetType(Integer))
|
||||
DTPSTemp.Columns.Add("SubProyecto", GetType(String))
|
||||
|
||||
|
||||
For Each DrowPartidas As DataRow In TmpDTCalculo
|
||||
Dim CveTamanioTemp As Integer = DrowPartidas("CveTamaño").ToString().ToEntero()
|
||||
|
||||
@@ -28283,6 +28302,10 @@ Partial Class Ventas
|
||||
End If
|
||||
Next
|
||||
|
||||
If DTPSTemp IsNot Nothing AndAlso DTPSTemp.Rows.Count > 0 Then
|
||||
DTPSTemp = DTPSTemp.Select().OrderBy(Function(row) row("PU")).CopyToDataTable()
|
||||
End If
|
||||
|
||||
For Each drowPsTamaños As DataRow In DTPSTemp.Rows
|
||||
Modalidad = "A"
|
||||
If drowPsTamaños("PU").ToString().ToDecimal > 0 Then
|
||||
|
||||
Reference in New Issue
Block a user