Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -2736,6 +2736,9 @@ Partial Class Ventas
|
||||
TmpDT.Columns.Add("CveMarca", GetType(Integer))
|
||||
TmpDT.Columns.Add("CvePrecioLista", GetType(Integer))
|
||||
TmpDT.Columns.Add("PrecioLista", GetType(String))
|
||||
TmpDT.Columns.Add("CveActivoFijo", GetType(Integer))
|
||||
TmpDT.Columns.Add("AFDepreciacion", GetType(Decimal))
|
||||
TmpDT.Columns.Add("AFValorInicial", GetType(Decimal))
|
||||
|
||||
GvPS.DataSource = ObjVentas.DtResultados
|
||||
GvPS.DataBind()
|
||||
@@ -2763,6 +2766,9 @@ Partial Class Ventas
|
||||
TmpDT.Columns.Add("CveMarca", GetType(Integer))
|
||||
TmpDT.Columns.Add("CvePrecioLista", GetType(Integer))
|
||||
TmpDT.Columns.Add("PrecioLista", GetType(String))
|
||||
TmpDT.Columns.Add("CveActivoFijo", GetType(Integer))
|
||||
TmpDT.Columns.Add("AFDepreciacion", GetType(Decimal))
|
||||
TmpDT.Columns.Add("AFValorInicial", GetType(Decimal))
|
||||
|
||||
GvPS.DataSource = ObjVentas.DtResultados
|
||||
GvPS.DataBind()
|
||||
@@ -3291,7 +3297,12 @@ Partial Class Ventas
|
||||
DivAddUMPyME.Visible = False
|
||||
End If
|
||||
|
||||
TabVentaAF.Visible = False
|
||||
TabVentaAF.Visible = (UsuarioActual.CveRol = 1)
|
||||
DivAgregarAF.Visible = (CveVenta <= 0 AndAlso UsuarioActual.CveRol = 1)
|
||||
|
||||
If DivAgregarAF.Visible Then
|
||||
CargaDatosAF()
|
||||
End If
|
||||
|
||||
'CARGA VALORES INICIALES PARA AGREGAR PS DESDE MODAL
|
||||
CargaMetodosPSModal()
|
||||
@@ -4635,8 +4646,12 @@ Partial Class Ventas
|
||||
TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer))
|
||||
TmpDT.Columns.Add("TieneProntoPago", GetType(String))
|
||||
TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
|
||||
TmpDT.Columns.Add("AFDepreciacion", GetType(Decimal))
|
||||
TmpDT.Columns.Add("AFValorInicial", GetType(Decimal))
|
||||
End If
|
||||
|
||||
CargaAFVenta()
|
||||
|
||||
'CargaFirmas
|
||||
If ObjVentas.GetVentasFirmas(CveVenta) Then
|
||||
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||
@@ -7658,12 +7673,20 @@ Partial Class Ventas
|
||||
dtt = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
|
||||
DdlSubProyectoDatos.DataSource = dtt.FiltraParametros("EsSucursal = True ")
|
||||
DdlSubProyectoDatos.DataBind()
|
||||
|
||||
DdlSubProyectoCobranza.DataSource = dtt.FiltraParametros("EsSucursal = True ")
|
||||
DdlSubProyectoCobranza.DataBind()
|
||||
|
||||
DdlSubProyectoEjecucion.DataSource = dtt.FiltraParametros("EsSucursal = True ")
|
||||
DdlSubProyectoEjecucion.DataBind()
|
||||
|
||||
DdlSubProyectoPyME.DataSource = dtt
|
||||
DdlSubProyectoPyME.DataBind()
|
||||
|
||||
DdlSubProyectoFiltroAF.DataSource = dtt
|
||||
DdlSubProyectoFiltroAF.DataBind()
|
||||
DdlSubProyectoFiltroAF.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
dtt.Dispose()
|
||||
End Sub
|
||||
Private Sub CargaClasificaciones()
|
||||
@@ -13337,7 +13360,7 @@ Partial Class Ventas
|
||||
Row("PU").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("ImporteIVA").ToString().ToDouble, Math.Round((Row("Total").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)))), 6),
|
||||
Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(If(factura.ConvertirPesos, factura.TipoCambio, 1)), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(), TiempoEntrega:=Row("TiempoEntrega").ToString(), CveVentaDetallePadre:=Row("CveVentaDetalle").ToString().ToEntero(),
|
||||
CveContratoDetalle:=Row("CveContratoDetalle").ToString().ToEntero(), CvePromocionDetalle:=Row("CvePromocionDetalle").ToString().ToEntero(), IEPS:=Row("ImporteIEPS").ToString().ToDouble, CveMovimientoDetallePedido:=Row("CveMovimientoDetallePedido").ToString().ToEntero(), ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString().ToDouble,
|
||||
PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDouble, CuentaPredial:=Row("CuentaPredial").ToString(), CvePrecioLista:=Row("CvePrecioLista").ToString().ToEntero()) Then
|
||||
PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDouble, CuentaPredial:=Row("CuentaPredial").ToString(), CvePrecioLista:=Row("CvePrecioLista").ToString().ToEntero(), CveActivoFijo:=Row("CveActivoFijo").ToString().ToEntero()) Then
|
||||
ErrorList.Add("Ocurrió un error al agregar un Producto o Servicio a la Factura.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
||||
Exit For
|
||||
Else
|
||||
@@ -13914,6 +13937,25 @@ Partial Class Ventas
|
||||
IdCtaContable = ObjFactura.Cliente.IdCtaContMonedaExtranjera
|
||||
End If
|
||||
IdCtaContableCliente = IdCtaContable
|
||||
|
||||
Dim DtAF As DataTable = TmpDT.FiltraParametros("CveActivoFijo > 0")
|
||||
|
||||
If DtAF.Rows.Count > 0 Then
|
||||
For Each RowAF As DataRow In DtAF.FiltraParametros("", "", {"CveActivoFijo", "Obs"}).Rows
|
||||
Dim ImporteDepreciado As Decimal = DtAF.SUMD("AFDepreciacion", $"CveActivoFijo = {RowAF("CveActivoFijo")}").RoundSQL(2)
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, ImporteDepreciado, Referencia, 271, $"Depreciación {RowAF("Obs")}", FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=(ImporteDepreciado).RoundSQL, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), Contabilizable:=SeContabiliza) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
|
||||
'MARCAR EL ACTIVO FIJO COMO VENDEDIDO
|
||||
If Not ErrorPrepoliza AndAlso RowAF("CveActivoFijo").ToString().ToEntero() > 0 Then
|
||||
If Not ObjVentas.UpdateEstatusAFVendido(RowAF("CveActivoFijo").ToString().ToEntero(), UsuarioActual.CveEmpresa, 5) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
'Case 7 'descuentos
|
||||
@@ -14775,12 +14817,12 @@ Partial Class Ventas
|
||||
CveVentaAmortizacionAplicar = ObjFactura.CveVenta
|
||||
End If
|
||||
|
||||
DT = TmpDTDetalle.FiltraParametros($"CvePS <> {CvePSAmortizacion}", "", {"CveClasificacion", "CveSubProyecto", "PorcentajeIVA"})
|
||||
DT = TmpDTDetalle.FiltraParametros($"CvePS <> {CvePSAmortizacion}", "", {"CveClasificacion", "CveSubProyecto", "PorcentajeIVA", "CveActivoFijo"})
|
||||
|
||||
If DT.Rows.Count > 0 Then
|
||||
'Se agrega movimiento separado por la cuenta de ventas (ER)
|
||||
For Each Row2 As DataRow In DT.Rows
|
||||
importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1} AND PorcentajeIVA = {2}", Row2("CveClasificacion"), Row2("CveSubProyecto"), Row2("PorcentajeIVA"))).ToString().ToDecimal()) * ValorMultiplicador
|
||||
importeMovimiento = (TmpDTDetalle.SUM("TotalImporte", String.Format("CveClasificacion = {0} And CveSubProyecto = {1} AND PorcentajeIVA = {2} AND ISNULL(CveActivoFijo,-1) = {3}", Row2("CveClasificacion"), Row2("CveSubProyecto"), Row2("PorcentajeIVA"), If(Row2("CveActivoFijo").ToString().ToEntero() > 0, Row2("CveActivoFijo").ToString().ToEntero(), -1))).ToString().ToDecimal()) * ValorMultiplicador
|
||||
importeMX = importeMovimiento * tipoCambio * Multiplicador
|
||||
FechaMovimiento = ObjFactura.FechaPago
|
||||
Concepto = $"{ObjFactura.SerieFolio} {If(Row2("CveClasificacion").ToString().ToEntero() > 0, GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}"), "")} - {If(Row2("CveSubProyecto").ToString().ToEntero() > 0, GlobalDTSubProyectos(-1, -1, UsuarioActual.CveEmpresa).FiltroPrimeroValor("SubProyecto", $"CveSubProyecto = {Row2("CveSubProyecto").ToString()}"), "Sin SubProyecto Asignado")}"
|
||||
@@ -14796,6 +14838,26 @@ Partial Class Ventas
|
||||
|
||||
If importeMovimiento <> 0 Then
|
||||
|
||||
If Row2("CveActivoFijo").ToString().ToEntero() > 0 Then
|
||||
Dim DtAF As DataTable = TmpDT.FiltraParametros($"CveActivoFijo = {Row2("CveActivoFijo")}")
|
||||
|
||||
If DtAF.Rows.Count > 0 Then
|
||||
For Each RowAF As DataRow In DtAF.FiltraParametros("", "", {"CveActivoFijo", "Obs"}).Rows
|
||||
Dim ImporteCosto As Decimal = DtAF.SUMD("AFValorInicial", $"CveActivoFijo = {RowAF("CveActivoFijo")}").RoundSQL(2)
|
||||
Dim ImporteDepreciacion As Decimal = DtAF.SUMD("AFDepreciacion", $"CveActivoFijo = {RowAF("CveActivoFijo")}").RoundSQL(2)
|
||||
Dim ImporteC4 As Decimal = importeMovimiento
|
||||
Dim ImporteC4MX As Decimal = importeMX
|
||||
|
||||
importeMovimiento = ImporteC4 - ImporteCosto + ImporteDepreciacion
|
||||
importeMX = ImporteC4MX - ImporteCosto + ImporteDepreciacion
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, ImporteCosto, Referencia, 49, $"COSTO {RowAF("Obs")}", FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=(ImporteCosto).RoundSQL, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), TipoCambio:=tipoCambio, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveActivoFijo:=Row2("CveActivoFijo").ToString().ToEntero(), Contabilizable:=SeContabiliza) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
If IdCtaContable <= 0 Then
|
||||
CuentasContablesInvalidas.Append("<br>" & GlobalDTContaConceptosContables(-1).FiltroPrimero(String.Format("CveConceptoContable = {0}", ConceptoContable))("ConceptoContable").ToString() + GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Clasificacion", $"CveClasificacion = {Row2("CveClasificacion").ToString()}"))
|
||||
idCuentaContabilizacion = 0
|
||||
@@ -19032,7 +19094,8 @@ Partial Class Ventas
|
||||
Optional EntregaDirecta As Integer = 0, Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
|
||||
Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, Optional CuentaPredial As String = "",
|
||||
Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1, Optional EsCargo As Boolean = False,
|
||||
Optional ImporteProntoPago As Decimal = 0, Optional ByRef ObjDescuento As Modelos.VentaDescuentos = Nothing, Optional CvePrecioLista As Integer = -1, Optional PrecioLista As String = "") As Boolean
|
||||
Optional ImporteProntoPago As Decimal = 0, Optional ByRef ObjDescuento As Modelos.VentaDescuentos = Nothing, Optional CvePrecioLista As Integer = -1, Optional PrecioLista As String = "",
|
||||
Optional CveActivoFijo As Integer = -1, Optional AFDepreciacion As Decimal = 0D, Optional AFValorInicial As Decimal = 0D) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
Try
|
||||
@@ -19128,6 +19191,10 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
If CveUM <= 0 Then
|
||||
CveUM = DrPS("CveUnidadMedida").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
Row("Cantidad") = Cantidad
|
||||
Row("CveUM") = CveUM
|
||||
Row("UM") = DrPS("UnidadMedida")
|
||||
@@ -19291,6 +19358,11 @@ Partial Class Ventas
|
||||
Row("CvePrecioLista") = CvePrecioLista
|
||||
Row("PrecioLista") = PrecioLista
|
||||
|
||||
Row("CveActivoFijo") = CveActivoFijo
|
||||
Row("AFDepreciacion") = AFDepreciacion
|
||||
Row("AFValorInicial") = AFValorInicial
|
||||
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(119, 13, 83) Then
|
||||
If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
|
||||
|
||||
@@ -19528,6 +19600,10 @@ Partial Class Ventas
|
||||
TmpDT.Columns.Add("CvePrecioLista", GetType(Integer))
|
||||
TmpDT.Columns.Add("PrecioLista", GetType(String))
|
||||
|
||||
TmpDT.Columns.Add("CveActivoFijo", GetType(Integer))
|
||||
TmpDT.Columns.Add("AFDepreciacion", GetType(Decimal))
|
||||
TmpDT.Columns.Add("AFValorInicial", GetType(Decimal))
|
||||
|
||||
TmpDT.Columns("EsOutSourcing").DefaultValue = False
|
||||
TmpDT.Columns("EsCargo").DefaultValue = False
|
||||
|
||||
@@ -22254,7 +22330,7 @@ Partial Class Ventas
|
||||
Row("PU").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("ImporteIVA").ToString().ToDouble, Math.Round((Row("Total").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)))), 6),
|
||||
Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(), PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, IEPS:=Row("ImporteIEPS").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, TiempoEntrega:=Row("TiempoEntrega").ToString(),
|
||||
CveVentaDetallePadre:=Row("CveVentaDetalle").ToString().ToEntero(), CveContratoDetalle:=Row("CveContratoDetalle").ToString().ToEntero(), CvePromocionDetalle:=If(DtPromociones IsNot Nothing, DtPromociones.FiltroPrimeroValor("CvePromocionDetalle", $"CvePS={Row("CvePS").ToString()}").ToEntero(), -1),
|
||||
ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString().ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDouble, CuentaPredial:=Row("CuentaPredial").ToString(), CvePrecioLista:=Row("CvePrecioLista").ToString().ToEntero()) Then
|
||||
ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString().ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString().ToDouble, CuentaPredial:=Row("CuentaPredial").ToString(), CvePrecioLista:=Row("CvePrecioLista").ToString().ToEntero(), CveActivoFijo:=Row("CveActivoFijo").ToString().ToEntero()) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
Else
|
||||
@@ -29986,6 +30062,9 @@ Partial Class Ventas
|
||||
TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer))
|
||||
TmpDT.Columns.Add("TieneProntoPago", GetType(String))
|
||||
TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
|
||||
'TmpDT.Columns.Add("CveActivoFijo", GetType(Integer))
|
||||
TmpDT.Columns.Add("AFDepreciacion", GetType(Decimal))
|
||||
TmpDT.Columns.Add("AFValorInicial", GetType(Decimal))
|
||||
End If
|
||||
Dim FechaFactura As DateTime = Now
|
||||
|
||||
@@ -35149,6 +35228,8 @@ Partial Class Ventas
|
||||
TmpDT = ObjVentas.DtResultados
|
||||
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
|
||||
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
|
||||
TmpDT.Columns.Add("AFDepreciacion", GetType(Decimal))
|
||||
TmpDT.Columns.Add("AFValorInicial", GetType(Decimal))
|
||||
End If
|
||||
|
||||
If ObjVentas.GetVenta(CveVentaNC, UsuarioActual.CveEmpresa, VerificaAlmacen:=False) Then
|
||||
@@ -35309,6 +35390,10 @@ Partial Class Ventas
|
||||
TmpDT.Columns.Add("CveMarca", GetType(Integer))
|
||||
TmpDT.Columns.Add("CvePrecioLista", GetType(Integer))
|
||||
TmpDT.Columns.Add("PrecioLista", GetType(String))
|
||||
TmpDT.Columns.Add("CveActivoFijo", GetType(Integer))
|
||||
TmpDT.Columns.Add("AFDepreciacion", GetType(Decimal))
|
||||
TmpDT.Columns.Add("AFValorInicial", GetType(Decimal))
|
||||
|
||||
Return TmpDT
|
||||
End Function
|
||||
Private Function InicializaDTVentasNCProntoPago() As DataTable
|
||||
@@ -36773,5 +36858,160 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
#Region " A C T I V O S - F I J O S"
|
||||
|
||||
Protected Sub CargaDatosAF()
|
||||
CargarTipoActivoFijo()
|
||||
CargaDdlAF()
|
||||
|
||||
DdlTipoActivo_SelectedIndexChanged(DdlTipoActivoFiltro, EventArgs.Empty)
|
||||
End Sub
|
||||
|
||||
Protected Sub CargarTipoActivoFijo()
|
||||
DdlTipoActivoFiltro.DataSource = GlobalDTTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros("", "TipoActivoFijo")
|
||||
DdlTipoActivoFiltro.DataBind()
|
||||
DdlTipoActivoFiltro.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
End Sub
|
||||
|
||||
Protected Sub DdlTipoActivo_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
DdlSubTipoActivoFiltro.Items.Clear()
|
||||
DdlSubTipoActivoFiltro.DataSource = GlobalDTSubTipoActivoFijo(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CveTipoActivoFijo = {0}", DdlTipoActivoFiltro.SelectedValue), "SubTipoActivoFijo")
|
||||
DdlSubTipoActivoFiltro.DataBind()
|
||||
DdlSubTipoActivoFiltro.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
End Sub
|
||||
|
||||
#End Region
|
||||
Protected Sub BtnFiltrarAF_Click(sender As Object, e As EventArgs)
|
||||
Using ObjAF As New ClsAF
|
||||
If ObjAF.GetRepActivosFijosDepreciacion(UsuarioActual.CveEmpresa, Now, Depreciados:=1, CveTipoAF:=DdlTipoActivoFiltro.SelectedValue.ToEntero(), CveSubTipoAF:=DdlSubTipoActivoFiltro.SelectedValue.ToEntero(), CveSubProyecto:=DdlSubProyectoFiltroAF.SelectedValue.ToEntero()) Then
|
||||
GvVentaAF.DataSource = ObjAF.DtResultados.FiltraParametros("CveActivoFijo > 0 AND CveEstadoActivoFijo <> 5")
|
||||
End If
|
||||
End Using
|
||||
|
||||
GvVentaAF.DataBind()
|
||||
UpActivosFijos.Update()
|
||||
End Sub
|
||||
|
||||
Private Sub CargaAFVenta()
|
||||
If CveVenta > 0 AndAlso TmpDT IsNot Nothing AndAlso TmpDT.COUNT("CveActivoFijo", "CveActivoFijo > 0") > 0 Then
|
||||
DivVentasAF.Visible = True
|
||||
Using ObjAF As New ClsAF
|
||||
If ObjAF.GetActivosFijosVenta(Me.CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
GvAF.DataSource = ObjAF.DtResultados
|
||||
End If
|
||||
End Using
|
||||
GvAF.DataBind()
|
||||
UpActivosFijos.Update()
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Public Sub CargaDdlAF()
|
||||
Dim strAF = UsuarioActual.Empresa.Funcionalidad(380)
|
||||
Dim CvePSAF As Integer = -1
|
||||
|
||||
If String.IsNullOrEmpty(strAF) Then
|
||||
Dim RowFuncionalidad380 As DataRow = Nothing
|
||||
|
||||
Using ObjEmpresas As New ClsSisEmpresas
|
||||
If ObjEmpresas.GetEmpresasFuncionalidades(UsuarioActual.CveEmpresa) Then
|
||||
RowFuncionalidad380 = ObjEmpresas.DtResultados.FiltroPrimero("CveFuncionalidad = 380")
|
||||
End If
|
||||
End Using
|
||||
|
||||
If RowFuncionalidad380 IsNot Nothing Then
|
||||
CvePSAF = RowFuncionalidad380("Valor").ToString().ToEntero()
|
||||
End If
|
||||
|
||||
Else
|
||||
CvePSAF = strAF.ToEntero()
|
||||
End If
|
||||
|
||||
If CvePSAF > 0 Then
|
||||
Dim dtt = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSAF, AplicaParaVenta:=1) ', SATClavePS:=CveSATNC
|
||||
|
||||
If dtt IsNot Nothing Then
|
||||
DdlPSAF.DataSource = dtt
|
||||
DdlPSAF.DataBind()
|
||||
End If
|
||||
Else
|
||||
LnkGenerarPSAF.Visible = True
|
||||
DdlPSAF.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
End If
|
||||
|
||||
End Sub
|
||||
Protected Sub BtnGuardarAF_Click(sender As Object, e As EventArgs)
|
||||
|
||||
Dim Cantidad As Decimal = 1
|
||||
Dim CvePS = DdlPSAF.SelectedValue.ToEntero()
|
||||
Dim CveUnidadMedida As Integer = -1
|
||||
Dim UnidadMedida As String = ""
|
||||
Dim CveClasificacion As Integer = -1
|
||||
Dim Clasificacion As String = ""
|
||||
Dim Obs As String = ""
|
||||
|
||||
Dim PrecioVenta As Decimal = 0.0D
|
||||
|
||||
Dim CveProyecto As Integer = -1
|
||||
Dim Proyecto As String = ""
|
||||
|
||||
Dim CveSubProyecto As Integer = DdlSubProyectoDatos.SelectedValue.ToEntero()
|
||||
Dim SubProyecto As String = DdlSubProyectoDatos.SelectedItem.Text
|
||||
|
||||
If CveSubProyecto > 0 Then
|
||||
Dim RowSP = GlobalDTSubProyectos(-1, CveSubProyecto:=CveSubProyecto, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("")
|
||||
If RowSP IsNot Nothing Then
|
||||
CveProyecto = RowSP("CveProyecto").ToString().ToEntero()
|
||||
Proyecto = RowSP("Proyecto").ToString()
|
||||
End If
|
||||
End If
|
||||
|
||||
TmpDT.Rows.Clear()
|
||||
|
||||
Dim CveAF As Integer = -1
|
||||
Dim AFDepreciacion As Decimal = 0
|
||||
Dim AFValorInicial As Decimal = 0
|
||||
|
||||
For Each GvRow As GridViewRow In GvVentaAF.Rows
|
||||
If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
'LIMPIA VARIABLES
|
||||
Obs = ""
|
||||
CveAF = -1
|
||||
AFDepreciacion = 0
|
||||
AFValorInicial = 0
|
||||
|
||||
PrecioVenta = 0D
|
||||
|
||||
If GvRow.FCCheckBox("chkAF").Checked Then
|
||||
Obs = GvRow.DataKey("Observaciones")
|
||||
CveAF = GvRow.DataKey("CveActivoFijo").ToEntero()
|
||||
AFDepreciacion = GvRow.DataKey("DepreciacionAcumulada").ToDecimal()
|
||||
AFValorInicial = GvRow.DataKey("MOI").ToDecimal()
|
||||
|
||||
PrecioVenta = GvRow.FCTextBox("TxtPrecioAF").Text.ToDecimal()
|
||||
|
||||
If PrecioVenta < 1D Then
|
||||
Alert($"El activo fijo '{GvRow.DataKey("Descripcion")}' debe tener un importe para venta.", TipoMensaje.MsgAdvertencia)
|
||||
TmpDT.Rows.Clear()
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
AgregarProductoServicio(Cantidad, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePS, "", Obs, PrecioVenta, 0,
|
||||
CveProyecto, Proyecto, CveSubProyecto, SubProyecto, CveActivoFijo:=CveAF, AFDepreciacion:=AFDepreciacion, AFValorInicial:=AFValorInicial)
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
DdlMoneda.SelectedValue = "1"
|
||||
DdlMoneda.Enabled = False
|
||||
|
||||
CalculaTotalesVenta()
|
||||
|
||||
Tab.ActiveTabIndex = 0
|
||||
Updatetabs.Update()
|
||||
End Sub
|
||||
End Class
|
||||
|
||||
|
||||
Reference in New Issue
Block a user