Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -875,6 +875,23 @@ Public Class ClsAcumuladores
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Public Function UpdatePolizaVirtual(CvePolizaVirtual As Integer, CveMarca As Integer, FechaUsado As DateTime) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
SqlDataAdapter("PA_Vta_PolizaVirtualUpdate")
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CvePolizaVirtual", SqlDbType.Int).Value = CvePolizaVirtual
|
||||
.Add("@CveMarca", SqlDbType.Int).Value = CveMarca
|
||||
.Add("@FechaUsado", SqlDbType.DateTime).Value = FechaUsado
|
||||
End With
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As SqlException
|
||||
OnError("Ocurrió un al actualizar el envio de la poliza virtual. ", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function UpdateEnvioPolizaVirutal(CvePolizaVirtual As Integer, Envio As Boolean, FechaEnvio As DateTime, CodigoUnico As String) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
SqlDataAdapter("PA_Vta_PolizaVirtualEnvioUpdate")
|
||||
|
||||
@@ -196,7 +196,7 @@ Public Class ClsCompras
|
||||
Optional CveOC As Integer = -1, Optional CveCajaChica As Integer = -1, Optional CvePersonal As Integer = -1, Optional NumeroReembolso As String = "-1", Optional CveProveedorSucursal As Integer = -1,
|
||||
Optional AplicoPromocion As Boolean = False, Optional PorcentajeIVA As Double = 0, Optional CveMetodoPago As Integer = -1, Optional CveRetIVAConcepto As Integer = -1, Optional CveConceptoContableAlmacen As Integer = -1,
|
||||
Optional CveRetISRConcepto As Integer = -1, Optional NoDeducible As Boolean = False, Optional CveTipoCompra As Integer = -1, Optional TotalOriginal As Double = 0, Optional CveTipoConcepto As Integer = 1, Optional CveFactura As Integer = -1,
|
||||
Optional CveContrato As Integer = -1) As Boolean
|
||||
Optional CveContrato As Integer = -1, Optional EsImportacion As Boolean = False) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
@@ -248,6 +248,8 @@ Public Class ClsCompras
|
||||
.Add("@CveTipoConcepto", SqlDbType.Int).Value = CveTipoConcepto
|
||||
.Add("@CveFactura", SqlDbType.Int).Value = CveFactura
|
||||
.Add("@CveContrato", SqlDbType.Int).Value = CveContrato
|
||||
.Add("@EsImportacion", SqlDbType.Bit).Value = EsImportacion
|
||||
|
||||
End With
|
||||
|
||||
Try
|
||||
|
||||
@@ -6473,7 +6473,7 @@ Public Class ClsPaginas
|
||||
If Vta.SubProyecto.CP.ToEntero > 0 Then SBDomicilioSucursal.AppendFormat(", CP: {0}", Vta.SubProyecto.CP)
|
||||
If CiudadSucursal.Length > 0 Then SBDomicilioSucursal.AppendFormat(", {0}", CiudadSucursal)
|
||||
If Vta.SubProyecto.Pais.Length > 0 Then SBDomicilioSucursal.AppendFormat(", {0}", Vta.SubProyecto.Pais)
|
||||
If Not String.IsNullOrEmpty(Vta.SubProyecto.Telefono) AndAlso UsuarioActual.CveEmpresa = 141 Then SBDomicilioSucursal.AppendFormat(", Tel: {0}", Vta.SubProyecto.Telefono)
|
||||
If Not String.IsNullOrEmpty(Vta.SubProyecto.Telefono) AndAlso UsuarioActual.CveEmpresa.Contiene(141, 152, 159, 160, 161, 162) Then SBDomicilioSucursal.AppendFormat(", Tel: {0}", Vta.SubProyecto.Telefono)
|
||||
|
||||
DomicilioSucursal = SBDomicilioSucursal.ToString
|
||||
|
||||
@@ -6718,7 +6718,7 @@ Public Class ClsPaginas
|
||||
params.Add(New ReportParameter("ClienteTelefono", Vta.ClienteSucursal.TelefonoSucursal))
|
||||
ElseIf Vta.CveCliente.ToEntero > 0 Then
|
||||
params.Add(New ReportParameter("ClienteContactoMail", Vta.Cliente.MailCotizacion))
|
||||
params.Add(New ReportParameter("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.RFC = "XAXX010101000", Vta.TelefonoGenerico, Vta.Cliente.Telefono)))
|
||||
params.Add(New ReportParameter("ClienteTelefono", If(Vta.TipoDocto.Contiene("Ing", "Rem") AndAlso Vta.Cliente.Telefono.Length > 6, Vta.TelefonoGenerico, Vta.Cliente.Telefono)))
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(17) Then
|
||||
|
||||
@@ -1268,17 +1268,19 @@ Public Class ClsVentas
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function UpdateVentaDetalleRemision(CveVenta As Integer, CvePS As Integer, Cantidad As Double, PU As Double, IEPS As Double, PorcentajeIEPS As Decimal, Observaciones As String, Optional CveUsuarioModifico As Integer = -1) As Boolean
|
||||
Public Function UpdateVentaDetalleRemision(CveVenta As Integer, CvePS As Integer, Cantidad As Decimal, PU As Decimal, IEPS As Decimal, PorcentajeIEPS As Decimal, IVA As Decimal, PorcentajeIVA As Decimal, Observaciones As String, Optional CveUsuarioModifico As Integer = -1) As Boolean
|
||||
Dim Retorno As Boolean = False
|
||||
DataAdapter("PA_VentasDetalleRemisionUpdate")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveVentaDetalle", SqlDbType.Int).Value = CveVenta
|
||||
.Add("@CvePS", SqlDbType.Int).Value = CvePS
|
||||
.Add("@Cantidad", SqlDbType.Float).Value = Cantidad
|
||||
.Add("@PU", SqlDbType.Float).Value = PU
|
||||
.Add("@IEPS", SqlDbType.Float).Value = IEPS
|
||||
.Add("@PorcentajeIEPS", SqlDbType.Float).Value = PorcentajeIEPS
|
||||
.Add("@Cantidad", SqlDbType.Decimal).Value = Cantidad
|
||||
.Add("@PU", SqlDbType.Decimal).Value = PU
|
||||
.Add("@IEPS", SqlDbType.Decimal).Value = IEPS
|
||||
.Add("@PorcentajeIEPS", SqlDbType.Decimal).Value = PorcentajeIEPS
|
||||
.Add("@IVA", SqlDbType.Decimal).Value = IVA
|
||||
.Add("@PorcentajeIVA", SqlDbType.Decimal).Value = PorcentajeIVA
|
||||
.Add("@Observaciones", SqlDbType.VarChar).Value = Observaciones
|
||||
.Add("@CveUsuarioModifico", SqlDbType.Int).Value = CveUsuarioModifico
|
||||
End With
|
||||
|
||||
@@ -392,22 +392,37 @@ Public Class E141 : Implements IHttpHandler
|
||||
Select Case Metodo
|
||||
Case "CrearActualizarProductos"
|
||||
respuesta = CrearActualizarProductos(If(FiltrarTodos = "1", True, False))
|
||||
If respuesta Then
|
||||
retorno = "True"
|
||||
Else
|
||||
retorno = "False"
|
||||
End If
|
||||
Case "CrearActualizarProductosJson"
|
||||
retorno = CrearActualizarProductosJson(If(FiltrarTodos = "1", True, False))
|
||||
Case "ActualizarPrecios"
|
||||
respuesta = ActualizarPrecios(If(FiltrarTodos = "1", True, False))
|
||||
If respuesta Then
|
||||
retorno = "True"
|
||||
Else
|
||||
retorno = "False"
|
||||
End If
|
||||
Case "ActualizarExistencias"
|
||||
respuesta = ActualizarExistencias()
|
||||
If respuesta Then
|
||||
retorno = "True"
|
||||
Else
|
||||
retorno = "False"
|
||||
End If
|
||||
Case "ActualizarVendedores"
|
||||
respuesta = ActualizarVendedores(If(FiltrarTodos = "1", True, False))
|
||||
If respuesta Then
|
||||
retorno = "True"
|
||||
Else
|
||||
retorno = "False"
|
||||
End If
|
||||
End Select
|
||||
|
||||
If respuesta Then
|
||||
retorno = "True"
|
||||
Else
|
||||
retorno = "False"
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
context.Response.Write(retorno)
|
||||
@@ -1962,6 +1977,25 @@ Public Class E141 : Implements IHttpHandler
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
Private Function CrearActualizarProductosJson(Todos As Boolean) As String
|
||||
Dim payload = New JObject()
|
||||
|
||||
Dim CountPeticiones As Integer = 0, CountPeticionesExitosas As Integer = 0
|
||||
|
||||
Dim DtPS As DataTable = Nothing
|
||||
Using ObjPS As New ClsProductosServicios
|
||||
'OBTERNER PRECIOS DE PUBLICO GENERAL
|
||||
If ObjPS.GetProductosModificados(CveEmpresa, 44, If(Todos, -1, 1)) Then
|
||||
DtPS = ObjPS.DtResultados.Copy()
|
||||
End If
|
||||
End Using
|
||||
|
||||
If DtPS IsNot Nothing Then
|
||||
payload.Add(New JProperty("products", GenerarPayloadProductos(DtPS)))
|
||||
End If
|
||||
|
||||
Return payload.ToString()
|
||||
End Function
|
||||
Private Function GenerarPayloadProductos(DtPS As DataTable) As JArray
|
||||
Dim ArrayPS As New JArray
|
||||
For Each RowPS As DataRow In DtPS.Rows
|
||||
|
||||
@@ -47,8 +47,7 @@ Partial Class Bancos_PopIECompras
|
||||
Set(value As Integer)
|
||||
ViewState("CveCompra") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
End Property
|
||||
Private Property CveTipoConcepto As Integer
|
||||
Get
|
||||
Return ViewState("CveTipoConcepto").ToString.ToEntero
|
||||
@@ -474,6 +473,21 @@ Partial Class Bancos_PopIECompras
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property EsImportacion As Boolean
|
||||
Get
|
||||
|
||||
If ViewState("EsImportacion") Is Nothing Then
|
||||
Return False
|
||||
Else
|
||||
Return CBool(ViewState("EsImportacion"))
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("EsImportacion") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
|
||||
@@ -735,6 +749,7 @@ Partial Class Bancos_PopIECompras
|
||||
TxtImporte.Text = dr("Saldo").ToString.ToDouble.FormatoNumero
|
||||
|
||||
SaldoVenta = dr("Saldo").ToString.ToDouble
|
||||
EsImportacion = CBool(dr("EsImportacion"))
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
@@ -1589,7 +1604,19 @@ Partial Class Bancos_PopIECompras
|
||||
|
||||
|
||||
Dim CveSubProyectoInsertar As Integer = -1
|
||||
Dim ConceptoContable = Row("CveConcepto").ToString.ToEntero
|
||||
Dim ConceptoContable = Row("CveConcepto").ToString.ToEntero
|
||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
|
||||
If ConceptoContable.Contiene(14, 19) AndAlso CveCompra > 0 Then
|
||||
If EsImportacion Then
|
||||
If ConceptoContable = 14 Then
|
||||
ConceptoContable = 287
|
||||
Else
|
||||
ConceptoContable = 288
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False)
|
||||
Dim ImporteMovimiento As Decimal = 0
|
||||
Dim ImporteMX As Decimal = 0
|
||||
@@ -2635,6 +2662,230 @@ Partial Class Bancos_PopIECompras
|
||||
End If
|
||||
End If
|
||||
|
||||
Case 287 'Iva por Acreditar
|
||||
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
||||
'funcionalidad que toma el 100% del pago para acreditamiento de iva
|
||||
Dim TotalImporte As Decimal
|
||||
|
||||
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then
|
||||
TotalImporte = ImportePagado.ToString.ToDecimal
|
||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||
TotalImporte = Math.Round(ImportePagado.ToString.ToDecimal / tipoCambioPago, 2)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||
TotalImporte = Math.Round(ImportePagado.ToString.ToDecimal * tipoCambioPago, 2)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||
TotalImporte = ImportePagado.ToString.ToDecimal
|
||||
End If
|
||||
|
||||
If TotalImporte = CompraSaldo Then
|
||||
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimiento = MovimientoPagar.IVA
|
||||
ImporteMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = MovimientoPagar.IVA
|
||||
ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimiento = MovimientoPagar.IVA
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = MovimientoPagar.IVA
|
||||
ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
End If
|
||||
ImporteMovimiento = Math.Round(ImporteMovimiento, 2)
|
||||
ImporteMX = Math.Round(ImporteMX, 2)
|
||||
TimpocambioGeneral = tipoCambioCompra
|
||||
|
||||
If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}"
|
||||
Else
|
||||
ImporteMovimiento = 0
|
||||
ImporteMX = 0
|
||||
End If
|
||||
Else
|
||||
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimiento = MovimientoPagar.IVA * PorcentajePago
|
||||
ImporteMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago)
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago)
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = (MovimientoPagar.IVA * PorcentajePago)
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
End If
|
||||
ImporteMovimiento = Math.Round(ImporteMovimiento, 2)
|
||||
ImporteMX = Math.Round(ImporteMX, 2)
|
||||
TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
|
||||
If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}"
|
||||
End If
|
||||
|
||||
PorcentajeImpuesto = MovimientoPagar.PorcentajeIVA
|
||||
Dim IdCtaIVAXAcreditar As Integer = 0
|
||||
Dim IdCtaIVAAcreditable As Integer = 0
|
||||
|
||||
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
|
||||
IdCtaIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
|
||||
IdCtaIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
|
||||
End If
|
||||
|
||||
IdCtaContable = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0)
|
||||
|
||||
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
|
||||
If ObjMov.DtResultados.Rows.Count > 0 Then
|
||||
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
|
||||
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
|
||||
Case 288 'Iva Acreditable
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
||||
'funcionalidad que toma el 100% del pago para acreditamiento de iva
|
||||
Dim TotalImporte As Decimal
|
||||
|
||||
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then
|
||||
TotalImporte = ImportePagado.ToString.ToDecimal
|
||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||
TotalImporte = Math.Round(ImportePagado.ToString.ToDecimal / tipoCambioPago, 2)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||
TotalImporte = Math.Round(ImportePagado.ToString.ToDecimal * tipoCambioPago, 2)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||
TotalImporte = ImportePagado.ToString.ToDecimal
|
||||
End If
|
||||
|
||||
If TotalImporte = CompraSaldo Then
|
||||
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimiento = MovimientoPagar.IVADeducible
|
||||
ImporteMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = (MovimientoPagar.IVADeducible)
|
||||
ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimiento = (MovimientoPagar.IVADeducible)
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = (MovimientoPagar.IVADeducible)
|
||||
ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
End If
|
||||
ImporteMovimiento = Math.Round(ImporteMovimiento, 2)
|
||||
ImporteMX = Math.Round(ImporteMX, 2)
|
||||
TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
|
||||
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
|
||||
Else
|
||||
ImporteMovimiento = 0
|
||||
ImporteMX = 0
|
||||
End If
|
||||
|
||||
Else
|
||||
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimiento = (MovimientoPagar.IVADeducible * PorcentajePago).RoundSQL
|
||||
ImporteMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = (MovimientoPagar.IVADeducible * PorcentajePago)
|
||||
ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimiento = (MovimientoPagar.IVADeducible * PorcentajePago)
|
||||
ImporteMX = ImporteMovimiento * tipoCambioCompra
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimiento = (MovimientoPagar.IVADeducible * PorcentajePago)
|
||||
ImporteMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
End If
|
||||
ImporteMovimiento = Math.Round(ImporteMovimiento, 2)
|
||||
ImporteMX = Math.Round(ImporteMX, 2)
|
||||
TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
|
||||
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
|
||||
End If
|
||||
|
||||
If MovimientoPagar.IVANoDeducible.ToString.ToDecimal > 0 Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
||||
'funcionalidad que toma el 100% del pago para acreditamiento de iva
|
||||
Dim TotalImporte As Decimal
|
||||
|
||||
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then
|
||||
TotalImporte = ImportePagado.ToString.ToDecimal
|
||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||
TotalImporte = Math.Round(ImportePagado.ToString.ToDecimal / tipoCambioPago, 2)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||
TotalImporte = Math.Round(ImportePagado.ToString.ToDecimal * tipoCambioPago, 2)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||
TotalImporte = ImportePagado.ToString.ToDecimal
|
||||
End If
|
||||
|
||||
If TotalImporte = CompraSaldo Then
|
||||
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimientoNoDeducible = MovimientoPagar.IVANoDeducible
|
||||
ImporteMXNoDeducible = ImporteMovimientoNoDeducible
|
||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimientoNoDeducible = (MovimientoPagar.IVANoDeducible)
|
||||
ImporteMXNoDeducible = ImporteMovimientoNoDeducible * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimientoNoDeducible = (MovimientoPagar.IVANoDeducible)
|
||||
ImporteMXNoDeducible = ImporteMovimientoNoDeducible * tipoCambioCompra
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimientoNoDeducible = (MovimientoPagar.IVANoDeducible)
|
||||
ImporteMXNoDeducible = ImporteMovimientoNoDeducible * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
End If
|
||||
ImporteMovimientoNoDeducible = Math.Round(ImporteMovimientoNoDeducible, 2)
|
||||
ImporteMXNoDeducible = Math.Round(ImporteMX, 2)
|
||||
TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
|
||||
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimientoNoDeducible.FormatoNumero(2)}"
|
||||
Else
|
||||
ImporteMovimientoNoDeducible = 0
|
||||
ImporteMXNoDeducible = 0
|
||||
End If
|
||||
|
||||
Else
|
||||
If CveMoneda = 1 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimientoNoDeducible = MovimientoPagar.IVANoDeducible * PorcentajePago
|
||||
ImporteMXNoDeducible = ImporteMovimientoNoDeducible
|
||||
ElseIf CveMoneda = 1 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimientoNoDeducible = (MovimientoPagar.IVANoDeducible * PorcentajePago)
|
||||
ImporteMXNoDeducible = ImporteMovimientoNoDeducible * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 1 Then
|
||||
ImporteMovimientoNoDeducible = (MovimientoPagar.IVANoDeducible * PorcentajePago)
|
||||
ImporteMXNoDeducible = ImporteMovimientoNoDeducible * tipoCambioCompra
|
||||
ElseIf CveMoneda = 2 AndAlso CveMonedaCompra = 2 Then
|
||||
ImporteMovimientoNoDeducible = (MovimientoPagar.IVANoDeducible * PorcentajePago)
|
||||
ImporteMXNoDeducible = ImporteMovimientoNoDeducible * If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
End If
|
||||
ImporteMovimientoNoDeducible = Math.Round(ImporteMovimientoNoDeducible, 2)
|
||||
ImporteMXNoDeducible = Math.Round(ImporteMXNoDeducible, 2)
|
||||
TimpocambioGeneral = If(FuncionalidadFluctuacionImpuestos, tipoCambioPago, tipoCambioCompra)
|
||||
|
||||
If tipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{tipoCambioPago} ${ImporteMovimientoNoDeducible.FormatoNumero(2)}"
|
||||
End If
|
||||
End If
|
||||
|
||||
PorcentajeImpuesto = MovimientoPagar.PorcentajeIVA
|
||||
Dim IdCtaIVAXAcreditar As Integer = 0
|
||||
Dim IdCtaIVAAcreditable As Integer = 0
|
||||
Dim IdCtaContableNoIVA As Integer = 0
|
||||
|
||||
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
|
||||
IdCtaIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
|
||||
IdCtaIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
|
||||
IdCtaContableNoIVA = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVANoAcreditable").ToString.ToEntero
|
||||
End If
|
||||
|
||||
IdCtaContable = If(IdCtaIVAAcreditable > 0, IdCtaIVAAcreditable, 0)
|
||||
|
||||
If ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
|
||||
If ObjMov.DtResultados.Rows.Count > 0 Then
|
||||
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
|
||||
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
|
||||
If MovimientoPagar.IVANoDeducible > 0 Then
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteMovimiento, If(ConceptoContable = 30, TxtFolio.Text.Trim, TxtObservaciones.Text), 280, ConceptoMovimiento, Fecha, IdCtaContableNoIVA, -1, CveIE, -1, CveCompra, -1, CveProveedor:=CveProveedor2, ImporteMX:=ImporteMXNoDeducible, CveCuenta:=CveCuenta, TipoCambio:=TimpocambioGeneral, CvePersonal:=CvePersonal, PorcentajeImpuesto:=PorcentajeImpuesto) Then
|
||||
MsgError = "No se pudo insertar la póliza"
|
||||
End If
|
||||
End If
|
||||
'Case 280 'Iva Acreditable No Deducible
|
||||
' If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
||||
' 'funcionalidad que toma el 100% del pago para acreditamiento de iva
|
||||
|
||||
@@ -718,79 +718,76 @@ Partial Class Bancos_PopIEVentas
|
||||
Validada = True
|
||||
End If
|
||||
|
||||
|
||||
If Validada Then
|
||||
|
||||
CveCliente = dr("CveCliente").ToString.ToEntero
|
||||
CveClienteOriginal = dr("CveCliente").ToString.ToEntero
|
||||
HdnCveCliente.Value = CveCliente.ToString
|
||||
CargaCliente(CveCliente, "-1")
|
||||
CveMoneda = dr("CveMoneda").ToString.ToEntero
|
||||
CveMonedaVenta = dr("CveMoneda").ToString.ToEntero
|
||||
CveMonedaFiltros = dr("CveMoneda").ToString.ToEntero
|
||||
NombreCliente = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=CveCliente).FiltroPrimeroValor("Nombre", String.Format("CveCliente = {0}", CveCliente))
|
||||
SerieFolio = dr("SerieFolio").ToString
|
||||
TipoCambioOriginal = dr("TipoCambio").ToString.ToDecimal
|
||||
CveSubProyectoVenta = dr("CveSubProyecto").ToString.ToEntero
|
||||
|
||||
LblMetodoPAgo.Text = $"{dr("ClaveMetodoPagoSATStr").ToString() }"
|
||||
CveCliente = dr("CveCliente").ToString.ToEntero
|
||||
CveClienteOriginal = dr("CveCliente").ToString.ToEntero
|
||||
HdnCveCliente.Value = CveCliente.ToString
|
||||
CargaCliente(CveCliente, "-1")
|
||||
CveMoneda = dr("CveMoneda").ToString.ToEntero
|
||||
CveMonedaVenta = dr("CveMoneda").ToString.ToEntero
|
||||
CveMonedaFiltros = dr("CveMoneda").ToString.ToEntero
|
||||
NombreCliente = GlobalDTCliente(UsuarioActual.CveEmpresa, CveCliente:=CveCliente).FiltroPrimeroValor("Nombre", String.Format("CveCliente = {0}", CveCliente))
|
||||
SerieFolio = dr("SerieFolio").ToString
|
||||
TipoCambioOriginal = dr("TipoCambio").ToString.ToDecimal
|
||||
CveSubProyectoVenta = dr("CveSubProyecto").ToString.ToEntero
|
||||
|
||||
LblMetodoPAgo.Text = $"{dr("ClaveMetodoPagoSATStr").ToString() }"
|
||||
|
||||
'Configuración de Modalidad Update
|
||||
|
||||
'Dim RFCCliente As String = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("RFC", $"CveCliente = {CveCliente} ")
|
||||
|
||||
If Not UsuarioActual.Empresa.Funcionalidad(536) = "1" Then
|
||||
If dr("TipoDocto").ToString = "Rem" Then
|
||||
Alert("Los documentos de tipo Remisión no se permite realizar el pago", TipoMensaje.MsgAdvertencia)
|
||||
BtnGuardar.Visible = False
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
'Configuración de Modalidad Update
|
||||
MovimientoPagar = New IEMovimiento
|
||||
MovimientoPagar.SubTotal = dr("SubTotal").ToString.ToDecimal
|
||||
MovimientoPagar.IVA = dr("IVA").ToString.ToDecimal
|
||||
MovimientoPagar.RetIVA = dr("RetIVA").ToString.ToDecimal
|
||||
MovimientoPagar.RetISR = dr("RetISR").ToString.ToDecimal
|
||||
MovimientoPagar.Total = dr("Total").ToString.ToDecimal
|
||||
MovimientoPagar.Saldo = dr("Saldo").ToString.ToDecimal
|
||||
MovimientoPagar.IEPS = dr("IEPS").ToString.ToDecimal
|
||||
MovimientoPagar.PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal
|
||||
|
||||
'Dim RFCCliente As String = GlobalDTCliente(UsuarioActual.CveEmpresa).FiltroPrimeroValor("RFC", $"CveCliente = {CveCliente} ")
|
||||
LtlTitulo.Text = "Cuentas por Cobrar"
|
||||
LtlTipo2.Text = "Folio de la Venta"
|
||||
LtlTipo3.Text = "Fecha de la Venta"
|
||||
LtlSaldo.Text = If(CveMoneda = 1, $"{dr("Saldo").ToString.FormatoNumero}{" MXN"}", $"{dr("Saldo").ToString.FormatoNumero}{" USD"}")
|
||||
LtlFechaVenta.Text = dr("Fecha").ToString.ToDate.ToShortDateString()
|
||||
LtlFolio.Text = dr("SerieFolio").ToString
|
||||
|
||||
TxtFolio.Enabled = True
|
||||
TxtFechaDocumento.Enabled = True
|
||||
Calendario.Enabled = True
|
||||
TxtPagueseA.Enabled = False
|
||||
TxtImporte.Enabled = True
|
||||
|
||||
DdlCuenta.Enabled = True
|
||||
|
||||
DdlTipoTransaccion.Enabled = True
|
||||
TxtObservaciones.Enabled = True
|
||||
|
||||
RVImporte.Enabled = True
|
||||
RVImporte.MaximumValue = dr("Saldo").ToString.ToDouble.ToString.FormatoNumero
|
||||
TxtImporte.Text = dr("Saldo").ToString.ToDouble.FormatoNumero
|
||||
|
||||
FechaVenta = dr("Fecha").ToString.ToDate
|
||||
SaldoVenta = dr("Saldo").ToString.ToDouble
|
||||
|
||||
|
||||
If Not UsuarioActual.Empresa.Funcionalidad(536) = "1" Then
|
||||
If dr("TipoDocto").ToString = "Rem" Then
|
||||
Alert("Los documentos de tipo Remisión no se permite realizar el pago", TipoMensaje.MsgAdvertencia)
|
||||
BtnGuardar.Visible = False
|
||||
End If
|
||||
End If
|
||||
'Cortes de Caja
|
||||
If UsuarioActual.TienePermisoProceso(160) Then
|
||||
CargaCorteCaja()
|
||||
End If
|
||||
|
||||
|
||||
|
||||
MovimientoPagar = New IEMovimiento
|
||||
MovimientoPagar.SubTotal = dr("SubTotal").ToString.ToDecimal
|
||||
MovimientoPagar.IVA = dr("IVA").ToString.ToDecimal
|
||||
MovimientoPagar.RetIVA = dr("RetIVA").ToString.ToDecimal
|
||||
MovimientoPagar.RetISR = dr("RetISR").ToString.ToDecimal
|
||||
MovimientoPagar.Total = dr("Total").ToString.ToDecimal
|
||||
MovimientoPagar.Saldo = dr("Saldo").ToString.ToDecimal
|
||||
MovimientoPagar.IEPS = dr("IEPS").ToString.ToDecimal
|
||||
MovimientoPagar.PorcentajeIVA = dr("PorcentajeIVA").ToString.ToDecimal
|
||||
|
||||
LtlTitulo.Text = "Cuentas por Cobrar"
|
||||
LtlTipo2.Text = "Folio de la Venta"
|
||||
LtlTipo3.Text = "Fecha de la Venta"
|
||||
LtlSaldo.Text = If(CveMoneda = 1, $"{dr("Saldo").ToString.FormatoNumero}{" MXN"}", $"{dr("Saldo").ToString.FormatoNumero}{" USD"}")
|
||||
LtlFechaVenta.Text = dr("Fecha").ToString.ToDate.ToShortDateString()
|
||||
LtlFolio.Text = dr("SerieFolio").ToString
|
||||
|
||||
TxtFolio.Enabled = True
|
||||
TxtFechaDocumento.Enabled = True
|
||||
Calendario.Enabled = True
|
||||
TxtPagueseA.Enabled = False
|
||||
TxtImporte.Enabled = True
|
||||
|
||||
DdlCuenta.Enabled = True
|
||||
|
||||
DdlTipoTransaccion.Enabled = True
|
||||
TxtObservaciones.Enabled = True
|
||||
|
||||
RVImporte.Enabled = True
|
||||
RVImporte.MaximumValue = dr("Saldo").ToString.ToDouble.ToString.FormatoNumero
|
||||
TxtImporte.Text = dr("Saldo").ToString.ToDouble.FormatoNumero
|
||||
|
||||
FechaVenta = dr("Fecha").ToString.ToDate
|
||||
SaldoVenta = dr("Saldo").ToString.ToDouble
|
||||
|
||||
|
||||
'Cortes de Caja
|
||||
If UsuarioActual.TienePermisoProceso(160) Then
|
||||
CargaCorteCaja()
|
||||
End If
|
||||
If Not Validada Then
|
||||
BtnGuardar.Visible = False
|
||||
End If
|
||||
|
||||
|
||||
@@ -1388,8 +1385,6 @@ Partial Class Bancos_PopIEVentas
|
||||
#Region "G U A R D A R"
|
||||
Private Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
|
||||
|
||||
|
||||
|
||||
Dim FechaFactura As Date = FechaVenta
|
||||
Dim FechaDocumentoPago As Date = TxtFechaDocumento.Text.ToDate
|
||||
|
||||
|
||||
@@ -1006,6 +1006,7 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
'inserto las compras que voy a pagar
|
||||
For Each gvr As GridViewRow In GvCxP.Rows
|
||||
If gvr.FCCheckBox("Chk").Checked Then
|
||||
Dim EsImportacion As Boolean = False
|
||||
|
||||
'Tipos de cambio
|
||||
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos
|
||||
@@ -1032,7 +1033,6 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
|
||||
If ObjMov.GetPlantillaConceptos(UsuarioActual.CveEmpresa, CvePlantillaPoliza) Then
|
||||
For Each Row As DataRow In ObjMov.DtResultados.Rows
|
||||
|
||||
ConceptoContable = Row("CveConcepto").ToString.ToEntero
|
||||
TipoMovimiento = If(Row("TipoMovto").ToString = "True", True, False)
|
||||
ImporteMovimiento = 0
|
||||
@@ -1042,6 +1042,27 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
Referencia = gvr.DataKey("SerieFolio").ToString
|
||||
Dim PorcentajeImpuesto As Decimal = 0
|
||||
|
||||
If ConceptoContable.Contiene(14, 19) AndAlso gvr.DataKey("CveCompra").ToEntero > 0 Then
|
||||
Dim objcompras As New ClsCompras
|
||||
objcompras.GetCompras(gvr.DataKey("CveCompra").ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa)
|
||||
If objcompras.DtResultados IsNot Nothing AndAlso objcompras.DtResultados.Rows.Count > 0 Then
|
||||
Dim dr As DataRow = objcompras.DtResultados.Rows(0)
|
||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
|
||||
If dr("EsImportacion").ToString = "True" Then
|
||||
EsImportacion = True
|
||||
If ConceptoContable = 14 Then
|
||||
ConceptoContable = 287
|
||||
Else
|
||||
ConceptoContable = 288
|
||||
End If
|
||||
Else
|
||||
EsImportacion = False
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Select Case ConceptoContable
|
||||
Case 17 'Pago Proveedores
|
||||
|
||||
@@ -1736,6 +1757,72 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAxAcreditarSIG").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
Case 287 'Iva X Acreditar Importacion
|
||||
Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
||||
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
||||
'funcionalidad que toma el 100% del pago para acreditamiento de iva
|
||||
|
||||
If TotalImporte = gvr.DataKey("Saldo").ToDecimal Then
|
||||
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||
ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
|
||||
importeMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||
ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
|
||||
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||
ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
|
||||
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||
ImporteMovimiento = gvr.DataKey("IVA").ToDecimal
|
||||
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||
End If
|
||||
ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
|
||||
importeMX = Math.Round(importeMX, 2)
|
||||
|
||||
If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}"
|
||||
Else
|
||||
ImporteMovimiento = 0
|
||||
importeMX = 0
|
||||
End If
|
||||
Else
|
||||
ImporteMovimiento = gvr.DataKey("IVAPorPagar").ToDecimal * PorcentajePago
|
||||
|
||||
|
||||
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||
importeMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||
End If
|
||||
ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
|
||||
importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero)
|
||||
|
||||
If tipoCambioCompra > 1 Then ConceptoMovimiento += $" TC:{tipoCambioCompra} ${ImporteMovimiento.FormatoNumero(2)}"
|
||||
End If
|
||||
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
|
||||
|
||||
PorcentajeImpuesto = gvr.DataKey("PorcentajeIVA").ToDecimal
|
||||
Dim IdCtaIVAXAcreditar As Integer = 0
|
||||
Dim IdCtaIVAAcreditable As Integer = 0
|
||||
|
||||
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
|
||||
IdCtaIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
|
||||
IdCtaIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
|
||||
End If
|
||||
IdCtaContable = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0)
|
||||
If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
|
||||
If ObjMov.DtResultados.Rows.Count > 0 Then
|
||||
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
|
||||
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
Case 19 'Iva Acreditado
|
||||
Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
||||
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
||||
@@ -1817,6 +1904,88 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCuentaIVAAcreditableSIG").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
|
||||
Case 288 'Iva Acreditado
|
||||
Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
||||
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
||||
'funcionalidad que toma el 100% del pago para acreditamiento de iva
|
||||
If TotalImporte = gvr.DataKey("Saldo").ToDecimal Then
|
||||
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||
ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
|
||||
importeMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||
ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
|
||||
importeMX = gvr.DataKey("IVADeducible").ToDecimal * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
|
||||
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||
ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
|
||||
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||
ImporteMovimiento = gvr.DataKey("IVADeducible").ToDecimal
|
||||
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
|
||||
End If
|
||||
ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
|
||||
importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero)
|
||||
|
||||
If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
|
||||
Else
|
||||
ImporteMovimiento = 0
|
||||
importeMX = 0
|
||||
End If
|
||||
Else
|
||||
ImporteMovimiento = gvr.DataKey("IVAPorPagar").ToDecimal * PorcentajePago
|
||||
|
||||
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||
importeMX = ImporteMovimiento
|
||||
ElseIf CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
|
||||
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
|
||||
importeMX = ImporteMovimiento * tipoCambioCompra
|
||||
ElseIf CveMoneda = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero = 2 Then
|
||||
tipoCambioCompra = gvr.DataKey("TipoCambio").ToDecimal
|
||||
|
||||
importeMX = ImporteMovimiento * If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
|
||||
End If
|
||||
ImporteMovimiento = Math.Round(ImporteMovimiento, 2, MidpointRounding.AwayFromZero)
|
||||
importeMX = Math.Round(importeMX, 2, MidpointRounding.AwayFromZero)
|
||||
|
||||
If TipoCambioPago > 1 Then ConceptoMovimiento += $" TC:{TipoCambioPago} ${ImporteMovimiento.FormatoNumero(2)}"
|
||||
End If
|
||||
TipoCambioGeneral = If(FuncionalidadFluctuacionImpuestos, TipoCambioPago, tipoCambioCompra)
|
||||
|
||||
|
||||
|
||||
PorcentajeImpuesto = gvr.DataKey("PorcentajeIVA").ToDecimal
|
||||
Dim IdCtaIVAXAcreditar As Integer = 0
|
||||
Dim IdCtaIVAAcreditable As Integer = 0
|
||||
Dim IdCtaContableNoIVA As Integer = 0
|
||||
|
||||
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows.Count > 0 Then
|
||||
IdCtaIVAXAcreditar = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAXAcreditar").ToString.ToEntero
|
||||
IdCtaIVAAcreditable = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVAAcreditable").ToString.ToEntero
|
||||
IdCtaContableNoIVA = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=PorcentajeImpuesto).Rows(0)("IdCtaIVANoAcreditable").ToString.ToEntero
|
||||
End If
|
||||
IdCtaContable = If(IdCtaIVAAcreditable > 0, IdCtaIVAAcreditable, 0)
|
||||
|
||||
'se registra el iva no acreditable
|
||||
If gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal > 0 Then
|
||||
|
||||
Dim ImporteNOIVA As Decimal = gvr.DataKey("IVAPorPagarNoDeducible").ToDecimal * PorcentajePago
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, ImporteNOIVA, Referencia, 280, ConceptoMovimiento, FechaMovimiento, IdCtaContableNoIVA, -1, CveIE, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedor, ImporteMX:=ImporteNOIVA, ImporteME:=If(TipoCambioPago = 1, 0, ImporteMovimiento), CveCuenta:=CveCuenta, TipoCambio:=TipoCambioGeneral, PorcentajeImpuesto:=PorcentajeImpuesto) Then
|
||||
MsgError = "No se pudo insertar la póliza"
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
If ImporteMovimiento <> 0 AndAlso ObjMov.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
|
||||
If ObjMov.DtResultados.Rows.Count > 0 Then
|
||||
IdCtaContable = ObjMov.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
|
||||
CveCuenta = ObjMov.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
Case 25 'IEPS X Acreditar
|
||||
Dim TotalImporte As Decimal = gvr.FCTextBox("TxtAbonar").Text.ToDecimal
|
||||
ImporteMovimiento = gvr.DataKey("IEPSPorPagar").ToDecimal * PorcentajePago
|
||||
@@ -2219,6 +2388,7 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
End If
|
||||
|
||||
'Agrego el IVA
|
||||
|
||||
If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, True, gvr.DataKey("IVA").ToDecimal * PorcentajePago, TxtObservaciones.Text, 14, TxtObservaciones.Text, Now, IdCtaIVAXAcreditar, -1, CveIE, CveCompra:=gvr.DataKey("CveCompra").ToEntero, CveProveedor:=CveProveedor, ImporteMX:=gvr.DataKey("IVA").ToDecimal * PorcentajePago) Then
|
||||
MsgError = "Detalle"
|
||||
|
||||
@@ -3392,6 +3562,7 @@ Partial Class Bancos_ProveedoresAbonar
|
||||
Private Sub RVTxtFechaDocumento_Init(sender As Object, e As EventArgs) Handles RVTxtFechaDocumento.Init
|
||||
RVTxtFechaDocumento.MaximumValue = DateTime.Now.ToShortDateString
|
||||
RVTxtFechaDocumentoMenor.MinimumValue = DateTime.Now.AddMonths(-4).ToShortDateString
|
||||
RVTxtFechaDocumentoMenor.MaximumValue = DateTime.Now.ToShortDateString
|
||||
Calendario.EndDate = DateTime.Now
|
||||
|
||||
End Sub
|
||||
|
||||
@@ -514,6 +514,12 @@
|
||||
</asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
<div class="form-group proveedoreespes" runat="server" id="divImportacion" visible="false">
|
||||
<span class="whitoutcol linewhitsize proveedoreespes">Importación </span>
|
||||
<div class="whitoutcol whitoutcol">
|
||||
<asp:CheckBox runat="server" ID="chkImportacion"> </asp:CheckBox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
@@ -4427,7 +4433,7 @@
|
||||
<asp:UpdatePanel ID="UpIVA" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="col-md-3" id="divIVA" runat="server" visible="false">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlIVA" CssClass="form-control select2me" Style="width: 100%; display: inline-block;" runat="server" Enabled="false">
|
||||
<asp:ListItem Selected="True" Value="1.08">8%</asp:ListItem>
|
||||
@@ -4439,6 +4445,15 @@
|
||||
<label for="<%= DdlIVA.ClientID.ToString()%>">% IVA:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3" id="divImporteImportacion" runat="server" visible="false">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="txtImportacion" ClientIDMode="Static" runat="server" CssClass=" form-control " CausesValidation="true"></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender ID="FTBEImportacion" runat="server" TargetControlID="txtImportacion" FilterType="Custom, Numbers" ValidChars="." />
|
||||
<%--<asp:TextBox ID="TxtIVAModal" ClientIDMode="Static" Enabled="false" runat="server" CssClass=" form-control " CausesValidation="true" MaxLength="12" ValidationGroup="GprAgregaPS"></asp:TextBox>
|
||||
<ajax:FilteredTextBoxExtender ID="FTBEIVA" runat="server" TargetControlID="TxtIVAModal" FilterType="Custom, Numbers" ValidChars="." />--%>
|
||||
<label for="<%= DdlIVA.ClientID.ToString()%>">Importación:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:TextBox ID="TxtRetIVAModal" ClientIDMode="Static" Enabled="false" runat="server" CssClass=" form-control " CausesValidation="true" MaxLength="12" ValidationGroup="GprAgregaPS"></asp:TextBox>
|
||||
@@ -6613,9 +6628,19 @@
|
||||
$('#LblTotalContrato').text(SubTotal);
|
||||
|
||||
}
|
||||
function ChkImportacion(chk) {
|
||||
|
||||
if (chk.checked == true) {
|
||||
$('#divIVA').css("display", "none");
|
||||
$('#divImporteImportacion').css("display", "block");
|
||||
debugger;
|
||||
} else {
|
||||
$('#divIVA').css("display", "none");
|
||||
$("#divImporteImportacion").css("display", "block");
|
||||
debugger;
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
function ValidateCantCon(variable) {
|
||||
|
||||
|
||||
@@ -1623,6 +1623,13 @@ Partial Class Compras_Compras
|
||||
'End If
|
||||
|
||||
'RegistraScript("ScrollVentanaAddProducto();")
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
|
||||
divImportacion.Visible = True
|
||||
chkImportacion.Attributes.Add("onclick", "ChkImportacion(this);")
|
||||
|
||||
End If
|
||||
|
||||
End Sub
|
||||
|
||||
#Region "C A R G A S"
|
||||
@@ -3009,6 +3016,14 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
End If
|
||||
|
||||
'Tiene Importacion
|
||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" Then
|
||||
If dr("EsImportacion").ToString = "True" Then
|
||||
chkImportacion.Checked = True
|
||||
Else
|
||||
chkImportacion.Checked = False
|
||||
End If
|
||||
End If
|
||||
CargaComplementosPago()
|
||||
|
||||
Else
|
||||
@@ -4507,6 +4522,7 @@ Partial Class Compras_Compras
|
||||
Dim EntregaDirecta = False
|
||||
|
||||
Dim ConceptoPoliza As String = String.Format("{0} - {1}{2} - {3}", NombreProveedor, TxtSerie.Text, TxtFolio.Text, TxtDescripcion.Text.Trim)
|
||||
Dim EsImportacion As Boolean = chkImportacion.Checked 'funcion para empresas llanteras
|
||||
|
||||
'TIPO CAMBIO MANUAL CON COMPRA NUEVA
|
||||
Dim TipoCambioGuardar As Decimal = 1
|
||||
@@ -4616,7 +4632,7 @@ Partial Class Compras_Compras
|
||||
Else
|
||||
CveConceptoContableAlmacen = 205
|
||||
End If
|
||||
If OCVinculada And Not (CveImportacion > 0 Or CveFlete > 0) Then
|
||||
If OCVinculada AndAlso DdlOCVinculaInv.visible AndAlso Not (CveImportacion > 0 Or CveFlete > 0) Then
|
||||
CveConceptoContableAlmacen = DdlOCVinculaInv.SelectedValue.ToEntero
|
||||
End If
|
||||
If UsuarioActual.CveEmpresa.Contiene(72, 80, 140, 141) And Not (CveImportacion > 0 Or CveFlete > 0) Then 'se comento, RMF. 2020.08.19, no le hallo sentido
|
||||
@@ -4671,12 +4687,13 @@ Partial Class Compras_Compras
|
||||
|
||||
|
||||
'Compra
|
||||
|
||||
If ObjCompras.AddCompra(DdlTipoComprobante.SelectedValue, TxtDescripcion.Text.Trim, TxtSerie.Text.Trim, TxtFolio.Text.Trim, TxtFolioSecundario.Text.Trim, CveProveedor, TxtSubTotal.Text.ToDouble, TxtDescuento.Text.ToDouble,
|
||||
LblAmortizacion.Text.ToDouble, TxtIVA.Text.ToDouble, TxtRetIVA.Text.ToDouble, TxtRetISR.Text.ToDouble, TxtIEPS.Text.ToDouble, TxtOtrosImpuestos.Text.ToDouble,
|
||||
TxtRedondeo.Text.ToDouble, TxtTotal.Text.ToDouble, TxtFecha.Text.Trim.ToDate, DdlMoneda.SelectedValue.ToEntero, TipoCambio, TxtFechaPago.Text.Trim.ToDate, ChkAplicaNotaCredito.Checked, TxtObsFact.Text.Trim, CveEstatusFactura,
|
||||
CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, IdPoliza, CveCajaChica:=CveCajaChica, CvePersonal:=CvePersonal, NumeroReembolso:=NumeroReembolso, CveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero,
|
||||
AplicoPromocion:=ChkOCPromocion.Checked, PorcentajeIVA:=PorcentajeIVA, CveMetodoPago:=CveMetodoPago, CveRetIVAConcepto:=If(DdlRetIVAConcepto.Items.Count > 0, DdlRetIVAConcepto.SelectedValue.ToEntero, -1), CveConceptoContableAlmacen:=CveConceptoContableAlmacen,
|
||||
CveRetISRConcepto:=If(DdlRetISRConcepto.Items.Count > 0, DdlRetISRConcepto.SelectedValue.ToEntero, -1), NoDeducible:=EsNoDeducible, CveTipoCompra:=DdlTipoCompra.SelectedValue.ToEntero, TotalOriginal:=TotalOriginal, CveTipoConcepto:=CveTipoConcepto) Then
|
||||
CveRetISRConcepto:=If(DdlRetISRConcepto.Items.Count > 0, DdlRetISRConcepto.SelectedValue.ToEntero, -1), NoDeducible:=EsNoDeducible, CveTipoCompra:=DdlTipoCompra.SelectedValue.ToEntero, TotalOriginal:=TotalOriginal, CveTipoConcepto:=CveTipoConcepto, EsImportacion:=EsImportacion) Then
|
||||
|
||||
ViewState("CveCompra") = ObjCompras.CveCompra
|
||||
If ObjCompras.DtResultados.Rows.Count > 0 Then ViewState("CompraFolio") = ObjCompras.DtResultados.Rows(0)("vFolio").ToString
|
||||
@@ -5844,8 +5861,11 @@ Partial Class Compras_Compras
|
||||
For Each Row As DataRow In DTPlatilla.Rows
|
||||
|
||||
Dim CveSubProyectoInsertar As Integer = -1
|
||||
|
||||
Dim ConceptoContable As Integer = Row("CveConcepto").ToString.ToEntero
|
||||
If chkImportacion.Checked And ConceptoContable = 14 Then
|
||||
ConceptoContable = 287
|
||||
|
||||
End If
|
||||
Dim TipoMovimiento As Boolean = If(Row("TipoMovto").ToString = "True", True, False)
|
||||
Dim importeMovimiento As Decimal = 0
|
||||
Dim IdCtaContable As Integer = 0
|
||||
@@ -6077,6 +6097,21 @@ Partial Class Compras_Compras
|
||||
CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaIVAxAcreditarSIG").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
|
||||
Case 287 'IVA X Acreditar
|
||||
importeMovimiento = importeIVAxAcreditar
|
||||
importeMN = Math.Round(importeMovimiento, 2) * tipoCambioActual * Multiplicador
|
||||
If tipoCambioActual > 1 Then Concepto += $" TC{tipoCambioActual} ${importeMovimiento.FormatoNumero(2)}"
|
||||
PorcentajeImpuesto = PorcentajeIVA
|
||||
IdCtaContable = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0)
|
||||
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
|
||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCtaContable").ToString.ToEntero
|
||||
CveCuenta = ObjConta.DtResultados.Rows(0)("IdCtaContableSIG").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
Case 25 'IEPS X Acreditar
|
||||
If Not DdlTipoComprobante.SelectedValue.Contiene("Ant") Then
|
||||
importeMovimiento = ImporteIEPSxAcreditar
|
||||
@@ -6517,7 +6552,7 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
Case 6 'Compra
|
||||
|
||||
Dim AgregaMercanciaInventario As Boolean = UsuarioActual.CveEmpresa.Contiene(1, 72, 80, 119, 140, 141, 152, 159, 160, 161, 162, 163) AndAlso UsuarioActual.Empresa.UsaInventarios AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1"
|
||||
Dim AgregaMercanciaInventario As Boolean = UsuarioActual.CveEmpresa.Contiene(1, 72, 80, 119, 140, 141, 152, 153, 154, 159, 160, 161, 162, 163) AndAlso UsuarioActual.Empresa.UsaInventarios AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1"
|
||||
|
||||
Dim RegistraConcepto225 As Boolean = UsuarioActual.Empresa.UsaInventarios AndAlso DdlTipoComprobante.SelectedValue.Contiene("NC", "DEV") AndAlso Not UsuarioActual.Empresa.Funcionalidad(126) = "1"
|
||||
|
||||
@@ -9167,6 +9202,32 @@ Partial Class Compras_Compras
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Case 287 'Iva X Acreditar importacion
|
||||
If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant") Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
||||
If sumaAmortizacion = CompraSaldo Then
|
||||
ImporteMovimiento = TxtIVA.Text.ToDecimal
|
||||
|
||||
If ImporteMovimiento > 0 Then
|
||||
IVACompleto = True
|
||||
End If
|
||||
|
||||
Else
|
||||
ImporteMovimiento = 0
|
||||
End If
|
||||
Else
|
||||
ImporteMovimiento = Math.Round(PorcentajePago * TxtIVA.Text.ToDecimal, 2)
|
||||
End If
|
||||
importeMN = ImporteMovimiento * tipoCambio
|
||||
PorcentajeImpuesto = TmpDT.MAX("IVAPorcentaje").ToDecimal
|
||||
IdCtaContable = If(IdCtaIVAXAcreditar > 0, IdCtaIVAXAcreditar, 0)
|
||||
If ObjConta.GetRetCuenta(ConceptoContable, UsuarioActual.CveEmpresa) And Not IdCtaContable > 0 Then
|
||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||
IdCtaContable = ObjConta.DtResultados.Rows(0)("IdCuentaIVAxAcreditar").ToString.ToEntero
|
||||
CveCuenta = ObjConta.DtResultados.Rows(0)("IdCuentaIVAxAcreditarSIG").ToString.ToEntero
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Case 19 'Iva Acreditado
|
||||
If Not gvr.DataKey("TipoDocto").Contiene("NC", "DEV", "Ant") Then
|
||||
If UsuarioActual.Empresa.Funcionalidad(521) = "1" Then
|
||||
@@ -17757,6 +17818,15 @@ Partial Class Compras_Compras
|
||||
|
||||
UpPSS.Update()
|
||||
RegistraScript(String.Format("$('#{0}').modal('show');", "divAddProducto"))
|
||||
If chkImportacion.Checked Then
|
||||
divImporteImportacion.Visible = True
|
||||
divIVA.Visible = False
|
||||
|
||||
Else
|
||||
divIVA.Visible = True
|
||||
divImporteImportacion.Visible = False
|
||||
|
||||
End If
|
||||
End Sub
|
||||
Private Sub LimpiaAgregar()
|
||||
|
||||
@@ -18198,9 +18268,14 @@ Partial Class Compras_Compras
|
||||
If PSRow IsNot Nothing Then
|
||||
SATClavePS = PSRow("SATClavePS").ToString.ToEntero
|
||||
End If
|
||||
|
||||
Dim IVA As Double
|
||||
If chkImportacion.Checked Then
|
||||
IVA = (txtImportacion.Text.Trim.ToDouble / (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.Trim.ToDouble))
|
||||
Else
|
||||
IVA = Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2)
|
||||
End If
|
||||
AddPS(TxtCantidad.Text.Trim.ToDouble, ddlUM.SelectedValue.ToEntero, ddlUM.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text, DdlPS.SelectedValue.ToEntero, DdlPS.SelectedText, HdnTipoPS.Value.ToEntero,
|
||||
DdlSubProyecto.SelectedValue.ToString, DdlSubProyecto.SelectedItem.Text, DdlProyecto.SelectedItem.Text, DdlProyecto.SelectedValue.ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, Total, Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2),
|
||||
DdlSubProyecto.SelectedValue.ToString, DdlSubProyecto.SelectedItem.Text, DdlProyecto.SelectedItem.Text, DdlProyecto.SelectedValue.ToString, TxtObsPS.Text.Trim, TxtPrecio.Text.Trim.ToDouble, Total, IVA,
|
||||
TxtRetIVAModal.Text.ToDouble / 100, TxtRetISRModal.Text.ToDouble / 100, TxtIEPSModal.Text.ToDouble / 100, 0, TxtDescuentoModal.Text.ToDouble, OtrosGastos:=TxtOtrosGastos.Text.ToDouble, CveTipoGasto:=DdlTipoGasto.SelectedValue.ToEntero, TipoGasto:=DdlTipoGasto.SelectedItem.Text,
|
||||
NoDeducible:=ChkEsNoDeduciblePS.Checked, CveSATPS:=SATClavePS)
|
||||
|
||||
|
||||
@@ -67,9 +67,17 @@
|
||||
<asp:Label ID="LblEncabezado" runat="server" Text=" Registro de Póliza"></asp:Label>
|
||||
</asp:Content>
|
||||
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
||||
<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>
|
||||
</li>
|
||||
<asp:UpdatePanel runat="server">
|
||||
<ContentTemplate>
|
||||
<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>
|
||||
</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>
|
||||
</li>
|
||||
</ContentTemplate>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
<asp:UpdatePanel runat="server">
|
||||
<ContentTemplate>
|
||||
<li>
|
||||
@@ -779,6 +787,54 @@
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div id="DivCargaExcel" 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">×</button>
|
||||
<h4 class="modal-title">Agregar Excel</h4>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<label class="col-md-2 truncate" style="text-align: right;">Plantilla:</label>
|
||||
<div class="col-md-10">
|
||||
<asp:DropDownList ID="DdlPlantilla2" runat="server" DataValueField="CvePlantillaPoliza" DataTextField="PlantillaPoliza" class="select2me" Width="100%"></asp:DropDownList>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h3>Arraste o haga click para subir el archivo Excel</h3>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col-md-11" style="margin-left: 30px; margin-right: 30px; margin-bottom: 10px;">
|
||||
<asp:TextBox ID="TxtExcel" CssClass="ADSdropzone hidden" Text="" data-maxFile="1" runat="server"></asp:TextBox>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<div class="row">
|
||||
<div class="col-md-3" style="text-align: left">
|
||||
<asp:UpdatePanel ID="UpDescargar" runat="server" UpdateMode="Conditional">
|
||||
<ContentTemplate>
|
||||
<asp:Button ID="BtnDescargar" runat="server" CssClass="btn btn-warning" Text="Descargar Formato" />
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="BtnDescargar" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
|
||||
</div>
|
||||
<div class="col-md-9" style="text-align: right">
|
||||
<asp:Button ID="BtnCargaExcel" runat="server" CssClass="btn btn-success" Text="Aceptar"></asp:Button>
|
||||
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<script src="/Metronic/assets/global/plugins/dropzone/dropzone.js"></script>
|
||||
|
||||
@@ -4,11 +4,12 @@ Imports System.Data
|
||||
Imports Extensiones
|
||||
Imports System.Linq
|
||||
Imports System.Web.Services
|
||||
Imports GemBox.Spreadsheet
|
||||
|
||||
Partial Class ContabilidadC_RegPrePolizaS
|
||||
Inherits ClsPaginas
|
||||
|
||||
|
||||
Inherits ClsPaginas
|
||||
|
||||
|
||||
#Region "Propiedades"
|
||||
Public Property ArregloMovs As ArrayList
|
||||
Get
|
||||
@@ -157,9 +158,9 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
Set(value As Integer)
|
||||
ViewState("IndiceGrid") = value
|
||||
End Set
|
||||
End Property
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
|
||||
If Not Page.IsPostBack Then
|
||||
@@ -483,16 +484,29 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub CargaPlantillas(TipoPlantilla As Integer)
|
||||
|
||||
'GvPlantillas.DataSource = GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa, TipoPlantilla)
|
||||
'GvPlantillas.DataBind()
|
||||
|
||||
DdlPlantilla.DataSource = GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa, TipoPlantilla)
|
||||
DdlPlantilla.DataBind()
|
||||
DdlPlantilla.Items.Insert(0, New ListItem("Plantilla Personalizada", "53"))
|
||||
End Sub
|
||||
|
||||
Private Sub CargaPlantillas(TipoPlantilla As Integer)
|
||||
|
||||
'GvPlantillas.DataSource = GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa, TipoPlantilla)
|
||||
'GvPlantillas.DataBind()
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(120) Then
|
||||
DdlPlantilla.DataSource = GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa, -1)
|
||||
DdlPlantilla2.DataSource = GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa, -1)
|
||||
|
||||
Else
|
||||
DdlPlantilla.DataSource = GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa, TipoPlantilla)
|
||||
DdlPlantilla2.DataSource = GlobalDTContaPlantillasPolizas(UsuarioActual.CveEmpresa, TipoPlantilla)
|
||||
|
||||
End If
|
||||
|
||||
|
||||
DdlPlantilla.DataBind()
|
||||
DdlPlantilla.Items.Insert(0, New ListItem("Plantilla Personalizada", "53"))
|
||||
|
||||
DdlPlantilla2.DataBind()
|
||||
DdlPlantilla2.Items.Insert(0, New ListItem("Plantilla Personalizada", "53"))
|
||||
End Sub
|
||||
|
||||
Private Sub CargaConceptos()
|
||||
DdlConceptosContables.DataSource = GlobalDTContaConceptosContables(-1)
|
||||
DdlConceptosContables.DataBind()
|
||||
@@ -543,8 +557,9 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
|
||||
Private Sub CargaCuentasContables()
|
||||
Dim ObjConta As New ClsContabilidad
|
||||
If ObjConta.GetCuentas(-1, "-1", -1, UsuarioActual.CveEmpresa) Then
|
||||
If ObjConta.GetCuentas(-1, "-1", 1, UsuarioActual.CveEmpresa) Then
|
||||
DdlCtaContable.DataSource = ObjConta.DtResultados
|
||||
DtCuentasContables = ObjConta.DtResultados
|
||||
End If
|
||||
ObjConta.Dispose()
|
||||
DdlCtaContable.DataBind()
|
||||
@@ -1338,7 +1353,7 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
dr("IdCuenta") = DdlCtaContable.SelectedValue
|
||||
|
||||
If DdlCtaContable.SelectedValue.ToEntero > 0 Then
|
||||
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContable.SelectedValue))
|
||||
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCtaContable.SelectedValue))
|
||||
If drr IsNot Nothing Then
|
||||
CodigoCuenta = drr("CuentaFormato").ToString()
|
||||
NombreCuenta = drr("Nombre").ToString()
|
||||
@@ -1406,7 +1421,7 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
dr("IdCuenta") = DdlCtaContable.SelectedValue
|
||||
|
||||
If DdlCtaContable.SelectedValue.ToEntero > 0 Then
|
||||
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("Id={0}", DdlCtaContable.SelectedValue))
|
||||
Dim drr As DataRow = DtCuentasContables.FiltroPrimero(String.Format("CveCuenta={0}", DdlCtaContable.SelectedValue))
|
||||
If drr IsNot Nothing Then
|
||||
CodigoCuenta = drr("CuentaFormato").ToString()
|
||||
NombreCuenta = drr("Nombre").ToString()
|
||||
@@ -1457,8 +1472,8 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
TxtAbono.Text = ""
|
||||
TxtReferencia.Text = ""
|
||||
TxtDescripcion.Text = ""
|
||||
End Sub
|
||||
|
||||
End Sub
|
||||
|
||||
#Region "PESTAÑA INFORMACION GENERAL DE BANCO IE"
|
||||
Public Sub Bancos_Click(sender As Object, e As EventArgs)
|
||||
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
|
||||
@@ -1510,9 +1525,9 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
End If
|
||||
|
||||
ObjContabilidad.Dispose()
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
Protected Sub DdlTipoGasto_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
If UpPrePoliza.Visible Then
|
||||
For Each Gvr As GridViewRow In GvPrePoliza.Rows
|
||||
@@ -1669,11 +1684,11 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
ObjConta.Dispose()
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
#Region "COMPLEMENTO DE PAGO"
|
||||
|
||||
|
||||
Private Sub GeneraTimbre(CvePrePoliza As Integer)
|
||||
Dim Str As New StringBuilder
|
||||
Dim Banco As New ClsBancos
|
||||
@@ -1730,10 +1745,211 @@ Partial Class ContabilidadC_RegPrePolizaS
|
||||
|
||||
Protected Sub LnkComplementoPago_Click(sender As Object, e As EventArgs)
|
||||
GeneraTimbre(CvePrePoliza)
|
||||
End Sub
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#Region "E X C E L"
|
||||
|
||||
|
||||
Private Sub LnkExcel_Click(sender As Object, e As EventArgs) Handles LnkExcel.Click
|
||||
RegistraScript(String.Format("$('#{0}').modal();", "DivCargaExcel"))
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnDescargar_Click(sender As Object, e As EventArgs) Handles BtnDescargar.Click
|
||||
Dim NombreArchivo As String
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
Dim workbook As New ExcelFile()
|
||||
Dim worksheet = workbook.Worksheets.Add(DdlPlantilla2.SelectedItem.Text.ToString)
|
||||
|
||||
Dim CvePlantilla As Integer = DdlPlantilla2.SelectedValue.ToEntero
|
||||
Dim Dt As DataTable = GlobalDTContaPlantillasPolizasDetalle(CvePlantilla).FiltraParametros(String.Format("CveEmpresa={0}", UsuarioActual.CveEmpresa), "Orden")
|
||||
|
||||
Dim DtExcel As DataTable = (From row As DataRow In Dt.Rows
|
||||
Select New With
|
||||
{
|
||||
.ConceptoAdministrativo = row.Item("ConceptoContable"),
|
||||
.Cuenta = row.Item("Codigo"),
|
||||
.NombreCuenta = row.Item("NombreCuenta"),
|
||||
.Cargo = "",
|
||||
.Abono = "",
|
||||
.Referencia = "",
|
||||
.Concepto = "",
|
||||
.SubProyecto = row.Item("SubProyecto"),
|
||||
.CveConceptoContable = row.Item("CveConcepto"),
|
||||
.CveSubProyecto = IIf(row.Item("CveSubProyecto").ToString.ToEntero > 0, row.Item("CveSubProyecto"), -1),
|
||||
.IdCtaContable = IIf(row.Item("IdCtaContable").ToString.ToEntero > 0, row.Item("IdCtaContable"), -1),
|
||||
.CveCuenta = row.Item("CveCuenta")
|
||||
}).QueryToDataTable(True)
|
||||
|
||||
worksheet.InsertDataTable(DtExcel, New InsertDataTableOptions() With
|
||||
{
|
||||
.ColumnHeaders = True,
|
||||
.StartRow = 0,
|
||||
.StartColumn = 0
|
||||
})
|
||||
|
||||
Dim columnCount = worksheet.CalculateMaxUsedColumns()
|
||||
For i = 0 To columnCount
|
||||
worksheet.Columns(i).AutoFit(1, worksheet.Rows(0), worksheet.Rows(worksheet.Rows.Count - 1))
|
||||
Next
|
||||
worksheet.Columns("I").Hidden = True
|
||||
worksheet.Columns("J").Hidden = True
|
||||
worksheet.Columns("K").Hidden = True
|
||||
worksheet.Columns("L").Hidden = True
|
||||
|
||||
|
||||
NombreArchivo = DdlPlantilla2.SelectedItem.Text.ToString
|
||||
workbook.Save(Response, $"{NombreArchivo}.xlsx", SaveOptions.XlsxDefault)
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnCargaExcel_Click(sender As Object, e As EventArgs) Handles BtnCargaExcel.Click
|
||||
If TxtExcel.getfiles().Archivos.Count > 0 Then
|
||||
Dim file As Archivo = TxtExcel.getfiles().Archivos(0)
|
||||
|
||||
Dim Directorio As String = Server.MapPath("~") & file.patch
|
||||
|
||||
Dim Tipo As String = If(file.Extencion.Contiene("xlsx", "xlsx", "xlsm", "xlsb"), "EXCEL", "CSV")
|
||||
CargarArchivo(Directorio, file.filename, Tipo)
|
||||
Else
|
||||
Alert("No existe el archivo.Favor de subir un archivo csv o excel a la plataforma", TipoMensaje.MsgError)
|
||||
End If
|
||||
End Sub
|
||||
Private Sub CargarArchivo(Ruta As String, FileName As String, Tipo As String)
|
||||
Dim dt As New DataTable
|
||||
' Conexion As Odbc.OdbcConnection = Nothing
|
||||
Dim ErrorArchivo = False
|
||||
Dim ErrorExcel = False
|
||||
|
||||
dt = ReadExcelFile(Ruta + FileName, True)
|
||||
|
||||
|
||||
If Not ErrorArchivo Then
|
||||
|
||||
If Not dt.Columns(0).ColumnName = "ConceptoAdministrativo" Then
|
||||
Alert("El nombre de la primera columna debe ser 'ConceptoAdmin'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(1).ColumnName = "Cuenta" Then
|
||||
Alert("El nombre de la segunda columna debe ser 'Cuenta'.Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(2).ColumnName = "NombreCuenta" Then
|
||||
Alert("El nombre de la tercera columna debe ser 'NombreCuenta'.Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(3).ColumnName = "Cargo" Then
|
||||
Alert("El nombre de la cuarta columna debe ser 'Cargo'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(4).ColumnName = "Abono" Then
|
||||
Alert("El nombre de la quinta columna debe ser 'Abono' .Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(5).ColumnName = "Referencia" Then
|
||||
Alert("El nombre de la sexta columna debe ser 'Referencia'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(6).ColumnName = "Concepto" Then
|
||||
Alert("El nombre de la séptima columna debe ser 'Concepto'.Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
If Not dt.Columns(7).ColumnName = "SubProyecto" Then
|
||||
Alert("El nombre de la octava columna debe ser 'SubProyecto'. Favor de corregirlo", TipoMensaje.MsgError)
|
||||
Exit Sub
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ErrorArchivo Then
|
||||
|
||||
|
||||
Dim ObjConta As New ClsContabilidad()
|
||||
ObjConta.IniciaTransacSQL()
|
||||
Try
|
||||
Dim TieneError As Boolean = False
|
||||
Dim ContadorUpdate As Integer = 0
|
||||
Dim ContadorError As Integer = 0
|
||||
Dim NombreCuenta As String = ""
|
||||
Dim CvePrePoliza As Integer = 0
|
||||
Dim Cuenta As String = ""
|
||||
Dim Reporte As New StringBuilder
|
||||
Dim TotalCargos As Integer = 0
|
||||
Dim TotalAbonos As Integer = 0
|
||||
|
||||
|
||||
CvePrePoliza = ObjConta.AddPrePolizas("Contabilidad/RegPrePolizaExcel", DdlPlantilla2.SelectedValue.ToEntero, TotalCargos, TotalAbonos, 1, TxtFecha.Text.ToDate, DdlPlantilla2.SelectedItem.Text.ToString, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=DdlTipoPolizaAdd.SelectedValue.ToEntero)
|
||||
|
||||
|
||||
For Each Row As DataRow In dt.Rows
|
||||
NombreCuenta = Row("NombreCuenta").ToString
|
||||
Cuenta = Row("Cuenta").ToString
|
||||
|
||||
Dim Importe As Decimal = If(Row("Cargo").ToString.ToDecimal <> 0, Row("Cargo").ToString.ToDecimal, Row("Abono").ToString.ToDecimal)
|
||||
Dim Concepto As String = Row("Concepto").ToString
|
||||
Dim Referencia As String = Row("Referencia").ToString
|
||||
Dim IdCuenta As Integer = -1
|
||||
Dim CveSubProyecto As Integer = Row("CveSubProyecto").ToString.ToEntero
|
||||
Dim TipoMovto As Boolean = If(Row("Cargo").ToString.ToDecimal <> 0, False, True)
|
||||
Dim YaExiste As Boolean = False
|
||||
Dim CveConceptoContable As Integer = Row("CveConceptoContable").ToString.ToEntero
|
||||
Dim IdCtaContable As Integer = Row("IdCtaContable").ToString.ToEntero
|
||||
|
||||
|
||||
If Importe <> 0 Then
|
||||
|
||||
If ObjConta.GetCuentas(-1, Cuenta.Replace("-", ""), 1, UsuarioActual.CveEmpresa) Then
|
||||
If ObjConta.DtResultados.Rows.Count > 0 Then
|
||||
IdCuenta = ObjConta.DtResultados().FiltroPrimeroValor("CveCuenta").ToEntero
|
||||
'TipoCuenta = ObjConta.DtResultados().FiltroPrimeroValor("Tipo")
|
||||
Else
|
||||
Reporte.AppendLine($"{Cuenta} - {NombreCuenta} - {Importe} </br>")
|
||||
TieneError = True
|
||||
YaExiste = True
|
||||
End If
|
||||
Else
|
||||
TieneError = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
|
||||
If YaExiste = False Then
|
||||
If IdCuenta > 0 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, "", CveConceptoContable, Concepto, Now.ToDate, IdCtaContable, -1, ImporteMX:=Importe, CveSubProyecto:=CveSubProyecto, CveCuenta:=IdCuenta) Then
|
||||
TieneError = True
|
||||
Exit For
|
||||
End If
|
||||
Else
|
||||
IdCuenta = -2
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
Next
|
||||
If Not TieneError Then
|
||||
ObjConta.Commit()
|
||||
Alert(String.Format("<br/><br/>Prepóliza: <b><a href = ""/Contabilidad/RegPrePolizas.aspx?CvePrePoliza={0}"" class=""texto"" target=""_blank"" >{1}</a></b>", CvePrePoliza, "Ver"))
|
||||
|
||||
Alert($"Se agregó la póliza {ObjConta.ContaFolio}")
|
||||
|
||||
Else
|
||||
Alert($"No encontraron las siguientes cuentas: {Reporte.ToString} ", TipoMensaje.MsgError)
|
||||
ObjConta.RollBack()
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
ObjConta.RollBack()
|
||||
End Try
|
||||
|
||||
ObjConta.Dispose()
|
||||
End If
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
|
||||
@@ -894,6 +894,10 @@ Partial Class Contratos_Default
|
||||
GRidsPresupuestos.Visible = True
|
||||
msjpresupuestos.Visible = False
|
||||
|
||||
If ObjContratos.CveContratoTipo = 30 Then
|
||||
Server.Transfer(String.Format("/Contratos/ContratoObra.aspx?CveContrato={0}", CveContrato))
|
||||
End If
|
||||
|
||||
If ArchivoUpdate = ObjContratos.Archivo.ToString Then
|
||||
LinkArchivo.Visible = True
|
||||
LinkArchivo.HRef = String.Format("{0}{1}", Ruta, ObjContratos.Archivo.ToString)
|
||||
|
||||
@@ -192,7 +192,7 @@
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
|
||||
<asp:TemplateField HeaderText="Procentaje">
|
||||
<asp:TemplateField HeaderText="Porcentaje">
|
||||
<ItemTemplate>
|
||||
<asp:TextBox ID="TxtPorcentaje" Text="" CssClass="txtporcentaje" data-cve='<%# Eval("CveContratoDetalle") %>' type="number" step="any" Width="90" runat="server"></asp:TextBox>
|
||||
</ItemTemplate>
|
||||
|
||||
@@ -103,7 +103,7 @@
|
||||
</li>
|
||||
|
||||
<li>
|
||||
<asp:LinkButton ID="LnkModalAddMaquinariaFlotilla" Visible="false" runat="server" OnClick="LnkModalAddMaquinariaFlotilla_Click"> <i class="fa fa-file-excel-o" style="font-weight:bold;"></i>Agregar Maquionaria Flotilla Herramienta</asp:LinkButton>
|
||||
<asp:LinkButton ID="LnkModalAddMaquinariaFlotilla" Visible="false" runat="server" OnClick="LnkModalAddMaquinariaFlotilla_Click"> <i class="fa fa-file-excel-o" style="font-weight:bold;"></i>Agregar Maquinaria-Flotilla-Herramienta</asp:LinkButton>
|
||||
</li>
|
||||
|
||||
</ContentTemplate>
|
||||
|
||||
6015
Empresas/158/Formatos/Factura.rdlc
Normal file
6015
Empresas/158/Formatos/Factura.rdlc
Normal file
File diff suppressed because it is too large
Load Diff
@@ -2091,6 +2091,8 @@ Partial Class GPS_Rastreo
|
||||
DtDatos.Columns.Add("Evento", GetType(String))
|
||||
DtDatos.Columns.Add("LatLng", GetType(String))
|
||||
|
||||
Dim KMRecorridos = DtPosiciones.SUM("KMRecorridos").ToString
|
||||
|
||||
Try
|
||||
Dim Direcciones As JArray = ConsultarDirecciones(DtPosiciones)
|
||||
For Each row As DataRow In DtPosiciones.Rows
|
||||
@@ -2107,6 +2109,12 @@ Partial Class GPS_Rastreo
|
||||
For Each Dir As JObject In Direcciones
|
||||
DtDatos.Rows(Dir("Indice").ToEntero())("Direccion") = Dir("Direccion").ToString()
|
||||
Next
|
||||
|
||||
|
||||
DtDatos.Columns("Vehiculo").ColumnName = "Vehículo"
|
||||
DtDatos.Columns("TiempoDetenido").ColumnName = "Tiempo Detenido"
|
||||
DtDatos.Columns("Direccion").ColumnName = "Dirección"
|
||||
|
||||
Catch ex As Exception
|
||||
GuardaLog(String.Format("Ocurrio un error al generar el reporte RLDC {0}", ex))
|
||||
End Try
|
||||
@@ -2159,15 +2167,17 @@ Partial Class GPS_Rastreo
|
||||
|
||||
|
||||
If FechaI.Length > 0 And FechaF.Length > 0 Then
|
||||
Dim RangoFechas = worksheet.Cells.GetSubrangeAbsolute(4, celdasConTexto.FirstColumnIndex, 4, celdasConTexto.LastColumnIndex)
|
||||
RangoFechas.Merged = True
|
||||
RangoFechas.Value = $"Fechas: {FechaI} a {FechaF}"
|
||||
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
|
||||
|
||||
Dim RangoFechas = worksheet.Cells.GetSubrangeAbsolute(4, celdasConTexto.FirstColumnIndex, 4, celdasConTexto.LastColumnIndex)
|
||||
RangoFechas.Merged = True
|
||||
RangoFechas.Value = $"Distancia: {KMRecorridos:N2} KM {If(FechaI.Length > 0 And FechaF.Length > 0, $"Fechas: {FechaI} a {FechaF}", "")}"
|
||||
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
|
||||
|
||||
|
||||
For i = celdasConTexto.FirstColumnIndex To celdasConTexto.LastColumnIndex
|
||||
|
||||
|
||||
@@ -335,6 +335,45 @@
|
||||
</asp:GridView>
|
||||
</div>
|
||||
</div>
|
||||
<div id="DivRecepcionApartado" runat="server" visible="false" 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">Apartado Usado</span>
|
||||
</div>
|
||||
<div class="actions">
|
||||
<div class="btn-group">
|
||||
</div>
|
||||
</div>
|
||||
<div class="tools">
|
||||
</div>
|
||||
</div>
|
||||
<div class="portlet-body">
|
||||
<div class="row">
|
||||
<div class="col-md-8">
|
||||
<div class="form-group form-md-line-input input-iconright">
|
||||
<asp:DropDownList ID="DdlMarcaRem" CssClass="form-control input-sm select2me" runat="server" DataTextField="Marca" DataValueField="CveMarca" Width="100%">
|
||||
<asp:ListItem Selected="True" Text="Seleccione la Marca" Value="-1"></asp:ListItem>
|
||||
</asp:DropDownList>
|
||||
<label for="<%= DdlMarcaRem.ClientID.ToString()%>">Marca:</label>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<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: 120px !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 id="DivAjuste" runat="server" visible="false" class="col-md-6">
|
||||
<asp:UpdatePanel ID="UpAjuste" runat="server" class="portlet light xspadding bordered" UpdateMode="Conditional">
|
||||
|
||||
@@ -317,6 +317,15 @@ Partial Class Inventarios_RecepcionUsados
|
||||
ViewState("DtPorcentajeMarcas") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property TmpDTPolizaVirtual As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("TmpDTPolizaVirtual")), Nothing, CType(ViewState("TmpDTPolizaVirtual"), DataTable))
|
||||
End Get
|
||||
Set(value As DataTable)
|
||||
ViewState("TmpDTPolizaVirtual") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
|
||||
@@ -1125,57 +1134,76 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Recibio:=TxtResponsable.Text.Trim, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, DepartamentoEntrega:=TxtDepartamentoEntrega.Text,
|
||||
PedidoContrato:=TxtPedidoContrato.Text, CveProveedor:=tCveProveedor, Modulo:="RU/G")
|
||||
If CveMovimiento <= 0 Then
|
||||
Mensaje = "Error al guardar los movimientos"
|
||||
ErrorMovInv = True
|
||||
Else
|
||||
FolioInv = ObjInventario.Folio.ToString()
|
||||
Mensaje = "Error al guardar los movimientos"
|
||||
ErrorMovInv = True
|
||||
Else
|
||||
FolioInv = ObjInventario.Folio.ToString()
|
||||
|
||||
For Each Dr As DataRow In DtMovimientos.Rows
|
||||
For Each Dr As DataRow In DtMovimientos.Rows
|
||||
|
||||
If CveConcepto = 42 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then
|
||||
ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
|
||||
Else
|
||||
ImporteConcepto = Dr("PU").ToString.ToDecimal
|
||||
End If
|
||||
If CveConcepto = 42 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then
|
||||
ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
|
||||
Else
|
||||
ImporteConcepto = Dr("PU").ToString.ToDecimal
|
||||
End If
|
||||
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
||||
Mensaje = "Error al guardar los movimientos"
|
||||
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, CveAF:=Dr("CveAF").ToString.ToEntero, Serie:=Dr("Serie").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, Observaciones:=Dr("Observaciones").ToString, CveUsuarioModifico:=UsuarioActual.CveUsuario) Then
|
||||
Mensaje = "Error al guardar los movimientos"
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
If CveVenta > 0 AndAlso Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True, CveMovimiento) Then
|
||||
Mensaje = "Error al actualizar el recibo de los usados"
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
'si es selectedvalue = 42, es entrada ,3 -salida
|
||||
Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 42, 1, 2)
|
||||
|
||||
If EsDistribuidor AndAlso RBLOpcion.SelectedValue.ToEntero = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then
|
||||
|
||||
If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario,
|
||||
UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then
|
||||
Mensaje = "Error al guardar Movimientos de distribuidor"
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
If CveVenta > 0 AndAlso Not ObjVentas.UpdateVentaUsadoRecibido(CveVenta, Dr("CvePS").ToString.ToEntero, True, CveMovimiento) Then
|
||||
Mensaje = "Error al actualizar el recibo de los usados"
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
'si es selectedvalue = 42, es entrada ,3 -salida
|
||||
Dim CveConceptoUsados As Integer = If(RBLOpcion.SelectedValue.ToEntero = 42, 1, 2)
|
||||
'ACTUALIZA LA POLIZA VIRTUAL DEL LA REMISION
|
||||
'If Not ErrorMovInv AndAlso ObjFactura.TipoDocto = "Rem" Then
|
||||
' If ObjAcum.GetPolizasVirtuales(ObjFactura.CveVenta) Then
|
||||
' Dim DtPoliza As DataTable = ObjAcum.DtResultados.Copy()
|
||||
' For Each RowPoliza As DataRow In DtPoliza.Rows
|
||||
' If Not ObjAcum.UpdatePolizaVirtual(RowPoliza("CvePolizaVirtual").ToString().ToEntero, DdlMarcaRem.SelectedValue.ToEntero(), TxtFechaVigencia.Text.ToDateTime()) Then
|
||||
' Mensaje = "Error al guardar la póliza virtual"
|
||||
' ErrorMovInv = True
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
|
||||
If EsDistribuidor AndAlso RBLOpcion.SelectedValue.ToEntero = 42 AndAlso Dr("CveTamaño").ToString.ToEntero > 0 Then
|
||||
' DtPoliza.Dispose()
|
||||
' Else
|
||||
' Mensaje = "Error al obtener la póliza virtual"
|
||||
' ErrorMovInv = True
|
||||
' End If
|
||||
'End If
|
||||
|
||||
If Not ObjAcum.DistribuidorMovtosAdd(DdlClientes.SelectedValue.ToEntero, Dr("Cantidad").ToString.ToEntero(), Dr("CveTamaño").ToString.ToEntero, CveConceptoUsados, CveVenta, UsuarioActual.CveUsuario,
|
||||
UsuarioActual.CveEmpresa, 0, Dr("Observaciones").ToString, CveMovimiento:=CveMovimiento) Then
|
||||
Mensaje = "Error al guardar Movimientos de distribuidor"
|
||||
ErrorMovInv = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
End If
|
||||
Next
|
||||
|
||||
'GENERA LA PREPOLIZA DE ALMACEN VS EL CONCEPTO DE RNC
|
||||
'If Not ErrorMovInv Then
|
||||
' ErrorMovInv = Not GeneraPrePoliza(CveMovimiento, ObjInventario, ObjConta, True)
|
||||
'End If
|
||||
|
||||
End If
|
||||
'GENERA LA PREPOLIZA DE ALMACEN VS EL CONCEPTO DE RNC
|
||||
'If Not ErrorMovInv Then
|
||||
' ErrorMovInv = Not GeneraPrePoliza(CveMovimiento, ObjInventario, ObjConta, True)
|
||||
'End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If Not ErrorMovInv Then
|
||||
|
||||
If Not ErrorMovInv Then
|
||||
If Resp IsNot Nothing Then
|
||||
For Each mensaje2 As String In Resp.Mensajes
|
||||
Msg.AppendFormat("<br>{0}", mensaje2)
|
||||
@@ -1473,6 +1501,13 @@ Partial Class Inventarios_RecepcionUsados
|
||||
GvM.DataSource = DtTemp
|
||||
GvM.DataBind()
|
||||
|
||||
'If TmpDTPolizaVirtual IsNot Nothing AndAlso RblUsadosAjuste.SelectedValue = "2" Then
|
||||
' TmpDTPolizaVirtual.Clear()
|
||||
' For Each Row As DataRow In DtTemp.Rows
|
||||
' AddPolizaVirtual(Row("CvePS").ToString().ToEntero())
|
||||
' Next
|
||||
'End If
|
||||
|
||||
EscondeColumnasGVM(DtTemp)
|
||||
End Sub
|
||||
Private Sub EscondeColumnasGVM(DtTemp As DataTable)
|
||||
@@ -2076,6 +2111,14 @@ Partial Class Inventarios_RecepcionUsados
|
||||
DdlClientes.SelectedValueExist(CveCliente)
|
||||
End If
|
||||
|
||||
If Me.ObjFactura IsNot Nothing Then
|
||||
Me.ObjFactura.Dispose()
|
||||
Me.ObjFactura = Nothing
|
||||
End If
|
||||
|
||||
Me.ObjFactura = New Modelos.Factura(UsuarioActual, CveRemisionRecibida, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas)
|
||||
|
||||
|
||||
'SI ES DISTRIBUIDOR VAMOS A GENERAR LA REMISION DE NOTA DE CREDITO
|
||||
If EsDistribuidor Then
|
||||
DivCliente.Visible = True
|
||||
@@ -2087,13 +2130,6 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Me.ObjRemisionNC = Nothing
|
||||
End If
|
||||
|
||||
If Me.ObjFactura IsNot Nothing Then
|
||||
Me.ObjFactura.Dispose()
|
||||
Me.ObjFactura = Nothing
|
||||
End If
|
||||
|
||||
Me.ObjFactura = New Modelos.Factura(UsuarioActual, CveRemisionRecibida, UsuarioActual.CveEmpresa, DirectorioServidor:=ModExtensiones.DirectorioBaseEmpresas)
|
||||
|
||||
If Me.ObjFactura IsNot Nothing Then
|
||||
'CreaRemisionNC(ObjFactura.CveCliente, ObjFactura.CveSubProyecto, ObjFactura.CveMoneda)
|
||||
DivTotal.Visible = True
|
||||
@@ -2102,12 +2138,17 @@ Partial Class Inventarios_RecepcionUsados
|
||||
'DivCliente.Visible = False
|
||||
'DivFactura.Visible = False
|
||||
End If
|
||||
|
||||
If ObjVentas.GetVentasUsadosDetalle(CveRemisionRecibida) Then
|
||||
DtUsados = ObjVentas.DtResultados.Copy()
|
||||
End If
|
||||
|
||||
ObjVentas.Dispose()
|
||||
|
||||
If DtUsados IsNot Nothing Then
|
||||
|
||||
'DivRecepcionApartado.Visible = True
|
||||
|
||||
For Each RowUsado As DataRow In DtUsados.Rows
|
||||
Dim CvePS = RowUsado("CvePS").ToString().ToEntero()
|
||||
|
||||
@@ -2271,6 +2312,10 @@ Partial Class Inventarios_RecepcionUsados
|
||||
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,
|
||||
@@ -3087,6 +3132,10 @@ Partial Class Inventarios_RecepcionUsados
|
||||
ObjPS.Dispose()
|
||||
|
||||
GuardaAjuste()
|
||||
|
||||
'If TmpDTPolizaVirtual Is Nothing Then
|
||||
' CreaDTmpDTPolizaVirtual()
|
||||
'End If
|
||||
End Sub
|
||||
|
||||
Protected Sub CargarDescuento()
|
||||
@@ -3251,15 +3300,126 @@ Partial Class Inventarios_RecepcionUsados
|
||||
Using ObjMarcas As New ClsProductosServicios
|
||||
If ObjMarcas.GetMarcas(UsuarioActual.CveEmpresa) Then
|
||||
DdlMarcaPSAjuste.DataSource = ObjMarcas.DtResultados
|
||||
DdlMarcaRem.DataSource = ObjMarcas.DtResultados
|
||||
End If
|
||||
End Using
|
||||
|
||||
DdlMarcaPSAjuste.DataBind()
|
||||
DdlMarcaRem.DataBind()
|
||||
|
||||
DdlMarcaPSAjuste.Items.Insert(0, New ListItem("Todas", "-1"))
|
||||
DdlMarcaRem.Items.Insert(0, New ListItem("Todas", "-1"))
|
||||
|
||||
UpAjuste.Update()
|
||||
End Sub
|
||||
|
||||
#Region "P O L I Z A - V I R T U A L"
|
||||
Private Sub CreaDTmpDTPolizaVirtual()
|
||||
TmpDTPolizaVirtual = New DataTable
|
||||
TmpDTPolizaVirtual.Columns.Add("CvePS", GetType(Integer))
|
||||
TmpDTPolizaVirtual.Columns.Add("Cantidad", GetType(Decimal))
|
||||
TmpDTPolizaVirtual.Columns.Add("PU", GetType(Decimal))
|
||||
TmpDTPolizaVirtual.Columns.Add("Descuento", GetType(Decimal))
|
||||
TmpDTPolizaVirtual.Columns.Add("Total", GetType(Decimal))
|
||||
TmpDTPolizaVirtual.Columns.Add("CveVentaDetalle", GetType(Integer))
|
||||
TmpDTPolizaVirtual.Columns.Add("TipoServicio", GetType(Integer))
|
||||
TmpDTPolizaVirtual.Columns.Add("TipoPoliza", GetType(Integer))
|
||||
TmpDTPolizaVirtual.Columns.Add("CveModeloAuto", GetType(Integer))
|
||||
TmpDTPolizaVirtual.Columns.Add("AnioVehiculo", GetType(Integer))
|
||||
TmpDTPolizaVirtual.Columns.Add("TieneUsado", GetType(Boolean))
|
||||
TmpDTPolizaVirtual.Columns.Add("FechaUsado", GetType(DateTime))
|
||||
TmpDTPolizaVirtual.Columns.Add("CvePSUsado", GetType(Integer))
|
||||
TmpDTPolizaVirtual.Columns.Add("CveBCIUsado", GetType(Integer))
|
||||
End Sub
|
||||
Private Function AddPolizaVirtual(CvePS As Integer) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = True
|
||||
|
||||
'If Modalidad = "U" Then
|
||||
' If TmpDTPolizaVirtual.Rows.Count > 0 Then
|
||||
' Dim Elimino As Boolean = False
|
||||
' For Each RowPoliza As DataRow In TmpDTPolizaVirtual.Rows
|
||||
' If RowPoliza("CvePS").ToString().ToEntero() = CvePS Then
|
||||
' RowPoliza.Delete()
|
||||
' Elimino = True
|
||||
' Exit For
|
||||
' End If
|
||||
' Next
|
||||
' If Elimino Then
|
||||
' TmpDTRecepcionUsados.AcceptChanges()
|
||||
' End If
|
||||
' End If
|
||||
'End If
|
||||
|
||||
Dim DrPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
||||
|
||||
If DrPS IsNot Nothing Then
|
||||
'SOLO DEBE AGREGAR POLIZA VIRTUAL SI ES ACUMULADOR
|
||||
If Not DrPS("CveClasificacion").ToString().ToEntero().Contiene(20520, 20522, 20513, 20511, 20521, 20512, 20514, 20229) Then
|
||||
Return Retorno
|
||||
End If
|
||||
Else
|
||||
Retorno = False
|
||||
Return Retorno
|
||||
End If
|
||||
|
||||
Dim Cantidad As Decimal = 1
|
||||
Dim PU As Decimal = txtPrecio.Text.ToDecimal()
|
||||
Dim Descuento As Decimal = 0
|
||||
Dim ImporteAjuste As Decimal = TxtImporteAjuste.Text.ToDecimal().RoundSQL(2)
|
||||
|
||||
Dim Total As Decimal = ((Cantidad * PU) - Descuento).RoundSQL(2)
|
||||
Dim TipoServicio As Integer = -1
|
||||
Dim FechaUsado As DateTime = If(TxtFechaAjuste.Text.ToDateTime() < MinFecha, Now, TxtFechaAjuste.Text.ToDateTime())
|
||||
Dim CveModeloAuto As Integer = -1
|
||||
Dim AnioVehiculo As Integer = 0
|
||||
Dim TipoPoliza As Integer = 1 'VENTA
|
||||
|
||||
If Total = ImporteAjuste Then
|
||||
TipoPoliza = 3 'GARANTIA
|
||||
Else
|
||||
TipoPoliza = 2 'AJUSTE
|
||||
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 CvePSUsado As Integer = -1
|
||||
Dim CveBCIUsado As Integer = -1
|
||||
|
||||
'If TieneUsado Then
|
||||
' For Each GvRow As GridViewRow In GvRecepcionUsados.Rows
|
||||
' If GvRow.RowType = DataControlRowType.DataRow Then
|
||||
' If GvRow.FCTextBox("TxtCantidad").Text.ToDecimal() > 0 Then
|
||||
' CvePSUsado = GvRow.DataKey("CvePSCargo").ToEntero()
|
||||
' CveBCIUsado = GvRow.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero()
|
||||
|
||||
' Exit For
|
||||
' End If
|
||||
' End If
|
||||
' Next
|
||||
'End If
|
||||
|
||||
Dim Row As DataRow = TmpDTPolizaVirtual.NewRow()
|
||||
Row("CvePS") = CvePS
|
||||
Row("Cantidad") = Cantidad
|
||||
Row("PU") = PU
|
||||
Row("Descuento") = Descuento
|
||||
Row("Total") = Total
|
||||
Row("CveVentaDetalle") = -1
|
||||
Row("TipoServicio") = TipoServicio
|
||||
Row("TipoPoliza") = TipoPoliza
|
||||
Row("CveModeloAuto") = CveModeloAuto
|
||||
Row("AnioVehiculo") = AnioVehiculo
|
||||
Row("TieneUsado") = 1
|
||||
Row("FechaUsado") = FechaUsado
|
||||
Row("CvePSUsado") = CvePSUsado
|
||||
Row("CveBCIUsado") = CveBCIUsado
|
||||
|
||||
TmpDTPolizaVirtual.Rows.Add(Row)
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
#End Region
|
||||
|
||||
|
||||
Partial Class MFolioGarantiaMensaje
|
||||
Public Property CvePS As Integer
|
||||
|
||||
@@ -206,12 +206,11 @@
|
||||
CssClass="table table-striped table-advance table-hover Widthall ScrollAD"
|
||||
data-sort="true" GridLines="None">
|
||||
<Columns>
|
||||
<asp:BoundField HeaderText="Folio" DataField="Folio" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" />
|
||||
<asp:HyperlinkField DataTextField="Folio" HeaderText="Folio" DataNavigateUrlFormatString="/Inventarios/EntradasSalidas.aspx?CveMovimiento={0}" DataNavigateUrlFields="CveMovimiento" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" />
|
||||
<asp:BoundField HeaderText="Fecha" DataField="FechaMovto" DataFormatString="{0:d}" ItemStyle-Width="5%" />
|
||||
<asp:BoundField HeaderText="Disponible" DataField="Cantidad" DataFormatString="{0:#,##0.00####}" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="5%" />
|
||||
<asp:BoundField HeaderText="Unidad" DataField="UnidadMedida" ItemStyle-Width="5%" />
|
||||
<asp:BoundField HeaderText="Código" DataField="Codigo" ItemStyle-Width="5%" />
|
||||
|
||||
|
||||
<asp:BoundField HeaderText="Código" DataField="Codigo" ItemStyle-Width="5%" />
|
||||
<asp:BoundField HeaderText="Producto" DataField="PS" ItemStyle-HorizontalAlign="Left"/>
|
||||
<asp:BoundField HeaderText="Serie" DataField="Serie" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Left"/>
|
||||
<asp:BoundField HeaderText="Valor" DataField="Valor" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Right" DataFormatString="{0:n}" />
|
||||
|
||||
@@ -100,6 +100,13 @@ Partial Class RepTraspasoAlmacen
|
||||
Protected Sub GvDatos_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvDatos.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If e.Row.DBCampo("Folio") = "" Then
|
||||
e.Row.CssClass = "Totales"
|
||||
Else
|
||||
If e.Row.DBCampo("PS") = "" Then
|
||||
e.Row.CssClass = "SubTotales"
|
||||
End If
|
||||
End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
|
||||
@@ -399,7 +399,7 @@
|
||||
<ajax:FilteredTextBoxExtender ID="ftbeCant" runat="server" TargetControlID="txtCantidad" FilterType="Custom, Numbers" ValidChars="." />
|
||||
<asp:RequiredFieldValidator runat="server" ID="RFVCantidad" ControlToValidate="txtCantidad" ValidationGroup="GrpAgregar" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario por favor introdúzcalo." Display="Dynamic" Text="*"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCOCantidad" runat="server" HighlightCssClass="vco" TargetControlID="RFVCantidad" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
<asp:RangeValidator ID="RVCantidad" runat="server" ControlToValidate="txtCantidad" Display="None" Type="Double" MinimumValue="0.1" MaximumValue="2147483647" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario, por favor introdúzcalo." ValidationGroup="GrpAgregar"></asp:RangeValidator>
|
||||
<asp:RangeValidator ID="RVCantidad" runat="server" ControlToValidate="txtCantidad" Display="None" Type="Double" MinimumValue="0.001" MaximumValue="2147483647" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario, por favor introdúzcalo." ValidationGroup="GrpAgregar"></asp:RangeValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCECantidad" runat="server" HighlightCssClass="vco" TargetControlID="RVCantidad" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
</td>
|
||||
<td>
|
||||
|
||||
@@ -3071,7 +3071,7 @@ Partial Class Inventarios_TraspasoAlmacen
|
||||
|
||||
ElseIf DrAlmO("CveTipoAlmacen").ToString.ToEntero = 22 Then 'Recepcion de Usados
|
||||
|
||||
DdlAlmacenDestino.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen IN (22) AND Estatus = 'Activo'")
|
||||
DdlAlmacenDestino.DataSource = GlobalDTAlmacen(UsuarioActual.CveEmpresa).FiltraParametros("CveTipoAlmacen IN (21,22) AND Estatus = 'Activo'")
|
||||
DdlAlmacenDestino.DataBind()
|
||||
DdlAlmacenDestino.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
Else
|
||||
|
||||
@@ -264,7 +264,7 @@
|
||||
<asp:Literal ID="LtlFechaInicio" runat="server" Text='<%# Eval("FechaInicio", "{0:dd/MM/yyyy}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="TxtFechaInicio" CssClass="form-control" runat="server" CausesValidation="true" Text='<%# Eval("FechaInicio") %>' ValidationGroup="GrpGV" MaxLength="10" Width="70px"></asp:TextBox>
|
||||
<asp:TextBox ID="TxtFechaInicio" CssClass="form-control" runat="server" CausesValidation="true" Text='<%# Eval("FechaInicio", "{0:dd/MM/yyyy}") %>' ValidationGroup="GrpGV" MaxLength="10" Width="70px"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RFVFechaInicio" runat="server" ControlToValidate="TxtFechaInicio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Días de Período''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGV"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCFechaInicio" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaInicio" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
</EditItemTemplate>
|
||||
@@ -274,7 +274,7 @@
|
||||
<asp:Literal ID="LtlFechaFin" runat="server" Text='<%# Eval("FechaFin", "{0:d}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
<EditItemTemplate>
|
||||
<asp:TextBox ID="TxtFechaFin" CssClass="form-control" runat="server" CausesValidation="true" Text='<%# Eval("FechaFin") %>' ValidationGroup="GrpGV" MaxLength="10" Width="70px"></asp:TextBox>
|
||||
<asp:TextBox ID="TxtFechaFin" CssClass="form-control" runat="server" CausesValidation="true" Text='<%# Eval("FechaFin", "{0:dd/MM/yyyy}") %>' ValidationGroup="GrpGV" MaxLength="10" Width="70px"></asp:TextBox>
|
||||
<asp:RequiredFieldValidator ID="RFVFechaFin" runat="server" ControlToValidate="TxtFechaFin" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Días de Período''</b> es necesario, por favor ingréselo." ValidationGroup="GrpGV"></asp:RequiredFieldValidator>
|
||||
<ajax:ValidatorCalloutExtender ID="VCFechaFin" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaFin" Width="300px"></ajax:ValidatorCalloutExtender>
|
||||
</EditItemTemplate>
|
||||
|
||||
@@ -5352,13 +5352,29 @@ Partial Class OC
|
||||
|
||||
Dim Cantidad As Decimal = Row("Cantidad").ToString.ToDecimal
|
||||
Dim PU As Decimal = Row("Importe").ToString.ToDecimal() + (Row("Importe").ToString.ToDecimal() * PorcentajeGanancia)
|
||||
Dim IEPSPS As Decimal = DrPS("IEPSPorcentaje").ToString.ToDecimal
|
||||
Dim ImporteIEPS As Decimal = ((Cantidad * PU) * IEPSPS).RoundSQL(2)
|
||||
|
||||
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalleCotizacion").ToString.ToEntero, CvePS, Cantidad, PU, ImporteIEPS, "", UsuarioActual.CveUsuario) Then
|
||||
|
||||
Dim TotalCalculableImpuestos = (Cantidad * (PU))
|
||||
Dim TotalCalculableImpuestosIVA = TotalCalculableImpuestos * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
|
||||
|
||||
Dim PorcentajeIEPS As Decimal = DrPS("IEPSPorcentaje").ToString.ToDecimal
|
||||
|
||||
Dim PorcentajeIVA As Decimal = 0D
|
||||
|
||||
If DrPS("IVA").ToString().Contiene("-1", "") Then
|
||||
PorcentajeIVA = Row("IVAPorcentaje")
|
||||
Else
|
||||
PorcentajeIVA = DrPS("IVA")
|
||||
End If
|
||||
|
||||
Dim ImporteIEPS As Decimal = (TotalCalculableImpuestos * PorcentajeIEPS).RoundSQL(2)
|
||||
Dim ImporteIVA As Decimal = (TotalCalculableImpuestosIVA * PorcentajeIVA).RoundSQL(2)
|
||||
|
||||
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalleCotizacion").ToString.ToEntero, CvePS, Cantidad, PU, ImporteIEPS, PorcentajeIEPS, ImporteIVA, PorcentajeIVA, "", UsuarioActual.CveUsuario) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Next
|
||||
Catch ex As Exception
|
||||
OcurrioError = True
|
||||
|
||||
@@ -316,7 +316,26 @@ Partial Class Ventas_ActualizarPrecios
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
DtExcel.TableName = DdlPrecioLista.SelectedItem.Text
|
||||
|
||||
If DdlPrecioLista.SelectedItem IsNot Nothing Then
|
||||
Dim worksheetName As String = DdlPrecioLista.SelectedItem.Text
|
||||
|
||||
Const invalidCharsRegex As String = "[/\\*'?[\]:]+"
|
||||
Const maxLength As Integer = 31
|
||||
Dim safeName As String = Regex.Replace(worksheetName, invalidCharsRegex, " ").Replace(" ", " ").Trim()
|
||||
|
||||
If String.IsNullOrEmpty(safeName) Then
|
||||
safeName = "Precios" ' cannot be empty
|
||||
ElseIf safeName.Length > maxLength Then
|
||||
safeName = safeName.Substring(0, maxLength)
|
||||
End If
|
||||
|
||||
DtExcel.TableName = safeName
|
||||
Else
|
||||
DtExcel.TableName = "Precios"
|
||||
End If
|
||||
|
||||
|
||||
DtExcel.Columns("Codigo").ColumnName = "Código"
|
||||
DtExcel.Columns("PS").ColumnName = "Producto / Servicio"
|
||||
SpreadsheetInfo.SetLicense(ModExtensiones.SerialGemBoxSpreadsheet)
|
||||
|
||||
@@ -59,7 +59,7 @@
|
||||
|
||||
<asp:GridView ID="GvDatos" CssClass="table table-striped table-hover Widthall" runat="server" AutoGenerateColumns="False" GridLines="None">
|
||||
<Columns>
|
||||
<asp:TemplateField HeaderText="Promoción" ItemStyle-Width="300px" ItemStyle-HorizontalAlign="Left">
|
||||
<asp:TemplateField HeaderText="Promoción" ItemStyle-HorizontalAlign="Left">
|
||||
<ItemTemplate>
|
||||
<asp:HyperLink runat="server" ID="HLPromocion" Text='<%# Eval("Promocion").ToString %>' CssClass="Texto"></asp:HyperLink>
|
||||
</ItemTemplate>
|
||||
|
||||
@@ -5037,6 +5037,9 @@
|
||||
</div>
|
||||
</div>
|
||||
</ContentTemplate>
|
||||
<Triggers>
|
||||
<asp:PostBackTrigger ControlID="BtnDescargar" />
|
||||
</Triggers>
|
||||
</asp:UpdatePanel>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@@ -1763,7 +1763,7 @@ Partial Class Clientes
|
||||
DivPortletSucursales.Visible = False
|
||||
DivPortletDireccionEnvio.Visible = False
|
||||
DivPortletAsignaciones.Visible = False
|
||||
DivPortletBitacora.Visible = False
|
||||
'DivPortletBitacora.Visible = False
|
||||
BtnEliminar.Visible = False
|
||||
|
||||
DivProtletRegistrar.Visible = True
|
||||
|
||||
@@ -1867,7 +1867,7 @@ Partial Class PV
|
||||
For Each Row As DataRow In TmpDT.FiltraParametros("EliminarDB = False").Rows
|
||||
Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString.ToEntero()
|
||||
If CveVentaDetalle > 0 Then
|
||||
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal(), Row("ImporteIEPS").ToString.ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("Obs").ToString, UsuarioActual.CveUsuario) Then
|
||||
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal(), Row("ImporteIEPS").ToString.ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("ImporteIVA").ToString.ToDecimal(), Row("PorcentajeIVA").ToString().ToDecimal(), Row("Obs").ToString, UsuarioActual.CveUsuario) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
|
||||
@@ -1427,7 +1427,7 @@
|
||||
<td>
|
||||
<asp:TextBox ID="TxtSubTotal2" ClientIDMode="Static" runat="server" BorderStyle="None" Style="text-align: right;" Text="0.00" Width="78px"></asp:TextBox></td>
|
||||
<td>
|
||||
<%-- <asp:LinkButton ID="LkbAgregarComplementos" runat="server" CssClass="btn btn-circle btn-xs gray" Text="<i class='fa fa-bell '></i>"></asp:LinkButton>--%>
|
||||
<%-- <asp:LinkButton ID="LkbAgregarComplementos" runat="server" CssClass="btn btn-circle btn-xs gray" Text="<i class='fa fa-bell '></i>"></asp:LinkButton>--%>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -2723,7 +2723,7 @@
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</td>
|
||||
<td rowspan="1" colspan="1">
|
||||
<div class="portlet light xspadding bordered whitoutcol" style="width: 450px;">
|
||||
<div class="portlet-title">
|
||||
@@ -7110,6 +7110,7 @@
|
||||
<asp:TemplateField>
|
||||
<ItemTemplate>
|
||||
<asp:CheckBox ID="ChkAplicar" runat="server" />
|
||||
<asp:HiddenField ID="HdnPorcentajeIVA" ClientIDMode="Static" runat="server" Value='<%# Eval("PorcentajeIVA").ToString %>' />
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
<asp:TemplateField HeaderText="Cantidad">
|
||||
@@ -7124,6 +7125,7 @@
|
||||
<asp:BoundField HeaderText="Fecha" DataField="Fecha" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
|
||||
<asp:TemplateField HeaderText="Total" ItemStyle-HorizontalAlign="Right">
|
||||
<ItemTemplate>
|
||||
<asp:HiddenField ID="HdnPU" ClientIDMode="Static" runat="server" Value='<%# Eval("PU").ToString %>' />
|
||||
<asp:Literal ID="TtlTotal" runat="server" Text='<%# Eval("Total", "{0:N2}") %>'></asp:Literal>
|
||||
</ItemTemplate>
|
||||
</asp:TemplateField>
|
||||
@@ -7440,6 +7442,66 @@
|
||||
TxtImporte.value = "";
|
||||
}
|
||||
}
|
||||
function CalculaSaldoRNCChkDetalle(TxtCantidad, CantidadPendiente, ImporteTotal, Chk) {
|
||||
//ImportesRNCCargo
|
||||
let Importe = 0;
|
||||
if (Chk.checked) {
|
||||
let SaldoMaximoUtilizable = ToDouble(HdnSaldoMaximoUsados.value)
|
||||
let ImportesAsignados = 0;
|
||||
|
||||
$('.ImportesRNCDetalle').each(function () {
|
||||
|
||||
if (Chk.id != $(this).find("td").eq(0).find(":checkbox").attr('id')) {
|
||||
let seleccionado = $(this).find("td").eq(0).find(":checkbox").is(':checked');
|
||||
|
||||
if (seleccionado) {
|
||||
let cantidad = ToDouble($(this).find("td").eq(1).find(":text").val());
|
||||
let porcentajeIVA = ToDouble($(this).find("td").eq(0).find(":hidden").val());
|
||||
let precio = ToDouble($(this).find("td").eq(5).find(":hidden").val());
|
||||
|
||||
let totalcalculableImpuestos = (cantidad * precio);
|
||||
let iva = ToDouble((totalcalculableImpuestos * porcentajeIVA).toFixed(2));
|
||||
|
||||
ImportesAsignados += totalcalculableImpuestos + iva;
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
Importe = SaldoMaximoUtilizable - ImportesAsignados;
|
||||
|
||||
if (Importe > 0) {
|
||||
|
||||
} else {
|
||||
if (SaldoMaximoUtilizable > 0) {
|
||||
Importe = 0;
|
||||
Chk.checked = false;
|
||||
} else {
|
||||
Importe = 0;
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
Importe = 0;
|
||||
}
|
||||
|
||||
Importe = ToDouble(Importe.toFixed(2));
|
||||
|
||||
if (Importe > 0) {
|
||||
let pu = (ImporteTotal / CantidadPendiente);
|
||||
|
||||
if (pu > 0) {
|
||||
TxtCantidad.value = (Importe / pu).toString();
|
||||
}
|
||||
|
||||
|
||||
}else {
|
||||
TxtCantidad.value = "0";
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
function LimitaSaldoRNCChk(TxtImporte, Saldo) {
|
||||
//var Importe = 0;
|
||||
|
||||
@@ -8729,21 +8791,21 @@
|
||||
|
||||
if (TotalRem == TotalNC) {
|
||||
document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.border = "2px solid #04B431";
|
||||
document.getElementById('<%= TxtNCImporte.ClientID %>').style.border = "2px solid #04B431";
|
||||
document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.color = "";
|
||||
document.getElementById('<%= TxtNCImporte.ClientID %>').style.color = "";
|
||||
document.getElementById('<%= TxtNCImporte.ClientID %>').style.border = "2px solid #04B431";
|
||||
document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.color = "";
|
||||
document.getElementById('<%= TxtNCImporte.ClientID %>').style.color = "";
|
||||
|
||||
} else {
|
||||
document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.border = "2px solid #ff0000";
|
||||
document.getElementById('<%= TxtNCImporte.ClientID %>').style.border = "2px solid #ff0000";
|
||||
document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.color = "#ff0000";
|
||||
document.getElementById('<%= TxtNCImporte.ClientID %>').style.color = "#ff0000";
|
||||
} else {
|
||||
document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.border = "2px solid #ff0000";
|
||||
document.getElementById('<%= TxtNCImporte.ClientID %>').style.border = "2px solid #ff0000";
|
||||
document.getElementById('<%= TxtImportesRemisionesNC.ClientID %>').style.color = "#ff0000";
|
||||
document.getElementById('<%= TxtNCImporte.ClientID %>').style.color = "#ff0000";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function CerrarModalRemNC() {
|
||||
if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1') {
|
||||
function CerrarModalRemNC() {
|
||||
if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1') {
|
||||
AplicarValidarRNC(true);
|
||||
CompararNC();
|
||||
}
|
||||
|
||||
@@ -2907,6 +2907,15 @@ Partial Class Ventas
|
||||
End If
|
||||
MostrarOpcionesPaqueteria()
|
||||
|
||||
'If ViewState("CveCotizacion").ToString().ToEntero() > 0 Then
|
||||
|
||||
'If Not AjustarTotalCotizacionFacturada(ViewState("CveCotizacion").ToString().ToEntero(), TxtTotal.Text.ToDecimal) Then
|
||||
' BtnEmitirImprimir.Visible = True
|
||||
' Alert("Ocurrió un error al ajustar el importe", TipoMensaje.MsgError)
|
||||
'End If
|
||||
|
||||
'End If
|
||||
|
||||
'UNA VEZ CARGADA LAS CONDICIONES DE PAGO INICIALMENTE, NO VUELVE A SOBREESCRIBIR EL VALOR
|
||||
CveFormaPago33Cliente = -1
|
||||
|
||||
@@ -7019,17 +7028,15 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
Else
|
||||
Dim DrPS As DataRow = Nothing
|
||||
|
||||
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("")
|
||||
|
||||
If Not ClienteDesglosaIEPS Then
|
||||
Dim DrPS As DataRow = Nothing
|
||||
|
||||
'DrPS = GlobalDTProductosServicios(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero(), Estatus:=-1).FiltroPrimero("")
|
||||
|
||||
DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString().ToEntero()).FiltroPrimero("")
|
||||
|
||||
PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
|
||||
|
||||
TmpDT.Rows(e.RowIndex)("PorcentajeIEPS") = 0
|
||||
DrPS = Nothing
|
||||
|
||||
End If
|
||||
|
||||
Dim TotalCalculableImpuestos As Decimal = ((Cantidad * PU) - (ObjDescuento.ImporteDescuento))
|
||||
@@ -7052,7 +7059,11 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If DrPS("IVA").ToString().Contiene("-1", "") Then
|
||||
TmpDT.Rows(e.RowIndex)("PorcentajeIVA") = PorcentajeIVA
|
||||
Else
|
||||
TmpDT.Rows(e.RowIndex)("PorcentajeIVA") = DrPS("IVA")
|
||||
End If
|
||||
|
||||
TmpDT.Rows(e.RowIndex)("CveUM") = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida").SelectedValue.ToEntero()
|
||||
TmpDT.Rows(e.RowIndex)("UM") = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida").SelectedItem.Text
|
||||
@@ -7086,6 +7097,8 @@ Partial Class Ventas
|
||||
TmpDT.Rows(e.RowIndex)("CveSubProyecto") = GvPS.Rows(e.RowIndex).FCDropDownList("DdlSubProyecto").SelectedValue
|
||||
End If
|
||||
|
||||
DrPS = Nothing
|
||||
|
||||
GvPS.EditIndex = -1
|
||||
GvPS.DataSource = TmpDT
|
||||
DtInv = TmpDT.Copy.FiltraParametros("CveTipoPS = 2")
|
||||
@@ -9727,7 +9740,7 @@ Partial Class Ventas
|
||||
ObjFactura.SetSubProyectoMatriz(Me)
|
||||
ObjFactura.SetSubProyecto(Me)
|
||||
ObjFactura.ClienteSucursal = New Modelos.SucursalModel()
|
||||
If Not CveEmpresaCRM > 0 Then
|
||||
If CveCliente > 0 Then
|
||||
If Me.ClienteSucursal IsNot Nothing Then
|
||||
ObjFactura.ClienteSucursal.RFC = Me.ClienteSucursal.RFC
|
||||
ObjFactura.ClienteSucursal.Nombre = Me.ClienteSucursal.Nombre
|
||||
@@ -9828,7 +9841,7 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
|
||||
If Not CveEmpresaCRM > 0 Then ObjFactura.Timbre = PreParaTimbre(ObjFactura)
|
||||
If CveCliente > 0 Then ObjFactura.Timbre = PreParaTimbre(ObjFactura)
|
||||
|
||||
'SI SE ESTA EDITANDO ACTUALIZA LOS IMPORTES DEL DT
|
||||
If GvImpuestosLocales2.Visible AndAlso GvImpuestosLocales2.Enabled Then
|
||||
@@ -16164,7 +16177,7 @@ Partial Class Ventas
|
||||
'End If
|
||||
|
||||
End Sub
|
||||
Private Sub CargaFormatoSucursal()
|
||||
Private Sub CargaFormatoSucursal(Optional RecalcularIVA As Boolean = True)
|
||||
Dim dr = GlobalDTSubProyectos(-1, CveEmpresa:=UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveSubProyecto = {0}", If(DdlSubProyectoDatos.SelectedValue = "", "-1", DdlSubProyectoDatos.SelectedValue)))
|
||||
If dr IsNot Nothing Then
|
||||
ViewState("SucCalle") = dr("Calle")
|
||||
@@ -16195,7 +16208,7 @@ Partial Class Ventas
|
||||
If CveVenta <= 0 AndAlso DdlTipoComprobante.SelectedValue = "Cot" Then
|
||||
DdlIVA.Visible = True
|
||||
End If
|
||||
If TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 AndAlso (Not CveVenta > 0 Or EsCreaApartirDe Or CveDevolucion > 0) Then RecalculaIVA()
|
||||
If RecalcularIVA AndAlso TmpDT IsNot Nothing AndAlso TmpDT.Rows.Count > 0 AndAlso (Not CveVenta > 0 Or EsCreaApartirDe Or CveDevolucion > 0) Then RecalculaIVA()
|
||||
'ViewState("SubProyectoPorcentajeIVA") = dr("IVA")
|
||||
ViewState("TipoFormato") = dr("TipoFormato")
|
||||
'ViewState("Serie") = dr("Serie")
|
||||
@@ -16547,7 +16560,7 @@ Partial Class Ventas
|
||||
If TipoAplicacion = 2 Then
|
||||
Descuento = 0
|
||||
SeAjustoPU = True
|
||||
PUModificado = PUPromocion
|
||||
PUModificado = Math.Round(PUPromocion / (1 + If(IncluyeImpuestos, PorcentajeIVA, 0)), 6)
|
||||
Else
|
||||
Descuento = Descuento + PU - TotalPromocion
|
||||
End If
|
||||
@@ -17063,11 +17076,17 @@ Partial Class Ventas
|
||||
DrPoliza("CveTipoPS") = DrPSAdicional("CveTipoPS")
|
||||
DrPoliza("CveTipoInvPS") = DrPSAdicional("Inv_CveMetodoInventario")
|
||||
DrPoliza("NoIdentificacion") = DrPSAdicional("Codigo")
|
||||
|
||||
If Modalidad = "U" Then
|
||||
DrPoliza("Consec") = Index
|
||||
Else
|
||||
DrPoliza("Consec") = TmpDT.Rows.Count + 1
|
||||
Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero()
|
||||
If ConsecutivoActual < 0 Then
|
||||
ConsecutivoActual = 0
|
||||
End If
|
||||
DrPoliza("Consec") = ConsecutivoActual + 1
|
||||
End If
|
||||
|
||||
Row("Orden") = TmpDT.Rows.Count + 1
|
||||
DrPoliza("Cantidad") = If(Dr("Cantidad").ToString().ToDecimal > 0, Dr("Cantidad").ToString().ToDecimal, Cantidad)
|
||||
PU = 0
|
||||
@@ -17141,6 +17160,249 @@ Partial Class Ventas
|
||||
Return Retorno
|
||||
End Function
|
||||
|
||||
'Private Function AgregarProductoServicioCotizacion(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, PorcentajeIVA As Decimal, ImporteIVA As Decimal, CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String, Optional Serie As String = "", Optional TiempoEntrega As String = "",
|
||||
' Optional EntregaDirecta As Integer = 0, Optional CveContratoDetalle As Integer = 0, Optional CveVentaDetalle As Integer = 0, Optional CveMovimientoDetallePedido As Integer = 0,
|
||||
' Optional CveOrdenCompraDetalle As Integer = 0, Optional CveVentaDetalleRemision As Integer = 0, Optional CveVentaDetalleCotizacion As Integer = 0, Optional CuentaPredial As String = "",
|
||||
' Optional RegeneraIEPS As Boolean = True, Optional CveVentaDetallePedido2 As Integer = 0, Optional SeActualiza As Boolean = False, Optional CvePromocionDetalle As Integer = -1, Optional EsCargo As Boolean = False,
|
||||
' Optional ImporteProntoPago As Decimal = 0) As Boolean
|
||||
|
||||
' Dim Retorno As Boolean = False
|
||||
' Try
|
||||
' 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.MsgError)
|
||||
' Return False
|
||||
' End If
|
||||
|
||||
' Dim Row As DataRow = Nothing
|
||||
' Dim TotalCalculableImpuestos As Decimal = 0
|
||||
' PU = PU.RoundSQL(6) ' el precio unitario puede llevar hasta 6 decimales permitidos
|
||||
' Descuento = Descuento.RoundSQL(NumeroDecimales)
|
||||
|
||||
' If Not TmpDT.Columns.Contains("RetIVA") Then
|
||||
' TmpDT.Columns.Add("RetIVA", GetType(Decimal))
|
||||
' End If
|
||||
|
||||
' Row = TmpDT.NewRow()
|
||||
' Row("CveProyecto") = CveProyecto
|
||||
' Row("Proyecto") = Proyecto
|
||||
' Row("CveSubProyecto") = CveSubProyecto
|
||||
' Row("SubProyecto") = SubProyecto
|
||||
' Row("Serie") = Serie
|
||||
' Row("TiempoEntrega") = TiempoEntrega
|
||||
' If Modalidad = "U" Then
|
||||
' Row("Orden") = Index
|
||||
' Else
|
||||
' Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero()
|
||||
' If ConsecutivoActual < 0 Then
|
||||
' ConsecutivoActual = 0
|
||||
' End If
|
||||
' Row("Orden") = ConsecutivoActual + 1
|
||||
' End If
|
||||
|
||||
' 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.MsgError)
|
||||
' Return False
|
||||
' End If
|
||||
|
||||
' If (DrPS("SATClaveUnidadMedida").ToString() = "" Or DrPS("SATClavePS").ToString() = "") Then
|
||||
' 'VALIDA CLAVESAT
|
||||
' If Not DdlTipoComprobante.SelectedValue.Contiene("Ped", "PeC") Then 'DOCUMENTOS DONDE NO SE VALIDA
|
||||
' If DrPS("SATClavePS").ToString() = "" Then
|
||||
' MensajeCveSAT.AppendFormat("<b>{0}-{1}</b>: Sin producto SAT<br/>", DrPS("Codigo").ToString(), DrPS("PS").ToString())
|
||||
' Return False
|
||||
' ElseIf DrPS("SATClaveUnidadMedida").ToString() = "" Then
|
||||
' MensajeCveSAT.AppendFormat("<b>{0}-{1}</b>: Sin Unidad Medida SAT<br/>", DrPS("Codigo").ToString(), DrPS("PS").ToString())
|
||||
' Return False
|
||||
' End If
|
||||
|
||||
' 'If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) AndAlso DrPS("SATClavePS").ToString() = "01010101" Then
|
||||
' ' MensajeCveSAT.AppendFormat("<b>{0}-{1}</b>: El producto/servicio no existe en el catálogo del SAT<br/>", DrPS("Codigo").ToString(), DrPS("PS").ToString())
|
||||
' ' Return False
|
||||
' 'End If
|
||||
' End If
|
||||
' Else
|
||||
' If UsuarioActual.CveEmpresa.Contiene(72, 80, 146) AndAlso DrPS("SATClavePS").ToString() = "01010101" Then
|
||||
' MensajeCveSAT.AppendFormat("<b>{0}-{1}</b>: El producto/servicio no existe en el catálogo del SAT<br/>", DrPS("Codigo").ToString(), DrPS("PS").ToString())
|
||||
' Return False
|
||||
' End If
|
||||
' 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
|
||||
|
||||
' 'VERIFICA SI EN LA FACTURA PADRE SE DESGLOSO EL IEPS
|
||||
' Dim FacturaDesglosoIEPS As Boolean = ((CveDevolucion > 0 AndAlso NuevaFactura = 1) AndAlso (Me.ObjFacturaNC IsNot Nothing AndAlso Not Me.ObjFacturaNC.VentaDesglosaIEPS))
|
||||
|
||||
' If Not ClienteDesglosaIEPS Then
|
||||
' If Not RegeneraIEPS AndAlso Not FacturaDesglosoIEPS Then
|
||||
' PU = PU * (1 + DrPS("IEPSPorcentaje").ToString().ToDecimal)
|
||||
' VentaDesglosaIEPS = True
|
||||
' End If
|
||||
' DrPS("IEPSPorcentaje") = 0
|
||||
' End If
|
||||
' 'SI YA SE DESGLOSO EL IEPS SE GUARDA LA BANDERA EN ESTA FACTURA
|
||||
' If FacturaDesglosoIEPS Then
|
||||
' VentaDesglosaIEPS = True
|
||||
' End If
|
||||
|
||||
|
||||
' TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
|
||||
|
||||
' 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")
|
||||
' If Modalidad = "U" Then
|
||||
' Row("Consec") = Index
|
||||
' Else
|
||||
' Dim ConsecutivoActual As Integer = TmpDT.MAX("Consec").ToEntero()
|
||||
' If ConsecutivoActual < 0 Then
|
||||
' ConsecutivoActual = 0
|
||||
' End If
|
||||
' Row("Consec") = ConsecutivoActual + 1
|
||||
' End If
|
||||
|
||||
' 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")
|
||||
|
||||
' Row("PorcentajeIVA") = PorcentajeIVA
|
||||
|
||||
' Dim ClienteRetIVA = Me.ClienteRetIVA
|
||||
|
||||
' If ClienteRetIVA <= 0 Then
|
||||
' If CBool(DrPS("EsOutSourcing").ToString()) Then
|
||||
' ClienteRetIVA = 0.06D
|
||||
' DdlTipoRetencion.SelectedValueExist("4")
|
||||
' ElseIf DdlTipoRetencion.SelectedValue.Contiene("1", "2") Then
|
||||
' ClienteRetIVA = 0.106667D
|
||||
' ElseIf DdlTipoRetencion.SelectedValue.Contiene("3") Then
|
||||
' ClienteRetIVA = 0.04D
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' LblRetIVA.Text = (ClienteRetIVA * 100).FormatoNumero
|
||||
' TrRetIVA.Style.Add("display", "")
|
||||
' DdlTipoRetencion.Visible = True
|
||||
|
||||
|
||||
' Row("IVA") = PorcentajeIVA
|
||||
' Row("ImporteIVA") = (ImporteIVA).RoundSQL(NumeroDecimales)
|
||||
' Row("ImporteRetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
|
||||
|
||||
|
||||
|
||||
' Row("RetIVA") = (ClienteRetIVA * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
|
||||
|
||||
' Row("ImporteRetISR") = (ClienteRetISR * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
|
||||
' Row("PorcentajeRetIVA") = ClienteRetIVA
|
||||
' Row("PorcentajeRetISR") = ClienteRetISR
|
||||
' Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje")
|
||||
' Row("ImporteIEPS") = (DrPS("IEPSPorcentaje").ToString().ToDecimal * TotalCalculableImpuestos).RoundSQL(NumeroDecimales)
|
||||
' Row("IEPS") = Row("ImporteIEPS")
|
||||
' Row("Descuento") = (Descuento).RoundSQL(NumeroDecimales)
|
||||
' Row("TipoDescuento") = HdnTipoDescuento.Value
|
||||
' Row("CvePromocionDetalle") = CvePromocionDetalle
|
||||
' Row("Total") = (Cantidad * PU)
|
||||
' Row("TotalImporte") = (Cantidad * PU).RoundSQL(NumeroDecimales)
|
||||
|
||||
' 'Row("AsientoContableVentas") = DrPS("AsientoContableVentas")
|
||||
' ' Row("IdCtaContVentas") = IdCtaContable
|
||||
' ' Row("AplicaParaConcepto") = AplicaParaConcepto
|
||||
|
||||
' Row("SATClaveProdServ") = DrPS("SATClavePS")
|
||||
' Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
|
||||
|
||||
' If UsuarioActual.Empresa.UsaAC Then
|
||||
' Row("CvePresupuestoIngreso") = Me.DdlFuenteRecaudacion.SelectedValue
|
||||
' End If
|
||||
|
||||
' 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("EsOutSourcing") = DrPS("EsOutSourcing")
|
||||
' Row("EsCargo") = EsCargo
|
||||
|
||||
' If ImporteProntoPago > 0 Then
|
||||
' Row("ImporteProntoPago") = ImporteProntoPago
|
||||
' Row("TieneProntoPago") = "Si"
|
||||
' 'SOLO DEBE MOSTRASE SI EL PAGO ES DE CONTADO
|
||||
' If RBLPago.SelectedValue = "2" Then
|
||||
' GvPS.Columns(22).Visible = True
|
||||
' thProntoPago.Visible = True
|
||||
' thProntoPago2.Visible = True
|
||||
' End If
|
||||
|
||||
' End If
|
||||
|
||||
' If UsuarioActual.CveEmpresa = 119 Then
|
||||
' If Not RemisionesLista.Count > 0 Then 'SI VIENE DE REMISION NO SE CONSIDERA
|
||||
|
||||
' 'MONEDA DIFERENTE DEL PS AL PRIMER PS AGREGADO
|
||||
' If DdlMoneda.Enabled = False And CveVenta < 0 And TmpDT.Rows.Count > 0 Then
|
||||
' If DdlMoneda.SelectedValue <> DrPS("CveMoneda").ToString() Then
|
||||
' Alert($"La moneda base del producto: <b>{DrPS("PSCodigo").ToString()}</b> es diferente a la moneda del documento.", TipoMensaje.MsgAdvertencia)
|
||||
' Return False
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' 'ACTIVA PRODUCTOS DE LA MISMA MONEDA
|
||||
' If TmpDT.Rows.Count = 0 And CveVenta < 0 Then
|
||||
' DdlMoneda.SelectedValueExist(DrPS("CveMoneda").ToString())
|
||||
' CambiaMoneda()
|
||||
' DdlMoneda.Enabled = False
|
||||
' End If
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' 'RECARGAR GV
|
||||
' TmpDT.Rows.Add(Row)
|
||||
|
||||
' Retorno = True
|
||||
' Catch ex As Exception
|
||||
' Retorno = False
|
||||
' OnError("Ocurrió un error al agregar el producto/servicio", ex)
|
||||
' End Try
|
||||
|
||||
|
||||
' Return Retorno
|
||||
'End Function
|
||||
|
||||
#End Region
|
||||
|
||||
#Region "D A T A - T A B L E S"
|
||||
@@ -17731,6 +17993,9 @@ Partial Class Ventas
|
||||
|
||||
If TbDescuentosRNC.Visible AndAlso ListaNCDesc IsNot Nothing Then
|
||||
TotalRemNCAplicado = ListaNCDesc.Sum(Function(RNC) RNC.TotalRemNCAplicado)
|
||||
If ListaNCBonificacion IsNot Nothing AndAlso ListaNCBonificacion.Count > 0 Then
|
||||
TotalRemNCAplicado += ListaNCBonificacion.Sum(Function(RNC) RNC.TotalRemNCAplicado)
|
||||
End If
|
||||
End If
|
||||
|
||||
Total = (TotalSubTotal - TotalDescuentos - TotalAmortizacion + TotalIVA + TotalIEPS - TotalRetIVA - TotalRetISR - TotalImpuestosLocales)
|
||||
@@ -19705,7 +19970,7 @@ Partial Class Ventas
|
||||
For Each Row As DataRow In TmpDT.Rows
|
||||
Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString().ToEntero()
|
||||
If CveVentaDetalle > 0 Then
|
||||
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString().ToEntero(), Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDecimal, Row("PU").ToString().ToDecimal(), Row("ImporteIEPS").ToString().ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("Obs").ToString(), UsuarioActual.CveUsuario) Then
|
||||
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString().ToEntero(), Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDecimal, Row("PU").ToString().ToDecimal(), Row("ImporteIEPS").ToString().ToDecimal(), Row("PorcentajeIEPS").ToString().ToDecimal(), Row("ImporteIVA").ToString().ToDecimal(), Row("PorcentajeIVA").ToString().ToDecimal(), Row("Obs").ToString(), UsuarioActual.CveUsuario) Then
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
@@ -19766,6 +20031,12 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not OcurrioError Then
|
||||
If RegeneracionPolizas(ObjVentas, ObjAC, ObjConta, ObjBancos) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then
|
||||
If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||
If ObjConta.ValorPolizaDescuadre = 2 Then
|
||||
@@ -19775,12 +20046,6 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not OcurrioError Then
|
||||
If RegeneracionPolizas(ObjVentas, ObjAC, ObjConta, ObjBancos) Then
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
|
||||
Catch ex As Exception
|
||||
OcurrioError = True
|
||||
OnError("Ocurrió un error al actualizar la remisión", ex)
|
||||
@@ -25067,6 +25332,23 @@ Partial Class Ventas
|
||||
e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDescNCCargosDetalle_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCCargosDetalle.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
|
||||
If e.Row.DBCampo("CveVentaDetalleRNC").ToEntero() = 0 Then
|
||||
e.Row.CssClass = "Totales"
|
||||
e.Row.FCCheckBox("ChkAplicar").Visible = False
|
||||
e.Row.FCTextBox("TxtCantidadRNC").Visible = False
|
||||
Else
|
||||
e.Row.CssClass = "ImportesRNCDetalle"
|
||||
e.Row.FCCheckBox("ChkAplicar").Attributes.Add("onclick", $"CalculaSaldoRNCChkDetalle({e.Row.FCTextBox("TxtCantidadRNC").ClientID},{e.Row.DBCampo("CantidadPendiente").ToDouble},{e.Row.DBCampo("Total").ToDouble}, this);")
|
||||
'e.Row.FCTextBox("TxtImporte").Attributes.Add("onkeyup", $"LimitaSaldoRNCChk({e.Row.FCTextBox("TxtImporte").ClientID},{e.Row.DBCampo("Saldo").ToDouble});")
|
||||
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvDescNCBonificaciones_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCBonificaciones.RowDataBound
|
||||
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);")
|
||||
@@ -25096,15 +25378,6 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub GvDescNCCargosDetalle_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDescNCCargosDetalle.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
If e.Row.DBCampo("CveVentaDetalleRNC").ToEntero() = 0 Then
|
||||
e.Row.CssClass = "Totales"
|
||||
e.Row.FCCheckBox("ChkAplicar").Visible = False
|
||||
e.Row.FCTextBox("TxtCantidadRNC").Visible = False
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Protected Sub GvRemisionesNCBon_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvRemisionesNCBon.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
@@ -27047,65 +27320,145 @@ Partial Class Ventas
|
||||
Dim OcurrioError = False
|
||||
Dim MensajeError = ""
|
||||
|
||||
Try
|
||||
'CONVERTIR REMISION - TIPO MONEDA -DOLARES A PESOS
|
||||
If DdlMoneda.SelectedValue.ToEntero() <> 2 AndAlso ChkConvertirDolares.Checked Then
|
||||
|
||||
'ACTUALIZA VENTA
|
||||
If Not ObjVentas.UpdateVentas(TxtSubTotal.Text.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), LblDescuentos.Text.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), TxtIVA.Text.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), TxtIEPS.Text.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), TxtTotal.Text.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)),
|
||||
For Each Row As DataRow In TmpDT.Rows
|
||||
Row("PU") = Math.Round(Row("PU").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, 6)
|
||||
Row("Total") = Math.Round(Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal, NumeroDecimales)
|
||||
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal, NumeroDecimales)
|
||||
Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
|
||||
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
|
||||
Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
|
||||
Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
|
||||
Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString().ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
|
||||
Next
|
||||
|
||||
Dim ImpuestosLocales As Double = 0
|
||||
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
|
||||
If gvr.RowType = DataControlRowType.DataRow Then
|
||||
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TxtTipoCambioDlls.Text.Trim.ToDecimal).FormatoNumero
|
||||
ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
|
||||
End If
|
||||
Next
|
||||
|
||||
TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero
|
||||
LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero
|
||||
LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero
|
||||
TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero
|
||||
TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero
|
||||
TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero
|
||||
TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero
|
||||
TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero
|
||||
|
||||
TipoCambio = TxtTipoCambioDlls.Text.Trim.ToDecimal
|
||||
Moneda = 2
|
||||
End If
|
||||
|
||||
|
||||
'CONVERTIR REMISION - TIPO MONEDA -PESO A DOLARES
|
||||
If DdlMoneda.SelectedValue.ToEntero() <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then
|
||||
Dim Importe As Decimal
|
||||
Dim TCC As Decimal = TxtTipoCambio.Text.Trim.ToDecimal
|
||||
For Each Row As DataRow In TmpDT.Rows
|
||||
Row("PU") = Math.Round(Row("PU").ToString().ToDecimal * TCC, 6)
|
||||
Row("Total") = Math.Round(Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal, NumeroDecimales)
|
||||
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString().ToDecimal * Row("PU").ToString().ToDecimal, NumeroDecimales)
|
||||
Row("Descuento") = Math.Round(Row("Descuento").ToString().ToDecimal * TCC, NumeroDecimales)
|
||||
Importe = Row("Total").ToString().ToDecimal - Row("Descuento").ToString().ToDecimal
|
||||
Row("ImporteIEPS") = Math.Round(Importe * Row("PorcentajeIEPS").ToString().ToDecimal, NumeroDecimales)
|
||||
Row("ImporteIVA") = Math.Round(Importe * Row("PorcentajeIVA").ToString().ToDecimal, NumeroDecimales)
|
||||
Row("ImporteRetIVA") = Math.Round(Importe * Row("PorcentajeRetIVA").ToString().ToDecimal, NumeroDecimales)
|
||||
Row("ImporteRetISR") = Math.Round(Importe * Row("PorcentajeRetISR").ToString().ToDecimal, NumeroDecimales)
|
||||
Next
|
||||
|
||||
Dim ImpuestosLocales As Double = 0
|
||||
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
|
||||
If gvr.RowType = DataControlRowType.DataRow Then
|
||||
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TxtTipoCambio.Text.Trim.ToDecimal).FormatoNumero
|
||||
ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales)
|
||||
End If
|
||||
Next
|
||||
|
||||
TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero
|
||||
LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero
|
||||
LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero
|
||||
TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero
|
||||
TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero
|
||||
TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero
|
||||
TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero
|
||||
TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero
|
||||
|
||||
|
||||
TipoCambio = 1
|
||||
Moneda = 1
|
||||
End If
|
||||
|
||||
|
||||
'ACTUALIZA VENTA
|
||||
If Not ObjVentas.UpdateVentas(TxtSubTotal.Text.ToDouble(), LblDescuentos.Text.ToDouble(), TxtIVA.Text.ToDouble(), TxtIEPS.Text.ToDouble(), TxtTotal.Text.ToDouble(),
|
||||
Moneda, TipoCambio, TxtFecha.Text.Trim.ToDate, TxtObsFact.Text.Trim,
|
||||
UsuarioActual.CveEmpresa, CveVenta, 0, 0,
|
||||
Vigencia:=TxtFechaVencimientoCotizacion.Text.Trim.ToDate, CondicionesPago:=If(RBLPago.SelectedValue = "2", 0, 1),
|
||||
PedidoContrato:=TxtPedidoContrato.Text, AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero(), CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero(),
|
||||
CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, OrdenCompra:=TxtOrdenCompra.Text, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal,
|
||||
TipoDocto:=DdlTipoComprobante.SelectedValue, Kilometraje:=TxtKilometraje.Text.ToDouble, CveUsoCFDi:=DdlUsoCFDI.SelectedValue.ToEntero()) Then
|
||||
MensajeError = "Ocurrió un error al actualizar la información de la cotización"
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
'ELIMINA DETALLES
|
||||
If Not ObjVentas.RemoveVentasDetalle(CveVenta) Then
|
||||
MensajeError = "Ocurrió un error al actualizar las partidas de la cotización"
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
'RE-INSERTA DETALLES
|
||||
For Each Row As DataRow In TmpDT.Rows
|
||||
If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDouble, Row("CveUM").ToString().ToEntero(),
|
||||
Row("PU").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("ImporteIVA").ToString().ToDouble, Math.Round((Row("Total").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)) * (1 + Row("PorcentajeIVA").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)))), 6),
|
||||
Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(),
|
||||
PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, IEPS:=Row("ImporteIEPS").ToString().ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, TiempoEntrega:=Row("TiempoEntrega").ToString(),
|
||||
PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDecimal) Then
|
||||
MensajeError = "Ocurrió un error al guardar las partidas de la cotización"
|
||||
MensajeError = "Ocurrió un error al actualizar la información de la cotización"
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
|
||||
If gvr.RowType = DataControlRowType.DataRow Then
|
||||
If Not ObjVentas.UpdateVentaImpuestoLocales(CveVenta, gvr.DataKey("CveImpuestoLocal").ToString().ToEntero(), gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble) Then
|
||||
MensajeError = "Ocurrió un error al actualizar los impuestos locales"
|
||||
'ELIMINA DETALLES
|
||||
If Not ObjVentas.RemoveVentasDetalle(CveVenta) Then
|
||||
MensajeError = "Ocurrió un error al actualizar las partidas de la cotización"
|
||||
OcurrioError = True
|
||||
End If
|
||||
|
||||
'RE-INSERTA DETALLES
|
||||
For Each Row As DataRow In TmpDT.Rows
|
||||
If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString().ToEntero(), Row("Cantidad").ToString().ToDouble, Row("CveUM").ToString().ToEntero(),
|
||||
Row("PU").ToString().ToDouble(), Row("ImporteIVA").ToString().ToDouble, Math.Round((Row("Total").ToString().ToDouble() * (1 + Row("PorcentajeIVA").ToString().ToDouble())), 6),
|
||||
Row("Obs").ToString(), Row("Descuento").ToString().ToDouble(), Row("TipoDescuento").ToString().ToEntero(), Row("CveSubProyecto").ToString().ToEntero(), Row("CvePresupuestoIngreso").ToString().ToEntero(),
|
||||
PorcentajeIVA:=Row("PorcentajeIVA").ToString().ToDecimal, IEPS:=Row("ImporteIEPS").ToString().ToDouble(), PorcentajeIEPS:=Row("PorcentajeIEPS").ToString().ToDouble, TiempoEntrega:=Row("TiempoEntrega").ToString(),
|
||||
PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA:=Row("ImporteRetIVA").ToString().ToDecimal) Then
|
||||
MensajeError = "Ocurrió un error al guardar las partidas de la cotización"
|
||||
OcurrioError = True
|
||||
Exit For
|
||||
End If
|
||||
Next
|
||||
|
||||
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
|
||||
If gvr.RowType = DataControlRowType.DataRow Then
|
||||
If Not ObjVentas.UpdateVentaImpuestoLocales(CveVenta, gvr.DataKey("CveImpuestoLocal").ToString().ToEntero(), gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble) Then
|
||||
MensajeError = "Ocurrió un error al actualizar los impuestos locales"
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
'ORDEN PRODUCCION
|
||||
If UsuarioActual.CveEmpresa.Contiene(126) Then
|
||||
If CveVenta > 0 And DdlOrdenProduccion.SelectedValue.ToEntero() > 0 Then
|
||||
If Not ObjCGame.UpdateOrdenProduccionVenta(DdlOrdenProduccion.SelectedValue.ToEntero(), CveVenta) Then
|
||||
MensajeError = "Ocurrió un error al actualizar la orden de producción"
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
|
||||
'ORDEN PRODUCCION
|
||||
If UsuarioActual.CveEmpresa.Contiene(126) Then
|
||||
If CveVenta > 0 And DdlOrdenProduccion.SelectedValue.ToEntero() > 0 Then
|
||||
If Not ObjCGame.UpdateOrdenProduccionVenta(DdlOrdenProduccion.SelectedValue.ToEntero(), CveVenta) Then
|
||||
MensajeError = "Ocurrió un error al actualizar la orden de producción"
|
||||
OcurrioError = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
'If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then
|
||||
' If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||
' If ObjConta.ValorPolizaDescuadre = 2 Then
|
||||
' OcurrioError = True
|
||||
' MensajeError = ObjConta.MensajePolizaDescuadre
|
||||
' End If
|
||||
' End If
|
||||
'End If
|
||||
Catch ex As Exception
|
||||
OcurrioError = True
|
||||
OnError("Ocurrió un error al guardar la cotización", ex)
|
||||
End Try
|
||||
|
||||
'If ObjConta.ValidacionPrePolizaCuadre(-1, 2, CveVenta) Then
|
||||
' If ObjConta.ValorPolizaDescuadre > 0 Then
|
||||
' If ObjConta.ValorPolizaDescuadre = 2 Then
|
||||
' OcurrioError = True
|
||||
' MensajeError = ObjConta.MensajePolizaDescuadre
|
||||
' End If
|
||||
' End If
|
||||
'End If
|
||||
|
||||
If OcurrioError Then
|
||||
ObjVentas.RollBack()
|
||||
@@ -27335,6 +27688,61 @@ Partial Class Ventas
|
||||
UpPS.Update()
|
||||
UpParametros.Update()
|
||||
End Sub
|
||||
|
||||
Private Function AjustarTotalCotizacionFacturada(CveCotizacion As Integer, TotalAjustar As Decimal) As Boolean
|
||||
Dim ErrorAjuste As Boolean = False
|
||||
|
||||
Dim ObjCotizacion As New Modelos.Factura(UsuarioActual, CveCotizacion, UsuarioActual.CveEmpresa)
|
||||
|
||||
If ObjCotizacion.CveMoneda = 1 Then
|
||||
Dim TotalNuevoDocumento As Decimal = TotalAjustar
|
||||
|
||||
Dim Diferencia As Decimal = (ObjCotizacion.Total - TotalNuevoDocumento)
|
||||
|
||||
If Diferencia <> 0 Then
|
||||
'AJUSTAR EN EL IVA
|
||||
For Each RowNuevoDocumento As DataRow In TmpDT.Rows
|
||||
Dim CveVentaDetalleCotizacion As Integer = RowNuevoDocumento("CveVentaDetalleCotizacion").ToString().ToEntero()
|
||||
|
||||
Dim ImporteIVANuevoDocumento As Decimal = RowNuevoDocumento("ImporteIVA").ToString().ToDecimal()
|
||||
Dim ImporteIEPSNuevoDocumento As Decimal = RowNuevoDocumento("ImporteIEPS").ToString().ToDecimal()
|
||||
|
||||
If CveVentaDetalleCotizacion > 0 Then
|
||||
'AJUSTAR IVA
|
||||
If ImporteIVANuevoDocumento > 0 Then
|
||||
Dim ImporteIVACotizacion As Decimal = ObjCotizacion.DtDetalle.FiltroPrimeroValor("ImporteIVA", $"CveVentaDetalle={CveVentaDetalleCotizacion}").ToDecimal
|
||||
|
||||
If ImporteIVANuevoDocumento <> ImporteIVACotizacion Then
|
||||
RowNuevoDocumento("ImporteIVA") = ImporteIVACotizacion
|
||||
End If
|
||||
End If
|
||||
|
||||
'AJUSTAR IEPS
|
||||
If ImporteIEPSNuevoDocumento > 0 Then
|
||||
Dim ImporteIEPSCotizacion As Decimal = ObjCotizacion.DtDetalle.FiltroPrimeroValor("ImporteIEPS", $"CveVentaDetalle={CveVentaDetalleCotizacion}").ToDecimal
|
||||
|
||||
If ImporteIEPSNuevoDocumento <> ImporteIEPSCotizacion Then
|
||||
RowNuevoDocumento("ImporteIEPS") = ImporteIEPSCotizacion
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
Next
|
||||
End If
|
||||
|
||||
CalculaTotalesVenta(RecalculaImpuestosLocales:=False)
|
||||
|
||||
If Math.Abs(ObjCotizacion.Total - TotalAjustar) > 0 OrElse Math.Abs(TxtTotal.Text.ToDecimal - TotalAjustar) > 0 Then
|
||||
ErrorAjuste = True
|
||||
End If
|
||||
|
||||
End If
|
||||
ObjCotizacion.Dispose()
|
||||
|
||||
Return Not ErrorAjuste
|
||||
End Function
|
||||
|
||||
Private Class MVentaDetalleCotizacion
|
||||
Public Property CveVentaDetalle As Integer
|
||||
Public Property Cantidad As Decimal
|
||||
@@ -27468,6 +27876,11 @@ Partial Class Ventas
|
||||
tCantidad = If(ChkCotProductos.Checked, GvCotPS.Rows(IndiceGVCotDataKey(GvCotPS, Dr("CveVentaDetalle").ToString())).FCTextBox("TxtCantidadCot").Text.ToDecimal, Dr("Cantidad")).ToString().ToDecimal
|
||||
End If
|
||||
|
||||
'AgregarProductoServicioCotizacion(tCantidad, Dr("CveUM").ToString().ToEntero(), Dr("UM").ToString(), Dr("CveClasificacion").ToString().ToEntero(), Dr("Clasificacion").ToString(),
|
||||
' Dr("CvePS").ToString().ToEntero(), Dr("PS").ToString(), Dr("Obs").ToString(), Dr("PU").ToString().ToDecimal, Dr("Descuento").ToString().ToDecimal,
|
||||
' Dr("PorcentajeIVA").ToString().ToDecimal, Dr("IVA").ToString().ToDecimal,
|
||||
' Dr("CveProyecto").ToString().ToEntero(), Dr("Proyecto").ToString(), Dr("CveSubProyecto").ToString().ToEntero(), Dr("SubProyecto").ToString(),
|
||||
' CveContratoDetalle:=Dr("CveContratoDetalle").ToString().ToEntero(), CveVentaDetalleCotizacion:=Dr("CveVentaDetalle").ToString().ToEntero(), SeActualiza:=True)
|
||||
AgregarProductoServicio(tCantidad, Dr("CveUM").ToString().ToEntero(), Dr("UM").ToString(), Dr("CveClasificacion").ToString().ToEntero(), Dr("Clasificacion").ToString(),
|
||||
Dr("CvePS").ToString().ToEntero(), Dr("PS").ToString(), Dr("Obs").ToString(), Dr("PU").ToString().ToDecimal, Dr("Descuento").ToString().ToDecimal,
|
||||
Dr("CveProyecto").ToString().ToEntero(), Dr("Proyecto").ToString(), Dr("CveSubProyecto").ToString().ToEntero(), Dr("SubProyecto").ToString(),
|
||||
@@ -28735,6 +29148,11 @@ Partial Class Ventas
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
'If Not AjustarTotalCotizacionFacturada(Me.CveVenta) Then
|
||||
' Alert("Ocurrió un error al ajustar el importe", TipoMensaje.MsgError)
|
||||
' Exit Sub
|
||||
'End If
|
||||
|
||||
End If
|
||||
|
||||
'CARGA LO PENDIENTE POR FACTURAR DE REMISION
|
||||
|
||||
Reference in New Issue
Block a user