diff --git a/Ventas/PVCobranza.aspx b/Ventas/PVCobranza.aspx index 8d3dd7083..2217a2461 100644 --- a/Ventas/PVCobranza.aspx +++ b/Ventas/PVCobranza.aspx @@ -735,7 +735,24 @@
- +
+
+ Origen: +
+
+ +
+
+
+
+
+ Destino: +
+
+ +
+
+
diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 01439a969..eef0ecab6 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -113,6 +113,14 @@ Partial Class Ventas_PVCobranza DdlCuentaCheque.DataBind() DdlCuentaTransferencia.DataBind() + DdlCuentaGastoOrigen.DataSource = DtCC.FiltraParametros("CveMoneda = 1 AND CveTipoCuenta = 1") + DdlCuentaGastoOrigen.DataBind() + DdlCuentaGastoOrigen.Items.Insert(0, New ListItem("Seleccione", "-1")) + + DdlCuentaGastoDestino.DataSource = DtCC.FiltraParametros("CveMoneda = 1 AND CveTipoCuenta = 1") + DdlCuentaGastoDestino.DataBind() + DdlCuentaGastoDestino.Items.Insert(0, New ListItem("Seleccione", "-1")) + TxtImporteEfectivo.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();") TxtImporteCredito.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();") TxtImporteDebito.Attributes.Add("onKeyUp", "CalculaTotalPagoContado();") @@ -644,6 +652,7 @@ Partial Class Ventas_PVCobranza Dim ObjPVenta As New ClsPuntoVenta Dim ObjIE As New ClsBancos(ObjPVenta.IniciaTransacSQL()) Dim ObjMov As New ClsContabilidad(ObjPVenta.IniciaTransacSQL()) + Dim documentos As String = "" Try Dim CveMoneda As Integer = 1 Dim TipoCambio As Decimal = 1D @@ -652,29 +661,28 @@ Partial Class Ventas_PVCobranza 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 + If ChkAplicaGasto.Checked Then + documentos = "Los Depósitos se realizaron exitosamente

" + 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 FolioOrigen As Long = ObjIE.GetNextFolio(DdlCuentaGastoOrigen.SelectedValue.ToEntero, 2) + Dim FolioDestino As Long = ObjIE.GetNextFolio(DdlCuentaGastoOrigen.SelectedValue.ToEntero, 8) - Dim CveIE = ObjIE.AddBancos_IE(DdlCuentaGasto.SelectedValue.ToEntero, CveTipoTransaccion, Now, Folio.ToString(), "", Importe, CveMoneda, + Dim CveIEDestino As Integer = -1 + Dim CveIEOrigen = ObjIE.AddBancos_IE(DdlCuentaGastoOrigen.SelectedValue.ToEntero, 2, Now, FolioOrigen.ToString(), "", Importe, CveMoneda, TipoCambio, TxtDescripcionIE.Text.Trim(), "", EsAbonoEnCuenta, AplicaImpuestos, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=Me.CveCorte) - Dim TipoMovimiento As Boolean = True + If CveIEOrigen > 0 Then + documentos += String.Format("IE Salida: {1}    
", CveIEOrigen, FolioOrigen) - 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 + CveIEDestino = ObjIE.AddBancos_IE(DdlCuentaGastoDestino.SelectedValue.ToEntero, 8, Now, FolioDestino.ToString(), "", Importe, CveMoneda, + TipoCambio, TxtDescripcionIE.Text.Trim(), "", EsAbonoEnCuenta, AplicaImpuestos, -1, CvePrePoliza, "", UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveCorte:=Me.CveCorte) + If CveIEDestino > 0 Then + documentos += String.Format("IE Entrada: {1}    
", CveIEDestino, FolioDestino) Else TieneError = True End If @@ -682,26 +690,49 @@ Partial Class Ventas_PVCobranza TieneError = True End If + If Not TieneError Then + Dim TipoMovimiento As Boolean = True + + If ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovimiento, Importe, Importe, 30, FolioOrigen.ToString(), FolioOrigen.ToString(), CveIE:=CveIEOrigen) Then + If Not ObjMov.AddPrePolizasDetalle(CvePrePoliza, Not TipoMovimiento, Importe, Importe, 30, FolioDestino.ToString(), FolioDestino.ToString(), CveIE:=CveIEDestino) Then + TieneError = True + End If + Else + TieneError = True + End If + End If End If Catch ex As Exception TieneError = True + GuardaLog(ex.ToString()) End Try If TieneError Then + documentos = "" ObjPVenta.RollBack() + Alert("Ocurrió un error al generar el movimiento", TipoMensaje.MsgError) Else ObjPVenta.Commit() End If ObjPVenta.Dispose() + ObjIE.Dispose() + ObjMov.Dispose() If Not TieneError Then TxtCantidadIE.Text = "" TxtDescripcionIE.Text = "" RegistraScript("$('#DivIngresoEgreso').modal('hide')", "divingresoegreso") - Alert("El movimiento se realizó correctamente") - UpIngresoEgreso.Update() + + If ChkAplicaGasto.Checked Then + Alert(documentos) + Else + Alert("El movimiento se realizó correctamente") + End If + End If + + UpIngresoEgreso.Update() End Sub Private Sub ImpresionDirectaPDF(CveVenta As Integer)