Agenda CRM, Compras

This commit is contained in:
Oscar Irigoyen
2022-12-14 11:59:46 -07:00
parent 1c3aa45eed
commit fc90c51700
8 changed files with 780 additions and 298 deletions

View File

@@ -211,6 +211,16 @@
<ajax:ValidatorCalloutExtender ID="VCEFuncionarioEmpleado" runat="server" HighlightCssClass="vco" TargetControlID="RFVFuncionarioEmpleado" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="row" runat="server" id="RowCheque" visible="true">
<label class="col-xs-4">Cheque:</label>
<div class="col-xs-8">
<asp:DropDownList ID="DDlCheques" CssClass="form-control input-sm select2me" Width="100%" runat="server" DataTextField="FolioFecha" DataValueField="CveIE" AutoPostBack="True"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVCheques" runat="server" ControlToValidate="DDlCheques" InitialValue="-1" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cheque''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpContado"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCECheques" runat="server" HighlightCssClass="vco" TargetControlID="RFVCheques" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
</div>
</asp:Panel>
<asp:Panel ID="PanelIngresos" runat="server" Visible="false">

View File

@@ -428,6 +428,19 @@ Partial Class Bancos_PopIECompras
End Property
Private Property DtCheques As DataTable
Get
If ViewState("DtCheques") Is Nothing Then
ViewState("DtCheques") = New DataTable
End If
Return CType(ViewState("DtCheques"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtCheques") = value
End Set
End Property
@@ -1077,36 +1090,65 @@ Partial Class Bancos_PopIECompras
Protected Sub DdlFuncionarioEmpleado_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlFuncionarioEmpleado.SelectedIndexChanged
ArrIEFuncionariosEmpleados = New ArrayList()
ArrIE = New ArrayList()
DtCheques = New DataTable
Dim objGastosXComprobar As New ClsMovimientos
'Dim objGastosXComprobar As New ClsMovimientos
Dim CvePersonal As Integer = DdlFuncionarioEmpleado.SelectedValue.ToEntero
If objGastosXComprobar.GetEgresosSinComprobarPersonal(UsuarioActual.CveEmpresa) Then
Dim CvePersonal As Integer = DdlFuncionarioEmpleado.SelectedValue.ToEntero
'If objGastosXComprobar.GetEgresosSinComprobarPersonal(UsuarioActual.CveEmpresa) Then
'For Each Row As DataRow In objGastosXComprobar.DtResultados.FiltraParametros("CvePersonal > 0 AND FechaDocumento IS NOT NULL").Rows
' ArrIE.Add(New Anticipos With {.CveIE = Row("CveIE").ToString.ToEntero, .Importe = Row("Saldo").ToString.ToDecimal, .CvePersonal = Row("CvePersonal").ToString.ToEntero})
'Next
For Each Row As DataRow In objGastosXComprobar.DtResultados.FiltraParametros("CvePersonal > 0 AND FechaDocumento IS NOT NULL").Rows
ArrIE.Add(New Anticipos With {.CveIE = Row("CveIE").ToString.ToEntero, .Importe = Row("Saldo").ToString.ToDecimal, .CvePersonal = Row("CvePersonal").ToString.ToEntero})
Next
If CveCompra > 0 Then
For Each Ant As Anticipos In ArrIE
If Ant.CvePersonal = CvePersonal Then
ArrIEFuncionariosEmpleados.Add(New Anticipos With {.CveIE = Ant.CveIE, .Importe = Ant.Importe, .CvePersonal = Ant.CvePersonal})
End If
Next
'actualizo el monto maximo a pagar en el movimiento bancario
Dim tSaldo As Decimal = DdlFuncionarioEmpleado.SelectedItem.Text.Split(CChar("-"))(1).ToDecimal
If tSaldo < MovimientoPagar.Saldo Then
TxtImporte.Text = tSaldo.FormatoNumero()
End If
End If
Dim ObjMovtos As New ClsMovimientos
RowCheque.Visible = True
ObjMovtos.GetEgresosSinComprobarPersonalDetalle(DdlFuncionarioEmpleado.SelectedValue.ToEntero, UsuarioActual.CveEmpresa)
DtCheques = ObjMovtos.DtResultados.FiltraParametros("CveIE > 0", "FechaDocumento, FolioFecha")
'Limpia Ddl Cheques
DDlCheques.Items.Clear()
If DtCheques.Rows.Count > 0 Then
DDlCheques.DataSource = DtCheques
End If
ObjMovtos.Dispose()
DDlCheques.DataBind()
'EstaAsociadoAPersonal = True
DDlCheques_SelectedIndexChanged(DDlCheques, EventArgs.Empty)
UpDatos.Update()
'End If
End Sub
Protected Sub DDlCheques_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DDlCheques.SelectedIndexChanged
'Dim saldo As Double = DtCheques.Rows(DDlCheques.SelectedIndex)("Saldo").ToString.ToDecimal
Dim saldo As Double = DtCheques.Rows(DDlCheques.SelectedIndex)("Saldo").ToString.ToDecimal
'TxtDocumentoImporteFE.Text = If(saldo < TxtTotal.Text.ToDouble, saldo.FormatoNumero, TxtTotal.Text)
'lblSaldoFE.Text = saldo.FormatoNumero
If CveCompra > 0 Then
'Dim tSaldo As Decimal = DdlFuncionarioEmpleado.SelectedItem.Text.Split(CChar("-"))(1).ToDecimal
If saldo < MovimientoPagar.Saldo Then
TxtImporte.Text = saldo.FormatoNumero()
Else
TxtImporte.Text = MovimientoPagar.Saldo.FormatoNumero()
End If
End If
UpDatos.Update()
End Sub
Private Sub DdlIngreso_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlIngreso.SelectedIndexChanged
@@ -1389,22 +1431,25 @@ Partial Class Bancos_PopIECompras
ImportePagado = TxtImporte.Text.Trim.ToDecimal
Fecha = TxtFechaDocumento.Text.Trim.ToDate
TipoMovimiento = True
Case "2" 'FyE
Case "2" 'FyE
ImportePagado = TxtImporte.Text.Trim.ToDecimal
Fecha = TxtFechaDocumento.Text.Trim.ToDate
CveConcepto = 29
CveIE = -1
If ArrIEFuncionariosEmpleados IsNot Nothing AndAlso ArrIEFuncionariosEmpleados.Count > 0 Then
Dim objAray As Anticipos = DirectCast(ArrIEFuncionariosEmpleados(0), Anticipos)
CveIE = objAray.CveIE
End If
CveIE = DDlCheques.SelectedValue.ToEntero
If Not CveIE > 0 Then
Alert("No se encontro movimientos bancarios de perosonal", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
Dim saldo As Double = DtCheques.Rows(DDlCheques.SelectedIndex)("Saldo").ToString.ToDecimal
If TxtImporte.Text.ToDecimal > saldo Then
Alert("El importe no debe de superar el saldo del cheque seleccionado.", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
TipoMovimiento = True
Dim stringPersonal As String = DdlFuncionarioEmpleado.SelectedItem.ToString
CvePersonal = DdlFuncionarioEmpleado.SelectedValue.ToEntero