|
|
|
@@ -85,6 +85,14 @@ Partial Class Ventas
|
|
|
|
End Property
|
|
|
|
End Property
|
|
|
|
|
|
|
|
|
|
|
|
'Local
|
|
|
|
'Local
|
|
|
|
|
|
|
|
Private Property DtPorcentajeMarcas As DataTable
|
|
|
|
|
|
|
|
Get
|
|
|
|
|
|
|
|
Return If(IsNothing(ViewState("DtPorcentajeMarcas")), Nothing, CType(ViewState("DtPorcentajeMarcas"), DataTable))
|
|
|
|
|
|
|
|
End Get
|
|
|
|
|
|
|
|
Set(value As DataTable)
|
|
|
|
|
|
|
|
ViewState("DtPorcentajeMarcas") = value
|
|
|
|
|
|
|
|
End Set
|
|
|
|
|
|
|
|
End Property
|
|
|
|
Private Property TmpDT As DataTable
|
|
|
|
Private Property TmpDT As DataTable
|
|
|
|
Get
|
|
|
|
Get
|
|
|
|
Return If(IsNothing(ViewState("TmpDT")), Nothing, CType(ViewState("TmpDT"), DataTable))
|
|
|
|
Return If(IsNothing(ViewState("TmpDT")), Nothing, CType(ViewState("TmpDT"), DataTable))
|
|
|
|
@@ -265,6 +273,14 @@ Partial Class Ventas
|
|
|
|
ViewState("ListaRemisionesNC") = value
|
|
|
|
ViewState("ListaRemisionesNC") = value
|
|
|
|
End Set
|
|
|
|
End Set
|
|
|
|
End Property
|
|
|
|
End Property
|
|
|
|
|
|
|
|
Private Property ListaNCDesc As List(Of Modelos.Factura)
|
|
|
|
|
|
|
|
Get
|
|
|
|
|
|
|
|
Return If(IsNothing(ViewState("ListaNCDesc")), Nothing, CType(ViewState("ListaNCDesc"), List(Of Modelos.Factura)))
|
|
|
|
|
|
|
|
End Get
|
|
|
|
|
|
|
|
Set(value As List(Of Modelos.Factura))
|
|
|
|
|
|
|
|
ViewState("ListaNCDesc") = value
|
|
|
|
|
|
|
|
End Set
|
|
|
|
|
|
|
|
End Property
|
|
|
|
Private Property Pedidos2Lista As List(Of Integer)
|
|
|
|
Private Property Pedidos2Lista As List(Of Integer)
|
|
|
|
Get
|
|
|
|
Get
|
|
|
|
Return If(IsNothing(ViewState("Pedidos2Lista")), Nothing, CType(ViewState("Pedidos2Lista"), List(Of Integer)))
|
|
|
|
Return If(IsNothing(ViewState("Pedidos2Lista")), Nothing, CType(ViewState("Pedidos2Lista"), List(Of Integer)))
|
|
|
|
@@ -2463,7 +2479,7 @@ Partial Class Ventas
|
|
|
|
InicializaAplicarNC()
|
|
|
|
InicializaAplicarNC()
|
|
|
|
|
|
|
|
|
|
|
|
If CveCliente > 0 Then
|
|
|
|
If CveCliente > 0 Then
|
|
|
|
CargaRestriccionesCreditoCliente()
|
|
|
|
CargaRestriccionesCreditoCliente(CveVenta:=Me.CveVenta)
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
If Not CveVenta > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(403).ToString = "1" Then
|
|
|
|
If Not CveVenta > 0 AndAlso UsuarioActual.Empresa.Funcionalidad(403).ToString = "1" Then
|
|
|
|
@@ -2512,6 +2528,11 @@ Partial Class Ventas
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
TxtFecha.Enabled = True
|
|
|
|
TxtFecha.Enabled = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then
|
|
|
|
|
|
|
|
TbDescuentosRNC.Visible = True
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CargaPorcentajeMarcas()
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
Private Sub ConfiguraEmpresa()
|
|
|
|
Private Sub ConfiguraEmpresa()
|
|
|
|
@@ -4947,7 +4968,7 @@ Partial Class Ventas
|
|
|
|
TrVistaPrevia.Visible = True
|
|
|
|
TrVistaPrevia.Visible = True
|
|
|
|
|
|
|
|
|
|
|
|
If Not (ModalidadEdicion AndAlso DdlTipoComprobante.SelectedValue = "Rem") Then
|
|
|
|
If Not (ModalidadEdicion AndAlso DdlTipoComprobante.SelectedValue = "Rem") Then
|
|
|
|
CargaRestriccionesCreditoCliente(True)
|
|
|
|
CargaRestriccionesCreditoCliente(True, Me.CveVenta)
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@@ -5001,7 +5022,7 @@ Partial Class Ventas
|
|
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False)
|
|
|
|
Private Sub CargaRestriccionesCreditoCliente(Optional Alertas As Boolean = False, Optional CveVenta As Integer = -1)
|
|
|
|
Dim ObjCliente As New ClsClientes()
|
|
|
|
Dim ObjCliente As New ClsClientes()
|
|
|
|
If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
|
|
|
|
If ObjCliente.GetClientes(CveCliente, "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
|
|
|
|
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
|
|
|
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
|
|
|
@@ -6120,7 +6141,11 @@ Partial Class Ventas
|
|
|
|
#Region " EMITIR IMPRIMIR - GUARDAR "
|
|
|
|
#Region " EMITIR IMPRIMIR - GUARDAR "
|
|
|
|
|
|
|
|
|
|
|
|
Protected Sub BtnEmitirImprimir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEmitirImprimir.Click
|
|
|
|
Protected Sub BtnEmitirImprimir_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles BtnEmitirImprimir.Click
|
|
|
|
|
|
|
|
Try
|
|
|
|
EmitirImprimir()
|
|
|
|
EmitirImprimir()
|
|
|
|
|
|
|
|
Catch ex As Exception
|
|
|
|
|
|
|
|
OnError(ex.ToString(), ex)
|
|
|
|
|
|
|
|
End Try
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
Private Sub EmitirImprimir()
|
|
|
|
Private Sub EmitirImprimir()
|
|
|
|
@@ -6525,7 +6550,6 @@ Partial Class Ventas
|
|
|
|
' Exit Sub
|
|
|
|
' Exit Sub
|
|
|
|
'End If
|
|
|
|
'End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If ObjFactura.CveCliente > 0 Or CveEmpresaCRM > 0 Then
|
|
|
|
If ObjFactura.CveCliente > 0 Or CveEmpresaCRM > 0 Then
|
|
|
|
If TmpDT.Rows.Count > 0 Then
|
|
|
|
If TmpDT.Rows.Count > 0 Then
|
|
|
|
|
|
|
|
|
|
|
|
@@ -6597,7 +6621,8 @@ Partial Class Ventas
|
|
|
|
EsNCAmortizacion = True
|
|
|
|
EsNCAmortizacion = True
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS, ObjEventos, ObjCGame, ObjClientes, EsNCAmortizacion:=EsNCAmortizacion)
|
|
|
|
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS,
|
|
|
|
|
|
|
|
ObjEventos, ObjCGame, ObjClientes, EsNCAmortizacion:=EsNCAmortizacion)
|
|
|
|
|
|
|
|
|
|
|
|
'SI ES REFACTURACION
|
|
|
|
'SI ES REFACTURACION
|
|
|
|
Dim ObjNC As List(Of Object) = Nothing
|
|
|
|
Dim ObjNC As List(Of Object) = Nothing
|
|
|
|
@@ -6620,30 +6645,21 @@ Partial Class Ventas
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'SI ES AMORTIZACION 3.3
|
|
|
|
'SI ES amortizacion 3.3
|
|
|
|
|
|
|
|
Dim Obj2 As New List(Of Object)
|
|
|
|
Dim Obj2 As New List(Of Object)
|
|
|
|
|
|
|
|
Dim NCDescuento As Boolean = (ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0)
|
|
|
|
If ErrorList.Count = 0 Then
|
|
|
|
If ErrorList.Count = 0 Then
|
|
|
|
' cambiar la condicion para saber si hay seleccionado
|
|
|
|
' cambiar la condicion para saber si hay seleccionado
|
|
|
|
If TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
|
|
|
|
If (TieneAnticipo AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2") OrElse NCDescuento Then
|
|
|
|
|
|
|
|
|
|
|
|
If TieneAnticipo Then
|
|
|
|
|
|
|
|
CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveAnticipoPadre)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Try
|
|
|
|
Try
|
|
|
|
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing, Nothing) Then
|
|
|
|
CreaObjetosVentaAmortizacion(ObjVentas, FolioFiscalRelacionado, CveAnticipoPadre, NCDescuento:=NCDescuento)
|
|
|
|
|
|
|
|
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing,
|
|
|
|
|
|
|
|
Nothing, NCDescuento:=NCDescuento) Then
|
|
|
|
Obj2.Add(ObjFacturaDevolucion)
|
|
|
|
Obj2.Add(ObjFacturaDevolucion)
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
Catch ex As Exception
|
|
|
|
Catch ex As Exception
|
|
|
|
ErrorList.Add("No se pudo generarse la nota de crédito de amortización")
|
|
|
|
ErrorList.Add("No se pudo generarse la nota de crédito de amortización")
|
|
|
|
End Try
|
|
|
|
End Try
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Obj2 Is Nothing AndAlso Obj2.Count = 0 Then
|
|
|
|
If Obj2 Is Nothing AndAlso Obj2.Count = 0 Then
|
|
|
|
ErrorList.Add("No se pudo generarse la nota de crédito de amortización")
|
|
|
|
ErrorList.Add("No se pudo generarse la nota de crédito de amortización")
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
@@ -6820,7 +6836,6 @@ Partial Class Ventas
|
|
|
|
End Try
|
|
|
|
End Try
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim SeTimbro As Boolean = False
|
|
|
|
Dim SeTimbro As Boolean = False
|
|
|
|
Dim SeTimbroNC As Boolean = False
|
|
|
|
Dim SeTimbroNC As Boolean = False
|
|
|
|
Dim EstatusSMS = 0
|
|
|
|
Dim EstatusSMS = 0
|
|
|
|
@@ -7084,7 +7099,8 @@ Partial Class Ventas
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Private Sub CreaObjetosVentaAmortizacion(ObjVentas As ClsVentas, FolioFiscalRelacionado As String, CveAnticipoPadre As Integer, Optional CveVentasPadre As Integer = -1)
|
|
|
|
Private Sub CreaObjetosVentaAmortizacion(ObjVentas As ClsVentas, FolioFiscalRelacionado As String, CveAnticipoPadre As Integer,
|
|
|
|
|
|
|
|
Optional CveVentasPadre As Integer = -1, Optional NCDescuento As Boolean = False)
|
|
|
|
ObjFacturaDevolucion = New Modelos.Factura
|
|
|
|
ObjFacturaDevolucion = New Modelos.Factura
|
|
|
|
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.CveUsuario = UsuarioActual.CveUsuario
|
|
|
|
ObjFacturaDevolucion.CveUsuario = UsuarioActual.CveUsuario
|
|
|
|
@@ -7098,7 +7114,6 @@ Partial Class Ventas
|
|
|
|
ObjFacturaDevolucion.CveVentaRelacion = ObjVentas.CveVenta
|
|
|
|
ObjFacturaDevolucion.CveVentaRelacion = ObjVentas.CveVenta
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.CveEmpresa = UsuarioActual.CveEmpresa
|
|
|
|
ObjFacturaDevolucion.CveEmpresa = UsuarioActual.CveEmpresa
|
|
|
|
ObjFacturaDevolucion.TipoCambio = If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.Trim.ToDecimal)
|
|
|
|
ObjFacturaDevolucion.TipoCambio = If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.Trim.ToDecimal)
|
|
|
|
ObjFacturaDevolucion.ConvertirPesos = ChkConvertirDoctoPesos.Checked
|
|
|
|
ObjFacturaDevolucion.ConvertirPesos = ChkConvertirDoctoPesos.Checked
|
|
|
|
@@ -7139,6 +7154,7 @@ Partial Class Ventas
|
|
|
|
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero
|
|
|
|
ObjFacturaDevolucion.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero
|
|
|
|
ObjFacturaDevolucion.TipoRelacion = "07"
|
|
|
|
ObjFacturaDevolucion.TipoRelacion = "07"
|
|
|
|
|
|
|
|
|
|
|
|
Dim Fol As New List(Of String)
|
|
|
|
Dim Fol As New List(Of String)
|
|
|
|
Fol.Add(FolioFiscalRelacionado)
|
|
|
|
Fol.Add(FolioFiscalRelacionado)
|
|
|
|
ObjFacturaDevolucion.UUIDRelacionados = Fol
|
|
|
|
ObjFacturaDevolucion.UUIDRelacionados = Fol
|
|
|
|
@@ -7199,7 +7215,23 @@ Partial Class Ventas
|
|
|
|
ObjFacturaDevolucion.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim
|
|
|
|
ObjFacturaDevolucion.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim
|
|
|
|
ObjFacturaDevolucion.MonedaAbreviatura = ""
|
|
|
|
ObjFacturaDevolucion.MonedaAbreviatura = ""
|
|
|
|
|
|
|
|
|
|
|
|
'Totales, Y se llena TmpDTImpuestos
|
|
|
|
'DETALLES
|
|
|
|
|
|
|
|
If NCDescuento Then
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.DtDetalle = CreaDTDetalleNCDescuento()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.SubTotal = ObjFacturaDevolucion.DtDetalle.SUM("Total").ToDecimal()
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.Descuento = ObjFacturaDevolucion.DtDetalle.SUM("Descuento").ToDecimal()
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.Amortizacion = 0
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.IVA = ObjFacturaDevolucion.DtDetalle.SUM("ImporteIVA").ToDecimal()
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.RetIVA = ObjFacturaDevolucion.DtDetalle.SUM("ImporteRetIVA").ToDecimal()
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.RetISR = ObjFacturaDevolucion.DtDetalle.SUM("ImporteRetISR").ToDecimal()
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.IEPS = ObjFacturaDevolucion.DtDetalle.SUM("ImporteIEPS").ToDecimal()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim Total As Decimal = (ObjFacturaDevolucion.SubTotal + ObjFacturaDevolucion.IVA + ObjFacturaDevolucion.IEPS) - (ObjFacturaDevolucion.Descuento + ObjFacturaDevolucion.RetIVA + ObjFacturaDevolucion.RetISR + ObjFacturaDevolucion.Amortizacion)
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.Total = Total
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.DtDetalle = TmpDT
|
|
|
|
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.SubTotal = TxtSubTotal.Text.ToDecimal
|
|
|
|
ObjFacturaDevolucion.SubTotal = TxtSubTotal.Text.ToDecimal
|
|
|
|
ObjFacturaDevolucion.Descuento = LblDescuentos.Text.Trim.ToDecimal
|
|
|
|
ObjFacturaDevolucion.Descuento = LblDescuentos.Text.Trim.ToDecimal
|
|
|
|
ObjFacturaDevolucion.Amortizacion = LblAmortizacion.Text.Trim.ToDecimal
|
|
|
|
ObjFacturaDevolucion.Amortizacion = LblAmortizacion.Text.Trim.ToDecimal
|
|
|
|
@@ -7208,6 +7240,8 @@ Partial Class Ventas
|
|
|
|
ObjFacturaDevolucion.RetISR = TxtRetISR.Text.ToDecimal
|
|
|
|
ObjFacturaDevolucion.RetISR = TxtRetISR.Text.ToDecimal
|
|
|
|
ObjFacturaDevolucion.IEPS = TxtIEPS.Text.ToDecimal
|
|
|
|
ObjFacturaDevolucion.IEPS = TxtIEPS.Text.ToDecimal
|
|
|
|
ObjFacturaDevolucion.Total = TxtTotal.Text.ToDecimal
|
|
|
|
ObjFacturaDevolucion.Total = TxtTotal.Text.ToDecimal
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
'Totales, Y se llena TmpDTImpuestos
|
|
|
|
|
|
|
|
|
|
|
|
'ObjFactura.BZDescripcion = TxtBZDescripcion.Text.Trim
|
|
|
|
'ObjFactura.BZDescripcion = TxtBZDescripcion.Text.Trim
|
|
|
|
'ObjFactura.BZNombreCorto = TxtBZNombreCorto.Text.Trim
|
|
|
|
'ObjFactura.BZNombreCorto = TxtBZNombreCorto.Text.Trim
|
|
|
|
@@ -7255,12 +7289,10 @@ Partial Class Ventas
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
Next
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If TxtTotal.Text.ToDecimal <> 0 Then DR("ImpuestoLocal") = "Total" : DR("Importe") = TxtTotal.Text.ToDecimal : DR("Orden") = 100 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
|
|
|
|
If TxtTotal.Text.ToDecimal <> 0 Then DR("ImpuestoLocal") = "Total" : DR("Importe") = TxtTotal.Text.ToDecimal : DR("Orden") = 100 : DR("TipoImpuesto") = "0" : TmpDTImpuestos.Rows.Add(DR)
|
|
|
|
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.DtDeduccion = TmpDTImpuestos.FiltraParametros("", Orderby:="Orden ASC")
|
|
|
|
ObjFacturaDevolucion.DtDeduccion = TmpDTImpuestos.FiltraParametros("", Orderby:="Orden ASC")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'otros
|
|
|
|
'otros
|
|
|
|
ObjFacturaDevolucion.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim
|
|
|
|
ObjFacturaDevolucion.Det_FechaOrdenCompra = TxtDet_FechaOrdenCompra.Text.Trim
|
|
|
|
ObjFacturaDevolucion.Det_OrdenCompra = TxtDet_OrdenCompra.Text.Trim
|
|
|
|
ObjFacturaDevolucion.Det_OrdenCompra = TxtDet_OrdenCompra.Text.Trim
|
|
|
|
@@ -7273,8 +7305,6 @@ Partial Class Ventas
|
|
|
|
ObjFacturaDevolucion.CveMoneda = 1
|
|
|
|
ObjFacturaDevolucion.CveMoneda = 1
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
'DETALLES
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.DtDetalle = TmpDT
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.DtFirmas = DTmpF
|
|
|
|
ObjFacturaDevolucion.DtFirmas = DTmpF
|
|
|
|
|
|
|
|
|
|
|
|
'CLIENTE
|
|
|
|
'CLIENTE
|
|
|
|
@@ -7331,10 +7361,11 @@ Partial Class Ventas
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Private Function RegistrarNCAmortizacion(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi, ByVal factura As Modelos.Factura, ObjBancos As ClsBancos, TmpDTconceptos As DataTable, ByRef ObjEventos As ClsOIEventos) As Boolean
|
|
|
|
Private Function RegistrarNCAmortizacion(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, 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) As Boolean
|
|
|
|
Dim ProcesoCorrecto As Boolean = True
|
|
|
|
Dim ProcesoCorrecto As Boolean = True
|
|
|
|
|
|
|
|
|
|
|
|
'Generamos el nuevo folio
|
|
|
|
'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
|
|
|
|
If ObjFolios.GetFolios(factura.TipoDocto, UsuarioActual.CveEmpresa) Then
|
|
|
|
@@ -7347,7 +7378,21 @@ Partial Class Ventas
|
|
|
|
DT.Dispose()
|
|
|
|
DT.Dispose()
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
'** genero los datos de la NC
|
|
|
|
If NCDescuento Then
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
|
|
|
|
|
|
|
|
DtVentasNC.Rows(0)("Importe") = factura.Total
|
|
|
|
|
|
|
|
DtVentasNC.Rows(0)("TC") = factura.TipoCambio
|
|
|
|
|
|
|
|
DtVentasNC.Rows(0)("TCCambioValuacion") = factura.TipoCambio
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'Registramos la venta
|
|
|
|
|
|
|
|
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True, NCDescuento:=True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
|
|
|
'GENERO LOS DATOS DE LA NC
|
|
|
|
Dim tmpcon As DataTable = TmpDT.Clone
|
|
|
|
Dim tmpcon As DataTable = TmpDT.Clone
|
|
|
|
tmpcon.Clear()
|
|
|
|
tmpcon.Clear()
|
|
|
|
|
|
|
|
|
|
|
|
@@ -7407,7 +7452,7 @@ Partial Class Ventas
|
|
|
|
|
|
|
|
|
|
|
|
Next
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
|
|
'**** impuestos locales
|
|
|
|
'**** IMPUESTOS LOCALES
|
|
|
|
|
|
|
|
|
|
|
|
factura.DtDetalle = tmpcon
|
|
|
|
factura.DtDetalle = tmpcon
|
|
|
|
Dim TotalSubTotal As Decimal = tmpcon.SUM("TotalImporte").ToDecimal
|
|
|
|
Dim TotalSubTotal As Decimal = tmpcon.SUM("TotalImporte").ToDecimal
|
|
|
|
@@ -7441,34 +7486,10 @@ Partial Class Ventas
|
|
|
|
'Registramos la venta
|
|
|
|
'Registramos la venta
|
|
|
|
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True)
|
|
|
|
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True)
|
|
|
|
|
|
|
|
|
|
|
|
''Timbramos
|
|
|
|
|
|
|
|
'If factura.TipoDocto.Contiene("Ing", "Egs", "Ant") Then
|
|
|
|
|
|
|
|
' If UsuarioActual.Empresa.TipoFacturacion = "CFDi" AndAlso UsuarioActual.Empresa.FacturaProduccion Then
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
' Dim sw As New Diagnostics.Stopwatch
|
|
|
|
|
|
|
|
' sw.Start()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
' ''factura INGRESO / EGRESO
|
|
|
|
|
|
|
|
' Dim ObjTimbrado As New Modelos.Timbrado
|
|
|
|
|
|
|
|
' Dim FM As New Modelos.FemsaFactura
|
|
|
|
|
|
|
|
' Dim TmpDT7Eleven As New DataTable
|
|
|
|
|
|
|
|
' Dim TmpDTComplementosTimbrado As New DataTable
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
' 'PrepararTimbrado(FM, TmpDT7Eleven, TmpDTComplementosTimbrado)
|
|
|
|
|
|
|
|
' '**
|
|
|
|
|
|
|
|
' ObjTimbrado.TimbrarFactura(UsuarioActual, factura, FM, TmpDT, TmpDTImpuestos, TmpDT7Eleven, TmpDTComplementosTimbrado, Ruta, LstFordASN, TxtFordGSDB.Text)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
' sw.Stop()
|
|
|
|
|
|
|
|
' 'GuardaLogTimbrado(sw.ElapsedMilliseconds.ToString, UsuarioActual.Empresa.CvePAC)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
' End If
|
|
|
|
|
|
|
|
'End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Else
|
|
|
|
Else
|
|
|
|
ErrorList.Add("No se encontró un producto para generar la nota de crédito")
|
|
|
|
ErrorList.Add("No se encontró un producto para generar la nota de crédito")
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
Return ProcesoCorrecto
|
|
|
|
Return ProcesoCorrecto
|
|
|
|
End Function
|
|
|
|
End Function
|
|
|
|
@@ -8934,7 +8955,7 @@ Partial Class Ventas
|
|
|
|
#Region " GUARDAR - VENTA, PREPOLIZAS, INV, ESTIMACIONES, AC, NOTA DE CRÉDITO "
|
|
|
|
#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, TmpDTDetalle As DataTable, CveNCaVincular As Integer,
|
|
|
|
Private Sub GuardarVenta(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjInventario As ClsInventarios, ByRef ObjContr As ClsContratos, factura As Modelos.Factura, 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 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)
|
|
|
|
ByRef Optional ObjCliente As ClsClientes = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False)
|
|
|
|
|
|
|
|
|
|
|
|
Dim Msgok As New StringBuilder
|
|
|
|
Dim Msgok As New StringBuilder
|
|
|
|
Dim CveAlmacenTraspasoOrigen As Integer = -1
|
|
|
|
Dim CveAlmacenTraspasoOrigen As Integer = -1
|
|
|
|
@@ -9255,10 +9276,10 @@ Partial Class Ventas
|
|
|
|
|
|
|
|
|
|
|
|
If ErrorList.Count = 0 Then
|
|
|
|
If ErrorList.Count = 0 Then
|
|
|
|
'prepoliza
|
|
|
|
'prepoliza
|
|
|
|
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion)
|
|
|
|
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento)
|
|
|
|
If ErrorList.Count = 0 Then
|
|
|
|
If ErrorList.Count = 0 Then
|
|
|
|
'inventarios
|
|
|
|
'inventarios
|
|
|
|
If Not EsNCAmortizacion Then
|
|
|
|
If Not EsNCAmortizacion AndAlso Not NCDescuento Then
|
|
|
|
If GuardarVentaInventarios(ObjInventario, ObjConta, factura) Then
|
|
|
|
If GuardarVentaInventarios(ObjInventario, ObjConta, factura) Then
|
|
|
|
ErrorList.Add("Ocurrio un error al Guardar Inventario")
|
|
|
|
ErrorList.Add("Ocurrio un error al Guardar Inventario")
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
@@ -9284,7 +9305,7 @@ Partial Class Ventas
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
Private Sub GuardarVentaPrePolizas(ByRef ObjConta As ClsContabilidad, factura As Modelos.Factura, TmpDTDetalleMovimientos As DataTable, CveNCaVincular As Integer,
|
|
|
|
Private Sub GuardarVentaPrePolizas(ByRef ObjConta As ClsContabilidad, factura As Modelos.Factura, TmpDTDetalleMovimientos As DataTable, CveNCaVincular As Integer,
|
|
|
|
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
|
|
|
|
ByRef objContPaqi As ClsContPAQi, Optional ByRef ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
|
|
|
|
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False)
|
|
|
|
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False)
|
|
|
|
|
|
|
|
|
|
|
|
Dim CveIE As Integer = -1
|
|
|
|
Dim CveIE As Integer = -1
|
|
|
|
Dim DT As DataTable = Nothing
|
|
|
|
Dim DT As DataTable = Nothing
|
|
|
|
@@ -9303,7 +9324,7 @@ Partial Class Ventas
|
|
|
|
If DdlTipoComprobante.SelectedValue <> "Cot" Then
|
|
|
|
If DdlTipoComprobante.SelectedValue <> "Cot" Then
|
|
|
|
If factura.CvePrePoliza > 0 Then
|
|
|
|
If factura.CvePrePoliza > 0 Then
|
|
|
|
|
|
|
|
|
|
|
|
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, 1, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion) Then
|
|
|
|
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, 1, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento) Then
|
|
|
|
ErrorList.Add("Ocurrió un error al agregar los Movimientos de la prepoliza.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
|
|
|
ErrorList.Add("Ocurrió un error al agregar los Movimientos de la prepoliza.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
@@ -9314,7 +9335,7 @@ Partial Class Ventas
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
Private Function ProcesoPrepolizas(ByRef ObjConta As ClsContabilidad, ObjFactura As Modelos.Factura, CveIE As Integer, TmpDTDetalle As DataTable, ByRef objContPaqi As ClsContPAQi,
|
|
|
|
Private Function ProcesoPrepolizas(ByRef ObjConta As ClsContabilidad, ObjFactura As Modelos.Factura, CveIE As Integer, TmpDTDetalle As DataTable, ByRef objContPaqi As ClsContPAQi,
|
|
|
|
Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
|
|
|
|
Optional ValorMultiplicador As Integer = 1, ByRef Optional ObjBancos As ClsBancos = Nothing, ByRef Optional ObjVentas As ClsVentas = Nothing,
|
|
|
|
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False) As Boolean
|
|
|
|
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False) As Boolean
|
|
|
|
Try
|
|
|
|
Try
|
|
|
|
Dim DT As DataTable
|
|
|
|
Dim DT As DataTable
|
|
|
|
Dim CvePlantilaPoliza As Integer
|
|
|
|
Dim CvePlantilaPoliza As Integer
|
|
|
|
@@ -9960,8 +9981,16 @@ Partial Class Ventas
|
|
|
|
Next
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(344) = "1" Then
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(344) = "1" Then
|
|
|
|
If ListaRemisionesNC IsNot Nothing Then
|
|
|
|
Dim ListaNC As List(Of Modelos.Factura) = Nothing
|
|
|
|
For Each ObjRNC As Modelos.Factura In ListaRemisionesNC
|
|
|
|
|
|
|
|
|
|
|
|
If NCDescuento Then
|
|
|
|
|
|
|
|
ListaNC = ListaNCDesc
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
|
|
|
ListaNC = ListaRemisionesNC
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If ListaNC IsNot Nothing Then
|
|
|
|
|
|
|
|
For Each ObjRNC As Modelos.Factura In ListaNC
|
|
|
|
If ObjRNC.TipoDocto = "RNC" Then
|
|
|
|
If ObjRNC.TipoDocto = "RNC" Then
|
|
|
|
importeMovimiento = ObjRNC.TotalRemNCAplicado * -1
|
|
|
|
importeMovimiento = ObjRNC.TotalRemNCAplicado * -1
|
|
|
|
importeMX = importeMovimiento * tipoCambio * Multiplicador
|
|
|
|
importeMX = importeMovimiento * tipoCambio * Multiplicador
|
|
|
|
@@ -10101,7 +10130,7 @@ Partial Class Ventas
|
|
|
|
|
|
|
|
|
|
|
|
importeMovimiento = 0
|
|
|
|
importeMovimiento = 0
|
|
|
|
Case 150 'Descuento sobre ventas
|
|
|
|
Case 150 'Descuento sobre ventas
|
|
|
|
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") AndAlso Not EsNCAmortizacion Then
|
|
|
|
If (ObjFactura.TipoDocto.Contiene("Egs", "Dev") AndAlso Not EsNCAmortizacion) OrElse NCDescuento Then
|
|
|
|
|
|
|
|
|
|
|
|
Dim ConceptoContableAplicar = 150
|
|
|
|
Dim ConceptoContableAplicar = 150
|
|
|
|
Dim CveVentaAplicar = ObjFactura.CveVenta
|
|
|
|
Dim CveVentaAplicar = ObjFactura.CveVenta
|
|
|
|
@@ -13815,6 +13844,13 @@ Partial Class Ventas
|
|
|
|
UpINV.Update()
|
|
|
|
UpINV.Update()
|
|
|
|
UPPPS.Update()
|
|
|
|
UPPPS.Update()
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub CargaPorcentajeMarcas()
|
|
|
|
|
|
|
|
Dim ObjPS As New ClsProductosServicios
|
|
|
|
|
|
|
|
If ObjPS.GetPorcentajeMarcas(CveCliente) Then
|
|
|
|
|
|
|
|
DtPorcentajeMarcas = ObjPS.DtResultados.Copy()
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
ObjPS.Dispose()
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
Private Function AgregarProductoServicio(Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String,
|
|
|
|
Private Function AgregarProductoServicio(Cantidad As Decimal, CveUM As Integer, UM As String, CveClasificacion As Integer, Clasificacion As String, CvePS As Integer, PS As String, Obs As String,
|
|
|
|
PU As Decimal, Descuento As Decimal,
|
|
|
|
PU As Decimal, Descuento As Decimal,
|
|
|
|
CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String,
|
|
|
|
CveProyecto As Integer, Proyecto As String, CveSubProyecto As Integer, SubProyecto As String,
|
|
|
|
@@ -13891,13 +13927,6 @@ Partial Class Ventas
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
If Not ClienteDesglosaIEPS Then
|
|
|
|
|
|
|
|
If Not RegeneraIEPS Then
|
|
|
|
|
|
|
|
PU = PU * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal)
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
DrPS("IEPSPorcentaje") = 0
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'verifica si tiene ventaminima
|
|
|
|
'verifica si tiene ventaminima
|
|
|
|
If Cantidad > 0 AndAlso DrPS("VentaMinima").ToString.ToDecimal > 0 Then
|
|
|
|
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...
|
|
|
|
'verifico que la cantidad sea multiplo de venta minima, es decir ventaminima =5, solo puede vender 5,10,15...
|
|
|
|
@@ -13907,6 +13936,56 @@ Partial Class Ventas
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Not ClienteDesglosaIEPS Then
|
|
|
|
|
|
|
|
If Not RegeneraIEPS Then
|
|
|
|
|
|
|
|
PU = PU * (1 + DrPS("IEPSPorcentaje").ToString.ToDecimal)
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
DrPS("IEPSPorcentaje") = 0
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'VERIFICA SI APLICAN CONDICIONES COMERCIALES
|
|
|
|
|
|
|
|
If DtPorcentajeMarcas IsNot Nothing AndAlso DtPorcentajeMarcas.Rows.Count > 0 Then
|
|
|
|
|
|
|
|
'VERIFICA SI EL PRODUCTO TIENE ESPECIFICADA UNA MARCA
|
|
|
|
|
|
|
|
If Not String.IsNullOrEmpty(DrPS("CveMarca").ToString()) AndAlso DrPS("CveMarca").ToString().ToEntero() > 0 Then
|
|
|
|
|
|
|
|
Dim RowPorcentaje = DtPorcentajeMarcas.FiltroPrimero($"CveMarca={DrPS("CveMarca").ToString()}")
|
|
|
|
|
|
|
|
'REALIZA LOS DESCUENTOS DE ACUERDO AL PORCENTAJE POR MARCA
|
|
|
|
|
|
|
|
If RowPorcentaje IsNot Nothing Then
|
|
|
|
|
|
|
|
Dim PorcentajeProducto = RowPorcentaje("PorcentajeProducto").ToString().ToDecimal() / 100D
|
|
|
|
|
|
|
|
Dim PorcentajeProducto2 = RowPorcentaje("PorcentajeProducto2").ToString().ToDecimal() / 100D
|
|
|
|
|
|
|
|
Dim PorcentajeProducto3 = RowPorcentaje("PorcentajeProducto3").ToString().ToDecimal() / 100D
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim TotalInicial = (Cantidad * (PU)) - Descuento
|
|
|
|
|
|
|
|
Dim TotalFinal = TotalInicial
|
|
|
|
|
|
|
|
'SI APLICA EL PRIMER DESCUENTO
|
|
|
|
|
|
|
|
If PorcentajeProducto > 0 Then
|
|
|
|
|
|
|
|
Dim Descuento1 = TotalInicial * PorcentajeProducto
|
|
|
|
|
|
|
|
Dim Total2 = (TotalInicial - Descuento1)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'SI APLICA EL SEGUNDO DESCUENTO
|
|
|
|
|
|
|
|
If PorcentajeProducto2 > 0 Then
|
|
|
|
|
|
|
|
Dim Descuento2 = Total2 * PorcentajeProducto2
|
|
|
|
|
|
|
|
Dim Total3 = (Total2 - Descuento2)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'SI APLICA EL TERCER DESCUENTO
|
|
|
|
|
|
|
|
If PorcentajeProducto3 > 0 Then
|
|
|
|
|
|
|
|
Dim Descuento3 = Total3 * PorcentajeProducto3
|
|
|
|
|
|
|
|
TotalFinal = Total3 - Descuento3
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
|
|
|
TotalFinal = Total3
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
|
|
|
TotalFinal = Total2
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
|
|
|
TotalFinal = TotalInicial
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Descuento += ((Cantidad * PU) - TotalFinal)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
|
|
|
|
TotalCalculableImpuestos = (Cantidad * (PU)) - Descuento
|
|
|
|
|
|
|
|
|
|
|
|
Row("PU") = PU
|
|
|
|
Row("PU") = PU
|
|
|
|
@@ -13939,8 +14018,6 @@ Partial Class Ventas
|
|
|
|
|
|
|
|
|
|
|
|
Row("IVA") = Row("PorcentajeIVA")
|
|
|
|
Row("IVA") = Row("PorcentajeIVA")
|
|
|
|
Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
|
|
|
Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
|
|
|
|
Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
|
|
|
|
Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
|
|
|
|
Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
|
|
|
|
Row("PorcentajeRetIVA") = ClienteRetIVA
|
|
|
|
Row("PorcentajeRetIVA") = ClienteRetIVA
|
|
|
|
@@ -14575,7 +14652,7 @@ Partial Class Ventas
|
|
|
|
ConfiguraTipoDocto()
|
|
|
|
ConfiguraTipoDocto()
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True)
|
|
|
|
Private Sub CalculaTotalesVenta(Optional RecalculaImpuestosLocales As Boolean = True, Optional NCDescuento As Boolean = False)
|
|
|
|
|
|
|
|
|
|
|
|
Dim TotalSubTotal As Decimal = TmpDT.SUM("TotalImporte").ToDecimal
|
|
|
|
Dim TotalSubTotal As Decimal = TmpDT.SUM("TotalImporte").ToDecimal
|
|
|
|
Dim TotalDescuentos As Decimal = TmpDT.SUM("Descuento").ToDecimal
|
|
|
|
Dim TotalDescuentos As Decimal = TmpDT.SUM("Descuento").ToDecimal
|
|
|
|
@@ -16721,15 +16798,30 @@ Partial Class Ventas
|
|
|
|
Private Function ValidaPagosContado() As Boolean
|
|
|
|
Private Function ValidaPagosContado() As Boolean
|
|
|
|
Dim Retorno = False
|
|
|
|
Dim Retorno = False
|
|
|
|
|
|
|
|
|
|
|
|
If (UsuarioActual.CveEmpresa = 140) AndAlso (Not PermiteCredito) AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) And TxtTotal.Text.ToDecimal > 0 Then
|
|
|
|
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Rem", "Ant") AndAlso (UsuarioActual.CveEmpresa = 140) AndAlso (Not PermiteCredito) AndAlso (DtPagos Is Nothing OrElse DtPagos.Rows.Count = 0) And TxtTotal.Text.ToDecimal > 0 Then
|
|
|
|
Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia)
|
|
|
|
Alert("Es necesario especificar un pago.", TipoMensaje.MsgAdvertencia)
|
|
|
|
Retorno = True
|
|
|
|
Retorno = True
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.Empresa.Funcionalidad(572) = "1" Then
|
|
|
|
|
|
|
|
Dim TotalNC As Decimal = If(ListaNCDesc IsNot Nothing AndAlso ListaNCDesc.Count > 0, ListaNCDesc.Sum(Function(f) f.TotalRemNCAplicado), 0)
|
|
|
|
|
|
|
|
If TotalNC > 0 Then
|
|
|
|
|
|
|
|
If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TotalNC Then
|
|
|
|
|
|
|
|
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
|
|
|
Retorno = True
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
Else
|
|
|
|
If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then
|
|
|
|
If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then
|
|
|
|
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
|
|
|
|
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
|
|
|
|
Retorno = True
|
|
|
|
Retorno = True
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
|
|
|
If (DtPagos.SUM("Importe").ToString.ToDecimal + Total - TxtCambio.Text.ToDecimal) > TxtTotal.Text.ToDecimal Then
|
|
|
|
|
|
|
|
Alert("El importe de los pagos no puede exceder el importe de la factura. Por favor verifique.", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
|
|
|
Retorno = True
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
Return Retorno
|
|
|
|
Return Retorno
|
|
|
|
End Function
|
|
|
|
End Function
|
|
|
|
@@ -20504,6 +20596,16 @@ Partial Class Ventas
|
|
|
|
ObjMovtos.Dispose()
|
|
|
|
ObjMovtos.Dispose()
|
|
|
|
GvRemisionesNC.DataBind()
|
|
|
|
GvRemisionesNC.DataBind()
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Private Sub CargaDescRNC()
|
|
|
|
|
|
|
|
Dim ObjMovtos As New ClsMovimientos()
|
|
|
|
|
|
|
|
If ObjMovtos.GetCxCClienteDetalle(ViewState("CveCliente").ToString.ToEntero, "-1", "-1", -1, -1, UsuarioActual.CveEmpresa, -1, TipoDocto:="RNC") Then
|
|
|
|
|
|
|
|
GvDescNC.DataSource = ObjMovtos.DtResultados.FiltraParametros("Tipo = 'Act' AND CveVenta > 0", "Moneda, OrdenVencimiento, FechaVencimiento")
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
ObjMovtos.Dispose()
|
|
|
|
|
|
|
|
GvDescNC.DataBind()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UpDescNC.Update()
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
Protected Sub GvCxC_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
|
|
|
Protected Sub GvCxC_RowDataBound(sender As Object, e As GridViewRowEventArgs)
|
|
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
|
|
|
@@ -20540,8 +20642,13 @@ Partial Class Ventas
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AplicarNC(DdlNCPS.SelectedValue.ToEntero)
|
|
|
|
|
|
|
|
|
|
|
|
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlNCPS.SelectedValue.ToEntero).FiltroPrimero("")
|
|
|
|
RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC")
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Private Sub AplicarNC(CvePS As Integer, Optional NCDescuento As Boolean = False)
|
|
|
|
|
|
|
|
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePS).FiltroPrimero("")
|
|
|
|
If DrPS Is Nothing Then
|
|
|
|
If DrPS Is Nothing Then
|
|
|
|
Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
|
|
|
|
Alert("Ocurrió un error al cargar la información del producto. Por favor comuniquese con asistencia SIG", TipoMensaje.MsgError)
|
|
|
|
Exit Sub
|
|
|
|
Exit Sub
|
|
|
|
@@ -20556,11 +20663,6 @@ Partial Class Ventas
|
|
|
|
Exit Sub
|
|
|
|
Exit Sub
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
If DdlTipoComprobante.SelectedValue = "Ant" Then CveAnticipo = CveVenta
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlTipoComprobante.SelectedValueExist("Egs")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'CREAMOS DT PARA UTILIZAR AL TIMBRAR
|
|
|
|
'CREAMOS DT PARA UTILIZAR AL TIMBRAR
|
|
|
|
InicializaDTVentasNC()
|
|
|
|
InicializaDTVentasNC()
|
|
|
|
|
|
|
|
|
|
|
|
@@ -20579,6 +20681,13 @@ Partial Class Ventas
|
|
|
|
DtImpuestos.AcceptChanges()
|
|
|
|
DtImpuestos.AcceptChanges()
|
|
|
|
|
|
|
|
|
|
|
|
If AplicaNCMasiva Then
|
|
|
|
If AplicaNCMasiva Then
|
|
|
|
|
|
|
|
If NCDescuento Then
|
|
|
|
|
|
|
|
For Each Gvr As GridViewRow In GvDescNC.Rows
|
|
|
|
|
|
|
|
If Gvr.FCCheckBox("ChkAplicar").Checked Then
|
|
|
|
|
|
|
|
DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal), True, MissingSchemaAction.Ignore)
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
Else
|
|
|
|
For Each Gvr As GridViewRow In GvCxC.Rows
|
|
|
|
For Each Gvr As GridViewRow In GvCxC.Rows
|
|
|
|
If Gvr.FCCheckBox("ChkCxC").Checked Then
|
|
|
|
If Gvr.FCCheckBox("ChkCxC").Checked Then
|
|
|
|
DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal), True, MissingSchemaAction.Ignore)
|
|
|
|
DtImpuestos.Merge(CargaDtImpuestosNC(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal), True, MissingSchemaAction.Ignore)
|
|
|
|
@@ -20586,6 +20695,7 @@ Partial Class Ventas
|
|
|
|
CargaNCDT(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal)
|
|
|
|
CargaNCDT(Gvr.DataKey("CveVenta").ToString.ToEntero, Gvr.FCTextBox("TxtImporte").Text.ToString.ToDecimal)
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
Next
|
|
|
|
Next
|
|
|
|
|
|
|
|
End If
|
|
|
|
Else
|
|
|
|
Else
|
|
|
|
DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal)
|
|
|
|
DtImpuestos = CargaDtImpuestosNC(CveVenta, TxtNCImporte.Text.Trim.ToDecimal)
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
@@ -20613,16 +20723,25 @@ Partial Class Ventas
|
|
|
|
Exit Sub
|
|
|
|
Exit Sub
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DtImpuestos = query.QueryToDataTable(False)
|
|
|
|
DtImpuestos = query.QueryToDataTable(False)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Not NCDescuento Then
|
|
|
|
LimpiaDocumentoNC()
|
|
|
|
LimpiaDocumentoNC()
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
Dim CveSubProyecto = DrSubProyecto("CveSubProyecto").ToString.ToEntero
|
|
|
|
Dim CveSubProyecto = DrSubProyecto("CveSubProyecto").ToString.ToEntero
|
|
|
|
Dim SubProyecto = DrSubProyecto("SubProyecto").ToString
|
|
|
|
Dim SubProyecto = DrSubProyecto("SubProyecto").ToString
|
|
|
|
Dim CveProyecto = DrSubProyecto("CveProyecto").ToString.ToEntero
|
|
|
|
Dim CveProyecto = DrSubProyecto("CveProyecto").ToString.ToEntero
|
|
|
|
Dim Proyecto = DrSubProyecto("Proyecto").ToString
|
|
|
|
Dim Proyecto = DrSubProyecto("Proyecto").ToString
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AplicaNC = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Not NCDescuento Then
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If DdlTipoComprobante.SelectedValue = "Ant" Then CveAnticipo = CveVenta
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
DdlTipoComprobante.SelectedValueExist("Egs")
|
|
|
|
|
|
|
|
|
|
|
|
For Each Dr As DataRow In DtImpuestos.Rows
|
|
|
|
For Each Dr As DataRow In DtImpuestos.Rows
|
|
|
|
AgregaTempDT(DrPS("CvePS").ToString.ToEntero, DrPS("PS").ToString, DrPS("Codigo").ToString, DrPS("PSCodigo").ToString, DrPS("CveTipoPS").ToString.ToEntero, DrPS("Inv_CveMetodoInventario").ToString.ToEntero,
|
|
|
|
AgregaTempDT(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,
|
|
|
|
DrPS("CveUM").ToString.ToEntero, DrPS("UnidadMedida").ToString, DrPS("CveClasificacion").ToString.ToEntero, DrPS("Clasificacion").ToString, CveProyecto, Proyecto, CveSubProyecto, SubProyecto,
|
|
|
|
@@ -20631,22 +20750,19 @@ Partial Class Ventas
|
|
|
|
DrPS("SATClavePS").ToString, DrPS("SATClaveUnidadMedida").ToString, -1, -1, -1, -1, -1, -1)
|
|
|
|
DrPS("SATClavePS").ToString, DrPS("SATClaveUnidadMedida").ToString, -1, -1, -1, -1, -1, -1)
|
|
|
|
Next
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
|
|
TrTipoRelacion.Visible = True
|
|
|
|
|
|
|
|
DdlTiposRelacion.SelectedValueExist("1")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
GvPS.DataSource = TmpDT
|
|
|
|
GvPS.DataSource = TmpDT
|
|
|
|
GvPS.DataBind()
|
|
|
|
GvPS.DataBind()
|
|
|
|
|
|
|
|
|
|
|
|
CalculaTotalesVenta(True)
|
|
|
|
CalculaTotalesVenta(True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
TrTipoRelacion.Visible = True
|
|
|
|
|
|
|
|
DdlTiposRelacion.SelectedValueExist("1")
|
|
|
|
|
|
|
|
|
|
|
|
'condicióon, en la que se verifica que el importe total de aplicación de la nota de crédito sea igual al del total de la nota de crédito, ej. saldo de la factura 1000.01 y la nota de crédito se generó po 1000.00
|
|
|
|
'condicióon, en la que se verifica que el importe total de aplicación de la nota de crédito sea igual al del total de la nota de crédito, ej. saldo de la factura 1000.01 y la nota de crédito se generó po 1000.00
|
|
|
|
If Not AplicaNCMasiva Then
|
|
|
|
If Not AplicaNCMasiva Then
|
|
|
|
Dim TT As Decimal = TxtNCImporte.Text.ToDecimal
|
|
|
|
Dim TT As Decimal = TxtNCImporte.Text.ToDecimal
|
|
|
|
If TT > TxtTotal.Text.ToDecimal Then TT = TxtTotal.Text.ToDecimal
|
|
|
|
If TT > TxtTotal.Text.ToDecimal Then TT = TxtTotal.Text.ToDecimal
|
|
|
|
CargaNCDT(CveVenta, TT)
|
|
|
|
CargaNCDT(CveVenta, TT)
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
'verifica el tipo de cambio que se actualice
|
|
|
|
'verifica el tipo de cambio que se actualice
|
|
|
|
If DdlMoneda.SelectedValue <> "1" Then
|
|
|
|
If DdlMoneda.SelectedValue <> "1" Then
|
|
|
|
@@ -20656,11 +20772,10 @@ Partial Class Ventas
|
|
|
|
UpPS.Update()
|
|
|
|
UpPS.Update()
|
|
|
|
|
|
|
|
|
|
|
|
LBNotaCredito.Visible = False
|
|
|
|
LBNotaCredito.Visible = False
|
|
|
|
RegistraScript("$('#ModalAplicarNC').modal('hide');", "EscondeModalNC")
|
|
|
|
|
|
|
|
AplicaNC = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
CambiaTipoDocto()
|
|
|
|
CambiaTipoDocto()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal) As DataTable
|
|
|
|
Private Function CargaDtImpuestosNC(CveVentaNC As Integer, Importe As Decimal) As DataTable
|
|
|
|
@@ -20684,8 +20799,6 @@ Partial Class Ventas
|
|
|
|
Else
|
|
|
|
Else
|
|
|
|
Total = TxtTotal.Text.ToDecimal
|
|
|
|
Total = TxtTotal.Text.ToDecimal
|
|
|
|
SubTotal = TxtSubTotal.Text.ToDecimal
|
|
|
|
SubTotal = TxtSubTotal.Text.ToDecimal
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
ObjVentas.Dispose()
|
|
|
|
|
|
|
|
|
|
|
|
@@ -22061,7 +22174,10 @@ Partial Class Ventas
|
|
|
|
Protected Sub BtnGuardarRemisiones_Click(sender As Object, e As EventArgs) Handles BtnGuardarRemisiones.Click
|
|
|
|
Protected Sub BtnGuardarRemisiones_Click(sender As Object, e As EventArgs) Handles BtnGuardarRemisiones.Click
|
|
|
|
If GvRem.Rows.Count > 0 Or GvRemPS.Rows.Count > 0 Then
|
|
|
|
If GvRem.Rows.Count > 0 Or GvRemPS.Rows.Count > 0 Then
|
|
|
|
'Checa las facturas selecionadas
|
|
|
|
'Checa las facturas selecionadas
|
|
|
|
VerificaRemisiones(DTRemisiones)
|
|
|
|
If Not VerificaRemisiones(DTRemisiones) Then
|
|
|
|
|
|
|
|
Alert("La cantidad/total debe ser mayor que 0", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
|
|
|
Exit Sub
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
Dim dtSeleccionadas As DataTable = DTRemisiones.FiltraParametros("Aplicado = True")
|
|
|
|
Dim dtSeleccionadas As DataTable = DTRemisiones.FiltraParametros("Aplicado = True")
|
|
|
|
Dim CveContrato = DTRemisiones.FiltroPrimeroValor("CveContrato", "Aplicado = True").ToEntero
|
|
|
|
Dim CveContrato = DTRemisiones.FiltroPrimeroValor("CveContrato", "Aplicado = True").ToEntero
|
|
|
|
@@ -22231,8 +22347,17 @@ Partial Class Ventas
|
|
|
|
|
|
|
|
|
|
|
|
RegistraScript("$('#DivRemisiones').modal('hide');", "DivRemisionesHide")
|
|
|
|
RegistraScript("$('#DivRemisiones').modal('hide');", "DivRemisionesHide")
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
Private Sub VerificaRemisiones(ByRef dt As DataTable)
|
|
|
|
Private Function VerificaRemisiones(ByRef dt As DataTable) As Boolean
|
|
|
|
|
|
|
|
Dim Valido As Boolean = True
|
|
|
|
If ChkRemProductos.Checked Then
|
|
|
|
If ChkRemProductos.Checked Then
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Valido = Not (From GvRow In GvRemPS.Rows.Cast(Of GridViewRow)
|
|
|
|
|
|
|
|
Let Cantidad = GvRow.FCTextBox("TxtCantidadRem").Text.Trim().ToEntero(), Aplicar = GvRow.FCCheckBox("Chk").Checked
|
|
|
|
|
|
|
|
Where GvRow.RowType = DataControlRowType.DataRow AndAlso Cantidad <= 0 AndAlso Aplicar
|
|
|
|
|
|
|
|
Select GvRow
|
|
|
|
|
|
|
|
).Any
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If Valido Then
|
|
|
|
For Each Gvr As GridViewRow In GvRemPS.Rows
|
|
|
|
For Each Gvr As GridViewRow In GvRemPS.Rows
|
|
|
|
If Gvr.RowType = DataControlRowType.DataRow Then
|
|
|
|
If Gvr.RowType = DataControlRowType.DataRow Then
|
|
|
|
Dim ChkAplicar As CheckBox = Gvr.FCCheckBox("Chk")
|
|
|
|
Dim ChkAplicar As CheckBox = Gvr.FCCheckBox("Chk")
|
|
|
|
@@ -22244,6 +22369,8 @@ Partial Class Ventas
|
|
|
|
dt.AcceptChanges()
|
|
|
|
dt.AcceptChanges()
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
Next
|
|
|
|
Next
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
Else
|
|
|
|
Else
|
|
|
|
For Each Gvr As GridViewRow In GvRem.Rows
|
|
|
|
For Each Gvr As GridViewRow In GvRem.Rows
|
|
|
|
If Gvr.RowType = DataControlRowType.DataRow Then
|
|
|
|
If Gvr.RowType = DataControlRowType.DataRow Then
|
|
|
|
@@ -22257,7 +22384,9 @@ Partial Class Ventas
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
Next
|
|
|
|
Next
|
|
|
|
End If
|
|
|
|
End If
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
Return Valido
|
|
|
|
|
|
|
|
End Function
|
|
|
|
Private Sub CargaConceptosRemisionPorFacturar(CveRemisiones As String, TipoCargas As Integer)
|
|
|
|
Private Sub CargaConceptosRemisionPorFacturar(CveRemisiones As String, TipoCargas As Integer)
|
|
|
|
Dim ObjClientes As New ClsClientes
|
|
|
|
Dim ObjClientes As New ClsClientes
|
|
|
|
If ObjClientes.GetVentasRemisionesTotales(CveCliente, CveRemisiones, TipoCargas) Then
|
|
|
|
If ObjClientes.GetVentasRemisionesTotales(CveCliente, CveRemisiones, TipoCargas) Then
|
|
|
|
@@ -22877,7 +23006,7 @@ Partial Class Ventas
|
|
|
|
CambiaTipoDocto()
|
|
|
|
CambiaTipoDocto()
|
|
|
|
CambiaSucursalGeneral()
|
|
|
|
CambiaSucursalGeneral()
|
|
|
|
CargaAnticipos(CveCliente)
|
|
|
|
CargaAnticipos(CveCliente)
|
|
|
|
CargaRestriccionesCreditoCliente()
|
|
|
|
CargaRestriccionesCreditoCliente(CveVenta:=-1)
|
|
|
|
UpParametros.Update()
|
|
|
|
UpParametros.Update()
|
|
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
@@ -23274,4 +23403,158 @@ Partial Class Ventas
|
|
|
|
RegistraScript("CerrarModalRemNC();")
|
|
|
|
RegistraScript("CerrarModalRemNC();")
|
|
|
|
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Protected Sub LnkDescuentosRNC_Click(sender As Object, e As EventArgs)
|
|
|
|
|
|
|
|
CargaDescRNC()
|
|
|
|
|
|
|
|
RegistraScript("$('#ModalAplicarDescuentoNC').modal('show'); ")
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
Protected Sub BtnAplicarDesc_Click(sender As Object, e As EventArgs)
|
|
|
|
|
|
|
|
Dim CveSATNC = "84111506"
|
|
|
|
|
|
|
|
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).Rows(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If DrPS Is Nothing Then
|
|
|
|
|
|
|
|
Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
|
|
|
|
|
|
|
Exit Sub
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AplicaNCMasiva = True
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If ListaNCDesc Is Nothing Then
|
|
|
|
|
|
|
|
ListaNCDesc = New List(Of Modelos.Factura)
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
|
|
|
ListaNCDesc.Clear()
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim TotalRemNCAplicado As Decimal = 0
|
|
|
|
|
|
|
|
For Each GvRow As GridViewRow In GvDescNC.Rows
|
|
|
|
|
|
|
|
If GvRow.RowType = DataControlRowType.DataRow Then
|
|
|
|
|
|
|
|
If GvRow.FCCheckBox("ChkAplicar").Checked Then
|
|
|
|
|
|
|
|
Dim RemNC As New Modelos.Factura(UsuarioActual, GvRow.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
|
|
|
|
|
|
|
|
RemNC.TotalRemNCAplicado = GvRow.FCTextBox("TxtImporte").Text.ToDecimal()
|
|
|
|
|
|
|
|
TotalRemNCAplicado += RemNC.TotalRemNCAplicado
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If RemNC.TotalRemNCAplicado <= 0 Then
|
|
|
|
|
|
|
|
Alert($"Debe asignar un importe en la siguiente remisión: <b>{RemNC.SerieFolio}</b>", TipoMensaje.MsgAdvertencia)
|
|
|
|
|
|
|
|
ListaNCDesc.Clear()
|
|
|
|
|
|
|
|
Exit Sub
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ListaNCDesc.Add(RemNC)
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
Next
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
LblDescuentosRNC.Text = TotalRemNCAplicado.FormatoNumero
|
|
|
|
|
|
|
|
LblTotalNC.Text = (TxtTotal.Text.ToDecimal() - TotalRemNCAplicado).FormatoNumero
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim CvePS = DrPS("CvePS").ToString().ToEntero()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
AplicarNC(CvePS, True)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
UpPS.Update()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
RegistraScript("$('#ModalAplicarDescuentoNC').modal('hide'); ")
|
|
|
|
|
|
|
|
End Sub
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Protected Function CreaDTDetalleNCDescuento() As DataTable
|
|
|
|
|
|
|
|
Dim Dt As DataTable = TmpDT.Clone()
|
|
|
|
|
|
|
|
Dt.Rows.Clear()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim CveSATNC = "84111506"
|
|
|
|
|
|
|
|
Dim DrPS = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1).Rows(0)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If DrPS Is Nothing Then
|
|
|
|
|
|
|
|
Alert("Ocurrió un error al cargar la información del Producto. Por favor vuelva a intentar.", TipoMensaje.MsgError)
|
|
|
|
|
|
|
|
Return Dt
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
Dim CvePS = DrPS("CvePS").ToString().ToEntero()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim TotalCalculableImpuestos As Decimal = 0
|
|
|
|
|
|
|
|
Dim PU = Math.Round(ListaNCDesc.Sum(Function(RNC) RNC.TotalRemNCAplicado), 6) ' el precio unitario puede llevar hasta 6 decimales permitidos
|
|
|
|
|
|
|
|
Dim Cantidad As Decimal = 1
|
|
|
|
|
|
|
|
Dim Descuento As Decimal = 0
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Dim Row As DataRow = Dt.NewRow()
|
|
|
|
|
|
|
|
Row("CveProyecto") = DdlProyecto.SelectedValue.ToEntero()
|
|
|
|
|
|
|
|
Row("Proyecto") = DdlProyecto.SelectedItem.Text
|
|
|
|
|
|
|
|
Row("CveSubProyecto") = DdlSubProyecto.SelectedValue.ToEntero()
|
|
|
|
|
|
|
|
Row("SubProyecto") = DdlSubProyecto.SelectedItem.Text
|
|
|
|
|
|
|
|
Row("SerieLote") = "-1"
|
|
|
|
|
|
|
|
Row("TiempoEntrega") = ""
|
|
|
|
|
|
|
|
Row("Orden") = Dt.Rows.Count + 1
|
|
|
|
|
|
|
|
Row("Cantidad") = Cantidad
|
|
|
|
|
|
|
|
Row("CveUM") = DrPS("CveUM").ToString().ToEntero()
|
|
|
|
|
|
|
|
Row("UM") = ""
|
|
|
|
|
|
|
|
Row("CveClasificacion") = DrPS("CveClasificacion").ToString().ToEntero()
|
|
|
|
|
|
|
|
Row("Clasificacion") = ""
|
|
|
|
|
|
|
|
Row("CvePS") = CvePS
|
|
|
|
|
|
|
|
Row("Obs") = ""
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
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
|
|
|
|
|
|
|
|
Row("Consec") = TmpDT.Rows.Count + 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")
|
|
|
|
|
|
|
|
Row("CveClasificacion") = DrPS("CveClasificacion")
|
|
|
|
|
|
|
|
Row("Clasificacion") = DrPS("Clasificacion")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If DrPS("IVA").ToString.Contiene("-1", "") Then
|
|
|
|
|
|
|
|
Row("PorcentajeIVA") = PorcentajeIVA
|
|
|
|
|
|
|
|
Else
|
|
|
|
|
|
|
|
Row("PorcentajeIVA") = DrPS("IVA")
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Row("IVA") = Row("PorcentajeIVA")
|
|
|
|
|
|
|
|
Row("ImporteIVA") = Math.Round(Row("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
|
|
|
|
|
|
|
Row("ImporteRetIVA") = Math.Round(ClienteRetIVA * TotalCalculableImpuestos, NumeroDecimales)
|
|
|
|
|
|
|
|
Row("ImporteRetISR") = Math.Round(ClienteRetISR * TotalCalculableImpuestos, NumeroDecimales)
|
|
|
|
|
|
|
|
Row("PorcentajeRetIVA") = ClienteRetIVA
|
|
|
|
|
|
|
|
Row("PorcentajeRetISR") = ClienteRetISR
|
|
|
|
|
|
|
|
Row("PorcentajeIEPS") = DrPS("IEPSPorcentaje")
|
|
|
|
|
|
|
|
Row("ImporteIEPS") = Math.Round(DrPS("IEPSPorcentaje").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
|
|
|
|
|
|
|
|
Row("IEPS") = Row("ImporteIEPS")
|
|
|
|
|
|
|
|
Row("Descuento") = Math.Round(Descuento, NumeroDecimales)
|
|
|
|
|
|
|
|
Row("TipoDescuento") = HdnTipoDescuento.Value
|
|
|
|
|
|
|
|
Row("Total") = (Cantidad * PU)
|
|
|
|
|
|
|
|
Row("TotalImporte") = Math.Round(Cantidad * PU, NumeroDecimales)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Row("SATClaveProdServ") = DrPS("SATClavePS")
|
|
|
|
|
|
|
|
Row("SATClaveUM") = DrPS("SATClaveUnidadMedida")
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
If UsuarioActual.Empresa.UsaAC Then
|
|
|
|
|
|
|
|
Row("CvePresupuestoIngreso") = Me.DdlFuenteRecaudacion.SelectedValue
|
|
|
|
|
|
|
|
End If
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Row("EntregaDirecta") = -1
|
|
|
|
|
|
|
|
'Contratos
|
|
|
|
|
|
|
|
Row("CveContratoDetalle") = -1
|
|
|
|
|
|
|
|
Row("CveVentaDetalle") = -1
|
|
|
|
|
|
|
|
Row("CveMovimientoDetallePedido") = -1
|
|
|
|
|
|
|
|
Row("CveOrdenCompraDetalle") = -1
|
|
|
|
|
|
|
|
Row("CveVentaDetalleRemision") = -1
|
|
|
|
|
|
|
|
Row("CveVentaDetalleCotizacion") = -1
|
|
|
|
|
|
|
|
Row("CveVentaDetallePedido2") = -1
|
|
|
|
|
|
|
|
Row("CuentaPredial") = "-1"
|
|
|
|
|
|
|
|
Row("Consec") = 1
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
'RECARGAR GV
|
|
|
|
|
|
|
|
Dt.Rows.Add(Row)
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Return Dt
|
|
|
|
|
|
|
|
End Function
|
|
|
|
End Class
|
|
|
|
End Class
|