BDH. Calculo de importes desde codigo, separacion de conceptos de acreditamiento por cargo y bonificacion
This commit is contained in:
@@ -4702,6 +4702,15 @@ Partial Class Ventas
|
||||
If AplicaCancelarRemision AndAlso CveEstatus.Contiene(2, 3) AndAlso DdlTipoComprobante.SelectedValue = "Ing" Then DivCanRem.Visible = True
|
||||
VentaSaldoAlmacen = DbRowVenta("SaldoAlmacen").ToString().ToDecimal
|
||||
|
||||
If DbRowVenta("TipoDocto").ToString().Contiene("Rem", "Dev") AndAlso VentaSaldoAlmacen <> 0 Then
|
||||
ChkDevAlm.Checked = True
|
||||
LiDevolucionAlmacen.Visible = True
|
||||
If DbRowVenta("TipoDocto").ToString() = "Dev" Then
|
||||
LblDevAlm.Text = "Salida de almacen"
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If CveEstatus = 5 Then LbCancelarDocumento.Enabled = False
|
||||
'If CveEstatus = 20 Then
|
||||
' LbCancelarDocumentoManual.Visible = True
|
||||
@@ -9471,6 +9480,7 @@ Partial Class Ventas
|
||||
Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL())
|
||||
Dim ObjDocCliente As New ClsEdocumentacion(ObjVentas.IniciaTransacSQL())
|
||||
Dim ObjGeneral As New ClsGenerales(ObjVentas.IniciaTransacSQL())
|
||||
Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL())
|
||||
|
||||
Dim ObjContPaq As ClsContPAQi = Nothing
|
||||
'Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL())
|
||||
@@ -9541,7 +9551,7 @@ Partial Class Ventas
|
||||
|
||||
Dim CveTimbreCartaPorte As Integer = -1
|
||||
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS,
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS,
|
||||
ObjEventos, ObjCGame, ObjClientes, EsNCAmortizacion:=EsNCAmortizacion, CveAnticipoPadre:=CveAnticipoPadre)
|
||||
|
||||
If ErrorList.Count = 0 AndAlso ChkEmitirCartaPorte.Checked AndAlso ObjFactura.TipoDocto = "Ing" Then
|
||||
@@ -9668,7 +9678,7 @@ Partial Class Ventas
|
||||
|
||||
If (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse (ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0) Then
|
||||
CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento)
|
||||
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing,
|
||||
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing,
|
||||
Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDesc, IndexNC:=(If(DtVentasNC IsNot Nothing, DtVentasNC.Rows.Count - 1, 0))) Then
|
||||
ListaNotasCreditoGeneradas.Add(ObjFacturaDevolucion)
|
||||
End If
|
||||
@@ -9681,7 +9691,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
CreaObjetosVentaBonificacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento)
|
||||
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaBonificacion, ObjBancos, Nothing,
|
||||
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, ObjContPaq, ObjFacturaBonificacion, ObjBancos, Nothing,
|
||||
Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCBonificacion, IndexNC:=(DtVentasNC.Rows.Count - 1)) Then
|
||||
ListaNotasCreditoGeneradas.Add(ObjFacturaBonificacion)
|
||||
End If
|
||||
@@ -9839,12 +9849,6 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or ObjFactura.TipoDocto.Contiene("Ped", "Cot", "DPe", "PeC", "PA", "Pd2")) Then
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
ObjVentas.Commit()
|
||||
|
||||
'ENVIAR POLIZA VIRTUAL
|
||||
@@ -9854,7 +9858,6 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
'ContPAQ El movimiento 1 es el de Venta
|
||||
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
|
||||
|
||||
@@ -9891,7 +9894,6 @@ Partial Class Ventas
|
||||
OnError("Ocurrió un error al contabilizar la factura", ex)
|
||||
End Try
|
||||
|
||||
|
||||
Try
|
||||
'RMF, cuando es pedido, se manda autorización.
|
||||
If ObjFactura.TipoDocto.Contiene("PA") Then
|
||||
@@ -10133,12 +10135,8 @@ Partial Class Ventas
|
||||
|
||||
If ArchivoCotRdlc.Exists Or ArchivoCotMrt.Exists Then
|
||||
MensajeAlert.AppendFormat("<ul><li><a class=""Texto"" href=""/Compras/PopUpVerFactura.aspx?P={0}"">Descargar PDF</a></li></ul><br/>", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))
|
||||
|
||||
|
||||
If ChkEnviarFacturaCRM.Checked AndAlso CorreoContactoCRM.Trim.Length > 0 Then
|
||||
|
||||
Try
|
||||
|
||||
Dim pdfCRM As Byte() = Nothing
|
||||
'If CveVenta > 0 Then
|
||||
' ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False)
|
||||
@@ -10151,16 +10149,10 @@ Partial Class Ventas
|
||||
GeneraPDFCotizacion(True, CorreoContactoCRM:=CorreoContactoCRM, pdfCRM:=pdfCRM, SerieFolioCRM:=SerieFolioCRM, TipoDoctoCRM:=TipoDoctoCRM)
|
||||
End If
|
||||
|
||||
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al enviar el PDF", ex)
|
||||
End Try
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
Else
|
||||
MensajeAlert.Append("Ocurrió un error al generar el PDF. Por favor vuelva a entrar a la factura para imprimir el PDF. ")
|
||||
End If
|
||||
@@ -10178,9 +10170,6 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
'ERROR DE NO TIMBRADO
|
||||
If Not SeTimbro And (DdlTipoComprobante.SelectedValue = "Ing" Or DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") Or DdlTipoComprobante.SelectedValue = "Ant") Then
|
||||
MensajeAlert.AppendFormat("La factura no se pudo timbrar.</b> Por favor intentelo de nuevo a traves del boton Emitir.")
|
||||
@@ -10202,12 +10191,10 @@ Partial Class Ventas
|
||||
End Select
|
||||
|
||||
|
||||
|
||||
If DdlTipoComprobante.SelectedValue.Contiene("Cot") AndAlso CveEmpresaCRM > 0 AndAlso CveAcercamientoCRM > 0 Then
|
||||
RegistraScript($"window.location.href = '/Compras/PopUpVerFactura.aspx?P={Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1", CveVenta))}'", "Imprimir")
|
||||
End If
|
||||
|
||||
|
||||
'DESCARGAR PDF DE CICOVISA
|
||||
'If UsuarioActual.CveEmpresa = 72 And CveCliente = 70381 Then
|
||||
' If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem") Then
|
||||
@@ -10235,8 +10222,6 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
GeneraPDFCotizacion(ChkEnviarFactura.Checked) ' MANDA CORREO
|
||||
Else
|
||||
'Enviar pore correo cot CRM
|
||||
End If
|
||||
ElseIf DdlTipoComprobante.SelectedValue = "Rem" Then
|
||||
If UsuarioActual.CveEmpresa.Contiene(81, 109) Then
|
||||
@@ -10311,7 +10296,6 @@ Partial Class Ventas
|
||||
Alert(MensajeAlert.ToString(), TipoMensaje.MsgDosBotones, Liga, TextoConfirmacion:="Seguir Registrando", TextoSegundoBoton:="Ir al Cliente", JSBtn2:=Liga2, ShowCloseButton:=False)
|
||||
End If
|
||||
|
||||
|
||||
MensajeAlert.Clear()
|
||||
|
||||
Try
|
||||
@@ -10324,7 +10308,6 @@ Partial Class Ventas
|
||||
OnError("Ocurrió un error al limpiar los datos", ex)
|
||||
End Try
|
||||
|
||||
|
||||
Else
|
||||
ObjVentas.RollBack()
|
||||
If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
|
||||
@@ -10343,6 +10326,7 @@ Partial Class Ventas
|
||||
ObjCGame.Dispose()
|
||||
ObjContr.Dispose()
|
||||
ObjDocCliente.Dispose()
|
||||
ObjAcum.Dispose()
|
||||
'ObjFolios.Dispose()
|
||||
ErrorList.Clear()
|
||||
ErrorList = Nothing
|
||||
@@ -10986,24 +10970,27 @@ Partial Class Ventas
|
||||
End Sub
|
||||
|
||||
|
||||
Private Function RegistrarNCAmortizacion(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi,
|
||||
Private Function RegistrarNCAmortizacion(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjAcum As ClsAcumuladores, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi,
|
||||
ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos, Optional NCDescuento As Boolean = False,
|
||||
Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional IndexNC As Integer = 0) As Boolean
|
||||
Dim ProcesoCorrecto As Boolean = True
|
||||
|
||||
'GENERAMOS EL NUEVO FOLIO
|
||||
Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL())
|
||||
'Dim ObjFolios As New ClsGralFolios(ObjVentas.IniciaTransacSQL())
|
||||
|
||||
If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then
|
||||
Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue.ToEntero()))
|
||||
If DT.Rows.Count > 0 Then
|
||||
factura.Serie = DT.Rows(0)("Serie").ToString()
|
||||
factura.Folio = DT.Rows(0)("FActual").ToString().ToEntero()
|
||||
Else
|
||||
ProcesoCorrecto = False
|
||||
End If
|
||||
DT.Dispose()
|
||||
End If
|
||||
'If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then
|
||||
' Dim DT As DataTable = ObjFolios.DtResultados.FiltraParametros(String.Format(" CveSubProyecto = {0} And Estado = 'Activo'", DdlSubProyectoDatos.SelectedValue.ToEntero()))
|
||||
' If DT.Rows.Count > 0 Then
|
||||
' factura.Serie = DT.Rows(0)("Serie").ToString()
|
||||
' factura.Folio = DT.Rows(0)("FActual").ToString().ToEntero()
|
||||
' Else
|
||||
' ProcesoCorrecto = False
|
||||
' End If
|
||||
' DT.Dispose()
|
||||
'End If
|
||||
|
||||
factura.Serie = "-1"
|
||||
factura.Folio = -1
|
||||
|
||||
If NCDescuento Then
|
||||
|
||||
@@ -11019,7 +11006,7 @@ Partial Class Ventas
|
||||
|
||||
factura.CveVentaPadre = Me.CveVenta
|
||||
'Registramos la venta
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=False, NCDescuento:=True, ListaNCDescuento:=ListaNCDescuento)
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=False, NCDescuento:=True, ListaNCDescuento:=ListaNCDescuento)
|
||||
|
||||
Else
|
||||
'GENERO LOS DATOS DE LA NC
|
||||
@@ -11158,7 +11145,7 @@ Partial Class Ventas
|
||||
ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
|
||||
|
||||
'Registramos la venta
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True)
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True)
|
||||
|
||||
Else
|
||||
ErrorList.Add("No se encontró un producto para generar la nota de crédito")
|
||||
@@ -12916,7 +12903,7 @@ Partial Class Ventas
|
||||
|
||||
|
||||
#Region " GUARDAR - VENTA, PREPOLIZAS, INV, ESTIMACIONES, AC, NOTA DE CRÉDITO "
|
||||
Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, ByRef TmpDTDetalle As DataTable, CveNCaVincular As Integer,
|
||||
Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjAcum As ClsAcumuladores, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, ByRef TmpDTDetalle As DataTable, CveNCaVincular As Integer,
|
||||
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, Optional ByRef ObjOS As ClsOS = Nothing, ByRef Optional ObjEventos As ClsOIEventos = Nothing, ByRef Optional ObjCGame As ClsCGame = Nothing,
|
||||
ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional CveAnticipoPadre As Integer = -1)
|
||||
|
||||
@@ -13128,11 +13115,11 @@ Partial Class Ventas
|
||||
'SI ES REFACTURACION, NO DEBE AFECTAR LOS USADOS
|
||||
If Not NuevaFactura.Contiene(1) Then
|
||||
If ObjFactura.TipoDocto = "Ing" Then
|
||||
If Not GuardarUsados(2, ObjVentas.IniciaTransacSQL, factura) Then
|
||||
If Not GuardarUsados(2, ObjVentas.IniciaTransacSQL, factura, ObjAcum) Then
|
||||
ErrorList.Add("Error al guardar usados")
|
||||
End If
|
||||
ElseIf ObjFactura.TipoDocto = "Dev" Then
|
||||
If Not GuardarUsados(1, ObjVentas.IniciaTransacSQL, factura) Then
|
||||
If Not GuardarUsados(1, ObjVentas.IniciaTransacSQL, factura, ObjAcum) Then
|
||||
ErrorList.Add("Error al guardar usados")
|
||||
End If
|
||||
End If
|
||||
@@ -13238,7 +13225,6 @@ Partial Class Ventas
|
||||
Dim ListaRNC As List(Of Modelos.Factura) = Nothing
|
||||
|
||||
If NCDescuento Then
|
||||
EsCargo = (Not ListaNCDescuento.Any(Function(RNC) RNC.Num2 = 1))
|
||||
ListaRNC = ListaNCDescuento
|
||||
Else
|
||||
EsCargo = RblRNCTipo.SelectedValue = "1"
|
||||
@@ -13246,26 +13232,93 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
'SI SE FACTURAN RNC DE CARGO, SE AGREGA EL CONCEPTO DE ACREDITAMIENTO
|
||||
If ListaRNC IsNot Nothing AndAlso ClienteEsDistribuidor AndAlso EsCargo AndAlso Not factura.EsGarantia Then
|
||||
Dim ObjAcum As New ClsAcumuladores(ObjVentas.IniciaTransacSQL())
|
||||
|
||||
If ListaRNC IsNot Nothing AndAlso ClienteEsDistribuidor AndAlso Not factura.EsGarantia Then
|
||||
Dim CvePSCargo As Integer = -1
|
||||
For Each RNC In ListaRNC
|
||||
CvePSCargo = RNC.DtDetalle.FiltroPrimeroValor("CvePS", $"CveVentaDetalle={Row("CveVentaDetalleRNC").ToString()}").ToEntero()
|
||||
If CvePSCargo > 0 Then
|
||||
Exit For
|
||||
Dim CveVentaRNC As Integer = -1
|
||||
|
||||
For Each RNC As Modelos.Factura In ListaRNC
|
||||
|
||||
If NCDescuento Then
|
||||
EsCargo = (Not RNC.Num1 = 2)
|
||||
End If
|
||||
|
||||
CvePSCargo = RNC.DtDetalle.FiltroPrimeroValor("CvePS", $"CveVentaDetalle={Row("CveVentaDetalleRNC").ToString()}").ToEntero()
|
||||
CveVentaRNC = RNC.DtDetalle.FiltroPrimeroValor("CveVenta", $"CveVentaDetalle={Row("CveVentaDetalleRNC").ToString()}").ToEntero()
|
||||
|
||||
If EsCargo Then
|
||||
If Not ObjAcum.DistribuidorMovtosGet(Me.CveCliente, UsuarioActual.CveEmpresa, CveVentaRNCCargo:=CveVentaRNC) AndAlso ObjAcum.DtResultados.Rows.Count > 0 Then
|
||||
ErrorList.Add("Ocurrió un error al obtener los movimientos del distribuidor.")
|
||||
Exit For
|
||||
End If
|
||||
|
||||
Dim RowMovto As DataRow = ObjAcum.DtResultados.FiltroPrimero($"CvePSCargo={CvePSCargo}")
|
||||
|
||||
If RowMovto IsNot Nothing Then
|
||||
'OBTIENE LOS IMPORTES ORIGINALES EN BASE A LO QUE HABIA EN EL MOVIMIENTO
|
||||
Dim ImporteCargoOriginal = (RowMovto("ImporteCargo").ToString().ToDecimal() / RowMovto("Cantidad").ToString().ToDecimal()).RoundSQL(2)
|
||||
'Dim ImporteBonificacionOriginal = (RowMovto("ImporteBonificacion").ToString().ToDecimal() / RowMovto("Cantidad").ToString().ToDecimal()).RoundSQL(2)
|
||||
Dim PuntosOriginales = (RowMovto("Puntos").ToString().ToDecimal() / RowMovto("Cantidad").ToString().ToDecimal()).RoundSQL(2)
|
||||
|
||||
Dim CveTamanio As Integer = RowMovto("CveTamaño").ToString().ToEntero()
|
||||
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
|
||||
|
||||
Dim Puntos As Decimal = Cantidad * PuntosOriginales
|
||||
Dim Cargo As Decimal = Cantidad * ImporteCargoOriginal
|
||||
Dim Bonificacion As Decimal = 0
|
||||
|
||||
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, CveTamanio, Puntos, Cargo, Bonificacion, 6, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", Now) Then
|
||||
ErrorList.Add("Ocurrió un error al agregar el movimiento de distribuidor.")
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
|
||||
Else
|
||||
|
||||
Dim DrTamanio As DataRow = GlobalDTAcumTamaños().FiltroPrimero($"CvePSCargo={CvePSCargo}")
|
||||
|
||||
If DrTamanio IsNot Nothing Then
|
||||
'OBTIENE LOS IMPORTES ORIGINALES EN BASE A LO QUE HABIA EN EL MOVIMIENTO
|
||||
Dim ImporteBonificacion = Row("Total").ToString().ToDecimal().RoundSQL(2)
|
||||
Dim CveTamanio As Integer = DrTamanio("CveTamaño").ToString().ToEntero()
|
||||
Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
|
||||
|
||||
Dim Puntos As Decimal = 0
|
||||
Dim Cargo As Decimal = 0
|
||||
|
||||
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, CveTamanio, Puntos, Cargo, ImporteBonificacion, 6, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", Now) Then
|
||||
ErrorList.Add("Ocurrió un error al agregar el movimiento de distribuidor.")
|
||||
Exit For
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
Next
|
||||
|
||||
Dim CveTamanio As Integer = GlobalDTAcumTamaños().FiltroPrimeroValor("CveTamaño", $"CvePSCargo={CvePSCargo}").ToEntero()
|
||||
'Dim RowTamanio As DataRow = GlobalDTAcumTamaños().FiltroPrimero($"CvePSCargo={CvePSCargo}")
|
||||
|
||||
If CveTamanio > 0 Then
|
||||
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Row("Cantidad").ToString().ToDecimal(), CveTamanio, 6, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", Now) Then
|
||||
ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.")
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
'If RowTamanio IsNot Nothing Then
|
||||
' Dim CveTamanio As Integer = RowTamanio("CveTamaño").ToString().ToEntero()
|
||||
' Dim Cantidad As Decimal = Row("Cantidad").ToString().ToDecimal()
|
||||
' Dim Puntos As Decimal = Cantidad * RowTamanio("Puntos").ToString().ToDecimal()
|
||||
' Dim Cargo As Decimal = Cantidad * RowTamanio("Cargo").ToString().ToDecimal()
|
||||
' Dim Bonificacion As Decimal = Cantidad * RowTamanio("Bonificacion").ToString().ToDecimal()
|
||||
|
||||
' If EsCargo Then
|
||||
' Bonificacion = 0
|
||||
' Else
|
||||
' Puntos = 0
|
||||
' Cargo = 0
|
||||
' End If
|
||||
|
||||
' If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, Cantidad, CveTamanio, Puntos, Cargo, Bonificacion, 6, factura.CveVenta, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, 0D, "", Now) Then
|
||||
' ErrorList.Add("Ocurrió un error al agregar la venta detalle devolución.")
|
||||
' Exit For
|
||||
' End If
|
||||
'End If
|
||||
End If
|
||||
|
||||
End If
|
||||
@@ -24786,9 +24839,9 @@ Partial Class Ventas
|
||||
|
||||
ObjFacturaCancelacion.CveAlmacenDevolucion = CveAlmacenDevolucion
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ObjFacturaCancelacion.TipoDocto = "Rem" Then
|
||||
ChkDevAlm.Checked = True
|
||||
End If
|
||||
'If UsuarioActual.Empresa.Funcionalidad(531) = "1" AndAlso ObjFacturaCancelacion.TipoDocto.Contiene("Rem", "Dev") Then
|
||||
' ChkDevAlm.Checked = True
|
||||
'End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso ObjFacturaCancelacion.TipoDocto = "Rem" Then
|
||||
ChkDevAlm.Checked = True
|
||||
@@ -29314,13 +29367,15 @@ Partial Class Ventas
|
||||
End If
|
||||
UltimoRenglonRNC += 1
|
||||
|
||||
Dim CveVentaDetalleRNC As Integer = RNCBonificacion.DtDetalle.FiltroPrimeroValor("CveVentaDetalle").ToEntero()
|
||||
|
||||
'SOLO AGREGA SI LA CANTIDAD ES MAYOR CERO
|
||||
If Cantidad.RoundSQL(6) > 0D AndAlso ImportePU.RoundSQL(6) > 0 Then
|
||||
AgregaTempDT(TmpDTDescNCBonificacion, DrPS("CvePS").ToString().ToEntero(), DrPS("PS").ToString(), DrPS("Codigo").ToString(), DrPS("PSCodigo").ToString(), DrPS("CveTipoPS").ToString().ToEntero(), DrPS("Inv_CveMetodoInventario").ToString().ToEntero(),
|
||||
DrPS("CveUM").ToString().ToEntero(), DrPS("UnidadMedida").ToString(), DrPS("CveClasificacion").ToString().ToEntero(), DrPS("Clasificacion").ToString(), CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
|
||||
Obs, Cantidad, ImportePU, RowCargo("PorcentajeIVA").ToString().ToDecimal, ImporteIVA, RowCargo("PorcentajeRetIVA").ToString().ToDecimal, ImporteRetIVA,
|
||||
RowCargo("PorcentajeRetISR").ToString().ToDecimal, ImporteRetISR, RowCargo("PorcentajeIEPS").ToString().ToDecimal, ImporteIEPS, -1, 0, ImporteTotal, "", "", -1, -1,
|
||||
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString())
|
||||
DrPS("SATClavePS").ToString(), DrPS("SATClaveUnidadMedida").ToString(), -1, -1, -1, -1, -1, -1, CveVentaDetalleRNC:=CveVentaDetalleRNC, CodigoObjetoImpuesto:=DrPS("CodigoObjetoImpuesto").ToString())
|
||||
End If
|
||||
|
||||
Next
|
||||
@@ -32935,29 +32990,36 @@ Partial Class Ventas
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Private Function GuardarUsados(CveConcepto As Integer, SqlTransaccion As SqlClient.SqlTransaction, factura As Modelos.Factura) As Boolean
|
||||
Private Function GuardarUsados(CveConcepto As Integer, SqlTransaccion As SqlClient.SqlTransaction, factura As Modelos.Factura, ObjAcum As ClsAcumuladores) As Boolean
|
||||
Dim Resultado As Boolean = True
|
||||
|
||||
If ClienteEsDistribuidor AndAlso Not factura.EsGarantia Then
|
||||
Dim ObjAcum As New ClsAcumuladores(SqlTransaccion)
|
||||
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
|
||||
If ClienteEsDistribuidor AndAlso Not factura.EsGarantia Then
|
||||
For Each drow As DataRow In factura.DtDetalle.Rows
|
||||
If drow("CveTamaño").ToString.ToEntero > 0 Then
|
||||
Dim DrTamanio As DataRow = GlobalDTAcumTamaños().FiltroPrimero($"CveTamaño={drow("CveTamaño").ToString.ToEntero}")
|
||||
If DrTamanio IsNot Nothing Then
|
||||
Dim Cargo As Decimal = DrTamanio("Cargo").ToString().ToDecimal() * drow("Cantidad").ToString.ToDecimal()
|
||||
Dim Bonificacion As Decimal = DrTamanio("Bonificacion").ToString().ToDecimal() * drow("Cantidad").ToString.ToDecimal()
|
||||
Dim Puntos As Decimal = DrTamanio("Puntos").ToString().ToDecimal() * drow("Cantidad").ToString.ToDecimal()
|
||||
|
||||
Dim CvePSPSA As Integer = UsuarioActual.Empresa.Funcionalidad(533).ToEntero
|
||||
|
||||
For Each drow As DataRow In factura.DtDetalle.Rows
|
||||
If drow("CveTamaño").ToString.ToEntero > 0 And (CvePSPSA <> drow("CvePS").ToString.ToEntero) Then
|
||||
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario,
|
||||
If drow("CveTamaño").ToString.ToEntero > 0 Then
|
||||
If Not ObjAcum.DistribuidorMovtosAdd(factura.CveCliente, drow("Cantidad").ToString.ToDecimal, drow("CveTamaño").ToString.ToEntero, Puntos, Cargo, Bonificacion, CveConcepto, factura.CveVenta, UsuarioActual.CveUsuario,
|
||||
UsuarioActual.CveEmpresa, 0D, "", Now) Then
|
||||
Resultado = False
|
||||
Exit For
|
||||
Resultado = False
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
Resultado = False
|
||||
Exit For
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
Next
|
||||
Else
|
||||
Resultado = True
|
||||
Next
|
||||
End If
|
||||
End If
|
||||
|
||||
Return Resultado
|
||||
|
||||
End Function
|
||||
|
||||
|
||||
@@ -36023,6 +36085,9 @@ Partial Class Ventas
|
||||
|
||||
|
||||
Protected Sub DdlLineaAdicional_SelectedIndexChanged(sender As Object, e As EventArgs)
|
||||
TxtFechaPago.Enabled = True
|
||||
imgCalendario.Visible = True
|
||||
|
||||
If DdlLineaAdicional.SelectedValue.ToEntero() > 0 Then
|
||||
RBLPago.SelectedValue = "1"
|
||||
RBLPago.Enabled = False
|
||||
@@ -36037,6 +36102,8 @@ Partial Class Ventas
|
||||
'AL FACTURAR CON LINEA ADICIONAL TIPO PO, SE SUMARÁN LOS DIAS DE VENCIMIENTO A LA FECHA ACTUAL
|
||||
If RowLinea("TipoLinea").ToString() = "2" Then
|
||||
TxtFechaPago.Text = Now.AddDays(RowLinea("DiasVencimiento").ToString().ToEntero()).ToString("dd/MM/yyyy")
|
||||
TxtFechaPago.Enabled = False
|
||||
imgCalendario.Visible = False
|
||||
End If
|
||||
|
||||
Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero()
|
||||
|
||||
Reference in New Issue
Block a user