-
-
+ Área:
+ PisoAlmacén
diff --git a/App_Code/ClsVentas.vb b/App_Code/ClsVentas.vb
index ee571bfd0..ff7e79fa5 100644
--- a/App_Code/ClsVentas.vb
+++ b/App_Code/ClsVentas.vb
@@ -341,7 +341,7 @@ Public Class ClsVentas
Optional CveFormaPago33 As Integer = -1, Optional CveMetodoPago33 As Integer = -1, Optional CveUsoCFDI As Integer = -1, Optional OrdenCompra As String = "-1", Optional CveCuentaTerminal As Integer = -1, Optional CveTipoRelacion As Integer = -1, Optional ImpuestoLocal As Double = 0,
Optional CveTipoAmortizacionAnticipo As Integer = -1, Optional CveVentaRelacion As Integer = -1, Optional ImporteRelacion As Decimal = -1, Optional CveEmpresaCRM As Integer = -1, Optional EsInterno As Integer = -1, Optional CveAcercamientoCRM As Integer = -1,
Optional DiasCredito As Integer = 0, Optional EsDiasCreditoFijo As Boolean = False, Optional AnticipoEspecial As Boolean = False, Optional Kilometraje As Double = 0, Optional EsAmortizacion As Boolean = False, Optional CveTipoRetencion As Integer = 0,
- Optional CorreoNotificacion As String = "", Optional FormaPaqueteria As Integer = 1, Optional FacturarSucursal As Boolean = False) As Boolean
+ Optional CorreoNotificacion As String = "", Optional FormaPaqueteria As Integer = 1, Optional FacturarSucursal As Boolean = False, Optional VentaDesglosaIEPS As Boolean = False) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_VentasAdd")
@@ -433,6 +433,7 @@ Public Class ClsVentas
.Add("@CorreoNotificacion", SqlDbType.VarChar).Value = CorreoNotificacion
.Add("@FormaPaqueteria", SqlDbType.Int).Value = FormaPaqueteria
.Add("@FacturarSucursal", SqlDbType.Bit).Value = FacturarSucursal
+ .Add("@VentaDesglosaIEPS", SqlDbType.Bit).Value = VentaDesglosaIEPS
.Add("@RETURN_VALUE", SqlDbType.Int).Direction = ParameterDirection.ReturnValue
End With
diff --git a/App_Code/Modelos.vb b/App_Code/Modelos.vb
index 4ca5dafc2..6df233d4e 100644
--- a/App_Code/Modelos.vb
+++ b/App_Code/Modelos.vb
@@ -6094,6 +6094,8 @@ Namespace Modelos
Public Property CveTipoRetencion As Integer
+ Public Property VentaDesglosaIEPS As Boolean
+
#End Region
diff --git a/Bancos/FluctuacionCambiaria.aspx b/Bancos/FluctuacionCambiaria.aspx
index c74d540a3..3ecd068fa 100644
--- a/Bancos/FluctuacionCambiaria.aspx
+++ b/Bancos/FluctuacionCambiaria.aspx
@@ -149,13 +149,7 @@
-
-
-
-
-
-
-
+
@@ -230,10 +224,37 @@
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
@@ -333,10 +382,37 @@
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
+
+
+
+
+
+
+
+
+
diff --git a/Bancos/PopIEVentas.aspx.vb b/Bancos/PopIEVentas.aspx.vb
index 3d83cb0b4..ef4f28551 100644
--- a/Bancos/PopIEVentas.aspx.vb
+++ b/Bancos/PopIEVentas.aspx.vb
@@ -736,11 +736,16 @@ Partial Class Bancos_PopIEVentas
SerieFolio = dr("SerieFolio").ToString
TipoCambioOriginal = dr("TipoCambio").ToString.ToDecimal
CveSubProyectoVenta = dr("CveSubProyecto").ToString.ToEntero
- 'Configuración de Modalidad Update
-
- 'Dim RFCCliente As String = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("RFC", $"CveCliente = {CveCliente} ")
-
+ LblMetodoPAgo.Text = $"{dr("ClaveMetodoPagoSATStr").ToString() }"
+
+
+
+ 'Configuración de Modalidad Update
+
+ 'Dim RFCCliente As String = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("RFC", $"CveCliente = {CveCliente} ")
+
+
If Not UsuarioActual.Empresa.Funcionalidad(536) = "1" Then
If dr("TipoDocto").ToString = "Rem" Then
Alert("Los documentos de tipo Remisión no se permite realizar el pago", TipoMensaje.MsgAdvertencia)
diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb
index 0cbaee78a..d7ef591ea 100644
--- a/Compras/Compras.aspx.vb
+++ b/Compras/Compras.aspx.vb
@@ -29,6 +29,24 @@ Partial Class Compras_Compras
End Set
End Property
+ Private Property EstaAsociadoACajaChica() As Boolean
+ Get
+ Return If(IsNothing(ViewState("EstaAsociadoACajaChica")), False, CBool(ViewState("EstaAsociadoACajaChica")))
+ End Get
+ Set
+ ViewState("EstaAsociadoACajaChica") = Value
+ End Set
+ End Property
+
+ Private Property EstaAsociadoAPersonal() As Boolean
+ Get
+ Return If(IsNothing(ViewState("EstaAsociadoAPersonal")), False, CBool(ViewState("EstaAsociadoAPersonal")))
+ End Get
+ Set
+ ViewState("EstaAsociadoAPersonal") = Value
+ End Set
+ End Property
+
Private Property CveUsuarioEvaluador() As Integer
Get
Return If(IsNothing(ViewState("CveUsuarioEvaluador")), -1, CInt(ViewState("CveUsuarioEvaluador")))
@@ -848,6 +866,14 @@ Partial Class Compras_Compras
ViewState("PopUpOC") = value
End Set
End Property
+ Private Property CompraEstaVinculadaOC As Boolean
+ Get
+ Return CBool(ViewState("CompraEstaVinculadaOC"))
+ End Get
+ Set(value As Boolean)
+ ViewState("CompraEstaVinculadaOC") = value
+ End Set
+ End Property
#End Region
#Region "PROPIEDADES ALMACEN" 'Charlie
@@ -1307,6 +1333,9 @@ Partial Class Compras_Compras
ViewState("CveFactura") = Request("CveFactura").ToEntero
Dim RFC As String = CargaFactura(CveFactura)
+ If Not VerificarProductosSATPS() Then
+ Exit Sub
+ End If
If RFC.Trim <> String.Empty Then
DdlProveedor.Visible = False
HplProveedor.Visible = True
@@ -1734,6 +1763,7 @@ Partial Class Compras_Compras
'TmpDT.Columns.Add("IEPSPSIVAPorcentaje")
SubTotalConceptos = Math.Round(TmpDT.SUM("Total"), 2).ToDecimal
AddPS2(False)
+
End If
Else
CargaConceptosXML(XMLDoc)
@@ -3971,6 +4001,17 @@ Partial Class Compras_Compras
DtNoEncontrados.Dispose()
End If
+ 'Verifica funcionalidad 702 "Require orden de compra para factura de compra"
+
+ If UsuarioActual.Empresa.Funcionalidad(702) = "1" Then
+ If Not EstaAsociadoACajaChica And Not EstaAsociadoAPersonal Then
+ If Not CompraEstaVinculadaOC Then
+ Alert("Debe de vincular una orden de compra para realizar esta factura")
+ Exit Sub
+ End If
+ End If
+ End If
+
'Si se marcó No Deducible en el encabezado mínimo se debe registrar un No Deducible en el Detalle
Dim GuardaNoDeducibles As Boolean = False
If ChkEsNoDeducible.Checked Then
@@ -12712,6 +12753,7 @@ Partial Class Compras_Compras
CveMoneda = dr("CveMoneda").ToString.ToEntero
IdCuentaBancaria = dr("IdCtaContable").ToString.ToEntero
CveCuentaBancaria = dr("IdCtaContableSIG").ToString.ToEntero
+ EstaAsociadoACajaChica = True
End If
If UsuarioActual.Empresa.Funcionalidad(505) <> "1" Then
@@ -12740,7 +12782,7 @@ Partial Class Compras_Compras
ObjMovtos.Dispose()
DDlCheques.DataBind()
-
+ EstaAsociadoAPersonal = True
DDlCheques_SelectedIndexChanged(DDlCheques, EventArgs.Empty)
Else
@@ -13751,6 +13793,9 @@ Partial Class Compras_Compras
#Region " REEMBOLSOS NO USA AC "
Protected Sub DdlPersonal2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlPersonalReembolso.SelectedIndexChanged
ViewState("CvePersonal") = DdlPersonalReembolso.SelectedValue
+ If DdlPersonalReembolso.SelectedValue.ToEntero > 0 Then
+ EstaAsociadoAPersonal = True
+ End If
End Sub
Protected Sub DdlCajaChica2_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlCuentaCajaChicaReembolso.SelectedIndexChanged
Dim dr As DataRow = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("CveCuenta = " & DdlCuentaCajaChicaReembolso.SelectedValue)
@@ -13759,6 +13804,7 @@ Partial Class Compras_Compras
CveMoneda = dr("CveMoneda").ToString.ToEntero
IdCuentaBancaria = dr("IdCtaContable").ToString.ToEntero
CveCuentaBancaria = dr("IdCtaContableSIG").ToString.ToEntero
+ EstaAsociadoACajaChica = True
End If
ViewState("CveCajaChica") = DdlCuentaCajaChicaReembolso.SelectedValue
End Sub
@@ -15051,13 +15097,11 @@ Partial Class Compras_Compras
End If
'SI PUEDE RECIBIR POR OC Y COMPRA
- If UsuarioActual.CveEmpresa.Contiene(119) Then
- If UsuarioActual.Empresa.UsaInventarios And UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 And Not UsuarioActual.Empresa.Funcionalidad(153).ToEntero > 0 Then
- DivOCVinculaInv.Visible = True
- End If
+ ' si usa almacen, si tiene activado que reciba por OC, y que si la compra tipo Proveedor. que lo muestre
+ If UsuarioActual.Empresa.UsaInventarios And UsuarioActual.Empresa.Funcionalidad(131).ToEntero > 0 AndAlso CveTipoConcepto = 1 Then
+ DivOCVinculaInv.Visible = True
End If
-
'TIPO CAMBIO
If CveCompra > 0 Then
DivTipoCambioOC.Visible = False
@@ -15383,27 +15427,27 @@ Partial Class Compras_Compras
Dim SubTotalCompra As Decimal = Amortizacion
Dim DiferenciaPermitida = 1
Dim Cont = 0
- Dim ProductosCodigoSATNoPermitidos As New StringBuilder("")
- For Each gvr As GridViewRow In GvOC1.Rows
- SubTotalGV += gvr.FCTextBox("TxtTotalOC1").Text.ToDecimal
- If Cont = 0 Then DdlProveedorSucursal.SelectedValueExist(gvr.DataKey("CveProveedorSucursal").ToEntero())
- Cont = 1
- If GvOC1.Columns(6).Visible Then
- Dim SatPS As String = gvr.FCDropDownLost("DdlSATPS").SelectedText()
- Dim NombreProducto As String = gvr.FCLabel("LbProductoServicio").Text
- If SatPS.Contains("01010101") Then
- ProductosCodigoSATNoPermitidos.AppendFormat("{0}", NombreProducto)
- 'Dim mensajeAdvertencia As String = String.Format("Al vincular una Orden de Compra no se permiten productos con Producto/Servicio SAT igual a '{0}', revise el producto '{1}' en Orden(es) de Compra Vinculada(s)", SatPS, NombreProducto)
- 'Alert(mensajeAdvertencia, TipoMensaje.MsgAdvertencia)
+ 'Dim ProductosCodigoSATNoPermitidos As New StringBuilder("")
+ 'For Each gvr As GridViewRow In GvOC1.Rows
+ ' SubTotalGV += gvr.FCTextBox("TxtTotalOC1").Text.ToDecimal
+ ' If Cont = 0 Then DdlProveedorSucursal.SelectedValueExist(gvr.DataKey("CveProveedorSucursal").ToEntero())
+ ' Cont = 1
+ ' If GvOC1.Columns(6).Visible Then
+ ' Dim SatPS As String = gvr.FCDropDownLost("DdlSATPS").SelectedText()
+ ' Dim NombreProducto As String = gvr.FCLabel("LbProductoServicio").Text
+ ' If SatPS.Contains("01010101") Then
+ ' ProductosCodigoSATNoPermitidos.AppendFormat("{0}", NombreProducto)
+ ' 'Dim mensajeAdvertencia As String = String.Format("Al vincular una Orden de Compra no se permiten productos con Producto/Servicio SAT igual a '{0}', revise el producto '{1}' en Orden(es) de Compra Vinculada(s)", SatPS, NombreProducto)
+ ' 'Alert(mensajeAdvertencia, TipoMensaje.MsgAdvertencia)
- End If
- End If
- Next
- If ProductosCodigoSATNoPermitidos.ToString.Length > 0 Then
- Dim mensajeAdvertencia As String = String.Format("No se permite vinculación de productos con código SAT '01010101', revise los productos:{0}", ProductosCodigoSATNoPermitidos.ToString)
- Alert(mensajeAdvertencia, TipoMensaje.MsgAdvertencia)
- Exit Sub
- End If
+ ' End If
+ ' End If
+ 'Next
+ 'If ProductosCodigoSATNoPermitidos.ToString.Length > 0 Then
+ ' Dim mensajeAdvertencia As String = String.Format("No se permite vinculación de productos con código SAT '01010101', revise los productos:{0}", ProductosCodigoSATNoPermitidos.ToString)
+ ' Alert(mensajeAdvertencia, TipoMensaje.MsgAdvertencia)
+ ' Exit Sub
+ 'End If
If Math.Abs(SubTotalGV - SubTotalCompra) < DiferenciaPermitida Then
LbSubTotalDif.Visible = False
@@ -15641,6 +15685,7 @@ Partial Class Compras_Compras
End If
CalculaTotales()
+ CompraEstaVinculadaOC = True
End Sub
@@ -20158,7 +20203,35 @@ Partial Class Compras_Compras
End Sub
+ Private Function VerificarProductosSATPS() As Boolean
+ Dim CvePSGRuposAux As New StringBuilder("")
+ For Each gvr As GridViewRow In GvPS.Rows
+ Dim CvePSIndividual As String = gvr.DataKey("CvePS")
+ CvePSGRuposAux.AppendFormat("{0},", CvePSIndividual)
+ Next
+ Dim CvePSGRupos As String = Left(CvePSGRuposAux.ToString, CvePSGRuposAux.Length - 1)
+
+ Dim PSSat As DataTable = GlobalDTPS(UsuarioActual.CveEmpresa).FiltraParametros(String.Format("CvePS IN ({0})", CvePSGRuposAux))
+
+ Dim ProductosCodigoSATNoPermitidos As New StringBuilder("")
+ For Each PS As GridViewRow In GvPS.Rows
+ Dim PSIndividual As String = PS.DataKey("PS")
+ Dim ClavePSSAT As String = PSSat.FiltroPrimeroValor("CveSATPS", String.Format("PS = '{0}'", PSIndividual))
+ If ClavePSSAT = "46920" Then
+ ProductosCodigoSATNoPermitidos.AppendFormat("{0}", PSIndividual)
+ End If
+ Next
+
+ If ProductosCodigoSATNoPermitidos.ToString.Length > 0 Then
+ Dim mensajeAdvertencia As String = String.Format("No se permite vinculación de productos con código SAT '01010101', revise los productos:{0}", ProductosCodigoSATNoPermitidos.ToString)
+ Alert(mensajeAdvertencia, TipoMensaje.MsgAdvertencia)
+ Return False
+ End If
+
+ Return True
+
+ End Function
End Class
diff --git a/Compras/PopUpVerFactura.aspx.vb b/Compras/PopUpVerFactura.aspx.vb
index 482e6026a..49ae7b3d6 100644
--- a/Compras/PopUpVerFactura.aspx.vb
+++ b/Compras/PopUpVerFactura.aspx.vb
@@ -1238,6 +1238,7 @@ Partial Class PopUpVerFactura
Dim Observaciones As String = ObjInventarios.Observaciones
Dim ObservacionesSolicitud As String = ObjInventarios.DtResultados.FiltroPrimeroValor("ObservacionesSolicitud")
Dim NombreCapturo As String = ObjInventarios.NombreCapturo
+ Dim NombreEntrego As String = ObjInventarios.DtResultados.FiltroPrimeroValor("Entrego")
Dim CveAlmacen As Integer = ObjInventarios.CveAlmacen
Dim Recibio As String = ObjInventarios.Recibio
Dim PuestoRecibio As String = ObjInventarios.PuestoRecibio
@@ -1341,7 +1342,7 @@ Partial Class PopUpVerFactura
EstadoOrigen, PaisOrigen, CPOrigen, CalleDestino, NoExtDestino, ColoniaDestino, LocalidadDestino,
MunicipioDestino, EstadoDestino, PaisDestino, CPDestino, FechaMovimiento, NombreCapturo, PuestoRecibio,
PuestoEnrego, RazonSocial, ResponsableCarga, ResponsableRecibio, NombreCliente,
- CantidadProductos:=CantidadProductos, CantidadUsados:=CantidadUsados, CveTipoAlmacen:=CveTipoAlmacen)
+ CantidadProductos:=CantidadProductos, CantidadUsados:=CantidadUsados, CveTipoAlmacen:=CveTipoAlmacen, NombreEntrego:=NombreEntrego)
End Sub
Private Sub PUanacExtr(CveMoneda As Integer) 'preciounitario a moneda nacional o extranjera
@@ -1358,7 +1359,7 @@ Partial Class PopUpVerFactura
Remision As String, Proveedor As String, CalleOrigen As String, NoExtOrigen As String, ColoniaOrigen As String, LocalidadOrigen As String, MunicipioOrigen As String,
EstadoOrigen As String, PaisOrigen As String, CPOrigen As String, CalleDestino As String, NoExtDestino As String, ColoniaDestino As String, LocalidadDestino As String, MunicipioDestino As String,
EstadoDestino As String, PaisDestino As String, CPDestino As String, FechaMovimiento As Date, NombreCapturo As String, PuestoRecibio As String, PuestoEntrego As String,
- RazonSocial As String, ResponsableCarga As String, ResponsableRecibio As String, NombreCliente As String, Optional CantidadProductos As Decimal = 0, Optional CantidadUsados As Decimal = 0, Optional CveTipoAlmacen As Integer = -1)
+ RazonSocial As String, ResponsableCarga As String, ResponsableRecibio As String, NombreCliente As String, Optional CantidadProductos As Decimal = 0, Optional CantidadUsados As Decimal = 0, Optional CveTipoAlmacen As Integer = -1, Optional NombreEntrego As String = "")
Select Case CveConcepto
@@ -2704,7 +2705,7 @@ Partial Class PopUpVerFactura
End If
Dim DepartamentoRecibe As String = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Departamento", String.Format("NombreCompleto = '{0}'", Recibio))
- Dim DepartamentoEntrego As String = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Departamento", String.Format("NombreCompleto = '{0}'", Capturo))
+ Dim DepartamentoEntrego As String = GlobalDTRHPersonal(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Departamento", String.Format("NombreCompleto = '{0}'", NombreEntrego))
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("Concepto", "Salida por resguardo"))
@@ -2715,7 +2716,7 @@ Partial Class PopUpVerFactura
params.Add(New ReportParameter("Descuentos", ""))
params.Add(New ReportParameter("IVA", ""))
params.Add(New ReportParameter("Total", ""))
- params.Add(New ReportParameter("NombreEntrego", String.Format("ENTREGÓ{0}{1}", vbCrLf, Capturo)))
+ params.Add(New ReportParameter("NombreEntrego", NombreEntrego))
params.Add(New ReportParameter("NombreRecibio", Recibio))
params.Add(New ReportParameter("PuestoRecibio", PuestoEntrego))
params.Add(New ReportParameter("PuestoEntrego", PuestoRecibio))
@@ -2727,7 +2728,7 @@ Partial Class PopUpVerFactura
End If
params.Add(New ReportParameter("FechaMovimiento", FechaMovimiento.ToString("dd/MM/yyyy")))
- params.Add(New ReportParameter("UsuarioImprimio", NombreCapturo))
+ params.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Nombre))
params.Add(New ReportParameter("Observaciones", Observaciones))
diff --git a/Compras/ReembolsosComprobaciones.aspx b/Compras/ReembolsosComprobaciones.aspx
index 3f432ff33..760c32799 100644
--- a/Compras/ReembolsosComprobaciones.aspx
+++ b/Compras/ReembolsosComprobaciones.aspx
@@ -291,7 +291,8 @@
-
+
diff --git a/Compras/ReembolsosComprobaciones.aspx.vb b/Compras/ReembolsosComprobaciones.aspx.vb
index 7b60c10d5..36b4176d3 100644
--- a/Compras/ReembolsosComprobaciones.aspx.vb
+++ b/Compras/ReembolsosComprobaciones.aspx.vb
@@ -1036,7 +1036,7 @@ Partial Class Compras_ReembolsosComprobaciones
'Otros Ingresos
If ChkAjusteOI.Checked Then
- If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.FCTextBox("TxtComision").Text.ToDecimal, Referencia, 78, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.FCTextBox("TxtComision").Text.ToDecimal), ImporteMX:=gvr.FCTextBox("TxtComision").Text.ToDecimal * tipoCambio, CveCuenta:=CveCuentaProveedor) Then
+ If Not ObjMov.AddPrePolizasDetalle(CvePrePolizaExcedente, True, gvr.FCTextBox("TxtComision").Text.ToDecimal, Referencia, 78, ConceptoMovimiento, gvr.FCLiteral("LtlFecha").Text.ToDate, IdCtaProveedor, -1, CveIE:=CveIERegistrado, CvePersonal:=CvePersonal, CveCompra:=gvr.FCHyperLink("HplF2").Text.ToEntero, CveSubProyecto:=gvr.DataKey("CveSubProyecto").ToEntero, CveProveedor:=gvr.FCHyperLink("HLProv").Text.ToEntero, ImporteME:=If(tipoCambio = 1, 0, gvr.FCTextBox("TxtComision").Text.ToDecimal), ImporteMX:=gvr.FCTextBox("TxtComision").Text.ToDecimal * tipoCambio, CveCuenta:=CveCuentaProveedor) Then
MsgError = "no se pudo insertar el detalle de la poliza de otros ingresos"
End If
End If
diff --git a/Contabilidad2/RepEstadoResultadosHorizontal - Copy.aspx b/Contabilidad2/RepEstadoResultadosHorizontal - Copy.aspx
new file mode 100644
index 000000000..32123d23c
--- /dev/null
+++ b/Contabilidad2/RepEstadoResultadosHorizontal - Copy.aspx
@@ -0,0 +1,1593 @@
+<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepEstadoResultadosHorizontal - Copy.aspx.vb" Inherits="Contabilidad_RepEstadoResultadosHorizontal" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
"
+ Next IndiceInicio
+
+
+
+ ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = -2 Then
+
+ Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero
+ Dim IndiceInicio As Integer = 1
+ Dim IndiceMax As Integer = 1 + CountDinamico
+
+ For IndiceInicio = 1 To IndiceMax
+
+ Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal
+ e.Row.Cells(IndiceInicio).Text = $"
"
+
+ Next IndiceInicio
+
+
+ End If
+ e.Row.FCHyperLink("HLAnterior").Text = If(DdlDivisor.SelectedValue.ToEntero > 1, e.Row.DBCampo("ImporteAcumulado").ToString.ToDecimal.ToString("###,###,##0"), e.Row.DBCampo("ImporteAcumulado").ToString.ToDecimal.ToString("###,###,##0.00"))
+ If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then
+ e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red
+ End If
+
+ End If
+
+ End Sub
+
+ Protected Sub GvGastosSubProyectoH_RowDataBound(sender As Object, e As GridViewRowEventArgs)
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ setgraficaCC(e)
+ If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
+ TotalActualMes -= e.Row.DBCampo("ImporteActual").ToString.ToDouble
+ TotalAnteriorMes -= e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble
+ e.Row.ControlStyle.Font.Bold = True
+ ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then
+ 'e.Row.CssClass = "SubTotales"
+ e.Row.ControlStyle.Font.Bold = True
+ End If
+ If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then
+ e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red
+ End If
+ End If
+ End Sub
+
+ Protected Sub GvTotalesSubProyectoH_RowDataBound(sender As Object, e As GridViewRowEventArgs)
+ If e.Row.RowType = DataControlRowType.Header Then
+ ' e.Row.Attributes.Add("style", "display:none")
+ End If
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ setgraficaCC(e)
+ e.Row.Attributes.Add("style", "Font-weight: bold")
+ End If
+ End Sub
+
+ Public Sub setgraficaCC(e As GridViewRowEventArgs)
+ Dim lista As New List(Of Object)
+ Dim colorindex As Integer = 0
+ For Each campo As String() In listaCampos
+ lista.Add(New With {.Texto = campo(1), .Valor = e.Row.DBCampo(campo(0)).ToDecimal(), .Color = listacolores(colorindex)})
+ colorindex = colorindex + 1
+ If colorindex >= listacolores.Count Then
+ colorindex = 0
+ End If
+ Next
+ e.Row.FCHyperLink("Hypgrafica").Attributes.Add("data-values", Newtonsoft.Json.JsonConvert.SerializeObject(lista))
+ End Sub
+#End Region
+
+
+
+
+
+#Region "DESCARGA EXCEL"
+
+ Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
+ Imprimir("Excel")
+ End Sub
+
+ Private Sub Imprimir(Optional reporte As String = "PDF")
+
+
+ If TAB.ActiveTabIndex = 0 AndAlso GvIngresosMes.Rows.Count > 0 Then
+ ExportToExcelG(GvIngresosMes, GvGastosMes, TMesT1, "Reporte_Mensual", UsuarioActual, "Mensual")
+ ElseIf TAB.ActiveTabIndex = 1 AndAlso GvIngresosMesH.Rows.Count > 0 Then
+ ExportToExcelG(GvIngresosMesH, GvGastosMesH, TMesT1, "Reporte_Mensual_Horizontal", UsuarioActual, "Mensual Horizontal", Gv3:=GvTotalesMesH)
+ ElseIf TAB.ActiveTabIndex = 2 AndAlso GvIngresosAnualH.Rows.Count > 0 Then
+ ExportToExcelG(GvIngresosAnualH, GvGastosAnualH, TMesT1, "Reporte_Anual_Horizontal", UsuarioActual, "Anual Horizontal", Gv3:=GvTotalesAnualH)
+
+ ElseIf TAB.ActiveTabIndex = 3 AndAlso GvIngresosSubProyectoH.Rows.Count > 0 Then
+
+ ExportToExcelG(GvIngresosSubProyectoH, GvGastosSubProyectoH, TMesT1, "Reporte_Proyecto_Horizontal", UsuarioActual, $"Estado de Resultados Horizontal por {LblSubProyecto.Text}", Gv3:=GvTotalesSubProyectoH, EsPorSubProtyecto:=True)
+
+ End If
+
+
+ End Sub
+
+ 'Public Sub ExportToExcelG(Gv1 As GridView, Gv2 As GridView, NombreArchivoXLSx As String, Optional Titulo As String = "Reporte", Optional Usuario As Usuario = Nothing, Optional Filtros As String = "", Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100)
+ Public Sub ExportToExcelG(Gv1 As GridView, Gv2 As GridView, TablaResultados As HtmlTable, NombreArchivoXLSx As String, Usuario As Usuario, Titulo As String, Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100, Optional Gv3 As GridView = Nothing, Optional EsPorSubProtyecto As Boolean = False)
+
+ Dim sw1 As New StringWriter()
+ Dim htw1 As New HtmlTextWriter(sw1)
+ Gv1.RenderControl(htw1)
+
+ Dim sw2 As New StringWriter()
+ Dim htw2 As New HtmlTextWriter(sw2)
+ Gv2.RenderControl(htw2)
+
+
+ TablaResultados.Width = Gv2.Width.ToString
+
+ Dim sw3 As New StringWriter()
+ Dim htw3 As New HtmlTextWriter(sw3)
+ TablaResultados.RenderControl(htw3)
+
+ Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault
+
+ Dim htmlStream1 = New MemoryStream(options.Encoding.GetBytes(sw1.ToString()))
+ Dim htmlStream2 = New MemoryStream(options.Encoding.GetBytes(sw2.ToString()))
+ Dim htmlStream3 = New MemoryStream(options.Encoding.GetBytes(sw3.ToString()))
+
+ htmlStream1.Position = 0
+ Dim sr1 As New StreamReader(htmlStream1)
+
+ htmlStream2.Position = 0
+ Dim sr2 As New StreamReader(htmlStream2)
+
+ htmlStream3.Position = 0
+ Dim sr3 As New StreamReader(htmlStream3)
+
+
+ Dim myStr1 = sr1.ReadToEnd()
+ Dim myStr2 = sr2.ReadToEnd()
+ Dim myStr3 = sr3.ReadToEnd()
+
+ sr1.Dispose()
+ sr2.Dispose()
+ sr3.Dispose()
+
+ htmlStream1.Dispose()
+ htmlStream2.Dispose()
+ htmlStream3.Dispose()
+
+ sw1.Dispose()
+ sw2.Dispose()
+ sw3.Dispose()
+
+ If Gv3 IsNot Nothing Then
+
+ Gv3.ShowHeader = False
+
+ Dim sw4 As New StringWriter()
+ Dim htw4 As New HtmlTextWriter(sw4)
+ Gv3.RenderControl(htw4)
+ Dim htmlStream4 = New MemoryStream(options.Encoding.GetBytes(sw4.ToString()))
+ htmlStream4.Position = 0
+ Dim sr4 As New StreamReader(htmlStream4)
+ myStr3 = sr4.ReadToEnd()
+
+ sr4.Dispose()
+ htmlStream2.Dispose()
+ sw4.Dispose()
+
+ End If
+
+
+ Dim HtmlCompleto As String = myStr1 & " " & myStr2 & " " & myStr3
+
+
+ HtmlCompleto = Regex.Replace(HtmlCompleto, "\<[\/]*a[^\>]*\>", "")
+
+
+ Dim htmlStream5 = New MemoryStream(options.Encoding.GetBytes(HtmlCompleto))
+
+ GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet)
+
+ Dim excel As GemBox.Spreadsheet.ExcelFile
+
+ excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream5, options)
+
+ If Usuario IsNot Nothing Then
+
+ Dim TotalRowHeader As Integer = 8
+ Dim TotalRowFooter As Integer = 2
+
+
+ Dim worksheet = excel.Worksheets(0)
+ worksheet.Rows.InsertEmpty(0, TotalRowHeader)
+ Dim celdasConTexto = worksheet.GetUsedCellRange(True)
+ celdasConTexto.Style.Font.Name = "Calibri Light"
+
+ Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex)
+ RangoNombreEmpresa.Merged = True
+ RangoNombreEmpresa.Value = Usuario.Empresa.Empresa
+ RangoNombreEmpresa.Style.Font.Size = 18 * 20
+ RangoNombreEmpresa.Style.Font.Name = "Calibri Light"
+ RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
+ RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
+
+
+ Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex)
+ RangoTitulo.Merged = True
+ RangoTitulo.Value = Titulo
+ RangoTitulo.Style.Font.Size = 20 * 20
+ RangoTitulo.Style.Font.Name = "Calibri Light"
+ RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
+ RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
+
+ Dim RangoFechas = worksheet.Cells.GetSubrangeAbsolute(4, celdasConTexto.FirstColumnIndex, 4, celdasConTexto.LastColumnIndex)
+ RangoFechas.Merged = True
+ RangoFechas.Value = $"Fechas: {FechaIMes} a {FechaFMes}"
+ RangoFechas.Style.Font.Size = 15 * 20
+ RangoFechas.Style.Font.Name = "Calibri Light"
+ RangoFechas.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
+ RangoFechas.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
+
+
+ If EsPorSubProtyecto And DdlSubproyecto.SelectedValue.ToEntero > 0 Then
+ Dim RangoSubProyecto = worksheet.Cells.GetSubrangeAbsolute(5, celdasConTexto.FirstColumnIndex, 5, celdasConTexto.LastColumnIndex)
+ RangoSubProyecto.Merged = True
+ RangoSubProyecto.Value = DdlSubproyecto.SelectedItem.Text
+ RangoSubProyecto.Style.Font.Size = 20 * 20
+ RangoSubProyecto.Style.Font.Name = "Calibri Light"
+ RangoSubProyecto.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
+ RangoSubProyecto.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
+ End If
+
+ For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
+
+ worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20
+ worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
+ worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
+
+ worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255))
+ worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
+
+
+
+ If Not EsPorSubProtyecto Then
+ worksheet.Rows(8 + Gv1.Rows.Count + 2).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255))
+ worksheet.Rows(8 + Gv1.Rows.Count + 2).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
+ Else
+ worksheet.Rows(18).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255))
+ worksheet.Rows(18).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
+ End If
+
+
+
+ If i > 0 Then
+ Try
+ worksheet.Columns(i).AutoFit(1)
+ Catch ex As Exception
+ End Try
+ End If
+ Next
+
+ Dim IndexEndTable As Integer = Gv1.Rows.Count + Gv2.Rows.Count + 4 + TotalRowHeader + TotalRowFooter
+
+ worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió"
+ worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.Nombre
+
+ worksheet.Rows(IndexEndTable).Cells(2).Value = "Fecha Impresión"
+ worksheet.Rows(IndexEndTable + 1).Cells(2).Value = DateTime.Now.ToString("dd/MM/yyyy")
+
+ Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta))
+
+ If Imagen.Exists Then
+ Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)
+ Using sr As New StreamReader(Ruta)
+ Dim ms As New MemoryStream()
+ sr.BaseStream.CopyTo(ms)
+ worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel)
+ End Using
+ End If
+
+
+
+
+
+
+ For I = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
+
+ If I > 0 Then
+
+ If DdlDivisor.SelectedValue.ToEntero = 1 Then
+ worksheet.Columns(I + 1).Style.NumberFormat = "#,##0.00"
+ Else
+ worksheet.Columns(I + 1).Style.NumberFormat = "#,##"
+ End If
+
+ Try
+ worksheet.Columns(I).AutoFit(1)
+ Catch ex As Exception
+ End Try
+
+ End If
+ Next
+
+ End If
+
+ excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx")
+
+
+ End Sub
+
+ Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
+ End Sub
+
+#End Region
+
+
+
+
+
+End Class
+
diff --git a/Finanzas/RepBalanceGeneralHorizontal.aspx.vb b/Finanzas/RepBalanceGeneralHorizontal.aspx.vb
index a893e59c8..4a65d9fd7 100644
--- a/Finanzas/RepBalanceGeneralHorizontal.aspx.vb
+++ b/Finanzas/RepBalanceGeneralHorizontal.aspx.vb
@@ -278,8 +278,8 @@ Partial Class Contabilidad_RepBalanceGeneralHorizontal
'LIGA SOLO EN DETALLE POR CAMPO CVECUENTA - TEMPORAL
- If e.Row.DBCampo("CtaMayor").ToString = "1" Then
- e.Row.FCHyperLink("HLNombre").NavigateUrl = $"/Contabilidad2/RepAnexoCatalogoMensual.aspx?C={e.Row.DBCampo("CveCuenta")}&E={DdlEjercicio.SelectedValue}&S={DdlSubProyecto.SelectedValue}&D={DdlDivisor.SelectedValue}"
+ If e.Row.DBCampo("CtaMayor").ToString = "1" Then
+ ' e.Row.FCHyperLink("HLNombre").NavigateUrl = $"/Contabilidad2/RepAnexoCatalogoMensual.aspx?C={e.Row.DBCampo("CveCuenta")}&E={DdlEjercicio.SelectedValue}&S={DdlSubProyecto.SelectedValue}&D={DdlDivisor.SelectedValue}"
End If
diff --git a/Finanzas/RepBalanceGeneralHorizontal2.aspx b/Finanzas/RepBalanceGeneralHorizontal2.aspx
new file mode 100644
index 000000000..cb5a8067e
--- /dev/null
+++ b/Finanzas/RepBalanceGeneralHorizontal2.aspx
@@ -0,0 +1,1592 @@
+<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RepBalanceGeneralHorizontal2.aspx.vb" Inherits="Contabilidad_RepBalanceGeneralHorizontal2" %>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
"
+ Next IndiceInicio
+
+
+
+ ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = -2 Then
+
+ Dim CountDinamico As Integer = e.Row.DataKey("CountDinamico").ToEntero
+ Dim IndiceInicio As Integer = 1
+ Dim IndiceMax As Integer = 1 + CountDinamico
+
+ For IndiceInicio = 1 To IndiceMax
+
+ Dim Importe As Decimal = e.Row.Cells(IndiceInicio).Text.ToDecimal
+ e.Row.Cells(IndiceInicio).Text = $"
"
+
+ Next IndiceInicio
+
+
+ End If
+ e.Row.FCHyperLink("HLAnterior").Text = If(DdlDivisor.SelectedValue.ToEntero > 1, e.Row.DBCampo("ImporteAcumulado").ToString.ToDecimal.ToString("###,###,##0"), e.Row.DBCampo("ImporteAcumulado").ToString.ToDecimal.ToString("###,###,##0.00"))
+ If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then
+ e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red
+ End If
+
+ End If
+
+ End Sub
+
+ Protected Sub GvGastosSubProyectoH_RowDataBound(sender As Object, e As GridViewRowEventArgs)
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ setgraficaCC(e)
+ If e.Row.DBCampo("CtaMayor").ToString.ToEntero < 0 Then
+ TotalActualMes -= e.Row.DBCampo("ImporteActual").ToString.ToDouble
+ TotalAnteriorMes -= e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble
+ e.Row.ControlStyle.Font.Bold = True
+ ElseIf e.Row.DBCampo("CtaMayor").ToString.ToEntero = 3 Then
+ 'e.Row.CssClass = "SubTotales"
+ e.Row.ControlStyle.Font.Bold = True
+ End If
+ If e.Row.DBCampo("ImporteAcumulado").ToString.ToDouble < 0 Then
+ e.Row.FCHyperLink("HLAnterior").ForeColor = Drawing.Color.Red
+ End If
+ End If
+ End Sub
+
+ Protected Sub GvTotalesSubProyectoH_RowDataBound(sender As Object, e As GridViewRowEventArgs)
+ If e.Row.RowType = DataControlRowType.Header Then
+ ' e.Row.Attributes.Add("style", "display:none")
+ End If
+ If e.Row.RowType = DataControlRowType.DataRow Then
+ setgraficaCC(e)
+ e.Row.Attributes.Add("style", "Font-weight: bold")
+ End If
+ End Sub
+
+ Public Sub setgraficaCC(e As GridViewRowEventArgs)
+ Dim lista As New List(Of Object)
+ Dim colorindex As Integer = 0
+ For Each campo As String() In listaCampos
+ lista.Add(New With {.Texto = campo(1), .Valor = e.Row.DBCampo(campo(0)).ToDecimal(), .Color = listacolores(colorindex)})
+ colorindex = colorindex + 1
+ If colorindex >= listacolores.Count Then
+ colorindex = 0
+ End If
+ Next
+ e.Row.FCHyperLink("Hypgrafica").Attributes.Add("data-values", Newtonsoft.Json.JsonConvert.SerializeObject(lista))
+ End Sub
+#End Region
+
+
+
+
+
+#Region "DESCARGA EXCEL"
+
+ Private Sub LnkExportar_Click(sender As Object, e As EventArgs) Handles LnkExportar.Click
+ Imprimir("Excel")
+ End Sub
+
+ Private Sub Imprimir(Optional reporte As String = "PDF")
+
+
+ If TAB.ActiveTabIndex = 0 AndAlso GvIngresosMes.Rows.Count > 0 Then
+ ExportToExcelG(GvIngresosMes, GvGastosMes, TMesT1, "Reporte_Mensual", UsuarioActual, "Mensual")
+ ElseIf TAB.ActiveTabIndex = 1 AndAlso GvIngresosMesH.Rows.Count > 0 Then
+ ExportToExcelG(GvIngresosMesH, GvGastosMesH, TMesT1, "Reporte_Mensual_Horizontal", UsuarioActual, "Mensual Horizontal", Gv3:=GvTotalesMesH)
+ ElseIf TAB.ActiveTabIndex = 2 AndAlso GvIngresosAnualH.Rows.Count > 0 Then
+ ExportToExcelG(GvIngresosAnualH, GvGastosAnualH, TMesT1, "Reporte_Anual_Horizontal", UsuarioActual, "Anual Horizontal", Gv3:=GvTotalesAnualH)
+
+ ElseIf TAB.ActiveTabIndex = 3 AndAlso GvIngresosSubProyectoH.Rows.Count > 0 Then
+
+ ExportToExcelG(GvIngresosSubProyectoH, GvGastosSubProyectoH, TMesT1, "Reporte_Proyecto_Horizontal", UsuarioActual, $"Estado de Resultados Horizontal por {LblSubProyecto.Text}", Gv3:=GvTotalesSubProyectoH, EsPorSubProtyecto:=True)
+
+ End If
+
+
+ End Sub
+
+ 'Public Sub ExportToExcelG(Gv1 As GridView, Gv2 As GridView, NombreArchivoXLSx As String, Optional Titulo As String = "Reporte", Optional Usuario As Usuario = Nothing, Optional Filtros As String = "", Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100)
+ Public Sub ExportToExcelG(Gv1 As GridView, Gv2 As GridView, TablaResultados As HtmlTable, NombreArchivoXLSx As String, Usuario As Usuario, Titulo As String, Optional AlturaImagen As Double = 100, Optional AnchoImagen As Double = 100, Optional Gv3 As GridView = Nothing, Optional EsPorSubProtyecto As Boolean = False)
+
+ Dim sw1 As New StringWriter()
+ Dim htw1 As New HtmlTextWriter(sw1)
+ Gv1.RenderControl(htw1)
+
+ Dim sw2 As New StringWriter()
+ Dim htw2 As New HtmlTextWriter(sw2)
+ Gv2.RenderControl(htw2)
+
+
+ TablaResultados.Width = Gv2.Width.ToString
+
+ Dim sw3 As New StringWriter()
+ Dim htw3 As New HtmlTextWriter(sw3)
+ TablaResultados.RenderControl(htw3)
+
+ Dim options = GemBox.Spreadsheet.LoadOptions.HtmlDefault
+
+ Dim htmlStream1 = New MemoryStream(options.Encoding.GetBytes(sw1.ToString()))
+ Dim htmlStream2 = New MemoryStream(options.Encoding.GetBytes(sw2.ToString()))
+ Dim htmlStream3 = New MemoryStream(options.Encoding.GetBytes(sw3.ToString()))
+
+ htmlStream1.Position = 0
+ Dim sr1 As New StreamReader(htmlStream1)
+
+ htmlStream2.Position = 0
+ Dim sr2 As New StreamReader(htmlStream2)
+
+ htmlStream3.Position = 0
+ Dim sr3 As New StreamReader(htmlStream3)
+
+
+ Dim myStr1 = sr1.ReadToEnd()
+ Dim myStr2 = sr2.ReadToEnd()
+ Dim myStr3 = sr3.ReadToEnd()
+
+ sr1.Dispose()
+ sr2.Dispose()
+ sr3.Dispose()
+
+ htmlStream1.Dispose()
+ htmlStream2.Dispose()
+ htmlStream3.Dispose()
+
+ sw1.Dispose()
+ sw2.Dispose()
+ sw3.Dispose()
+
+ If Gv3 IsNot Nothing Then
+
+ Gv3.ShowHeader = False
+
+ Dim sw4 As New StringWriter()
+ Dim htw4 As New HtmlTextWriter(sw4)
+ Gv3.RenderControl(htw4)
+ Dim htmlStream4 = New MemoryStream(options.Encoding.GetBytes(sw4.ToString()))
+ htmlStream4.Position = 0
+ Dim sr4 As New StreamReader(htmlStream4)
+ myStr3 = sr4.ReadToEnd()
+
+ sr4.Dispose()
+ htmlStream2.Dispose()
+ sw4.Dispose()
+
+ End If
+
+
+ Dim HtmlCompleto As String = myStr1 & " " & myStr2 & " " & myStr3
+
+
+ HtmlCompleto = Regex.Replace(HtmlCompleto, "\<[\/]*a[^\>]*\>", "")
+
+
+ Dim htmlStream5 = New MemoryStream(options.Encoding.GetBytes(HtmlCompleto))
+
+ GemBox.Spreadsheet.SpreadsheetInfo.SetLicense(SerialGemBoxSpreadsheet)
+
+ Dim excel As GemBox.Spreadsheet.ExcelFile
+
+ excel = GemBox.Spreadsheet.ExcelFile.Load(htmlStream5, options)
+
+ If Usuario IsNot Nothing Then
+
+ Dim TotalRowHeader As Integer = 8
+ Dim TotalRowFooter As Integer = 2
+
+
+ Dim worksheet = excel.Worksheets(0)
+ worksheet.Rows.InsertEmpty(0, TotalRowHeader)
+ Dim celdasConTexto = worksheet.GetUsedCellRange(True)
+ celdasConTexto.Style.Font.Name = "Calibri Light"
+
+ Dim RangoNombreEmpresa = worksheet.Cells.GetSubrangeAbsolute(1, celdasConTexto.FirstColumnIndex, 1, celdasConTexto.LastColumnIndex)
+ RangoNombreEmpresa.Merged = True
+ RangoNombreEmpresa.Value = Usuario.Empresa.Empresa
+ RangoNombreEmpresa.Style.Font.Size = 18 * 20
+ RangoNombreEmpresa.Style.Font.Name = "Calibri Light"
+ RangoNombreEmpresa.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
+ RangoNombreEmpresa.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
+
+
+ Dim RangoTitulo = worksheet.Cells.GetSubrangeAbsolute(3, celdasConTexto.FirstColumnIndex, 3, celdasConTexto.LastColumnIndex)
+ RangoTitulo.Merged = True
+ RangoTitulo.Value = Titulo
+ RangoTitulo.Style.Font.Size = 20 * 20
+ RangoTitulo.Style.Font.Name = "Calibri Light"
+ RangoTitulo.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
+ RangoTitulo.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
+
+ Dim RangoFechas = worksheet.Cells.GetSubrangeAbsolute(4, celdasConTexto.FirstColumnIndex, 4, celdasConTexto.LastColumnIndex)
+ RangoFechas.Merged = True
+ RangoFechas.Value = $"Fechas: {FechaIMes} a {FechaFMes}"
+ RangoFechas.Style.Font.Size = 15 * 20
+ RangoFechas.Style.Font.Name = "Calibri Light"
+ RangoFechas.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
+ RangoFechas.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
+
+
+ If EsPorSubProtyecto And DdlSubproyecto.SelectedValue.ToEntero > 0 Then
+ Dim RangoSubProyecto = worksheet.Cells.GetSubrangeAbsolute(5, celdasConTexto.FirstColumnIndex, 5, celdasConTexto.LastColumnIndex)
+ RangoSubProyecto.Merged = True
+ RangoSubProyecto.Value = DdlSubproyecto.SelectedItem.Text
+ RangoSubProyecto.Style.Font.Size = 20 * 20
+ RangoSubProyecto.Style.Font.Name = "Calibri Light"
+ RangoSubProyecto.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
+ RangoSubProyecto.Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
+ End If
+
+ For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
+
+ worksheet.Rows(8).Cells(i).Style.Font.Size = 12 * 20
+ worksheet.Rows(8).Cells(i).Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
+ worksheet.Rows(8).Cells(i).Style.VerticalAlignment = GemBox.Spreadsheet.VerticalAlignmentStyle.Center
+
+ worksheet.Rows(8).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255))
+ worksheet.Rows(8).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
+
+
+
+ If Not EsPorSubProtyecto Then
+ worksheet.Rows(8 + Gv1.Rows.Count + 2).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255))
+ worksheet.Rows(8 + Gv1.Rows.Count + 2).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
+ Else
+ worksheet.Rows(18).Cells(i).Style.FillPattern.SetPattern(GemBox.Spreadsheet.FillPatternStyle.Solid, GemBox.Spreadsheet.SpreadsheetColor.FromArgb(75, 119, 190), GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255))
+ worksheet.Rows(18).Cells(i).Style.Font.Color = GemBox.Spreadsheet.SpreadsheetColor.FromArgb(255, 255, 255)
+ End If
+
+
+
+ If i > 0 Then
+ Try
+ worksheet.Columns(i).AutoFit(1)
+ Catch ex As Exception
+ End Try
+ End If
+ Next
+
+ Dim IndexEndTable As Integer = Gv1.Rows.Count + Gv2.Rows.Count + 4 + TotalRowHeader + TotalRowFooter
+
+ worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió"
+ worksheet.Rows(IndexEndTable + 1).Cells(0).Value = Usuario.Nombre
+
+ worksheet.Rows(IndexEndTable).Cells(2).Value = "Fecha Impresión"
+ worksheet.Rows(IndexEndTable + 1).Cells(2).Value = DateTime.Now.ToString("dd/MM/yyyy")
+
+ Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", Usuario.Empresa.Ruta))
+
+ If Imagen.Exists Then
+ Dim Ruta As String = String.Format("{0}/Logo.png", Usuario.Empresa.Ruta)
+ Using sr As New StreamReader(Ruta)
+ Dim ms As New MemoryStream()
+ sr.BaseStream.CopyTo(ms)
+ worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", AnchoImagen, AlturaImagen, LengthUnit.Pixel)
+ End Using
+ End If
+
+
+
+
+
+
+ For I = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
+
+ If I > 0 Then
+
+ If DdlDivisor.SelectedValue.ToEntero = 1 Then
+ worksheet.Columns(I + 1).Style.NumberFormat = "#,##0.00"
+ Else
+ worksheet.Columns(I + 1).Style.NumberFormat = "#,##"
+ End If
+
+ Try
+ worksheet.Columns(I).AutoFit(1)
+ Catch ex As Exception
+ End Try
+
+ End If
+ Next
+
+ End If
+
+ excel.Save(HttpContext.Current.Response, $"{NombreArchivoXLSx}.xlsx")
+
+
+ End Sub
+
+ Public Overrides Sub VerifyRenderingInServerForm(ByVal control As Control)
+ End Sub
+
+#End Region
+
+
+
+
+
+End Class
+
diff --git a/Inventarios/RecepcionAlmacen.aspx.vb b/Inventarios/RecepcionAlmacen.aspx.vb
index 53d9e0acb..5022d6ebb 100644
--- a/Inventarios/RecepcionAlmacen.aspx.vb
+++ b/Inventarios/RecepcionAlmacen.aspx.vb
@@ -732,7 +732,7 @@ Partial Class Inventarios_RecepcionAlmacen
ObjInventarios.Dispose()
DdlIndirectoFactura.DataBind()
- DdlIndirectoFactura.Items.Insert(0, New ListItem("Todos", "-1"))
+ 'DdlIndirectoFactura.Items.Insert(0, New ListItem("Todos", "-1"))
End Sub
@@ -2270,6 +2270,10 @@ Partial Class Inventarios_RecepcionAlmacen
Dim ObjContaContPAQ As ClsContPAQi = Nothing
'ENTREGA DIRECTA
+
+ Dim MovtosEntradaExA As New List(Of Integer)
+ Dim FoliosEntradaExA As New List(Of Integer)
+
Dim MovtosSalidaDirecta As New List(Of Integer)
Dim FoliosSalidaDirecta As New List(Of Integer)
@@ -2548,36 +2552,42 @@ Partial Class Inventarios_RecepcionAlmacen
Dim CveVenta As Integer = DrVenta("CveVenta").ToString().ToEntero()
- CveMovtoSalidaDirecta = ObjInventario.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, 3, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1,
- CveVenta, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, TipoCambio:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, TipoCambio),
- MovimientoFijo:=True, CveMovimientoRelacionado:=CveMovimiento, Remision:=TxtRemision.Text, CveVendedor:=CveVendedor, CveCliente:=CveCliente, Modulo:="RA/G2")
- FolioSalidaDirecta = ObjInventario.Folio
+ Dim ObjFactura As New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa)
- If Not CveMovtoSalidaDirecta > 0 Then
- ErrorMovInv = True
- Exit For
- End If
+ Dim DtDetalleMovimiento As DataTable = Dt.FiltraParametros($"CveVenta={ObjFactura.CveVenta}")
- If Not ErrorMovInv AndAlso Dt IsNot Nothing Then
- For Each Dr As DataRow In Dt.FiltraParametros($"CveVenta={CveVenta}").Rows
- If Not ObjInventario.AddMovimientoDetalle(CveMovtoSalidaDirecta, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
- ErrorMovInv = True
- Exit For
- End If
- Next
- End If
+ If ObjFactura.TipoDocto = "Ing" Then
+ Dim MovSalida = GenerarMovimientoAlmacenVenta(DdlAlmacen.SelectedValue.ToEntero(), 3, ObjFactura.CveVenta, CveMovimiento, DtDetalleMovimiento, ObjInventario, ObjConta, ObjContaContPAQ, EsContabilizable, "RA/G2")
- If Not ErrorMovInv Then
- If Not GeneraPrePolizaSalidaEntregaDirecta(CveMovtoSalidaDirecta, ObjInventario, ObjConta, ObjContaContPAQ, EsContabilizable) Then
- ErrorMovInv = True
- Exit For
+ ErrorMovInv = MovSalida.CveMovimiento <= 0
+
+ If Not ErrorMovInv Then
+ MovtosSalidaDirecta.Add(MovSalida.CveMovimiento)
+ FoliosSalidaDirecta.Add(MovSalida.Folio)
End If
+
+ ElseIf ObjFactura.TipoDocto = "Rem" Then
+ Dim MovSalidaExA = GenerarMovimientoAlmacenVenta(DdlAlmacen.SelectedValue.ToEntero(), 8, ObjFactura.CveVenta, -1, DtDetalleMovimiento, ObjInventario, ObjConta, ObjContaContPAQ, False, "RA/G2R1")
+
+ ErrorMovInv = MovSalidaExA.CveMovimiento <= 0
+
+ If Not ErrorMovInv Then
+ MovtosSalidaDirecta.Add(MovSalidaExA.CveMovimiento)
+ FoliosSalidaDirecta.Add(MovSalidaExA.Folio)
+
+ Dim MovEntradaExA = GenerarMovimientoAlmacenVenta(ObjFactura.CveAlmacenTraspasoDestino, 9, ObjFactura.CveVenta, MovSalidaExA.CveMovimiento, DtDetalleMovimiento, ObjInventario, ObjConta, ObjContaContPAQ, False, "RA/G2R2")
+
+ ErrorMovInv = MovEntradaExA.CveMovimiento <= 0
+
+ If Not ErrorMovInv Then
+ MovtosEntradaExA.Add(MovEntradaExA.CveMovimiento)
+ FoliosEntradaExA.Add(MovEntradaExA.Folio)
+ End If
+
+ End If
+
End If
- If Not ErrorMovInv Then
- MovtosSalidaDirecta.Add(CveMovtoSalidaDirecta)
- FoliosSalidaDirecta.Add(FolioSalidaDirecta)
- End If
Next
If Not ErrorMovInv Then
@@ -3307,6 +3317,14 @@ Partial Class Inventarios_RecepcionAlmacen
'ENTREGA DIRECTA
If MovtosSalidaDirecta.Count > 0 Then
Msg.AppendFormat("
Movimientos de control: ")
+
+ If MovtosEntradaExA.Count > 0 Then
+ For index = 0 To MovtosEntradaExA.Count - 1
+ link = String.Format("{1}", MovtosEntradaExA(index), FoliosEntradaExA(index))
+ Msg.AppendFormat(" Movimiento de Entrada Folio: {0}", link)
+ Next
+ End If
+
For index = 0 To MovtosSalidaDirecta.Count - 1
link = String.Format("{1}", MovtosSalidaDirecta(index), FoliosSalidaDirecta(index))
Msg.AppendFormat(" Movimiento de Salida Folio: {0}", link)
@@ -3355,6 +3373,45 @@ Partial Class Inventarios_RecepcionAlmacen
If ObjContaAC IsNot Nothing Then ObjContaAC.Dispose()
If ObjContaContPAQ IsNot Nothing Then ObjContaContPAQ.Dispose()
End Sub
+
+ Private Function GenerarMovimientoAlmacenVenta(CveAlmacen As Integer, CveConceptoAlmacen As Integer, CveVenta As Integer, CveMovimientoRelacionado As Integer, DtDetalle As DataTable, ObjInventario As ClsInventarios, ObjConta As ClsContabilidad, ObjContaContPAQ As ClsContPAQi, EsContabilizable As Boolean, Modulo As String) As MMovimientoAlmacen
+ Dim ErrorMovInv As Boolean = False
+ Dim Retorno As New MMovimientoAlmacen
+
+ Dim CveMovtoSalidaDirecta As Integer = -1
+ Dim FolioSalidaDirecta As Integer = -1
+
+ CveMovtoSalidaDirecta = ObjInventario.AddMovimiento(CveAlmacen, CveConceptoAlmacen, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1,
+ CveVenta, -1, -1, Observaciones:=TxtObservaciones.Text.Trim, TipoCambio:=If(DdlMonedaTC.SelectedValue.ToEntero = 1, -1, TipoCambio),
+ MovimientoFijo:=True, CveMovimientoRelacionado:=CveMovimientoRelacionado, Remision:=TxtRemision.Text, CveVendedor:=CveVendedor, CveCliente:=CveCliente, Modulo:=Modulo)
+ FolioSalidaDirecta = ObjInventario.Folio
+
+ If Not CveMovtoSalidaDirecta > 0 Then
+ ErrorMovInv = True
+ End If
+
+ If Not ErrorMovInv AndAlso DtDetalle IsNot Nothing Then
+ For Each Dr As DataRow In DtDetalle.Rows
+ If Not ObjInventario.AddMovimientoDetalle(CveMovtoSalidaDirecta, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString.ToEntero, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
+ ErrorMovInv = True
+ Exit For
+ End If
+ Next
+ End If
+
+ If Not ErrorMovInv AndAlso CveConceptoAlmacen = 3 Then
+ If Not GeneraPrePolizaSalidaEntregaDirecta(CveMovtoSalidaDirecta, ObjInventario, ObjConta, ObjContaContPAQ, EsContabilizable) Then
+ ErrorMovInv = True
+ End If
+ End If
+
+ If Not ErrorMovInv Then
+ Retorno.CveMovimiento = CveMovtoSalidaDirecta
+ Retorno.Folio = FolioSalidaDirecta
+ End If
+
+ Return Retorno
+ End Function
Private Sub GuardaImportacionFlete()
Dim CveMovimiento As Integer
Dim InvFolio As String = ""
@@ -4283,3 +4340,9 @@ Partial Class Inventarios_RecepcionAlmacen
End Class
+
+Public Class MMovimientoAlmacen
+ Public Property CveMovimiento As Integer
+ Public Property Folio As Integer
+
+End Class
diff --git a/Inventarios/TrasladoSolicitud.aspx b/Inventarios/TrasladoSolicitud.aspx
index 5e5b351c2..ea4114667 100644
--- a/Inventarios/TrasladoSolicitud.aspx
+++ b/Inventarios/TrasladoSolicitud.aspx
@@ -234,35 +234,39 @@
-
-
-
+
+
+
-
-
+
+
+
+
-
Estado :
-
Usuario :
-
Fecha :
+
Estado :
+
Usuario :
+
Fecha :
-
+
+
+
-
-
-
-
-
-
+
-
-
-
-
-
-
+
+
+
+
+
+
-
+
+
+
+
+
+
diff --git a/Inventarios/TrasladoSolicitud.aspx.vb b/Inventarios/TrasladoSolicitud.aspx.vb
index 13286849f..baf983a9c 100644
--- a/Inventarios/TrasladoSolicitud.aspx.vb
+++ b/Inventarios/TrasladoSolicitud.aspx.vb
@@ -285,6 +285,9 @@ Partial Class Inventarios_TrasladoSolicitud
Else
Alert("Ocurrió un error al obtener los datos del traspaso.", TipoMensaje.MsgError)
End If
+
+ UpAutorizaciones.Update()
+
End If
ObjInventarios.Dispose()
ObjClientes.Dispose()
@@ -1034,6 +1037,9 @@ Partial Class Inventarios_TrasladoSolicitud
MandaCorreoRechazo(LbFolio.Text.ToEntero, CveTraspasoSolicitud, CveUsuarioSolicita, TxtMotivoRechazo.Text)
CargaDatos()
RegistraScript("$('#ModalRechazarTraslado').modal('hide');")
+
+
+
End If
End Sub
diff --git a/Sistemas/Empresa.aspx b/Sistemas/Empresa.aspx
index 65c1c9719..0c560e540 100644
--- a/Sistemas/Empresa.aspx
+++ b/Sistemas/Empresa.aspx
@@ -1327,6 +1327,11 @@
+
+
+
+
+
diff --git a/Ventas/ProductosServicios.aspx.vb b/Ventas/ProductosServicios.aspx.vb
index e4ea4d42e..6a56b6f1a 100644
--- a/Ventas/ProductosServicios.aspx.vb
+++ b/Ventas/ProductosServicios.aspx.vb
@@ -911,7 +911,7 @@ Partial Class ProductosyServicios
Public Sub CargaDdlSATPS()
DdlSATPS.setEsWebService(True)
- DdlSATPS.Attributes.Add("data-metodo", "getpssat")
+ DdlSATPS.ddlWS.Attributes.Add("data-metodo", "getpssat")
End Sub
Public Sub CargaDdlFraccionArancelaria()
@@ -1123,6 +1123,10 @@ Partial Class ProductosyServicios
End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As System.EventArgs) Handles BtnGuardar.Click
+ If DdlSATPS.SelectedValue = "46920" Then
+ Alert("El Producto Servicio SAT con clave '01010101' no es valido, por favor seleccione otro", TipoMensaje.MsgAdvertencia)
+ Exit Sub
+ End If
If TxtPS.Text.Trim.Length = 0 Or DdlTipoPS.SelectedValue.ToEntero <= 0 Or DdlUnidadMedida.SelectedValue.ToEntero <= 0 Or DdlClasificacion.SelectedValue.ToEntero <= 0 Then
Alert("Los campos Producto/Servicio, Tipo, Unidad de medida, Clasificación Contable son requeridos por favor ingreselos.", TipoMensaje.MsgAdvertencia)
diff --git a/Ventas/Ventas.aspx.vb b/Ventas/Ventas.aspx.vb
index c560d8455..f66c6c5ef 100644
--- a/Ventas/Ventas.aspx.vb
+++ b/Ventas/Ventas.aspx.vb
@@ -1782,6 +1782,15 @@ Partial Class Ventas
End Set
End Property
+ Private Property VentaDesglosaIEPS As Boolean
+ Get
+ Return CBool(IfNull(ViewState("VentaDesglosaIEPS"), "False", ViewState("VentaDesglosaIEPS")))
+ End Get
+ Set(value As Boolean)
+ ViewState("VentaDesglosaIEPS") = value
+ End Set
+ End Property
+
#End Region
'#Region "AuxiliarConta"
@@ -5325,8 +5334,7 @@ Partial Class Ventas
CargarAlmacenes()
- If UsuarioActual.Empresa.FacturaProduccion Then
- End If
+
CargaDocumentacionCliente()
If UsuarioActual.CveEmpresa.Contiene(72, 80, 1, 119) Then
@@ -8483,7 +8491,7 @@ Partial Class Ventas
ObjFactura.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", $"CveMoneda = {DdlMoneda.SelectedValue}")
ObjFactura.TipoDocto = If(IfNull(ViewState("CveRemision"), 0).ToString().ToEntero() > 0, "Ing", DdlTipoComprobante.SelectedValue)
ObjFactura.FacturarSucursal = (Me.FacturarSucursal AndAlso DdlSucursalCliente.SelectedValue.ToEntero() > 0 AndAlso (Me.ClienteSucursal IsNot Nothing AndAlso Not String.IsNullOrEmpty(Me.ClienteSucursal.RFC)))
-
+ ObjFactura.VentaDesglosaIEPS = Me.VentaDesglosaIEPS
'ObjFactura.RefDocto = TxtDocto.Text.Trim
'si es cancelacion, debe de conservar el folio actual
If Not EsCancelacion Then ObjFactura.Folio = If(EstablecioFolio Or VistaPrevia Or (CveVenta > 0 And (NuevaFactura.Contiene(0, 2))), TxtFolio.Text.Trim.ToEntero(), -1)
@@ -9868,16 +9876,23 @@ Partial Class Ventas
ObjClientes.Dispose()
+ BtnEmitirImprimir.Text = "Facturar"
+
'REGISTRAR UNA ENTREGA DIRECTA
If TmpDT.COUNT("EntregaDirecta", "EntregaDirecta = 1") > 0 Then
trPaqueteriaOpciones.Visible = False
trPaqueteriOpcionesLabel.Visible = False
trPaqueteriaDirectaLabel.Visible = True
- End If
- BtnEmitirImprimir.Text = "Facturar"
- DdlTipoComprobante.SelectedValue = "Ing"
- DdlTipoComprobante.Enabled = False
+ DdlTipoComprobante.Items.Clear()
+ DdlTipoComprobante.Items.Insert(0, New ListItem("Ingresos", "Ing"))
+ DdlTipoComprobante.Items.Insert(1, New ListItem("Remisión", "Rem"))
+ DdlTipoComprobante.Enabled = True
+
+ Else
+ DdlTipoComprobante.SelectedValue = "Ing"
+ DdlTipoComprobante.Enabled = False
+ End If
Tab.ActiveTab = TabGenerales
TabGenerales.Enabled = True
@@ -10048,7 +10063,8 @@ Partial Class Ventas
CveVentaRelacion:=(If(factura.CveVentaRelacion.ToEntero() > 0, factura.CveVentaRelacion, -1)), ImporteRelacion:=(If(factura.ImporteRelacion <> Nothing, factura.ImporteRelacion, -1)),
CveTipoAmortizacionAnticipo:=factura.CveTipoAmortizacionAnticipo, CveEmpresaCRM:=CveEmpresaCRM, EsInterno:=EsInterno, CveAcercamientoCRM:=CveAcercamientoCRM,
DiasCredito:=factura.DiasCredito, EsDiasCreditoFijo:=factura.EsDiasCreditoFijo, AnticipoEspecial:=If(TrAntEspecial.Visible, ChkAntEspecial.Checked, False),
- Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=factura.CveTipoRetencion, CorreoNotificacion:=TxtCorreoNotificaciones.Text, FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal) Then
+ Kilometraje:=TxtKilometraje.Text.ToDouble, EsAmortizacion:=EsNCAmortizacion, CveTipoRetencion:=factura.CveTipoRetencion, CorreoNotificacion:=TxtCorreoNotificaciones.Text,
+ FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS) Then
ErrorList.Add("Ocurrió un error al Generar la Venta. Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Else
If factura.TipoDocto.Contiene("Dev", "Egs") Or DtVentasNC IsNot Nothing Or CveEstatusRefacturacion = 1 Then
@@ -14534,119 +14550,121 @@ Partial Class Ventas
TxtPrecio.Enabled = True
End If
- If UsuarioActual.TienePermisoProceso(68) Then TxtPrecio.Enabled = False
+ Dim PSCodigoSAT As String = drPS("SATClavePS").ToString
+
+ If UsuarioActual.TienePermisoProceso(68) AndAlso Not PSCodigoSAT.Contiene("84111506", "80141610") Then TxtPrecio.Enabled = False
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count = 0 Then
- DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString())
- CambiaMoneda()
- End If
-
- 'SUGIERE PRECIO
- Dim PrecioSugerido = 0.0
- PrecioSugerido = drPS("Precio").ToString().ToDouble
-
- If UsuarioActual.CveEmpresa.Contiene(1) Then
- Dim ObjPS As New ClsProductosServicios
- If ObjPS.GetPorcentajeProductos(CveCliente) Then
- Dim PrecioAplicado = ObjPS.DtResultados.FiltraParametros($"CvePS = {CvePSParametro}").FiltroPrimeroValor("PrecioA").ToDouble
- If PrecioAplicado > 0 Then
- PrecioSugerido = PrecioAplicado
- End If
- End If
- ObjPS.Dispose()
- End If
-
- If UsuarioActual.Empresa.Funcionalidad(404).ToEntero > 0 Then 'cuando el valor es 10.- secuencia Cliente/Sucursal, 20 - sucursal/cliente
- Dim TipoPrecioLista As Integer = UsuarioActual.Empresa.Funcionalidad(404).ToEntero
- ' si es 10. primero el cliente
- Dim CvePrecioListaPS As Integer
- Dim PorcentajePrecio As Double = 0
-
- If TipoPrecioLista = 10 Then
-
- CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero()
- If CvePrecioListaPS <= 0 Then
-
- CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero()
-
- End If
-
- Else
-
- CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero()
- If CvePrecioListaPS <= 0 Then
-
- CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero()
-
- End If
-
+ DdlMoneda.SelectedValueExist(drPS("CveMoneda").ToString())
+ CambiaMoneda()
End If
- If CvePrecioListaPS > 0 Then
+ 'SUGIERE PRECIO
+ Dim PrecioSugerido = 0.0
+ PrecioSugerido = drPS("Precio").ToString().ToDouble
+
+ If UsuarioActual.CveEmpresa.Contiene(1) Then
Dim ObjPS As New ClsProductosServicios
- If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then
- PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDouble
- PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDouble
+ If ObjPS.GetPorcentajeProductos(CveCliente) Then
+ Dim PrecioAplicado = ObjPS.DtResultados.FiltraParametros($"CvePS = {CvePSParametro}").FiltroPrimeroValor("PrecioA").ToDouble
+ If PrecioAplicado > 0 Then
+ PrecioSugerido = PrecioAplicado
+ End If
End If
ObjPS.Dispose()
End If
- If PrecioSugerido = 0 Then
- Dim ObjInventarios As New ClsInventarios
- Dim CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
- 'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
- If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
- ObjInventarios.Dispose()
- If CostoPS > 0 And PorcentajePrecio > 0 Then
- PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS
+ If UsuarioActual.Empresa.Funcionalidad(404).ToEntero > 0 Then 'cuando el valor es 10.- secuencia Cliente/Sucursal, 20 - sucursal/cliente
+ Dim TipoPrecioLista As Integer = UsuarioActual.Empresa.Funcionalidad(404).ToEntero
+ ' si es 10. primero el cliente
+ Dim CvePrecioListaPS As Integer
+ Dim PorcentajePrecio As Double = 0
+
+ If TipoPrecioLista = 10 Then
+
+ CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero()
+ If CvePrecioListaPS <= 0 Then
+
+ CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero()
+
+ End If
+
+ Else
+
+ CvePrecioListaPS = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(), CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimeroValor("CvePrecioLista", "").ToEntero()
+ If CvePrecioListaPS <= 0 Then
+
+ CvePrecioListaPS = GlobalDTCliente(UsuarioActual.CveEmpresa, Estatus:=-1, CveCliente:=CveCliente).FiltroPrimeroValor("CvePrecioLista").ToEntero()
+
+ End If
+
End If
+
+ If CvePrecioListaPS > 0 Then
+ Dim ObjPS As New ClsProductosServicios
+ If ObjPS.GetPSPreciosLista(UsuarioActual.CveEmpresa, CvePrecioListaPS, CvePS:=CvePSParametro) Then
+ PrecioSugerido = ObjPS.DtResultados.FiltroPrimeroValor("PrecioLista").ToDouble
+ PorcentajePrecio = ObjPS.DtResultados.FiltroPrimeroValor("Porcentaje").ToDouble
+ End If
+ ObjPS.Dispose()
+ End If
+
+ If PrecioSugerido = 0 Then
+ Dim ObjInventarios As New ClsInventarios
+ Dim CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero(), CveTipoAlmacen:=1)
+ 'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
+ If CostoPS = 0 Then CostoPS = ObjInventarios.GetCostoPS(CvePSParametro, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1, CveTipoAlmacen:=1)
+ ObjInventarios.Dispose()
+ If CostoPS > 0 And PorcentajePrecio > 0 Then
+ PrecioSugerido = ((PorcentajePrecio / 100) + 1) * CostoPS
+ End If
+ End If
+ CvePrecioLista = CvePrecioListaPS
End If
- CvePrecioLista = CvePrecioListaPS
- End If
- 'Dim ObjClasificaciones As New ClsClasificaciones
- 'If ObjClasificaciones.GetClasificaciones() Then
- ' PrecioBaseCosto = ObjClasificaciones.DtResultados.FiltroPrimeroValor("PrecioBaseCosto", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveClasificacion = {drPS("CveClasificacion")}").ToDecimal
- 'End If
+ 'Dim ObjClasificaciones As New ClsClasificaciones
+ 'If ObjClasificaciones.GetClasificaciones() Then
+ ' PrecioBaseCosto = ObjClasificaciones.DtResultados.FiltroPrimeroValor("PrecioBaseCosto", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveClasificacion = {drPS("CveClasificacion")}").ToDecimal
+ 'End If
- If PrecioSugerido > 0 Then
- Dim PrecioBaseCosto As Decimal = 0
- PrecioBaseCosto = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=drPS("CveClasificacion").ToString().ToEntero()).FiltroPrimeroValor("PrecioBaseCosto", "").ToDecimal
+ If PrecioSugerido > 0 Then
+ Dim PrecioBaseCosto As Decimal = 0
+ PrecioBaseCosto = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, CveClasificacion:=drPS("CveClasificacion").ToString().ToEntero()).FiltroPrimeroValor("PrecioBaseCosto", "").ToDecimal
- If PrecioBaseCosto > 0 Then
- PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1)
+ If PrecioBaseCosto > 0 Then
+ PrecioSugerido = PrecioSugerido * ((PrecioBaseCosto / 100) + 1)
+ End If
+ TxtPrecio.Text = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere
End If
- TxtPrecio.Text = PrecioSugerido.ToString("#,###.####") ' que muestre hasta los 4 digitos si lo requiere
- End If
- If IsNumeric(TxtCantidad.Text.Trim) Then
- LblTotalPS.Text = (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.ToDouble).ToString().FormatoNumero(2)
- Else
- LblTotalPS.Text = "0.00"
- End If
- LblPrecio1.Text = TxtPrecio.Text
- UPPDescuento.Update()
-
- HdnIVAPS.Value = If(drPS("IVA").ToString() = "-1", ViewState("IVA"), drPS("IVA").ToString()).ToString()
- HdnIVARetAPS.Value = drPS("RetIVA").ToString()
- HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString()
- HdnCtaContable.Value = drPS("IdCtaContVentas").ToString()
- HdnAplicaParaConcepto.Value = drPS("AplicaParaConcepto").ToString()
- HdnCodigo.Value = drPS("Codigo").ToString()
- If DdlClasificacion.SelectedIndex = 0 Then
- If drPS("CveClasificacion").ToString() IsNot Nothing Then
- DdlClasificacion.SelectedValueExist(drPS("CveClasificacion").ToString())
+ If IsNumeric(TxtCantidad.Text.Trim) Then
+ LblTotalPS.Text = (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.ToDouble).ToString().FormatoNumero(2)
Else
- Alert("El Productos/Servicio no tiene asignada una Clasificación.", TipoMensaje.MsgInformacion)
+ LblTotalPS.Text = "0.00"
+ End If
+ LblPrecio1.Text = TxtPrecio.Text
+ UPPDescuento.Update()
+
+ HdnIVAPS.Value = If(drPS("IVA").ToString() = "-1", ViewState("IVA"), drPS("IVA").ToString()).ToString()
+ HdnIVARetAPS.Value = drPS("RetIVA").ToString()
+ HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString()
+ HdnCtaContable.Value = drPS("IdCtaContVentas").ToString()
+ HdnAplicaParaConcepto.Value = drPS("AplicaParaConcepto").ToString()
+ HdnCodigo.Value = drPS("Codigo").ToString()
+ If DdlClasificacion.SelectedIndex = 0 Then
+ If drPS("CveClasificacion").ToString() IsNot Nothing Then
+ DdlClasificacion.SelectedValueExist(drPS("CveClasificacion").ToString())
+ Else
+ Alert("El Productos/Servicio no tiene asignada una Clasificación.", TipoMensaje.MsgInformacion)
+ End If
+
End If
End If
- End If
-
- ElseIf CvePSParametro = -2 Then
+ ElseIf CvePSParametro = -2 Then
CargaPS(DdlClasificacion.SelectedValue.ToEntero(), Ddl)
End If
@@ -15668,13 +15686,10 @@ Partial Class Ventas
ObjPS.Dispose()
End Sub
Private Function AgregarProductoServicio(Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String,
- PU As Decimal, Descuento As Decimal,
- CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String,
- Optional Serie As String = "", Optional TiempoEntrega As String = "", 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) As Boolean
+ PU As Decimal, Descuento As Decimal, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, Optional Serie As String = "", Optional TiempoEntrega As String = "",
+ 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) As Boolean
Dim Retorno As Boolean = False
If Not CvePS > 0 Then
@@ -15758,12 +15773,21 @@ Partial Class Ventas
End If
End If
+ 'VERIFICA SI EN LA FACTURA PADRE SE DESGLOSO EL IEPS
+ Dim FacturaDesglosoIEPS As Boolean = ((CveDevolucion > 0 AndAlso NuevaFactura = 1) AndAlso (Me.ObjFacturaNC IsNot Nothing AndAlso Me.ObjFacturaNC.VentaDesglosaIEPS))
+
If Not ClienteDesglosaIEPS Then
- If Not RegeneraIEPS Then
+ If Not RegeneraIEPS AndAlso Not FacturaDesglosoIEPS Then
PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
+ VentaDesglosaIEPS = True
End If
DrPS("IEPSPorcentaje") = 0
End If
+ 'SI YA SE DESGLOSO EL IEPS SE GUARDA LA BANDERA EN ESTA FACTURA
+ If FacturaDesglosoIEPS Then
+ VentaDesglosaIEPS = True
+ End If
+
TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)