From 4414a727b791768bec186b926d89588a5c1df3b2 Mon Sep 17 00:00:00 2001 From: rakcsle Date: Sat, 6 Apr 2024 12:59:51 -0700 Subject: [PATCH] =?UTF-8?q?Crear=20opci=C3=B3n=20para=20editar=20la=20form?= =?UTF-8?q?a=20de=20pago=20en=20PVCobranza?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- App_Code/ClsBancos.vb | 24 ++ Compras/Compras.aspx.vb | 3 +- Ventas/PVCobranza.aspx | 482 +++++++++++++++++++++++--------------- Ventas/PVCobranza.aspx.vb | 167 ++++++++++++- 4 files changed, 486 insertions(+), 190 deletions(-) diff --git a/App_Code/ClsBancos.vb b/App_Code/ClsBancos.vb index be580aea7..77940930c 100644 --- a/App_Code/ClsBancos.vb +++ b/App_Code/ClsBancos.vb @@ -1704,6 +1704,30 @@ Public Class ClsBancos Return Retorno End Function + + Public Function UpdateBancosIECobranza(CveIE As Integer, CveTipoTransaccion As Integer, Folio As String, CveUsuario As Integer, CveEmpresa As Integer) As Boolean + Dim Retorno As Boolean = False + + DataAdapter("PA_Banc_IECobranzaUpdate") + With SqlAdapter.SelectCommand.Parameters + .Add("@CveIE", SqlDbType.Int).Value = CveIE + .Add("@CveTipoTransaccion", SqlDbType.Int).Value = CveTipoTransaccion + .Add("@Folio", SqlDbType.VarChar).Value = Folio + .Add("@CveUsuario", SqlDbType.Int).Value = CveUsuario + .Add("@CveEmpresa", SqlDbType.Int).Value = CveEmpresa + End With + + Try + SqlAdapter.Fill(Data) + + Retorno = True + Catch ex As Exception + OnError("Ocurrió un error al actualizar el tipo cambio del IE.", ex, SqlAdapter.SelectCommand.Parameters.ParametrosInfo()) + End Try + + Return Retorno + End Function + Public Function GetUsuariosConcilio(CveEmpresa As Integer) As Boolean Dim Retorno As Boolean = False diff --git a/Compras/Compras.aspx.vb b/Compras/Compras.aspx.vb index 26d4b1869..aeb94a329 100644 --- a/Compras/Compras.aspx.vb +++ b/Compras/Compras.aspx.vb @@ -6489,7 +6489,8 @@ Partial Class Compras_Compras If DdlMoneda.SelectedValue.ToEntero <> 1 Then TCO = TxtTC.Text.ToDecimal ImporteCI176 = ObjOC.DtResultados.FiltroPrimeroValor("ImporteCI228").ToDecimal - CostoIndirectoAcum176 += ImporteCI176 + 'CostoIndirectoAcum176 += ImporteCI176 + CostoIndirectoAcum176 += 0 SumatoriaInventario += Importe228 + Importe229 'se considera costoindirecto, para que la factura tiene en un concepto tipo servicio SumatoriaOCINV += (Dr(If(ListaDocumentos IsNot Nothing AndAlso ListaDocumentos.Count > 0 AndAlso ArrAnticipos IsNot Nothing AndAlso ArrAnticipos.Count > 0 AndAlso TxtTotal.Text.ToDecimal = 0, "ImporteSinImpuestos", "Total")).ToString.ToDecimal * tipoCambioActual) - (ImporteMN228 + ImporteMN229 - ImporteCI176) diff --git a/Ventas/PVCobranza.aspx b/Ventas/PVCobranza.aspx index 6007e8cf2..d6615ce7d 100644 --- a/Ventas/PVCobranza.aspx +++ b/Ventas/PVCobranza.aspx @@ -270,228 +270,287 @@ + + -
- - -
- Turno: - -
-
-
-
-
-
- - - - - - - - - -   - - - - - -
-
- -
-
-
-
Nombre:
-
         
- -
Folio:
-
  
- -
-
-
-
+
+
+ + +
+ Turno: +
-
-
-
+ + +
+
+
+ + + + + + + + + +   + + + + + +
+
+ +
+
+
+
Nombre:
+
         
-
-
-
-
- -
- $ - - -
-
- - - +
Folio:
+
  
+ +
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+
+
+
+ +
+ $ + + +
+
+ + + +
-
-
-
- -
- $ - - -
-
- - - -
-
- - MSI - 3M - 6M - 9M - 12M - - <%-- - --%> +
+
+ +
+ $ + + +
+
+ + + +
+
+ + MSI + 3M + 6M + 9M + 12M + + <%-- + --%> +
-
-
-
- -
- $ - - -
-
- - - +
+
+ +
+ $ + + +
+
+ + + +
-
-
-
- -
- $ - - -
-
- - - +
+
+ +
+ $ + + +
+
+ + + +
-
-
-
- -
- $ - - -
-
- - - +
+
+ +
+ $ + + +
+
+ + + +
-
-
-
+
+
-
- - Otros - Credito - Debito - Cheque - -
+
+ + Otros + Credito + Debito + Cheque + +
-
- $ - - -
+
+ $ + + +
-
- - - -
+
+ + + +
-
- - Meses - 3M - 6M - 9M - 12M - -
+
+ + Meses + 3M + 6M + 9M + 12M + +
-
-
- -
-
- -
- $ - - - -
- -
- $ - - -
-
-
- - - + +
+
+ +
+ $ + + + +
+ +
+ $ + + +
+
+
+
+
+ + + +
-
- + +
+
+
+
+ + + + + + Serie - Folio + + + + + + + + + + + + + + + + + + + + + + + + + +
+
+
+ + + +
+ + + + + + + @@ -861,5 +974,8 @@ $('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total)); } + + + diff --git a/Ventas/PVCobranza.aspx.vb b/Ventas/PVCobranza.aspx.vb index 556c2c13e..9d05b153f 100644 --- a/Ventas/PVCobranza.aspx.vb +++ b/Ventas/PVCobranza.aspx.vb @@ -17,6 +17,8 @@ Partial Class Ventas_PVCobranza End Set End Property + + Private Property DineroCaja As Double Get Return If(IsNothing(ViewState("DineroCaja")), 0, ViewState("DineroCaja").ToString().ToDecimal()) @@ -24,12 +26,51 @@ Partial Class Ventas_PVCobranza Set(value As Double) ViewState("DineroCaja") = value End Set + End Property + + Private Property CveIE As Integer + Get + If ViewState("CveIE") Is Nothing Then + ViewState("CveIE") = -1 + End If + Return ViewState("CveIE").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveIE") = value + End Set + End Property + + Private Property CveTipoTransaccionOriginal As Integer + Get + If ViewState("CveTipoTransaccionOriginal") Is Nothing Then + ViewState("CveTipoTransaccionOriginal") = -1 + End If + Return ViewState("CveTipoTransaccionOriginal").ToString.ToEntero + End Get + Set(value As Integer) + ViewState("CveTipoTransaccionOriginal") = value + End Set + End Property + + Private Property DtCortesVentas As DataTable + Get + + If ViewState("DtCortesVentas") Is Nothing Then + ViewState("DtCortesVentas") = New DataTable + End If + Return CType(ViewState("DtCortesVentas"), DataTable) + + End Get + Set(value As DataTable) + ViewState("DtCortesVentas") = value + End Set End Property Protected Sub Page_Load(sender As Object, e As System.EventArgs) Handles Me.Load If Not Page.IsPostBack Then CveCorte = 0 CargaFiltros() + CargaDdlPagos() If UsuarioActual.TienePermisoProceso(371) Then CargaCorteCaja() End If @@ -210,12 +251,25 @@ Partial Class Ventas_PVCobranza TxtImporteOtrosContado.Text = "" TxtCambio.Text = "" - End Sub - - Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click - CargaDatos() - End Sub - + End Sub + + + Protected Sub BtnConsultar_Click(sender As Object, e As EventArgs) Handles BtnConsultar.Click + + If ChkMostrarSoloPagados.Checked Then + DVCobraza.Visible = False + DVPagado.Visible = True + CargaDatosPagos() + Else + DVCobraza.Visible = True + DVPagado.Visible = False + CargaDatos() + End If + + End Sub + + + Private Sub GvDatos_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvDatos.RowDataBound If e.Row.RowType = DataControlRowType.DataRow Then @@ -663,4 +717,105 @@ Partial Class Ventas_PVCobranza End If End Sub + + + +#Region "PAGOS" + + Public Sub CargaDatosPagos() + + Dim FechaI As Date = If(txtFechaI.Text <> "", txtFechaI.Text.ToDate, MinFecha) + Dim FechaF As Date = If(txtFechaF.Text <> "", txtFechaF.Text.ToDate, MaxFecha) + + Dim ObjPuntoVenta As New ClsPuntoVenta + + If ObjPuntoVenta.GetCortesDetalleVentas(CveCorte, DdlSubProyecto.SelectedValue.ToEntero, UsuarioActual.CveEmpresa, 2) Then + GvD.DataSource = ObjPuntoVenta.DtResultados + DtCortesVentas = ObjPuntoVenta.DtResultados + End If + + ObjPuntoVenta.Dispose() + + GvD.DataBind() + UpL.Update() + End Sub + + Protected Sub GvD_RowDataBound(sender As Object, e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvD.RowDataBound + If e.Row.RowType = DataControlRowType.DataRow Then + If e.Row.DBCampo("CveVenta").ToString = "" Then + e.Row.CssClass = "Totales" + End If + If e.Row.DBCampo("ImportePagado").ToDecimal() < 0 Then + e.Row.FCLabel("LblTotal").CssClass = "badge badge-danger" + End If + If e.Row.DataKey("CveIE").ToEntero > 0 Then + e.Row.FCLinkButton("LnkEditarPago").Visible = True + End If + End If + End Sub + + + + Sub CargaDdlPagos() + + DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Ing'") + DdlTipoTransaccion.DataBind() + DdlTipoTransaccion.Items.Insert(0, New ListItem("Seleccione Tipo Movimiento", "-1")) + + + DdlCuenta.DataSource = GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa:=UsuarioActual.CveEmpresa) + DdlCuenta.DataBind() + DdlCuenta.Items.Insert(0, New ListItem("Seleccione", "-1")) + + End Sub + + Protected Sub LnkEditarPago_Click(sender As Object, e As EventArgs) + + Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow) + + + CveIE = GvRow.DataKey("CveIE").ToEntero + CveTipoTransaccionOriginal = GvRow.DataKey("CveTipoTransaccion").ToEntero + + Dim CveTipoTransaccion As Integer = GvRow.DataKey("CveTipoTransaccion").ToEntero + Dim CveCuenta As Integer = GvRow.DataKey("CveCuenta").ToEntero + + LblModalPagoTitulo.Text = $"Editar Pago {GvRow.DataKey("SerieFolio")}" + DdlTipoTransaccion.SelectedValueExist(CveTipoTransaccion) + DdlCuenta.SelectedValueExist(CveCuenta) + + UpModalPago.Update() + + RegistraScript("$('#DVModalPagos').modal('show');") + + End Sub + + + Protected Sub LnkDvModalPagoAceptar_Click(sender As Object, e As EventArgs) + + Dim TieneError As Boolean = False + If CveTipoTransaccionOriginal <> DdlTipoTransaccion.SelectedValue.ToEntero Then + + Dim Folio As Long + Dim objBanco As New ClsBancos + Folio = objBanco.GetNextFolio(DdlCuenta.SelectedValue.ToEntero, DdlTipoTransaccion.SelectedValue.ToEntero) + + If Not objBanco.UpdateBancosIECobranza(CveIE, DdlTipoTransaccion.SelectedValue.ToEntero, Folio.ToString, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Then + TieneError = True + End If + + objBanco.Dispose() + + End If + + If Not TieneError Then + CargaDatosPagos() + Alert("Movimiento actualizado correctamente") + RegistraScript("$('#DVModalPagos').modal('hide');") + End If + + End Sub + +#End Region + End Class