Merge branch 'master' of http://agonzalez@192.168.10.111:8383/SIG.git
This commit is contained in:
@@ -475,6 +475,29 @@ Public Class ClsContabilidad
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
Public Function TraspasarSaldosPrePolizasRefacturacion(CveVenta As Integer, CveVentaNueva As Integer, CvePrePolizaNueva As Integer, CvePlantillaPoliza As Integer, CveEmpresa As Integer) As Boolean
|
||||
|
||||
Dim Retorno As Boolean = False
|
||||
|
||||
DataAdapter("PA_Conta_PrePolizasSaldosRefacturacionTraspasar")
|
||||
|
||||
With SqlAdapter.SelectCommand.Parameters
|
||||
.Add("@CveVenta", SqlDbType.Int).Value = CveVenta
|
||||
.Add("@CveVentaNueva", SqlDbType.Int).Value = CveVentaNueva
|
||||
.Add("@CvePrePolizaNueva", SqlDbType.Int).Value = CvePrePolizaNueva
|
||||
.Add("@CvePlantillaPoliza", SqlDbType.Int).Value = CvePlantillaPoliza
|
||||
.Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa
|
||||
End With
|
||||
|
||||
Try
|
||||
SqlAdapter.Fill(Data)
|
||||
Retorno = True
|
||||
Catch ex As Exception
|
||||
OnError("Ocurrió un error al traspasar el saldo al refacturar", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo)
|
||||
End Try
|
||||
|
||||
Return Retorno
|
||||
End Function
|
||||
''' <param name="CveVenta">Venta a la que se le van a cancelar los pagos</param>
|
||||
''' <param name="CvePrePoliza">PrePoliza donde van a quedar los movimientos (No necesariamente la PrePoliza de la venta)</param>
|
||||
''' <returns></returns>
|
||||
|
||||
@@ -4025,7 +4025,7 @@ Namespace Modelos
|
||||
End If
|
||||
|
||||
'LA VALIDACION DE SALDOS CUANDO ES REFACTURACION SE HACE ANTES ASI QUE SI ES REFACTURACION IGNORAMOS ESTA CONDICION, SI ES ANTICIPO VERIFICA QUE NO ESTÉ APLICADO
|
||||
If ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Rem") AndAlso ObjFactura.Pagado > 0 AndAlso DTDocumentosRelacionados.Rows.Count > 0 Then
|
||||
If Not EsRefacturacion AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant", "Rem") AndAlso ObjFactura.Pagado > 0 AndAlso DTDocumentosRelacionados.Rows.Count > 0 Then
|
||||
Retorno.Mensaje = "La factura no se puede cancelar debido a que tiene pagos vinculados."
|
||||
Retorno.TipoMensaje = TipoMensaje.MsgAdvertencia
|
||||
|
||||
|
||||
@@ -1374,6 +1374,14 @@ Partial Class Ventas
|
||||
ViewState("ObjFacturaDevolucion") = value
|
||||
End Set
|
||||
End Property
|
||||
Private Property ObjFacturaNC As Modelos.Factura
|
||||
Get
|
||||
Return CType(ViewState("ObjFacturaNC"), Modelos.Factura)
|
||||
End Get
|
||||
Set(value As Modelos.Factura)
|
||||
ViewState("ObjFacturaNC") = value
|
||||
End Set
|
||||
End Property
|
||||
#End Region
|
||||
|
||||
#Region " PROPIEDADES NUEVAS "
|
||||
@@ -5598,8 +5606,12 @@ Partial Class Ventas
|
||||
Else
|
||||
DTFacNC = Nothing
|
||||
End If
|
||||
|
||||
ObjClientes.Dispose()
|
||||
|
||||
Me.ObjFacturaNC = Nothing
|
||||
Me.ObjFacturaNC = New Modelos.Factura(UsuarioActual, pCveVenta, UsuarioActual.CveEmpresa, DirectorioServidor:=Server.MapPath("/"), EsCancelacion:=False)
|
||||
|
||||
DdlNCFactura.DataSource = DTFacNC
|
||||
DdlNCFactura.DataBind()
|
||||
|
||||
@@ -5633,14 +5645,18 @@ Partial Class Ventas
|
||||
Dim CveSATNC = "84111506"
|
||||
Dim dtt As New DataTable
|
||||
dtt = GlobalDTPS(UsuarioActual.CveEmpresa, SATClavePS:=CveSATNC, AplicaParaVenta:=1) ', SATClavePS:=CveSATNC
|
||||
DdlNCPS.DataSource = dtt
|
||||
DdlNCPS.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlNCPS.DataBind()
|
||||
|
||||
DdlNCPSAnt.DataSource = dtt
|
||||
DdlNCPSAnt.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlNCPSAnt.DataBind()
|
||||
dtt.Dispose()
|
||||
If dtt IsNot Nothing Then
|
||||
DdlNCPS.DataSource = dtt
|
||||
DdlNCPS.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlNCPS.DataBind()
|
||||
|
||||
DdlNCPSAnt.DataSource = dtt
|
||||
DdlNCPSAnt.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||
DdlNCPSAnt.DataBind()
|
||||
dtt.Dispose()
|
||||
End If
|
||||
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
@@ -6958,12 +6974,12 @@ Partial Class Ventas
|
||||
If ErrorList.Count = 0 Then
|
||||
If NuevaFactura = 1 Then
|
||||
'Si directamente como cancelada sin aceptación, debe de generar la cancelacion aquí
|
||||
If Me.CveEstatusRefacturacion = 0 Then ' cuando es refacturación sin aceptación debe de cancelar y reducir saldo
|
||||
ObjNC = generaNC(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, ObjEventos)
|
||||
If ObjNC Is Nothing Then
|
||||
ErrorList.Add("No se pudo Cancelar la Factura")
|
||||
End If
|
||||
End If
|
||||
'If Me.CveEstatusRefacturacion = 0 Then ' cuando es refacturación sin aceptación debe de cancelar y reducir saldo
|
||||
' ObjNC = generaNC(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, ObjEventos)
|
||||
' If ObjNC Is Nothing Then
|
||||
' ErrorList.Add("No se pudo Cancelar la Factura")
|
||||
' End If
|
||||
'End If
|
||||
'Esquema viejo, evitamos que aparezca por surtir
|
||||
If ErrorList.Count = 0 Then
|
||||
If VentaSaldoAlmacenNC <> 0 OrElse DevolucionAlmacenNC = 2 Then
|
||||
@@ -8451,6 +8467,7 @@ Partial Class Ventas
|
||||
If UsuarioActual.Empresa.Funcionalidad(579) = "1" Then
|
||||
ObjFactura.CveTipoRetencion = DdlTipoRetencion.SelectedValue.ToEntero()
|
||||
End If
|
||||
ObjFactura.NuevaFactura = Me.NuevaFactura
|
||||
End Sub
|
||||
|
||||
Private Sub CreaObjetosVentaDevolucion()
|
||||
@@ -9650,12 +9667,16 @@ Partial Class Ventas
|
||||
'prepoliza
|
||||
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento)
|
||||
If ErrorList.Count = 0 Then
|
||||
'inventarios
|
||||
If Not EsNCAmortizacion AndAlso Not NCDescuento Then
|
||||
If GuardarVentaInventarios(ObjInventario, ObjConta, factura) Then
|
||||
ErrorList.Add("Ocurrio un error al Guardar Inventario")
|
||||
|
||||
'INVENTARIOS
|
||||
If ErrorList.Count = 0 Then
|
||||
If Not EsNCAmortizacion AndAlso Not NCDescuento Then
|
||||
If GuardarVentaInventarios(ObjInventario, ObjConta, factura) Then
|
||||
ErrorList.Add("Ocurrio un error al Guardar Inventario")
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If ErrorList.Count = 0 Then
|
||||
'estimaciones
|
||||
GuardarVentaEstimaciones(ObjContr, factura)
|
||||
@@ -9678,7 +9699,7 @@ Partial Class Ventas
|
||||
|
||||
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 Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False)
|
||||
ByRef Optional ObjEventos As ClsOIEventos = Nothing, Optional EsNCAmortizacion As Boolean = False, Optional NCDescuento As Boolean = False, Optional ValorMultiplicador As Integer = 1)
|
||||
|
||||
Dim CveIE As Integer = -1
|
||||
Dim DT As DataTable = Nothing
|
||||
@@ -9697,7 +9718,7 @@ Partial Class Ventas
|
||||
If DdlTipoComprobante.SelectedValue <> "Cot" Then
|
||||
If factura.CvePrePoliza > 0 Then
|
||||
|
||||
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, 1, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento) Then
|
||||
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, ValorMultiplicador, 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")
|
||||
End If
|
||||
|
||||
@@ -10894,6 +10915,13 @@ Partial Class Ventas
|
||||
|
||||
End If
|
||||
|
||||
'TRASPASA PAGADO
|
||||
If ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso ObjFactura.NuevaFactura = 1 Then
|
||||
If Not ObjConta.TraspasarSaldosPrePolizasRefacturacion(ObjFacturaNC.CveVenta, ObjFactura.CveVenta, ObjFactura.CvePrePoliza, CvePlantilaPoliza, UsuarioActual.CveEmpresa) Then
|
||||
ErrorList.Add("Ocurrió un error al agregar la bitacora de Póliza Virtual.")
|
||||
End If
|
||||
End If
|
||||
|
||||
'Si es Facturacion de una remision cancelamos, traspasamos saldos y agregamos evento a la bitacora
|
||||
If RemisionesLista.Count > 0 AndAlso ObjFactura.TipoDocto.Contiene("Ing", "Ant") Then
|
||||
|
||||
@@ -10902,9 +10930,8 @@ Partial Class Ventas
|
||||
ErrorPrepoliza = True
|
||||
ErrorList.Add("No se pueden facturar las remisiones, con ese tipo de comprobante seleccionado")
|
||||
Else
|
||||
|
||||
|
||||
For Each CveRemision As Integer In RemisionesLista
|
||||
|
||||
If Not ObjConta.TraspasarSaldosRemision(CveRemision, ObjFactura.CvePrePoliza, ObjFactura.CveVenta) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
@@ -21727,9 +21754,11 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
If Not AplicaImpuestosLocales Then
|
||||
TmpDTImpuestos.Rows.Clear()
|
||||
GvImpuestosLocales2.DataSource = TmpDTImpuestos
|
||||
GvImpuestosLocales2.DataBind()
|
||||
If TmpDTImpuestos IsNot Nothing Then
|
||||
TmpDTImpuestos.Rows.Clear()
|
||||
GvImpuestosLocales2.DataSource = TmpDTImpuestos
|
||||
GvImpuestosLocales2.DataBind()
|
||||
End If
|
||||
End If
|
||||
|
||||
'CREAMOS DT PARA UTILIZAR AL TIMBRAR
|
||||
|
||||
Reference in New Issue
Block a user