quitar llamados clscontpaqi
This commit is contained in:
@@ -9649,18 +9649,10 @@ Partial Class Ventas
|
||||
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())
|
||||
ErrorList = New List(Of String)
|
||||
MensajeAlert = New StringBuilder
|
||||
|
||||
|
||||
'CONTABILIDAD AUTOMATICA Y AC
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC Then
|
||||
ObjContPaq = New ClsContPAQi(UsuarioActual.Empresa)
|
||||
ObjContPaq.IniciaTransacSQL()
|
||||
End If
|
||||
|
||||
'VERIFICA QUE EL FOLIO NO SEA IGUAL AL DE LA FACTURA ANTERIOR
|
||||
'If ObjFactura.Folio = TxtFolio.Text.ToEntero() Then
|
||||
' If ObjFolios.GetFolios(ObjFactura.TipoDocto, UsuarioActual.CveEmpresa) Then
|
||||
@@ -9718,7 +9710,7 @@ Partial Class Ventas
|
||||
|
||||
Dim CveTimbreCartaPorte As Integer = -1
|
||||
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS,
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjBancos, ObjOS,
|
||||
ObjEventos, ObjCGame, ObjClientes, EsNCAmortizacion:=EsNCAmortizacion, CveAnticipoPadre:=CveAnticipoPadre)
|
||||
|
||||
If ErrorList.Count = 0 AndAlso ChkEmitirCartaPorte.Checked AndAlso ObjFactura.TipoDocto = "Ing" Then
|
||||
@@ -9817,10 +9809,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
DtMovDetalles.Dispose()
|
||||
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -9845,7 +9834,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, ObjAcum, ObjContr, ObjContPaq, ObjFacturaDevolucion, ObjBancos, Nothing,
|
||||
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, ObjFacturaDevolucion, ObjBancos, Nothing,
|
||||
Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDesc, IndexNC:=(If(DtVentasNC IsNot Nothing, DtVentasNC.Rows.Count - 1, 0))) Then
|
||||
ListaNotasCreditoGeneradas.Add(ObjFacturaDevolucion)
|
||||
End If
|
||||
@@ -9858,7 +9847,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
CreaObjetosVentaBonificacion(ObjVentas, FolioFiscalRelacionado, CveVentaRelacionada, NCDescuento:=NCDescuento)
|
||||
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, ObjContPaq, ObjFacturaBonificacion, ObjBancos, Nothing,
|
||||
If RegistrarNCAmortizacion(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, ObjFacturaBonificacion, ObjBancos, Nothing,
|
||||
Nothing, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCBonificacion, IndexNC:=(DtVentasNC.Rows.Count - 1)) Then
|
||||
ListaNotasCreditoGeneradas.Add(ObjFacturaBonificacion)
|
||||
End If
|
||||
@@ -9884,7 +9873,7 @@ Partial Class Ventas
|
||||
|
||||
If (ImportePagado + ImporteRNC + ObjFactura.DescuentoProntoPago) >= ObjFactura.Total Then
|
||||
|
||||
Dim RespFacturaProntoPago = GenerarNCProntoPago(ObjVentas.IniciaTransacSQL(), ObjClientes, ObjContPaq, ObjFactura)
|
||||
Dim RespFacturaProntoPago = GenerarNCProntoPago(ObjVentas.IniciaTransacSQL(), ObjClientes, ObjFactura)
|
||||
|
||||
If RespFacturaProntoPago.ObjFacturaProntoPago Is Nothing OrElse RespFacturaProntoPago Is Nothing Then
|
||||
ErrorList.Add("No se pudo generar la nota de crédito de pronto pago")
|
||||
@@ -9901,8 +9890,6 @@ Partial Class Ventas
|
||||
Else
|
||||
ErrorList.Add("No se pudo generar la nota de crédito de pronto pago, no coiciden los pagos con el total a pagar de la factura")
|
||||
End If
|
||||
|
||||
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(558) = "1" AndAlso ErrorList.Count = 0 AndAlso ObjFactura.TipoDocto = "Ing" Then
|
||||
@@ -9934,7 +9921,7 @@ Partial Class Ventas
|
||||
|
||||
If ErrorList.Count = 0 Then
|
||||
If ObjFactura.CveVenta > 0 And CveAlmacenExistenciasContrato > 0 And DdlTipoComprobante.SelectedValue = "Ing" Then
|
||||
If Not RegistraAlmacenConsignacionVenta(ObjInventario, ObjConta, ObjFactura, ObjContPaq) Then
|
||||
If Not RegistraAlmacenConsignacionVenta(ObjInventario, ObjConta, ObjFactura) Then
|
||||
ErrorList.Add("Ocurrió un error al registrar los movimientos de almacén del contrato de consignación")
|
||||
End If
|
||||
End If
|
||||
@@ -10052,7 +10039,7 @@ Partial Class Ventas
|
||||
|
||||
Try
|
||||
If AutoConta Then
|
||||
If Not ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContPaq) Then
|
||||
If Not ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa) Then
|
||||
ErrorList.Add("Ocurrió un error al contabilizar, pongase en contacto con soporte técnico")
|
||||
End If
|
||||
End If
|
||||
@@ -10063,7 +10050,6 @@ Partial Class Ventas
|
||||
|
||||
If ObjFactura.CveVenta > 0 AndAlso ErrorList.Count = 0 AndAlso (SeGuardoPrePoliza Or ObjFactura.TipoDocto.Contiene("Ped", "Cot", "DPe", "PeC", "PA", "Pd2")) Then
|
||||
ObjVentas.Commit()
|
||||
If ObjContPaq IsNot Nothing Then ObjContPaq.Commit()
|
||||
|
||||
'ENVIAR POLIZA VIRTUAL
|
||||
If ErrorList.Count = 0 Then
|
||||
@@ -10488,7 +10474,6 @@ Partial Class Ventas
|
||||
|
||||
Else
|
||||
ObjVentas.RollBack()
|
||||
If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
|
||||
|
||||
For Each ErrorItem In ErrorList
|
||||
Alert(ErrorItem, TipoMensaje.MsgAdvertencia)
|
||||
@@ -10509,13 +10494,11 @@ Partial Class Ventas
|
||||
ErrorList.Clear()
|
||||
ErrorList = Nothing
|
||||
MensajeAlert = Nothing
|
||||
If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
|
||||
TmpDT = TmpDTError.Copy
|
||||
CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
|
||||
Else
|
||||
ObjVentas.RollBack()
|
||||
If ObjContPaq IsNot Nothing Then ObjContPaq.RollBack()
|
||||
|
||||
For Each ErrorItem In ErrorList
|
||||
Alert(ErrorItem, TipoMensaje.MsgAdvertencia)
|
||||
@@ -10533,7 +10516,7 @@ Partial Class Ventas
|
||||
ErrorList.Clear()
|
||||
ErrorList = Nothing
|
||||
MensajeAlert = Nothing
|
||||
If ObjContPaq IsNot Nothing Then ObjContPaq.Dispose()
|
||||
|
||||
TmpDT = TmpDTError.Copy
|
||||
CalculaTotalesVenta(RecalcularTotalOriginal:=False)
|
||||
End If
|
||||
@@ -11134,7 +11117,7 @@ Partial Class Ventas
|
||||
End Sub
|
||||
|
||||
|
||||
Private Function RegistrarNCAmortizacion(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjAcum As ClsAcumuladores, ObjContr As ClsContratos, ObjContPaq As ClsContPAQi,
|
||||
Private Function RegistrarNCAmortizacion(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjInventario As ClsInventarios, ObjAcum As ClsAcumuladores, ObjContr As ClsContratos,
|
||||
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
|
||||
@@ -11170,7 +11153,7 @@ Partial Class Ventas
|
||||
|
||||
factura.CveVentaPadre = Me.CveVenta
|
||||
'Registramos la venta
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, factura, factura.DtDetalle, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=False, NCDescuento:=True, ListaNCDescuento:=ListaNCDescuento)
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, factura, factura.DtDetalle, -1, ObjBancos, EsNCAmortizacion:=False, NCDescuento:=True, ListaNCDescuento:=ListaNCDescuento)
|
||||
|
||||
Else
|
||||
'GENERO LOS DATOS DE LA NC
|
||||
@@ -11318,7 +11301,7 @@ Partial Class Ventas
|
||||
ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
|
||||
|
||||
'Registramos la venta
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, factura, tmpcon, -1, ObjContPaq, ObjBancos, EsNCAmortizacion:=True)
|
||||
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjAcum, ObjContr, factura, tmpcon, -1, ObjBancos, EsNCAmortizacion:=True)
|
||||
|
||||
Else
|
||||
ErrorList.Add("No se encontró un producto para generar la nota de crédito")
|
||||
@@ -13051,7 +13034,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 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,
|
||||
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)
|
||||
|
||||
Dim Msgok As New StringBuilder
|
||||
@@ -13673,7 +13656,6 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If ErrorList.Count = 0 AndAlso RBLTipoContrato.SelectedValue = "4" And DdlEstimacionesObra.SelectedValue.ToEntero > 0 Then
|
||||
|
||||
If Not ObjContr.UpdateContratosAvanceEstimacionVentas(DdlEstimacionesObra.SelectedValue.ToEntero, ObjFactura.CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
@@ -13681,10 +13663,9 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If ErrorList.Count = 0 Then
|
||||
'prepoliza
|
||||
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento, ObjInventario:=ObjInventario, TipoContable:=TipoContable)
|
||||
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento, ObjInventario:=ObjInventario, TipoContable:=TipoContable)
|
||||
If ErrorList.Count = 0 Then
|
||||
|
||||
'INVENTARIOS
|
||||
@@ -13703,7 +13684,7 @@ Partial Class Ventas
|
||||
End If
|
||||
If ErrorList.Count = 0 Then
|
||||
'armonizaccionContable
|
||||
GuardarVentaAC(ObjVentas, factura, Msgok, objContPaqi)
|
||||
'GuardarVentaAC(ObjVentas, factura, Msgok)
|
||||
If ErrorList.Count = 0 Then
|
||||
'Impuestos Locales
|
||||
If GuardarVentaImpuestosLocales(ObjVentas, ObjConta, factura) Then
|
||||
@@ -13719,7 +13700,7 @@ Partial Class Ventas
|
||||
End Sub
|
||||
|
||||
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,
|
||||
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,
|
||||
Optional ValorMultiplicador As Integer = 1, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional ObjInventario As ClsInventarios = Nothing, Optional TipoContable As Integer = -1)
|
||||
|
||||
@@ -13740,7 +13721,7 @@ Partial Class Ventas
|
||||
If DdlTipoComprobante.SelectedValue <> "Cot" Then
|
||||
If factura.CvePrePoliza > 0 Then
|
||||
|
||||
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, ValorMultiplicador, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento, ObjInventario:=ObjInventario, TipoContable:=TipoContable) Then
|
||||
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, ValorMultiplicador, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento, ObjInventario:=ObjInventario, TipoContable:=TipoContable) 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
|
||||
|
||||
@@ -13749,7 +13730,7 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
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,
|
||||
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, Optional NCDescuento As Boolean = False,
|
||||
Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional ObjInventario As ClsInventarios = Nothing, Optional TipoContable As Integer = -1) As Boolean
|
||||
@@ -15263,30 +15244,30 @@ Partial Class Ventas
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Private Sub GuardarVentaAC(ObjVentas As ClsVentas, factura As Modelos.Factura, Msgok As StringBuilder, ObjAC As ClsContPAQi)
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC Then
|
||||
'Private Sub GuardarVentaAC(ObjVentas As ClsVentas, factura As Modelos.Factura, Msgok As StringBuilder)
|
||||
' If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC Then
|
||||
|
||||
If factura.TipoDocto.Contiene("Ing", "Egs", "OP", "Com") Then
|
||||
' If factura.TipoDocto.Contiene("Ing", "Egs", "OP", "Com") Then
|
||||
|
||||
Dim IDPoliza As Modelos.RetornoPolizaConta = GenerarPolizaAC(ObjAC, factura)
|
||||
' Dim IDPoliza As Modelos.RetornoPolizaConta = GenerarPolizaAC(ObjAC, factura)
|
||||
|
||||
If IDPoliza.IdPoliza > 0 Then
|
||||
' If IDPoliza.IdPoliza > 0 Then
|
||||
|
||||
If ObjVentas.UpdateVentaPrePoliza(IDPoliza.IdPoliza, IDPoliza.FolioPoliza, factura.CvePrePoliza, factura.CveVenta, factura.CveEmpresa) Then
|
||||
' If ObjVentas.UpdateVentaPrePoliza(IDPoliza.IdPoliza, IDPoliza.FolioPoliza, factura.CvePrePoliza, factura.CveVenta, factura.CveEmpresa) Then
|
||||
|
||||
'Si se facturó la cotización hay que vincular la venta
|
||||
Msgok.AppendFormat("Abono Registrado Correctamente.<br/><br/> <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>Ver Poliza</a>", IDPoliza)
|
||||
End If
|
||||
Else
|
||||
ErrorList.Add("Ocurrió un error al generar A.C. en la Factura.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
||||
End If
|
||||
' 'Si se facturó la cotización hay que vincular la venta
|
||||
' Msgok.AppendFormat("Abono Registrado Correctamente.<br/><br/> <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>Ver Poliza</a>", IDPoliza)
|
||||
' End If
|
||||
' Else
|
||||
' ErrorList.Add("Ocurrió un error al generar A.C. en la Factura.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
||||
' End If
|
||||
|
||||
Else
|
||||
Msgok.Append("Movimiento Registrado Correctamente.<br/><br/> ")
|
||||
End If
|
||||
' Else
|
||||
' Msgok.Append("Movimiento Registrado Correctamente.<br/><br/> ")
|
||||
' End If
|
||||
|
||||
End If
|
||||
End Sub
|
||||
' End If
|
||||
'End Sub
|
||||
Private Function GuardarVentaImpuestosLocales(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, Factura As Modelos.Factura, Optional ValorMultiplicador As Integer = 1) As Boolean
|
||||
Dim ErrorPrepoliza As Boolean = False
|
||||
|
||||
@@ -18987,124 +18968,124 @@ Partial Class Ventas
|
||||
End If
|
||||
ObjVentas.Dispose()
|
||||
End Sub
|
||||
Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, factura As Modelos.Factura, Optional CancelacionIngreso As Boolean = False) As Modelos.RetornoPolizaConta
|
||||
Dim Retorno As New Modelos.RetornoPolizaConta
|
||||
Dim IDPoliza As Integer = 0
|
||||
'Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, factura As Modelos.Factura, Optional CancelacionIngreso As Boolean = False) As Modelos.RetornoPolizaConta
|
||||
' Dim Retorno As New Modelos.RetornoPolizaConta
|
||||
' Dim IDPoliza As Integer = 0
|
||||
|
||||
Dim ErrorAC As Boolean = False
|
||||
'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL()
|
||||
Dim Fecha As Date = factura.Fecha
|
||||
Dim Concepto As String = String.Format("GD {0}", factura.Cliente.Nombre)
|
||||
Dim Paridad As Integer = 1
|
||||
Dim TipoMovto As Boolean = False
|
||||
' Dim ErrorAC As Boolean = False
|
||||
' 'Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL()
|
||||
' Dim Fecha As Date = factura.Fecha
|
||||
' Dim Concepto As String = String.Format("GD {0}", factura.Cliente.Nombre)
|
||||
' Dim Paridad As Integer = 1
|
||||
' Dim TipoMovto As Boolean = False
|
||||
|
||||
If CancelacionIngreso Then
|
||||
Concepto = String.Format("Cancelación GD {0}", factura.Cliente.Nombre)
|
||||
Paridad = -1
|
||||
TipoMovto = True
|
||||
End If
|
||||
' If CancelacionIngreso Then
|
||||
' Concepto = String.Format("Cancelación GD {0}", factura.Cliente.Nombre)
|
||||
' Paridad = -1
|
||||
' TipoMovto = True
|
||||
' End If
|
||||
|
||||
Dim TipoPoliza = If(factura.TipoDocto = "OP" Or factura.TipoDocto = "Com", 3, 1)
|
||||
' Dim TipoPoliza = If(factura.TipoDocto = "OP" Or factura.TipoDocto = "Com", 3, 1)
|
||||
|
||||
IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, factura.Total * 2, factura.Total * 2, factura.CveUsuario, Fecha)
|
||||
Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue))
|
||||
'Dim Importe As Double = TxtTotal.Text.ToDouble
|
||||
Dim CtaCliente As Integer = 0
|
||||
Dim CtaISSSTESON As Integer = 643
|
||||
Dim CtaISPT As Integer = 1745
|
||||
' Dim NombreCliente As String = ViewState("NombreCliente").ToString()
|
||||
' IDPoliza = ObjAC.AddPoliza(TipoPoliza, Concepto, factura.Total * 2, factura.Total * 2, factura.CveUsuario, Fecha)
|
||||
' Dim dr As DataRow ' = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", DdlFuenteRecaudacion.SelectedValue))
|
||||
' 'Dim Importe As Double = TxtTotal.Text.ToDouble
|
||||
' Dim CtaCliente As Integer = 0
|
||||
' Dim CtaISSSTESON As Integer = 643
|
||||
' Dim CtaISPT As Integer = 1745
|
||||
' ' Dim NombreCliente As String = ViewState("NombreCliente").ToString()
|
||||
|
||||
If IDPoliza > 0 Then
|
||||
Retorno.IdPoliza = IDPoliza
|
||||
Retorno.FolioPoliza = ObjAC.Folio
|
||||
'Orden de PAGO
|
||||
If factura.TipoDocto = "OP" Then
|
||||
' If IDPoliza > 0 Then
|
||||
' Retorno.IdPoliza = IDPoliza
|
||||
' Retorno.FolioPoliza = ObjAC.Folio
|
||||
' 'Orden de PAGO
|
||||
' If factura.TipoDocto = "OP" Then
|
||||
|
||||
If DdlOrdenPago.SelectedValue.ToEntero() = 1 Then
|
||||
'ISSSTESON
|
||||
' If DdlOrdenPago.SelectedValue.ToEntero() = 1 Then
|
||||
' 'ISSSTESON
|
||||
|
||||
If ObjAC.AddMovimiento(IDPoliza, 0, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
|
||||
If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
|
||||
ErrorAC = True
|
||||
End If
|
||||
Else
|
||||
ErrorAC = True
|
||||
End If
|
||||
' If ObjAC.AddMovimiento(IDPoliza, 0, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
|
||||
' If Not ObjAC.AddMovimiento(IDPoliza, CtaISSSTESON, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
|
||||
' ErrorAC = True
|
||||
' End If
|
||||
' Else
|
||||
' ErrorAC = True
|
||||
' End If
|
||||
|
||||
Else
|
||||
'ISPT
|
||||
' Else
|
||||
' 'ISPT
|
||||
|
||||
If ObjAC.AddMovimiento(IDPoliza, 0, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
|
||||
If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
|
||||
ErrorAC = True
|
||||
End If
|
||||
Else
|
||||
ErrorAC = True
|
||||
End If
|
||||
End If
|
||||
' If ObjAC.AddMovimiento(IDPoliza, 0, False, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
|
||||
' If Not ObjAC.AddMovimiento(IDPoliza, CtaISPT, True, Paridad * factura.Total, "", Concepto, 0, Fecha, "") Then
|
||||
' ErrorAC = True
|
||||
' End If
|
||||
' Else
|
||||
' ErrorAC = True
|
||||
' End If
|
||||
' End If
|
||||
|
||||
' NORMAL
|
||||
Else
|
||||
Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)()
|
||||
Group gvr By Grp = New With {
|
||||
Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero()
|
||||
} Into Group
|
||||
Select Grp.CvePresupuestoIngreso,
|
||||
TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble)
|
||||
' ' NORMAL
|
||||
' Else
|
||||
' Dim Detalles = From gvr As GridViewRow In GvPS.Rows.Cast(Of GridViewRow)()
|
||||
' Group gvr By Grp = New With {
|
||||
' Key .CvePresupuestoIngreso = gvr.FCDropDownList("DdlFR").SelectedValue.ToEntero()
|
||||
' } Into Group
|
||||
' Select Grp.CvePresupuestoIngreso,
|
||||
' TotalImporte = Group.Sum(Function(r) r.FCLiteral("LtlTotal").Text.ToDouble)
|
||||
|
||||
|
||||
'Select Case TipoComprobante
|
||||
' Case "Ing", "Egs"
|
||||
For Each grp In Detalles
|
||||
dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso))
|
||||
Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString(), TxtFolio.Text)
|
||||
' 'Select Case TipoComprobante
|
||||
' ' Case "Ing", "Egs"
|
||||
' For Each grp In Detalles
|
||||
' dr = DTPresupuestoIngresos.FiltroPrimero(String.Format("CvePresupuestoIngreso = {0}", grp.CvePresupuestoIngreso))
|
||||
' Concepto = String.Format("{0} - {1}: {2}", NombreCliente, DdlTipoComprobante.SelectedItem.Text.ToString(), TxtFolio.Text)
|
||||
|
||||
If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString().ToEntero(), False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "V||" & factura.CveVenta) Then
|
||||
If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString().ToEntero(), True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "V||" & factura.CveVenta) Then
|
||||
'CARGO la deuda del cliente
|
||||
If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "V||" & factura.CveVenta) Then
|
||||
'abono,
|
||||
If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString().ToEntero(), Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "V||" & factura.CveVenta) Then
|
||||
ErrorAC = True
|
||||
End If
|
||||
Else
|
||||
ErrorAC = True
|
||||
End If
|
||||
Else
|
||||
ErrorAC = True
|
||||
End If
|
||||
Else
|
||||
ErrorAC = True
|
||||
End If
|
||||
Next
|
||||
' If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaPorEjecutar").ToString().ToEntero(), False, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "V||" & factura.CveVenta) Then
|
||||
' If ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaDevengado").ToString().ToEntero(), True, Paridad * grp.TotalImporte, "", Concepto, 0, Fecha, "V||" & factura.CveVenta) Then
|
||||
' 'CARGO la deuda del cliente
|
||||
' If ObjAC.AddMovimiento(IDPoliza, CtaCliente, TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "V||" & factura.CveVenta) Then
|
||||
' 'abono,
|
||||
' If Not ObjAC.AddMovimiento(IDPoliza, dr("IdCuentaMatriz").ToString().ToEntero(), Not TipoMovto, grp.TotalImporte, "", Concepto, 0, Fecha, "V||" & factura.CveVenta) Then
|
||||
' ErrorAC = True
|
||||
' End If
|
||||
' Else
|
||||
' ErrorAC = True
|
||||
' End If
|
||||
' Else
|
||||
' ErrorAC = True
|
||||
' End If
|
||||
' Else
|
||||
' ErrorAC = True
|
||||
' End If
|
||||
' Next
|
||||
|
||||
'Case "OP", "Com"
|
||||
' Dim Importe As Decimal = 0
|
||||
' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, False, Importe, "", Concepto, 0, Fecha, "") Then
|
||||
' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, True, Importe, "", Concepto, 0, Fecha, "") Then
|
||||
' 'Case "OP", "Com"
|
||||
' ' Dim Importe As Decimal = 0
|
||||
' ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, False, Importe, "", Concepto, 0, Fecha, "") Then
|
||||
' ' If ObjAC.AddMovimiento(123456, IDPoliza, CtaCliente, True, Importe, "", Concepto, 0, Fecha, "") Then
|
||||
|
||||
' End If
|
||||
' End If
|
||||
'End Select
|
||||
End If
|
||||
' ' End If
|
||||
' ' End If
|
||||
' 'End Select
|
||||
' End If
|
||||
|
||||
Else
|
||||
ErrorAC = True
|
||||
End If
|
||||
' Else
|
||||
' ErrorAC = True
|
||||
' End If
|
||||
|
||||
If Not ErrorAC Then
|
||||
ObjAC.AjustaPoliza(IDPoliza)
|
||||
Else
|
||||
Retorno.IdPoliza = 0
|
||||
Retorno.FolioPoliza = -1
|
||||
Alert("Error al agregar la Póliza de AC.", TipoMensaje.MsgError)
|
||||
End If
|
||||
' If Not ErrorAC Then
|
||||
' ObjAC.AjustaPoliza(IDPoliza)
|
||||
' Else
|
||||
' Retorno.IdPoliza = 0
|
||||
' Retorno.FolioPoliza = -1
|
||||
' Alert("Error al agregar la Póliza de AC.", TipoMensaje.MsgError)
|
||||
' End If
|
||||
|
||||
' ObjAC.Dispose()
|
||||
' ' ObjAC.Dispose()
|
||||
|
||||
Return Retorno
|
||||
' Return Retorno
|
||||
|
||||
End Function
|
||||
'End Function
|
||||
|
||||
|
||||
'Private Function GenerarPolizaAC(ObjAC As ClsContPAQi, Optional CancelacionIngreso As Boolean = False) As Integer
|
||||
@@ -20389,7 +20370,7 @@ Partial Class Ventas
|
||||
'Return Not OcurrioError
|
||||
|
||||
End Function
|
||||
Private Function GeneraPrePolizaMovimientoAlmacen(ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, ByRef ObjContPaq As ClsContPAQi, ObjFactura As Modelos.Factura, CvePrePoliza As Integer, CveMovimientoInventario As Integer, CveAlmacen As Integer) As Boolean
|
||||
Private Function GeneraPrePolizaMovimientoAlmacen(ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, ObjFactura As Modelos.Factura, CvePrePoliza As Integer, CveMovimientoInventario As Integer, CveAlmacen As Integer) As Boolean
|
||||
Dim OcurrioError As Boolean = False
|
||||
Dim GenerarPrePolizaNueva As Boolean = False
|
||||
Try
|
||||
@@ -20461,7 +20442,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
If AutoConta Then
|
||||
If Not ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa, ObjConta:=ObjContPaq) Then
|
||||
If Not ObjConta.ContabilizarPrePoliza(ObjFactura.CvePrePoliza, ObjFactura.CveUsuario, UsuarioActual.Empresa) Then
|
||||
Alert("Ocurrio un Error al contabilizar la prepoliza de almacen, pongase en contacto con Soporte Técnico", TipoMensaje.MsgError)
|
||||
End If
|
||||
End If
|
||||
@@ -23087,7 +23068,7 @@ Partial Class Ventas
|
||||
ObjFactura.CvePrePoliza = CvePrePoliza
|
||||
|
||||
'VUELVE A GENERAR LAS PREPOLIZAS
|
||||
If Not ErrorCancelar Then ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFactura, -1, TmpDT, ObjAC, 1, ObjBancos, ObjVentas)
|
||||
If Not ErrorCancelar Then ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFactura, -1, TmpDT, 1, ObjBancos, ObjVentas)
|
||||
|
||||
If Not ErrorCancelar Then ErrorCancelar = GuardarVentaImpuestosLocales(ObjVentas, ObjConta, ObjFactura, 1)
|
||||
|
||||
@@ -25134,7 +25115,7 @@ Partial Class Ventas
|
||||
#End Region
|
||||
|
||||
#Region " CONTRATO DE CONSIGNACION DE VENTA - SURTIDO DE ALMACÉN "
|
||||
Function RegistraAlmacenConsignacionVenta(ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, factura As Modelos.Factura, ObjContPaq As ClsContPAQi) As Boolean
|
||||
Function RegistraAlmacenConsignacionVenta(ByRef ObjInventario As ClsInventarios, ByRef ObjConta As ClsContabilidad, factura As Modelos.Factura) As Boolean
|
||||
If Not (UsuarioActual.Empresa.UsaInventarios AndAlso CveAlmacenExistenciasContrato > 0) Then
|
||||
Return True
|
||||
End If
|
||||
@@ -25229,7 +25210,7 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
'GENERAR PREPOLIZA
|
||||
If Not GeneraPrePolizaMovimientoAlmacen(ObjInventario, ObjConta, ObjContPaq, ObjFactura, ObjFactura.CvePrePoliza, CveMovimientoSalidaGeneral, CveAlmacenOrigenContrato) Then
|
||||
If Not GeneraPrePolizaMovimientoAlmacen(ObjInventario, ObjConta, ObjFactura, ObjFactura.CvePrePoliza, CveMovimientoSalidaGeneral, CveAlmacenOrigenContrato) Then
|
||||
Return False
|
||||
End If
|
||||
|
||||
@@ -33721,7 +33702,7 @@ Partial Class Ventas
|
||||
|
||||
#Region " N O T A - D E - C R E D I T O - P R O N T O - P A G O"
|
||||
|
||||
Private Function GenerarNCProntoPago(SqlTransaccion As SqlClient.SqlTransaction, ByRef ObjCliente As ClsClientes, ByRef ObjConta As ClsContPAQi, ObjFactura As Modelos.Factura) As Modelos.MensajeProntoPago
|
||||
Private Function GenerarNCProntoPago(SqlTransaccion As SqlClient.SqlTransaction, ByRef ObjCliente As ClsClientes, ObjFactura As Modelos.Factura) As Modelos.MensajeProntoPago
|
||||
Dim Retorno As New Modelos.MensajeProntoPago
|
||||
|
||||
Dim Resp As New Modelos.Factura.MMensajeFactura
|
||||
@@ -33874,7 +33855,7 @@ Partial Class Ventas
|
||||
|
||||
ObjFacturaProntoPago.Timbre = PreParaTimbre(ObjFacturaProntoPago)
|
||||
|
||||
Resp = ObjFacturaProntoPago.EmitirFactura(False, Transac:=SqlTransaccion, ObjContPaqTransac:=ObjConta)
|
||||
Resp = ObjFacturaProntoPago.EmitirFactura(False, Transac:=SqlTransaccion)
|
||||
|
||||
Retorno.ObjFacturaProntoPago = ObjFacturaProntoPago
|
||||
|
||||
@@ -35146,39 +35127,39 @@ Partial Class Ventas
|
||||
Protected Sub BtnGenerarPoliza_Click(sender As Object, e As EventArgs)
|
||||
CreaObjetosVenta()
|
||||
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 Then
|
||||
'If UsuarioActual.Empresa.TipoContabilidad = 2 Then
|
||||
|
||||
Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa)
|
||||
Dim Msgok As New StringBuilder
|
||||
If ObjFactura.TipoDocto.Contiene("Ing", "Egs", "OP", "Com") Then
|
||||
' Dim ObjAC As New ClsContPAQi(UsuarioActual.Empresa)
|
||||
' Dim Msgok As New StringBuilder
|
||||
' If ObjFactura.TipoDocto.Contiene("Ing", "Egs", "OP", "Com") Then
|
||||
|
||||
Dim IDPoliza As Modelos.RetornoPolizaConta = GenerarPolizaAC(ObjAC, ObjFactura)
|
||||
' Dim IDPoliza As Modelos.RetornoPolizaConta = GenerarPolizaAC(ObjAC, ObjFactura)
|
||||
|
||||
If IDPoliza.IdPoliza > 0 Then
|
||||
' If IDPoliza.IdPoliza > 0 Then
|
||||
|
||||
Dim ObjVentas As New ClsVentas
|
||||
' Dim ObjVentas As New ClsVentas
|
||||
|
||||
If ObjVentas.UpdateVentaPrePoliza(IDPoliza.IdPoliza, IDPoliza.FolioPoliza, CvePrePoliza, CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
' If ObjVentas.UpdateVentaPrePoliza(IDPoliza.IdPoliza, IDPoliza.FolioPoliza, CvePrePoliza, CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
|
||||
'Si se facturó la cotización hay que vincular la venta
|
||||
Msgok.AppendFormat("Abono Registrado Correctamente.<br/><br/> <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>Ver Poliza</a>", IDPoliza)
|
||||
End If
|
||||
' 'Si se facturó la cotización hay que vincular la venta
|
||||
' Msgok.AppendFormat("Abono Registrado Correctamente.<br/><br/> <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>Ver Poliza</a>", IDPoliza)
|
||||
' End If
|
||||
|
||||
ObjVentas.Dispose()
|
||||
' ObjVentas.Dispose()
|
||||
|
||||
'Si se facturó la cotización hay que vincular la venta
|
||||
Msgok.AppendFormat("Abono Registrado Correctamente.<br/><br/> <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>Ver Poliza</a>", IDPoliza)
|
||||
' 'Si se facturó la cotización hay que vincular la venta
|
||||
' Msgok.AppendFormat("Abono Registrado Correctamente.<br/><br/> <a href='/Contabilidad/RegPoliza.aspx?IdPoliza={0}' target='_blank' class='Texto'>Ver Poliza</a>", IDPoliza)
|
||||
|
||||
Else
|
||||
ErrorList.Add("Ocurrió un error al generar A.C. en la Factura.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
||||
End If
|
||||
' Else
|
||||
' ErrorList.Add("Ocurrió un error al generar A.C. en la Factura.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
|
||||
' End If
|
||||
|
||||
Else
|
||||
Msgok.Append("Movimiento Registrado Correctamente.<br/><br/> ")
|
||||
End If
|
||||
ObjAC.Dispose()
|
||||
' Else
|
||||
' Msgok.Append("Movimiento Registrado Correctamente.<br/><br/> ")
|
||||
' End If
|
||||
' ObjAC.Dispose()
|
||||
|
||||
End If
|
||||
'End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Reference in New Issue
Block a user