Merge branch 'master' of http://192.168.10.111:8383/SIG
This commit is contained in:
@@ -2242,10 +2242,10 @@ Partial Class Ventas
|
||||
|
||||
Private Property SaldoLineaAdicional As Decimal
|
||||
Get
|
||||
Return (IfNull(ViewState("ImporteLineaAdicional"), "0", ViewState("ImporteLineaAdicional"))).ToString().ToDecimal()
|
||||
Return (IfNull(ViewState("SaldoLineaAdicional"), "0", ViewState("SaldoLineaAdicional"))).ToString().ToDecimal()
|
||||
End Get
|
||||
Set(value As Decimal)
|
||||
ViewState("ImporteLineaAdicional") = value
|
||||
ViewState("SaldoLineaAdicional") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
@@ -5568,6 +5568,17 @@ Partial Class Ventas
|
||||
LBFacturarAnticipo.Visible = UsuarioActual.TienePermisoProceso(274)
|
||||
End If
|
||||
|
||||
'SI ES COMPLEMENTARIA, NO DEBE PERMITIR FACTURAR
|
||||
If UsuarioActual.Empresa.Funcionalidad(706) = "1" AndAlso DbRowVenta("TipoContable").ToString() <> "-1" Then
|
||||
If DbRowVenta("TipoContable").ToString() = "0" Then
|
||||
BtnsFacturar.Visible = False
|
||||
End If
|
||||
|
||||
TrTipoContable.Visible = True
|
||||
DdlTipoContable.SelectedValueExist(DbRowVenta("TipoContable").ToString())
|
||||
DdlTipoContable.Enabled = False
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
If DbRowVenta("TipoDocto").ToString().Contiene("Cot", "Pd2") Then
|
||||
@@ -8974,15 +8985,15 @@ Partial Class Ventas
|
||||
EsValido = True
|
||||
End If
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(133).ToEntero() > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then
|
||||
CostoMayor = Costo + ((UsuarioActual.Empresa.Funcionalidad(133).ToDecimal / 100) * Costo)
|
||||
'SI EL PRECIO ES MAYOR AL COSTO, SI PASA
|
||||
If PU <= CostoMayor Then
|
||||
EsValidoMayor = True
|
||||
End If
|
||||
Else
|
||||
EsValidoMayor = True
|
||||
End If
|
||||
'If UsuarioActual.Empresa.Funcionalidad(133).ToEntero() > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then
|
||||
' CostoMayor = Costo + ((UsuarioActual.Empresa.Funcionalidad(133).ToDecimal / 100) * Costo)
|
||||
' 'SI EL PRECIO ES MAYOR AL COSTO, SI PASA
|
||||
' If PU <= CostoMayor Then
|
||||
' EsValidoMayor = True
|
||||
' End If
|
||||
'Else
|
||||
' EsValidoMayor = True
|
||||
'End If
|
||||
|
||||
'VALIDA PROMOCION: SI TIENE PROMOCION Y EL PRECIO ES MENOR AL PRECIO DE PROMOCION, NO PASA | SI YA CUMPLE NO VUELVE A VALIDAR
|
||||
If Not EsValido Or PU = 0 Then
|
||||
@@ -8998,24 +9009,24 @@ Partial Class Ventas
|
||||
End If
|
||||
'NO DEJA REGISTRAR CON VALIDACION DE COSTO ALMACEN O PROMOCION
|
||||
Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201)
|
||||
If Not EsValido Then
|
||||
'If Not EsValido Then
|
||||
|
||||
MensajeCosto.AppendFormat("El Producto <b>{0}</b>. No se puede vender a un precio menor de su Costo ni a un precio mayor de su rango aceptado<br/>", dr("PS").ToString())
|
||||
If TienePermisoImportes Then
|
||||
MensajeCosto.AppendFormat("El costo del producto es: <b>{0:#,###.00}$</b> <br/>", Costo)
|
||||
MensajeCosto.AppendFormat("El rango menor aceptado es: {0} <b>{1:#,###.00}$</b> <br/>", UsuarioActual.Empresa.Funcionalidad(129).ToEntero(), CostoMenor)
|
||||
MensajeCosto.AppendFormat("El precio indicado es: <b>{0:#,###.00}$</b> ({1}% de ganancia) <br/>", PU.FormatoNumero, If(Costo > 0, ((PU - Costo) * 100) / Costo, 0))
|
||||
End If
|
||||
End If
|
||||
' MensajeCosto.AppendFormat("El Producto <b>{0}</b>. No se puede vender a un precio menor de su Costo ni a un precio mayor de su rango aceptado<br/>", dr("PS").ToString())
|
||||
' If TienePermisoImportes Then
|
||||
' MensajeCosto.AppendFormat("El costo del producto es: <b>{0:#,###.00}$</b> <br/>", Costo)
|
||||
' MensajeCosto.AppendFormat("El rango menor aceptado es: {0} <b>{1:#,###.00}$</b> <br/>", UsuarioActual.Empresa.Funcionalidad(129).ToEntero(), CostoMenor)
|
||||
' MensajeCosto.AppendFormat("El precio indicado es: <b>{0:#,###.00}$</b> ({1}% de ganancia) <br/>", PU.FormatoNumero, If(Costo > 0, ((PU - Costo) * 100) / Costo, 0))
|
||||
' End If
|
||||
'End If
|
||||
|
||||
If Not EsValidoMayor Then
|
||||
MensajeCosto.AppendFormat("El Producto <b>{0}</b>. No se puede vender a un precio mayor de su rango aceptado<br/>", dr("PS").ToString())
|
||||
If TienePermisoImportes Then
|
||||
MensajeCosto.AppendFormat("El costo del producto es: <b>{0:#,###.00}$</b> <br/>", Costo)
|
||||
MensajeCosto.AppendFormat("El rango mayor aceptado es: {0} <b>{1:#,###.00}$</b> <br/>", UsuarioActual.Empresa.Funcionalidad(133).ToEntero(), CostoMayor)
|
||||
MensajeCosto.AppendFormat("El precio indicado es: <b>{0:#,###.00}$</b> ({1}% de ganancia) <br/>", PU.FormatoNumero, If(Costo > 0, ((PU - Costo) * 100) / Costo, 0))
|
||||
End If
|
||||
End If
|
||||
'If Not EsValidoMayor Then
|
||||
' MensajeCosto.AppendFormat("El Producto <b>{0}</b>. No se puede vender a un precio mayor de su rango aceptado<br/>", dr("PS").ToString())
|
||||
' If TienePermisoImportes Then
|
||||
' MensajeCosto.AppendFormat("El costo del producto es: <b>{0:#,###.00}$</b> <br/>", Costo)
|
||||
' MensajeCosto.AppendFormat("El rango mayor aceptado es: {0} <b>{1:#,###.00}$</b> <br/>", UsuarioActual.Empresa.Funcionalidad(133).ToEntero(), CostoMayor)
|
||||
' MensajeCosto.AppendFormat("El precio indicado es: <b>{0:#,###.00}$</b> ({1}% de ganancia) <br/>", PU.FormatoNumero, If(Costo > 0, ((PU - Costo) * 100) / Costo, 0))
|
||||
' End If
|
||||
'End If
|
||||
|
||||
' SOLO SI TIENE LA FUNCIONALIDAD DE RESTRICCION VALIDA EL IMPORTE CERO
|
||||
If UsuarioActual.Empresa.Funcionalidad(139).ToString().ToEntero() > 0 Then
|
||||
@@ -9115,10 +9126,13 @@ Partial Class Ventas
|
||||
Dim Archivo As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.rdlc", UsuarioActual.Empresa.Ruta))
|
||||
Dim Archivo2 As New System.IO.FileInfo(String.Format("{0}Formatos/Remision.rdlc", UsuarioActual.Empresa.Ruta))
|
||||
|
||||
Dim ArchivoSti As New System.IO.FileInfo(String.Format("{0}Formatos/Factura.mrt", UsuarioActual.Empresa.Ruta))
|
||||
Dim ArchivoSti2 As New System.IO.FileInfo(String.Format("{0}Formatos/Remision.mrt", UsuarioActual.Empresa.Ruta))
|
||||
|
||||
LnkImprimir.Visible = False
|
||||
|
||||
'If (UsuarioActual.CveEmpresa.Contiene(1, 4, 5, 7, 11, 12, 72, 80, 81, 83) And UsuarioActual.CveUsuario = 100) Or UsuarioActual.CveEmpresa.Contiene(80, 83) Or UsuarioActual.CveUsuario = 100 Then
|
||||
If (Archivo.Exists Or Archivo2.Exists) And IfNull(CveVenta, 0).ToString().ToEntero() > 0 Then
|
||||
If (Archivo.Exists Or Archivo2.Exists Or ArchivoSti.Exists Or ArchivoSti2.Exists) And IfNull(CveVenta, 0).ToString().ToEntero() > 0 Then
|
||||
HplDownPDF.Visible = True
|
||||
HplDownPDF.NavigateUrl = String.Format("/Compras/PopUpVerFactura.aspx?P={0}", Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta)))
|
||||
If UsuarioActual.CveRol = 1 Then
|
||||
@@ -12640,7 +12654,13 @@ Partial Class Ventas
|
||||
tCveTipoPoliza = 1 ' que sea siempre ingreso.
|
||||
End If
|
||||
|
||||
factura.CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardarVenta", factura.CvePlantillaPoliza, factura.Total, factura.Total, factura.CveMoneda, factura.Fecha, If(CveEmpresaCRM > 0, LblEmpresaCRM.Text, factura.Cliente.Nombre), factura.CveUsuario, factura.CveEmpresa, CveTipoPoliza:=tCveTipoPoliza)
|
||||
Dim TipoContable As Integer = -1
|
||||
If UsuarioActual.Empresa.Funcionalidad(706) = "1" AndAlso factura.TipoDocto = "Rem" Then
|
||||
'1-Contable, 0-Complementaria
|
||||
TipoContable = DdlTipoContable.SelectedValue.ToEntero()
|
||||
End If
|
||||
|
||||
factura.CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardarVenta", factura.CvePlantillaPoliza, factura.Total, factura.Total, factura.CveMoneda, factura.Fecha, If(CveEmpresaCRM > 0, LblEmpresaCRM.Text, factura.Cliente.Nombre), factura.CveUsuario, factura.CveEmpresa, CveTipoPoliza:=tCveTipoPoliza, TipoContable:=TipoContable)
|
||||
|
||||
Dim RFCReceptor As String = ""
|
||||
|
||||
@@ -13126,7 +13146,7 @@ Partial Class Ventas
|
||||
|
||||
If ErrorList.Count = 0 Then
|
||||
'prepoliza
|
||||
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento, ObjInventario:=ObjInventario)
|
||||
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento, ObjInventario:=ObjInventario, TipoContable:=TipoContable)
|
||||
If ErrorList.Count = 0 Then
|
||||
|
||||
'INVENTARIOS
|
||||
@@ -13161,7 +13181,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,
|
||||
Optional ValorMultiplicador As Integer = 1, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional ObjInventario As ClsInventarios = Nothing)
|
||||
Optional ValorMultiplicador As Integer = 1, Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional ObjInventario As ClsInventarios = Nothing, Optional TipoContable As Integer = -1)
|
||||
|
||||
Dim CveIE As Integer = -1
|
||||
Dim DT As DataTable = Nothing
|
||||
@@ -13180,7 +13200,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) Then
|
||||
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, 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
|
||||
|
||||
@@ -13192,7 +13212,7 @@ Partial Class Ventas
|
||||
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,
|
||||
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) As Boolean
|
||||
Optional ListaNCDescuento As List(Of Modelos.Factura) = Nothing, Optional ObjInventario As ClsInventarios = Nothing, Optional TipoContable As Integer = -1) As Boolean
|
||||
Try
|
||||
Dim DT As DataTable
|
||||
Dim CvePlantilaPoliza As Integer
|
||||
@@ -13343,8 +13363,13 @@ Partial Class Ventas
|
||||
End If
|
||||
IdCtaContableCliente = IdCtaContable
|
||||
|
||||
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 190, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 193, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=False, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||
Dim ContabilizableRem As Boolean = False
|
||||
If TipoContable <> -1 Then
|
||||
ContabilizableRem = True
|
||||
End If
|
||||
|
||||
If ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, TipoMovimiento, importeMovimiento, Referencia, 190, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=ContabilizableRem, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(ObjFactura.CvePrePoliza, Not TipoMovimiento, importeMovimiento, Referencia, 193, Concepto, FechaMovimiento, IdCtaContable, -1, CveVenta:=ObjFactura.CveVenta, CveCliente:=ObjFactura.CveCliente, CveIE:=CveIE, ImporteMX:=importeMX, ImporteME:=If(tipoCambio = 1, 0, importeMovimiento), Contabilizable:=ContabilizableRem, CveSubProyecto:=CveSubProyectoContabilizar) Then
|
||||
ErrorPrepoliza = True
|
||||
End If
|
||||
Else
|
||||
@@ -14841,16 +14866,14 @@ Partial Class Ventas
|
||||
Next
|
||||
End If
|
||||
|
||||
If DivAlmacen.Visible AndAlso GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 Then
|
||||
If factura.TipoDocto.Contiene("Ing", "Dev") AndAlso DivAlmacen.Visible AndAlso GvInv.Rows.Cast(Of GridViewRow)().Count(Function(gvr) gvr.FCCheckBox("cbInv").Checked) > 0 Then
|
||||
|
||||
Dim Filtro As String = ""
|
||||
Select Case factura.TipoDocto
|
||||
Case "Ing", "Ped"
|
||||
Case "Ing"
|
||||
Filtro = "CveConcepto IN (3,40)"
|
||||
Case "Dev"
|
||||
Filtro = "CveConcepto IN (3,40)"
|
||||
Case Else
|
||||
Filtro = "CveConcepto = 9"
|
||||
End Select
|
||||
|
||||
Dim CveConceptoAlmacen As Integer = 3
|
||||
@@ -15776,47 +15799,8 @@ Partial Class Ventas
|
||||
For Each gvr As GridViewRow In GVAnticipos.Rows
|
||||
If gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked Then
|
||||
|
||||
|
||||
Dim FechaUltimaFluctuacion As Date = MinFecha
|
||||
Dim TipoCambioFluctuacion As Decimal = 1
|
||||
Dim tFecha As Date = Now
|
||||
|
||||
Dim UltimaFluctuacion As MTipoCambioFluctuacion = GlobalTipoCambioUltimaFluctuacion(tFecha)
|
||||
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(703) = "1" AndAlso UltimaFluctuacion IsNot Nothing Then
|
||||
If UltimaFluctuacion.FechaFluctuacion <= tFecha Then
|
||||
FechaUltimaFluctuacion = UltimaFluctuacion.FechaFluctuacion
|
||||
TipoCambioFluctuacion = UltimaFluctuacion.TCFluctuacion
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 1 Then 'SI LA VENTA VIENE EN PESOS Y SE VA A PAGAR EN PESOS
|
||||
tipoCambioPago = 1
|
||||
tipoCambioVenta = 1
|
||||
tipoCambioVentaValuacion = 1
|
||||
PorcentajePago = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 1 Then 'SI LA VENTA VIENE EN DOLARES Y SE VA A PAGAR EN PESOS
|
||||
tipoCambioPago = gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
|
||||
tipoCambioVenta = TxtTipoCambio.Text.ToDecimal
|
||||
tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal)
|
||||
PorcentajePago = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal) / gvr.DataKey("Original").ToDecimal
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero() = 2 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then 'SI LA VENTA VIENE EN DOLARES Y SE VA A PAGAR EN DOLARES
|
||||
tipoCambioPago = gvr.DataKey("TipoCambio").ToString().ToDecimal
|
||||
tipoCambioVenta = TxtTipoCambio.Text.ToDecimal
|
||||
tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal)
|
||||
PorcentajePago = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("Original").ToDecimal
|
||||
ElseIf DdlMoneda.SelectedValue.ToEntero() = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero() = 2 Then 'SI LA VENTA VIENE EN PESOS Y SE VA A PAGAR EN DOLARES
|
||||
tipoCambioPago = gvr.DataKey("TipoCambioHoy").ToDecimal() ' gvr.FCTextBox("TxtTC" & gvr.RowIndex).Text.ToDecimal
|
||||
tipoCambioVenta = 1
|
||||
tipoCambioVentaValuacion = If(TxtFecha.Text.ToDate < FechaUltimaFluctuacion, TipoCambioFluctuacion, TxtTipoCambio.Text.ToDecimal)
|
||||
PorcentajePago = (gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal) / gvr.DataKey("Original").ToDecimal
|
||||
End If
|
||||
|
||||
Dim importeMovimiento As Decimal = 0
|
||||
Dim importeMN As Decimal = 0
|
||||
Dim TC As Decimal
|
||||
Dim IdCtaContable As Integer
|
||||
Dim TipoMovimiento As Boolean = True
|
||||
Dim Concepto As String = VentaActual.SerieFolio
|
||||
@@ -15886,81 +15870,22 @@ Partial Class Ventas
|
||||
If gvr.DataKey("CveIE").ToEntero() > 0 Then
|
||||
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal
|
||||
IdCtaContable = IdCtaContClientes
|
||||
|
||||
If importeMovimiento <> 0 Then
|
||||
|
||||
Dim Pago As New VentaPago
|
||||
Pago.ImportePagoVenta = importeMovimiento
|
||||
Pago.ImportePago = importeMovimiento
|
||||
Pago.CveIE = CveIEAnticipo
|
||||
Pago.CveMonedaPago = gvr.DataKey("CveMoneda").ToEntero()
|
||||
Pago.TipoPago = "A"
|
||||
Pago.TCPago = gvr.DataKey("TipoCambio").ToDecimal
|
||||
Pago.TipoPago = "I"
|
||||
Pago.FechaDocumentoRelacionado = gvr.DataKey("Fecha").ToDate
|
||||
Pago.CveVentaAmortizacion = gvr.DataKey("CveVenta").ToEntero()
|
||||
Pago.AplicaTraslado = gvr.DataKey("RegresarImpuesto") = "1"
|
||||
Pago.Referencia = gvr.DataKey("Folio")
|
||||
|
||||
ErrorConta = AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjConta)
|
||||
|
||||
' Agregamos el 2
|
||||
If tipoCambioPago = 1 Then
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, Now, IdCtaContClientes, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
Else 'Cuando son dolares
|
||||
If importeMovimiento <> 0 Then
|
||||
If IdCtaContComplementaria > 0 Or 0 > 0 Then
|
||||
'Agregamos la Complementaria
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, 0, Concepto, 207, Concepto, Now, IdCtaContComplementaria, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta - importeMovimiento, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
'Agregamos la Extranjera
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, Now, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMovimiento, ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
Else
|
||||
'Agregamos la Extranjera
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, importeMovimiento, Concepto, 2, Concepto, Now, IdCtaContMonedaExtranjera, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=Math.Round(importeMovimiento * tipoCambioVenta, 2, MidpointRounding.AwayFromZero), ImporteME:=importeMovimiento, CveCuenta:=0, TipoCambio:=tipoCambioVenta, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
importeMovimiento = ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / TxtTotal.Text.ToDecimal) * TxtIVA.Text.ToDecimal)
|
||||
importeMN = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero)
|
||||
|
||||
|
||||
'Agregamos el 92
|
||||
importeMovimiento = gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal 'gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal - ((gvr.FCTextBox("TxtAnticipo" & gvr.RowIndex).Text.ToDecimal / gvr.DataKey("TotalAnticipo" & gvr.RowIndex).ToDecimal) * gvr.DataKey("IVAAnticipo").ToDecimal)
|
||||
importeMN = Math.Round(importeMovimiento * tipoCambioPago, 2, MidpointRounding.AwayFromZero)
|
||||
IdCtaContable = IdCtaContAnticipos
|
||||
|
||||
If ObjCliente.GetClientes(gvr.DataKey("CveCliente").ToEntero(), "-1", "-1", "-1", "-1", "-1", "-1", -1, UsuarioActual.CveEmpresa) Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
If Not tipoCambioPago = 1 Then
|
||||
IdCtaContable = ObjCliente.IdCtaMonedaExtranjeraAnticipos
|
||||
Else
|
||||
IdCtaContable = ObjCliente.IdCtaContAnticipos
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If UsuarioActual.CveEmpresa.Contiene(119) Then
|
||||
If gvr.DataKey("Fecha").ToDate.Year <= 2017 AndAlso TxtFechaAnticipoCliente.Text.ToDate.Year >= 2018 Then
|
||||
If ObjCliente.DtResultados.Rows.Count > 0 Then
|
||||
If Not tipoCambioPago = 1 Then
|
||||
IdCtaContable = ObjCliente.IdCtaContMonedaExtranjera
|
||||
Else
|
||||
IdCtaContable = ObjCliente.IdCtaContClientes
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
|
||||
If Not ObjConta.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, importeMovimiento, Concepto, 555, Concepto, Now, IdCtaContable, -1, CveVenta:=CveVenta, CveCliente:=CveCliente, CveIE:=CveIEAnticipo, ImporteMX:=importeMN, CveCuenta:=-1, TipoCambio:=tipoCambioPago, CveSubProyecto:=CveSubProyectoVenta) Then
|
||||
ErrorConta = True
|
||||
End If
|
||||
|
||||
End If
|
||||
End If
|
||||
End Select
|
||||
@@ -16621,189 +16546,194 @@ Partial Class Ventas
|
||||
#End Region
|
||||
|
||||
#Region "I M A G E - B U T T O N S"
|
||||
Protected Function CancelarFactura(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjAC As ClsContPAQi, ByRef ObjBancos As ClsBancos) As Boolean
|
||||
Dim IDPoliza As Integer = -1
|
||||
Dim CvePrePoliza As Integer
|
||||
Dim CvePlantillaPoliza As Integer
|
||||
'Protected Function CancelarFactura(ByRef ObjVentas As ClsVentas, ByRef ObjConta As ClsContabilidad, ByRef ObjAC As ClsContPAQi, ByRef ObjBancos As ClsBancos) As Boolean
|
||||
' Dim IDPoliza As Integer = -1
|
||||
' Dim CvePrePoliza As Integer
|
||||
' Dim CvePlantillaPoliza As Integer
|
||||
|
||||
Dim ErrorCancelar As Boolean = False
|
||||
Dim Mensaje As String = ""
|
||||
' Dim ErrorCancelar As Boolean = False
|
||||
' Dim Mensaje As String = ""
|
||||
|
||||
Try
|
||||
ObjFacturaDevolucion.TipoDocto = ObjFactura.TipoDocto
|
||||
' Try
|
||||
' ObjFacturaDevolucion.TipoDocto = ObjFactura.TipoDocto
|
||||
|
||||
If ObjFacturaDevolucion.TipoDocto.Contiene("Egs", "Dev") Then
|
||||
CvePlantillaPoliza = 7
|
||||
ElseIf ObjFacturaDevolucion.TipoDocto.Contiene("Ing", "Rem", "Ant") Then
|
||||
CvePlantillaPoliza = 4
|
||||
End If
|
||||
' Dim TipoContable As Integer = -1
|
||||
' If ObjFacturaDevolucion.TipoDocto.Contiene("Egs", "Dev") Then
|
||||
' CvePlantillaPoliza = 7
|
||||
' ElseIf ObjFacturaDevolucion.TipoDocto.Contiene("Ing", "Rem", "Ant") Then
|
||||
' CvePlantillaPoliza = 4
|
||||
' End If
|
||||
|
||||
' If UsuarioActual.Empresa.Funcionalidad(706) = "1" AndAlso Then
|
||||
|
||||
' End If
|
||||
|
||||
|
||||
CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardaEstatus", CvePlantillaPoliza, TxtTotal.Text.ToDouble, TxtTotal.Text.Replace(",", "").ToDouble, DdlMoneda.SelectedValue.ToEntero(), Now, NombreCliente, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
ObjFacturaDevolucion.CveVenta = CveVenta
|
||||
ObjFacturaDevolucion.CvePrePoliza = CvePrePoliza
|
||||
' CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardaEstatus", CvePlantillaPoliza, TxtTotal.Text.ToDouble, TxtTotal.Text.Replace(",", "").ToDouble, DdlMoneda.SelectedValue.ToEntero(), Now, NombreCliente, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
' ObjFacturaDevolucion.CveVenta = CveVenta
|
||||
' ObjFacturaDevolucion.CvePrePoliza = CvePrePoliza
|
||||
|
||||
|
||||
If NuevaFactura = 1 AndAlso UsuarioActual.TienePermisoProceso(222) Then
|
||||
If ObjVentas.GetVentaDetalle(ObjFacturaDevolucion.CveVenta) Then
|
||||
TmpDT = ObjVentas.DtResultados
|
||||
TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer))
|
||||
TmpDT.Columns.Add("TieneProntoPago", GetType(String))
|
||||
TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
|
||||
End If
|
||||
ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFacturaDevolucion, -1, TmpDT, ObjAC, -1, ObjBancos, ObjVentas)
|
||||
Else
|
||||
ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFacturaDevolucion, -1, TmpDT, ObjAC, -1, ObjBancos, ObjVentas)
|
||||
End If
|
||||
' If NuevaFactura = 1 AndAlso UsuarioActual.TienePermisoProceso(222) Then
|
||||
' If ObjVentas.GetVentaDetalle(ObjFacturaDevolucion.CveVenta) Then
|
||||
' TmpDT = ObjVentas.DtResultados
|
||||
' TmpDT.Columns.Add("CveVentaDetalleRNC", GetType(Integer))
|
||||
' TmpDT.Columns.Add("TieneProntoPago", GetType(String))
|
||||
' TmpDT.Columns.Add("ImporteProntoPago", GetType(Decimal))
|
||||
' End If
|
||||
' ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFacturaDevolucion, -1, TmpDT, ObjAC, -1, ObjBancos, ObjVentas)
|
||||
' Else
|
||||
' ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFacturaDevolucion, -1, TmpDT, ObjAC, -1, ObjBancos, ObjVentas)
|
||||
' End If
|
||||
|
||||
If Not ErrorCancelar Then
|
||||
ErrorCancelar = GuardarVentaImpuestosLocales(ObjVentas, ObjConta, ObjFacturaDevolucion, -1)
|
||||
End If
|
||||
' If Not ErrorCancelar Then
|
||||
' ErrorCancelar = GuardarVentaImpuestosLocales(ObjVentas, ObjConta, ObjFacturaDevolucion, -1)
|
||||
' End If
|
||||
|
||||
If CveEstatus = 4 Then
|
||||
' If CveEstatus = 4 Then
|
||||
|
||||
If ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, "", Now, CveVenta, IDPoliza) Then
|
||||
Mensaje = "El nuevo estatus se guardó correctamente"
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
' If ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, "", Now, CveVenta, IDPoliza) Then
|
||||
' Mensaje = "El nuevo estatus se guardó correctamente"
|
||||
' Else
|
||||
' ErrorCancelar = True
|
||||
' End If
|
||||
|
||||
'Si se está mandando a Cancelada SAT
|
||||
ElseIf CveEstatus = 5 Then
|
||||
' 'Si se está mandando a Cancelada SAT
|
||||
' ElseIf CveEstatus = 5 Then
|
||||
|
||||
Dim DT As DataTable = Nothing
|
||||
' Dim DT As DataTable = Nothing
|
||||
|
||||
If FolioFiscal = "" Then
|
||||
Dim XmlDoc As New XmlDocument
|
||||
XmlDoc.Load(Ruta & "XML\" & DdlTipoComprobante.SelectedValue & "\" & VentaFolio & ".xml")
|
||||
ViewState("FolioFiscal") = XmlDoc.DocumentElement("cfdi:Complemento").FirstChild.Attributes("UUID").InnerText
|
||||
End If
|
||||
' If FolioFiscal = "" Then
|
||||
' Dim XmlDoc As New XmlDocument
|
||||
' XmlDoc.Load(Ruta & "XML\" & DdlTipoComprobante.SelectedValue & "\" & VentaFolio & ".xml")
|
||||
' ViewState("FolioFiscal") = XmlDoc.DocumentElement("cfdi:Complemento").FirstChild.Attributes("UUID").InnerText
|
||||
' End If
|
||||
|
||||
Dim ObjCancelacion As New Timbrado
|
||||
' Dim ObjCancelacion As New Timbrado
|
||||
|
||||
Dim Total As Decimal = TxtTotal.Text.ToDecimal
|
||||
Dim RFCReceptor As String = HdnRFCVenta.Value
|
||||
' Dim Total As Decimal = TxtTotal.Text.ToDecimal
|
||||
' Dim RFCReceptor As String = HdnRFCVenta.Value
|
||||
|
||||
If Not ObjVentas.UpdateEstatusFactura(13, FolioFiscal, "", Now, CveVenta, IDPoliza) Then 'Marcamos la factura como refacturada, si no se cancelo en el SAT el estatus nos dejara cancelarla despues
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
Dim RespCancelacion = ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, UsuarioActual.Empresa.RFC)
|
||||
If RespCancelacion.Verificado Then
|
||||
'falta verificar traer el acuse y reenviarlo
|
||||
' If Not ObjVentas.UpdateEstatusFactura(13, FolioFiscal, "", Now, CveVenta, IDPoliza) Then 'Marcamos la factura como refacturada, si no se cancelo en el SAT el estatus nos dejara cancelarla despues
|
||||
' ErrorCancelar = True
|
||||
' End If
|
||||
' Dim RespCancelacion = ObjCancelacion.CFDICancelar(UsuarioActual.Empresa, FolioFiscal, Total, RFCReceptor, UsuarioActual.Empresa.RFC)
|
||||
' If RespCancelacion.Verificado Then
|
||||
' 'falta verificar traer el acuse y reenviarlo
|
||||
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC Then
|
||||
Dim IDMPoliza As Modelos.RetornoPolizaConta = GenerarPolizaAC(ObjAC, ObjFacturaDevolucion, True)
|
||||
IDPoliza = IDMPoliza.IdPoliza
|
||||
If IDMPoliza.IdPoliza <= 0 Then
|
||||
Mensaje = "No se pudo generar la poliza"
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
End If
|
||||
' If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC Then
|
||||
' Dim IDMPoliza As Modelos.RetornoPolizaConta = GenerarPolizaAC(ObjAC, ObjFacturaDevolucion, True)
|
||||
' IDPoliza = IDMPoliza.IdPoliza
|
||||
' If IDMPoliza.IdPoliza <= 0 Then
|
||||
' Mensaje = "No se pudo generar la poliza"
|
||||
' ErrorCancelar = True
|
||||
' End If
|
||||
' End If
|
||||
|
||||
If Not ErrorCancelar Then
|
||||
If ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, ObjCancelacion.CancelacionAcuse, Now, CveVenta, IDPoliza, CvePAC:=UsuarioActual.Empresa.CvePAC) Then
|
||||
Mensaje = "El nuevo estatus se guardó correctamente"
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
End If
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
' If Not ErrorCancelar Then
|
||||
' If ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, ObjCancelacion.CancelacionAcuse, Now, CveVenta, IDPoliza, CvePAC:=UsuarioActual.Empresa.CvePAC) Then
|
||||
' Mensaje = "El nuevo estatus se guardó correctamente"
|
||||
' Else
|
||||
' ErrorCancelar = True
|
||||
' End If
|
||||
' End If
|
||||
' Else
|
||||
' ErrorCancelar = True
|
||||
' End If
|
||||
|
||||
ObjCancelacion = Nothing
|
||||
' ObjCancelacion = Nothing
|
||||
|
||||
End If
|
||||
Catch ex As Exception
|
||||
GuardaLog("CancelF." & ex.ToString())
|
||||
ErrorCancelar = True
|
||||
End Try
|
||||
' End If
|
||||
' Catch ex As Exception
|
||||
' GuardaLog("CancelF." & ex.ToString())
|
||||
' ErrorCancelar = True
|
||||
' End Try
|
||||
|
||||
Return Not ErrorCancelar
|
||||
End Function
|
||||
Protected Function CancelarFactura2(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjAC As ClsContPAQi, ObjBancos As ClsBancos) As Boolean
|
||||
' Return Not ErrorCancelar
|
||||
'End Function
|
||||
'Protected Function CancelarFactura2(ObjVentas As ClsVentas, ObjConta As ClsContabilidad, ObjAC As ClsContPAQi, ObjBancos As ClsBancos) As Boolean
|
||||
|
||||
Dim IDPoliza As Integer = -1
|
||||
Dim CvePrePoliza As Integer
|
||||
Dim CvePlantillaPoliza As Integer
|
||||
' Dim IDPoliza As Integer = -1
|
||||
' Dim CvePrePoliza As Integer
|
||||
' Dim CvePlantillaPoliza As Integer
|
||||
|
||||
Dim ErrorCancelar As Boolean = False
|
||||
Dim Mensaje As String = ""
|
||||
' Dim ErrorCancelar As Boolean = False
|
||||
' Dim Mensaje As String = ""
|
||||
|
||||
CreaObjetosVenta()
|
||||
' CreaObjetosVenta()
|
||||
|
||||
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then
|
||||
CvePlantillaPoliza = 7
|
||||
ElseIf ObjFactura.TipoDocto.Contiene("Ing", "Rem") Then
|
||||
CvePlantillaPoliza = 4
|
||||
End If
|
||||
' If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then
|
||||
' CvePlantillaPoliza = 7
|
||||
' ElseIf ObjFactura.TipoDocto.Contiene("Ing", "Rem") Then
|
||||
' CvePlantillaPoliza = 4
|
||||
' End If
|
||||
|
||||
|
||||
CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardaEstatus", CvePlantillaPoliza, TxtTotal.Text.ToDouble, TxtTotal.Text.Replace(",", "").ToDouble, DdlMoneda.SelectedValue.ToEntero(), Now, NombreCliente, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
ObjFactura.CveVenta = CveVenta
|
||||
ObjFactura.CvePrePoliza = CvePrePoliza
|
||||
' CvePrePoliza = ObjConta.AddPrePolizas("Ventas/GuardaEstatus", CvePlantillaPoliza, TxtTotal.Text.ToDouble, TxtTotal.Text.Replace(",", "").ToDouble, DdlMoneda.SelectedValue.ToEntero(), Now, NombreCliente, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
|
||||
' ObjFactura.CveVenta = CveVenta
|
||||
' ObjFactura.CvePrePoliza = CvePrePoliza
|
||||
|
||||
If HplSaldoAuxiliar.Text.ToDecimal > 0 Then
|
||||
ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFactura, -1, TmpDT, ObjAC, -1, ObjBancos, ObjVentas)
|
||||
End If
|
||||
' If HplSaldoAuxiliar.Text.ToDecimal > 0 Then
|
||||
' ErrorCancelar = ProcesoPrepolizas(ObjConta, ObjFactura, -1, TmpDT, ObjAC, -1, ObjBancos, ObjVentas)
|
||||
' End If
|
||||
|
||||
If Not ErrorCancelar Then
|
||||
ErrorCancelar = GuardarVentaImpuestosLocales(ObjVentas, ObjConta, ObjFactura, -1)
|
||||
End If
|
||||
' If Not ErrorCancelar Then
|
||||
' ErrorCancelar = GuardarVentaImpuestosLocales(ObjVentas, ObjConta, ObjFactura, -1)
|
||||
' End If
|
||||
|
||||
If CveEstatus = 4 Then
|
||||
' If CveEstatus = 4 Then
|
||||
|
||||
If ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, "", Now, CveVenta, IDPoliza) Then
|
||||
Mensaje = "El nuevo estatus se guardó correctamente"
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
' If ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, "", Now, CveVenta, IDPoliza) Then
|
||||
' Mensaje = "El nuevo estatus se guardó correctamente"
|
||||
' Else
|
||||
' ErrorCancelar = True
|
||||
' End If
|
||||
|
||||
'Si se está mandando a Cancelada SAT
|
||||
ElseIf CveEstatus = 5 Then
|
||||
' 'Si se está mandando a Cancelada SAT
|
||||
' ElseIf CveEstatus = 5 Then
|
||||
|
||||
Dim DT As DataTable = Nothing
|
||||
' Dim DT As DataTable = Nothing
|
||||
|
||||
If FolioFiscal = "" Then
|
||||
Dim XmlDoc As New XmlDocument
|
||||
XmlDoc.Load(Ruta & "XML\" & DdlTipoComprobante.SelectedValue & "\" & VentaFolio & ".xml")
|
||||
ViewState("FolioFiscal") = XmlDoc.DocumentElement("cfdi:Complemento").FirstChild.Attributes("UUID").InnerText
|
||||
End If
|
||||
' If FolioFiscal = "" Then
|
||||
' Dim XmlDoc As New XmlDocument
|
||||
' XmlDoc.Load(Ruta & "XML\" & DdlTipoComprobante.SelectedValue & "\" & VentaFolio & ".xml")
|
||||
' ViewState("FolioFiscal") = XmlDoc.DocumentElement("cfdi:Complemento").FirstChild.Attributes("UUID").InnerText
|
||||
' End If
|
||||
|
||||
'Si es cancelar en el SAT:
|
||||
Dim CFDi As New ClbNegBICFDv3_2.ClsNegEDI
|
||||
Dim Respuesta As New ClbNegBICFDv3_2.ClsNegRespuesta
|
||||
Respuesta = CFDi.CancelaCFdi(UsuarioActual.Empresa.BIUsuario, UsuarioActual.Empresa.BIContraseña, Ruta & "Certificados\" & UsuarioActual.Empresa.ArchivoPfx, UsuarioActual.Empresa.ContraseñaKey, UsuarioActual.Empresa.RFC, FolioFiscal, "http://208.43.160.178/srvCFDi/service1.asmx")
|
||||
' 'Si es cancelar en el SAT:
|
||||
' Dim CFDi As New ClbNegBICFDv3_2.ClsNegEDI
|
||||
' Dim Respuesta As New ClbNegBICFDv3_2.ClsNegRespuesta
|
||||
' Respuesta = CFDi.CancelaCFdi(UsuarioActual.Empresa.BIUsuario, UsuarioActual.Empresa.BIContraseña, Ruta & "Certificados\" & UsuarioActual.Empresa.ArchivoPfx, UsuarioActual.Empresa.ContraseñaKey, UsuarioActual.Empresa.RFC, FolioFiscal, "http://208.43.160.178/srvCFDi/service1.asmx")
|
||||
|
||||
If Respuesta Is Nothing Then
|
||||
'Alert("La factura no se pudo cancelar. <br />Posbiles causas:<br /> - Los servicios del SAT están ocupados.<br /> - El Folio Fiscal no ha quedado registrado.", TipoMensaje.MsgError)
|
||||
Me.GuardaLog(CFDi.MsgError)
|
||||
ErrorCancelar = True
|
||||
Mensaje = "La factura no se pudo cancelar. <br />Posbiles causas:<br /> - Los servicios del SAT están ocupados.<br /> - El Folio Fiscal no ha quedado registrado."
|
||||
ElseIf Respuesta.NoCertificadoSAT <> String.Empty Then
|
||||
' If Respuesta Is Nothing Then
|
||||
' 'Alert("La factura no se pudo cancelar. <br />Posbiles causas:<br /> - Los servicios del SAT están ocupados.<br /> - El Folio Fiscal no ha quedado registrado.", TipoMensaje.MsgError)
|
||||
' Me.GuardaLog(CFDi.MsgError)
|
||||
' ErrorCancelar = True
|
||||
' Mensaje = "La factura no se pudo cancelar. <br />Posbiles causas:<br /> - Los servicios del SAT están ocupados.<br /> - El Folio Fiscal no ha quedado registrado."
|
||||
' ElseIf Respuesta.NoCertificadoSAT <> String.Empty Then
|
||||
|
||||
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC Then
|
||||
Dim IDMPoliza As Modelos.RetornoPolizaConta = GenerarPolizaAC(ObjAC, ObjFacturaDevolucion, True)
|
||||
IDPoliza = IDMPoliza.IdPoliza
|
||||
If IDMPoliza.IdPoliza <= 0 Then
|
||||
Mensaje = "No se pudo generar la poliza"
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
End If
|
||||
' If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC Then
|
||||
' Dim IDMPoliza As Modelos.RetornoPolizaConta = GenerarPolizaAC(ObjAC, ObjFacturaDevolucion, True)
|
||||
' IDPoliza = IDMPoliza.IdPoliza
|
||||
' If IDMPoliza.IdPoliza <= 0 Then
|
||||
' Mensaje = "No se pudo generar la poliza"
|
||||
' ErrorCancelar = True
|
||||
' End If
|
||||
' End If
|
||||
|
||||
If Not ErrorCancelar Then
|
||||
If ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, Respuesta.NoCertificadoSAT, Respuesta.FechaTimbrado, CveVenta, IDPoliza) Then
|
||||
Mensaje = "El nuevo estatus se guardó correctamente"
|
||||
Else
|
||||
ErrorCancelar = True
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
' If Not ErrorCancelar Then
|
||||
' If ObjVentas.UpdateEstatusFactura(CveEstatus, FolioFiscal, Respuesta.NoCertificadoSAT, Respuesta.FechaTimbrado, CveVenta, IDPoliza) Then
|
||||
' Mensaje = "El nuevo estatus se guardó correctamente"
|
||||
' Else
|
||||
' ErrorCancelar = True
|
||||
' End If
|
||||
' End If
|
||||
' End If
|
||||
|
||||
End If
|
||||
' End If
|
||||
|
||||
Return Not ErrorCancelar
|
||||
End Function
|
||||
' Return Not ErrorCancelar
|
||||
'End Function
|
||||
|
||||
Protected Sub ImgBtnAddC_Click(sender As Object, e As ImageClickEventArgs) Handles ImgBtnAddC.Click
|
||||
Dim Row As DataRow = Nothing
|
||||
@@ -17218,6 +17148,10 @@ Partial Class Ventas
|
||||
tdFechaVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot")
|
||||
|
||||
|
||||
If UsuarioActual.Empresa.Funcionalidad(706) = "1" AndAlso (CveVenta <= 0 OrElse EsCreaApartirDe) AndAlso DdlTipoComprobante.SelectedValue.Contiene("Rem") Then
|
||||
TrTipoContable.Visible = True
|
||||
End If
|
||||
|
||||
Updatetabs.Update()
|
||||
UPCondicionesPago.Update()
|
||||
UpCliente.Update()
|
||||
@@ -19916,6 +19850,7 @@ Partial Class Ventas
|
||||
If Not OcurrioError AndAlso RemisionesLista.Count > 0 AndAlso DtRemConceptosSurtidos IsNot Nothing Then
|
||||
If DtRemConceptosSurtidos.SUMD("Surtido") <> DtRemConceptosSurtidos.SUMD("Cantidad") Then
|
||||
OcurrioError = True
|
||||
Alert("Lo facturado no coincide con lo surtido en inventario", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
End If
|
||||
|
||||
@@ -26509,7 +26444,7 @@ Partial Class Ventas
|
||||
params.Add(New ReportParameter("FechaEstimada", FechaEstimada))
|
||||
|
||||
If Imagen.Exists Then
|
||||
params.Add(New ReportParameter("LogoPath", logouri))
|
||||
params.Add(New ReportParameter("LogoPath", $"file://{Imagen.FullName}"))
|
||||
Else
|
||||
params.Add(New ReportParameter("LogoPath", ""))
|
||||
End If
|
||||
@@ -33462,11 +33397,14 @@ Partial Class Ventas
|
||||
TxtPedidoContrato.Enabled = True
|
||||
TxtObsAlmacen.Enabled = True
|
||||
RblPaqueteria.Enabled = True
|
||||
DdlLineaAdicional.Enabled = True
|
||||
|
||||
LnkUpdateLineaAdicional.Visible = True
|
||||
'Acciones
|
||||
BtnEditar.Text = "Guardar"
|
||||
|
||||
CalculaLineasAdicionales()
|
||||
DdlLineaAdicional.Enabled = True
|
||||
|
||||
UpParametros.Update()
|
||||
UPObservaciones.Update()
|
||||
UpFacturar.Update()
|
||||
@@ -35348,9 +35286,17 @@ Partial Class Ventas
|
||||
|
||||
Me.CveCategoriaLineaAdicional = RowLinea("CveCategoria").ToString().ToEntero()
|
||||
Me.CveMonedaLineaAdicional = RowLinea("CveMoneda").ToString().ToEntero()
|
||||
Me.SaldoLineaAdicional = RowLinea("Saldo").ToString().ToDecimal()
|
||||
End If
|
||||
|
||||
Else
|
||||
Alert("No se pudieron obtener datos de la linea adicional", TipoMensaje.MsgAdvertencia)
|
||||
Me.SaldoLineaAdicional = 0
|
||||
Me.CveCategoriaLineaAdicional = 0
|
||||
End If
|
||||
Else
|
||||
Alert("No se pudieron obtener datos de la linea adicional", TipoMensaje.MsgAdvertencia)
|
||||
Me.SaldoLineaAdicional = 0
|
||||
Me.CveCategoriaLineaAdicional = 0
|
||||
End If
|
||||
End Using
|
||||
Else
|
||||
|
||||
Reference in New Issue
Block a user