This commit is contained in:
JORGE LUIS CAUDILLO ESPARZA
2021-05-03 07:38:58 -07:00
51 changed files with 3664 additions and 733 deletions

View File

@@ -833,7 +833,7 @@ Public Class ClsAcumuladores
#Region "P O L I Z A - V I R T U A L" #Region "P O L I Z A - V I R T U A L"
Public Function AddPolizaVirtual(CveVenta As Integer, CveVentaDetalle As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, Descuento As Decimal, Total As Decimal, Public Function AddPolizaVirtual(CveVenta As Integer, CveVentaDetalle As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, Descuento As Decimal, Total As Decimal,
TipoServicio As Integer, TipoPoliza As Integer, CveModeloAuto As Integer, AnioVehiculo As Integer, TieneUsado As Boolean, FechaUsado As DateTime, TipoServicio As Integer, TipoPoliza As Integer, CveModeloAuto As Integer, AnioVehiculo As Integer, TieneUsado As Boolean, FechaUsado As DateTime,
CvePSUsado As Integer, CveBCIUsado As Integer) As Boolean CvePSUsado As Integer, CveBCIUsado As Integer, CveMarcaUsado As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
SqlDataAdapter("PA_Vta_PolizaVirtualAdd") SqlDataAdapter("PA_Vta_PolizaVirtualAdd")
With SqlAdapter.SelectCommand.Parameters With SqlAdapter.SelectCommand.Parameters
@@ -852,6 +852,7 @@ Public Class ClsAcumuladores
.Add("@FechaUsado", SqlDbType.DateTime).Value = FechaUsado .Add("@FechaUsado", SqlDbType.DateTime).Value = FechaUsado
.Add("@CvePSUsado", SqlDbType.Int).Value = CvePSUsado .Add("@CvePSUsado", SqlDbType.Int).Value = CvePSUsado
.Add("@CveBCIUsado", SqlDbType.Int).Value = CveBCIUsado .Add("@CveBCIUsado", SqlDbType.Int).Value = CveBCIUsado
.Add("@CveMarcaUsado", SqlDbType.Int).Value = CveMarcaUsado
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)

View File

@@ -806,7 +806,13 @@ Public Class ClsCRM
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)
Retorno = True Retorno = True
Catch ex As Exception Catch ex As Exception
OnError("Ocurrió un error al eliminar el Acercamiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) If ex.Message.Contains("CveVenta = ") Then
Dim CveVenta As String = ex.Message
CveVenta = CveVenta.Substring(11, 8)
Alert(String.Format("Este acercamiento esta ligado a una cotización <br/> <b> Cotización: </b> <a href='/Ventas/Ventas.aspx?CveVenta={0}'>{0}</a>", CveVenta), TipoMensaje.MsgAdvertencia)
Else
OnError("Ocurrió un error al eliminar el Acercamiento.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End If
End Try End Try
Return Retorno Return Retorno
End Function End Function

View File

@@ -7282,19 +7282,21 @@ Public Class ClsContPAQi
Return Retorno Return Retorno
End Function End Function
Public Function GetPolizas(Ejercicio As Integer, Periodo As Integer, TipoPoliza As Integer, SegmentoNegocio As Integer) As Boolean Public Function GetPolizas(Ejercicio As Integer, Periodo As Integer, TipoPoliza As Integer, SegmentoNegocio As Integer, Optional CveEmpresa As Integer = -1) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
StrSQL.Clear() StrSQL.Clear()
StrSQL.Append(" SELECT P.Id, P.Fecha, T.Nombre AS TipoPol, P.Concepto, P.Cargos, P.Abonos, P.Folio ") StrSQL.Append(" SELECT P.Id, P.Fecha, T.Nombre AS TipoPol, P.Concepto, P.Cargos, P.Abonos, P.Folio, PP.CvePrepoliza ")
StrSQL.Append(" FROM [dbo].[Polizas] P ") StrSQL.Append(" FROM [dbo].[Polizas] P ")
StrSQL.Append(" LEFT JOIN TiposPolizas T ON T.Id = P.TipoPol ") StrSQL.Append(" LEFT JOIN TiposPolizas T ON T.Id = P.TipoPol ")
StrSQL.Append(" LEFT JOIN MovimientosPoliza M ON M.IdPoliza = P.Id ") StrSQL.Append(" LEFT JOIN MovimientosPoliza M ON M.IdPoliza = P.Id ")
StrSQL.Append(" LEFT JOIN [SERVIDOR].[Ventas].dbo.Conta_PrePolizas PP on P.Id = PP.IdPoliza")
StrSQL.Append(" WHERE P.Ejercicio = @Ejercicio ") StrSQL.Append(" WHERE P.Ejercicio = @Ejercicio ")
StrSQL.Append(" AND P.Periodo = @Periodo ") StrSQL.Append(" AND P.Periodo = @Periodo ")
StrSQL.Append(" AND (@TipoPoliza = -1 OR P.TipoPol = @TipoPoliza) ") StrSQL.Append(" AND (@TipoPoliza = -1 OR P.TipoPol = @TipoPoliza) ")
StrSQL.Append(" AND (@SegmentoNegocio = -1 OR M.IdSegNeg = @SegmentoNegocio) ") StrSQL.Append(" AND (@SegmentoNegocio = -1 OR M.IdSegNeg = @SegmentoNegocio) ")
StrSQL.Append(" GROUP BY P.Id, P.Fecha, T.Nombre, P.Concepto, P.Cargos, P.Abonos, P.Folio ") StrSQL.Append(" AND (PP.CveEmpresa = @CveEmpresa) ")
StrSQL.Append(" GROUP BY P.Id, P.Fecha, T.Nombre, P.Concepto, P.Cargos, P.Abonos, P.Folio, PP.CvePrepoliza ")
StrSQL.Append(" ORDER BY P.Folio ") StrSQL.Append(" ORDER BY P.Folio ")
SqlDataAdapter(StrSQL.ToString, CommandType.Text) SqlDataAdapter(StrSQL.ToString, CommandType.Text)
@@ -7305,6 +7307,8 @@ Public Class ClsContPAQi
.Add("@Periodo", SqlDbType.Int).Value = Periodo .Add("@Periodo", SqlDbType.Int).Value = Periodo
.Add("@TipoPoliza", SqlDbType.Int).Value = TipoPoliza .Add("@TipoPoliza", SqlDbType.Int).Value = TipoPoliza
.Add("@SegmentoNegocio", SqlDbType.Int).Value = SegmentoNegocio .Add("@SegmentoNegocio", SqlDbType.Int).Value = SegmentoNegocio
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With End With
Try Try
SqlAdapter.Fill(Data) SqlAdapter.Fill(Data)

View File

@@ -5726,7 +5726,7 @@ Public Class ClsContabilidad
Public Function AddCuentasAsignaciones(Optional CveConceptoContable As Integer = -1, Optional CveEmpresa As Integer = -1, Optional CveCuenta As Integer = -1, Optional IdCtaContable As Integer = -1, Public Function AddCuentasAsignaciones(Optional CveConceptoContable As Integer = -1, Optional CveEmpresa As Integer = -1, Optional CveCuenta As Integer = -1, Optional IdCtaContable As Integer = -1,
Optional CveProveedor As Integer = -1, Optional CveCliente As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveClasificacion As Integer = -1, Optional CveProveedor As Integer = -1, Optional CveCliente As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveClasificacion As Integer = -1,
Optional CveAlmacen As Integer = -1, Optional PorcentajeIVA As Decimal = -1, Optional CveConceptoNomina As Decimal = -1) As Boolean Optional CveAlmacen As Integer = -1, Optional PorcentajeIVA As Decimal = -1, Optional CveConceptoNomina As Decimal = -1, Optional CveBancoCuenta As Integer = -1) As Boolean
Dim Retorno = False Dim Retorno = False
DataAdapter("PA_Conta_CuentasAsignacionesAdd") DataAdapter("PA_Conta_CuentasAsignacionesAdd")
@@ -5743,6 +5743,7 @@ Public Class ClsContabilidad
.Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen
.Add("@PorcentajeIVA", SqlDbType.Decimal).Value = PorcentajeIVA .Add("@PorcentajeIVA", SqlDbType.Decimal).Value = PorcentajeIVA
.Add("@CveConceptoNomina", SqlDbType.Decimal).Value = CveConceptoNomina .Add("@CveConceptoNomina", SqlDbType.Decimal).Value = CveConceptoNomina
.Add("@CveBancoCuenta", SqlDbType.Int).Value = CveBancoCuenta
End With End With
Try Try
@@ -5777,7 +5778,7 @@ Public Class ClsContabilidad
Public Function UpdateCuentasAsignaciones(CveConceptoAsignacion As Integer, Optional CveConceptoContable As Integer = -1, Optional CveCuenta As Integer = -1, Public Function UpdateCuentasAsignaciones(CveConceptoAsignacion As Integer, Optional CveConceptoContable As Integer = -1, Optional CveCuenta As Integer = -1,
Optional IdCtaContable As Integer = -1, Optional CveProveedor As Integer = -1, Optional CveCliente As Integer = -1, Optional IdCtaContable As Integer = -1, Optional CveProveedor As Integer = -1, Optional CveCliente As Integer = -1,
Optional CvePersonal As Integer = -1, Optional CveClasificacion As Integer = -1, Optional CveAlmacen As Integer = -1, Optional CvePersonal As Integer = -1, Optional CveClasificacion As Integer = -1, Optional CveAlmacen As Integer = -1,
Optional PorcentajeIVA As Decimal = -1, Optional CveConceptoNomina As Decimal = -1) As Boolean Optional PorcentajeIVA As Decimal = -1, Optional CveConceptoNomina As Decimal = -1, Optional CveBancoCuenta As Integer = -1) As Boolean
Dim Retorno = False Dim Retorno = False
DataAdapter("PA_Conta_CuentasAsignacionesUpdate") DataAdapter("PA_Conta_CuentasAsignacionesUpdate")
@@ -5794,6 +5795,7 @@ Public Class ClsContabilidad
.Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen .Add("@CveAlmacen", SqlDbType.Int).Value = CveAlmacen
.Add("@PorcentajeIVA", SqlDbType.Decimal).Value = PorcentajeIVA .Add("@PorcentajeIVA", SqlDbType.Decimal).Value = PorcentajeIVA
.Add("@CveConceptoNomina", SqlDbType.Decimal).Value = CveConceptoNomina .Add("@CveConceptoNomina", SqlDbType.Decimal).Value = CveConceptoNomina
.Add("@CveBancoCuenta", SqlDbType.Int).Value = CveBancoCuenta
End With End With
Try Try

View File

@@ -3232,6 +3232,32 @@ Public Class ClsInventarios
Return Retorno Return Retorno
End Function End Function
Public Function GetProductosDevolucion(CvePS As Integer, CveCliente As Integer, CveSubProyecto As Integer, FechaInicio As DateTime, FechaFin As DateTime, Serie As String, Lote As String, FechaCaducidad As DateTime, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Vta_ProductosDevolucionAlmacen")
With SqlAdapter.SelectCommand.Parameters
.Add("@CvePS", SqlDbType.Int).Value = CvePS
.Add("@CveCliente", SqlDbType.Int).Value = CveCliente
.Add("@CveSubProyecto", SqlDbType.Int).Value = CvePS
.Add("@FechaInicio", SqlDbType.DateTime).Value = FechaInicio
.Add("@FechaFin", SqlDbType.DateTime).Value = FechaFin
.Add("@Serie", SqlDbType.VarChar).Value = Serie
.Add("@Lote", SqlDbType.VarChar).Value = Lote
.Add("@FechaCaducidad", SqlDbType.DateTime).Value = FechaCaducidad
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener datos de devolución.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
End Try
Return Retorno
End Function
Public Function GetSaldoVentaDetalle(CveVenta As Integer, CveEmpresa As Integer) As Boolean Public Function GetSaldoVentaDetalle(CveVenta As Integer, CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False Dim Retorno As Boolean = False
DataAdapter("PA_Vta_VentaDetalleSaldo") DataAdapter("PA_Vta_VentaDetalleSaldo")

View File

@@ -4681,6 +4681,7 @@ Public Class ClsPaginas
PaginaDict.Add("/Inventarios/EntregasPorRealizar.aspx".ToUpper(), 728) PaginaDict.Add("/Inventarios/EntregasPorRealizar.aspx".ToUpper(), 728)
PaginaDict.Add("/Inventarios/CatAlmacenClasificacionSecciones.aspx".ToUpper(), 764) PaginaDict.Add("/Inventarios/CatAlmacenClasificacionSecciones.aspx".ToUpper(), 764)
PaginaDict.Add("/Inventarios/ReconstruirCostos.aspx".ToUpper(), 764) PaginaDict.Add("/Inventarios/ReconstruirCostos.aspx".ToUpper(), 764)
PaginaDict.Add("/Inventarios/RecepcionDevolucion.aspx".ToUpper(), 696)
#End Region #End Region
@@ -6150,7 +6151,8 @@ Public Class ClsPaginas
params.Add(New CrystalParametro("ClienteTelefono", Vta.ClienteSucursal.TelefonoSucursal)) params.Add(New CrystalParametro("ClienteTelefono", Vta.ClienteSucursal.TelefonoSucursal))
Else Else
params.Add(New CrystalParametro("ClienteContactoMail", Vta.Cliente.MailCotizacion)) params.Add(New CrystalParametro("ClienteContactoMail", Vta.Cliente.MailCotizacion))
params.Add(New CrystalParametro("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.RFC = "XAXX010101000", Vta.TelefonoGenerico, Vta.Cliente.Telefono))) params.Add(New CrystalParametro("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.Telefono.Length > 6, Vta.TelefonoGenerico, Vta.Cliente.Telefono)))
End If End If
If UsuarioActual.CveEmpresa.Contiene(17) Then If UsuarioActual.CveEmpresa.Contiene(17) Then

View File

@@ -1450,6 +1450,22 @@ Public Class ClsProductosServicios
Return Retorno Return Retorno
End Function End Function
Public Function GetMarcasUsados(CveEmpresa As Integer) As Boolean
Dim Retorno As Boolean = False
DataAdapter("PA_Gral_MarcasUsadosGet")
With SqlAdapter.SelectCommand.Parameters
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
End With
Try
SqlAdapter.Fill(Data)
Retorno = True
Catch ex As Exception
OnError("Ocurrió un error al obtener el Catálogo de Marcas.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo())
End Try
Return Retorno
End Function
Public Function AddMarcas(Marca As String, Estatus As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Boolean Public Function AddMarcas(Marca As String, Estatus As Boolean, CveUsuario As Integer, CveEmpresa As Integer) As Boolean

View File

@@ -1507,10 +1507,17 @@ Namespace Modelos
Row("CveVentaDetalle") = ObjVentas.CveVentaDetalle Row("CveVentaDetalle") = ObjVentas.CveVentaDetalle
If DtInventario IsNot Nothing Then If DtInventario IsNot Nothing Then
If DtInventario.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then 'If DtInventario.Select($"CvePS={Row("CvePS").ToString.ToEntero}").Length > 0 Then
Dim rowInv As DataRow = DtInventario.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0) ' Dim rowInv As DataRow = DtInventario.Select($"CvePS={Row("CvePS").ToString.ToEntero}")(0)
rowInv("CveVentaDetalle") = ObjVentas.CveVentaDetalle ' rowInv("CveVentaDetalle") = ObjVentas.CveVentaDetalle
End If 'End If
Try
Dim InvDr As DataRow = DtInventario.Select($"Consec = {Row("Consec").ToString()}")(0)
InvDr("CveVentaDetalle") = ObjVentas.CveVentaDetalle
Catch ex As Exception
End Try
End If End If
If DtRecepcionUsados IsNot Nothing Then If DtRecepcionUsados IsNot Nothing Then
@@ -1738,7 +1745,7 @@ Namespace Modelos
GuardarVentaPrePolizas(factura, ObjConta, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, ObjInventario:=ObjInventario) GuardarVentaPrePolizas(factura, ObjConta, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, ObjInventario:=ObjInventario)
If ErrorList.Count = 0 Then If ErrorList.Count = 0 Then
'inventarios 'inventarios
GuardarVentaInventarios(factura, ObjInventario, ObjConta, ObjVentas, ObjAcum) GuardarVentaInventarios(Resp, factura, ObjInventario, ObjConta, ObjVentas, ObjAcum)
'GuardaRecepcionUsados(factura, ObjInventario, ObjConta) 'GuardaRecepcionUsados(factura, ObjInventario, ObjConta)
@@ -2142,7 +2149,7 @@ Namespace Modelos
For Each drow As DataRow In ObjFactura.DtPolizasVirtuales.Rows For Each drow As DataRow In ObjFactura.DtPolizasVirtuales.Rows
If ObjAcum.AddPolizaVirtual(ObjFactura.CveVenta, drow("CveVentaDetalle").ToString().ToEntero(), drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("Descuento").ToString.ToDecimal, If ObjAcum.AddPolizaVirtual(ObjFactura.CveVenta, drow("CveVentaDetalle").ToString().ToEntero(), drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("Descuento").ToString.ToDecimal,
drow("Total").ToString.ToDecimal, drow("TipoServicio").ToString.ToEntero, drow("TipoPoliza").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero, drow("AnioVehiculo").ToString.ToEntero, CBool(drow("TieneUsado").ToString), drow("Total").ToString.ToDecimal, drow("TipoServicio").ToString.ToEntero, drow("TipoPoliza").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero, drow("AnioVehiculo").ToString.ToEntero, CBool(drow("TieneUsado").ToString),
drow("FechaUsado").ToString().ToDateTime, drow("CvePSUsado").ToString.ToEntero, drow("CveBCIUsado").ToString.ToEntero) Then drow("FechaUsado").ToString().ToDateTime, drow("CvePSUsado").ToString.ToEntero, drow("CveBCIUsado").ToString.ToEntero, drow("CveMarcaUsado").ToString.ToEntero) Then
Else Else
Resultado = False Resultado = False
Exit For Exit For
@@ -3709,7 +3716,7 @@ Namespace Modelos
Return OcurrioError Return OcurrioError
End Function End Function
Private Function GuardarVentaInventarios(ByRef factura As Modelos.Factura, ObjInventario As ClsInventarios, ObjConta As ClsContabilidad, ObjVentas As ClsVentas, ObjAcum As ClsAcumuladores) As Boolean Private Function GuardarVentaInventarios(ByRef Resp As MMensajeFactura, ByRef factura As Modelos.Factura, ObjInventario As ClsInventarios, ObjConta As ClsContabilidad, ObjVentas As ClsVentas, ObjAcum As ClsAcumuladores) As Boolean
Dim OcurrioError As Boolean = False Dim OcurrioError As Boolean = False
If UsuarioActual.Empresa.UsaInventarios AndAlso factura.TipoDocto.Contiene("Ing", "Egs", "Rem") Then If UsuarioActual.Empresa.UsaInventarios AndAlso factura.TipoDocto.Contiene("Ing", "Egs", "Rem") Then
@@ -3751,6 +3758,24 @@ Namespace Modelos
End If End If
'SI ES UNA RNC DE CARGO GENERA EL MOVIMIENTO DE ALMACEN AQUI
If factura.TipoDocto = "RNC" AndAlso factura.Num3 = 10 Then
Dim CveMovimiento = GenerarMovimientoAlmacenDevolucionRNC(ObjInventario, factura, DtInventario, factura.CveAlmacen, factura.CveConceptoMovimiento, factura.CveMoneda, factura.CveVenta, "Modelos/RNC1")
If CveMovimiento <= 0 Then
OcurrioError = True
Else
If Resp IsNot Nothing Then
Resp.CveMovimientoUsado = CveMovimiento
If CveMovimiento > 0 Then
If ObjInventario.GetMovimientos(CveMovimiento, -1, -1, UsuarioActual.CveEmpresa) Then
Resp.FolioUsado = ObjInventario.DtResultados.FiltroPrimeroValor("Folio")
End If
End If
End If
End If
End If
Return OcurrioError Return OcurrioError
End Function End Function
Private Function CuadrarFacturaMovimientos(MovDetalle As DataTable) As DataTable Private Function CuadrarFacturaMovimientos(MovDetalle As DataTable) As DataTable
@@ -4158,6 +4183,148 @@ Namespace Modelos
Return CveMovimientoInventario Return CveMovimientoInventario
End Function End Function
Private Function GenerarMovimientoAlmacenDevolucionRNC(ByRef ObjInventario As ClsInventarios, ByRef factura As Modelos.Factura, DtInventario As DataTable, CveAlmacen As Integer, CveConcepto As Integer, CveMoneda As Integer, CveVenta As Integer, Modulo As String, Optional MovimientoPrePoliza As Boolean = False, Optional ByRef ObjConta As ClsContabilidad = Nothing, Optional CveMovimientoRelacionado As Integer = -1) As Integer
Dim OcurrioError As Boolean = False
Dim CveMovimientoInventario As Integer = ObjInventario.AddMovimiento(CveAlmacen, CveConcepto, factura.CveMoneda, factura.Fecha, -1, factura.CveUsuario, factura.CveEmpresa, -1, factura.CveVenta, -1, -1, Modulo:=Modulo, CveMovimientoRelacionado:=CveMovimientoRelacionado)
If CveMovimientoInventario <= 0 Then
OcurrioError = True
ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Else
If CveMovimientoRelacionado > 0 Then
If ObjInventario.GetMovimientosDetalle(CveMovimientoRelacionado, UsuarioActual.CveEmpresa) Then
For Each Dr As DataRow In ObjInventario.DtResultados.Rows
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Dr("Cantidad").ToString().ToDouble, Dr("CveUM").ToString().ToEntero(), Dr("CvePS").ToString().ToEntero(), Dr("PU").ToString().ToDecimal, CveAF:=Dr("CveAF").ToString().ToEntero(), Serie:=Dr("Serie").ToString(), CveMovimientoDetalleEntrada:=Dr("CveMovimientoDetalle").ToString().ToEntero(), CveVentaDetalle:=Dr("CveVentaDetalle").ToString().ToEntero(), FechaCaducidad:=If(CBool(Dr("AplicaCaducidad")), Dr("FechaCaducidad").ToString().ToDate, MinFecha), Lote:=If(CBool(Dr("AplicaLote")), Dr("Lote").ToString(), "-1"), CveSeccionAlmacen:=-3) Then
OcurrioError = True
ErrorList.Add("Ocurrió un Error al guardar los movimientos de entrada")
Exit For
End If
Next
End If
Else
Dim Mensaje As String = ""
Dim i As Integer = 0
Dim Cantidad As Decimal = 0
Dim PU As Decimal = 0
Dim CveUM As Integer = 0
Dim CvePS As Integer = 0
Dim AplicaSerie As Boolean
Dim AplicaLote As Boolean
Dim AplicaCaducidad As Boolean
Dim Serie As String = ""
Dim Lote As String = ""
Dim FechaCaducidad As DateTime = MinFecha
For Each Dr As DataRow In DtInventario.Rows
CvePS = Dr("CvePS").ToString.ToEntero
CveUM = Dr("CveUM").ToString.ToEntero
Cantidad = Dr("Cantidad").ToString.ToDecimal
PU = Dr("PU").ToString.ToDecimal
AplicaSerie = CBool(Dr("AplicaSerie"))
Serie = If(AplicaSerie, Dr("Serie").ToString, "")
AplicaLote = CBool(Dr("AplicaLote"))
Lote = If(AplicaLote, Dr("Lote").ToString, "")
AplicaCaducidad = CBool(Dr("AplicaCaducidad"))
FechaCaducidad = If(AplicaCaducidad, Dr("FechaCaducidad").ToString.ToDateTime, MinFecha)
If Dr("CveTipoInvPS").ToString.ToEntero = 5 AndAlso AplicaSerie AndAlso Serie = "" Then
OcurrioError = True
ErrorList.Add("Se deben especificar las Series de los productos de almacén")
Exit For
End If
If CvePS > 0 Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimientoInventario, Cantidad, CveUM, CvePS, PU, CveSeccionAlmacen:=-3, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad, CveVentaDetalle:=Dr("CveVentaDetalle").ToString.ToEntero) Then
OcurrioError = True
ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.<br />")
Exit For
End If
Else
OcurrioError = True
ErrorList.Add("Ocurrió un error al agregar los Movimientos de salida al Inventario.<br />")
Exit For
End If
i = i + 1
Next
End If
'REGISTRO LA PREPOLIZA DE COSTO VS ALMACEN
If MovimientoPrePoliza AndAlso Not OcurrioError Then
Dim DtCostos As DataTable = Nothing
Dim ValorInventario As Decimal = 0
Dim TotalCosto As Decimal = 0
Dim TipoMovto68 As Boolean = True
Dim TipoMovto69 As Boolean = False
If CveConcepto.Contiene(18, 41) Then
TipoMovto68 = False
TipoMovto69 = True
End If
If ObjInventario.GetMovimientosDetalle(CveMovimientoInventario, UsuarioActual.CveEmpresa) Then
DtCostos = ObjInventario.DtResultados
TotalCosto = DtCostos.SUMD("Total").RoundSQL
Dim tmpCostos As DataTable = DtCostos.FiltraParametros("", "", {"CveClasificacion"})
Dim IdCtaContable As Integer = 0
Dim CveCuenta As Integer = 0
If tmpCostos.Rows.Count > 0 Then
Dim TotalCostoAcumulado As Decimal = 0
Dim cont As Integer = 1
'Se agrega movimiento separado por la cuenta de ventas (ER)
For Each RowInv As DataRow In tmpCostos.Rows
ValorInventario = DtCostos.SUMD("Total", $"CveClasificacion = {RowInv("CveClasificacion")}").RoundSQL
TotalCostoAcumulado += ValorInventario
'cuando es el último movimiento y hay diferencias en los importes
If cont = tmpCostos.Rows.Count AndAlso TotalCosto <> TotalCostoAcumulado Then
ValorInventario = ValorInventario + (TotalCosto - TotalCostoAcumulado)
End If
'Concepto = String.Format("{0} - {1}", Row2("Clasificacion").ToString(), Row2("SubProyecto").ToString())
IdCtaContable = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaCostos", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
'CveCuenta = GlobalDTClasificaciones(factura.CveEmpresa).FiltroPrimeroValor("IdCuentaGastoSIG", $"CveClasificacion = {RowInv("CveClasificacion")}").ToEntero()
'If ValorInventario <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto69, ValorInventario, factura.SerieFolio, 69, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveSubProyecto:=factura.CveSubProyecto, CveClasificacion:=RowInv("CveClasificacion").ToString().ToEntero(), CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=ValorInventario, CveCuenta:=CveCuenta) Then
OcurrioError = True
End If
'End If
cont += 1
Next
End If
IdCtaContable = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltroPrimeroValor("IdCtaContable", String.Format("CveAlmacen = {0}", CveAlmacen)).ToEntero()
'If TotalCosto <> 0 Then
If Not ObjConta.AddPrePolizasDetalle(factura.CvePrePoliza, TipoMovto68, TotalCosto, factura.SerieFolio, 68, factura.SerieFolio, factura.Fecha, IdCtaContable, -1, CveVenta:=factura.CveVenta, CveCliente:=factura.CveCliente, CveMovimientoAlmacen:=CveMovimientoInventario, ImporteMX:=TotalCosto, CveCuenta:=CveCuenta, CveSubProyecto:=factura.CveSubProyecto) Then
OcurrioError = True
End If
'End If
Else
OcurrioError = True
End If
factura.Inv_CveMovimiento = CveMovimientoInventario
factura.Inv_ValorInventario = ValorInventario
End If
End If
Return CveMovimientoInventario
End Function
Private Sub GuardarVentaEstimaciones(ByRef factura As Modelos.Factura, ObjContr As ClsContratos) Private Sub GuardarVentaEstimaciones(ByRef factura As Modelos.Factura, ObjContr As ClsContratos)
'debe de ser por contrato el movimiento 'debe de ser por contrato el movimiento
If factura.CveContratoSecciones.Length > 0 Then If factura.CveContratoSecciones.Length > 0 Then

View File

@@ -256,30 +256,89 @@
function FnSuma(chk, cantidad) { function FnSuma(chk, cantidad) {
var saldoInicial = ToDouble($('#C_lblValorTotal').text()); var saldoInicial = ToDouble($('#C_lblValorTotal').text());
var ValorTotalSeleccionado2 = 0;
$('#C_GvFacturas input[type=checkbox]').each(
function () {
if (this.checked) {
ValorTotalSeleccionado2 = ValorTotalSeleccionado2 + ToDouble(FormatoNumero($(this).val(), 2));
}
}
);
ValorTotalSeleccionado = ValorTotalSeleccionado2;
if (chk.checked == false) { if (chk.checked == false) {
cantidad = cantidad * -1; cantidad = cantidad * -1;
} }
saldoInicial = saldoInicial + cantidad; saldoInicial = saldoInicial + cantidad;
$('#C_lblValorTotal').text(FormatoNumero(saldoInicial, 2)); $('#C_lblValorTotal').text(FormatoNumero(saldoInicial, 2));
$('#C_lblValorTotalSeleccionado').text(FormatoNumero(saldoInicial, 2)); $('#C_lblValorTotalSeleccionado').text(FormatoNumero(ValorTotalSeleccionado, 2));
ValorTotalSeleccionado = saldoInicial debugger;
if ($('#C_ChkFaltante').attr('checked')) {
var txtcomision = ToDouble($('#C_TxtComision').val());
if (txtcomision != 0) {
var comisionNegativa = 0;
if (txtcomision < 0) {
comisionNegativa = txtcomision * -1;
}
if (comisionNegativa > saldo) {
$('#C_TxtComision').val(0);
comision = 0;
descuento = 0;
txtcomision = 0;
alert("No es posible poner un importe Faltante/Sobrante superior a lo seleccionado");
saldo = 0;
$('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2));
debugger;
} else {
//debugger;
}
}
}
if ($('#C_ChkDescuento').attr('checked')) {
var txtdescuento = ToDouble($('#C_TxtDescuento').val());
if (txtdescuento != 0) {
var DescuentoNegativa = 0;
if (txtdescuento < 0) {
DescuentoNegativa = txtdescuento * -1;
}
if (DescuentoNegativa > saldo) {
$('#C_TxtDescuento').val(0);
comision = 0;
descuento = 0;
txtdescuento = 0;
alert("No es posible poner un descuento superior a lo seleccionado");
saldo = 0;
$('#C_lblValorTotal').text(FormatoNumero(ValorTotalSeleccionado, 2));
debugger;
} else {
//saldo = ValorTotalSeleccionado + txtdescuento + comision;
//$('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
//descuento = ToDouble($('#C_TxtDescuento').val())
//debugger;
}
}
}
} }
function txtSuma(txt) { function txtSuma(txt) {
var comision2 = ToDouble($('#C_TxtComision').val()); var comision2 = ToDouble($('#C_TxtComision').val());
var comisionNegativa = 0; var comisionNegativa = 0;
if (comision2 < 0) { if (comision2 < 0) {
comisionNegativa = comision2 * -1 comisionNegativa = comision2 * -1;
} }
if (comisionNegativa > ValorTotalSeleccionado) { if (comisionNegativa > ValorTotalSeleccionado) {
$('#C_TxtComision').val(comision) $('#C_TxtComision').val(0)
alert("No es posible poner una comision superior a lo seleccionado") alert("No es posible poner una comision superior a lo seleccionado")
} else { } else {
saldo = ValorTotalSeleccionado + comision2 + descuento; saldo = ValorTotalSeleccionado + comision2 + descuento;
$('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); $('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
comision = ToDouble($('#C_TxtComision').val()) comision = ToDouble($('#C_TxtComision').val())
debugger;
} }
} }
@@ -288,7 +347,7 @@
var comision2 = ToDouble($('#C_TxtDescuento').val()); var comision2 = ToDouble($('#C_TxtDescuento').val());
var comisionNegativa = 0; var comisionNegativa = 0;
if (comision2 < 0) { if (comision2 < 0) {
comisionNegativa = comision2 * -1 comisionNegativa = comision2 * -1;
} }
if (comisionNegativa > ValorTotalSeleccionado) { if (comisionNegativa > ValorTotalSeleccionado) {
$('#C_TxtDescuento').val(descuento) $('#C_TxtDescuento').val(descuento)
@@ -297,7 +356,6 @@
saldo = ValorTotalSeleccionado + comision2 + comision; saldo = ValorTotalSeleccionado + comision2 + comision;
$('#C_lblValorTotal').text(FormatoNumero(saldo, 2)); $('#C_lblValorTotal').text(FormatoNumero(saldo, 2));
descuento = ToDouble($('#C_TxtDescuento').val()) descuento = ToDouble($('#C_TxtDescuento').val())
debugger;
} }
} }
@@ -311,7 +369,7 @@
$('#divClasificacion').css("display", "block"); $('#divClasificacion').css("display", "block");
} else { } else {
$('#DivComision').css("display", "none"); $('#DivComision').css("display", "none");
$('#divSubProyecto').css("display", "none"); $('#LblSubproyecto').css("display", "none");
$('#divSubProyecto').css("display", "none"); $('#divSubProyecto').css("display", "none");
$('#LblClasificacion').css("display", "none"); $('#LblClasificacion').css("display", "none");
$('#divClasificacion').css("display", "none"); $('#divClasificacion').css("display", "none");

View File

@@ -148,11 +148,11 @@ Partial Class Bancos_DepositosCaja
NuevaCvePrePoliza = ObjContabilidad.AddPrePolizas("Vta", 13, TotalImportePrePoliza, TotalImportePrePoliza, CveMoneda, Fecha, "Depósito Bancario", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) NuevaCvePrePoliza = ObjContabilidad.AddPrePolizas("Vta", 13, TotalImportePrePoliza, TotalImportePrePoliza, CveMoneda, Fecha, "Depósito Bancario", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
'Entrada a bancos 'Entrada a bancos
FolioIE = ObjBancos.GetNextFolio(DdlCuentaDeposito.SelectedValue.ToEntero, 8) FolioIE = ObjBancos.GetNextFolio(DdlCuentaDeposito.SelectedValue.ToEntero, 13)
If Not FolioIE > 0 Then If Not FolioIE > 0 Then
OcurrioError = True OcurrioError = True
End If End If
CveIEOrigen = ObjBancos.AddBancos_IE(DdlCuentaDeposito.SelectedValue.ToEntero, 8, Fecha, FolioIE.ToString, "Depósito Bancario", TotalImporte, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) CveIEOrigen = ObjBancos.AddBancos_IE(DdlCuentaDeposito.SelectedValue.ToEntero, 13, Fecha, FolioIE.ToString, "Depósito Bancario", TotalImporte, CveMoneda, 1, "Depósito Bancario", "", False, False, -1, NuevaCvePrePoliza, "-1", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
documentos += String.Format("<a href='/Bancos/IE.aspx?CveIE={0}' target='_blank' class='Texto'>Depósito: {1}</a> &nbsp &nbsp <br/> ", CveIEOrigen, FolioIE) documentos += String.Format("<a href='/Bancos/IE.aspx?CveIE={0}' target='_blank' class='Texto'>Depósito: {1}</a> &nbsp &nbsp <br/> ", CveIEOrigen, FolioIE)
@@ -253,6 +253,8 @@ Partial Class Bancos_DepositosCaja
Protected Sub GvFacturas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvFacturas.RowDataBound Protected Sub GvFacturas_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvFacturas.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCCheckBox("ChkFactura").Attributes.Add("onclick", String.Format("FnSuma(this,{0});", e.Row.DBCampo("Importe"))) e.Row.FCCheckBox("ChkFactura").Attributes.Add("onclick", String.Format("FnSuma(this,{0});", e.Row.DBCampo("Importe")))
e.Row.FCCheckBox("ChkFactura").InputAttributes.Add("Value", e.Row.DBCampo("Importe"))
End If End If
End Sub End Sub

View File

@@ -30,6 +30,9 @@
<li> <li>
<asp:HyperLink ID="HLModalActualizarTC" NavigateUrl="#" runat="server" Visible="false" data-toggle="modal" data-target="#ModalActualizarTC" Style="color: #686868;"><i class="fa fa-usd" style="color:#686868;"></i> Actualizar Tipo Cambio</asp:HyperLink> <asp:HyperLink ID="HLModalActualizarTC" NavigateUrl="#" runat="server" Visible="false" data-toggle="modal" data-target="#ModalActualizarTC" Style="color: #686868;"><i class="fa fa-usd" style="color:#686868;"></i> Actualizar Tipo Cambio</asp:HyperLink>
</li> </li>
<li>
<asp:HyperLink ID="HpLPrePoliza" NavigateUrl="#" runat="server" Visible="false" Style="color: #686868;"><i class="" style="color:#686868;"></i> PrePoliza</asp:HyperLink>
</li>
<%-- <li> <%-- <li>
<asp:LinkButton ID="LnkEmitirComplemento" runat="server" Style="color: #686868;" Visible="false"><i class="fa fa-file-text-o" style="color:#686868;"></i> Emitir Complemento de Pago</asp:LinkButton> <asp:LinkButton ID="LnkEmitirComplemento" runat="server" Style="color: #686868;" Visible="false"><i class="fa fa-file-text-o" style="color:#686868;"></i> Emitir Complemento de Pago</asp:LinkButton>

View File

@@ -863,6 +863,8 @@ Partial Class Bancos_IE
LblCuenta.Text = ObjIE.BancoNumCuentaMoneda LblCuenta.Text = ObjIE.BancoNumCuentaMoneda
ViewState("CvePrePoliza") = ObjIE.DtResultados.Rows(0)("CvePrePoliza").ToString.ToEntero ViewState("CvePrePoliza") = ObjIE.DtResultados.Rows(0)("CvePrePoliza").ToString.ToEntero
HpLPrePoliza.NavigateUrl = String.Format("/Contabilidad/RegPrePoliza.aspx?CvePrepoliza={0}", ViewState("CvePrePoliza"))
HpLPrePoliza.Visible = True
TxtFechaDocumento.Text = ObjIE.FechaDocumento.ToShortDateString TxtFechaDocumento.Text = ObjIE.FechaDocumento.ToShortDateString
TxtFolio.Text = ObjIE.Folio TxtFolio.Text = ObjIE.Folio
LblBeneficiario.Text = ObjIE.PagueseA LblBeneficiario.Text = ObjIE.PagueseA

View File

@@ -51,7 +51,7 @@
<asp:LinkButton ID="imgCalendario" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton> <asp:LinkButton ID="imgCalendario" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span> </span>
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender> <ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="txtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="txtFechaI" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender> <ajax:CalendarExtender runat="server" ID="Calendario" TargetControlID="txtFechaI" PopupButtonID="ImgCalendario" PopupPosition="BottomLeft" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator> <asp:RequiredFieldValidator ID="rfvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="Valida"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator> <asp:CompareValidator ID="cvFechaI" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Valida"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="vcoFfvFI" runat="server" HighlightCssClass="vco" TargetControlID="rfvFechaI" Width="350px"></ajax:ValidatorCalloutExtender>

View File

@@ -48,8 +48,9 @@ Partial Class Bancos_RepCobradoPagadoDetalle
' GvDatos.Columns(5).HeaderText = "Cobrado" ' GvDatos.Columns(5).HeaderText = "Cobrado"
' End If ' End If
'End If 'End If
If Modalidad <> 0 Then
CargaDatos() CargaDatos()
End If
End Sub End Sub
#End Region #End Region

View File

@@ -176,59 +176,62 @@ public partial class CRM_CatEmpresasCRM : ClsPaginas
string Correo = row["Correo"].ToString(); string Correo = row["Correo"].ToString();
int CveMedioCaptacion = -1; int CveMedioCaptacion = -1;
if (ObjCRM.GetMedioCaptacion(UsuarioActual.CveEmpresa)) if (MedioCaptacion != "" || Agente != "") {
{
DataRow MediosCaptacion = ObjCRM.DtResultados.FiltroPrimero(String.Format("MedioCaptacion = '{0}'",MedioCaptacion)); if (ObjCRM.GetMedioCaptacion(UsuarioActual.CveEmpresa))
if(MediosCaptacion != null)
{ {
CveMedioCaptacion = MediosCaptacion["CveMedioCaptacion"].ToString().ToEntero(); DataRow MediosCaptacion = ObjCRM.DtResultados.FiltroPrimero(String.Format("MedioCaptacion = '{0}'",MedioCaptacion));
if(MediosCaptacion != null)
{
CveMedioCaptacion = MediosCaptacion["CveMedioCaptacion"].ToString().ToEntero();
}else
{
Alert(String.Format("El medio de captación '{0}' no fue encontrado", MedioCaptacion), ModExtensiones.TipoMensaje.MsgAdvertencia);
TieneError = true;
break;
}
}
int CveVendedor = -1;
DataRow Vendedor = get_GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("Vendedor = '{0}'",Agente));
if (Vendedor != null)
{
CveVendedor = Vendedor["CveVendedor"].ToString().ToEntero();
}else }else
{ {
Alert(String.Format("El medio de captación '{0}' no fue encontrado", MedioCaptacion), ModExtensiones.TipoMensaje.MsgAdvertencia); Alert(String.Format("El vendedor '{0}' no fue encontrado", Agente), ModExtensiones.TipoMensaje.MsgAdvertencia);
TieneError = true; TieneError = true;
break; break;
} }
}
int CveVendedor = -1; int CveSubProyecto = -1;
DataRow Vendedor = get_GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("Vendedor = '{0}'",Agente)); DataRow SubProyecto = get_GlobalDTSubProyectos(-1,CveEmpresa:UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("SubProyecto = '{0}'",Sucursal));
if (Vendedor != null) if(SubProyecto != null)
{ {
CveVendedor = Vendedor["CveVendedor"].ToString().ToEntero(); CveSubProyecto = SubProyecto["CveSubProyecto"].ToString().ToEntero();
}else }else
{ {
Alert(String.Format("El vendedor '{0}' no fue encontrado", MedioCaptacion), ModExtensiones.TipoMensaje.MsgAdvertencia); Alert(String.Format("El SubProyecto '{0}'", Sucursal), ModExtensiones.TipoMensaje.MsgAdvertencia);
TieneError = true; TieneError = true;
break; break;
} }
int CveSubProyecto = -1; int CveGiro = -1;
DataRow SubProyecto = get_GlobalDTSubProyectos(-1,CveEmpresa:UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("SubProyecto = '{0}'",Sucursal)); DataRow GiroDt = get_GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("ClienteClasificacion = '{0}'", Giro));
if(SubProyecto != null) if (GiroDt != null)
{ {
CveSubProyecto = SubProyecto["CveSubProyecto"].ToString().ToEntero(); CveGiro = GiroDt["CveClienteClasificacion"].ToString().ToEntero();
}else }
{ else
Alert(String.Format("El SubProyecto '{0}'", Sucursal), ModExtensiones.TipoMensaje.MsgAdvertencia); {
TieneError = true; Alert(String.Format("El Giro de Empresa '{0}', No está especificado", Giro), ModExtensiones.TipoMensaje.MsgAdvertencia);
break; TieneError = true;
} break;
}
int CveGiro = -1; TieneError = (!(ObjCRM.AddEmpresaCRM(NombreEmpresa, RFC, CveMedioCaptacion, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, -1, CveVendedor, CveSubProyecto, Mail, CveGiro) > 0));
DataRow GiroDt = get_GlobalDTClienteClasificaciones(UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("ClienteClasificacion = '{0}'", Giro));
if (GiroDt != null)
{
CveGiro = GiroDt["CveClienteClasificacion"].ToString().ToEntero();
}
else
{
Alert(String.Format("El Giro de Empresa '{0}', No está especificado", Giro), ModExtensiones.TipoMensaje.MsgAdvertencia);
TieneError = true;
break;
}
TieneError = (!(ObjCRM.AddEmpresaCRM(NombreEmpresa, RFC, CveMedioCaptacion, UsuarioActual.CveEmpresa, UsuarioActual.CveUsuario, -1, CveVendedor, CveSubProyecto, Mail, CveGiro) > 0));
}
} }
if (TieneError) if (TieneError)

View File

@@ -88,8 +88,8 @@
</div> </div>
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoPrceso2" runat="server" Width="50%" DataTextField="TipoProceso" DataValueField="CveTipoProceso" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-sm select2me" OnSelectedIndexChanged="DdlTipoProcesos_Change" AutoPostBack="true"/> <asp:DropDownList ID="DdlTipoProceso2" runat="server" Width="50%" DataTextField="TipoProceso" DataValueField="CveTipoProceso" AppendDataBoundItems="true" Class="table-group-action-input form-control input-inline input-sm select2me" OnSelectedIndexChanged="DdlTipoProcesos_Change" AutoPostBack="true"/>
<label for="<%=DdlTipoPrceso2.ClientID.ToString()%>">Tipo Proceso:</label> <label for="<%=DdlTipoProceso2.ClientID.ToString()%>">Tipo Proceso:</label>
</div> </div>
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">

View File

@@ -571,10 +571,10 @@ public partial class CRM_EmpresaCRM : ClsPaginas
ClsCRM ObjCRM = new ClsCRM(); ClsCRM ObjCRM = new ClsCRM();
if (ObjCRM.GetTipoProceso(UsuarioActual.CveEmpresa)) if (ObjCRM.GetTipoProceso(UsuarioActual.CveEmpresa))
{ {
DdlTipoPrceso2.DataSource = ObjCRM.DtResultados; DdlTipoProceso2.DataSource = ObjCRM.DtResultados;
DdlTipoPrceso2.Items.Insert(0, new ListItem("Seleccione","-1")); DdlTipoProceso2.Items.Insert(0, new ListItem("Seleccione","-1"));
} }
DdlTipoPrceso2.DataBind(); DdlTipoProceso2.DataBind();
ObjCRM.Dispose(); ObjCRM.Dispose();
} }
@@ -583,7 +583,7 @@ public partial class CRM_EmpresaCRM : ClsPaginas
ClsCRM ObjCRM = new ClsCRM(); ClsCRM ObjCRM = new ClsCRM();
if (ObjCRM.GetMedioCaptacion(UsuarioActual.CveEmpresa, -1)) if (ObjCRM.GetMedioCaptacion(UsuarioActual.CveEmpresa, -1))
{ {
DdlMedioCaptacion.DataSource = ObjCRM.DtResultados.FiltraParametros(String.Format("CveTipoProceso = {0}", DdlTipoPrceso2.SelectedValue)); DdlMedioCaptacion.DataSource = ObjCRM.DtResultados.FiltraParametros(String.Format("CveTipoProceso = {0}", DdlTipoProceso2.SelectedValue));
DdlMedioCaptacion.Items.Insert(0, new ListItem("Seleccione ", "-1")); DdlMedioCaptacion.Items.Insert(0, new ListItem("Seleccione ", "-1"));
DdlMedioCaptacionAcercamiento.Items.Clear(); DdlMedioCaptacionAcercamiento.Items.Clear();
DdlMedioCaptacionAcercamiento.DataSource = ObjCRM.DtResultados; DdlMedioCaptacionAcercamiento.DataSource = ObjCRM.DtResultados;
@@ -638,7 +638,7 @@ public partial class CRM_EmpresaCRM : ClsPaginas
TxtNombreEmpresa.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Empresa"); TxtNombreEmpresa.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Empresa");
TxtRFC.Text = ObjCRM.DtResultados.FiltroPrimeroValor("RFC"); TxtRFC.Text = ObjCRM.DtResultados.FiltroPrimeroValor("RFC");
DdlTipoPrceso2.SelectedValue = ObjCRM.DtResultados.FiltroPrimeroValor("CveTipoProceso"); DdlTipoProceso2.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveTipoProceso"));
CargaMetodosCaptacion(); CargaMetodosCaptacion();
TxtCorreoEmpresaCRM.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Correo"); TxtCorreoEmpresaCRM.Text = ObjCRM.DtResultados.FiltroPrimeroValor("Correo");
DdlMedioCaptacion.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveMedioCaptacion")); DdlMedioCaptacion.SelectedValueExist(ObjCRM.DtResultados.FiltroPrimeroValor("CveMedioCaptacion"));

View File

@@ -1457,7 +1457,8 @@ Partial Class Compras_Proveedores
#Region "LL E N A R - C O M B O S" #Region "LL E N A R - C O M B O S"
Private Sub CargaResponsable() Private Sub CargaResponsable()
DdlCveUsuarioResponsable.DataSource = GlobalDTUsuarioResponsable.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa) 'DdlCveUsuarioResponsable.DataSource = GlobalDTUsuarioResponsable.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa, DistinctColumns:={"CveUsuario", "Nombre"})
DdlCveUsuarioResponsable.DataSource = GlobalDTUsuarios(-1, UsuarioActual.CveEmpresa).FiltraParametros("", DistinctColumns:={"CveUsuario", "Nombre"})
DdlCveUsuarioResponsable.DataBind() DdlCveUsuarioResponsable.DataBind()
End Sub End Sub
Private Sub CargaClasificacionProveedor() Private Sub CargaClasificacionProveedor()

View File

@@ -33,12 +33,12 @@
<div class="row"> <div class="row">
<label class="col-md-1">Ejercicio: </label> <label class="col-md-1">Ejercicio: </label>
<div class="col-md-2"> <div class="col-md-2">
<asp:DropDownList ID="DdlEjercicio" runat="server" CssClass="form-control input-sm" DataTextField="Ejercicio" DataValueField="Ejercicio" AutoPostBack="true"></asp:DropDownList> <asp:DropDownList ID="DdlEjercicio" runat="server" CssClass="form-control input-sm" DataTextField="Ejercicio" DataValueField="Ejercicio" AutoPostBack="false"></asp:DropDownList>
</div> </div>
<label class="col-md-1">Periodo: </label> <label class="col-md-1">Periodo: </label>
<div class="col-md-2"> <div class="col-md-2">
<asp:DropDownList ID="DdlPeriodo" runat="server" CssClass="form-control input-sm" AutoPostBack="true"> <asp:DropDownList ID="DdlPeriodo" runat="server" CssClass="form-control input-sm" AutoPostBack="false">
<asp:ListItem Text="Enero" Value="1"></asp:ListItem> <asp:ListItem Text="Enero" Value="1"></asp:ListItem>
<asp:ListItem Text="Febrero" Value="2"></asp:ListItem> <asp:ListItem Text="Febrero" Value="2"></asp:ListItem>
<asp:ListItem Text="Marzo" Value="3"></asp:ListItem> <asp:ListItem Text="Marzo" Value="3"></asp:ListItem>
@@ -56,7 +56,7 @@
<label class="col-md-1">Tipo Póliza: </label> <label class="col-md-1">Tipo Póliza: </label>
<div class="col-md-1"> <div class="col-md-1">
<asp:DropDownList ID="DdlTipoPoliza" runat="server" CssClass="form-control input-sm" DataTextField="Ejercicio" DataValueField="Ejercicio" AutoPostBack="true"> <asp:DropDownList ID="DdlTipoPoliza" runat="server" CssClass="form-control input-sm" DataTextField="Ejercicio" DataValueField="Ejercicio" AutoPostBack="false">
<asp:ListItem Text="Todas" Value="-1"></asp:ListItem> <asp:ListItem Text="Todas" Value="-1"></asp:ListItem>
<asp:ListItem Text="Ingresos" Value="1"></asp:ListItem> <asp:ListItem Text="Ingresos" Value="1"></asp:ListItem>
<asp:ListItem Text="Egresos" Value="2"></asp:ListItem> <asp:ListItem Text="Egresos" Value="2"></asp:ListItem>
@@ -171,6 +171,14 @@
</ItemTemplate> </ItemTemplate>
<ItemStyle Width="100px"></ItemStyle> <ItemStyle Width="100px"></ItemStyle>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="PrePoliza" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:HyperLink ID="HplPrepoliza" CssClass="Texto" Target="_blank" NavigateUrl='<%# Eval("CvePrePoliza", "/Contabilidad/RegPrePoliza.aspx?CvePrePoliza={0}")%>' runat="server" ToolTip="Ir PrePoliza"><i class="fa fa-arrow-right" style="color:#686868;"></i></asp:HyperLink>
</ItemTemplate>
<ItemStyle Width="100px"></ItemStyle>
</asp:TemplateField>
</Columns> </Columns>
<HeaderStyle CssClass="Titulos"></HeaderStyle> <HeaderStyle CssClass="Titulos"></HeaderStyle>
</asp:GridView> </asp:GridView>

View File

@@ -49,7 +49,7 @@ Partial Class Contabilidad_FiltraPolizas
Dim Periodo As Integer = DdlPeriodo.SelectedValue.ToString().ToEntero() Dim Periodo As Integer = DdlPeriodo.SelectedValue.ToString().ToEntero()
Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa) Dim ObjConta As New ClsContPAQi(UsuarioActual.Empresa)
If ObjConta.GetPolizas(Ejercicio, Periodo, DdlTipoPoliza.SelectedValue.ToEntero(), DdlSegmentoNeg.SelectedValue.ToEntero()) Then If ObjConta.GetPolizas(Ejercicio, Periodo, DdlTipoPoliza.SelectedValue.ToEntero(), DdlSegmentoNeg.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then
DtDatos = ObjConta.DtResultados DtDatos = ObjConta.DtResultados
Gv.DataSource = ObjConta.DtResultados Gv.DataSource = ObjConta.DtResultados
'If DdlTipoPoliza.SelectedValue.ToEntero > 0 Then 'If DdlTipoPoliza.SelectedValue.ToEntero > 0 Then

View File

@@ -70,13 +70,24 @@
<asp:UpdatePanel runat="server"> <asp:UpdatePanel runat="server">
<ContentTemplate> <ContentTemplate>
<li> <li>
<asp:LinkButton ID="LnkExcel" runat="server" Visible="true" data-target="#DivCargaExcel"><i class="far fa-file-excel" style="font-weight:bold;"></i> Cargar Excel</asp:LinkButton> <asp:LinkButton ID="LnkExcel" runat="server" Visible="true" data-target="#DivCargaExcel"><i class="fa fa-file-excel-o" style="font-weight:bold;"></i> Cargar Excel</asp:LinkButton>
</li> </li>
<li> <li>
<asp:LinkButton ID="LnkComplementoPago" runat="server" Visible="false" OnClick="LnkComplementoPago_Click" Style="color: #686868;"><i class="fa fa-money" style="color:#686868;"></i> Crear Complemento de Pago</asp:LinkButton> <asp:LinkButton ID="LnkComplementoPago" runat="server" Visible="false" OnClick="LnkComplementoPago_Click" Style="color: #686868;"><i class="fa fa-money" style="color:#686868;"></i> Crear Complemento de Pago</asp:LinkButton>
</li> </li>
<li>
<asp:LinkButton ID="LnkImprimirPDF" runat="server" Visible="false" OnClick="LnkImprimirPDF_Click" Style="color: #686868;"><i class="fa fa-file-pdf-o" style="color:#686868;"></i> Paquete Egresos</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkComprobante" runat="server" Visible="false" data-toggle="modal" data-target="#ModalUpload" Style="color: #686868;"><i class="fa fa-upload" style="color:#686868;"></i> Cargar Comprobante</asp:LinkButton>
</li>
</ContentTemplate> </ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkComprobante" />
</Triggers>
</asp:UpdatePanel> </asp:UpdatePanel>
</asp:Content> </asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server"> <asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
@@ -783,7 +794,50 @@
</div> </div>
</div> </div>
</div> </div>
<div id="ModalUpload" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Subir Archivo</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel runat="server" ID="UpCargarArchivo" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-12" style="text-align: center;">
<label style="color: red;">Nota: Si ya tiene un comprobante este sera reemplazado</label>
</div>
</div>
<div class="row">
<div class="col-md-12">
<asp:TextBox ID="TxtCargarArchivo" CssClass="ADSdropzone hidden" data-maxFile="1" Text="" runat="server"></asp:TextBox>
</div>
</div>
<%--<div>
</div>--%>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="BtnGuardarArchivo" runat="server" ClientIDMode="Static" Text="Guardar" CssClass="btn btn-primary" />
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
<script src="/Metronic/assets/global/plugins/dropzone/dropzone.js"></script> <script src="/Metronic/assets/global/plugins/dropzone/dropzone.js"></script>
</asp:Content> </asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">

View File

@@ -5,6 +5,9 @@ Imports Extensiones
Imports System.Linq Imports System.Linq
Imports System.Web.Services Imports System.Web.Services
Imports GemBox.Spreadsheet Imports GemBox.Spreadsheet
Imports System.IO
Imports iTextSharp.text.pdf
Imports Microsoft.Reporting.WebForms
Partial Class ContabilidadC_RegPrePoliza Partial Class ContabilidadC_RegPrePoliza
Inherits ClsPaginas Inherits ClsPaginas
@@ -167,12 +170,39 @@ Partial Class ContabilidadC_RegPrePoliza
ViewState("IdPoliza") = value ViewState("IdPoliza") = value
End Set End Set
End Property End Property
Public Property Tick As String
Get
Return CType(ViewState("Tick"), String)
End Get
Set(value As String)
ViewState("Tick") = value
End Set
End Property
Public Property CveIE As Integer
Get
Return CType(ViewState("CveIE"), Integer)
End Get
Set(value As Integer)
ViewState("CveIE") = value
End Set
End Property
Public Property TipoPoliza As String
Get
Return CType(ViewState("TipoPoliza"), String)
End Get
Set(value As String)
ViewState("TipoPoliza") = value
End Set
End Property
#End Region #End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
If Not Page.IsPostBack Then If Not Page.IsPostBack Then
Tick = DateTime.Now.Ticks.ToString
If UsuarioActual.Empresa.TipoContabilizacion = 1 OrElse UsuarioActual.Empresa.TipoContabilidad = 1 Then If UsuarioActual.Empresa.TipoContabilizacion = 1 OrElse UsuarioActual.Empresa.TipoContabilidad = 1 Then
Response.Redirect(Request.Url.PathAndQuery.Replace("RegPrePoliza", "RegPrePolizaS")) Response.Redirect(Request.Url.PathAndQuery.Replace("RegPrePoliza", "RegPrePolizaS"))
@@ -265,8 +295,8 @@ Partial Class ContabilidadC_RegPrePoliza
ViewState("CveSubProyecto") = Request("CveSubProyecto").ToEntero ViewState("CveSubProyecto") = Request("CveSubProyecto").ToEntero
ViewState("CveTurno") = Request("CveTurno").ToEntero ViewState("CveTurno") = Request("CveTurno").ToEntero
DdlPlantilla.Items.Add(New ListItem("Pago Nomina", "61")) 'DdlPlantilla.Items.Add(New ListItem("Pago Nomina", "61"))
DdlPlantilla.SelectedValue = "61" 'DdlPlantilla.SelectedValue = "61"
DdlPlantilla.Enabled = False DdlPlantilla.Enabled = False
DivAgregarConceptos.Visible = False DivAgregarConceptos.Visible = False
@@ -418,6 +448,9 @@ Partial Class ContabilidadC_RegPrePoliza
TxtFechaDocumento.Text = dr("Fecha") TxtFechaDocumento.Text = dr("Fecha")
TxtConcepto.Text = dr("Concepto") TxtConcepto.Text = dr("Concepto")
DivDatosPoliza.Visible = True DivDatosPoliza.Visible = True
TipoPoliza = DdlTipoPoliza.SelectedItem.Text
Folio = dr("FolioPoliza").ToString
If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then
DivAgregarConceptos.Visible = True DivAgregarConceptos.Visible = True
@@ -485,19 +518,19 @@ Partial Class ContabilidadC_RegPrePoliza
'Asignamos los Subproyectos 'Asignamos los Subproyectos
e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa) e.Row.FCDropDownList("DdlSubProyecto").DataSource = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa)
e.Row.FCDropDownList("DdlSubProyecto").DataBind() e.Row.FCDropDownList("DdlSubProyecto").DataBind()
e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1")) 'e.Row.FCDropDownList("DdlSubProyecto").Items.Insert(0, New ListItem(" - ", "-1"))
e.Row.FCDropDownList("DdlSubProyecto").SelectedValueExist(e.Row.DataKey("CveSubProyecto")) e.Row.FCDropDownList("DdlSubProyecto").SelectedValueExist(e.Row.DataKey("CveSubProyecto"))
'Asignamos los Tipos de Gasto 'Asignamos los Tipos de Gasto
e.Row.FCDropDownList("DdlTipoGasto").DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa) e.Row.FCDropDownList("DdlTipoGasto").DataSource = GlobalDTTiposGastos(UsuarioActual.CveEmpresa)
e.Row.FCDropDownList("DdlTipoGasto").DataBind() e.Row.FCDropDownList("DdlTipoGasto").DataBind()
e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1")) 'e.Row.FCDropDownList("DdlTipoGasto").Items.Insert(0, New ListItem("Sin Asignar", "-1"))
e.Row.FCDropDownList("DdlTipoGasto").SelectedValueExist(e.Row.DataKey("CveTipoGasto")) e.Row.FCDropDownList("DdlTipoGasto").SelectedValueExist(e.Row.DataKey("CveTipoGasto"))
'ASignamos las CuentasContables 'ASignamos las CuentasContables
e.Row.FCDropDownList("DdlCtaContable").DataSource = Session("DtCuentas") e.Row.FCDropDownList("DdlCtaContable").DataSource = Session("DtCuentas")
e.Row.FCDropDownList("DdlCtaContable").DataBind() e.Row.FCDropDownList("DdlCtaContable").DataBind()
e.Row.FCDropDownList("DdlCtaContable").Items.Insert(0, New ListItem("Sin Asignar", "0")) 'e.Row.FCDropDownList("DdlCtaContable").Items.Insert(0, New ListItem("Sin Asignar", "0"))
e.Row.FCDropDownList("DdlCtaContable").SelectedValueExist(e.Row.DataKey("IdCtaContable")) e.Row.FCDropDownList("DdlCtaContable").SelectedValueExist(e.Row.DataKey("IdCtaContable"))
TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + e.Row.FCTextBox("TxtCargo").Text.ToDouble).ToString.FormatoNumero TxtTotalCargos.Text = (TxtTotalCargos.Text.ToDouble + e.Row.FCTextBox("TxtCargo").Text.ToDouble).ToString.FormatoNumero
@@ -511,6 +544,11 @@ Partial Class ContabilidadC_RegPrePoliza
If CveConceptoContable.Contiene(68) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}", e.Row.DBCampo("CveMovimientoAlmacen")) If CveConceptoContable.Contiene(68) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}", e.Row.DBCampo("CveMovimientoAlmacen"))
If CveConceptoContable.Contiene(30, 204) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE")) If CveConceptoContable.Contiene(30, 204) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE"))
If CveConceptoContable.Contiene(30) Then
LnkImprimirPDF.Visible = True
LnkComprobante.Visible = True
CveIE = e.Row.DBCampo("CveIE").ToString.ToEntero
End If
'e.Row.FCHyperLink("HlReferencia").NavigateUrl = CveConceptoContable 'e.Row.FCHyperLink("HlReferencia").NavigateUrl = CveConceptoContable
@@ -811,6 +849,8 @@ Partial Class ContabilidadC_RegPrePoliza
dr("MultipleSubProyecto") = drt("MultipleSubProyecto") dr("MultipleSubProyecto") = drt("MultipleSubProyecto")
dr("PorcentajeImpuesto") = drt("PorcentajeImpuesto") dr("PorcentajeImpuesto") = drt("PorcentajeImpuesto")
dr("CveCuenta") = drt("CveCuenta") dr("CveCuenta") = drt("CveCuenta")
dr("FolioPoliza") = drt("FolioPoliza")
DtMovimientos.Rows.Add(dr) DtMovimientos.Rows.Add(dr)
@@ -891,7 +931,6 @@ Partial Class ContabilidadC_RegPrePoliza
If e.Row.DataKey("CveConcepto").ToEntero.Contiene(30) Then If e.Row.DataKey("CveConcepto").ToEntero.Contiene(30) Then
e.Row.FCLinkButton("ImgBancos").Visible = True e.Row.FCLinkButton("ImgBancos").Visible = True
If CveTipoTransaccion > 0 And CveCuenta > 0 And Folio.Length > 0 And ImporteDocumento > 0 And Beneficiario.Length > 0 Then If CveTipoTransaccion > 0 And CveCuenta > 0 And Folio.Length > 0 And ImporteDocumento > 0 And Beneficiario.Length > 0 Then
e.Row.FCLinkButton("ImgBancos").CssClass = "btn btn-circle btn-sm green" e.Row.FCLinkButton("ImgBancos").CssClass = "btn btn-circle btn-sm green"
End If End If
@@ -1724,6 +1763,236 @@ Partial Class ContabilidadC_RegPrePoliza
Protected Sub LnkComplementoPago_Click(sender As Object, e As EventArgs) Protected Sub LnkComplementoPago_Click(sender As Object, e As EventArgs)
GeneraTimbre(CvePrePoliza) GeneraTimbre(CvePrePoliza)
End Sub End Sub
Protected Sub LnkImprimirPDF_Click(sender As Object, e As EventArgs)
Dim filtro() As String = {"CveCompra", "CveIE", "CveConceptoContable"}
Dim filtroComplemento() As String = {"CveIE"}
Dim Pathpdf As New List(Of String)
Dim pdfs = New List(Of Byte())
Dim Path As String
Dim dt As DataTable = DtMovimientos.FiltraParametros("", "", filtro)
Dim ObjCompra As New ClsCompras
Dim ObjIE As New ClsBancos()
Dim pathPoliza As String = ""
Dim TieneComprobante As Boolean
Try
TieneComprobante = VerificarComprobante()
If TieneComprobante Then
Path = ImprimirPolizaPDF(IdPoliza)
pathPoliza = Path
If File.Exists(Path) Then
Pathpdf.Add(Path)
End If
For Each Row As DataRow In dt.Rows
If Row("CveConceptoContable").ToString.ToEntero = 30 Then
If Row("CveIE").ToString.ToEntero > 0 Then
If ObjIE.GetBancosIE(Row("CveIE").ToString.ToEntero, UsuarioActual.CveEmpresa) Then
If ObjIE.DtResultados.Rows.Count > 0 Then
Path = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString)
If File.Exists(Path) Then
Dim formato As String = System.IO.Path.GetExtension(Path)
If formato.ToLower.Contiene(".jpg", ".png", ".jpeg") Then
Dim ComprobantePDF As String = String.Format("{0}\{1}\comprobante.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick)
Using crea_archivo = New iTextSharp.text.Document(iTextSharp.text.PageSize.A4, 18, 18, 18, 18)
PdfWriter.GetInstance(crea_archivo, New FileStream(ComprobantePDF, FileMode.Create))
crea_archivo.Open()
Dim image As iTextSharp.text.Image = iTextSharp.text.Image.GetInstance(Path)
If image.Height > image.Width Then
Dim percentage As Double = 0.0F
percentage = 700 / image.Height
image.ScalePercent(percentage * 100)
Else
Dim percentage As Double = 0.0F
percentage = 540 / image.Width
image.ScalePercent(percentage * 100)
End If
crea_archivo.Add(image)
End Using
Pathpdf.Add(ComprobantePDF)
Else
Pathpdf.Add(Path)
End If
End If
End If
End If
End If
End If
If Row("CveConceptoContable").ToString.ToEntero.Contiene(17, 309, 312, 308) Then
If ObjCompra.GetCompras(Row("CveCompra").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa) Then
If ObjCompra.DtResultados IsNot Nothing AndAlso ObjCompra.DtResultados.Rows.Count > 0 Then
Dim dr As DataRow = ObjCompra.DtResultados.Rows(0)
Dim RFC As String = dr("RFC").ToString
Dim CveFactura As String = dr("CveFactura").ToString
Path = String.Format("{0}Compras\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, RFC, CveFactura)
If File.Exists(Path) Then
Pathpdf.Add(Path)
End If
End If
End If
End If
Next
dt = DtMovimientos.FiltraParametros("", "", filtroComplemento)
For Each Row As DataRow In dt.Rows
If ObjCompra.GetCompraComplementoPago(-1, UsuarioActual.CveEmpresa, Row("CveIE").ToString.ToEntero) Then
Console.WriteLine(Row("CveIE").ToString)
If ObjCompra.DtResultados IsNot Nothing AndAlso ObjCompra.DtResultados.Rows.Count > 0 Then
Dim dr As DataRow = ObjCompra.DtResultados.Rows(0)
Dim RFC As String = dr("RFCde").ToString
Dim CveFactura As String = dr("CveFactura").ToString
Console.WriteLine(RFC & CveFactura)
If CveFactura <> "" Then
Path = String.Format("{0}Compras\{1}\{2}.pdf", UsuarioActual.Empresa.Ruta, RFC, CveFactura)
Console.WriteLine(Path)
If File.Exists(Path) Then
Pathpdf.Add(Path)
End If
End If
End If
End If
Next
MergePdfFiles(Pathpdf.ToArray)
If File.Exists(pathPoliza) Then
Directory.Delete(String.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, Tick), True)
End If
Else
Alert("No se tiene cargado comprobante de pago", TipoMensaje.MsgAdvertencia)
End If
Catch ex As Exception
Alert("Error al descargar el paquete", TipoMensaje.MsgError)
End Try
End Sub
Private Function ImprimirPolizaPDF(IdPoliza As Integer) As String
Dim ObjConta As New ClsContabilidad
'Dim ObjPoliza As New ClsContPAQi(UsuarioActual.Empresa)
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/Polizas.rdlc", UsuarioActual.Empresa.Ruta))
Dim params As New List(Of ReportParameter)
Dim Bytes As Byte() = Nothing
'If ObjPoliza.GetPoliza(IdPoliza, -1, -1, -1, -1) AndAlso ObjPoliza.DtResultados.Rows.Count > 0 Then
If ObjConta.GetPrePolizasDetalle(CvePrePoliza) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then
Dim dtVC As DataTable
Dim dr As DataRow
dtVC = ObjConta.DtResultados
dr = dtVC.Rows(0)
Dim ruta As String = ""
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("TipoPoliza", dr("TipoPoliza").ToString))
params.Add(New ReportParameter("Finicio", dr("Fecha").ToString.ToDate.ToShortDateString))
params.Add(New ReportParameter("FFin", dr("Fecha").ToString.ToDate.ToShortDateString))
params.Add(New ReportParameter("Fecha", dr("Fecha").ToString.ToDate.ToShortDateString))
'params.Add(New ReportParameter("Nombre", dr("Cuenta").ToString))
'params.Add(New ReportParameter("Cuenta", dr("Codigo").ToString))
params.Add(New ReportParameter("Numero", dr("FolioPoliza").ToString))
params.Add(New ReportParameter("Moneda", ""))
params.Add(New ReportParameter("CodigoPostal", ""))
If UsuarioActual.CveEmpresa = 119 Then
params.Add(New ReportParameter("UsuarioRegistro", GlobalDTUsuarios(dr("CveUsuario").ToString.ToEntero).FiltroPrimeroValor("Nombre")))
End If
If Archivo.Exists Then
ruta = UsuarioActual.Empresa.Ruta & "Formatos/Polizas.rdlc"
Else
ruta = "Empresas/Grales/Formatos/Polizas.rdlc"
End If
Bytes = StreamPDF(ruta, dtVC, params, "ppoliza")
If Not File.Exists(String.Format("{0}{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString)) Then
DirectoryExistsCreate(String.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, Tick))
File.WriteAllBytes(String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString), Bytes)
End If
End If
Return String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString)
ObjConta.Dispose()
End Function
Private Sub MergePdfFiles(ByVal pdfFiles() As String)
Dim result As Boolean = False
Dim pdfCount As Integer = 0
Dim f As Integer = 0
Dim fileName As String
Dim reader As iTextSharp.text.pdf.PdfReader = Nothing
Dim pageCount As Integer = 0
Dim pdfDoc As iTextSharp.text.Document = Nothing
Dim writer As PdfWriter = Nothing
Dim cb As PdfContentByte = Nothing
Dim page As PdfImportedPage = Nothing
Dim rotation As Integer = 0
Try
pdfCount = pdfFiles.Length
If pdfCount > 0 Then
fileName = pdfFiles(f)
reader = New iTextSharp.text.pdf.PdfReader(fileName)
pageCount = reader.NumberOfPages
pdfDoc = New iTextSharp.text.Document(reader.GetPageSizeWithRotation(1), 18, 18, 18, 18)
writer = PdfWriter.GetInstance(pdfDoc, New FileStream(String.Format("{0}\{1}\{2}-{3}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, TipoPoliza, Folio), FileMode.Create))
With pdfDoc
.Open()
End With
cb = writer.DirectContent
While f < pdfCount
Dim i As Integer = 0
While i < pageCount
i += 1
pdfDoc.SetPageSize(reader.GetPageSizeWithRotation(i))
pdfDoc.NewPage()
page = writer.GetImportedPage(reader, i)
rotation = reader.GetPageRotation(i)
If rotation = 90 Then
cb.AddTemplate(page, 0, -1.0F, 1.0F, 0, 0, reader.GetPageSizeWithRotation(i).Height)
ElseIf rotation = 270 Then
cb.AddTemplate(page, 0, 1.0F, -1.0F, 0, reader.GetPageSizeWithRotation(i).Width + 60, -30)
Else
cb.AddTemplate(page, 1.0F, 0, 0, 1.0F, 0, 0)
End If
End While
f += 1
If f < pdfCount Then
fileName = pdfFiles(f)
reader = New iTextSharp.text.pdf.PdfReader(fileName)
pageCount = reader.NumberOfPages
End If
End While
pdfDoc.Close()
Dim Archivo As New System.IO.FileInfo(String.Format("{0}\{1}\{2}-{3}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, TipoPoliza, Folio))
If Archivo.Exists Then
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ContentType = "application/octet-stream"
HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name))
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
HttpContext.Current.Response.TransmitFile(String.Format("{0}\{1}\{2}-{3}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, TipoPoliza, Folio))
Response.Flush() ' send it to the client to download
HttpContext.Current.Response.SuppressContent = True
HttpContext.Current.ApplicationInstance.CompleteRequest()
End If
result = True
End If
Catch ex As Exception
End Try
End Sub
#End Region #End Region
@@ -1945,7 +2214,7 @@ Partial Class ContabilidadC_RegPrePoliza
Next Next
If Not TieneError Then If Not TieneError Then
ObjConta.Commit() ObjConta.Commit()
Alert(String.Format("<br/><br/>Prepóliza: <b><a href = ""/Contabilidad/RegPrePoliza.aspx?CvePrePoliza={0}"" class=""texto"" target=""_blank"" >{1}</a></b>", CvePrePoliza, ObjConta.ContaFolio)) Alert(String.Format("<br/><br/>Prepóliza: <b><a href=""/Contabilidad/RegPrePoliza.aspx?CvePrePoliza={0}"" class=""texto"" target=""_blank"" >{1}</a></b>", CvePrePoliza, ObjConta.ContaFolio))
Alert($"Se agregó la póliza {ObjConta.ContaFolio}") Alert($"Se agregó la póliza {ObjConta.ContaFolio}")
@@ -2014,5 +2283,76 @@ Partial Class ContabilidadC_RegPrePoliza
Return dataTable Return dataTable
End Function End Function
Protected Sub BtnGuardarArchivo_Click(sender As Object, e As EventArgs) Handles BtnGuardarArchivo.Click
Dim ObjIE As New ClsBancos
Dim Comprobante As String = ""
Dim Filesgral As List(Of Archivo) = TxtCargarArchivo.getfiles().Archivos
If Filesgral.Count > 0 Then
Dim fileItem As Archivo = Filesgral(0)
Dim Path As String = HttpContext.Current.Request.ApplicationPath
Comprobante = IO.Path.GetExtension(String.Format("{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "")
Path = Extensiones.DirectorioBaseEmpresas
Path += String.Format("Empresas/{0}/IE", UsuarioActual.CveEmpresa)
If Not Directory.Exists(Path) Then
Directory.CreateDirectory(Path)
End If
Path += $"/{CveIE}.{Comprobante}"
If File.Exists(Path) Then
File.Delete(Path)
End If
My.Computer.FileSystem.MoveFile(fileItem.FileUrl, Path)
End If
TxtCargarArchivo.Text = ""
RegistraScript("$('#ModalUpload').modal('hide')", "hidemodal1")
If ObjIE.UpdateComprobanteIE(Comprobante.Replace("."c, ""), CveIE) Then
Alert("El Comprobante se guardo exitosamente.", TipoMensaje.MsgInformacion)
End If
ObjIE.Dispose()
End Sub
Private Function VerificarComprobante() As Boolean
Dim filtro() As String = {"CveCompra", "CveIE", "CveConceptoContable"}
Dim Path As String
Dim dt As DataTable = DtMovimientos.FiltraParametros("", "", filtro)
Dim ObjIE As New ClsBancos()
Dim TieneComprobante As Boolean = True
For Each Row As DataRow In dt.Rows
If TieneComprobante Then
If Row("CveConceptoContable").ToString.ToEntero = 30 Then
If Row("CveIE").ToString.ToEntero > 0 Then
If ObjIE.GetBancosIE(Row("CveIE").ToString.ToEntero, UsuarioActual.CveEmpresa) Then
If ObjIE.DtResultados.Rows.Count > 0 Then
Path = String.Format("{0}IE\{1}", UsuarioActual.Empresa.Ruta, ObjIE.Comprobante.ToString)
If File.Exists(Path) Then
TieneComprobante = True
Else
TieneComprobante = False
Exit For
End If
Else
TieneComprobante = False
Exit For
End If
End If
End If
End If
End If
Next
ObjIE.Dispose()
Return TieneComprobante
End Function
End Class End Class

View File

@@ -75,7 +75,14 @@
<li> <li>
<asp:LinkButton ID="LnkComplementoPago" runat="server" Visible="false" OnClick="LnkComplementoPago_Click" Style="color: #686868;"><i class="fa fa-money" style="color:#686868;"></i> Crear Complemento de Pago</asp:LinkButton> <asp:LinkButton ID="LnkComplementoPago" runat="server" Visible="false" OnClick="LnkComplementoPago_Click" Style="color: #686868;"><i class="fa fa-money" style="color:#686868;"></i> Crear Complemento de Pago</asp:LinkButton>
</li> </li>
<li>
<asp:LinkButton ID="LnkImprimirPDF" runat="server" Visible="false" OnClick="LnkImprimirPDF_Click" Style="color: #686868;"><i class="fa fa-file-pdf-o" style="color:#686868;"></i> Imprimir Poliza</asp:LinkButton>
</li>
</ContentTemplate> </ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkComprobante" />
</Triggers>
</asp:UpdatePanel> </asp:UpdatePanel>
<asp:UpdatePanel runat="server"> <asp:UpdatePanel runat="server">
@@ -835,7 +842,7 @@
</div> </div>
</div> </div>
</div> </div>
<script src="/Metronic/assets/global/plugins/dropzone/dropzone.js"></script> <script src="/Metronic/assets/global/plugins/dropzone/dropzone.js"></script>
</asp:Content> </asp:Content>

View File

@@ -5,7 +5,10 @@ Imports Extensiones
Imports System.Linq Imports System.Linq
Imports System.Web.Services Imports System.Web.Services
Imports GemBox.Spreadsheet Imports GemBox.Spreadsheet
Imports Microsoft.Reporting.WebForms
Imports System.IO
Imports iTextSharp.text.pdf
Partial Class ContabilidadC_RegPrePolizaS Partial Class ContabilidadC_RegPrePolizaS
Inherits ClsPaginas Inherits ClsPaginas
@@ -159,6 +162,40 @@ Partial Class ContabilidadC_RegPrePolizaS
ViewState("IndiceGrid") = value ViewState("IndiceGrid") = value
End Set End Set
End Property End Property
Public Property IdPoliza As Integer
Get
Return CType(ViewState("IdPoliza"), Integer)
End Get
Set(value As Integer)
ViewState("IdPoliza") = value
End Set
End Property
Public Property Tick As String
Get
Return CType(ViewState("Tick"), String)
End Get
Set(value As String)
ViewState("Tick") = value
End Set
End Property
Public Property CveIE As Integer
Get
Return CType(ViewState("CveIE"), Integer)
End Get
Set(value As Integer)
ViewState("CveIE") = value
End Set
End Property
Public Property TipoPoliza As String
Get
Return CType(ViewState("TipoPoliza"), String)
End Get
Set(value As String)
ViewState("TipoPoliza") = value
End Set
End Property
#End Region #End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -175,6 +212,8 @@ Partial Class ContabilidadC_RegPrePolizaS
Observaciones = "-1" Observaciones = "-1"
Beneficiario = "-1" Beneficiario = "-1"
Actualizar = False Actualizar = False
IdPoliza = -1
If IfNull(Request("Tipo"), "").ToString = "NOMPROV" Then If IfNull(Request("Tipo"), "").ToString = "NOMPROV" Then
DivTipoGasto.Visible = True DivTipoGasto.Visible = True
@@ -365,7 +404,9 @@ Partial Class ContabilidadC_RegPrePolizaS
DdlTipoPoliza.SelectedValue = dr("CveTipoPoliza") DdlTipoPoliza.SelectedValue = dr("CveTipoPoliza")
TxtFechaDocumento.Text = dr("Fecha") TxtFechaDocumento.Text = dr("Fecha")
TxtConcepto.Text = dr("Concepto") TxtConcepto.Text = dr("Concepto")
DivDatosPoliza.Visible = True DivDatosPoliza.Visible = True
TipoPoliza = DdlTipoPoliza.SelectedItem.Text
Folio = dr("FolioPoliza").ToString
If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then If UsuarioActual.CveRol = 1 OrElse UsuarioActual.TienePermisoProceso(221) Then
'DivAgregarConceptos.Visible = True 'DivAgregarConceptos.Visible = True
@@ -470,7 +511,13 @@ Partial Class ContabilidadC_RegPrePolizaS
If CveConceptoContable.Contiene(1, 2, 13, 38, 207, 203, 39, 61, 62, 63) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DataKey("CveVenta")) If CveConceptoContable.Contiene(1, 2, 13, 38, 207, 203, 39, 61, 62, 63) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Ventas/Ventas.aspx?CveVenta={0}", e.Row.DataKey("CveVenta"))
If CveConceptoContable.Contiene(5, 6, 17, 18, 14, 19, 25, 26, 60, 234, 235, 240) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DataKey("CveCompra")) If CveConceptoContable.Contiene(5, 6, 17, 18, 14, 19, 25, 26, 60, 234, 235, 240) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Compras/Compras.aspx?CveCompra={0}", e.Row.DataKey("CveCompra"))
If CveConceptoContable.Contiene(68) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}", e.Row.DBCampo("CveMovimientoAlmacen")) If CveConceptoContable.Contiene(68) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}", e.Row.DBCampo("CveMovimientoAlmacen"))
If CveConceptoContable.Contiene(30, 204) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE")) If CveConceptoContable.Contiene(30, 204) Then e.Row.FCHyperLink("HlReferencia").NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", e.Row.DBCampo("CveIE"))
If CveConceptoContable.Contiene(30) Then
LnkImprimirPDF.Visible = True
LnkComprobante.Visible = True
CveIE = e.Row.DBCampo("CveIE").ToString.ToEntero
End If
'e.Row.FCHyperLink("HlReferencia").NavigateUrl = CveConceptoContable 'e.Row.FCHyperLink("HlReferencia").NavigateUrl = CveConceptoContable
@@ -689,6 +736,8 @@ Partial Class ContabilidadC_RegPrePolizaS
dr("CvePersonal") = drt("CvePersonal") dr("CvePersonal") = drt("CvePersonal")
dr("CveClasificacion") = -1 dr("CveClasificacion") = -1
dr("MultipleSubProyecto") = drt("MultipleSubProyecto") dr("MultipleSubProyecto") = drt("MultipleSubProyecto")
dr("FolioPoliza") = drt("FolioPoliza")
DtMovimientos.Rows.Add(dr) DtMovimientos.Rows.Add(dr)
Next Next
@@ -1951,5 +2000,150 @@ Partial Class ContabilidadC_RegPrePolizaS
End Sub End Sub
#End Region #End Region
#Region "Paquete Egresos"
Protected Sub LnkImprimirPDF_Click(sender As Object, e As EventArgs)
Dim Pathpdf As New List(Of String)
Dim Path As String
Try
Path = ImprimirPolizaPDF(IdPoliza)
If File.Exists(Path) Then
Pathpdf.Add(Path)
End If
MergePdfFiles(Pathpdf.ToArray)
If File.Exists(Path) Then
Directory.Delete(String.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, Tick), True)
End If
Catch ex As Exception
Alert("Error al descargar la poliza", TipoMensaje.MsgError)
End Try
End Sub
Private Function ImprimirPolizaPDF(IdPoliza As Integer) As String
Dim ObjConta As New ClsContabilidad
'Dim ObjPoliza As New ClsContPAQi(UsuarioActual.Empresa)
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/Polizas.rdlc", UsuarioActual.Empresa.Ruta))
Dim params As New List(Of ReportParameter)
Dim Bytes As Byte() = Nothing
'If ObjPoliza.GetPoliza(IdPoliza, -1, -1, -1, -1) AndAlso ObjPoliza.DtResultados.Rows.Count > 0 Then
If ObjConta.GetPrePolizasDetalle(CvePrePoliza) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then
Dim dtVC As DataTable
Dim dr As DataRow
dtVC = ObjConta.DtResultados
dr = dtVC.Rows(0)
Dim ruta As String = ""
params.Add(New ReportParameter("Empresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("TipoPoliza", dr("TipoPoliza").ToString))
params.Add(New ReportParameter("Finicio", dr("Fecha").ToString.ToDate.ToShortDateString))
params.Add(New ReportParameter("FFin", dr("Fecha").ToString.ToDate.ToShortDateString))
params.Add(New ReportParameter("Fecha", dr("Fecha").ToString.ToDate.ToShortDateString))
'params.Add(New ReportParameter("Nombre", dr("Cuenta").ToString))
'params.Add(New ReportParameter("Cuenta", dr("Codigo").ToString))
params.Add(New ReportParameter("Numero", dr("FolioPoliza").ToString))
params.Add(New ReportParameter("Moneda", ""))
params.Add(New ReportParameter("CodigoPostal", ""))
If UsuarioActual.CveEmpresa = 119 Then
params.Add(New ReportParameter("UsuarioRegistro", GlobalDTUsuarios(dr("CveUsuario").ToString.ToEntero).FiltroPrimeroValor("Nombre")))
End If
If Archivo.Exists Then
ruta = UsuarioActual.Empresa.Ruta & "Formatos/Polizas.rdlc"
Else
ruta = "Empresas/Grales/Formatos/Polizas.rdlc"
End If
Bytes = StreamPDF(ruta, dtVC, params, "ppoliza")
If Not File.Exists(String.Format("{0}{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString)) Then
DirectoryExistsCreate(String.Format("{0}{1}", AppDomain.CurrentDomain.BaseDirectory, Tick))
File.WriteAllBytes(String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString), Bytes)
End If
End If
Return String.Format("{0}\{1}\{2}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, IdPoliza.ToString)
ObjConta.Dispose()
End Function
Private Sub MergePdfFiles(ByVal pdfFiles() As String)
Dim result As Boolean = False
Dim pdfCount As Integer = 0
Dim f As Integer = 0
Dim fileName As String
Dim reader As iTextSharp.text.pdf.PdfReader = Nothing
Dim pageCount As Integer = 0
Dim pdfDoc As iTextSharp.text.Document = Nothing
Dim writer As PdfWriter = Nothing
Dim cb As PdfContentByte = Nothing
Dim page As PdfImportedPage = Nothing
Dim rotation As Integer = 0
Try
pdfCount = pdfFiles.Length
If pdfCount > 0 Then
fileName = pdfFiles(f)
reader = New iTextSharp.text.pdf.PdfReader(fileName)
pageCount = reader.NumberOfPages
pdfDoc = New iTextSharp.text.Document(reader.GetPageSizeWithRotation(1), 18, 18, 18, 18)
writer = PdfWriter.GetInstance(pdfDoc, New FileStream(String.Format("{0}\{1}\{2}-{3}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, TipoPoliza, Folio), FileMode.Create))
With pdfDoc
.Open()
End With
cb = writer.DirectContent
While f < pdfCount
Dim i As Integer = 0
While i < pageCount
i += 1
pdfDoc.SetPageSize(reader.GetPageSizeWithRotation(i))
pdfDoc.NewPage()
page = writer.GetImportedPage(reader, i)
rotation = reader.GetPageRotation(i)
If rotation = 90 Then
cb.AddTemplate(page, 0, -1.0F, 1.0F, 0, 0, reader.GetPageSizeWithRotation(i).Height)
ElseIf rotation = 270 Then
cb.AddTemplate(page, 0, 1.0F, -1.0F, 0, reader.GetPageSizeWithRotation(i).Width + 60, -30)
Else
cb.AddTemplate(page, 1.0F, 0, 0, 1.0F, 0, 0)
End If
End While
f += 1
If f < pdfCount Then
fileName = pdfFiles(f)
reader = New iTextSharp.text.pdf.PdfReader(fileName)
pageCount = reader.NumberOfPages
End If
End While
pdfDoc.Close()
Dim Archivo As New System.IO.FileInfo(String.Format("{0}\{1}\{2}-{3}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, TipoPoliza, Folio))
If Archivo.Exists Then
HttpContext.Current.Response.Clear()
HttpContext.Current.Response.ClearContent()
HttpContext.Current.Response.ContentType = "application/octet-stream"
HttpContext.Current.Response.AppendHeader("Content-disposition", String.Format("attachment; filename={0}", Archivo.Name))
HttpContext.Current.Response.AddHeader("Content-Length", Archivo.Length.ToString())
HttpContext.Current.Response.TransmitFile(String.Format("{0}\{1}\{2}-{3}.pdf", AppDomain.CurrentDomain.BaseDirectory, Tick, TipoPoliza, Folio))
Response.Flush() ' send it to the client to download
HttpContext.Current.Response.SuppressContent = True
HttpContext.Current.ApplicationInstance.CompleteRequest()
End If
result = True
End If
Catch ex As Exception
End Try
End Sub
#End Region
End Class End Class

View File

@@ -216,6 +216,7 @@
<asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="IVA" DataField="IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="%IVA" DataField="PorcentajeIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="%IVA" DataField="PorcentajeIVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="IVA ND" DataField="IVANoDeducible" DataFormatString="{0:#,###,###.##}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="IVA ND" DataField="IVANoDeducible" DataFormatString="{0:#,###,###.##}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="IVA <br/>Importación " HtmlEncode="False" DataField="IvaExentoImpo" Visible="false" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="IEPS" DataField="IEPS" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:TemplateField ItemStyle-HorizontalAlign="Right"> <asp:TemplateField ItemStyle-HorizontalAlign="Right">
<HeaderTemplate> <HeaderTemplate>
@@ -231,7 +232,7 @@
<asp:BoundField HeaderText="RetIVA <br/> Serv." HtmlEncode="False" DataField="RetIVAServicios" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="RetIVA <br/> Serv." HtmlEncode="False" DataField="RetIVAServicios" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="RetISR <br/> Honorario" HtmlEncode="False" DataField="RetISR" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="RetISR <br/> Honorario" HtmlEncode="False" DataField="RetISR" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="RetISR <br/> Arrendamiento" HtmlEncode="False" DataField="RetISRArrend" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="RetISR <br/> Arrendamiento" HtmlEncode="False" DataField="RetISRArrend" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="F.Compra" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Right" /> <asp:BoundField HeaderText="F.Compra" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Folio Fiscal" DataField="FolioFiscal" /> <asp:BoundField HeaderText="Folio Fiscal" DataField="FolioFiscal" />

View File

@@ -53,7 +53,6 @@ public partial class Contabilidad_RepIVA : ClsPaginas
if (!IsPostBack) if (!IsPostBack)
{ {
InicializaValores(); InicializaValores();
} }
} }
@@ -61,8 +60,9 @@ public partial class Contabilidad_RepIVA : ClsPaginas
{ {
TipoCambio = 1; TipoCambio = 1;
TCEspecifico = -1; TCEspecifico = -1;
txtFechaI.Text = $"01/{DateTime.Now.Month}/{DateTime.Now.Year}"; DateTime FF = DateTime.Now.AddMonths(-1);
txtFechaF.Text = DateTime.Now.ToShortDateString(); txtFechaI.Text = $"01/{FF.Month}/{FF.Year}";
txtFechaF.Text = FF.ToShortDateString();
LnkAccionesDIOT.Visible = true; LnkAccionesDIOT.Visible = true;
@@ -104,6 +104,8 @@ public partial class Contabilidad_RepIVA : ClsPaginas
LblMsgAcreditable.Text = "La información presenta importes en negativo, estos no se incluirán en el archivo generado para DIOT"; LblMsgAcreditable.Text = "La información presenta importes en negativo, estos no se incluirán en el archivo generado para DIOT";
} }
GvA.Columns[11].Visible = DtIVAAcreditable.SUM("IvaExentoImpo") > 0; // sino tiene valor la columna de importación de oculta
if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 3, DdlCuenta.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)) if (ObjCont.GetRepIVAAcumulado(txtFechaI.Text.ToDate(), txtFechaF.Text.ToDate(), Conciliado, 3, DdlCuenta.SelectedValue.ToEntero(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa))
{ {

View File

@@ -24,7 +24,7 @@
<asp:UpdatePanel runat="server" ID="UpDatos" UpdateMode="Conditional"> <asp:UpdatePanel runat="server" ID="UpDatos" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<asp:GridView runat="server" ID="GvDatos" EmptyDataText="No se encontraron Motivo de Baja Registrados" ToolTip="Listado de Motivo de Baja" CssClass="table table-striped table-advance table-hover ScrollAD" <asp:GridView runat="server" ID="GvDatos" EmptyDataText="No se encontraron Motivo de Baja Registrados" ToolTip="Listado de Motivo de Baja" CssClass="table table-striped table-advance table-hover ScrollAD"
DataKeyNames="CveCuentaAsignacion,CveConceptoContable,CveCuenta,IdCuenta,CveProveedor,CveCliente,CvePersonal,CveClasificacion,CveAlmacen,PorcentajeIVA,CveConceptoNomina" AutoGenerateColumns="False" DataKeyNames="CveCuentaAsignacion,CveConceptoContable,CveCuenta,IdCuenta,CveProveedor,CveCliente,CvePersonal,CveClasificacion,CveAlmacen,PorcentajeIVA,CveConceptoNomina,CveBancoCuenta" AutoGenerateColumns="False"
Style="margin-top: -10px; text-align: center;width:100%" GridLines="None"> Style="margin-top: -10px; text-align: center;width:100%" GridLines="None">
<Columns> <Columns>
<asp:BoundField DataField="ConceptoContable" HeaderText="Concepto Contable" ItemStyle-HorizontalAlign="Left"/> <asp:BoundField DataField="ConceptoContable" HeaderText="Concepto Contable" ItemStyle-HorizontalAlign="Left"/>
@@ -87,6 +87,10 @@
<label for="<%= DdlClientes.ClientID.ToString()%>">Cliente: </label><br /> <label for="<%= DdlClientes.ClientID.ToString()%>">Cliente: </label><br />
<ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClientes" Width="90%" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;"></ADS:Dropdownlost> <ADS:Dropdownlost CssClassDdl="select2me" ID="DdlClientes" Width="90%" data-metodo="getcliente" runat="server" DataTextField="NombreComercial" DataValueField="CveCliente" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div> </div>
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlCuentaBancaria" CssClass="form-control input-sm select2me js-cuenta-programmatic select2me" runat="server" DataTextField="NumCuentaMoneda" DataValueField="CveCuenta" Width="240px" ValidationGroup="GrpModulo"></asp:DropDownList>
<label for="<%= DdlCuentaBancaria.ClientID.ToString()%>">Cuenta Bancaria: </label>
</div>
</div> </div>
<div class="col-md-1" style="width:50%;text-align:left"> <div class="col-md-1" style="width:50%;text-align:left">
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">

View File

@@ -42,7 +42,7 @@ Partial Class Contabilidad2_CatCuentasAsignaciones
If ObjConta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then If ObjConta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then
DdlCuenta.DataSource = ObjConta.DtResultados DdlCuenta.DataSource = ObjConta.DtResultados
End If End If
ObjConta.Dispose()
DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa) DdlProveedor.DataSource = GlobalDTCompProveedores(UsuarioActual.CveEmpresa)
DdlClientes.setEsWebService(True) DdlClientes.setEsWebService(True)
@@ -51,17 +51,25 @@ Partial Class Contabilidad2_CatCuentasAsignaciones
DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa) DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa)
DdlAlmacen.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa) DdlAlmacen.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa)
ObjConta.Dispose()
Dim ObjBancos As New ClsBancos
If ObjBancos.GetBancosCuentas(-1, CveEmpresa:=UsuarioActual.CveEmpresa) Then
DdlCuentaBancaria.DataSource = ObjBancos.DtResultados.FiltraParametros("CveEmpresa = " & UsuarioActual.CveEmpresa)
End If
ObjBancos.Dispose()
DdlCuentaBancaria.DataBind()
DdlCconceptosContables.DataBind() DdlCconceptosContables.DataBind()
DdlCuenta.DataBind() DdlCuenta.DataBind()
DdlProveedor.DataBind() DdlProveedor.DataBind()
'DdlPersonal.DataBind() 'DdlPersonal.DataBind()
DdlClasificacion.DataBind() DdlClasificacion.DataBind()
DdlAlmacen.DataBind() DdlAlmacen.DataBind()
DdlCuentaBancaria.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlConceptoNomina.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlConceptoNomina.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlCconceptosContables.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlCconceptosContables.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlCuenta.Items.Insert(0, New ListItem("Seleccione", "-1")) DdlCuenta.Items.Insert(0, New ListItem("Seleccione", "-1"))
@@ -71,16 +79,20 @@ Partial Class Contabilidad2_CatCuentasAsignaciones
End Sub End Sub
Protected Sub ActualizaModulo(sender As Object, e As EventArgs) Protected Sub ActualizaModulo(sender As Object, e As EventArgs)
LimpiarDatos()
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
CveConceptoAsignacion = GvRow.DataKey("CveCuentaAsignacion").ToEntero CveConceptoAsignacion = GvRow.DataKey("CveCuentaAsignacion").ToEntero
DdlCconceptosContables.SelectedValue = GvRow.DataKey("CveConceptoContable").ToEntero DdlCconceptosContables.SelectedValue = GvRow.DataKey("CveConceptoContable").ToEntero
DdlCuenta.SelectedValue = GvRow.DataKey("CveCuenta").ToEntero DdlCuenta.SelectedValue = GvRow.DataKey("CveCuenta").ToEntero
DdlConceptoNomina.SelectedValueexist(GvRow.DataKey("CveConceptoNomina").ToEntero) DdlConceptoNomina.SelectedValueExist(GvRow.DataKey("CveConceptoNomina").ToEntero)
DdlProveedor.SelectedValue = GvRow.DataKey("CveProveedor").ToEntero DdlProveedor.SelectedValue = GvRow.DataKey("CveProveedor").ToEntero
DdlClasificacion.SelectedValue = GvRow.DataKey("CveClasificacion").ToEntero DdlClasificacion.SelectedValue = GvRow.DataKey("CveClasificacion").ToEntero
DdlAlmacen.SelectedValue = GvRow.DataKey("CveAlmacen").ToEntero DdlAlmacen.SelectedValue = GvRow.DataKey("CveAlmacen").ToEntero
TxtIdCuentaContable.Text = GvRow.DataKey("IdCuenta") TxtIdCuentaContable.Text = GvRow.DataKey("IdCuenta")
TxtPorcentajeIVA.Text = GvRow.DataKey("PorcentajeIVA") TxtPorcentajeIVA.Text = GvRow.DataKey("PorcentajeIVA")
DdlCuentaBancaria.SelectedValueExist(GvRow.DataKey("CveBancoCuenta"))
Dim CveCliente As Integer = GvRow.DataKey("CveCliente").ToEntero Dim CveCliente As Integer = GvRow.DataKey("CveCliente").ToEntero
Dim CvePersonal As Integer = GvRow.DataKey("CvePersonal").ToEntero Dim CvePersonal As Integer = GvRow.DataKey("CvePersonal").ToEntero
@@ -120,14 +132,23 @@ Partial Class Contabilidad2_CatCuentasAsignaciones
ObjConta.Dispose() ObjConta.Dispose()
End Sub End Sub
Protected Sub BtnAgregarMotivoD_Click(sender As Object, e As EventArgs) Handles BtnAgregarMotivoD.Click Protected Sub BtnAgregarMotivoD_Click(sender As Object, e As EventArgs) Handles BtnAgregarMotivoD.Click
LimpiarDatos()
LbAgregar.Text = "Agregar"
UpModalModulos.Update()
RegistraScript("$('#ModalCat').modal();")
End Sub
Private Sub LimpiarDatos()
CveConceptoAsignacion = -1 CveConceptoAsignacion = -1
DdlCconceptosContables.SelectedValue = -1 DdlCconceptosContables.SelectedValue = -1
DdlCuenta.SelectedValue = -1 DdlCuenta.SelectedValue = -1
DdlProveedor.SelectedValue = -1 DdlProveedor.SelectedValue = -1
DdlClasificacion.SelectedValue = -1 DdlClasificacion.SelectedValue = -1
DdlAlmacen.SelectedValue = -1 DdlAlmacen.SelectedValue = -1
DdlConceptoNomina.SelectedValue = -1 DdlConceptoNomina.SelectedValue = -1
DdlCuentaBancaria.SelectedValueExist("-1")
TxtIdCuentaContable.Text = "" TxtIdCuentaContable.Text = ""
TxtPorcentajeIVA.Text = "" TxtPorcentajeIVA.Text = ""
DdlClientes.ddl.DataSource = "" DdlClientes.ddl.DataSource = ""
@@ -135,10 +156,7 @@ Partial Class Contabilidad2_CatCuentasAsignaciones
DdlClientes.setEsWebService(True) DdlClientes.setEsWebService(True)
DdlPersonal.ddl.DataSource = "" DdlPersonal.ddl.DataSource = ""
DdlPersonal.ddl.DataBind() DdlPersonal.ddl.DataBind()
DdlPersonal.setEsWebService(True) DdlPersonal.setEsWebService(True)
LbAgregar.Text = "Agregar"
UpModalModulos.Update()
RegistraScript("$('#ModalCat').modal();")
End Sub End Sub
Protected Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click Protected Sub LbAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click
@@ -147,13 +165,13 @@ Partial Class Contabilidad2_CatCuentasAsignaciones
If LbAgregar.Text = "Agregar" Then If LbAgregar.Text = "Agregar" Then
If Not ObjConta.AddCuentasAsignaciones(DdlCconceptosContables.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlCuenta.SelectedValue.ToEntero, TxtIdCuentaContable.Text.ToEntero, If Not ObjConta.AddCuentasAsignaciones(DdlCconceptosContables.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlCuenta.SelectedValue.ToEntero, TxtIdCuentaContable.Text.ToEntero,
DdlProveedor.SelectedValue.ToEntero, DdlClientes.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero, DdlProveedor.SelectedValue.ToEntero, DdlClientes.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero,
DdlClasificacion.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, TxtPorcentajeIVA.Text.ToDecimal) Then DdlClasificacion.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, TxtPorcentajeIVA.Text.ToDecimal, CveBancoCuenta:=DdlCuentaBancaria.SelectedValue.ToEntero) Then
ErrorString = "Error al agregar" ErrorString = "Error al agregar"
End If End If
ElseIf LbAgregar.Text = "Actualizar" Then ElseIf LbAgregar.Text = "Actualizar" Then
If Not ObjConta.UpdateCuentasAsignaciones(CveConceptoAsignacion, DdlCconceptosContables.SelectedValue.ToEntero, DdlCuenta.SelectedValue.ToEntero, TxtIdCuentaContable.Text.ToEntero, If Not ObjConta.UpdateCuentasAsignaciones(CveConceptoAsignacion, DdlCconceptosContables.SelectedValue.ToEntero, DdlCuenta.SelectedValue.ToEntero, TxtIdCuentaContable.Text.ToEntero,
DdlProveedor.SelectedValue.ToEntero, DdlClientes.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero, DdlProveedor.SelectedValue.ToEntero, DdlClientes.SelectedValue.ToEntero, DdlPersonal.SelectedValue.ToEntero,
DdlClasificacion.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, TxtPorcentajeIVA.Text.ToDecimal) Then DdlClasificacion.SelectedValue.ToEntero, DdlAlmacen.SelectedValue.ToEntero, TxtPorcentajeIVA.Text.ToDecimal, CveBancoCuenta:=DdlCuentaBancaria.SelectedValue.ToEntero) Then
ErrorString = "Error al actualizar" ErrorString = "Error al actualizar"
End If End If
End If End If

View File

@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Report xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner" xmlns:cl="http://schemas.microsoft.com/sqlserver/reporting/2010/01/componentdefinition" xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition"> <Report xmlns="http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition" xmlns:rd="http://schemas.microsoft.com/SQLServer/reporting/reportdesigner">
<AutoRefresh>0</AutoRefresh> <AutoRefresh>0</AutoRefresh>
<DataSources> <DataSources>
<DataSource Name="DataSet1"> <DataSource Name="DataSet1">
@@ -171,7 +171,6 @@
<PaddingBottom>2pt</PaddingBottom> <PaddingBottom>2pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
@@ -461,7 +460,6 @@
</Style> </Style>
</Textbox> </Textbox>
<ColSpan>7</ColSpan> <ColSpan>7</ColSpan>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell /> <TablixCell />
@@ -553,7 +551,6 @@
<PaddingBottom>2pt</PaddingBottom> <PaddingBottom>2pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
@@ -774,7 +771,6 @@
<PaddingBottom>1pt</PaddingBottom> <PaddingBottom>1pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
@@ -885,40 +881,40 @@
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Cargo2"> <Textbox Name="Cargo">
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>= Fields!Cargo.Value</Value> <Value>=Fields!Cargo.Value</Value>
<Style> <Style>
<FontFamily>calibri</FontFamily> <FontFamily>calibri</FontFamily>
<FontSize>8pt</FontSize> <FontSize>8pt</FontSize>
<Format>#,0.00</Format> <Format>#,0.00</Format>
<Language>es-MX</Language> <Language>es-MX</Language>
</Style> </Style>
</TextRun> </TextRun>
</TextRuns> </TextRuns>
<Style>
<TextAlign>Right</TextAlign>
</Style>
</Paragraph>
</Paragraphs>
<rd:DefaultName>Cargo</rd:DefaultName>
<Visibility>
<Hidden>=iif(Fields!TipoMovto.Value = "1", true, false)</Hidden>
</Visibility>
<Style> <Style>
<TextAlign>Right</TextAlign> <Border>
<Style>None</Style>
</Border>
<PaddingLeft>1pt</PaddingLeft>
<PaddingRight>1pt</PaddingRight>
<PaddingTop>1pt</PaddingTop>
<PaddingBottom>1pt</PaddingBottom>
</Style> </Style>
</Paragraph> </Textbox>
</Paragraphs>
<Visibility>
<Hidden>=iif(Fields!TipoMovto.Value ="0",False,True)</Hidden>
</Visibility>
<Style>
<Border>
<Style>None</Style>
</Border>
<PaddingLeft>1pt</PaddingLeft>
<PaddingRight>1pt</PaddingRight>
<PaddingTop>1pt</PaddingTop>
<PaddingBottom>1pt</PaddingBottom>
<rd:FormatSymbolCulture>es-MX</rd:FormatSymbolCulture>
</Style>
</Textbox>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
@@ -929,7 +925,7 @@
<Paragraph> <Paragraph>
<TextRuns> <TextRuns>
<TextRun> <TextRun>
<Value>= Fields!Abono.Value</Value> <Value>=Fields!Abono.Value</Value>
<Style> <Style>
<FontFamily>calibri</FontFamily> <FontFamily>calibri</FontFamily>
<FontSize>8pt</FontSize> <FontSize>8pt</FontSize>
@@ -946,7 +942,7 @@
</Paragraphs> </Paragraphs>
<rd:DefaultName>Abono</rd:DefaultName> <rd:DefaultName>Abono</rd:DefaultName>
<Visibility> <Visibility>
<Hidden>=iif(Fields!TipoMovto.Value ="1",False,True)</Hidden> <Hidden>=iif(Fields!TipoMovto.Value = "0", true, false)</Hidden>
</Visibility> </Visibility>
<Style> <Style>
<Border> <Border>
@@ -959,6 +955,7 @@
<rd:FormatSymbolCulture>es-MX</rd:FormatSymbolCulture> <rd:FormatSymbolCulture>es-MX</rd:FormatSymbolCulture>
</Style> </Style>
</Textbox> </Textbox>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
</TablixCells> </TablixCells>
@@ -996,7 +993,6 @@
<PaddingBottom>1pt</PaddingBottom> <PaddingBottom>1pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
@@ -1071,7 +1067,7 @@
<TablixCell /> <TablixCell />
<TablixCell> <TablixCell>
<CellContents> <CellContents>
<Textbox Name="Textbox113"> <Textbox Name="Textbox6">
<CanGrow>true</CanGrow> <CanGrow>true</CanGrow>
<KeepTogether>true</KeepTogether> <KeepTogether>true</KeepTogether>
<Paragraphs> <Paragraphs>
@@ -1091,7 +1087,7 @@
</Style> </Style>
</Paragraph> </Paragraph>
</Paragraphs> </Paragraphs>
<rd:DefaultName>Textbox113</rd:DefaultName> <rd:DefaultName>Textbox6</rd:DefaultName>
<Style> <Style>
<Border> <Border>
<Style>None</Style> <Style>None</Style>
@@ -1211,7 +1207,6 @@
<PaddingBottom>1pt</PaddingBottom> <PaddingBottom>1pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell> <TablixCell>
@@ -1546,7 +1541,6 @@
</Style> </Style>
</Textbox> </Textbox>
<ColSpan>3</ColSpan> <ColSpan>3</ColSpan>
<rd:Selected>true</rd:Selected>
</CellContents> </CellContents>
</TablixCell> </TablixCell>
<TablixCell /> <TablixCell />
@@ -2052,6 +2046,7 @@
<Prompt>ReportParameter1</Prompt> <Prompt>ReportParameter1</Prompt>
</ReportParameter> </ReportParameter>
</ReportParameters> </ReportParameters>
<Code> <Code>
REM Reset Page Number: REM Reset Page Number:
Shared offset As Integer Shared offset As Integer

View File

@@ -2869,6 +2869,21 @@
<PaddingBottom>2pt</PaddingBottom> <PaddingBottom>2pt</PaddingBottom>
</Style> </Style>
</Textbox> </Textbox>
<Image Name="Image1">
<Source>Embedded</Source>
<Value>ID2</Value>
<Sizing>FitProportional</Sizing>
<Top>0.29668cm</Top>
<Left>1.15361cm</Left>
<Height>2.413cm</Height>
<Width>2.75323cm</Width>
<ZIndex>30</ZIndex>
<Style>
<Border>
<Style>None</Style>
</Border>
</Style>
</Image>
</ReportItems> </ReportItems>
<Height>19.04565cm</Height> <Height>19.04565cm</Height>
<Style /> <Style />
@@ -3580,6 +3595,12 @@
<AllowBlank>true</AllowBlank> <AllowBlank>true</AllowBlank>
<Prompt>ReportParameter1</Prompt> <Prompt>ReportParameter1</Prompt>
</ReportParameter> </ReportParameter>
<ReportParameter Name="QRDescarga">
<DataType>String</DataType>
<Nullable>true</Nullable>
<AllowBlank>true</AllowBlank>
<Prompt>ReportParameter1</Prompt>
</ReportParameter>
</ReportParameters> </ReportParameters>
<EmbeddedImages> <EmbeddedImages>

View File

@@ -39,23 +39,22 @@ Partial Class GPS_PuntosDeInteres
End Sub End Sub
Private Sub CargaDatos() Private Sub CargaDatos()
Dim gps As New ClsGPS Dim ObjGPS As New ClsGPS
If gps.PuntoDeInteresGrupoGet(-1, 1) Then If ObjGPS.PuntoDeInteresGrupoGet(UsuarioActual.CveCliente, 1) Then
GvGrupos.DataSource = gps.DtResultados GvGrupos.DataSource = ObjGPS.DtResultados
Else
GvGrupos.DataSource = Nothing
End If End If
If gps.PuntoDeInteresGet(-1, UsuarioActual.CveCliente, 1, -1) Then
GvPuntos.DataSource = gps.DtResultados If ObjGPS.PuntoDeInteresGet(-1, UsuarioActual.CveCliente, 1, -1) Then
GVPuntosInteres.DataSource = gps.DtResultados GvPuntos.DataSource = ObjGPS.DtResultados
Else GVPuntosInteres.DataSource = ObjGPS.DtResultados
GvPuntos.DataSource = Nothing
GVPuntosInteres.DataSource = Nothing
End If End If
gps.Dispose()
ObjGPS.Dispose()
GvGrupos.DataBind() GvGrupos.DataBind()
GvPuntos.DataBind() GvPuntos.DataBind()
GVPuntosInteres.DataBind() GVPuntosInteres.DataBind()
UpEditar.Update() UpEditar.Update()
End Sub End Sub
@@ -65,7 +64,6 @@ Partial Class GPS_PuntosDeInteres
End If End If
End Sub End Sub
Protected Sub BtnAgregarPunto_Click(sender As Object, e As EventArgs) Handles BtnAgregarPunto.Click Protected Sub BtnAgregarPunto_Click(sender As Object, e As EventArgs) Handles BtnAgregarPunto.Click
Dim GPS As New ClsGPS Dim GPS As New ClsGPS
GPS.IniciaTransacSQL() GPS.IniciaTransacSQL()
@@ -110,7 +108,7 @@ Partial Class GPS_PuntosDeInteres
Alert("Es necesario seleccionar un grupo de puntos", TipoMensaje.MsgAdvertencia) Alert("Es necesario seleccionar un grupo de puntos", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
End If End If
If GPS.PuntoDeInteresGet(-1, -1, 1, HdnGrupo.Value.ToEntero) AndAlso GPS.DtResultados.Rows.Count > 0 Then If GPS.PuntoDeInteresGet(-1, UsuarioActual.CveCliente, 1, HdnGrupo.Value.ToEntero) AndAlso GPS.DtResultados.Rows.Count > 0 Then
Dim ruta As String = "" Dim ruta As String = ""
For Each row As DataRow In GPS.DtResultados.Rows For Each row As DataRow In GPS.DtResultados.Rows
ruta += row("Punto").ToString.Replace("POINT (", "").Replace(")", ",") ruta += row("Punto").ToString.Replace("POINT (", "").Replace(")", ",")

View File

@@ -1,46 +1,46 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/SiteGPS.master" AutoEventWireup="false" CodeFile="RepPuntosDeInteres.aspx.vb" Inherits="GPS_RepPuntosDeInteres" %> <%@ Page Title="" Language="VB" MasterPageFile="~/SiteGPS.master" AutoEventWireup="false" CodeFile="RepPuntosDeInteres.aspx.vb" Inherits="GPS_RepPuntosDeInteres" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server"> <asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content> </asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server"> <asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<link href="../Metronic/assets/global/plugins/jquery-minicolors/jquery.minicolors.css" rel="stylesheet" /> <link href="../Metronic/assets/global/plugins/jquery-minicolors/jquery.minicolors.css" rel="stylesheet" />
<style> <style>
html, body { html, body {
width: 100%; width: 100%;
height: 100%; height: 100%;
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
#map { #map {
width: 100%; width: 100%;
height: calc(100% - 51px); height: calc(100% - 51px);
margin: 0; margin: 0;
padding: 0; padding: 0;
} }
#map { #map {
position: fixed !important; position: fixed !important;
} }
.pac-container.pac-logo { .pac-container.pac-logo {
z-index: 100000; z-index: 100000;
} }
#showdiv1 { #showdiv1 {
left: 0 !important; left: 0 !important;
width: 100% !important; width: 100% !important;
} }
#ShowDiv3:hover { #ShowDiv3:hover {
line-height: 34px !important; line-height: 34px !important;
-webkit-transition: line-height ease 1s; -webkit-transition: line-height ease 1s;
-moz-transition: line-height ease 1s; -moz-transition: line-height ease 1s;
-o-transition: line-height ease 1s; -o-transition: line-height ease 1s;
transition: line-height ease 1s; transition: line-height ease 1s;
} }
.ADScroller-body { .ADScroller-body {
max-height: 400px; max-height: 400px;
} }
@@ -53,7 +53,7 @@
margin-bottom: 10px; margin-bottom: 10px;
} }
#iw-container .iw-title { #iw-container .iw-title {
font-family: 'Open Sans Condensed', sans-serif; font-family: 'Open Sans Condensed', sans-serif;
font-size: 22px; font-size: 22px;
font-weight: 400; font-weight: 400;
@@ -62,9 +62,9 @@
color: white; color: white;
margin: 0; margin: 0;
border-radius: 2px 2px 0 0; border-radius: 2px 2px 0 0;
} }
#iw-container .iw-content { #iw-container .iw-content {
font-size: 13px; font-size: 13px;
line-height: 18px; line-height: 18px;
font-weight: 400; font-weight: 400;
@@ -73,7 +73,7 @@
max-height: 140px; max-height: 140px;
overflow-y: auto; overflow-y: auto;
overflow-x: hidden; overflow-x: hidden;
} }
.iw-content img { .iw-content img {
float: right; float: right;
@@ -158,135 +158,160 @@
.form-horizontal .control-label { .form-horizontal .control-label {
text-align: left; text-align: left;
} }
</style> </style>
</asp:Content> </asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server"> <asp:Content ID="Content3" ContentPlaceHolderID="C" runat="Server">
<div id="map"></div> <div id="map"></div>
<div id="dvConsulta" class="modal ADS fade" role="dialog"> <div id="dvConsulta" class="modal ADS fade" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
<asp:UpdatePanel ID="UPConsulta" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UPConsulta" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
<h4 class="modal-title" id="H1" runat="server">Consultar Reporte de Puntos</h4> <h4 class="modal-title" id="H1" runat="server">Consultar Reporte de Puntos</h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<ul class="list-inline" style="font-size: 12px; margin-top: 15px; margin-left: 0px; margin-bottom: 20px;"> <ul class="list-inline" style="font-size: 12px; margin-top: 15px; margin-left: 0px; margin-bottom: 20px;">
<li>Fecha Inicio: <li>Fecha Inicio:
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy hh:mm" >
<asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control input-sm ADDateTimePicker" CausesValidation="true" MaxLength="18" Width="132px "></asp:TextBox> <div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy hh:mm">
<asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Inicio''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpFechas"></asp:RequiredFieldValidator> <asp:TextBox ID="txtFechaI" runat="server" CssClass="form-control input-sm ADDateTimePicker" CausesValidation="true" MaxLength="18" Width="132px "></asp:TextBox>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator4" Width="350px"></ajax:ValidatorCalloutExtender> <asp:RequiredFieldValidator ID="RequiredFieldValidator4" runat="server" ControlToValidate="txtFechaI" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Inicio''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpFechas"></asp:RequiredFieldValidator>
</div> <ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator4" Width="350px"></ajax:ValidatorCalloutExtender>
</li> </div>
</li>
<li>Fecha Fin: <li>Fecha Fin:
<div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy">
<asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control input-sm ADDateTimePicker" CausesValidation="true" MaxLength="18" Width="132px "></asp:TextBox> <div class="input-group input-sm date date-picker " data-date-format="dd/mm/yyyy">
<asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Fin''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpFechas"></asp:RequiredFieldValidator> <asp:TextBox ID="txtFechaF" runat="server" CssClass="form-control input-sm ADDateTimePicker" CausesValidation="true" MaxLength="18" Width="132px "></asp:TextBox>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator5" Width="350px"></ajax:ValidatorCalloutExtender> <asp:RequiredFieldValidator ID="RequiredFieldValidator5" runat="server" ControlToValidate="txtFechaF" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Fin''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpFechas"></asp:RequiredFieldValidator>
</div> <ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="RequiredFieldValidator5" Width="350px"></ajax:ValidatorCalloutExtender>
</li> </div>
</ul> </li>
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left"> </ul>
<div style="margin-right: 15px"> <div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<input type="text" id="TxtBusquedaEventos" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaEventos','{0}')", GvPuntos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" /> <div style="margin-right: 15px">
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaEventos','{0}')", GvPuntos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a> <input type="text" id="TxtBusquedaEventos" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaEventos','{0}')", GvPuntos.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
</div> <a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusquedaEventos','{0}')", GvPuntos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div> </div>
<asp:GridView ID="GvPuntos" runat="server" GridLines="None" DataKeyNames="Punto,PuntoDeInteres,CvePuntoDeInteres" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-height="150" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros"> </div>
<Columns> <asp:GridView ID="GvPuntos" runat="server" GridLines="None" DataKeyNames="Punto,PuntoDeInteres,CvePuntoDeInteres" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-height="150" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="10%"> <Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="10%">
<HeaderTemplate> <HeaderTemplate>
<asp:CheckBox runat="server" ID="chkSelectAll" CssClass="ChkAllClickGR" /> <asp:CheckBox runat="server" ID="chkSelectAll" CssClass="ChkAllClickGR" />
</HeaderTemplate> </HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:CheckBox runat="server" ID="chkGR" CssClass="ChkAllGR" /> <asp:CheckBox runat="server" ID="chkGR" CssClass="ChkAllGR" />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField DataField="PuntoDeInteres" ItemStyle-Width="45%" HeaderText="Punto De Interés" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="PuntoDeInteres" ItemStyle-Width="45%" HeaderText="Punto De Interés" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Descripcion" ItemStyle-Width="45%" HeaderText="Descripción" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="Descripcion" ItemStyle-Width="45%" HeaderText="Descripción" ItemStyle-HorizontalAlign="Left" />
</Columns> </Columns>
</asp:GridView> </asp:GridView>
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left"> <div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
<div style="margin-right: 15px"> <div style="margin-right: 15px">
<input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDispositivos.ClientID) %>" data-height="150" style="display: inline-block; margin-right: -20px; width: 150px;" /> <input type="text" id="TxtBusqueda" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDispositivos.ClientID) %>" data-height="150" style="display: inline-block; margin-right: -20px; width: 150px;" />
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDispositivos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a> <a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvDispositivos.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div> </div>
</div> </div>
<asp:GridView ID="GvDispositivos" runat="server" GridLines="None" DataKeyNames="CveDispositivo,SerieVehiculo,DevID,NoEconomico,NombreVehiculo" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" data-heighterror="800" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros"> <asp:GridView ID="GvDispositivos" runat="server" GridLines="None" DataKeyNames="CveDispositivo,SerieVehiculo,DevID,NoEconomico,NombreVehiculo" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" data-heighterror="800" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
<Columns> <Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="10%"> <asp:TemplateField ItemStyle-HorizontalAlign="center" ItemStyle-Width="10%">
<HeaderTemplate> <HeaderTemplate>
<asp:CheckBox runat="server" ID="chkSelectAll" CssClass="ChkAllClickDisp" /> <asp:CheckBox runat="server" ID="chkSelectAll" CssClass="ChkAllClickDisp" />
</HeaderTemplate> </HeaderTemplate>
<ItemTemplate> <ItemTemplate>
<asp:CheckBox runat="server" ID="chkDis" CssClass="ChkAllDisp" /> <asp:CheckBox runat="server" ID="chkDis" CssClass="ChkAllDisp" />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField DataField="NoEconomico" ItemStyle-Width="25%" HeaderText="Número Económico" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="NoEconomico" ItemStyle-Width="25%" HeaderText="Número Económico" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="ModeloVehiculo" ItemStyle-Width="25%" HeaderText="Modelo Vehículo" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="ModeloVehiculo" ItemStyle-Width="25%" HeaderText="Modelo Vehículo" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="AñoVehiculo" ItemStyle-Width="25%" HeaderText="Año Vehículo" ItemStyle-HorizontalAlign="center" /> <asp:BoundField DataField="AñoVehiculo" ItemStyle-Width="25%" HeaderText="Año Vehículo" ItemStyle-HorizontalAlign="center" />
<asp:BoundField DataField="PlacasVehiculo" ItemStyle-Width="25%" HeaderText="Placas Vehículo" ItemStyle-HorizontalAlign="center" /> <asp:BoundField DataField="PlacasVehiculo" ItemStyle-Width="25%" HeaderText="Placas Vehículo" ItemStyle-HorizontalAlign="center" />
</Columns> </Columns>
</asp:GridView> </asp:GridView>
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<asp:LinkButton ID="BtnConsultar" runat="server" Text="Consultar Reporte" ValidationGroup="GrpFechas" CssClass="btn btn-primary"></asp:LinkButton> <asp:LinkButton ID="BtnConsultar" runat="server" Text="Consultar Reporte" ValidationGroup="GrpFechas" CssClass="btn btn-primary"></asp:LinkButton>
<button data-dismiss="modal" class="btn btn-default">Cancelar</button> <button data-dismiss="modal" class="btn btn-default">Cancelar</button>
</div> </div>
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>
</div> </div>
<asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpdatePanel1"> <asp:UpdatePanel runat="server" UpdateMode="Conditional" ID="UpdatePanel1">
<ContentTemplate> <ContentTemplate>
<asp:HiddenField runat="server" ID="HdnPunto" ClientIDMode="static" Value="0" /> <asp:HiddenField runat="server" ID="HdnPunto" ClientIDMode="static" Value="0" />
<asp:HiddenField runat="server" ID="HdnDispositivo" ClientIDMode="static" Value="0" /> <asp:HiddenField runat="server" ID="HdnDispositivo" ClientIDMode="static" Value="0" />
<div id="dvHistorico" class="modal ADS fade" role="dialog"> <div id="dvHistorico" class="modal ADS fade" role="dialog">
<div class="modal-dialog"> <div class="modal-dialog">
<asp:UpdatePanel ID="UpHistorico" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional"> <asp:UpdatePanel ID="UpHistorico" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate> <ContentTemplate>
<div class="modal-header"> <div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"> <button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span> <span aria-hidden="true">&times;</span>
</button> </button>
<h4 class="modal-title" id="H2" runat="server"><i class="fa fa-bell-o"></i>Historial Visitas: </h4> <h4 class="modal-title" id="H2" runat="server"><i class="fa fa-bell-o"></i>Historial Visitas: </h4>
</div> </div>
<div class="modal-body"> <div class="modal-body">
<asp:UpdatePanel runat="server" UpdateMode="conditional" ID="UpdatePanel3"> <asp:UpdatePanel runat="server" UpdateMode="conditional" ID="UpdatePanel3">
<ContentTemplate> <Triggers>
<div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left"> <asp:PostBackTrigger ControlID="LnkImprimirEXCELVisita" />
<div style="margin-right: 15px"> </Triggers>
<input type="text" id="TxtBusquedaHist" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GVHistorico.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" /> <ContentTemplate>
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GVHistorico.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a> <div class="row">
</div> <div class="col-md-3">
</div> <asp:Label runat="server" Text="Punto de Interés:"></asp:Label>
<asp:GridView ID="GVHistorico" runat="server" GridLines="None" DataKeyNames="CveDispositivoEvento" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-heightfijo="100" data-height="100" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros"> <br />
<Columns> <b>
<asp:BoundField DataField="Conductor" ItemStyle-Width="35%" HeaderStyle-HorizontalAlign="center" HeaderText="Conductor" ItemStyle-HorizontalAlign="left" /> <asp:Label ID="LblPU" runat="server" Text=""></asp:Label></b>
<asp:BoundField DataField="FechaEntrada" ItemStyle-Width="35%" HeaderStyle-HorizontalAlign="center" HeaderText="Fecha Visita" ItemStyle-HorizontalAlign="center" /> </div>
<asp:BoundField DataField="Duracion" DataFormatString="{0} Minutos" HeaderStyle-HorizontalAlign="center" HeaderText="Duración" ItemStyle-Width="30%" ItemStyle-HorizontalAlign="center" /> <div class="col-md-4">
</Columns> <asp:Label runat="server" Text="Vehículo:"></asp:Label>
</asp:GridView> <br />
</ContentTemplate> <b>
</asp:UpdatePanel> <asp:Label ID="LblUnidad" runat="server" Text=""></asp:Label></b>
</div> </div>
<div class="modal-footer"> <div class="col-md-1">
<asp:UpdatePanel runat="server" ID="uphidden"> <asp:LinkButton ID="LnkImprimirEXCELVisita" runat="server" OnClick="LnkImprimirEXCELVisita_Click" CssClass="btn btn-circle btn-sm green"><i class='fa fa-file-excel-o' aria-hidden='true'></i></asp:LinkButton>
<ContentTemplate> </div>
<asp:Button Style="display: none" ID="BtnCargarGV" runat="server" /> <div class="col-md-4">
</ContentTemplate> <div class="row" style="margin-left: 0px; margin-top: 5px; margin-bottom: 5px; text-align: right" align="left">
</asp:UpdatePanel> <div style="margin-right: 15px">
</div> <input type="text" id="TxtBusquedaHist" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GVHistorico.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />
</ContentTemplate> <a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GVHistorico.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</asp:UpdatePanel> </div>
</div> </div>
</div> </div>
</ContentTemplate> </div>
</asp:UpdatePanel>
<asp:GridView ID="GVHistorico" runat="server" GridLines="None" DataKeyNames="CveDispositivoEvento" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-heightfijo="100" data-height="100" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" EmptyDataText="No se encontraron registros">
<Columns>
<asp:BoundField DataField="Conductor" ItemStyle-Width="35%" HeaderStyle-HorizontalAlign="center" HeaderText="Conductor" ItemStyle-HorizontalAlign="left" />
<asp:BoundField DataField="FechaEntrada" ItemStyle-Width="35%" HeaderStyle-HorizontalAlign="center" HeaderText="Fecha Visita" ItemStyle-HorizontalAlign="center" />
<asp:BoundField DataField="Duracion" DataFormatString="{0} Minutos" HeaderStyle-HorizontalAlign="center" HeaderText="Duración" ItemStyle-Width="30%" ItemStyle-HorizontalAlign="center" />
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server" ID="uphidden">
<ContentTemplate>
<asp:Button Style="display: none" ID="BtnCargarGV" runat="server" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="modal fade bottom in" style="bottom: unset; z-index: 539" id="h"> <div class="modal fade bottom in" style="bottom: unset; z-index: 539" id="h">
<div class="modal-dialog" style="position: fixed; bottom: 0; margin: 0px,0px,0px,0px; width: 100%; padding: 0px, 0px, 0px, 0px; border-style: solid; border-color: rgb(68, 77, 88); z-index: 539;"> <div class="modal-dialog" style="position: fixed; bottom: 0; margin: 0px,0px,0px,0px; width: 100%; padding: 0px, 0px, 0px, 0px; border-style: solid; border-color: rgb(68, 77, 88); z-index: 539;">
<div class="modal-content"> <div class="modal-content">
@@ -307,8 +332,9 @@
<Columns> <Columns>
<asp:BoundField DataField="Vehiculo" ItemStyle-Width="30%" HeaderText="Vehículo" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="Vehiculo" ItemStyle-Width="30%" HeaderText="Vehículo" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="PuntoDeInteres" ItemStyle-Width="30%" HeaderText="Punto De Interes" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="PuntoDeInteres" ItemStyle-Width="30%" HeaderText="Punto De Interes" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField DataField="Visitas" ItemStyle-Width="20%" DataFormatString="{0} Visitas" HeaderText="Visitas" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField DataField="Visitas" ItemStyle-Width="10%" DataFormatString="{0} Visitas" HeaderText="Visitas" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField DataField="UltimaVisita" ItemStyle-Width="20%" DataFormatString="{0:dd/MM/yyyy}" HeaderText="Ultima Visita" ItemStyle-HorizontalAlign="Center" /> <asp:BoundField DataField="UltimaVisita" ItemStyle-Width="20%" DataFormatString="{0:dd/MM/yyyy}" HeaderText="Ultima Visita" ItemStyle-HorizontalAlign="Center" />
<asp:HyperLinkField HeaderText="Posición" Text="Ver en google maps" ItemStyle-Width="10%" DataNavigateUrlFields="LigaMapa" Target="_blank" />
</Columns> </Columns>
<PagerSettings Mode="NextPrevious" Visible="true" Position="Top" /> <PagerSettings Mode="NextPrevious" Visible="true" Position="Top" />
</asp:GridView> </asp:GridView>
@@ -319,19 +345,19 @@
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<div runat="server" class="row" style="margin: 0px 0px 10px 0px; display: none"> <div runat="server" class="row" style="margin: 0px 0px 10px 0px; display: none">
<asp:Button runat="server" OnClick="btnImprimir_Click" ID="btnImprimir" CommandArgument="PDF" ToolTip="Imprimir en PDF" CssClass="btn btn-circle btn-sm grey" Text="<i class='fa fa-print' aria-hidden='true'></i>"></asp:Button> <asp:Button runat="server" OnClick="btnImprimir_Click" ID="btnImprimir" CommandArgument="PDF" ToolTip="Imprimir en PDF" CssClass="btn btn-circle btn-sm grey" Text="<i class='fa fa-print' aria-hidden='true'></i>"></asp:Button>
<asp:Button runat="server" OnClick="btnImprimir_Click" ID="BtnImprimirEX" CommandArgument="EXCEL" ToolTip="Imprimir en EXCEL" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-file-excel-o' aria-hidden='true'></i>"></asp:Button> <asp:Button runat="server" OnClick="btnImprimir_Click" ID="BtnImprimirEX" CommandArgument="EXCEL" ToolTip="Imprimir en EXCEL" CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-file-excel-o' aria-hidden='true'></i>"></asp:Button>
</div> </div>
</asp:Content> </asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="H" runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="H" runat="Server">
<li> <li>
<asp:LinkButton ID="BtnRep" OnClientClick="CargaDivs('Rep');return false;" Text="<i class='fa fa-location-arrow'></i><span>Reporte de puntos</span>" runat="server"> <asp:LinkButton ID="BtnRep" OnClientClick="CargaDivs('Rep');return false;" Text="<i class='fa fa-location-arrow'></i><span>Reporte de puntos</span>" runat="server">
</asp:LinkButton> </asp:LinkButton>
</li> </li>
</asp:Content> </asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="JS" runat="Server"> <asp:Content ID="Content5" ContentPlaceHolderID="JS" runat="Server">
<script> <script>
function doScaledCLick(boton) { function doScaledCLick(boton) {
@@ -350,10 +376,10 @@
$('body').on('click', '.ChkAllClickGR input', function () { $(".ChkAllGR input").not(this).prop('checked', $('.ChkAllClickGR input').is(':checked')); }); $('body').on('click', '.ChkAllClickGR input', function () { $(".ChkAllGR input").not(this).prop('checked', $('.ChkAllClickGR input').is(':checked')); });
$('body').on('click', '.ChkAllClickDisp input', function () { $(".ChkAllDisp input").not(this).prop('checked', $('.ChkAllClickDisp input').is(':checked')); }); $('body').on('click', '.ChkAllClickDisp input', function () { $(".ChkAllDisp input").not(this).prop('checked', $('.ChkAllClickDisp input').is(':checked')); });
function initMap() { function initMap() {
map = new google.maps.Map(document.getElementById('map'), { map = new google.maps.Map(document.getElementById('map'), {
center: { lat: 19.4326, lng: -99.13329 }, center: { lat: 19.4326, lng: -99.13329 },
zoom: 8 zoom: 8
}); });
var ShowDiv1 = document.createElement('div'); var ShowDiv1 = document.createElement('div');
@@ -364,16 +390,16 @@
map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(ShowDiv1); map.controls[google.maps.ControlPosition.BOTTOM_CENTER].push(ShowDiv1);
if (navigator.geolocation) { if (navigator.geolocation) {
navigator.geolocation.getCurrentPosition(function (position) { navigator.geolocation.getCurrentPosition(function (position) {
var pos = { var pos = {
lat: position.coords.latitude, lat: position.coords.latitude,
lng: position.coords.longitude lng: position.coords.longitude
}; };
map.setCenter(pos); map.setCenter(pos);
}, function () { }, function () {
handleLocationError(true, infoWindow, map.getCenter()); handleLocationError(true, infoWindow, map.getCenter());
}); });
} }
//CargaPickers(); //CargaPickers();
////directionsService = new google.maps.DirectionsService; ////directionsService = new google.maps.DirectionsService;
@@ -567,43 +593,43 @@
} }
} }
function CargaDivs(Tipo) { function CargaDivs(Tipo) {
if (Tipo === "PointGroup") { if (Tipo === "PointGroup") {
$("#C_TxtNombre").val("") $("#C_TxtNombre").val("")
$("#C_TxtDescripcion").val("") $("#C_TxtDescripcion").val("")
$('#divAgregarTipo').modal(); $('#divAgregarTipo').modal();
$("#HdnTipo").val(Tipo) $("#HdnTipo").val(Tipo)
$("#lblPuntos").text("Nombre Grupo de Puntos") $("#lblPuntos").text("Nombre Grupo de Puntos")
$("#dvEventos").css("display", "none") $("#dvEventos").css("display", "none")
$("#dvAdd").css("display", "") $("#dvAdd").css("display", "")
} }
else if (Tipo === "Point") { else if (Tipo === "Point") {
if (markers.length > 0) { if (markers.length > 0) {
$('#divAgregarTipo').modal(); $('#divAgregarTipo').modal();
$("#C_TxtNombre").val("") $("#C_TxtNombre").val("")
$("#C_TxtDescripcion").val("") $("#C_TxtDescripcion").val("")
$("#HdnTipo").val(Tipo) $("#HdnTipo").val(Tipo)
$("#lblPuntos").text("Nombre Punto(s) de Interés") $("#lblPuntos").text("Nombre Punto(s) de Interés")
$("#dvEventos").css("display", "") $("#dvEventos").css("display", "")
$("#dvAdd").css("display", "") $("#dvAdd").css("display", "")
} else { DeleteMarkers(); alert('Haga click en el mapa para dibujar puntos de interés') } } else { DeleteMarkers(); alert('Haga click en el mapa para dibujar puntos de interés') }
} }
else if (Tipo === "GroupRoute") { else if (Tipo === "GroupRoute") {
DeleteMarkers(); DeleteMarkers();
$("#C_TxtNombre").val("1") $("#C_TxtNombre").val("1")
$("#C_TxtDescripcion").val("1") $("#C_TxtDescripcion").val("1")
$('#divAgregarTipo').modal(); $('#divAgregarTipo').modal();
$("#HdnTipo").val(Tipo) $("#HdnTipo").val(Tipo)
$("#dvEventos").css("display", "") $("#dvEventos").css("display", "")
$("#dvAdd").css("display", "none") $("#dvAdd").css("display", "none")
} }
else if (Tipo === "Route") { else if (Tipo === "Route") {
DeleteMarkers(); DeleteMarkers();
$('#dvConsulta').modal({ backdrop: 'static', keyboard: false });
} else if (Tipo === "Rep") {
$('#dvConsulta').modal({ backdrop: 'static', keyboard: false }); $('#dvConsulta').modal({ backdrop: 'static', keyboard: false });
} else if (Tipo === "Rep") { CargaPickers();
$('#dvConsulta').modal({ backdrop: 'static', keyboard: false }); }
CargaPickers();
}
} }
@@ -618,85 +644,85 @@
// center: coords, // center: coords,
// radius: 15 // radius: 15
//}); //});
var Circle = new google.maps.Marker({ var Circle = new google.maps.Marker({
position: coords, position: coords,
icon: { icon: {
path: google.maps.SymbolPath.CIRCLE, path: google.maps.SymbolPath.CIRCLE,
scale: 10, scale: 10,
fillColor: color, fillColor: color,
fillOpacity: 0.35, fillOpacity: 0.35,
strokeWeight: 2, strokeWeight: 2,
strokeColor: color, strokeColor: color,
strokeOpacity: 0.8 strokeOpacity: 0.8
}, },
map: map map: map
}); });
circles.push(Circle); circles.push(Circle);
} }
function DeleteMarkers() { function DeleteMarkers() {
for (var i = 0; i < markers.length; i++) { for (var i = 0; i < markers.length; i++) {
markers[i].setMap(null); markers[i].setMap(null);
} }
markers = []; markers = [];
for (var i = 0; i < circles.length; i++) { for (var i = 0; i < circles.length; i++) {
circles[i].setMap(null); circles[i].setMap(null);
} }
circles = []; circles = [];
markers = []; markers = [];
} }
function CreaMarcador(coords, nomPunto, ContentString) { function CreaMarcador(coords, nomPunto, ContentString) {
var marker = new google.maps.Marker({ var marker = new google.maps.Marker({
position: coords, position: coords,
title: nomPunto, title: nomPunto,
map: map map: map
}); });
var infowindow = new google.maps.InfoWindow({ var infowindow = new google.maps.InfoWindow({
content: ContentString content: ContentString
}); });
marker.addListener('click', function () { marker.addListener('click', function () {
closeLastOpenedInfoWindow(); closeLastOpenedInfoWindow();
infowindow.open(map, marker); infowindow.open(map, marker);
lastOpenedInfoWindow = infowindow; lastOpenedInfoWindow = infowindow;
}); });
markers.push(marker); markers.push(marker);
if (markers.length > 1) { if (markers.length > 1) {
fitBoundsToVisibleMarkers() fitBoundsToVisibleMarkers()
} else if (markers.length === 1) { } else if (markers.length === 1) {
map.setZoom(15); map.setZoom(15);
map.setCenter(coords); map.setCenter(coords);
} }
} }
function closeLastOpenedInfoWindow() { function closeLastOpenedInfoWindow() {
if (lastOpenedInfoWindow) { if (lastOpenedInfoWindow) {
lastOpenedInfoWindow.close(); lastOpenedInfoWindow.close();
} }
} }
function fitBoundsToVisibleMarkers() { function fitBoundsToVisibleMarkers() {
var bounds = new google.maps.LatLngBounds(); var bounds = new google.maps.LatLngBounds();
for (var i = 0; i < markers.length; i++) { for (var i = 0; i < markers.length; i++) {
if (markers[i].getVisible()) { if (markers[i].getVisible()) {
bounds.extend(markers[i].getPosition()); bounds.extend(markers[i].getPosition());
} }
} }
map.fitBounds(bounds); map.fitBounds(bounds);
} }
function CargaPickers() { function CargaPickers() {
$.datetimepicker.setLocale('es'); $.datetimepicker.setLocale('es');
$('input.ADDateTimePicker').each(function () { $('input.ADDateTimePicker').each(function () {
var TThis = $(this); var TThis = $(this);
if (Tthis.siblings().length <= 2) { if (Tthis.siblings().length <= 2) {
TThis.datetimepicker({ TThis.datetimepicker({
dayOfWeekStart: 1, dayOfWeekStart: 1,
lang: 'es', lang: 'es',
format: 'd/m/Y H:i', format: 'd/m/Y H:i',
formatDate: 'd/m/Y H:i', formatDate: 'd/m/Y H:i',
step: 30 step: 30
}); });
var Div = TThis.parent() var Div = TThis.parent()
var boton = document.createElement('span'); var boton = document.createElement('span');
@@ -705,25 +731,25 @@
var subboton = document.createElement('a') var subboton = document.createElement('a')
subboton.className = "btn default" subboton.className = "btn default"
subboton.innerHTML = "<i class='fa fa-calendar'></i>" subboton.innerHTML = "<i class='fa fa-calendar'></i>"
subboton.addEventListener('click', function () { subboton.addEventListener('click', function () {
TThis.datetimepicker('show') TThis.datetimepicker('show')
}); });
boton.appendChild(subboton) boton.appendChild(subboton)
Div[0].appendChild(boton) Div[0].appendChild(boton)
} }
}); });
} }
function CargaGV(CveDispositivo, CvePunto) { function CargaGV(CveDispositivo, CvePunto) {
$("#HdnPunto").val(CvePunto + '') $("#HdnPunto").val(CvePunto + '')
$("#HdnDispositivo").val(CveDispositivo + '') $("#HdnDispositivo").val(CveDispositivo + '')
$("#C_BtnCargarGV").click() $("#C_BtnCargarGV").click()
} }
</script> </script>
<script src="<%= String.Format("https://maps.googleapis.com/maps/api/js?key={0}&libraries=places&callback=initMap", Extensiones.GOOGLE_MAPS_API_KEY) %>"></script> <script src="<%= String.Format("https://maps.googleapis.com/maps/api/js?key={0}&libraries=places&callback=initMap", Extensiones.GOOGLE_MAPS_API_KEY) %>"></script>
<script src="../Metronic/assets/global/plugins/jquery-minicolors/jquery.minicolors.min.js"></script> <script src="../Metronic/assets/global/plugins/jquery-minicolors/jquery.minicolors.min.js"></script>
<script src="../Metronic/assets/global/plugins/jquery-minicolors/components-color-pickers.min.js"></script> <script src="../Metronic/assets/global/plugins/jquery-minicolors/components-color-pickers.min.js"></script>
</asp:Content> </asp:Content>

View File

@@ -3,6 +3,7 @@
Imports Extensiones Imports Extensiones
Imports System.Data Imports System.Data
Imports Microsoft.Reporting.WebForms Imports Microsoft.Reporting.WebForms
Imports GemBox.Spreadsheet
Partial Class GPS_RepPuntosDeInteres Partial Class GPS_RepPuntosDeInteres
Inherits ClsPaginas Inherits ClsPaginas
@@ -24,6 +25,14 @@ Partial Class GPS_RepPuntosDeInteres
ViewState("DtDatosReporte") = value ViewState("DtDatosReporte") = value
End Set End Set
End Property End Property
Private Property DtVisitas As DataTable
Get
Return If(IsNothing(ViewState("DtVisitas")), Nothing, CType(ViewState("DtVisitas"), DataTable))
End Get
Set(value As DataTable)
ViewState("DtVisitas") = value
End Set
End Property
#End Region #End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -32,6 +41,7 @@ Partial Class GPS_RepPuntosDeInteres
End If End If
End Sub End Sub
Private Sub CargaDatos() Private Sub CargaDatos()
DtDatosReporte = Nothing
txtFechaF.Text = Now.ToString("dd/MM/yyyy") txtFechaF.Text = Now.ToString("dd/MM/yyyy")
txtFechaI.Text = Now.AddDays(-7).ToString("dd/MM/yyyy") txtFechaI.Text = Now.AddDays(-7).ToString("dd/MM/yyyy")
@@ -66,6 +76,11 @@ Partial Class GPS_RepPuntosDeInteres
End Sub End Sub
Private Sub ReportePuntos(Dispositivos As String) Private Sub ReportePuntos(Dispositivos As String)
'LIMPIAR REPORTE
If DtDatosReporte IsNot Nothing Then
DtDatosReporte.Dispose()
DtDatosReporte = Nothing
End If
Dim FechaI, FechaF As Date Dim FechaI, FechaF As Date
Dim SBBody As New StringBuilder Dim SBBody As New StringBuilder
@@ -83,11 +98,15 @@ Partial Class GPS_RepPuntosDeInteres
Try Try
For Each row As GridViewRow In GvPuntos.Rows For Each row As GridViewRow In GvPuntos.Rows
SBBody.Clear() SBBody.Clear()
If row.FCCheckBox("chkGR").Checked Then If row.FCCheckBox("chkGR").Checked Then
If ObjGPS.RepPuntosGet(row.DataKey("CvePuntoDeInteres").ToEntero, Dispositivos, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, UsuarioActual.CveCliente) Then If ObjGPS.RepPuntosGet(row.DataKey("CvePuntoDeInteres").ToEntero, Dispositivos, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, UsuarioActual.CveCliente) Then
DtDatosReporte = ObjGPS.DtResultados.Copy() If DtDatosReporte IsNot Nothing Then
GvBarra.DataSource = DtDatosReporte DtDatosReporte.Merge(ObjGPS.DtResultados)
Else
DtDatosReporte = ObjGPS.DtResultados.Copy()
End If
Coords = SQLToGmaps(row.DataKey("Punto").ToString, "POINT") Coords = SQLToGmaps(row.DataKey("Punto").ToString, "POINT")
SBBody.Append($"<div>") SBBody.Append($"<div>")
@@ -98,7 +117,7 @@ Partial Class GPS_RepPuntosDeInteres
SBBody.Append($"<div><table>") SBBody.Append($"<div><table>")
For Each Cve As String In DispositivosLista For Each Cve As String In DispositivosLista
If ObjGPS.DtResultados.FiltraParametros($"CveDispositivo = {Cve} ").Rows.Count > 0 Then If ObjGPS.DtResultados.FiltraParametros($"CveDispositivo = {Cve} ").Rows.Count > 0 Then
SBBody.Append($"<tr><td><b>{ObjGPS.DtResultados.FiltroPrimeroValor("Vehiculo", $"CveDispositivo = {Cve}")}:</b> <a onclick=""CargaGV({Cve}, {row.DataKey("CvePuntoDeInteres")} )"">{ObjGPS.DtResultados.FiltroPrimeroValor("Visitas", $"CveDispositivo = {Cve}")} visitas<a></td></tr>") SBBody.Append($"<tr><td><b>{ObjGPS.DtResultados.FiltroPrimeroValor("Vehiculo", $"CveDispositivo = {Cve}")}:</b> <a onclick=""CargaGV({Cve}, {row.DataKey("CvePuntoDeInteres")})"">{ObjGPS.DtResultados.FiltroPrimeroValor("Visitas", $"CveDispositivo = {Cve}")} visitas<a></td></tr>")
SBBody.Append($"<tr><td>Última Visita: {ObjGPS.DtResultados.FiltroPrimeroValor("UltimaVisita", $"CveDispositivo = {Cve}")}</td></tr>") SBBody.Append($"<tr><td>Última Visita: {ObjGPS.DtResultados.FiltroPrimeroValor("UltimaVisita", $"CveDispositivo = {Cve}")}</td></tr>")
End If End If
Next Next
@@ -111,7 +130,11 @@ Partial Class GPS_RepPuntosDeInteres
RegistraScript($"CreaCirculo({Coords},'{Color}');CreaMarcador({Coords},'{row.DataKey("PuntoDeInteres")}','{SBBody.ToString}');", row.DataKey("CvePuntoDeInteres")) RegistraScript($"CreaCirculo({Coords},'{Color}');CreaMarcador({Coords},'{row.DataKey("PuntoDeInteres")}','{SBBody.ToString}');", row.DataKey("CvePuntoDeInteres"))
End If End If
End If End If
Next Next
GvBarra.DataSource = DtDatosReporte
GvBarra.DataBind()
Catch ex As Exception Catch ex As Exception
OnError("Ocurrió un error al consultar los puntos de interes", ex) OnError("Ocurrió un error al consultar los puntos de interes", ex)
End Try End Try
@@ -162,13 +185,32 @@ Partial Class GPS_RepPuntosDeInteres
Protected Sub BtnCargarGV_Click(sender As Object, e As EventArgs) Handles BtnCargarGV.Click Protected Sub BtnCargarGV_Click(sender As Object, e As EventArgs) Handles BtnCargarGV.Click
Dim GPS As New ClsGPS DtVisitas = Nothing
If GPS.RepPuntosDetalleGet(HdnPunto.Value.ToEntero, HdnDispositivo.Value.ToEntero, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, UsuarioActual.CveCliente) Then
GVHistorico.DataSource = GPS.DtResultados.FiltraParametros("CveEvento = 106") Dim ObjGPS As New ClsGPS
Else Try
GVHistorico.DataSource = Nothing Dim PuntoInteres As String = "", Vehiculo As String = ""
End If
GPS.Dispose() If ObjGPS.PuntoDeInteresGet(HdnPunto.Value.ToEntero, UsuarioActual.CveCliente, 1, -1) Then
PuntoInteres = ObjGPS.DtResultados.FiltroPrimeroValor("PuntoDeInteres")
End If
Vehiculo = GlobalDTDispositivos(UsuarioActual.CveCliente).FiltroPrimeroValor("NoEconomico", $"CveDispositivo={HdnDispositivo.Value.ToEntero}")
LblPU.Text = PuntoInteres
LblUnidad.Text = Vehiculo
If ObjGPS.RepPuntosDetalleGet(HdnPunto.Value.ToEntero, HdnDispositivo.Value.ToEntero, txtFechaI.Text.ToDateTime, txtFechaF.Text.ToDateTime, UsuarioActual.CveCliente) Then
DtVisitas = ObjGPS.DtResultados.FiltraParametros("CveEvento = 106")
GVHistorico.DataSource = DtVisitas
Else
GVHistorico.DataSource = Nothing
End If
Catch ex As Exception
OnError("Ocurrió un error al cargar las visitas", ex)
End Try
ObjGPS.Dispose()
GVHistorico.DataBind() GVHistorico.DataBind()
UpdatePanel3.Update() UpdatePanel3.Update()
RegistraScript("$('#dvHistorico').modal()") RegistraScript("$('#dvHistorico').modal()")
@@ -192,21 +234,215 @@ Partial Class GPS_RepPuntosDeInteres
End Sub End Sub
Public Sub EnviarReporteProgramado(Format As String) Public Sub EnviarReporteProgramado(Format As String)
Dim RutaReporte = "Empresas/Grales/ReportesProgramados/RPTPuntosInteres.rdlc"
Dim NombreReporte = "ReportePuntosInteres"
Try If Format = "EXCEL" Then
Dim RptParametro As New List(Of ReportParameter) Dim filtros As String = $"Fecha Inicio: {txtFechaI.Text}, Fecha Fin: {txtFechaF.Text}"
RptParametro.Add(New ReportParameter("FechaInicio", txtFechaI.Text))
RptParametro.Add(New ReportParameter("FechaFin", txtFechaF.Text))
RptParametro.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario))
RptParametro.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToShortDateString))
Dim retorno = StreamPDF(RutaReporte, DtDatosReporte, RptParametro, $"{NombreReporte}{Date.Now.ToShortDateString}", Format, MR:=Nothing, RDSName:="DsOC") Dim DtImprimir As DataTable = DtDatosReporte.Copy()
ImprimirbytesPDF(retorno, $"{NombreReporte}{Date.Now.ToShortDateString}", Format) DtImprimir.Columns.Remove(DtImprimir.Columns("CveDispositivo"))
Catch ex As Exception
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex)) DtImprimir.Columns("PuntoDeInteres").SetOrdinal(0)
End Try DtImprimir.Columns("Vehiculo").SetOrdinal(1)
End Sub DtImprimir.Columns("UltimaVisita").SetOrdinal(2)
DtImprimir.Columns("Visitas").SetOrdinal(3)
DtImprimir.Columns("PuntoDeInteres").ColumnName = "Punto de Interés"
DtImprimir.Columns("Vehiculo").ColumnName = "Vehículo"
DtImprimir.Columns("UltimaVisita").ColumnName = "Última Visita"
ImprimirExcelG(DtImprimir, "ReportePuntosInteres.xlsx", "Reporte de Puntos de Interés", filtros, NombreHoja:="ReportePuntosInteres")
Else
Dim RutaReporte = "Empresas/Grales/ReportesProgramados/RPTPuntosInteres.rdlc"
Dim NombreReporte = "ReportePuntosInteres"
Try
Dim Nombre As String = ""
Dim ObjClientes As New ClsClientes
If ObjClientes.GetClientes(UsuarioActual.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then Nombre = ObjClientes.DtResultados.FiltroPrimeroValor("Nombre")
ObjClientes.Dispose()
Dim RptParametro As New List(Of ReportParameter)
RptParametro.Add(New ReportParameter("FechaInicio", txtFechaI.Text))
RptParametro.Add(New ReportParameter("FechaFin", txtFechaF.Text))
RptParametro.Add(New ReportParameter("UsuarioImprimio", UsuarioActual.Usuario))
RptParametro.Add(New ReportParameter("FechaImpresion", DateTime.Now.ToShortDateString))
RptParametro.Add(New ReportParameter("Cliente", Nombre))
'Dim MR = New ReportViewer
'MR.LocalReport.EnableHyperlinks = True
'MR.HyperlinkTarget = "_blank"
Dim retorno = StreamPDF(RutaReporte, DtDatosReporte, RptParametro, $"{NombreReporte}{Date.Now.ToShortDateString}", Format, MR:=Nothing, RDSName:="DsOC")
ImprimirbytesPDF(retorno, $"{NombreReporte}{Date.Now.ToShortDateString}", Format)
Catch ex As Exception
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
End Try
End If
End Sub
Protected Sub LnkImprimirEXCELVisita_Click(sender As Object, e As EventArgs)
Dim filtros As String = $"Punto de Interés: {LblPU.Text}, Vehículo: {LblUnidad.Text}"
Dim DtImprimir As DataTable = DtVisitas.Copy()
DtImprimir.Columns.Remove(DtImprimir.Columns("CveDispositivoEvento"))
DtImprimir.Columns.Remove(DtImprimir.Columns("CveEvento"))
DtImprimir.Columns.Remove(DtImprimir.Columns("FechaEvento"))
DtImprimir.Columns("FechaEntrada").ColumnName = "Fecha Visita"
DtImprimir.Columns("Duracion").ColumnName = "Duración (min)"
ImprimirExcelG(DtImprimir, "HistorialVistas.xlsx", "Historial de vistas", filtros, NombreHoja:="Historial")
End Sub
Private Sub ImprimirExcelG(DtDatos As DataTable, Archivo As String, Titulo As String, Filtros As String, Optional NombreHoja As String = "Hoja1")
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
Dim excel As ExcelFile = New ExcelFile
Dim TotalRowHeader As Integer = 8
Dim TotalRowFooter As Integer = 2
Dim item = excel.Worksheets.Add(NombreHoja)
item.InsertDataTable(DtDatos, New InsertDataTableOptions() With
{
.ColumnHeaders = True,
.StartRow = 0,
.StartColumn = 0
})
item.Rows(0).Style.FillPattern.SetPattern(FillPatternStyle.Solid, SpreadsheetColor.FromArgb(75, 119, 190), SpreadsheetColor.FromArgb(255, 255, 255))
item.Rows(0).Style.Font.Color = SpreadsheetColor.FromArgb(255, 255, 255)
Dim columnCount = item.CalculateMaxUsedColumns()
For i = 0 To columnCount
item.Columns(i).AutoFit(1, item.Rows(i), item.Rows(item.Rows.Count - 1))
Next
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
Dim Nombre As String = ""
Dim ObjClientes As New ClsClientes
If ObjClientes.GetClientes(UsuarioActual.CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, -1, Estatus:=-1) Then Nombre = ObjClientes.DtResultados.FiltroPrimeroValor("Nombre")
ObjClientes.Dispose()
RangoNombreEmpresa.Value = Nombre
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
'If FechaIMes.Trim.Length > 0 And FechaFMes.Trim.Length > 0 Then
' 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
'End If
'If SubProyecto.Length > 0 Then
' Dim RangoSubProyecto = worksheet.Cells.GetSubrangeAbsolute(5, celdasConTexto.FirstColumnIndex, 5, celdasConTexto.LastColumnIndex)
' RangoSubProyecto.Merged = True
' RangoSubProyecto.Value = SubProyecto
' 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
If Not String.IsNullOrEmpty(Filtros) Then
Dim RangoDatoTituloExtra = worksheet.Cells.GetSubrangeAbsolute(6, celdasConTexto.FirstColumnIndex, 6, celdasConTexto.LastColumnIndex)
RangoDatoTituloExtra.Merged = True
RangoDatoTituloExtra.Value = Filtros
RangoDatoTituloExtra.Style.Font.Size = 15 * 20
RangoDatoTituloExtra.Style.Font.Name = "Calibri Light"
RangoDatoTituloExtra.Style.HorizontalAlignment = GemBox.Spreadsheet.HorizontalAlignmentStyle.Center
RangoDatoTituloExtra.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 i > 0 Then
Try
worksheet.Columns(i).AutoFit(1)
Catch ex As Exception
End Try
End If
Next
Dim IndexEndTable As Integer = DtDatos.Rows.Count + TotalRowHeader + TotalRowFooter
worksheet.Rows(IndexEndTable).Cells(0).Value = "Usuario Imprimió"
worksheet.Rows(IndexEndTable + 1).Cells(0).Value = UsuarioActual.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", UsuarioActual.Empresa.Ruta))
'If Imagen.Exists Then
' Dim Ruta As String = String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta)
' Using sr As New StreamReader(Ruta)
' Dim ms As New MemoryStream()
' sr.BaseStream.CopyTo(ms)
' worksheet.Pictures.Add(ms, ExcelPictureFormat.Png, "A1", 100, 100, LengthUnit.Pixel)
' End Using
'End If
For I = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
If I > 0 Then
'If Divisor = 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
excel.Save(Me.Response, Archivo, SaveOptions.XlsxDefault)
End Sub
End Class End Class

View File

@@ -50,7 +50,7 @@ public partial class General_CATIEPSxEntidadFed : ClsPaginas
DdlEstado.DataBind(); DdlEstado.DataBind();
DdlEstado.Items.Insert(0, new ListItem("Seleccione", "-1")); DdlEstado.Items.Insert(0, new ListItem("Todos", "-1"));
RcveEstado = Request["cveEstado"] == null ? -1 : Request["cveEstado"].ToString().ToEntero(); RcveEstado = Request["cveEstado"] == null ? -1 : Request["cveEstado"].ToString().ToEntero();
RtasaIEPS = Request["tasaIEPS"] == null ? -1 : Request["tasaIEPS"].ToString().ToDecimal(); RtasaIEPS = Request["tasaIEPS"] == null ? -1 : Request["tasaIEPS"].ToString().ToDecimal();
RfechaInicio = Request["fechaInicio"] == null ? string.Format("01/{0:MM/yyyy}", DateTime.Now.AddMonths(-1)) : Request["fechaInicio"].ToString(); RfechaInicio = Request["fechaInicio"] == null ? string.Format("01/{0:MM/yyyy}", DateTime.Now.AddMonths(-1)) : Request["fechaInicio"].ToString();

View File

@@ -13,7 +13,7 @@ Partial Class Inventarios_AjustesSeccionAlmacen
End Sub End Sub
Private Sub CargaCombos() Private Sub CargaCombos()
Dim DtAlmacenes As DataTable = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros("CveTipoAlmacen in (1,12,14,16)") Dim DtAlmacenes As DataTable = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoAlmacen:=-1).FiltraParametros("CveTipoAlmacen in (1,12,14,16, 26)")
DdlAlmacen.DataSource = DtAlmacenes DdlAlmacen.DataSource = DtAlmacenes
DdlAlmacen.DataBind() DdlAlmacen.DataBind()

View File

@@ -2745,6 +2745,11 @@ Partial Class Inventarios_EntregaAlmacen
ValidaVirtual = False ValidaVirtual = False
End If End If
'SI NO APLICA VIRTUAL EN LOS PRODUCTOS NO VALIDA
If CveAlmacenVirtual > 0 AndAlso DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count = 0 Then
ValidaVirtual = False
End If
If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 AndAlso CveAlmacenVirtual > 0 AndAlso CveConceptoMovimientoVirtual > 0 Then
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1, CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, CveConceptoMovimientoVirtual, 1, TxtFecha.Text.ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, CveVentaSurtir, -1, -1,
Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveMovimientoRelacionado:=CveMovimientoRelacionadoVirtual, Modulo:="RE/G6") Observaciones:=TxtObservaciones.Text.Trim, Guia:=TxtGuia.Text, CveMovimientoRelacionado:=CveMovimientoRelacionadoVirtual, Modulo:="RE/G6")

View File

@@ -0,0 +1,376 @@
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="RecepcionDevolucion.aspx.vb" Inherits="Inventarios_RecepcionDevolucion" %>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
<style>
table > tbody > .SubTotales, table > tbody > .SubTotales:hover, table > tbody > .SubTotales:nth-of-type(odd) {
background: #CCCCCC !important;
}
table > tbody > .SubTotalesB, table > tbody > .SubTotalesB:hover, table > tbody > .SubTotalesB:nth-of-type(odd) {
background: #DDD !important;
}
.SegundoNivel, .SegundoNivel:hover {
background-color: rgba(172, 195, 222, 0.65) !important;
}
.select2 .select2-selection__rendered {
line-height: 1;
color: #111;
}
.select2 .select2-selection--multiple {
box-sizing: border-box;
cursor: pointer;
display: block;
min-height: 20px;
user-select: none;
-webkit-user-select: none;
}
.select2-container--default .select2-selection--multiple .select2-selection__choice {
margin-top: 10px;
}
.select2-selection__rendered {
margin-top: 0px;
height: 25px;
}
.select2-selection {
margin-top: 0px;
height: 31px;
}
.select2-container--default.select2-container--focus .select2-selection--multiple {
border: none;
outline: 0;
}
#chartdiv {
width: 100%;
height: 500px;
}
</style>
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="E" runat="Server">
Devolución desde almacen
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="HB" runat="Server">
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
<asp:UpdatePanel runat="server" ID="UppAcciones" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton runat="server" ID="LnkAgregarProducto" CssClass="" data-toggle="tooltip" data-placement="left" OnClick="LnkAgregarProducto_Click" Text="<i class='fa fa-plus'></i> Agregar Producto">
</asp:LinkButton>
</li>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" runat="Server">
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="C" runat="Server">
<asp:UpdatePanel ID="UpGenerales" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-4">
<div class="portlet smmallpadding light bordered infomov" style="width: 100%">
<div class="portlet-title">
<div class="tools">
<a href="javascript;" data-idchekbox="<%= chkexpand.ClientID%>" class=" <%= IIf(chkexpand.Checked = True, "collapse", "expand")%>"></a>
<asp:CheckBox ID="chkexpand" Checked="true" CssClass="hidden" runat="server" />
</div>
<div class="caption uppercase" style="position: relative;">
<i class="fa fa-info-circle"></i>Información del movimiento
</div>
</div>
<div class="portlet-body" <%= IIf(chkexpand.Checked = True, "", "style='display:none;'")%>>
<div id="tbEncabezado" runat="server" class="rowpadding" visible="true">
<div class="row">
<label class="col-md-3 truncate">Cliente:</label>
<div class="col-md-9">
<ADS:Dropdownlost ID="DdlCliente" runat="server" DataValueField="CveCliente" DataTextField="NombreComercial" CssClassDdl="select2me" Width="100%" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
</div>
<div class="row">
<label class="col-md-3 truncate">SubProyecto:</label>
<div class="col-md-9">
<asp:DropDownList ID="DdlSubProyecto" runat="server" Width="100%" DataTextField="SubProyecto" DataValueField="CveSubProyecto" OnSelectedIndexChanged="DdlSubProyecto_SelectedIndexChanged" AutoPostBack="true" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
<asp:ListItem Selected="True" Text="Todas" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator InitialValue="-1" ID="RFVSubProyecto" Display="None" ValidationGroup="GrpGuardar" runat="server" ControlToValidate="DdlSubProyecto" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Sub Proyecto''</b> es necesario, por favor seleccione uno."></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender7" runat="server" HighlightCssClass="vco" TargetControlID="RFVSubProyecto" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row">
<label class="col-md-3 truncate">Almacén:</label>
<div class="col-md-9">
<asp:DropDownList ID="DdlAlmacen" runat="server" CssClass="form-control input-sm select2me" DataTextField="Almacen" DataValueField="CveAlmacen" Width="100%"></asp:DropDownList>
<asp:RequiredFieldValidator InitialValue="-1" ID="RfvAlmacen" Display="None" ValidationGroup="GrpGuardar" runat="server" ControlToValidate="DdlAlmacen" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Almacen''</b> es necesario, por favor seleccione uno."></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender1" runat="server" HighlightCssClass="vco" TargetControlID="RfvAlmacen" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row" id="DivFactura" runat="server" visible="false">
<label class="col-md-3 truncate">Factura:</label>
<div class="col-md-9">
<asp:DropDownList ID="DdlFactura" runat="server" Width="100%" DataTextField="Venta" DataValueField="CveVenta" Class="table-group-action-input form-control input-inline input-small input-sm select2me">
<asp:ListItem Selected="True" Text="Todas" Value="-1"></asp:ListItem>
</asp:DropDownList>
<%--<asp:HyperLink ID="HLFactura" runat="server" Text=""></asp:HyperLink>--%>
</div>
</div>
<div class="row">
<label class="col-md-3 truncate">
Observaciones:
</label>
<div class="col-md-9">
<asp:TextBox ID="TxtObservaciones" TextMode="MultiLine" Rows="2" CssClass="form-control input-sm" runat="server" MaxLength="232"></asp:TextBox>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<asp:UpdatePanel ID="UpDatos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet light xspadding bordered ">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Productos a devolver</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom">
<%--GV DATOS--%>
<asp:GridView ID="GvDatos" runat="server" EmptyDataText="Aun no hay registros." AutoGenerateColumns="False" ShowFooter="True" ShowHeader="true" ShowHeaderWhenEmpty="True" OnRowDeleting="GvDatos_RowDeleting"
DataKeyNames="Consec" HeaderStyle-CssClass="Titulos" CssClass="table table-striped table-hover Widthall ScrollAD gvInventario mysmallbtn" data-heighterror="450" data-freezerows="1" GridLines="None">
<Columns>
<asp:BoundField HeaderText="Cantidad" DataField="CantidadDevuelta" DataFormatString="{0:#,##0.######}" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="Cant. Venta" DataField="CantidadVenta" DataFormatString="{0:#,##0.######}" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" />
<asp:HyperLinkField HeaderText="Factura" Target="_blank" DataTextField="Venta" DataNavigateUrlFields="CveVenta" DataNavigateUrlFormatString="/Ventas/Ventas.aspx?CveVenta={0}" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="7.5%" />
<asp:HyperLinkField HeaderText="Producto o Servicio" Target="_blank" DataTextField="PS" DataNavigateUrlFields="CvePS" DataNavigateUrlFormatString="/Ventas/ProductosServicios.aspx?CvePS={0}" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Unidad" DataField="UnidadMedida" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="7.5%" />
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="7.5%" />
<asp:BoundField HeaderText="Fecha Caducidad" DataField="FechaCaducidad" DataFormatString="{0:dd/MM/yyy}" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="7.5%" />
<asp:BoundField HeaderText="Sección" DataField="SeccionAlmacen" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" />
<asp:BoundField HeaderText="Total" DataField="Total" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="7.5%" />
<asp:TemplateField HeaderText="" ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<asp:LinkButton ID="lnkRemove" runat="server" CssClass="btn btn-circle btn-xs red" Text="<i class='icon-trash'></i>" CommandName="Delete" OnClientClick="return confirm('¿Desea borrar el registro?')"></asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
<asp:HiddenField runat="server" ClientIDMode="Static" ID="HdnCantidadMovimiento" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div style="width: 100%; text-align: center;">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="BtnGuardar" runat="server" ValidationGroup="GrpGuardar" Text="Guardar" CssClass="btn btn-primary" OnClick="BtnGuardar_Click" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DivModalAgregar" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<asp:UpdatePanel ID="UpModalAgregar" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="HTituloDispostivo" runat="server">Agregar Producto</h4>
</div>
<div class="modal-body" style="width: 1000px;">
<div class="row">
<div class="col-md-12">
<div class="portlet light xspadding bordered">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Buscar productos vendidos </span>
</div>
<div class="tools">
<a href="javascript;" class="collapse" data-original-title="" title=""></a>
</div>
</div>
<div class="portlet-body form">
<div class="row">
<div class="col-md-12">
<div class="portlet solid grey-cascade portlet-filter" id="idnecesaria">
<div class="portlet-title portlet-filterT smalltitle">
<div class="tools">
<asp:Button ID="BtnConsultar" runat="server" Text="Consultar" class="btn btn-primary" OnClick="BtnConsultar_Click" ValidationGroup="GrpConsulta" />
<a href="javascript:;" class="expand"></a>
</div>
<div class="titlefiltros caption">
<div class="row">
<label class="col-md-1 truncate">Producto:</label>
<div class="col-md-6">
<ADS:Dropdownlost ID="DdlPS" runat="server" DataValueField="CvePS" DataTextField="PSCodigo" CssClassDdl="select2me" Width="100%" CssStyle="width: 100%;"></ADS:Dropdownlost>
</div>
<div class="col-md-1"></div>
</div>
</div>
</div>
<div class="portlet-body" style="display: none">
<div class="row">
<label class="col-md-1 truncate">Fecha Inicio:</label>
<div class="col-md-2">
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy" style="width: 100% !important; padding: 0px;">
<asp:TextBox ID="TxtFechaI" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkFechaI" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaI" runat="server" TargetControlID="TxtFechaI" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender ID="CEFechaI" runat="server" TargetControlID="TxtFechaI" PopupButtonID="LnkFechaI" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RFCFechaI" runat="server" ControlToValidate="TxtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="GrpConsulta"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CVFechaI" runat="server" ControlToValidate="TxtFechaI" Display="None" ErrorMessage="El campo <b>''Fecha Inicial''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpConsulta"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="RFCFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender3" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaI" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<label class="col-md-2 truncate">Fecha Fin:</label>
<div class="col-md-2">
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy" style="width: 100% !important; padding: 0px;">
<asp:TextBox ID="TxtFechaF" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkFechaF" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaF" runat="server" TargetControlID="TxtFechaF" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender ID="CEFechaF" runat="server" TargetControlID="TxtFechaF" PopupButtonID="LnkFechaF" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RFVFechaF" runat="server" ControlToValidate="TxtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Fin''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="GrpConsulta"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CVFechaF" runat="server" ControlToValidate="TxtFechaF" Display="None" ErrorMessage="El campo <b>''Fecha Fin''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpConsulta"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender4" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender5" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaF" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<label class="col-md-1 truncate" style="width: 90px;">Aplica Serie:</label>
<div class="col-md-1" style="padding-right: 30px; width: 20px;">
<asp:CheckBox ID="ChkAplicaSerie" CssClass="md-checksd" runat="server" Text="" AutoPostBack="true" OnCheckedChanged="ChkAplicaSerie_CheckedChanged" />
</div>
</div>
<div class="row">
<label class="col-md-1 truncate">Aplica Lote:</label>
<div class="col-md-1">
<asp:CheckBox ID="ChkAplicaLote" CssClass="md-checksd" runat="server" Text="" AutoPostBack="true" OnCheckedChanged="ChkAplicaLote_CheckedChanged" />
</div>
<div class="col-md-1"></div>
<label class="col-md-2 truncate">Aplica Caducidad:</label>
<div class="col-md-1">
<asp:CheckBox ID="ChkAplicaCaducidad" CssClass="md-checksd" runat="server" Text="" AutoPostBack="true" OnCheckedChanged="ChkAplicaCaducidad_CheckedChanged" />
</div>
<div class="col-md-1"></div>
<label class="col-md-1 truncate" id="lblSerie" runat="server" visible="false">Serie:</label>
<div id="DivSerie" runat="server" visible="false" class="col-md-2">
<asp:TextBox ID="TxtSerie" CssClass="form-control input-sm" Width="100%" runat="server"></asp:TextBox>
</div>
</div>
<div class="row">
<label class="col-md-1 truncate" id="lblLote" runat="server" visible="false">Lote:</label>
<div id="DivLote" runat="server" visible="false" class="col-md-2">
<asp:TextBox ID="TxtLote" CssClass="form-control input-sm" Width="100%" runat="server"></asp:TextBox>
</div>
<label class="col-md-2 truncate" id="lblCaducidad" runat="server" visible="false">Fecha Caducidad:</label>
<div id="DivCaducidad" runat="server" visible="false" class="col-md-2">
<div class="input-group input-sm input-small date date-picker" data-date-format="dd/mm/yyyy" style="width: 100% !important; padding: 0px;">
<asp:TextBox ID="TxtFechaCaducidad" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkCaducidad" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaFEjec" runat="server" TargetControlID="TxtFechaCaducidad" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender ID="CEFechaCaducidad" runat="server" TargetControlID="TxtFechaCaducidad" PopupButtonID="LnkCaducidad" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RFVCaducidad" runat="server" ControlToValidate="TxtFechaCaducidad" Display="None" ErrorMessage="El campo <b>''Fecha Caducidad''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="GrpConsulta"></asp:RequiredFieldValidator>
<asp:CompareValidator ID="CVCaducidad" runat="server" ControlToValidate="TxtFechaCaducidad" Display="None" ErrorMessage="El campo <b>''Fecha Caducidad''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpConsulta"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOFechaFEjec1" runat="server" HighlightCssClass="vco" TargetControlID="RFVCaducidad" Width="350px"></ajax:ValidatorCalloutExtender>
<ajax:ValidatorCalloutExtender ID="VCOFechaFEjec2" runat="server" HighlightCssClass="vco" TargetControlID="CVCaducidad" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="row">
<div class="col-md-12">
<asp:GridView ID="GvPSAgregar" runat="server" AutoGenerateColumns="False" GridLines="None"
DataKeyNames="CveVenta,CveVentaDetalle,Cantidad,SerieFolio,CveUM,UnidadMedida,CvePS,PS,PU,CveClasificacion,CveSeccionAlmacen,SeccionAlmacen,Serie,Lote,FechaCaducidad,CveAlmacen" CssClass="table table-striped table-advance table-hover Widthall ScrollAD" data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" data-heighterror="400" EmptyDataText="No se encontraron registros">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="ChkAplicar" runat="server" />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Cantidad">
<ItemTemplate>
<asp:TextBox ID="TxtCantidad" runat="server" Text='<%#Eval("Cantidad", "{0:N2}").ToString%>' MaxLength="12" Width="46px" Height="24px"></asp:TextBox>
<asp:RangeValidator ID="RVCant" runat="server" Type="Double" MinimumValue="0" MaximumValue='<%#Eval("Cantidad").ToString%>' ErrorMessage="Cantidad Excedida" ControlToValidate="TxtCantidad" Display="None" ValidationGroup="VGAplicarRNC"></asp:RangeValidator>
<ajax:ValidatorCalloutExtender ID="VCECantidad3" runat="server" HighlightCssClass="vco" TargetControlID="RVCant" Width="300px"></ajax:ValidatorCalloutExtender>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Sección" DataField="SeccionAlmacen" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Lote" DataField="Lote" ItemStyle-HorizontalAlign="Left" />
<asp:BoundField HeaderText="Fecha Caducidad" DataField="FechaCaducidad" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
</Columns>
</asp:GridView>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:LinkButton ID="LnkModalAgregarUsado" runat="server" CssClass="btn btn-success" Text="Agregar" OnClick="LnkModalAgregarUsado_Click"></asp:LinkButton>
<button type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<asp:Button ID="BtnRefrescarPagina" runat="server" ClientIDMode="Static" Text="Refrescar" Style="display: none;" />
</asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" runat="Server">
<script type="text/javascript">
function BtnRefrescarPagina() {
$('#BtnRefrescarPagina').click();
}
</script>
</asp:Content>

View File

@@ -0,0 +1,879 @@
Option Strict On
Option Explicit On
Imports System.Data
Imports Extensiones
Partial Class Inventarios_RecepcionDevolucion
Inherits ClsPaginas
#Region "P R O P I E D A D E S"
Private Property ObjRemisionNC As Modelos.Factura
Get
Return CType(ViewState("ObjRemisionNC"), Modelos.Factura)
End Get
Set(value As Modelos.Factura)
ViewState("ObjRemisionNC") = value
End Set
End Property
Public Property DtMovimientos As DataTable
Get
Return CType(ViewState("DtMovimientos"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtMovimientos") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load
If Not IsPostBack Then
InicializaValores()
End If
End Sub
Protected Sub CreaDT()
Dim dt As New DataTable
Dim column As DataColumn = New DataColumn("Consec")
column.DataType = GetType(Integer)
With column
.AutoIncrement = True
.AutoIncrementSeed = 1
.AutoIncrementStep = 1
End With
dt.Columns.Add(column)
dt.Columns.Add("CantidadDevuelta", GetType(Decimal))
dt.Columns.Add("CantidadVenta", GetType(Decimal))
dt.Columns.Add("CveVentaDetalle", GetType(Integer))
dt.Columns.Add("CveVenta", GetType(Integer))
dt.Columns.Add("Venta", GetType(String))
dt.Columns.Add("CveUM", GetType(Integer))
dt.Columns.Add("UnidadMedida", GetType(String))
dt.Columns.Add("CvePS", GetType(Integer))
dt.Columns.Add("PS", GetType(String))
dt.Columns.Add("PU", GetType(Decimal))
dt.Columns.Add("Total", GetType(Decimal))
dt.Columns.Add("CveClasificacion", GetType(Integer))
dt.Columns.Add("CveSeccionAlmacen", GetType(Integer))
dt.Columns.Add("SeccionAlmacen", GetType(String))
dt.Columns.Add("Serie", GetType(String))
dt.Columns.Add("Lote", GetType(String))
dt.Columns.Add("FechaCaducidad", GetType(DateTime))
dt.Columns.Add("Observaciones", GetType(String))
DtMovimientos = dt.Clone()
End Sub
Private Sub InicializaValores()
Dim StrAlmacenes As String = "CveTipoAlmacen IN (1)"
If (UsuarioActual.Empresa.Funcionalidad(105) = "1" Or UsuarioActual.Empresa.Funcionalidad(141) = "1") Then
DdlCliente.setEsWebService(True)
DdlCliente.Attributes.Add("data-metodo", "getcliente")
DdlCliente.SelectedText = "Todos"
DdlCliente.SelectedValue = "-1"
Else
DdlCliente.setEsWebService(False)
DdlCliente.ddl.DataSource = GlobalDTCliente(UsuarioActual.CveEmpresa)
DdlCliente.ddl.DataBind()
DdlCliente.ddl.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros(StrAlmacenes) 'GlobalDTAlmacen(UsuarioActual.CveEmpresa)
DdlAlmacen.DataBind()
DdlAlmacen.Items.Insert(0, New ListItem("Seleccione ", "-1"))
DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen)
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, CveEstatus:=1)
DdlSubProyecto.DataBind()
DdlSubProyecto.Items.Insert(0, New ListItem("Seleccione ", "-1"))
TxtFechaI.Text = $"01/{Now.Month}/{Now.Year}"
TxtFechaF.Text = Now.ToString("dd/MM/yyyy")
GvDatos.DataSource = Nothing
GvDatos.DataBind()
LimpiarDatos()
CargaPS(-1, DdlPS, AplicaAlmacen:=False)
CreaDT()
UpGenerales.Update()
End Sub
Protected Sub DdlSubProyecto_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim StrAlmacenes As String = $"CveTipoAlmacen IN (1) AND CveSubProyecto={DdlSubProyecto.SelectedValue.ToEntero()}"
DdlAlmacen.DataSource = GlobalDTAlmacenUsuarios(UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1).FiltraParametros(StrAlmacenes) 'GlobalDTAlmacen(UsuarioActual.CveEmpresa)
DdlAlmacen.DataBind()
DdlAlmacen.Items.Insert(0, New ListItem("Seleccione ", "-1"))
DdlAlmacen.SelectedValueExist(UsuarioActual.CveAlmacen)
UpGenerales.Update()
End Sub
Protected Sub LnkAgregarProducto_Click(sender As Object, e As EventArgs)
Dim CveCliente As Integer = DdlCliente.SelectedValue.ToEntero()
Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero()
If CveCliente <= 0 Then
Alert("Debe seleccionar un cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If CveSubProyecto <= 0 Then
Alert("Debe seleccionar un sub proyecto", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
LimpiarDatos()
RegistraScript("$('#DivModalAgregar').modal('show');")
End Sub
Private Sub LimpiarDatos()
GvPSAgregar.DataSource = Nothing
GvPSAgregar.DataBind()
ChkAplicaSerie.Checked = False
ChkAplicaLote.Checked = False
ChkAplicaCaducidad.Checked = False
ChkAplicaSerie_CheckedChanged(ChkAplicaSerie, EventArgs.Empty)
ChkAplicaLote_CheckedChanged(ChkAplicaSerie, EventArgs.Empty)
ChkAplicaCaducidad_CheckedChanged(ChkAplicaSerie, EventArgs.Empty)
End Sub
Private Sub CargaPS(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost, Optional AplicaAlmacen As Boolean = True, Optional CveMarca As Integer = -1)
Objeto.setEsWebService(UsuarioActual.Empresa.Funcionalidad(141).ToString = "1")
If Not UsuarioActual.Empresa.Funcionalidad(141).ToString = "1" Then
Objeto.ddl.Items.Clear()
Objeto.ddl.DataSource = GlobalDTPSSimplificado(UsuarioActual.CveEmpresa, CveClasificacion:=CveClasificacion, Estatus:=1, AplicaParaVenta:=1)
Objeto.ddl.DataBind()
Objeto.ddl.Items.Insert(0, New ListItem("*** Actualizar listado de Productos o Servicios ***", "-2"))
Objeto.ddl.Items.Insert(0, New ListItem("Seleccione el Producto", "-1"))
Else
Objeto.Attributes.Add("data-cvesubproyecto", "-1")
Objeto.ddlWS.Attributes.Add("data-cveclasificacion", "-1")
Objeto.ddlWS.Attributes.Add("data-aplicaparaventa", "1")
If AplicaAlmacen Then
Objeto.ddlWS.Attributes.Add("data-pagina", "ventas/ventas")
Else
Objeto.ddlWS.Attributes.Add("data-pagina", "-1")
End If
Objeto.ddlWS.Attributes.Add("data-aplicaparaventa", "1")
Objeto.ddlWS.Attributes.Add("data-cvemarca", CveMarca.ToString)
Objeto.ddlWS.Attributes.Add("data-Estatus", "1")
End If
End Sub
Protected Sub ChkAplicaSerie_CheckedChanged(sender As Object, e As EventArgs)
lblSerie.Visible = ChkAplicaSerie.Checked
DivSerie.Visible = ChkAplicaSerie.Checked
UpModalAgregar.Update()
End Sub
Protected Sub ChkAplicaLote_CheckedChanged(sender As Object, e As EventArgs)
lblLote.Visible = ChkAplicaLote.Checked
DivLote.Visible = ChkAplicaLote.Checked
UpModalAgregar.Update()
End Sub
Protected Sub ChkAplicaCaducidad_CheckedChanged(sender As Object, e As EventArgs)
lblCaducidad.Visible = ChkAplicaCaducidad.Checked
DivCaducidad.Visible = ChkAplicaCaducidad.Checked
UpModalAgregar.Update()
End Sub
Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs)
Dim CvePS As Integer = DdlPS.SelectedValue.ToEntero()
Dim CveCliente As Integer = DdlCliente.SelectedValue.ToEntero()
Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero()
If CvePS <= 0 Then
Alert("Debe seleccionar un producto", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If CveCliente <= 0 Then
Alert("Debe seleccionar un cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If CveSubProyecto <= 0 Then
Alert("Debe seleccionar un sub proyecto", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim FechaI As DateTime = TxtFechaI.Text.ToDateTime()
Dim FechaF As DateTime = TxtFechaF.Text.ToDateTime()
Dim Serie As String = If(ChkAplicaSerie.Checked, TxtSerie.Text.Trim, "-1")
Dim Lote As String = If(ChkAplicaLote.Checked, TxtLote.Text.Trim, "-1")
Dim FechaCaducidad As DateTime = If(ChkAplicaCaducidad.Checked, TxtFechaCaducidad.Text.ToDateTime, MinFecha)
Dim ObjInv As New ClsInventarios
Try
If ObjInv.GetProductosDevolucion(CvePS, CveCliente, CveSubProyecto, FechaI, FechaF, Serie, Lote, FechaCaducidad, UsuarioActual.CveEmpresa) Then
GvPSAgregar.DataSource = ObjInv.DtResultados
End If
Catch ex As Exception
OnError("Ocurrio un error al obtener los datos de devolución", ex)
End Try
ObjInv.Dispose()
GvPSAgregar.DataBind()
UpModalAgregar.Update()
End Sub
Protected Sub GvPSAgregar_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvPSAgregar.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then
If e.Row.DBCampo("CvePS").ToEntero() <= 0 Then
e.Row.CssClass = "Totales"
e.Row.FCCheckBox("ChkAplicar").Visible = False
e.Row.FCTextBox("TxtCantidad").Visible = False
End If
End If
End Sub
Protected Sub LnkModalAgregarUsado_Click(sender As Object, e As EventArgs)
If DtMovimientos IsNot Nothing Then
For Each GvRow As GridViewRow In GvPSAgregar.Rows
If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCCheckBox("ChkAplicar").Checked Then
Dim RowDevolucion As DataRow = DtMovimientos.NewRow
RowDevolucion("CantidadDevuelta") = GvRow.FCTextBox("TxtCantidad").Text.ToDecimal()
RowDevolucion("CantidadVenta") = GvRow.DataKey("Cantidad").ToDecimal()
RowDevolucion("CveVentaDetalle") = GvRow.DataKey("CveVentaDetalle").ToEntero()
RowDevolucion("CveVenta") = GvRow.DataKey("CveVenta").ToEntero()
RowDevolucion("Venta") = GvRow.DataKey("SerieFolio")
RowDevolucion("CveUM") = GvRow.DataKey("CveUM").ToEntero()
RowDevolucion("UnidadMedida") = GvRow.DataKey("UnidadMedida")
RowDevolucion("CvePS") = GvRow.DataKey("CvePS").ToEntero()
RowDevolucion("PS") = GvRow.DataKey("PS")
RowDevolucion("PU") = GvRow.DataKey("PU").ToDecimal()
RowDevolucion("Total") = (GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() * GvRow.DataKey("PU").ToDecimal())
RowDevolucion("CveClasificacion") = GvRow.DataKey("CveClasificacion").ToEntero()
RowDevolucion("CveSeccionAlmacen") = GvRow.DataKey("CveSeccionAlmacen").ToEntero()
RowDevolucion("SeccionAlmacen") = GvRow.DataKey("SeccionAlmacen")
RowDevolucion("Serie") = GvRow.DataKey("Serie")
RowDevolucion("Lote") = GvRow.DataKey("Lote")
RowDevolucion("FechaCaducidad") = If(String.IsNullOrEmpty(GvRow.DataKey("FechaCaducidad")), Nothing, GvRow.DataKey("FechaCaducidad").ToDateTime())
RowDevolucion("Observaciones") = ""
'If GvRow.DataKey("CveAlmacen").ToEntero() > 0 AndAlso DdlAlmacen.SelectedValue.ToEntero() <= 0 Then
' DdlAlmacen.SelectedValueExist(GvRow.DataKey("CveAlmacen"))
'End If
DtMovimientos.Rows.Add(RowDevolucion)
End If
End If
Next
GvDatos.DataSource = DtMovimientos
GvDatos.DataBind()
If DtMovimientos.Rows.Count > 0 Then
DivFactura.Visible = True
DdlFactura.DataSource = DtMovimientos.FiltraParametros("", DistinctColumns:={"CveVenta", "Venta"})
DdlFactura.DataBind()
End If
End If
UpDatos.Update()
UpGenerales.Update()
RegistraScript("$('#DivModalAgregar').modal('hide');")
End Sub
#Region "C R E A R - R N C"
Private Sub CreaRemisionNC(CveCliente As Integer, CveSubProyecto As Integer)
If ObjRemisionNC IsNot Nothing Then
ObjRemisionNC.Dispose()
ObjRemisionNC = Nothing
End If
Me.ObjRemisionNC = New Modelos.Factura(UsuarioActual)
Me.ObjRemisionNC.TipoMensajeRespuesta = Modelos.TipoMensajeRespuesta.HTML
Me.ObjRemisionNC.Serie = "-1"
Me.ObjRemisionNC.Folio = -1 'Folio.ToEntero()
Me.ObjRemisionNC.Version = "3.3"
Me.ObjRemisionNC.FolioFiscal = ""
Me.ObjRemisionNC.CveUsuario = UsuarioActual.CveUsuario
Me.ObjRemisionNC.CveEmpresa = UsuarioActual.CveEmpresa
Me.ObjRemisionNC.ConvertirPesos = False
Me.ObjRemisionNC.CveVentaPadre = DdlFactura.SelectedValue.ToEntero()
Dim ObjVentasPadre As New ClsVentas
If ObjVentasPadre.GetVenta(Me.ObjRemisionNC.CveVentaPadre, UsuarioActual.CveEmpresa) AndAlso ObjVentasPadre.DtResultados.Rows.Count > 0 Then
Me.ObjRemisionNC.CveMoneda = ObjVentasPadre.DtResultados.FiltroPrimeroValor("CveMoneda").ToString().ToEntero()
End If
ObjVentasPadre.Dispose()
If Me.ObjRemisionNC.CveMoneda = 1 Then
Me.ObjRemisionNC.TipoCambio = 1
Else
Me.ObjRemisionNC.TipoCambio = GlobalTipoCambio(Now).ToDecimal()
End If
Me.ObjRemisionNC.Moneda = GlobalDTMonedas.FiltroPrimeroValor("Moneda", String.Format("CveMoneda = {0} ", Me.ObjRemisionNC.CveMoneda))
Me.ObjRemisionNC.MonedaSAT = GlobalDTMonedas.FiltroPrimeroValor("AbreviaturaSAT", String.Format("CveMoneda = {0} ", Me.ObjRemisionNC.CveMoneda))
Me.ObjRemisionNC.TipoDocto = "RNC"
Me.ObjRemisionNC.RefDocto = ""
Me.ObjRemisionNC.CveMesa = -1
Me.ObjRemisionNC.Fecha = Now
Me.ObjRemisionNC.CvePrePoliza = -1
Me.ObjRemisionNC.FechaPago = Now
Me.ObjRemisionNC.MotivoDescuento = ""
Me.ObjRemisionNC.FechaEjecucion = Now
Me.ObjRemisionNC.UsuarioCreo = UsuarioActual.Usuario
Me.ObjRemisionNC.CveCondicionEntrega = -1
Me.ObjRemisionNC.CondicionEntrega = ""
Me.ObjRemisionNC.NumeroCuenta = ""
Me.ObjRemisionNC.CondicionesPago = 0
Me.ObjRemisionNC.FormaPago = 0
Me.ObjRemisionNC.PedidoContrato = ""
Me.ObjRemisionNC.NumeroContrato = ""
Me.ObjRemisionNC.DescripcionContrato = ""
Me.ObjRemisionNC.CveCorte = -1
Me.ObjRemisionNC.TipoDocumento = "Remisión"
'NUM 1- CARGO 2- BONIFICACION
Me.ObjRemisionNC.Num1 = 0
'NUM 0- USADO 1- AJUSTE/GARANTIA
Me.ObjRemisionNC.Num2 = 0
'ES PARA GENERAR DEVOLUCION
Me.ObjRemisionNC.Num3 = 10
Me.ObjRemisionNC.Alfa1 = ""
Me.ObjRemisionNC.Alfa2 = ""
Me.ObjRemisionNC.Alfa3 = ""
Me.ObjRemisionNC.CveContrato = -1
Me.ObjRemisionNC.ConvertirPesos = False
Me.ObjRemisionNC.CveSubProyecto = CveSubProyecto
Me.ObjRemisionNC.CveSubProyectoCobranza = CveSubProyecto
Me.ObjRemisionNC.CveSubProyectoEjecucion = CveSubProyecto
Me.ObjRemisionNC.SubProyecto = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1).FiltroPrimero(String.Format("CveSubProyecto = {0}", CveSubProyecto)))
Me.ObjRemisionNC.SubProyectoMatriz = New Modelos.SubProyectoModel(GlobalDTSubProyectos(-1, CveSubProyecto:=-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero("TipoSucursal=1"))
'CLIENTE
Me.ObjRemisionNC.CveCliente = CveCliente
Me.ObjRemisionNC.SetCliente()
Me.ObjRemisionNC.CveAlmacen = -1
Dim ObjCliente As New ClsClientes
If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa, -1, TipoCliente:=-1) Then
If ObjCliente.DtResultados.Rows.Count > 0 Then
Me.ObjRemisionNC.CveFormaPago33 = ObjCliente.CveFormaPago33
Me.ObjRemisionNC.FormaPago33 = GlobalDTVtaFormaPago.FiltroPrimeroValor("FormaPago", String.Format("CveFormaPago = {0}", ObjCliente.CveFormaPago33))
Me.ObjRemisionNC.FormaPagoSAT33 = GlobalDTVtaFormaPago.FiltroPrimeroValor("ClaveFormaPagoSAT", String.Format("CveFormaPago = {0}", ObjCliente.CveFormaPago33))
Me.ObjRemisionNC.CveMetodoPago33 = ObjCliente.CveMetodoPago33
Me.ObjRemisionNC.MetodoPago33 = GlobalDTVtaMetodoPago.FiltroPrimeroValor("MetodoPago", String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago33))
Me.ObjRemisionNC.ClaveMetodoPagoSAT = GlobalDTVtaMetodoPago.FiltroPrimeroValor("ClaveMetodoPagoSAT", String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago33))
Me.ObjRemisionNC.CveUsoCFDI = ObjCliente.CveUsoCFDI
Me.ObjRemisionNC.UsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("Descripcion", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI))
Me.ObjRemisionNC.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", String.Format("CveUsoCFDI = {0}", ObjCliente.CveUsoCFDI))
Me.ObjRemisionNC.CveMetodoPago = ObjCliente.CveMetodoPago33
If GlobalDTMetodosPago.FiltraParametros(String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago33)).Rows.Count > 0 Then
Me.ObjRemisionNC.MetodoPago = GlobalDTMetodosPago.FiltraParametros(String.Format("CveMetodoPago = {0}", ObjCliente.CveMetodoPago33)).Rows(0)("MetodoPago").ToString
Else
Me.ObjRemisionNC.CveMetodoPago = 1
Me.ObjRemisionNC.MetodoPago = "Efectivo"
End If
If UsuarioActual.CveEmpresa = 119 Then
Me.ObjRemisionNC.FormaPago = 20 'POR DEFINIR AND (@CveMetodoPago33 = 3 AND @CveFormaPago33 <> 20)
If Me.ObjRemisionNC.CveMetodoPago33 = 3 Then
Me.ObjRemisionNC.CveFormaPago33 = 20
End If
End If
End If
End If
If ObjCliente.GetSucursales(CveCliente) Then
If ObjCliente.DtResultados.Rows.Count > 0 Then
Me.ObjRemisionNC.CveClienteSucursal = If(String.IsNullOrEmpty(ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'")), -1, ObjCliente.DtResultados.FiltroPrimeroValor("CveClienteSucursal", "Estatus = 'Activo'").ToEntero())
Else
Me.ObjRemisionNC.CveClienteSucursal = -1
End If
End If
ObjCliente.Dispose()
'DETALLES
Me.ObjRemisionNC.DtDetalle = CreaDTDetalleRNC()
CargaDTDetalleRNC()
'VALIDA PROMOCIONES Y EXISTENCIAS
Dim ObjVentas As New ClsVentas
If ObjVentas.GetPromocionesPS(-1, Now, CveSubProyecto, Me.ObjRemisionNC.CveCliente, Me.ObjRemisionNC.CveVendedor, 1, UsuarioActual.CveEmpresa) Then
Me.ObjRemisionNC.DtPromociones = ObjVentas.DtResultados.Copy()
End If
ObjVentas.Dispose()
Me.ObjRemisionNC.Observaciones = TxtObservaciones.Text
Me.ObjRemisionNC.OrdenCompra = ""
Me.ObjRemisionNC.PedidoContrato = ""
Me.ObjRemisionNC.ObservacionesAlmacen = ""
'If TmpDTPolizaVirtual IsNot Nothing Then
' Me.ObjRemisionNC.DtPolizasVirtuales = TmpDTPolizaVirtual
'End If
End Sub
Private Function AddPSRNC(ByRef TmpDT As DataTable, 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 EsCargo As Boolean = False, Optional PorcentajeIVA As Decimal = 0D, Optional CveTamaño As Integer = 0) As Boolean
Dim Retorno As Boolean = False
If Not CvePS > 0 Then
Alert("Ocurrió un error al cargar la información del producto a agregar. Por favor verifique y vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Return False
End If
If (Obs.Length + PS.Length > 1000) Then
Alert(String.Format("El Nombre y observación del producto tiene longitud de {0} caracteres y excede los 1000 caracteres permitidos.", Obs.Length + PS.Length), TipoMensaje.MsgAdvertencia)
Return False
End If
Dim Row As DataRow = Nothing
Dim TotalCalculableImpuestos As Decimal = 0D, TotalCalculableImpuestosIVA = 0D
PU = Math.Round(PU, 6) ' el precio unitario puede llevar hasta 6 decimales permitidos
Row = TmpDT.NewRow()
Row("CveProyecto") = CveProyecto
Row("Proyecto") = Proyecto
Row("CveSubProyecto") = CveSubProyecto
Row("SubProyecto") = SubProyecto
Row("Serie") = Serie
Row("TiempoEntrega") = TiempoEntrega
Row("Orden") = TmpDT.Rows.Count + 1
Row("Cantidad") = Cantidad
Row("CveUM") = CveUM
Row("UM") = UM
Row("CveClasificacion") = CveClasificacion
Row("Clasificacion") = Clasificacion
Row("CvePS") = CvePS
Row("Obs") = Obs
Dim DrPS As DataRow = Nothing
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("") ' Estado = -1
If DrPS Is Nothing Then
Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgAdvertencia)
Return False
End If
'verifica si tiene ventaminima
If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDecimal > 0 Then
'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15...
If Cantidad Mod DrPS("VentaMinima").ToString.ToDecimal <> 0 Then
Alert(String.Format("El producto se vende solo en cantidades de {0}", DrPS("VentaMinima").ToString))
Return False
End If
End If
TotalCalculableImpuestos = ((Cantidad * (PU)) - Descuento)
TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
Row("PU") = PU
Row("Codigo") = DrPS("Codigo")
Row("NoIdentificacion") = DrPS("Codigo")
Row("ClaveSATFraccionArancelaria") = DrPS("ClaveSATFraccionArancelaria")
Row("ClaveSATUnidadAduana") = DrPS("ClaveSATUnidadAduana")
Row("ClaveSATFraccionArancelariaDescripcion") = DrPS("ClaveSATFraccionArancelariaDescripcion")
Row("ClaveSATUnidadAduanaDescripcion") = DrPS("ClaveSATUnidadAduanaDescripcion")
Row("Consec") = TmpDT.Rows.Count + 1
Row("PS") = DrPS("PS")
Row("CodigoPS") = DrPS("PSCodigo").ToString
Row("CveTipoPS") = DrPS("CveTipoPS")
Row("CveTipoInvPS") = DrPS("Inv_CveMetodoInventario")
Row("CveTamaño") = DrPS("CveTamaño")
If CveClasificacion <= 0 Then Row("CveClasificacion") = DrPS("CveClasificacion")
If Clasificacion = "" Then Row("Clasificacion") = DrPS("Clasificacion")
If DrPS("IVA").ToString().Contiene("-1", "") Then
Row("PorcentajeIVA") = PorcentajeIVA
Else
Row("PorcentajeIVA") = DrPS("IVA")
End If
Row("IVA") = Row("PorcentajeIVA")
Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestosIVA, 2)
Row("ImporteRetIVA") = 0D
Row("ImporteRetISR") = 0D
Row("PorcentajeRetIVA") = 0D
Row("PorcentajeRetISR") = 0D
Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje")
Row("ImporteIEPS") = Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, 2)
Row("IEPS") = Row("ImporteIEPS")
Row("Descuento") = Math.Round(Descuento, 2)
Row("TipoDescuento") = 0
Row("Total") = (Cantidad * PU)
Row("TotalImporte") = Math.Round(Cantidad * PU, 2)
Row("SATClaveProdServ") = DrPS("SATClavePS")
Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
Row("EntregaDirecta") = EntregaDirecta
'Contratos
Row("CveContratoDetalle") = CveContratoDetalle
Row("CveVentaDetalle") = CveVentaDetalle
Row("CveMovimientoDetallePedido") = CveMovimientoDetallePedido
Row("CveOrdenCompraDetalle") = CveOrdenCompraDetalle
Row("CveVentaDetalleRemision") = CveVentaDetalleRemision
Row("CveVentaDetalleCotizacion") = CveVentaDetalleCotizacion
Row("CveVentaDetallePedido2") = CveVentaDetallePedido2
Row("CuentaPredial") = CuentaPredial
Row("EsCargo") = EsCargo
Row("CveTamaño") = CveTamaño
'RECARGAR GV
TmpDT.Rows.Add(Row)
TmpDT.AcceptChanges()
Retorno = True
Return Retorno
End Function
Protected Function CreaDTDetalleRNC() As DataTable
Dim TmpDT = New DataTable
TmpDT.Columns.Add("CveVenta", GetType(Integer))
TmpDT.Columns.Add("Consec", GetType(Integer))
TmpDT.Columns.Add("Cantidad", GetType(Decimal))
TmpDT.Columns.Add("Codigo", GetType(String))
TmpDT.Columns.Add("CveUM", GetType(Integer))
TmpDT.Columns.Add("UM", GetType(String))
TmpDT.Columns.Add("SATClaveUM", GetType(String))
TmpDT.Columns.Add("CveClasificacion", GetType(Integer))
TmpDT.Columns.Add("Clasificacion", GetType(String))
TmpDT.Columns.Add("CvePS", GetType(Integer))
TmpDT.Columns.Add("PS", GetType(String))
TmpDT.Columns.Add("CodigoPS", GetType(String))
TmpDT.Columns.Add("SATClaveProdServ", GetType(String))
TmpDT.Columns.Add("NoIdentificacion", GetType(String))
TmpDT.Columns.Add("CveTipoPS", GetType(Integer))
TmpDT.Columns.Add("CveTipoInvPS", GetType(Integer))
TmpDT.Columns.Add("Serie", GetType(String))
TmpDT.Columns.Add("CuentaPredial", GetType(String))
TmpDT.Columns.Add("Obs", GetType(String))
TmpDT.Columns.Add("TiempoEntrega", GetType(String))
TmpDT.Columns.Add("PU", GetType(Decimal))
TmpDT.Columns.Add("IVA", GetType(Decimal))
TmpDT.Columns.Add("ImporteIVA", GetType(Decimal))
TmpDT.Columns.Add("PorcentajeIVA", GetType(Decimal))
TmpDT.Columns.Add("ImporteRetIVA", GetType(Decimal))
TmpDT.Columns.Add("ImporteRetISR", GetType(Decimal))
TmpDT.Columns.Add("PorcentajeRetIVA", GetType(Decimal))
TmpDT.Columns.Add("PorcentajeRetISR", GetType(Decimal))
TmpDT.Columns.Add("ImporteIEPS", GetType(Decimal))
TmpDT.Columns.Add("IEPS", GetType(Decimal))
TmpDT.Columns.Add("PorcentajeIEPS", GetType(Decimal))
TmpDT.Columns.Add("Descuento", GetType(Decimal))
TmpDT.Columns.Add("TipoDescuento", GetType(Integer))
TmpDT.Columns.Add("TotalImporte", GetType(Decimal))
TmpDT.Columns.Add("Total", GetType(Decimal))
'Para uso del módulo contable
TmpDT.Columns.Add("AsientoContableVentas", GetType(Integer))
TmpDT.Columns.Add("IdCtaContVentas", GetType(Integer))
TmpDT.Columns.Add("AplicaParaConcepto", GetType(Boolean))
TmpDT.Columns.Add("CveProyecto", GetType(Integer))
TmpDT.Columns.Add("Proyecto", GetType(String))
TmpDT.Columns.Add("CveSubProyecto", GetType(Integer))
TmpDT.Columns.Add("SubProyecto", GetType(String))
TmpDT.Columns.Add("CveVentaDetallePadre", GetType(Integer))
'TipoDescuento: 1 = Descuento * PU; 2 = Descuento por Total del concepto
TmpDT.Columns.Add("CvePresupuestoIngreso", GetType(Integer))
TmpDT.Columns.Add("CveFuenteRecaudacion", GetType(Integer))
'Contratos
TmpDT.Columns.Add("CveContratoDetalle", GetType(Integer))
'Remisiones a Facturas
TmpDT.Columns.Add("CveVentaDetalle", GetType(Integer))
TmpDT.Columns.Add("CveVentaDetalleRemision", GetType(Integer))
TmpDT.Columns.Add("CveVentaDetalleCotizacion", GetType(Integer))
'Pedido2 a Facturas
TmpDT.Columns.Add("CveVentaDetallePedido2", GetType(Integer))
TmpDT.Columns.Add("Origen", GetType(Integer))
'Ordenes Servicio
TmpDT.Columns.Add("CveOS", GetType(Integer))
TmpDT.Columns.Add("CveOSDetalle", GetType(Integer))
TmpDT.Columns.Add("SeFacturara", GetType(Integer))
TmpDT.Columns.Add("Folio", GetType(Integer))
TmpDT.Columns.Add("Estatus", GetType(String))
'Ordenamiento
TmpDT.Columns.Add("Orden", GetType(Integer))
TmpDT.Columns.Add("TipoDocto", GetType(String))
'OC
TmpDT.Columns.Add("CveOrdenCompraDetalle", GetType(Integer))
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
TmpDT.Columns.Add("CantidadFacturadaRem", GetType(Decimal))
TmpDT.Columns.Add("CantidadFacturadaCot", GetType(Decimal))
TmpDT.Columns.Add("CantidadFacturadaPed2", GetType(Decimal))
TmpDT.Columns.Add("CantidadInventario", GetType(Decimal))
TmpDT.Columns.Add("ClaveSATFraccionArancelaria", GetType(String))
TmpDT.Columns.Add("ClaveSATUnidadAduana", GetType(String))
TmpDT.Columns.Add("ClaveSATFraccionArancelariaDescripcion", GetType(String))
TmpDT.Columns.Add("ClaveSATUnidadAduanaDescripcion", GetType(String))
TmpDT.Columns.Add("CveTamaño", GetType(Integer))
TmpDT.Columns.Add("EsCargo", GetType(Boolean))
Return TmpDT
End Function
Protected Sub CargaDTDetalleRNC()
'CvePS = Dr("CvePS").ToString.ToEntero
'CveUM = Dr("CveUM").ToString.ToEntero
'Cantidad = Dr("Cantidad").ToString.ToDecimal
'PU = Dr("PU").ToString.ToDecimal
'AplicaSerie = CBool(Dr("AplicaSerie"))
'Serie = If(AplicaSerie, Dr("Serie").ToString, "-1")
'AplicaLote = CBool(Dr("AplicaLote"))
'Lote = If(AplicaSerie, Dr("Lote").ToString, "-1")
'AplicaCaducidad = CBool(Dr("AplicaCaducidad"))
'FechaCaducidad = If(AplicaCaducidad, Dr("FechaCaducidad").ToString.ToDateTime, MinFecha)
'If Dr("CveTipoInvPS").ToString.ToEntero = 5 AndAlso AplicaSerie AndAlso Serie = "" Then
' OcurrioError = True
' ErrorList.Add("Se deben especificar las Series de los productos de almacén")
' Exit For
'End If
Dim DtInventario As DataTable = New DataTable
Dim column As DataColumn = New DataColumn("Consec")
column.DataType = GetType(Integer)
With column
.AutoIncrement = True
.AutoIncrementSeed = 1
.AutoIncrementStep = 1
End With
DtInventario.Columns.Add(column)
DtInventario.Columns.Add("Cantidad", GetType(Decimal))
DtInventario.Columns.Add("CveVentaDetalle", GetType(Integer))
DtInventario.Columns.Add("CvePS", GetType(Integer))
DtInventario.Columns.Add("CveUM", GetType(Integer))
DtInventario.Columns.Add("PU", GetType(Decimal))
DtInventario.Columns.Add("CveTipoInvPS", GetType(Integer))
DtInventario.Columns.Add("AplicaSerie", GetType(Boolean))
DtInventario.Columns.Add("Serie", GetType(String))
DtInventario.Columns.Add("AplicaLote", GetType(Boolean))
DtInventario.Columns.Add("Lote", GetType(String))
DtInventario.Columns.Add("AplicaCaducidad", GetType(Boolean))
DtInventario.Columns.Add("FechaCaducidad", GetType(DateTime))
For Each Row As DataRow In DtMovimientos.Rows
Dim Cantidad As Decimal = Row("CantidadDevuelta").ToString().ToDecimal()
Dim PU As Decimal = Row("PU").ToString().ToDecimal()
Dim SubTotal As Decimal = Cantidad * PU
Dim CveUnidadMedida As Integer = 0
Dim CveClasificacion As Integer = 0
Dim UnidadMedida As String = ""
Dim Clasificacion As String = ""
Dim PS As String = ""
Dim PorcentajeIVA As Decimal = 0
Dim CvePS As Integer = Row("CvePS").ToString().ToEntero()
If CvePS > 0 Then
Dim Dr As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).Rows(0)
Dim DrSubProyecto As DataRow = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveSubProyecto = {0}", ObjRemisionNC.CveSubProyecto))
If Dr IsNot Nothing AndAlso DrSubProyecto IsNot Nothing Then
CveUnidadMedida = Dr("CveUnidadMedida").ToString.ToEntero
CveClasificacion = Dr("CveClasificacion").ToString.ToEntero
PS = Dr("PSCodigo").ToString
UnidadMedida = Dr("UnidadMedida").ToString
Clasificacion = Dr("Clasificacion").ToString
PorcentajeIVA = DrSubProyecto("IVA").ToString().ToDecimal
If AddPSRNC(ObjRemisionNC.DtDetalle, Cantidad, CveUnidadMedida, UnidadMedida, CveClasificacion, Clasificacion, CvePS, PS, "", PU, 0, -1, "", ObjRemisionNC.CveSubProyecto, ObjRemisionNC.SubProyecto.SubProyecto, PorcentajeIVA:=PorcentajeIVA, CveTamaño:=-1, CveVentaDetalle:=Row("CveVentaDetalle").ToString().ToEntero()) Then
Dim RowInventario As DataRow = DtInventario.NewRow
RowInventario("Cantidad") = Cantidad
RowInventario("CveVentaDetalle") = -1
RowInventario("CvePS") = CvePS
RowInventario("CveUM") = CveUnidadMedida
RowInventario("PU") = PU
RowInventario("CveTipoInvPS") = 0
RowInventario("AplicaSerie") = Not String.IsNullOrEmpty(Row("Serie").ToString())
RowInventario("Serie") = Row("Serie")
RowInventario("AplicaLote") = Not String.IsNullOrEmpty(Row("Lote").ToString())
RowInventario("Lote") = Row("Lote")
Dim AplicaCaducidad = If(String.IsNullOrEmpty(Row("FechaCaducidad").ToString()), False, If(Row("FechaCaducidad").ToString().ToDateTime() <= MinFecha, False, True))
RowInventario("AplicaCaducidad") = AplicaCaducidad
RowInventario("FechaCaducidad") = Row("FechaCaducidad")
DtInventario.Rows.Add(RowInventario)
End If
End If
Else
Alert("No se pudo cargar el producto", TipoMensaje.MsgError)
End If
Next
Dim TotalImporte As Decimal = ObjRemisionNC.DtDetalle.SUM("TotalImporte").ToDecimal()
Dim ImporteIVA As Decimal = ObjRemisionNC.DtDetalle.SUM("ImporteIVA").ToDecimal()
Dim ImporteRetIVA As Decimal = ObjRemisionNC.DtDetalle.SUM("ImporteRetIVA").ToDecimal()
Dim ImporteRetISR As Decimal = ObjRemisionNC.DtDetalle.SUM("ImporteRetISR").ToDecimal()
Dim ImporteIEPS As Decimal = ObjRemisionNC.DtDetalle.SUM("ImporteIEPS").ToDecimal()
Dim Descuento As Decimal = ObjRemisionNC.DtDetalle.SUM("Descuento").ToDecimal()
Dim Amortizacion As Decimal = 0
Dim Total As Decimal = (TotalImporte + ImporteIVA + ImporteIEPS) - (ImporteRetIVA + ImporteRetISR + Descuento + Amortizacion)
'DETALLES
ObjRemisionNC.SubTotal = TotalImporte
ObjRemisionNC.Descuento = Descuento
ObjRemisionNC.Amortizacion = Amortizacion
ObjRemisionNC.IVA = ImporteIVA
ObjRemisionNC.RetIVA = ImporteRetIVA
ObjRemisionNC.RetISR = ImporteRetISR
ObjRemisionNC.IEPS = ImporteIEPS
ObjRemisionNC.Total = Total
ObjRemisionNC.TotalOtrosConceptos = 0
ObjRemisionNC.ObservacionesMovimiento = TxtObservaciones.Text
ObjRemisionNC.DtInventario = DtInventario
'Select Case DtMovimientos.FiltroPrimeroValor("CveConcepto").ToEntero()
' Case 40
' ObjRemisionNC.CveConceptoMovimiento = 41 ' DEVOLUCION DEL CLIENTE
' Case 3
' ObjRemisionNC.CveConceptoMovimiento = 18 ' DEVOLUCION DEL CLIENTE
'End Select
ObjRemisionNC.CveAlmacen = DdlAlmacen.SelectedValue.ToEntero()
Dim CveTipoAlmacen As Integer = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=ObjRemisionNC.CveAlmacen).FiltroPrimeroValor("CveTipoAlmacen").ToEntero
Select Case CveTipoAlmacen
Case 10
ObjRemisionNC.CveConceptoMovimiento = 41 ' DEVOLUCION DIRECTA DEL CLIENTE
Case Else
ObjRemisionNC.CveConceptoMovimiento = 18 ' DEVOLUCION DEL CLIENTE
End Select
End Sub
#End Region
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs)
Dim CveCliente As Integer = DdlCliente.SelectedValue.ToEntero()
Dim CveSubProyecto As Integer = DdlSubProyecto.SelectedValue.ToEntero()
Dim CveAlmacen As Integer = DdlAlmacen.SelectedValue.ToEntero()
If CveCliente <= 0 Then
Alert("Debe seleccionar un cliente", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If CveSubProyecto <= 0 Then
Alert("Debe seleccionar un sub proyecto", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If CveAlmacen <= 0 Then
Alert("Debe seleccionar un almacen", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If DtMovimientos Is Nothing OrElse DtMovimientos.Rows.Count = 0 Then
Alert("No hay producto para devolver", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Try
CreaRemisionNC(CveCliente, CveSubProyecto)
If ObjRemisionNC IsNot Nothing Then
Dim Resp = ObjRemisionNC.EmitirFactura(False)
If Resp.Mensajes.Count > 0 AndAlso Resp.CveVenta > 0 Then
Dim Msg As New StringBuilder
If Resp.CveVenta > 0 Then
If Resp IsNot Nothing Then
For Each mensaje2 As String In Resp.Mensajes
Msg.AppendFormat("<br>{0}", mensaje2)
Next
End If
End If
Msg.AppendFormat("<br/>El Movimiento se registro con el Folio: <b><a href='/Inventarios/EntradasSalidas.aspx?CveMovimiento={1}' target='_blank'>{0}</a></b>", Resp.FolioUsado, Resp.CveMovimientoUsado)
Msg.AppendFormat("<br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">Imprimir Movimiento</a> ", Encripta(String.Format("OP=Alm&CveMovimiento={0}", Resp.CveMovimientoUsado)))
Alert(Msg.ToString(), If(Resp.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), JSBtnAceptar:="BtnRefrescarPagina();", ShowCloseButton:=False)
ElseIf Resp.Mensajes.Count <= 0 AndAlso Resp.CveVenta <= 0 Then
Alert("Ocurrió un error al guardar", TipoMensaje.MsgError)
ElseIf Resp.Mensajes.Count >= 0 AndAlso Resp.CveVenta <= 0 Then
For Each Mensaje In Resp.Mensajes
Alert(Mensaje, If(Resp.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), If(Resp.TieneError, "", Resp.LigaPV), ShowCloseButton:=False)
Next
End If
End If
Catch ex As Exception
OnError("Ocurrió un error al guardar", ex)
End Try
End Sub
Protected Sub GvDatos_RowDeleting(sender As Object, e As GridViewDeleteEventArgs)
Dim GvRow As GridViewRow = GvDatos.Rows(e.RowIndex)
If DtMovimientos IsNot Nothing Then
Dim ConsecEliminar As Integer = GvRow.DataKey("Consec").ToEntero()
If ConsecEliminar > 0 Then
Dim RowEliminar = DtMovimientos.Select($"Consec={ConsecEliminar}")
If RowEliminar IsNot Nothing AndAlso RowEliminar.Length > 0 AndAlso RowEliminar.Length = 1 Then
RowEliminar(0).Delete()
End If
End If
GvDatos.DataSource = DtMovimientos
GvDatos.DataBind()
End If
UpDatos.Update()
End Sub
End Class

View File

@@ -377,6 +377,11 @@ Partial Class Inventarios_ResguardoMaterial
'End If 'End If
'dtt.Dispose() 'dtt.Dispose()
End If End If
Else
ThSeccion.Visible = False
TrSeccion.Visible = False
DdlSeccionAlmacen.Items.Clear()
End If End If
'activa lote 'activa lote
If CBool(drp("AplicaLote")) Then If CBool(drp("AplicaLote")) Then
@@ -453,11 +458,11 @@ Partial Class Inventarios_ResguardoMaterial
Dim Valido As Boolean = True Dim Valido As Boolean = True
Dim cantidadd As Double = txtCantidad.Text.ToDouble Dim cantidadd As Double = txtCantidad.Text.ToDouble
Dim Existencia As Double = GetExistencias(PSSelected, DdlUnidad.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, If(TxtnSerie.Visible, TxtnSerie.Text, "-1").ToString) Dim Existencia As Double = GetExistencias(PSSelected, DdlUnidad.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, If(TxtnSerie.Visible, TxtnSerie.Text, "-1").ToString)
If Existencia - txtCantidad.Text.ToDouble < 0 Then If Existencia - txtCantidad.Text.ToDouble - DtMovimientos.SUM("Cantidad", $"CvePS = {PSSelected} ") < 0 Then
If Existencia <= 0 Then If Existencia <= 0 Then
Alert("No hay existencia del producto", TipoMensaje.MsgAdvertencia) Alert("No hay existencia del producto", TipoMensaje.MsgAdvertencia)
Else Else
Alert(String.Format("Solo hay en existencia: {0}", Existencia), TipoMensaje.MsgAdvertencia) Alert(String.Format("Solo hay en existencia: {0}", Existencia - DtMovimientos.SUM("Cantidad", $"CvePS = {PSSelected} ")), TipoMensaje.MsgAdvertencia)
If Not UsuarioActual.TienePermisoProceso(114) Then If Not UsuarioActual.TienePermisoProceso(114) Then
cantidadd = Existencia cantidadd = Existencia
End If End If
@@ -496,6 +501,22 @@ Partial Class Inventarios_ResguardoMaterial
DdlClasificacion.SelectedValue = "-1" DdlClasificacion.SelectedValue = "-1"
txtCantidad.Text = "" txtCantidad.Text = ""
TxtObservacionesdetalle.Text = "" TxtObservacionesdetalle.Text = ""
ThCaducidad.Visible = False
TrCaducidad.Visible = False
TxtCaducidad.Text = ""
ThLote.Visible = False
TrLote.Visible = False
TxtLote.Text = ""
ThSerie.Visible = False
TrSerie.Visible = False
TxtnSerie.Visible = False
TxtnSerie.Text = ""
ThSeccion.Visible = False
TrSeccion.Visible = False
DdlSeccionAlmacen.Items.Clear()
End Sub End Sub
#End Region #End Region

View File

@@ -382,8 +382,8 @@ Partial Class Inventarios_TrasladoSolicitud
UpDatos.Update() UpDatos.Update()
RegistraScript(String.Format("$('#{0}').modal();", "ModalPS")) RegistraScript(String.Format("$('#{0}').modal();", "ModalPS"))
End Sub End Sub
Private Sub BtnAgregarPS_Click(sender As Object, e As EventArgs) Handles BtnAgregarPS.Click Private Sub BtnAgregarPS_Click(sender As Object, e As EventArgs) Handles BtnAgregarPS.Click
Dim Existencia As Boolean
If Not DdlProductoServicio.SelectedValue.ToEntero > 0 Then If Not DdlProductoServicio.SelectedValue.ToEntero > 0 Then
Alert("Tiene que seleccionar un producto.", TipoMensaje.MsgAdvertencia) Alert("Tiene que seleccionar un producto.", TipoMensaje.MsgAdvertencia)
Exit Sub Exit Sub
@@ -419,8 +419,8 @@ Partial Class Inventarios_TrasladoSolicitud
End Sub End Sub
Private Function AddPSTemporal() As Boolean Private Function AddPSTemporal() As Boolean
Dim Row As DataRow = TempDT.NewRow() Dim Row As DataRow = TempDT.NewRow()
Dim Lote As String Dim Lote As String = "-1"
Dim FechaCaducidad As Date Dim FechaCaducidad As Date = MinFecha
Row("Cantidad") = TxtCantidad.Text.Trim.ToDouble Row("Cantidad") = TxtCantidad.Text.Trim.ToDouble
Row("CvePS") = DdlProductoServicio.SelectedValue.ToEntero Row("CvePS") = DdlProductoServicio.SelectedValue.ToEntero
Row("CodigoPS") = DdlProductoServicio.SelectedText Row("CodigoPS") = DdlProductoServicio.SelectedText
@@ -465,7 +465,7 @@ Partial Class Inventarios_TrasladoSolicitud
If Existencia = 0 Then If Existencia = 0 Then
Alert("No hay existencia del producto", TipoMensaje.MsgAdvertencia) Alert("No hay existencia del producto", TipoMensaje.MsgAdvertencia)
Else Else
Alert($"No hay existencia suficiente del producto. Solo hay en existencia: {Existencia}", TipoMensaje.MsgAdvertencia) Alert($"No hay existencia suficiente del producto. Solo hay en existencia: {Existencia - TempDT.SUM("Cantidad", $"CvePS = {DdlProductoServicio.SelectedValue.ToEntero} AND CveUM = {DdlUM.SelectedValue.ToEntero}")}", TipoMensaje.MsgAdvertencia)
End If End If
Return False Return False
End If End If
@@ -580,8 +580,10 @@ Partial Class Inventarios_TrasladoSolicitud
RowTemp("CveUM") = row.DataKey("CveUM").ToEntero RowTemp("CveUM") = row.DataKey("CveUM").ToEntero
RowTemp("UnidadMedida") = row.DataKey("UM") RowTemp("UnidadMedida") = row.DataKey("UM")
RowTemp("Observaciones") = "" RowTemp("Observaciones") = ""
'RowTemp("CveDireccionEnvio") = DdlDireccionEnvio.SelectedValue RowTemp("Lote") = "-1"
'RowTemp("DireccionEnvio") = IIf(DdlDireccionEnvio.SelectedValue = "-1", "", DdlDireccionEnvio.SelectedItem) RowTemp("FechaCaducidad") = MinFecha
'RowTemp("CveDireccionEnvio") = DdlDireccionEnvio.SelectedValue
'RowTemp("DireccionEnvio") = IIf(DdlDireccionEnvio.SelectedValue = "-1", "", DdlDireccionEnvio.SelectedItem)
RowTemp("CveContratoDetalle") = row.DataKey("CveContratoDetalle") RowTemp("CveContratoDetalle") = row.DataKey("CveContratoDetalle")
CodigoPS = RowTemp("CodigoPS").ToString CodigoPS = RowTemp("CodigoPS").ToString
@@ -1005,7 +1007,7 @@ Partial Class Inventarios_TrasladoSolicitud
If Existencia = 0 Then If Existencia = 0 Then
Alert($"No hay existencia del producto: {CodigoPS}", TipoMensaje.MsgAdvertencia) Alert($"No hay existencia del producto: {CodigoPS}", TipoMensaje.MsgAdvertencia)
Else Else
Alert($"No hay existencia suficiente del producto: {CodigoPS}, Solo hay en existencia: {Existencia}", TipoMensaje.MsgAdvertencia) Alert($"No hay existencia suficiente del producto: {CodigoPS}, Solo hay en existencia: {Existencia - TempDT.SUM("Cantidad", $"CvePS = {RowTemp("CvePS").ToString.ToEntero} AND CveUM = {RowTemp("CveUM").ToString.ToEntero}")}", TipoMensaje.MsgAdvertencia)
End If End If
End If End If
TempDT.Rows.Add(RowTemp) TempDT.Rows.Add(RowTemp)

View File

@@ -10,15 +10,28 @@
<asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server"> <asp:Content ID="Content4" ContentPlaceHolderID="HB" Runat="Server">
</asp:Content> </asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server"> <asp:Content ID="Content5" ContentPlaceHolderID="H" Runat="Server">
<li> <asp:UpdatePanel runat="server" id="UPAcciones" UpdateMode="Conditional">
<asp:LinkButton ID="LnkPdf" OnClick="LnkPdf_Click" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Generar PDF</asp:LinkButton> <ContentTemplate>
</li> <li>
<li> <asp:LinkButton ID="LnkPdf" OnClick="LnkPdf_Click" runat="server"> <i class="fa fa-file-pdf-o" style="font-weight:bold;"></i> Generar PDF</asp:LinkButton>
<asp:LinkButton ID="LnkExcel" OnClick="LnkExcel_Click" runat="server"><i class="fa fa-file-excel-o" style="font-weight:bold;"></i> Exporta Excel</asp:LinkButton> </li>
</li> <li>
<li> <asp:LinkButton ID="LnkExcel" OnClick="LnkExcel_Click" runat="server"><i class="fa fa-file-excel-o" style="font-weight:bold;"></i> Exporta Excel</asp:LinkButton>
<asp:LinkButton ID="LnkImpresionMasiva" OnClick="LnkImpresionMasiva_Click" runat="server"> <i class="fa fa-download" style="font-weight:bold;"></i> Descargar PDFs</asp:LinkButton> </li>
</li> <li>
<asp:LinkButton ID="LnkImpresionMasiva" OnClick="LnkImpresionMasiva_Click" runat="server"> <i class="fa fa-download" style="font-weight:bold;"></i> Descargar PDFs</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkCambiarFecha" OnClick="LnkCambiarFecha_Click" runat="server"> <i class="fa fa-calendar" style="font-weight:bold;"></i> Cambiar Fechas</asp:LinkButton>
</li>
<li>
<asp:LinkButton ID="LnkGuardar" runat="server" Visible="false" data-toggle="modal" data-target="#ModalUpload"> <i class="fa fa-floppy-o" style="font-weight:bold;"></i> Guardar</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
<asp:PostBackTrigger ControlID="LnkGuardar" />
</Triggers>
</asp:UpdatePanel>
</asp:Content> </asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server"> <asp:Content ID="Content6" ContentPlaceHolderID="HA" Runat="Server">
</asp:Content> </asp:Content>
@@ -108,13 +121,20 @@
<a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvSolicitudes.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a> <a href="javascript:;" onclick="<%= String.Format("FiltrarTabla('TxtBusqueda','{0}')", GvSolicitudes.ClientID) %>" style="margin-top: -3px;" class="btn btn-circle btn-sm label-info"><i class="icon-magnifier"></i></a>
</div> </div>
</div> </div>
<asp:GridView ID="GvSolicitudes" runat="server" GridLines="None" DataKeyNames="CveOrdenCompra,Folio, RazonSocial, ImporteSol, FolioMov, Importe, Nombre" <asp:GridView ID="GvSolicitudes" runat="server" GridLines="None" DataKeyNames="CveOrdenCompra,Folio, RazonSocial, ImporteSol, FolioMov, Importe, Nombre, CveEvento"
CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ScrollAD" data-sort="true" data-footer="0" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" CssClass="table table-striped table-advance table-hover Widthall mysmallbtn ScrollAD" data-sort="true" data-footer="0" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False"
EmptyDataText="No se encontraron registros"> EmptyDataText="No se encontraron registros">
<Columns> <Columns>
<asp:TemplateField Visible="false">
<HeaderTemplate>
</HeaderTemplate>
<ItemTemplate>
<asp:CheckBox ID="ChkOrdenCompra" runat="server"/>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Ord. Compra" ItemStyle-Width="10%"> <asp:TemplateField HeaderText="Ord. Compra" ItemStyle-Width="10%">
<ItemTemplate> <ItemTemplate>
<asp:HyperLink ID="HplNum" runat="server" CssClass="Texto" Target="_blank" NavigateUrl='<%# Eval("CveOrdenCompra", "/OC/OC.aspx?OC={0}")%>' Text='<%# Eval("Folio") %>'></asp:HyperLink> <asp:HyperLink ID="HplNumFolio" runat="server" CssClass="Texto" Target="_blank" NavigateUrl='<%# Eval("CveOrdenCompra", "/OC/OC.aspx?OC={0}")%>' Text='<%# Eval("Folio") %>'></asp:HyperLink>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:BoundField DataField="RazonSocial" HeaderText="Proveedor" ItemStyle-Width="25%" ItemStyle-HorizontalAlign="Left" /> <asp:BoundField DataField="RazonSocial" HeaderText="Proveedor" ItemStyle-Width="25%" ItemStyle-HorizontalAlign="Left" />
@@ -126,7 +146,7 @@
<asp:TemplateField HeaderText="Folio Mov. Banc." ItemStyle-Width="10%" Visible="false"> <asp:TemplateField HeaderText="Folio Mov. Banc." ItemStyle-Width="10%" Visible="false">
<ItemTemplate> <ItemTemplate>
<asp:HyperLink ID="HplNum" runat="server" CssClass="Texto" Target="_blank" NavigateUrl='<%# Eval("CveIE", "/Bancos/IE.aspx?CveIE={0}") %>' Text='<%# Eval("FolioMov") %>'></asp:HyperLink> <asp:HyperLink ID="HplNumFolioMov" runat="server" CssClass="Texto" Target="_blank" NavigateUrl='<%# Eval("CveIE", "/Bancos/IE.aspx?CveIE={0}") %>' Text='<%# Eval("FolioMov") %>'></asp:HyperLink>
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
@@ -151,6 +171,59 @@
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
<div id="ModalUpload" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<!-- Modal content-->
<div class="modal-content">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Actualizar Fechas</h4>
</div>
<div class="modal-body">
<asp:UpdatePanel runat="server" ID="UpFecha" UpdateMode="Conditional">
<ContentTemplate>
<div class="row">
<div class="col-md-6" style="text-align: center;">
<asp:TextBox ID="txtFechaActualizar" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Style="width: 80px;"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="btnFechaActualizar" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaActualiar" runat="server" TargetControlID="txtFechaActualizar" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaActualiar" TargetControlID="txtFechaActualizar" PopupButtonID="btnFechaActualizar" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:CompareValidator ID="CVFechaActualiar" runat="server" ControlToValidate="txtFechaActualizar" Display="None" ErrorMessage="La fecha no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Actualiza"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCEFechaActualiar" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaActualiar" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
<div class="col-md-6" style="text-align: center;">
<asp:TextBox ID="txtFechaActualizarFin" runat="server" CssClass="form-control" CausesValidation="true" MaxLength="10" Style="width: 80px;"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="btnFechaActualizarFin" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaActualiarFin" runat="server" TargetControlID="txtFechaActualizarFin" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaActualiarFin" TargetControlID="txtFechaActualizarFin" PopupButtonID="btnFechaActualizarFin" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
<asp:CompareValidator ID="CVFechaActualiarFin" runat="server" ControlToValidate="txtFechaActualizarFin" Display="None" ErrorMessage="La fecha no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="Actualiza"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCEFechaActualiarFin" runat="server" HighlightCssClass="vco" TargetControlID="CVFechaActualiarFin" Width="350px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="modal-footer">
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:Button ID="BtnGuardarArchivo" OnClick="BtnGuardarArchivo_Click" runat="server" ClientIDMode="Static" Text="Guardar" CssClass="btn btn-primary" ValidationGroup="Actualiza" />
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
</asp:Content> </asp:Content>
<asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server"> <asp:Content ID="Content8" ContentPlaceHolderID="JS" Runat="Server">

View File

@@ -121,20 +121,20 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas
{ {
if (DdlEstatus.SelectedValue.ToEntero() == 3) if (DdlEstatus.SelectedValue.ToEntero() == 3)
{ {
GvSolicitudes.Columns[5].Visible = false; GvSolicitudes.Columns[6].Visible = false;
GvSolicitudes.Columns[9].Visible = false; GvSolicitudes.Columns[10].Visible = false;
GvSolicitudes.Columns[6].Visible = true;
GvSolicitudes.Columns[7].Visible = true; GvSolicitudes.Columns[7].Visible = true;
GvSolicitudes.Columns[8].Visible = true;
} }
else else
{ {
GvSolicitudes.Columns[5].Visible = true; GvSolicitudes.Columns[6].Visible = true;
GvSolicitudes.Columns[9].Visible = true; GvSolicitudes.Columns[10].Visible = true;
GvSolicitudes.Columns[6].Visible = false;
GvSolicitudes.Columns[7].Visible = false; GvSolicitudes.Columns[7].Visible = false;
GvSolicitudes.Columns[8].Visible = false;
} }
CargaDatos(); CargaDatos();
@@ -153,6 +153,60 @@ public partial class OC_RepSolicitudesAnticipo : ClsPaginas
{ {
GenerarImpresionMasiva(); GenerarImpresionMasiva();
} }
protected void LnkCambiarFecha_Click(object sender, EventArgs e)
{
GvSolicitudes.Columns[0].Visible = true;
LnkGuardar.Visible = true;
LnkCambiarFecha.Visible = false;
UPAcciones.Update();
UPDatos.Update();
}
protected void BtnGuardarArchivo_Click(object sender, EventArgs e)
{
ActualizarFechas();
RegistraScript("$('#ModalUpload').modal('hide')", "hidemodal1");
GvSolicitudes.Columns[0].Visible = false;
LnkGuardar.Visible = false;
LnkCambiarFecha.Visible = true;
UPAcciones.Update();
UPDatos.Update();
}
private void ActualizarFechas()
{
ClsOIEventos ObjEvento = new ClsOIEventos();
DateTime FechaInicio;
DateTime FechaFin;
int CveEvento;
Boolean TieneError = true;
foreach (GridViewRow Gvr in GvSolicitudes.Rows)
{
if (Gvr.FCCheckBox("ChkOrdenCompra").Checked)
{
FechaInicio = txtFechaActualizar.Text.ToDateTime();
FechaFin = txtFechaActualizarFin.Text.ToDateTime();
CveEvento = Gvr.DataKey("CveEvento").ToEntero();
if (ObjEvento.UpdateEvento("-1", "-1", -1, -1, -1, FechaInicio, FechaFin, -1, "-1", CveEvento))
{
TieneError = false;
}
else
{
TieneError = true;
Alert("Ocurrio un error al actulizar las fechas", TipoMensaje.MsgError);
ObjEvento.RollBack();
break;
}
}
}
if (TieneError == false) {
ObjEvento.Commit();
Alert("Las Fechas se actualizaron correctamente");
}
ObjEvento.Dispose();
CargaDatos();
}
protected void GenerarPDF(String Opcion) protected void GenerarPDF(String Opcion)
{ {

View File

@@ -286,7 +286,7 @@
</div> </div>
<div class="form-group form-md-line-input input-iconright"> <div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtTelefono" runat="server" CssClass="form-control" MaxLength="10"></asp:TextBox> <asp:TextBox ID="TxtTelefono" runat="server" CssClass="form-control" MaxLength="15"></asp:TextBox>
<label for="<%= TxtTelefono.ClientID.ToString()%>">Telefono:</label> <label for="<%= TxtTelefono.ClientID.ToString()%>">Telefono:</label>
</div> </div>

View File

@@ -14,6 +14,7 @@
<asp:DropDownList ID="DdlVariable" runat="server" AutoPostBack="True" Width="300px" CssClass="table-group-action-input form-control input-inline input-small input-sm select2me"> <asp:DropDownList ID="DdlVariable" runat="server" AutoPostBack="True" Width="300px" CssClass="table-group-action-input form-control input-inline input-small input-sm select2me">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem> <asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
<asp:ListItem Text="Usuarios" Value="GlobalDTUsuarios"></asp:ListItem> <asp:ListItem Text="Usuarios" Value="GlobalDTUsuarios"></asp:ListItem>
<asp:ListItem Text="UsuarioResponsable" Value="GlobalDTUsuarioResponsable"></asp:ListItem>
<asp:ListItem Text="Empresas" Value="GlobalDTEmpresas"></asp:ListItem> <asp:ListItem Text="Empresas" Value="GlobalDTEmpresas"></asp:ListItem>
<asp:ListItem Text="Roles" Value="GlobalDTRoles"></asp:ListItem> <asp:ListItem Text="Roles" Value="GlobalDTRoles"></asp:ListItem>
<asp:ListItem Text="Clientes" Value="GlobalDTCliente"></asp:ListItem> <asp:ListItem Text="Clientes" Value="GlobalDTCliente"></asp:ListItem>

View File

@@ -7,7 +7,9 @@ Partial Class Sistemas_CatSesiones
Protected Sub BtnCargar_Click(sender As Object, e As EventArgs) Handles BtnCargar.Click Protected Sub BtnCargar_Click(sender As Object, e As EventArgs) Handles BtnCargar.Click
If DdlVariable.SelectedItem.Value = "GlobalDTUsuarios" Then If DdlVariable.SelectedItem.Value = "GlobalDTUsuarios" Then
CargaUsuarios() CargaUsuarios()
ElseIf DdlVariable.SelectedItem.Value = "GlobalDTUsuarioResponsable" Then
CargaUsuariosResponsable()
ElseIf DdlVariable.SelectedItem.Value = "GlobalDTAlmacenUsuarios" Then ElseIf DdlVariable.SelectedItem.Value = "GlobalDTAlmacenUsuarios" Then
CargaAlmacenUsuarios() CargaAlmacenUsuarios()
ElseIf DdlVariable.SelectedItem.Value = "GlobalDTCliente" Then ElseIf DdlVariable.SelectedItem.Value = "GlobalDTCliente" Then
@@ -287,6 +289,19 @@ Partial Class Sistemas_CatSesiones
'Fin Carga Usuarios 'Fin Carga Usuarios
End Sub End Sub
Private Sub CargaUsuariosResponsable()
'Carga Usuarios
Dim ObjUsuarios As New ClsSisUsuarios
If ObjUsuarios.GetUsuariosEmpresas(-1) Then
Alert(ObjUsuarios.DtResultados.Rows.Count.ToString)
Application("GlobalDTUsuarioResponsable") = ObjUsuarios.DtResultados
Else
Application("GlobalDTUsuarioResponsable") = Nothing
End If
ObjUsuarios.Dispose()
'Fin Carga Usuarios
End Sub
Private Sub CargaEmpresas() Private Sub CargaEmpresas()
'Carga Empresas 'Carga Empresas

View File

@@ -522,30 +522,13 @@ Partial Class Sistemas_PopUpAddUsuario
Alert("Ocurrió un error al agregar el usuario.", TipoMensaje.MsgInformacion) Alert("Ocurrió un error al agregar el usuario.", TipoMensaje.MsgInformacion)
End If End If
Catch ex As Exception Catch ex As Exception
HuboError = true
OnError("Ocurrió un error al agregar el usuario.", ex) OnError("Ocurrió un error al agregar el usuario.", ex)
End Try End Try
If Not HuboError Then If Not HuboError Then
ObjUsuarios.Commit() ObjUsuarios.Commit()
If UsuarioActual.Empresa.CvePlataforma = 3 Then
Using ObjNotificaciones As New ClsSisNotificaciones()
ObjNotificaciones.DeleteNotificacion(-1, CveUsuario)
For Each row As GridViewRow In GVNotificaciones.Rows
If row.FCCheckBox("chkCorreo").Checked OrElse row.FCCheckBox("chkVentana").Checked OrElse row.FCCheckBox("chkSMS").Checked OrElse
row.FCCheckBox("chkApp").Checked OrElse row.FCCheckBox("chkCampana").Checked Then
If Not ObjNotificaciones.AddUsuariosNotificacion(CveUsuario, row.DataKey("CveNotificacion"), row.FCCheckBox("chkCorreo").Checked, row.FCCheckBox("chkVentana").Checked, row.FCCheckBox("chkSMS").Checked,
row.FCCheckBox("chkApp").Checked, row.FCCheckBox("chkCampana").Checked) Then
HuboError = True
End If
End If
Next
End Using
End If
Dim JSBTN As String = "" Dim JSBTN As String = ""
If UsuarioActual.Empresa.CvePlataforma = 3 AndAlso UsuarioActual.CveCliente > 0 Then If UsuarioActual.Empresa.CvePlataforma = 3 AndAlso UsuarioActual.CveCliente > 0 Then
@@ -566,7 +549,24 @@ Partial Class Sistemas_PopUpAddUsuario
ObjUsuarios.RollBack() ObjUsuarios.RollBack()
Alert("Ocurrió un error al agregar el usuario.", TipoMensaje.MsgInformacion) Alert("Ocurrió un error al agregar el usuario.", TipoMensaje.MsgInformacion)
End If End If
ObjUsuarios.Dispose() ObjUsuarios.Dispose()
If Not HuboError AndAlso UsuarioActual.Empresa.CvePlataforma = 3 Then
Using ObjNotificaciones As New ClsSisNotificaciones()
ObjNotificaciones.DeleteNotificacion(-1, CveUsuario)
For Each row As GridViewRow In GVNotificaciones.Rows
If row.FCCheckBox("chkCorreo").Checked OrElse row.FCCheckBox("chkVentana").Checked OrElse row.FCCheckBox("chkSMS").Checked OrElse
row.FCCheckBox("chkApp").Checked OrElse row.FCCheckBox("chkCampana").Checked Then
If Not ObjNotificaciones.AddUsuariosNotificacion(CveUsuario, row.DataKey("CveNotificacion"), row.FCCheckBox("chkCorreo").Checked, row.FCCheckBox("chkVentana").Checked, row.FCCheckBox("chkSMS").Checked,
row.FCCheckBox("chkApp").Checked, row.FCCheckBox("chkCampana").Checked) Then
HuboError = True
End If
End If
Next
End Using
End If
RecargarGlobalUsuarios() RecargarGlobalUsuarios()
RecargarGlobal() RecargarGlobal()

View File

@@ -2693,12 +2693,18 @@ Partial Class Ventas_ClientesAbonar
If CveConceptoDeduccion = 78 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.IdCuentaOtrosIngresos If CveConceptoDeduccion = 78 Then IdCuentaContableNoDeducible = UsuarioActual.Empresa.IdCuentaOtrosIngresos
If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) Then If UsuarioActual.CveEmpresa.Contiene(4, 7, 11, 12, 122) Then
ClienteMovto = False : Saldo = Saldo * -1 ClienteMovto = False : Saldo = Saldo * -1
ImpuestosMovto = True : IVA = IVA * -1 ImpuestosMovto = True : IVA = IVA * -1
RETIVA = RETIVA * -1
'RETIVA = RETIVA * -1
RETIVA = ((SubTotal * RETIVA / gr.DataKey("SubTotal").ToDecimal.RoundSQL) * -1).RoundSQL(2)
CveConceptoCliente = 1 CveConceptoCliente = 1
'falta cuenta incobrable 'falta cuenta incobrable
IdCuentaContableNoDeducible = 3114 IdCuentaContableNoDeducible = 3114
End If End If
Dim UsaComplementaria As Boolean = False Dim UsaComplementaria As Boolean = False

View File

@@ -2746,58 +2746,81 @@
</div> </div>
<div id="DivRecepcionUsados" runat="server"> <div id="DivRecepcionUsados" runat="server">
<div class="row"> <div class="portlet light xspadding bordered">
<div class="col-md-6"> <div class="portlet-title">
<label>Modelo:</label> <div class="caption font-green">
<br /> <i class="icon-pin font-green"></i>
<asp:DropDownList ID="DdlModeloAuto" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="ModeloMarca" DataValueField="CveModeloAuto"> <span class="caption-subject bold uppercase">Datos de Usados </span>
</asp:DropDownList> </div>
<div class="tools">
<a href="javascript;" class="collapse" data-original-title="" title=""></a>
</div>
</div> </div>
<div class="col-md-6"> <div class="portlet-body form">
<label>Año:</label> <div class="row">
<br /> <div class="col-md-4">
<asp:TextBox ID="TxtAnioVehiculo" type="number" runat="server" Height="100%" Width="100%" CssClass="form-control" CausesValidation="true"></asp:TextBox> <label>Tipo Servicio:</label>
<br />
<asp:DropDownList ID="DdlTipoServicio" CssClass="form-control input-sm select2me" runat="server" CausesValidation="true">
<asp:ListItem Text="Seleccione" Value="-1"></asp:ListItem>
<asp:ListItem Text="Particular" Value="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="Comercial" Value="2"></asp:ListItem>
<asp:ListItem Text="Taxi" Value="3"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-4">
<label>Modelo:</label>
<br />
<asp:DropDownList ID="DdlModeloAuto" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="ModeloMarca" DataValueField="CveModeloAuto">
</asp:DropDownList>
</div>
<div class="col-md-4">
<label>Año:</label>
<br />
<asp:TextBox ID="TxtAnioVehiculo" type="number" runat="server" Height="100%" Width="100%" CssClass="form-control" CausesValidation="true"></asp:TextBox>
</div>
</div>
<div class="row">
<div class="col-md-6">
<label>Usado:</label>
<br />
<asp:DropDownList ID="DdlRecepcionUsados" CssClass="form-control input-sm select2me" runat="server" CausesValidation="true" DataTextField="CodigoPS" DataValueField="CvePSCargo" Width="100%" OnSelectedIndexChanged="DdlRecepcionUsados_SelectedIndexChanged" AutoPostBack="true">
</asp:DropDownList>
</div>
<div class="col-md-6">
<label>BCI:</label>
<br />
<asp:DropDownList ID="DdlBCIUsado" CssClass="form-control input-sm select2me" runat="server" CausesValidation="true" DataTextField="BCI" DataValueField="CveBCIUsado" Width="100%">
</asp:DropDownList>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlMarcaUsado" CssClass="form-control input-sm select2me" runat="server" DataTextField="Marca" DataValueField="CveMarcaUsado" Width="100%">
<asp:ListItem Selected="True" Text="Seleccione la Marca" Value="-1"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlMarcaUsado.ClientID.ToString()%>">Marca:</label>
</div>
</div>
<div class="col-md-6">
<label for="<%= TxtFechaAjuste.ClientID.ToString()%>">Fecha Vigencia:</label>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 100% !important; padding: 0px;">
<asp:TextBox ID="TxtFechaVigencia" CssClass="form-control input-sm ADSMaskDate" Width="100%" runat="server"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkFechaVigencia" class="btn default " Text=" <i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaVigencia" runat="server" TargetControlID="TxtFechaVigencia" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEFechaVigencia" TargetControlID="TxtFechaVigencia" PopupButtonID="LnkFechaVigencia" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RFVFechaVigencia" runat="server" ControlToValidate="TxtFechaVigencia" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha Vigencia''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEFechaVigencia" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaVigencia"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
</div> </div>
</div> </div>
<div class="row">
<div class="col-md-6">
<label>Tipo Servicio:</label>
<br />
<asp:DropDownList ID="DdlTipoServicio" CssClass="form-control input-sm select2me" runat="server" CausesValidation="true">
<asp:ListItem Text="Seleccione" Value="-1"></asp:ListItem>
<asp:ListItem Text="Particular" Value="1" Selected="True"></asp:ListItem>
<asp:ListItem Text="Comercial" Value="2"></asp:ListItem>
<asp:ListItem Text="Taxi" Value="3"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="col-md-6"></div>
</div>
<br />
<div class="row">
<div class="col-md-12" visible="false">
<asp:GridView ID="GvRecepcionUsados" runat="server" GridLines="None" ShowHeaderWhenEmpty="true" CssClass="table table-hover table-striped ScrollAD mysmallbtn"
data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" data-height="100"
DataKeyNames="CvePSCargo,CveUM,Cargo,CveTamaño,CodigoPS">
<Columns>
<asp:BoundField DataField="CodigoPS" HeaderText="Tamaño" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="35%" />
<asp:TemplateField HeaderText="Cantidad" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20%">
<ItemTemplate>
<asp:TextBox ID="TxtCantidad" CssClass="form-control linewhitsize" runat="server" Width="90%" Height="30px"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTBECantidad" runat="server" TargetControlID="TxtCantidad" FilterType="Custom, Numbers" ValidChars="." />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BCI" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="25%">
<ItemTemplate>
<asp:DropDownList ID="DdlBCIUsado" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="BCI" DataValueField="CveBCIUsado" Width="90%">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</div> </div>
<br /> <br />
@@ -3562,37 +3585,37 @@
$get(Row).style.backgroundColor = "#82b6db"; $get(Row).style.backgroundColor = "#82b6db";
$get(Obj).focus(); $get(Obj).focus();
var total = parseFloat($('#<%= LblSaldoVenta.ClientID%>').text().replace(',', '')); var total = parseFloat($('#<%= LblSaldoVenta.ClientID%>').text().replace(',', ''));
$get(Obj).value = 0; $get(Obj).value = 0;
var suma = 0;
$('#<%= GVAnticipos.ClientID%> input[type="text"]').each(function (index) {
var currentsaldo = parseFloat($(this).val())
if (isNaN(currentsaldo)) { currentsaldo = 0 }
suma = currentsaldo + suma;
});
var txtvalue = total - suma;
if (txtvalue < 0) { txtvalue = 0; }
if (txtvalue < Saldo) { Saldo = txtvalue.toFixed(2); }
$get(Obj).value = Saldo;
$get("HdnAnticipos").value = parseFloat($get("HdnAnticipos").value) + parseFloat(Saldo);
} else {
$get(Obj).readOnly = true;
$get("HdnAnticipos").value = parseFloat($get("HdnAnticipos").value) - parseFloat($get(Obj).value);
$get(Obj).value = "";
$get(Row).style.backgroundColor = "#ffffff";
}
//if ($("input:checkbox:not(:checked)"))
SetText2($get("LblTotalAnticipos"), formato_numero($get("HdnAnticipos").value, 2, '.', ','));
}
function imprimircotizacion() {
__doPostBack('ctl00$HB$LnkImprimir', '');
}
function ValidaMontoMenor(Obj, Monto) {
debugger;
Monto = ToDouble($('#C_Tab_TabGenerales_TxtTotal').val())
var ValorTxt = Obj.value;
var suma = 0; var suma = 0;
var total = parseFloat($('#<%= LblSaldoVenta.ClientID%>').text().replace(',', '')); $('#<%= GVAnticipos.ClientID%> input[type="text"]').each(function (index) {
var currentsaldo = parseFloat($(this).val())
if (isNaN(currentsaldo)) { currentsaldo = 0 }
suma = currentsaldo + suma;
});
var txtvalue = total - suma;
if (txtvalue < 0) { txtvalue = 0; }
if (txtvalue < Saldo) { Saldo = txtvalue.toFixed(2); }
$get(Obj).value = Saldo;
$get("HdnAnticipos").value = parseFloat($get("HdnAnticipos").value) + parseFloat(Saldo);
} else {
$get(Obj).readOnly = true;
$get("HdnAnticipos").value = parseFloat($get("HdnAnticipos").value) - parseFloat($get(Obj).value);
$get(Obj).value = "";
$get(Row).style.backgroundColor = "#ffffff";
}
//if ($("input:checkbox:not(:checked)"))
SetText2($get("LblTotalAnticipos"), formato_numero($get("HdnAnticipos").value, 2, '.', ','));
}
function imprimircotizacion() {
__doPostBack('ctl00$HB$LnkImprimir', '');
}
function ValidaMontoMenor(Obj, Monto) {
debugger;
Monto = ToDouble($('#C_Tab_TabGenerales_TxtTotal').val())
var ValorTxt = Obj.value;
var suma = 0;
var total = parseFloat($('#<%= LblSaldoVenta.ClientID%>').text().replace(',', ''));
$('#<%= GVAnticipos.ClientID%> input[type="text"]').each(function (index) { $('#<%= GVAnticipos.ClientID%> input[type="text"]').each(function (index) {
var currentsaldo = parseFloat($(this).val()) var currentsaldo = parseFloat($(this).val())
if (isNaN(currentsaldo)) { currentsaldo = 0 } if (isNaN(currentsaldo)) { currentsaldo = 0 }

View File

@@ -1271,15 +1271,22 @@ Partial Class PV
Using ObjMarcas As New ClsProductosServicios Using ObjMarcas As New ClsProductosServicios
If ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) Then If ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) Then
DdlMarcaPS.DataSource = ObjMarcas.DtResultados DdlMarcaPS.DataSource = ObjMarcas.DtResultados.Copy()
DdlMarcaPSAjuste.DataSource = ObjMarcas.DtResultados DdlMarcaPSAjuste.DataSource = ObjMarcas.DtResultados.Copy()
End If
If ObjMarcas.GetMarcasUsados(UsuarioActual.CveEmpresa) Then
DdlMarcaUsado.DataSource = ObjMarcas.DtResultados.Copy()
End If End If
End Using End Using
DdlMarcaPS.DataBind() DdlMarcaPS.DataBind()
DdlMarcaPSAjuste.DataBind() DdlMarcaPSAjuste.DataBind()
DdlMarcaUsado.DataBind()
DdlMarcaPS.Items.Insert(0, New ListItem("Todas", "-1")) DdlMarcaPS.Items.Insert(0, New ListItem("Todas", "-1"))
DdlMarcaPSAjuste.Items.Insert(0, New ListItem("Todas", "-1")) DdlMarcaPSAjuste.Items.Insert(0, New ListItem("Todas", "-1"))
DdlMarcaUsado.Items.Insert(0, New ListItem("Seleccione", "-1"))
UpModalVenta.Update() UpModalVenta.Update()
UpAjuste.Update() UpAjuste.Update()
@@ -2005,7 +2012,7 @@ Partial Class PV
For Each drow As DataRow In TmpDTPolizaVirtual.Rows For Each drow As DataRow In TmpDTPolizaVirtual.Rows
If ObjAcum.AddPolizaVirtual(CveVenta, drow("CveVentaDetalle").ToString().ToEntero(), drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("Descuento").ToString.ToDecimal, If ObjAcum.AddPolizaVirtual(CveVenta, drow("CveVentaDetalle").ToString().ToEntero(), drow("CvePS").ToString.ToEntero, drow("Cantidad").ToString.ToDecimal, drow("PU").ToString.ToDecimal, drow("Descuento").ToString.ToDecimal,
drow("Total").ToString.ToDecimal, drow("TipoServicio").ToString.ToEntero, drow("TipoPoliza").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero, drow("AnioVehiculo").ToString.ToEntero, CBool(drow("TieneUsado").ToString), drow("Total").ToString.ToDecimal, drow("TipoServicio").ToString.ToEntero, drow("TipoPoliza").ToString.ToEntero, drow("CveModeloAuto").ToString.ToEntero, drow("AnioVehiculo").ToString.ToEntero, CBool(drow("TieneUsado").ToString),
drow("FechaUsado").ToString().ToDateTime, drow("CvePSUsado").ToString.ToEntero, drow("CveBCIUsado").ToString.ToEntero) Then drow("FechaUsado").ToString().ToDateTime, drow("CvePSUsado").ToString.ToEntero, drow("CveBCIUsado").ToString.ToEntero, drow("CveMarcaUsado").ToString.ToEntero) Then
Else Else
OcurrioError = True OcurrioError = True
Exit For Exit For
@@ -3255,17 +3262,47 @@ Partial Class PV
If ObjFactura.CveCliente > 0 Then If ObjFactura.CveCliente > 0 Then
If TmpDT.Rows.Count > 0 Then If TmpDT.Rows.Count > 0 Then
Dim Retorno = ObjFactura.EmitirFactura()
If Retorno.CveVenta > 0 Then
Dim SbAlert As New StringBuilder Dim TieneError As Boolean = False
SbAlert.AppendFormat("{0}<br>", Retorno.Mensajes(Retorno.Mensajes.Count - 1))
SbAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF Factura</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta)))
Dim urlFactura As String = $"/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta))}" Dim ObjAcum As New ClsAcumuladores
Dim urlAjuste As String = "" Dim ObjContPaq As ClsContPAQi = Nothing
If UsuarioActual.Empresa.UsaAC OrElse UsuarioActual.Empresa.Funcionalidad(200) = "1" Then
ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa)
End If
Dim Retorno As Modelos.Factura.MMensajeFactura = Nothing
Dim urlFactura As String = ""
Dim urlAjuste = ""
Dim SbAlert As New StringBuilder
Try
Retorno = ObjFactura.EmitirFactura(Transac:=ObjAcum.IniciaTransacSQL(), ObjContPaqTransac:=ObjContPaq)
If Retorno IsNot Nothing AndAlso Retorno.CveVenta > 0 Then
If ObjFactura.TipoDocto = "Rem" Then
If ObjAcum.GetPolizasVirtuales(Retorno.CveVenta) Then
Dim DtPoliza As DataTable = ObjAcum.DtResultados.Copy()
For Each Row As DataRow In ObjFactura.DtPolizasVirtuales.Rows
Dim CvePolizaVirtual As Integer = DtPoliza.FiltroPrimeroValor("CvePolizaVirtual", $"CveVentaDetalle={Row("CveVentaDetalle")}").ToEntero()
If Not ObjAcum.UpdatePolizaVirtual(CvePolizaVirtual, Row("CveMarcaUsado").ToString().ToEntero(), Row("FechaUsado").ToString().ToDateTime()) Then
SbAlert.Append("Error al guardar la póliza virtual")
TieneError = True
Exit For
End If
Next
DtPoliza.Dispose()
Else
SbAlert.Append("Error al obtener la póliza virtual")
TieneError = True
End If
End If
Using ObjAcum As New ClsAcumuladores
If ObjAcum.GetGarantiasDetalle(Retorno.CveVenta) Then If ObjAcum.GetGarantiasDetalle(Retorno.CveVenta) Then
Dim RowGarantia As DataRow = ObjAcum.DtResultados.FiltroPrimero("") Dim RowGarantia As DataRow = ObjAcum.DtResultados.FiltroPrimero("")
If RowGarantia IsNot Nothing Then If RowGarantia IsNot Nothing Then
@@ -3274,9 +3311,33 @@ Partial Class PV
urlAjuste = $"/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AJUSTE&CVEGARANTIADETALLE={0}", RowGarantia("CveGarantiaDetalle")))}" urlAjuste = $"/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=AJUSTE&CVEGARANTIADETALLE={0}", RowGarantia("CveGarantiaDetalle")))}"
End If End If
End If End If
End Using
Retorno.Mensajes(Retorno.Mensajes.Count - 1) = SbAlert.ToString() SbAlert.AppendFormat("{0}<br>", Retorno.Mensajes(Retorno.Mensajes.Count - 1))
SbAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF Factura</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta)))
urlFactura = $"/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", Retorno.CveVenta))}"
Else
TieneError = True
End If
Catch ex As Exception
TieneError = True
OnError("Ocurrió un error al generar el documento", ex)
End Try
If TieneError Then
ObjAcum.RollBack()
If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
ObjAcum.Dispose()
If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
Else
ObjAcum.Commit()
If ObjContPaq IsNot Nothing Then ObjContPaq.Commit()
ObjAcum.Dispose()
If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
RegistraScript($"descargarPDF('{urlFactura}','{urlAjuste}');", "Imprimir") RegistraScript($"descargarPDF('{urlFactura}','{urlAjuste}');", "Imprimir")
@@ -3284,12 +3345,20 @@ Partial Class PV
If DivBloqueo.Visible Then If DivBloqueo.Visible Then
Retorno.LigaPV = "bloquearAcceso();" Retorno.LigaPV = "bloquearAcceso();"
End If End If
End If
If Retorno IsNot Nothing AndAlso Retorno.Mensajes.Count > 0 Then
Retorno.Mensajes(Retorno.Mensajes.Count - 1) = SbAlert.ToString()
End If End If
For Each Mensaje In Retorno.Mensajes For Each Mensaje In Retorno.Mensajes
Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), If(Retorno.TieneError, "", Retorno.LigaPV), ShowCloseButton:=False) Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), If(Retorno.TieneError, "", Retorno.LigaPV), ShowCloseButton:=False)
Next Next
If ObjFactura IsNot Nothing Then
ObjFactura.Dispose()
End If
Else Else
Alert("No hay partidas agregadas a la factura", TipoMensaje.MsgAdvertencia) Alert("No hay partidas agregadas a la factura", TipoMensaje.MsgAdvertencia)
End If End If
@@ -3783,11 +3852,11 @@ Partial Class PV
'Muestra la tabla de tamaños 'Muestra la tabla de tamaños
If drPS("CveTamaño").ToString().ToEntero() > 0 Then If drPS("CveTamaño").ToString().ToEntero() > 0 Then
DivRecepcionUsados.Visible = True DivRecepcionUsados.Visible = True
If DdlTipoComprobante.SelectedValue <> "Rem" Then 'If DdlTipoComprobante.SelectedValue <> "Rem" Then
GvRecepcionUsados.Columns(2).Visible = False ' GvRecepcionUsados.Columns(2).Visible = False
Else 'Else
GvRecepcionUsados.Columns(2).Visible = True ' GvRecepcionUsados.Columns(2).Visible = True
End If 'End If
End If End If
DdlUnidadMedida.Items.Clear() DdlUnidadMedida.Items.Clear()
@@ -4335,11 +4404,13 @@ Partial Class PV
ChkAgregar.Checked = True ChkAgregar.Checked = True
For Each Gvr As GridViewRow In GvRecepcionUsados.Rows 'For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
If Gvr.RowType = DataControlRowType.DataRow Then ' If Gvr.RowType = DataControlRowType.DataRow Then
Gvr.FCTextBox("TxtCantidad").Text = "" ' Gvr.FCTextBox("TxtCantidad").Text = ""
End If ' End If
Next 'Next
DdlRecepcionUsados.SelectedValueExist("-1")
DivRecepcionUsados.Visible = False DivRecepcionUsados.Visible = False
LimpiaAjuste() LimpiaAjuste()
@@ -4590,14 +4661,20 @@ Partial Class PV
Dim Entregado As Decimal = 0 Dim Entregado As Decimal = 0
Dim UltimoEntregado As Decimal = 0 Dim UltimoEntregado As Decimal = 0
For Each Gvr As GridViewRow In GvRecepcionUsados.Rows 'For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
If Gvr.RowType = DataControlRowType.DataRow Then ' If Gvr.RowType = DataControlRowType.DataRow Then
If Gvr.FCTextBox("TxtCantidad").Text.ToEntero() > 0 Then ' If Gvr.FCTextBox("TxtCantidad").Text.ToEntero() > 0 Then
Entregado += (Gvr.FCTextBox("TxtCantidad").Text.ToEntero * Gvr.DataKey("Cargo").ToDecimal) ' Entregado += (Gvr.FCTextBox("TxtCantidad").Text.ToEntero * Gvr.DataKey("Cargo").ToDecimal)
UltimoEntregado = Gvr.DataKey("Cargo").ToDecimal ' UltimoEntregado = Gvr.DataKey("Cargo").ToDecimal
End If ' End If
End If ' End If
Next 'Next
If DdlRecepcionUsados.SelectedValue.ToEntero() > 0 Then
Dim DrTamanio As DataRow = GlobalDTAcumTamaños.FiltroPrimero($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo = {DdlRecepcionUsados.SelectedValue}")
Entregado += (1D * DrTamanio("Cargo").ToString().ToDecimal)
UltimoEntregado += (DrTamanio("Cargo").ToString().ToDecimal)
End If
If Entregado > 0 Then If Entregado > 0 Then
'Calcular Vendido 'Calcular Vendido
@@ -4916,13 +4993,13 @@ Partial Class PV
If CveVentaDetalle <= 0 AndAlso Not EsCargo Then If CveVentaDetalle <= 0 AndAlso Not EsCargo Then
Dim ListaPSCargo = CalculaUsados(Consec) Dim ListaPSCargo = CalculaUsados(Consec)
If ListaPSCargo.Count > 0 Then If ListaPSCargo.Count > 0 Then
CalculaRecepcionUsados(GvRecepcionUsados, CvePS, ListaPSCargo) CalculaRecepcionUsados(CvePS, ListaPSCargo)
End If End If
ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then ElseIf CveVentaDetalle > 0 AndAlso Not EsCargo Then
EliminarUsados() EliminarUsados()
Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False) Dim ListaPSCargo = CalculaUsados(Consec, LimpiarUsados:=False)
If ListaPSCargo.Count > 0 Then If ListaPSCargo.Count > 0 Then
CalculaRecepcionUsados(GvRecepcionUsados, CvePS, ListaPSCargo) CalculaRecepcionUsados(CvePS, ListaPSCargo)
End If End If
End If End If
@@ -6271,14 +6348,20 @@ Partial Class PV
CargaModelos() CargaModelos()
CargaBCIAjuste() CargaBCIAjuste()
GvRecepcionUsados.DataSource = DtTamanios DdlRecepcionUsados.DataSource = DtTamanios
GvRecepcionUsadosModal.DataSource = DtTamanios GvRecepcionUsadosModal.DataSource = DtTamanios
TxtFechaVigencia.Text = Now.ToString("dd/MM/yyyy")
DdlTipoUso.DataBind() DdlTipoUso.DataBind()
DdlTipoDefecto.DataBind() DdlTipoDefecto.DataBind()
DdlFacturas.DataBind() DdlFacturas.DataBind()
GvRecepcionUsados.DataBind() DdlRecepcionUsados.DataBind()
DdlRecepcionUsados.Items.Insert(0, New ListItem("Sin usado recibido", "-1"))
DdlBCIUsado.Items.Insert(0, New ListItem("Seleccione", "-1"))
GvRecepcionUsadosModal.DataBind() GvRecepcionUsadosModal.DataBind()
CreaDTmpDTAjustes() CreaDTmpDTAjustes()
@@ -6300,12 +6383,12 @@ Partial Class PV
DdlModeloAuto.DataBind() DdlModeloAuto.DataBind()
End Sub End Sub
Protected Sub GvRecepcionUsados_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvRecepcionUsados.RowDataBound 'Protected Sub GvRecepcionUsados_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvRecepcionUsados.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then ' If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCDropDownList("DdlBCIUsado").DataSource = DTBCIUsados.FiltraParametros(String.Format("CveTamaño = {0}", e.Row.DataKey("CveTamaño"))) ' e.Row.FCDropDownList("DdlBCIUsado").DataSource = DTBCIUsados.FiltraParametros(String.Format("CveTamaño = {0}", e.Row.DataKey("CveTamaño")))
e.Row.FCDropDownList("DdlBCIUsado").DataBind() ' e.Row.FCDropDownList("DdlBCIUsado").DataBind()
End If ' End If
End Sub 'End Sub
Private Sub CargaPSAjuste() Private Sub CargaPSAjuste()
'DdlPSAjuste.Items.Clear() 'DdlPSAjuste.Items.Clear()
@@ -6790,12 +6873,17 @@ Partial Class PV
Protected Sub ChkAjuste_CheckedChanged(sender As Object, e As EventArgs) Protected Sub ChkAjuste_CheckedChanged(sender As Object, e As EventArgs)
If ChkAjuste.Checked Then If ChkAjuste.Checked Then
For Each Gvr As GridViewRow In GvRecepcionUsados.Rows 'For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
If Gvr.RowType = DataControlRowType.DataRow Then ' If Gvr.RowType = DataControlRowType.DataRow Then
Gvr.FCTextBox("TxtCantidad").Text = "" ' Gvr.FCTextBox("TxtCantidad").Text = ""
Gvr.FCTextBox("TxtCantidad").Enabled = False ' Gvr.FCTextBox("TxtCantidad").Enabled = False
End If ' End If
Next 'Next
DdlRecepcionUsados.SelectedValueExist("-1")
DdlRecepcionUsados.Enabled = False
DdlBCIUsado.SelectedValueExist("-1")
DdlBCIUsado.Enabled = False
DivAjuste.Visible = True DivAjuste.Visible = True
TxtCantidad.Text = "1" TxtCantidad.Text = "1"
@@ -6810,12 +6898,17 @@ Partial Class PV
TxtPrecio.Text = TxtPrecio.Text TxtPrecio.Text = TxtPrecio.Text
TxtObsPS.Text = "Descuento por garantía" TxtObsPS.Text = "Descuento por garantía"
Else Else
For Each Gvr As GridViewRow In GvRecepcionUsados.Rows 'For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
If Gvr.RowType = DataControlRowType.DataRow Then ' If Gvr.RowType = DataControlRowType.DataRow Then
Gvr.FCTextBox("TxtCantidad").Text = "" ' Gvr.FCTextBox("TxtCantidad").Text = ""
Gvr.FCTextBox("TxtCantidad").Enabled = True ' Gvr.FCTextBox("TxtCantidad").Enabled = True
End If ' End If
Next 'Next
DdlRecepcionUsados.SelectedValueExist("-1")
DdlRecepcionUsados.Enabled = True
DdlBCIUsado.SelectedValueExist("-1")
DdlBCIUsado.Enabled = True
DivAjuste.Visible = False DivAjuste.Visible = False
TxtCantidad.Enabled = True TxtCantidad.Enabled = True
@@ -6877,6 +6970,7 @@ Partial Class PV
TmpDTPolizaVirtual.Columns.Add("FechaUsado", GetType(DateTime)) TmpDTPolizaVirtual.Columns.Add("FechaUsado", GetType(DateTime))
TmpDTPolizaVirtual.Columns.Add("CvePSUsado", GetType(Integer)) TmpDTPolizaVirtual.Columns.Add("CvePSUsado", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("CveBCIUsado", GetType(Integer)) TmpDTPolizaVirtual.Columns.Add("CveBCIUsado", GetType(Integer))
TmpDTPolizaVirtual.Columns.Add("CveMarcaUsado", GetType(Integer))
End Sub End Sub
Private Function AddPolizaVirtual(CvePS As Integer) As Boolean Private Function AddPolizaVirtual(CvePS As Integer) As Boolean
Dim Retorno As Boolean = True Dim Retorno As Boolean = True
@@ -6916,7 +7010,7 @@ Partial Class PV
Dim Total As Decimal = ((Cantidad * PU) - Descuento).RoundSQL(2) Dim Total As Decimal = ((Cantidad * PU) - Descuento).RoundSQL(2)
Dim TipoServicio As Integer = DdlTipoServicio.SelectedValue.ToEntero() Dim TipoServicio As Integer = DdlTipoServicio.SelectedValue.ToEntero()
Dim FechaUsado As DateTime = If(TxtFechaAjuste.Text.ToDateTime() < MinFecha, Now, TxtFechaAjuste.Text.ToDateTime()) Dim FechaUsado As DateTime = If(TxtFechaVigencia.Text.ToDateTime() < MinFecha, Now, TxtFechaVigencia.Text.ToDateTime())
Dim CveModeloAuto As Integer = DdlModeloAuto.SelectedValue.ToEntero() Dim CveModeloAuto As Integer = DdlModeloAuto.SelectedValue.ToEntero()
Dim AnioVehiculo As Integer = TxtAnioVehiculo.Text.ToEntero() Dim AnioVehiculo As Integer = TxtAnioVehiculo.Text.ToEntero()
Dim TipoPoliza As Integer = 1 'VENTA Dim TipoPoliza As Integer = 1 'VENTA
@@ -6929,21 +7023,25 @@ Partial Class PV
End If End If
End If End If
Dim TieneUsado As Boolean = GvRecepcionUsados.Rows.Cast(Of GridViewRow).Any(Function(GvRow) GvRow.RowType = DataControlRowType.DataRow AndAlso GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0) Dim TieneUsado As Boolean = (DdlRecepcionUsados.SelectedValue.ToEntero() > 0) 'GvRecepcionUsados.Rows.Cast(Of GridViewRow).Any(Function(GvRow) GvRow.RowType = DataControlRowType.DataRow AndAlso GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0)
Dim CvePSUsado As Integer = -1 Dim CvePSUsado As Integer = -1
Dim CveBCIUsado As Integer = -1 Dim CveBCIUsado As Integer = -1
If TieneUsado Then If TieneUsado Then
For Each GvRow As GridViewRow In GvRecepcionUsados.Rows 'For Each GvRow As GridViewRow In GvRecepcionUsados.Rows
If GvRow.RowType = DataControlRowType.DataRow Then ' If GvRow.RowType = DataControlRowType.DataRow Then
If GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0 Then ' If GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0 Then
CvePSUsado = GvRow.DataKey("CvePSCargo").ToEntero() ' CvePSUsado = GvRow.DataKey("CvePSCargo").ToEntero()
CveBCIUsado = GvRow.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero() ' CveBCIUsado = GvRow.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero()
' Exit For
' End If
' End If
'Next
CvePSUsado = DdlRecepcionUsados.SelectedValue.ToEntero()
CveBCIUsado = DdlBCIUsado.SelectedValue.ToEntero()
Exit For
End If
End If
Next
End If End If
Dim Row As DataRow = TmpDTPolizaVirtual.NewRow() Dim Row As DataRow = TmpDTPolizaVirtual.NewRow()
@@ -6961,6 +7059,7 @@ Partial Class PV
Row("FechaUsado") = FechaUsado Row("FechaUsado") = FechaUsado
Row("CvePSUsado") = CvePSUsado Row("CvePSUsado") = CvePSUsado
Row("CveBCIUsado") = CveBCIUsado Row("CveBCIUsado") = CveBCIUsado
Row("CveMarcaUsado") = DdlMarcaUsado.SelectedValue.ToEntero()
TmpDTPolizaVirtual.Rows.Add(Row) TmpDTPolizaVirtual.Rows.Add(Row)
@@ -6992,7 +7091,7 @@ Partial Class PV
EmitirImprimirNew() EmitirImprimirNew()
End Sub End Sub
Private Sub CalculaRecepcionUsados(Gv As GridView, CvePS As Integer, ListaPSCargo As List(Of Integer)) Private Sub CalculaRecepcionUsados(CvePS As Integer, ListaPSCargo As List(Of Integer))
If Modalidad = "U" Then If Modalidad = "U" Then
If TmpDTRecepcionUsados.Rows.Count > 0 Then If TmpDTRecepcionUsados.Rows.Count > 0 Then
@@ -7014,28 +7113,48 @@ Partial Class PV
Dim StrTamanios As New StringBuilder() Dim StrTamanios As New StringBuilder()
StrTamanios.Append("Se recibierón los siguientes usados:") StrTamanios.Append("Se recibierón los siguientes usados:")
For Each Gvr As GridViewRow In Gv.Rows 'For Each Gvr As GridViewRow In Gv.Rows
If Gvr.RowType = DataControlRowType.DataRow Then ' If Gvr.RowType = DataControlRowType.DataRow Then
If Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal > 0 Then ' If Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal > 0 Then
TotalCargos += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal * Gvr.DataKey("Cargo").ToDecimal ' TotalCargos += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal * Gvr.DataKey("Cargo").ToDecimal
TotalCantidad += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal ' TotalCantidad += Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal
StrTamanios.AppendFormat("{0},", Gvr.DataKey("CodigoPS")) ' StrTamanios.AppendFormat("{0},", Gvr.DataKey("CodigoPS"))
Dim Row As DataRow = TmpDTRecepcionUsados.NewRow() ' Dim Row As DataRow = TmpDTRecepcionUsados.NewRow()
Row("CvePS") = Gvr.DataKey("CvePSCargo").ToEntero ' Row("CvePS") = Gvr.DataKey("CvePSCargo").ToEntero
Row("CvePSRelacionado") = CvePS ' Row("CvePSRelacionado") = CvePS
Row("Cantidad") = Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal ' Row("Cantidad") = Gvr.FCTextBox("TxtCantidad").Text.ToString.ToDecimal
Row("CveUM") = Gvr.DataKey("CveUM").ToEntero ' Row("CveUM") = Gvr.DataKey("CveUM").ToEntero
Row("CveVentaDetalle") = -1 ' Row("CveVentaDetalle") = -1
Row("PU") = Gvr.DataKey("Cargo").ToDouble ' Row("PU") = Gvr.DataKey("Cargo").ToDouble
Row("CveBCIUsado") = Gvr.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero ' Row("CveBCIUsado") = Gvr.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero
Row("CveModeloAuto") = DdlModeloAuto.SelectedValue.ToEntero ' Row("CveModeloAuto") = DdlModeloAuto.SelectedValue.ToEntero
TmpDTRecepcionUsados.Rows.Add(Row) ' TmpDTRecepcionUsados.Rows.Add(Row)
End If ' End If
End If ' End If
Next 'Next
Dim DrTamanio As DataRow = GlobalDTAcumTamaños.FiltroPrimero($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo = {DdlRecepcionUsados.SelectedValue}")
If DdlRecepcionUsados.SelectedValue.ToEntero() > 0 Then
TotalCargos += 1D * DrTamanio("Cargo").ToString().ToDecimal
TotalCantidad += 1D
StrTamanios.AppendFormat("{0},", DrTamanio("CodigoPS"))
Dim Row As DataRow = TmpDTRecepcionUsados.NewRow()
Row("CvePS") = DrTamanio("CvePSCargo").ToString().ToEntero
Row("CvePSRelacionado") = CvePS
Row("Cantidad") = 1D
Row("CveUM") = DrTamanio("CveUM").ToString().ToEntero
Row("CveVentaDetalle") = -1
Row("PU") = DrTamanio("Cargo").ToString().ToDecimal
Row("CveBCIUsado") = DdlBCIUsado.SelectedValue.ToEntero
Row("CveModeloAuto") = DdlModeloAuto.SelectedValue.ToEntero
TmpDTRecepcionUsados.Rows.Add(Row)
End If
If TotalCargos > 0 Then If TotalCargos > 0 Then
StrTamanios.Remove(StrTamanios.Length - 1, 1) StrTamanios.Remove(StrTamanios.Length - 1, 1)
@@ -7587,4 +7706,12 @@ Partial Class PV
Response.Redirect($"~/Ventas/PV.aspx") Response.Redirect($"~/Ventas/PV.aspx")
End Sub End Sub
Protected Sub DdlRecepcionUsados_SelectedIndexChanged(sender As Object, e As EventArgs)
Dim DrTamanio As DataRow = GlobalDTAcumTamaños.FiltroPrimero($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo = {DdlRecepcionUsados.SelectedValue}")
DdlBCIUsado.DataSource = DTBCIUsados.FiltraParametros(String.Format("CveTamaño = {0}", DrTamanio("CveTamaño")))
DdlBCIUsado.DataBind()
UpModalVenta.Update()
End Sub
End Class End Class

View File

@@ -3635,15 +3635,17 @@
<td id="Td3" runat="server">Próxima Rotación y Balanceo:&nbsp;</td> <td id="Td3" runat="server">Próxima Rotación y Balanceo:&nbsp;</td>
</tr> </tr>
<tr align="left" id="trRotacionlbl" runat="server" visible="false"> <tr align="left" id="trRotacionlbl" runat="server" visible="false">
<td><asp:Label runat="server" id="LblRotacion" Text=""></asp:Label></td> <td>
<asp:Label runat="server" ID="LblRotacion" Text=""></asp:Label></td>
</tr> </tr>
<tr align="left" id="trAlineacion" runat="server" visible="false"> <tr align="left" id="trAlineacion" runat="server" visible="false">
<td id="Td7" runat="server">Próxima Alineación:&nbsp;</td> <td id="Td7" runat="server">Próxima Alineación:&nbsp;</td>
</tr> </tr>
<tr align="left" id="trAlineacionlbl" runat="server" visible="false"> <tr align="left" id="trAlineacionlbl" runat="server" visible="false">
<td><asp:Label runat="server" id="LblAlineacion" Text=""></asp:Label></td> <td>
<asp:Label runat="server" ID="LblAlineacion" Text=""></asp:Label></td>
</tr> </tr>
</table> </table>
</div> </div>
</ContentTemplate> </ContentTemplate>
@@ -6627,7 +6629,7 @@
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField> <asp:TemplateField>
<ItemTemplate> <ItemTemplate>
<asp:TextBox ID="TxtImporte" CssClass="myvalue" runat="server" Width="75px" /> <asp:TextBox ID="TxtImporte" CssClass="myvalue ImportesRNCBon" runat="server" Width="75px" />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
</Columns> </Columns>
@@ -7030,7 +7032,7 @@
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<asp:RadioButtonList ID="RblRNCTipoDesc" runat="server" RepeatDirection="Horizontal" CssClass="input-group col-md-12" CellSpacing="100" AutoPostBack="true" OnSelectedIndexChanged="RblRNCTipoDesc_SelectedIndexChanged"> <asp:RadioButtonList ID="RblRNCTipoDesc" runat="server" RepeatDirection="Horizontal" CssClass="input-group col-md-12" CellSpacing="100" AutoPostBack="true" OnSelectedIndexChanged="RblRNCTipoDesc_SelectedIndexChanged">
<asp:ListItem Value="2" Class="one"><label><b>Bonificaciones</b></label></asp:ListItem> <%--<asp:ListItem Value="2" Class="one"><label><b>Bonificaciones</b></label></asp:ListItem>--%>
<asp:ListItem Value="1" Class="one" Selected="True"><label><b>Cargos</b></label></asp:ListItem> <asp:ListItem Value="1" Class="one" Selected="True"><label><b>Cargos</b></label></asp:ListItem>
<asp:ListItem Value="3" Class="one"><label><b>Ajuste/Garantía</b></label></asp:ListItem> <asp:ListItem Value="3" Class="one"><label><b>Ajuste/Garantía</b></label></asp:ListItem>
</asp:RadioButtonList> </asp:RadioButtonList>
@@ -7110,7 +7112,7 @@
<asp:TemplateField> <asp:TemplateField>
<ItemTemplate> <ItemTemplate>
<asp:CheckBox ID="ChkAplicar" runat="server" /> <asp:CheckBox ID="ChkAplicar" runat="server" />
<asp:HiddenField ID="HdnPorcentajeIVA" ClientIDMode="Static" runat="server" Value='<%# Eval("PorcentajeIVA").ToString %>' /> <asp:HiddenField ID="HdnPorcentajeIVA" ClientIDMode="Static" runat="server" Value='<%# Eval("PorcentajeIVA").ToString %>' />
</ItemTemplate> </ItemTemplate>
</asp:TemplateField> </asp:TemplateField>
<asp:TemplateField HeaderText="Cantidad"> <asp:TemplateField HeaderText="Cantidad">
@@ -7201,7 +7203,7 @@
</asp:GridView> </asp:GridView>
</div> </div>
</div> </div>
<div class="row"> <%-- <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<table border="0" rules="none" class="well TextTab" style="float: right;" runat="server"> <table border="0" rules="none" class="well TextTab" style="float: right;" runat="server">
<tr align="right"> <tr align="right">
@@ -7213,13 +7215,11 @@
</tr> </tr>
</table> </table>
</div> </div>
</div> </div>--%>
</div> </div>
</div> </div>
</div> </div>
</div> </div>
<asp:HiddenField ID="HdnSaldoMaximoUsados" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnSMUBonDesc" runat="server" ClientIDMode="Static" Value="0" />
</div> </div>
<div class="modal-footer"> <div class="modal-footer">
<button id="CancelarAplicarDescNC" type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button> <button id="CancelarAplicarDescNC" type="button" class="btn btn-default" data-dismiss="modal">Cerrar</button>
@@ -7229,6 +7229,13 @@
</ContentTemplate> </ContentTemplate>
</asp:UpdatePanel> </asp:UpdatePanel>
</div> </div>
<asp:UpdatePanel ID="UpHdnSaldos" runat="server">
<ContentTemplate>
<asp:HiddenField ID="HdnSaldoMaximoUsados" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnSMUBon" runat="server" ClientIDMode="Static" Value="0" />
</ContentTemplate>
</asp:UpdatePanel>
<%-- MODAL SUCURSAL --%> <%-- MODAL SUCURSAL --%>
<div id="divAgregarSucursal" class="modal fade" role="dialog"> <div id="divAgregarSucursal" class="modal fade" role="dialog">
<div class="modal-dialog" style="max-height: 500px; max-width: 500px;"> <div class="modal-dialog" style="max-height: 500px; max-width: 500px;">
@@ -7577,6 +7584,100 @@
} }
} }
function CalculaSaldoRNCBonChkDesc(TxtImporte, Saldo, Chk) {
if (Chk.checked) {
TxtImporte.value = FormatoNumero(Saldo, 2);
} else {
TxtImporte.value = "";
}
//if (Chk.checked) {
// let SaldoMaximoUtilizable = ToDouble(HdnSMUBonDesc.value)
// let ImportesAsignados = 0;
// $('.ImportesRNCBon').each(function () {
// if ($(this).context.id != TxtImporte.id) {
// ImportesAsignados += ToDouble($(this).val());
// }
// });
// let Importe = SaldoMaximoUtilizable - ImportesAsignados;
// if (Importe > 0) {
// if (Saldo > Importe) {
// TxtImporte.value = FormatoNumero(Importe, 2);
// } else {
// TxtImporte.value = FormatoNumero(Saldo, 2);
// }
// } else {
// if (SaldoMaximoUtilizable > 0) {
// TxtImporte.value = "";
// Chk.checked = false;
// } else {
// TxtImporte.value = FormatoNumero(Saldo, 2);
// }
// }
//} else {
// TxtImporte.value = "";
//}
}
function LimitaSaldoRNCBonChkDesc(TxtImporte, Saldo) {
//var Importe = 0;
//if (TxtImporte.value.includes('.')) {
// return;
//}
//if (TxtImporte.value.includes(',')) {
// return;
//}
//var regex = new RegExp("^[-+]?[0-9]+\.[0-9]+$");
//if (regex.test(TxtImporte.value)) {
// if (TxtImporte.value != '') {
// Importe = parseFloat(TxtImporte.value);
// }
// if (Importe > Saldo) {
// TxtImporte.value = FormatoNumero(Saldo, 2);
// } else {
// TxtImporte.value = FormatoNumero(Importe, 2);;
// }
//}
var Importe = 0;
if (TxtImporte.value.includes('.')) {
return;
}
if (TxtImporte.value.includes(',')) {
return;
}
var regex = new RegExp("^[-+]?[0-9]+\.[0-9]+$");
if (regex.test(TxtImporte.value)) {
if (TxtImporte.value != '') {
Importe = parseFloat(TxtImporte.value);
}
let SaldoMaximoUtilizable = parseFloat(Saldo)
//let ImportesAsignados = 0;
//$('.ImportesRNCBon').each(function () {
// if ($(this).context.id != TxtImporte.id) {
// ImportesAsignados += ToDouble($(this).val());
// }
//});
let ImporteDiferencia = SaldoMaximoUtilizable; //- ImportesAsignados;
if (Importe > ImporteDiferencia) {
TxtImporte.value = FormatoNumero(ImporteDiferencia, 2);
} else {
TxtImporte.value = FormatoNumero(Importe, 2);;
}
}
}
function CalculaSaldoRNCBonChk(TxtImporte, Saldo, Chk) { function CalculaSaldoRNCBonChk(TxtImporte, Saldo, Chk) {
//if (Chk.checked) { //if (Chk.checked) {
// TxtImporte.value = FormatoNumero(Saldo, 2); // TxtImporte.value = FormatoNumero(Saldo, 2);
@@ -7584,7 +7685,7 @@
// TxtImporte.value = ""; // TxtImporte.value = "";
//} //}
if (Chk.checked) { if (Chk.checked) {
let SaldoMaximoUtilizable = ToDouble(HdnSMUBonDesc.value) let SaldoMaximoUtilizable = ToDouble(HdnSMUBon.value)
let ImportesAsignados = 0; let ImportesAsignados = 0;
$('.ImportesRNCBon').each(function () { $('.ImportesRNCBon').each(function () {
@@ -7654,7 +7755,7 @@
Importe = parseFloat(TxtImporte.value); Importe = parseFloat(TxtImporte.value);
} }
let SaldoMaximoUtilizable = parseFloat(HdnSMUBonDesc.value) let SaldoMaximoUtilizable = parseFloat(HdnSMUBon.value)
let ImportesAsignados = 0; let ImportesAsignados = 0;
$('.ImportesRNCBon').each(function () { $('.ImportesRNCBon').each(function () {
if ($(this).context.id != TxtImporte.id) { if ($(this).context.id != TxtImporte.id) {
@@ -8806,31 +8907,31 @@
function CerrarModalRemNC() { function CerrarModalRemNC() {
if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1') { if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1') {
AplicarValidarRNC(true); AplicarValidarRNC(true);
CompararNC(); CompararNC();
}
$('#ModalAplicarRemisionesNC').modal('hide');
} }
$('#ModalAplicarRemisionesNC').modal('hide');
}
var verficaRNC = function () { var verficaRNC = function () {
var total = 0; var total = 0;
if ('<%= UsuarioActual.CveEmpresa %>' == '140') { if ('<%= UsuarioActual.CveEmpresa %>' == '140') {
$(".ChkAplicaRNC > input").each(function () { $(".ChkAplicaRNC > input").each(function () {
if (this.checked) { if (this.checked) {
total = total + 1; total = total + 1;
} }
if (total == 2) { if (total == 2) {
alert("No se puede seleccionar mas de una remisión de nota de crédito."); alert("No se puede seleccionar mas de una remisión de nota de crédito.");
this.checked = false; this.checked = false;
return false; return false;
} }
}); });
} }
}; };
function showDivAgregarSucursal() { function showDivAgregarSucursal() {
$('#<%= TxtNombreSucursal.ClientID %>').val(''); $('#<%= TxtNombreSucursal.ClientID %>').val('');
$('#<%= TxtDireccionSucursal.ClientID %>').val(''); $('#<%= TxtDireccionSucursal.ClientID %>').val('');
$('#<%= TxtNumExtSucursal.ClientID %>').val(''); $('#<%= TxtNumExtSucursal.ClientID %>').val('');
$('#<%= TxtNumIntSucursal.ClientID %>').val(''); $('#<%= TxtNumIntSucursal.ClientID %>').val('');

View File

@@ -5464,6 +5464,12 @@ Partial Class Ventas
TrVistaPrevia.Visible = EstatusCliente TrVistaPrevia.Visible = EstatusCliente
End If End If
If ViewState("CveDevolucion") IsNot Nothing AndAlso ViewState("NuevaFactura") IsNot Nothing Then
If (CveDevolucion > 0 AndAlso NuevaFactura = 1) Then
BtnEmitirImprimir.Visible = EstatusCliente
TrVistaPrevia.Visible = EstatusCliente
End If
End If
'CUANDO SEA COTIZACION Y SEA COMPUPROVEEDORES (EMPRESA 72) NO DEBE ENVIAR CORREO AL CLIENTE 'CUANDO SEA COTIZACION Y SEA COMPUPROVEEDORES (EMPRESA 72) NO DEBE ENVIAR CORREO AL CLIENTE
If UsuarioActual.CveEmpresa = 72 AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then If UsuarioActual.CveEmpresa = 72 AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then
@@ -12840,6 +12846,40 @@ Partial Class Ventas
End If End If
End If End If
If ObjFactura.RetIVA <> 0 AndAlso ObjFactura.CveTipoRetencion = 4 Then
Dim PorcentajeImpuestoPago As Decimal = TmpDT.MAX("PorcentajeRetIVA").ToDecimal
Dim IdCtaContableRetIVA = 0
'RETIVA X TRASLADAR
'OBTENER CUENTAS
If ObjConta.GetRetCuenta(313, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then
'Conta ContPAQ
IdCtaContableRetIVA = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
Else
IdCtaContableRetIVA = 0
End If
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 313, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, (importeMovimiento * ObjFactura.RetIVA) / ObjFactura.Total, Referencia, 313, Concepto, Fecha, IdCtaContableRetIVA, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.RetIVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
ErrorPrepoliza = True
Exit For
End If
'RETIVA PAGADO
If ObjConta.GetRetCuenta(314, UsuarioActual.CveEmpresa) AndAlso ObjConta.DtResultados.Rows.Count > 0 Then
'Conta ContPAQ
IdCtaContableRetIVA = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
Else
IdCtaContableRetIVA = 0
End If
Concepto = ObjConta.ObtenerConceptoEmpresa(UsuarioActual.CveEmpresa, 314, NombreCliente, $"{ObjFactura.Serie}-{ObjFactura.Folio}", FolioIE.ToString())
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, (importeMovimiento * ObjFactura.RetIVA) / ObjFactura.Total, Referencia, 314, Concepto, Fecha, IdCtaContableRetIVA, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=CveCliente, CveIE:=CveIEPago, ImporteMX:=((importeMovimiento * ObjFactura.RetIVA) / ObjFactura.Total) * tipoCambio * Multiplicador, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), CveSubProyecto:=CveSubProyectoContabilizar, PorcentajeImpuesto:=PorcentajeImpuestoPago) Then
ErrorPrepoliza = True
Exit For
End If
End If
Else Else
ErrorPrepoliza = True ErrorPrepoliza = True
@@ -16924,7 +16964,7 @@ Partial Class Ventas
End If End If
TotalCalculableImpuestos = ((Cantidad * (PU)) - Descuento).RoundSQL TotalCalculableImpuestos = ((Cantidad * (PU)) - Descuento)
TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal) TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
Row("PU") = PU Row("PU") = PU
@@ -16994,7 +17034,7 @@ Partial Class Ventas
Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales) Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales)
Row("TipoDescuento") = HdnTipoDescuento.Value Row("TipoDescuento") = HdnTipoDescuento.Value
Row("CvePromocionDetalle") = CvePromocionDetalle Row("CvePromocionDetalle") = CvePromocionDetalle
Row("Total") = (Cantidad * PU).RoundSQL(NumeroDecimales) Row("Total") = (Cantidad * PU)
Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales) Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales)
'Row("AsientoContableVentas") = DrPS("AsientoContableVentas") 'Row("AsientoContableVentas") = DrPS("AsientoContableVentas")
@@ -17121,7 +17161,7 @@ Partial Class Ventas
End If End If
PU = PU.RoundSQL(6) PU = PU.RoundSQL(6)
DrPoliza("PU") = PU DrPoliza("PU") = PU
TotalCalculableImpuestos = (DrPoliza("Cantidad").ToString().ToDecimal * (PU)).RoundSQL TotalCalculableImpuestos = (DrPoliza("Cantidad").ToString().ToDecimal * (PU))
If DrPSAdicional("IVA").ToString().Contiene("-1", "") Then If DrPSAdicional("IVA").ToString().Contiene("-1", "") Then
DrPoliza("PorcentajeIVA") = PorcentajeIVA DrPoliza("PorcentajeIVA") = PorcentajeIVA
@@ -17139,7 +17179,7 @@ Partial Class Ventas
DrPoliza("IEPS") = DrPoliza("ImporteIEPS") DrPoliza("IEPS") = DrPoliza("ImporteIEPS")
DrPoliza("Descuento") = 0 ' Descuento DrPoliza("Descuento") = 0 ' Descuento
DrPoliza("TipoDescuento") = HdnTipoDescuento.Value DrPoliza("TipoDescuento") = HdnTipoDescuento.Value
DrPoliza("Total") = (DrPoliza("Cantidad").ToString().ToDecimal * PU).RoundSQL(NumeroDecimales) DrPoliza("Total") = (DrPoliza("Cantidad").ToString().ToDecimal * PU)
DrPoliza("TotalImporte") = (DrPoliza("Cantidad").ToString().ToDecimal * PU).RoundSQL(NumeroDecimales) DrPoliza("TotalImporte") = (DrPoliza("Cantidad").ToString().ToDecimal * PU).RoundSQL(NumeroDecimales)
DrPoliza("SATClaveProdServ") = DrPSAdicional("SATClavePS") DrPoliza("SATClaveProdServ") = DrPSAdicional("SATClavePS")
DrPoliza("SATClaveUM") = DrPSAdicional("SATClaveUnidadMedida") DrPoliza("SATClaveUM") = DrPSAdicional("SATClaveUnidadMedida")
@@ -25170,7 +25210,10 @@ Partial Class Ventas
GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas GvRemisionesNCBon.DataSource = TmpDTRNCBonificacionesSeleccionadas
GvRemisionesNCBon.DataBind() GvRemisionesNCBon.DataBind()
LtlSMUBon.Text = String.Format("{0:N2}", Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal()) Dim SMUBon As Decimal = Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal()
LtlSMUBon.Text = String.Format("{0:N2}", SMUBon)
HdnSMUBon.Value = SMUBon.ToString()
UpModalRemisionesNC.Update() UpModalRemisionesNC.Update()
End Sub End Sub
@@ -25302,26 +25345,26 @@ Partial Class Ventas
GvDescNCBonificaciones.DataBind() GvDescNCBonificaciones.DataBind()
'SI ES CREDITO 'SI ES CREDITO
If RBLPago.SelectedValue = "1" Then 'If RBLPago.SelectedValue = "1" Then
Dim ImporteUsados As Decimal = Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal() ' Dim ImporteUsados As Decimal = Me.TmpDTRNCBonificacionesSeleccionadas.SUM("ImporteBonificacion").ToDecimal() + Me.TmpDTRNCBonificacionesSeleccionadas.SUM("IVABonificacion").ToDecimal()
HdnSMUBonDesc.Value = ImporteUsados.ToString() ' HdnSMUBonDesc.Value = ImporteUsados.ToString()
LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", ImporteUsados) ' LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", ImporteUsados)
'SI ES CONTADO ' 'SI ES CONTADO
ElseIf RBLPago.SelectedValue = "2" Then 'ElseIf RBLPago.SelectedValue = "2" Then
Dim ImporteUsados As Decimal = 0 ' Dim ImporteUsados As Decimal = 0
For Each Row As DataRow In Me.TmpDT.FiltraParametros("EsCargo = True").Rows ' For Each Row As DataRow In Me.TmpDT.FiltraParametros("EsCargo = True").Rows
Dim PUBonificacion As Decimal = GlobalDTAcumTamaños().FiltroPrimeroValor("Bonificacion", $"CvePSCargo={Row("CvePS")}").ToDecimal() ' Dim PUBonificacion As Decimal = GlobalDTAcumTamaños().FiltroPrimeroValor("Bonificacion", $"CvePSCargo={Row("CvePS")}").ToDecimal()
Dim TotalBonificacion As Decimal = (Row("Cantidad").ToString().ToDecimal() * PUBonificacion) ' Dim TotalBonificacion As Decimal = (Row("Cantidad").ToString().ToDecimal() * PUBonificacion)
Dim IVABonificacion As Decimal = (TotalBonificacion * Row("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2) ' Dim IVABonificacion As Decimal = (TotalBonificacion * Row("PorcentajeIVA").ToString().ToDecimal()).RoundSQL(2)
ImporteUsados += TotalBonificacion + IVABonificacion ' ImporteUsados += TotalBonificacion + IVABonificacion
Next ' Next
HdnSMUBonDesc.Value = ImporteUsados.ToString() ' HdnSMUBonDesc.Value = ImporteUsados.ToString()
LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", ImporteUsados) ' LblSaldoMaximoBonificacion.Text = String.Format("{0:N2}", ImporteUsados)
End If 'End If
UpDescNC.Update() UpDescNC.Update()
End Sub End Sub
@@ -25351,8 +25394,8 @@ Partial Class Ventas
Protected Sub GvDescNCBonificaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCBonificaciones.RowDataBound Protected Sub GvDescNCBonificaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCBonificaciones.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCBonChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);") e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCBonChkDesc({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble}, this);")
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCBonChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});") e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCBonChkDesc({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
End If End If
End Sub End Sub
@@ -29909,15 +29952,15 @@ Partial Class Ventas
End If End If
Next Next
Dim LimiteBonficaciones As Decimal = LblSaldoMaximoBonificacion.Text.Trim().ToDecimal() 'Dim LimiteBonficaciones As Decimal = LblSaldoMaximoBonificacion.Text.Trim().ToDecimal()
'VERIFICA EL LIMITE DE LOS USADOS ''VERIFICA EL LIMITE DE LOS USADOS
If ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado) > LimiteBonficaciones Then 'If ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado) > LimiteBonficaciones Then
Alert($"La suma de las remisiones de nota de crédito de tipo 'Bonificación' no debe superar el limite.<br/>Total RNC: {ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado):N2}.<br/>Total Usados: {LimiteUsados:N2}", TipoMensaje.MsgAdvertencia) ' Alert($"La suma de las remisiones de nota de crédito de tipo 'Bonificación' no debe superar el limite.<br/>Total RNC: {ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado):N2}.<br/>Total Usados: {LimiteUsados:N2}", TipoMensaje.MsgAdvertencia)
ListaNCDesc.Clear() ' ListaNCDesc.Clear()
ListaNCBonificacion.Clear() ' ListaNCBonificacion.Clear()
Exit Sub ' Exit Sub
End If 'End If
ElseIf RblRNCTipoDesc.SelectedValue.Contiene("2") Then ElseIf RblRNCTipoDesc.SelectedValue.Contiene("2") Then
@@ -29940,15 +29983,15 @@ Partial Class Ventas
End If End If
Next Next
Dim LimiteBonficaciones As Decimal = LblSaldoMaximoBonificacion.Text.Trim().ToDecimal() 'Dim LimiteBonficaciones As Decimal = LblSaldoMaximoBonificacion.Text.Trim().ToDecimal()
'VERIFICA EL LIMITE DE LOS USADOS ''VERIFICA EL LIMITE DE LOS USADOS
If ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado) > LimiteBonficaciones Then 'If ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado) > LimiteBonficaciones Then
Alert($"La suma de las remisiones de nota de crédito de tipo 'Bonificación' no debe superar el limite.<br/>Total RNC: {ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado):N2}.<br/>Total Usados: {LimiteUsados:N2}", TipoMensaje.MsgAdvertencia) ' Alert($"La suma de las remisiones de nota de crédito de tipo 'Bonificación' no debe superar el limite.<br/>Total RNC: {ListaNCBonificacion.Sum(Function(x) x.TotalRemNCAplicado):N2}.<br/>Total Usados: {LimiteUsados:N2}", TipoMensaje.MsgAdvertencia)
ListaNCDesc.Clear() ' ListaNCDesc.Clear()
ListaNCBonificacion.Clear() ' ListaNCBonificacion.Clear()
Exit Sub ' Exit Sub
End If 'End If
'SI SON SOLO BONIFICACIONES GENERA LA NC PRINCIPAL EN BASE A ESAS 'SI SON SOLO BONIFICACIONES GENERA LA NC PRINCIPAL EN BASE A ESAS
If RblRNCTipoDesc.SelectedValue.ToString() = "2" AndAlso ListaNCDesc.Count = 0 Then If RblRNCTipoDesc.SelectedValue.ToString() = "2" AndAlso ListaNCDesc.Count = 0 Then
@@ -29965,6 +30008,13 @@ Partial Class Ventas
TotalProntoPago = TmpDT.SUM("ImporteProntoPago").ToDecimal TotalProntoPago = TmpDT.SUM("ImporteProntoPago").ToDecimal
End If End If
If TotalRemNCAplicado > TxtTotal.Text.ToDecimal() Then
Alert($"La suma de las remisiones de nota de crédito no debe superar el total de la factura.<br/>Total RNC: {TotalRemNCAplicado:N2}.<br/>Total Factura: {TxtTotal.Text.ToDecimal():N2}", TipoMensaje.MsgAdvertencia)
ListaNCDesc.Clear()
ListaNCBonificacion.Clear()
Exit Sub
End If
HdnTotalRNC.Value = TotalRemNCAplicado.ToString() HdnTotalRNC.Value = TotalRemNCAplicado.ToString()
LblDescuentosRNC.Text = TotalRemNCAplicado.FormatoNumero LblDescuentosRNC.Text = TotalRemNCAplicado.FormatoNumero
LblTotalAPagar.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado - TotalProntoPago).FormatoNumero LblTotalAPagar.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado - TotalProntoPago).FormatoNumero