-- proceso de simplificacion y validacion

This commit is contained in:
rrene
2020-04-08 20:23:29 -07:00
parent f91f23e2b1
commit 336487b789

View File

@@ -189,14 +189,6 @@ Partial Class Ventas_ClientesAbonar
End Get
End Property
Private Property EmpresaPrueba As Boolean
Get
Return CBool(ViewState("EmpresaPrueba"))
End Get
Set(value As Boolean)
ViewState("EmpresaPrueba") = value
End Set
End Property
Private Property Mail As String
Get
@@ -313,14 +305,8 @@ Partial Class Ventas_ClientesAbonar
TxtOtrosImportes.Attributes.Add("onKeyUp", String.Format("FnSuma(this,{0},{1});", "TxtTotal", 0))
If Not UsuarioActual.Empresa.UsaAC Then
EmpresaPrueba = True
End If
If CveMoneda > 0 Then LbTipoMoneda.Text = String.Format("Pago en {0}", GlobalDTMonedas.FiltraParametros(String.Format("CveMoneda = {0}", CveMoneda)).Rows(0)("Moneda"))
If CveMoneda = 2 Then
ChkPagarPesos.Visible = True
TxtTC.Text = GlobalTipoCambio(Fecha).FormatoNumero(4)
@@ -814,8 +800,12 @@ Partial Class Ventas_ClientesAbonar
'inserto las ventas que voy a pagar
For Each gvr As GridViewRow In GvCxC.Rows
If gvr.FCCheckBox("Chk").Checked Then
Dim ObjFactura As Modelos.Factura
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
ObjFactura = New Modelos.Factura(UsuarioActual, gvr.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
End If
Dim ObjFactura As New Modelos.Factura(UsuarioActual, gvr.DataKey("CveVenta").ToEntero(), UsuarioActual.CveEmpresa)
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then 'Si la venta viene en Pesos y se va a pagar en Pesos
tipoCambioPago = 1
@@ -915,7 +905,7 @@ Partial Class Ventas_ClientesAbonar
Case 8 'Ret IVA x Trasladar
If EsAnticipoEspecial Then Exit Select
If ObjFactura.CveTipoRetencion = 4 Then
If ObjFactura IsNot Nothing AndAlso ObjFactura.CveTipoRetencion = 4 Then
Exit Select
End If
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
@@ -964,7 +954,7 @@ Partial Class Ventas_ClientesAbonar
Case 313 'Ret Iva Servicios
If EsAnticipoEspecial Then Exit Select
If ObjFactura.CveTipoRetencion = 4 Then
If ObjFactura IsNot Nothing AndAlso ObjFactura.CveTipoRetencion = 4 Then
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago
importeMX = ImporteMovimiento
@@ -1079,7 +1069,7 @@ Partial Class Ventas_ClientesAbonar
If tipoCambioVenta > 1 Then ConceptoMovimiento += $" TC:{tipoCambioVenta} ${ImporteMovimiento.FormatoNumero(2)}"
Case 62 'Ret IVA Trasladado
If EsAnticipoEspecial Then Exit Select
If ObjFactura.CveTipoRetencion = 4 Then
If ObjFactura IsNot Nothing AndAlso ObjFactura.CveTipoRetencion = 4 Then
Exit Select
End If
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
@@ -1129,7 +1119,7 @@ Partial Class Ventas_ClientesAbonar
Case 314 'Ret Iva Servicios Traslado
If EsAnticipoEspecial Then Exit Select
If ObjFactura.CveTipoRetencion = 4 Then
If ObjFactura IsNot Nothing AndAlso ObjFactura.CveTipoRetencion = 4 Then
If CveMoneda = 1 AndAlso gvr.DataKey("CveMoneda").ToEntero = 1 Then
ImporteMovimiento = gvr.DataKey("RetIVA").ToDecimal * PorcentajePago
importeMX = ImporteMovimiento
@@ -1482,7 +1472,7 @@ Partial Class Ventas_ClientesAbonar
End If
Next
End If
If gvr.FCCheckBox("ChkGenerarNC").Checked Then
If gvr.FCCheckBox("ChkGenerarNC").Checked AndAlso ObjFactura IsNot Nothing Then
ObjFactura.DescuentoProntoPago = gvr.DataKey("DescuentoProntoPago").ToDecimal()
ListaFacturasGenerarNC.Add(ObjFactura)
End If
@@ -1571,42 +1561,34 @@ Partial Class Ventas_ClientesAbonar
End If
End If
If MsgError = "" AndAlso UsuarioActual.Empresa.Funcionalidad(220) <> "" Then
If Not ObjMov.PrePolizaSimplificacion(CvePrePoliza, UsuarioActual.CveEmpresa) Then
MsgError = "No se pudo simplificar los movimientos"
Alert("No se pudo simplificar los movimientos", TipoMensaje.MsgError)
End If
End If
If ObjMov.ValidacionPrePolizaCuadre(CvePrePoliza, 3) Then
If ObjMov.ValorPolizaDescuadre > 0 Then
MsgError = ObjMov.MensajePolizaDescuadre + " La diferencia es de: " + ObjMov.ValorDiferencia
End If
End If
If EmpresaPrueba Then 'Empresa Prueba
'El movimiento 2 es el de Pago
'Conta SIG
If UsuarioActual.Empresa.Funcionalidad(200) = "1" And MsgError = "" AndAlso UsuarioActual.Empresa.UsaContabilidadSIG Then
If CveCuentaContabilizacion > 0 Then
If ObjMov.ContabilizarPrePolizaSIG(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
IDPoliza = ObjMov.ContaIdPoliza
FolioPoliza = ObjMov.ContaFolio
Else
Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico")
End If
'Conta ContPAQ
If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then
If idCuentaContabilizacion > 0 Then
If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
IDPoliza = ObjMov.ContaIdPoliza
FolioPoliza = ObjMov.ContaFolio
Else
Alert(String.Format("No se puede contabilizar la Prepoliza debido a que las siguientes cuentas son invalidas: {0}", CuentasContablesInvalidasSIG))
Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico")
MsgError = "Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico"
End If
Else
Alert(String.Format("No se puede contabilizar la Prepoliza debido a que las siguientes cuentas son invalidas: {0}", CuentasContablesInvalidas))
End If
End If
'Conta ContPAQ
If UsuarioActual.Empresa.Funcionalidad(200) = "1" AndAlso MsgError = "" Then
If idCuentaContabilizacion > 0 Then
If ObjMov.ContabilizarPrePoliza(CvePrePoliza, UsuarioActual.CveUsuario, UsuarioActual.Empresa) Then
IDPoliza = ObjMov.ContaIdPoliza
FolioPoliza = ObjMov.ContaFolio
Else
Alert("Ocurrio un error al contabilizar, pongase en contacto con Soporte Técnico")
End If
Else
Alert(String.Format("No se puede contabilizar la Prepoliza debido a que las siguientes cuentas son invalidas: {0}", CuentasContablesInvalidas))
End If
End If
End If 'Empresa Prueba
Else
MsgError = "No se pudo insertar la póliza"
End If