-- corrección otros egresos

This commit is contained in:
2024-06-18 19:25:23 -07:00
parent 7c2eec887b
commit 1c64469384
2 changed files with 129 additions and 130 deletions

View File

@@ -161,7 +161,7 @@
</div>
</div>
<div class="row" runat="server" id="rowComisiones" visible="false">
<div class="row" runat="server" id="rowComisiones" >
<label class="col-xs-4" runat="server" id="lblpagocomisiones">Comisiones:</label>
<div class="col-xs-8">
<asp:DropDownList ID="DdlOtrosPagos" CssClass="form-control input-sm select2me" runat="server" AutoPostBack="true" Width="100%">

View File

@@ -325,9 +325,7 @@ Partial Class Bancos_PopIEVentas
ViewState("CveIE") = -1
End If
If UsuarioActual.CveEmpresa.Contiene(1, 4, 7, 11, 12, 72, 80, 119) Then
rowComisiones.Visible = True
End If
'rowComisiones.Visible = True
'SI USUARIO USA AMORTIZACIÓN CONTABLE
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC Then
@@ -547,10 +545,11 @@ Partial Class Bancos_PopIEVentas
CargaCorteCaja()
End If
If UsuarioActual.Empresa.Funcionalidad(531) = "1" Then 'toma como proridad el que viene de
If UsuarioActual.Empresa.Funcionalidad(531) = "1" OrElse (dr("CveCorte").ToString.ToEntero > 0) Then 'toma como proridad el que viene de
CveCorte = dr("CveCorte").ToString.ToEntero
End If
If RFCCliente.ToUpper <> "XAXX010101000" Then
Dim CveProveedor As Integer = GlobalDTCompProveedores(UsuarioActual.CveEmpresa, RFC:=RFCCliente.ToUpper).FiltroPrimeroValor("CveProveedor").ToEntero
@@ -752,8 +751,8 @@ Partial Class Bancos_PopIEVentas
#Region "DDL'S CHANGED"
Protected Sub DdlTipoTransaccion_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoTransaccion.SelectedIndexChanged
Dim valor As Integer = DirectCast(sender, DropDownList).SelectedValue.ToEntero
Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", DdlTipoTransaccion.SelectedValue)) 'Egs o Ing
'Dim valor As Integer = DirectCast(sender, DropDownList).SelectedValue.ToEntero
'Dim dr As DataRow = GlobalDTTipoTransacciones.FiltroPrimero(String.Format("CveTipoTransaccion = {0}", DdlTipoTransaccion.SelectedValue)) 'Egs o Ing
Select Case valor
Case 1
@@ -1239,162 +1238,162 @@ Partial Class Bancos_PopIEVentas
Pago.CveMonedaPago = CveMoneda
Pago.Referencia = VentaActual.SerieFolio
If DdlOtrosPagos.SelectedValue = "2" Then
ImportePagado = TxtImporte.Text.Trim.ToDecimal.RoundSQL - TxtComision.Text.ToDecimal
ImportePagado = TxtImporte.Text.Trim.ToDecimal.RoundSQL + TxtComision.Text.ToDecimal
Else
ImportePagado = TxtImporte.Text.Trim.ToDecimal.RoundSQL
End If
'Tipos de cambio
If Pago.CveMonedaPago = 1 AndAlso VentaActual.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en Pesos
Pago.TCPago = 1 / TxtTipoCambio.Text.ToDecimal
ElseIf Pago.CveMonedaPago = 2 AndAlso VentaActual.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en DOLARES
Pago.TCPago = TxtTipoCambio.Text.ToDecimal
ElseIf Pago.CveMonedaPago = 2 AndAlso VentaActual.CveMoneda = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES
Pago.TCPago = TxtTipoCambio.Text.ToDecimal
Pago.TCPago = TxtTipoCambio.Text.ToDecimal
End If
If ChkPagarPesos.Checked Then Pago.TCPago = 1 / TxtTipoCambio.Text.ToDecimal
If ChkPagarDolares.Checked Then Pago.TCPago = TxtTipoCambio.Text.ToDecimal
Pago.TCPago = 1 / TxtTipoCambio.Text.ToDecimal
ElseIf Pago.CveMonedaPago = 2 AndAlso VentaActual.CveMoneda = 2 Then 'Si la venta viene en Dolares y se va a pagar en DOLARES
Pago.TCPago = TxtTipoCambio.Text.ToDecimal
ElseIf Pago.CveMonedaPago = 2 AndAlso VentaActual.CveMoneda = 1 Then 'Si la venta viene en pesos y se va a pagar en DOLARES
Pago.TCPago = TxtTipoCambio.Text.ToDecimal
Pago.TCPago = TxtTipoCambio.Text.ToDecimal
End If
If ChkPagarPesos.Checked Then Pago.TCPago = 1 / TxtTipoCambio.Text.ToDecimal
If ChkPagarDolares.Checked Then Pago.TCPago = TxtTipoCambio.Text.ToDecimal
If TxtComision.Text.ToDecimal <> 0 Then Pago.OtroGastoIngreso = TxtComision.Text.ToDecimal Else Pago.OtroGastoIngreso = 0
If TxtComision.Text.ToDecimal <> 0 Then Pago.OtroGastoIngreso = TxtComision.Text.ToDecimal Else Pago.OtroGastoIngreso = 0
Select Case RBLContado.SelectedValue
Case "1" ' Banco
Select Case RBLContado.SelectedValue
Case "1" ' Banco
CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero, Fecha, TxtFolio.Text.Trim, TxtPagueseA.Text.Trim, ImportePagado, CveMoneda, tipoCambioPago, TxtObservaciones.Text.Trim, "",
True, True, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCuentaTarjeta:=If(DivTarjeta.Visible, DdlTarjeta.SelectedValue.ToEntero, -1), CveCuentaDeposito:=CveCuentaDeposito,
Referencia:=If(TxtReferenciaCIE.Visible, TxtReferenciaCIE.Text, "-1"), CveCorte:=CveCorte, FechaEmision:=FechaEmision)
If CveIE > 0 Then
Pago.ImportePago = ImportePagado
Pago.ImportePagoVenta = ImportePagado
Pago.ImportePagoVenta = ImportePagado - Pago.OtroGastoIngreso
Pago.CveIE = CveIE
Pago.TipoPago = "B"
If MsgError = "" AndAlso AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjMov) Then
MsgError = "No se pudo insertar la póliza"
End If
Else
MsgError = "Ocurrio un Error al registrarse el movimiento bancario."
Inserta = False
End If
Case "2" ' FyE
Pago.ImportePago = ImportePagado
Pago.ImportePagoVenta = ImportePagado - Pago.OtroGastoIngreso
Pago.TipoPago = "FyE"
Pago.CvePersonal = DdlFuncionarioEmpleado.SelectedValue.ToEntero
Pago.Referencia = DdlFuncionarioEmpleado.SelectedItem.ToString
If MsgError = "" AndAlso AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjMov) Then
MsgError = "No se pudo insertar la póliza"
End If
Else
MsgError = "Ocurrio un Error al registrarse el movimiento bancario."
Inserta = False
End If
Case "2" ' FyE
Case "3" 'Ingresos x Comprobar
Pago.ImportePago = ImportePagado
Pago.ImportePagoVenta = ImportePagado
Pago.TipoPago = "FyE"
Pago.CvePersonal = DdlFuncionarioEmpleado.SelectedValue.ToEntero
Pago.Referencia = DdlFuncionarioEmpleado.SelectedItem.ToString
CveCliente = DdlIngreso.SelectedValue.ToEntero
CveIE = -1
ImportePagado = TxtImporte.Text.Trim.ToDecimal
Pago.ImportePago = ImportePagado
Pago.TipoPago = "I"
If MsgError = "" AndAlso AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjMov) Then
MsgError = "No se pudo insertar la póliza"
End If
For Each rw As GridViewRow In GvIngresos.Rows
If rw.FCCheckBox("Chk").Checked Then
CveIE = rw.DataKey("CveIE").ToEntero
Pago.CveMonedaPago = rw.DataKey("CveMoneda").ToEntero
Pago.ImportePago = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
Pago.ImportePagoVenta = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
Pago.TCPago = rw.DataKey("TipoCambio").ToDecimal
Pago.FechaDocumentoRelacionado = rw.DataKey("FechaDocumento").ToDate
Pago.CveIE = CveIE
Pago.CveClientePago = rw.DataKey("CveCliente").ToEntero
If ChkPagarPesos.Checked Then Pago.TCPago = 1 / rw.DataKey("TipoCambio").ToDecimal
If ChkPagarDolares.Checked Then Pago.TCPago = rw.DataKey("TipoCambio").ToDecimal
Case "3" 'Ingresos x Comprobar
CveCliente = DdlIngreso.SelectedValue.ToEntero
CveIE = -1
ImportePagado = TxtImporte.Text.Trim.ToDecimal
Pago.ImportePago = ImportePagado
Pago.TipoPago = "I"
For Each rw As GridViewRow In GvIngresos.Rows
If rw.FCCheckBox("Chk").Checked Then
CveIE = rw.DataKey("CveIE").ToEntero
Pago.CveMonedaPago = rw.DataKey("CveMoneda").ToEntero
Pago.ImportePago = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
Pago.ImportePagoVenta = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
Pago.TCPago = rw.DataKey("TipoCambio").ToDecimal
Pago.FechaDocumentoRelacionado = rw.DataKey("FechaDocumento").ToDate
Pago.CveIE = CveIE
Pago.CveClientePago = rw.DataKey("CveCliente").ToEntero
If ChkPagarPesos.Checked Then Pago.TCPago = 1 / rw.DataKey("TipoCambio").ToDecimal
If ChkPagarDolares.Checked Then Pago.TCPago = rw.DataKey("TipoCambio").ToDecimal
If AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjMov) Then
MsgError = "No se pudo insertar la póliza"
Else
Exit For
End If
End If
Next
Case "4" 'Deudores Diversos
ImportePagado = TxtImporte.Text.Trim.ToDecimal
'CveProveedor2 = DdlDeudor.SelectedValue.ToEntero
CveIE = -1
If DdlDeudor.SelectedValue.ToEntero <= 0 Then
Alert("Debe especificar el deudor.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
For Each rw As GridViewRow In GvDeudores.Rows
If rw.FCCheckBox("Chk").Checked AndAlso rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal <> 0 Then
Pago.CveIE = rw.DataKey("CveIE").ToEntero
Pago.CveMonedaPago = rw.DataKey("CveMoneda").ToEntero
Pago.ImportePago = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
Pago.TCPago = rw.DataKey("TipoCambio").ToDecimal
'Pago.CveProveedor = DdlDeudor.SelectedValue.ToEntero
Pago.TipoPago = "DD"
If AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjMov) Then
MsgError = "No se pudo insertar la póliza"
Else
Exit For
End If
End If
Next
Case "5" 'Compras
ImportePagado = TxtImporte.Text.Trim.ToDecimal
CveIE = -1
For Each rw As GridViewRow In GvCompras.Rows
If rw.FCCheckBox("Chk").Checked AndAlso rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal <> 0 Then
Pago.CveMonedaPago = 1
Pago.ImportePago = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
Pago.ImportePagoVenta = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
Pago.TipoPago = "Compra"
If AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjMov) Then
MsgError = "No se pudo insertar la póliza"
End If
If MsgError = "" Then
Dim CompraActual As New Compra() With {.CveCompra = rw.DataKey("CveCompra").ToEntero, .ProveedorNombre = NombreCliente, .SerieFolio = rw.DataKey("SerieFolio"), .CveProveedor = rw.DataKey("CveProveedor").ToEntero, .IVA = rw.DataKey("IVA").ToDecimal, .IEPS = rw.DataKey("IEPS").ToDecimal, .RetIVA = rw.DataKey("RetIVA").ToDecimal, .RetISR = rw.DataKey("RetISR").ToDecimal, .Total = rw.DataKey("Total").ToDecimal, .PorcentajeIVA = rw.DataKey("PorcentajeIVA").ToDecimal, .CveSubProyecto = rw.DataKey("CveSubProyecto").ToEntero, .CveMoneda = rw.DataKey("CveMoneda").ToEntero, .CveTipoConceptoProveedor = rw.DataKey("CveTipoConcepto").ToEntero}
Dim PagoCompra As New CompraPago
PagoCompra.CveMonedaPago = rw.DataKey("CveMoneda").ToEntero
PagoCompra.ImportePago = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
PagoCompra.TCPago = rw.DataKey("TipoCambio").ToDecimal
PagoCompra.CveProveedor = rw.DataKey("CveProveedor").ToEntero
PagoCompra.CveVentaRelacionada = CveVenta
PagoCompra.TipoPago = "Venta"
If AplicaPrePolizaPagoCompra(CompraActual, PagoCompra, CvePrePoliza, ObjMov) Then
If AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjMov) Then
MsgError = "No se pudo insertar la póliza"
Else
Exit For
End If
End If
Next
Case "4" 'Deudores Diversos
ImportePagado = TxtImporte.Text.Trim.ToDecimal
'CveProveedor2 = DdlDeudor.SelectedValue.ToEntero
CveIE = -1
If DdlDeudor.SelectedValue.ToEntero <= 0 Then
Alert("Debe especificar el deudor.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Next
Case Else
'NO SE HA DEFINIDO PARA FUNCIONARIO Y EMPLEADO
If RBLContado.SelectedValue <> "2" Then
MsgError = "No se ha especificada opcion."
End If
End Select
If MsgError = "" Then
If MsgError = "" AndAlso ObjMov.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=3) Then
If ObjMov.ValorPolizaDescuadre > 0 Then
MsgError = ObjMov.MensajePolizaDescuadre
For Each rw As GridViewRow In GvDeudores.Rows
If rw.FCCheckBox("Chk").Checked AndAlso rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal <> 0 Then
Pago.CveIE = rw.DataKey("CveIE").ToEntero
Pago.CveMonedaPago = rw.DataKey("CveMoneda").ToEntero
Pago.ImportePago = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
Pago.TCPago = rw.DataKey("TipoCambio").ToDecimal
'Pago.CveProveedor = DdlDeudor.SelectedValue.ToEntero
Pago.TipoPago = "DD"
If AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjMov) Then
MsgError = "No se pudo insertar la póliza"
Else
Exit For
End If
End If
Next
Case "5" 'Compras
ImportePagado = TxtImporte.Text.Trim.ToDecimal
CveIE = -1
For Each rw As GridViewRow In GvCompras.Rows
If rw.FCCheckBox("Chk").Checked AndAlso rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal <> 0 Then
Pago.CveMonedaPago = 1
Pago.ImportePago = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
Pago.ImportePagoVenta = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
Pago.TipoPago = "Compra"
If AplicaPrePolizaPagoVenta(VentaActual, Pago, CvePrePoliza, ObjMov) Then
MsgError = "No se pudo insertar la póliza"
End If
If MsgError = "" Then
Dim CompraActual As New Compra() With {.CveCompra = rw.DataKey("CveCompra").ToEntero, .ProveedorNombre = NombreCliente, .SerieFolio = rw.DataKey("SerieFolio"), .CveProveedor = rw.DataKey("CveProveedor").ToEntero, .IVA = rw.DataKey("IVA").ToDecimal, .IEPS = rw.DataKey("IEPS").ToDecimal, .RetIVA = rw.DataKey("RetIVA").ToDecimal, .RetISR = rw.DataKey("RetISR").ToDecimal, .Total = rw.DataKey("Total").ToDecimal, .PorcentajeIVA = rw.DataKey("PorcentajeIVA").ToDecimal, .CveSubProyecto = rw.DataKey("CveSubProyecto").ToEntero, .CveMoneda = rw.DataKey("CveMoneda").ToEntero, .CveTipoConceptoProveedor = rw.DataKey("CveTipoConcepto").ToEntero}
Dim PagoCompra As New CompraPago
PagoCompra.CveMonedaPago = rw.DataKey("CveMoneda").ToEntero
PagoCompra.ImportePago = rw.FCTextBox("TxtSaldoDeudor").Text.ToDecimal
PagoCompra.TCPago = rw.DataKey("TipoCambio").ToDecimal
PagoCompra.CveProveedor = rw.DataKey("CveProveedor").ToEntero
PagoCompra.CveVentaRelacionada = CveVenta
PagoCompra.TipoPago = "Venta"
If AplicaPrePolizaPagoCompra(CompraActual, PagoCompra, CvePrePoliza, ObjMov) Then
MsgError = "No se pudo insertar la póliza"
End If
End If
End If
Next
Case Else
'NO SE HA DEFINIDO PARA FUNCIONARIO Y EMPLEADO
If RBLContado.SelectedValue <> "2" Then
MsgError = "No se ha especificada opcion."
End If
End Select
If MsgError = "" Then
If MsgError = "" AndAlso ObjMov.ValidacionesPrePoliza(CvePrePoliza, UsuarioActual, Opcion:=3) Then
If ObjMov.ValorPolizaDescuadre > 0 Then
MsgError = ObjMov.MensajePolizaDescuadre
End If
End If
Else
MsgError = "No se pudo insertar la poliza detalle"
End If
Else
MsgError = "No se pudo insertar la poliza detalle"
End If
End If
Else
Else
MsgError = "venta no identificada"
End If
Else