+
diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb
index 556c2c13e..fbe4f03c8 100644
--- a/Ventas/PVCobranza.aspx.vb
+++ b/Ventas/PVCobranza.aspx.vb
@@ -38,6 +38,10 @@ Partial Class Ventas_PVCobranza
Private Sub CargaFiltros()
+ If UsuarioActual.CveRol <> 1 Then
+ ChkAplicaGasto.Visible = False
+ End If
+
DdlSubProyecto.DataSource = GlobalDTSubProyectosUsuarios(UsuarioActual.CveUsuario, -1, UsuarioActual.CveEmpresa, -1, 1)
DdlSubProyecto.DataBind()
@@ -62,7 +66,11 @@ Partial Class Ventas_PVCobranza
'If UsuarioActual.Empresa.Funcionalidad(558) = "1" OrElse UsuarioActual.Empresa.Funcionalidad(531) = "1" Then
DdlCuentaTarjetaCredito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 1", CveMon))
DdlCuentaTarjetaDebito.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta = 1 AND TieneTerminal = 1", CveMon))
- DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", CveMon))
+ DdlCuentaTransferencia.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = {0} AND CveTipoCuenta <> 1", CveMon))
+
+ DdlCuentaGasto.DataSource = DtCC.FiltraParametros(String.Format("CveMoneda = 1 AND CveTipoCuenta = 1", CveMon))
+ DdlCuentaGasto.DataBind()
+ DdlCuentaGasto.Items.Insert(0, New ListItem("Seleccione", "-1"))
DtCC.Dispose()
@@ -70,7 +78,7 @@ Partial Class Ventas_PVCobranza
DdlCuentaTarjetaCredito.DataBind()
DdlCuentaTarjetaDebito.DataBind()
DdlCuentaCheque.DataBind()
- DdlCuentaTransferencia.DataBind()
+ DdlCuentaTransferencia.DataBind()
TxtImporteEfectivo.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();")
TxtImporteCredito.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();")
@@ -581,17 +589,73 @@ Partial Class Ventas_PVCobranza
End Sub
Private Sub BtnAceptarIE_Click(sender As Object, e As EventArgs) Handles BtnAceptarIE.Click
- Dim ObjPVenta As New ClsPuntoVenta
- If TxtCantidadIE.Text.ToEntero() > 0 Then
- If ObjPVenta.AddVta_MovimientosCajas(CveCorte, UsuarioActual.CveUsuario, TxtCantidadIE.Text.ToDouble, TxtDescripcionIE.Text, HdnTipoMovimiento.Value.ToEntero(), NowADS()) Then
- TxtCantidadIE.Text = ""
- TxtDescripcionIE.Text = ""
- RegistraScript("$('#DivIngresoEgreso').modal('hide')", "divingresoegreso")
- Alert("El movimiento se realizó correctamente")
- UpIngresoEgreso.Update()
- End If
+ If TxtCantidadIE.Text.ToEntero() <= 0 Then
+ Alert("La cantidad debe ser mayor a 0", TipoMensaje.MsgAdvertencia)
+ Exit Sub
End If
+
+ Dim TieneError As Boolean = False
+ Dim ObjPVenta As New ClsPuntoVenta
+ Dim ObjIE As New ClsBancos(ObjPVenta.IniciaTransacSQL())
+ Dim ObjMov As New ClsContabilidad(ObjPVenta.IniciaTransacSQL())
+ Try
+ Dim CveMoneda As Integer = 1
+ Dim TipoCambio As Decimal = 1D
+
+ Dim Importe As Decimal = TxtCantidadIE.Text.ToDecimal()
+ If Not ObjPVenta.AddVta_MovimientosCajas(CveCorte, UsuarioActual.CveUsuario, Importe, TxtDescripcionIE.Text, HdnTipoMovimiento.Value.ToEntero(), NowADS()) Then
+ TieneError = True
+ End If
+ If ChkAplicaGasto.Checked Then
+
+ Dim CveTipoTransaccion As Integer = 2
+ Dim CvePrePoliza = ObjMov.AddPrePolizas("PVCobranza/Gasto ", 23, Importe, Importe, CveMoneda, Now, "Gasto", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
+ 'TRANSFERENCIA BANCARIA
+ Dim EsAbonoEnCuenta As Boolean = False
+ Dim AplicaImpuestos As Boolean = False
+ Dim Folio As Long = ObjIE.GetNextFolio(DdlCuentaGasto.SelectedValue.ToEntero, CveTipoTransaccion)
+
+ Dim CveIE = ObjIE.AddBancos_IE(DdlCuentaGasto.SelectedValue.ToEntero, CveTipoTransaccion, Now, Folio.ToString(), "", Importe, CveMoneda,
+ TipoCambio, TxtDescripcionIE.Text.Trim(), "", EsAbonoEnCuenta, AplicaImpuestos, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=Me.CveCorte)
+
+ Dim TipoMovimiento As Boolean = True
+
+ Dim Importe30 As Decimal = TxtCantidadIE.Text.ToDecimal
+
+ If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, Importe, Importe30, 30, Folio.ToString(), Folio.ToString(), CveIE:=CveIE) Then
+ Dim IVA As Decimal = 0 ' TxtImporte.Text.ToDouble * HdnProvPorIVA.Value.ToDouble
+ 'TEMPORAL - Préstamo Personal/Gasto por Comprobar
+ If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, Importe, Importe30, 28, Folio.ToString(), Folio.ToString(), CveIE:=CveIE, CvePersonal:=UsuarioActual.CvePersonal) Then
+ 'If IVA > 0 AndAlso Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, False, IVA, TxtImporte.Text.ToDecimal, 19, Ref, Conc, CveIE:=CveIE, CveCompra:=CveCompra, CveProveedor:=CveProveedor, CveOC:=CveOrdenCompra, CvePersonal:=CvePersonal, CveCreditoDetalle:=CveCreditoDetalle, CveCliente:=CveCliente, ImporteME:=tImporteMonedaExtranjera, CveIEDevolucion:=DDlCheques.SelectedValue.ToEntero) Then
+ ' TieneError = True
+ 'End If
+ Else
+ TieneError = True
+ End If
+ Else
+ TieneError = True
+ End If
+
+ End If
+ Catch ex As Exception
+ TieneError = True
+ End Try
+
+ If TieneError Then
+ ObjPVenta.RollBack()
+ Else
+ ObjPVenta.Commit()
+ End If
+
ObjPVenta.Dispose()
+
+ If Not TieneError Then
+ TxtCantidadIE.Text = ""
+ TxtDescripcionIE.Text = ""
+ RegistraScript("$('#DivIngresoEgreso').modal('hide')", "divingresoegreso")
+ Alert("El movimiento se realizó correctamente")
+ UpIngresoEgreso.Update()
+ End If
End Sub
Private Sub ImpresionDirectaPDF(CveVenta As Integer)
@@ -663,4 +727,9 @@ Partial Class Ventas_PVCobranza
End If
End Sub
+ Protected Sub ChkAplicaGasto_CheckedChanged(sender As Object, e As EventArgs)
+ DivCuentaGasto.Visible = ChkAplicaGasto.Checked
+
+ UpIngresoEgreso.Update()
+ End Sub
End Class