GlobalDTOCEstatusUsuarios, GlobalDTBancosCuentas, OC anticpos

This commit is contained in:
Rakcsle Supertramp
2020-07-16 15:23:10 -07:00
parent 2188c6b8ce
commit 7cf2df795a
74 changed files with 855 additions and 363 deletions

View File

@@ -467,7 +467,21 @@
</div>
</div>
<div class="portlet-body ">
<div class="row">
<asp:GridView ID="GvAnticpos" runat="server" GridLines="None" CssClass="table xspadding table-striped table-advance table-hover Widthall" AutoGenerateColumns="False" Width="250px">
<Columns>
<asp:HyperLinkField DataNavigateUrlFields="CveIE" HeaderText="Folio" DataNavigateUrlFormatString="~/Bancos/IE.aspx?CveIE={0}" DataTextField="Folio" Target="_blank" />
<asp:BoundField DataField="Importe" HeaderText="Importe" DataFormatString="{0:C}" > <ItemStyle HorizontalAlign="Right" /></asp:BoundField>
</Columns>
</asp:GridView>
<%-- <div class="row">
<div class="col-md-2 bold">Folio:</div>
<div class="col-md-4">
<asp:Literal Text="" ID="LtFolioIEAnticipo" runat="server" />
@@ -476,7 +490,7 @@
<b>$ </b>
<asp:Literal Text="" ID="LtImporteIEAnticipo" runat="server" />
</div>
</div>
</div>--%>
</div>
</div>
</ContentTemplate>
@@ -2021,7 +2035,12 @@
<asp:TextBox ID="TxtSAImporte" min="0" max='<%=LblTotal.Text.ToString()%>' CssClass="form-control input-sm" type="number" step="any" pattern="(\d{3})([\.])(\d{2})" runat="server"></asp:TextBox>
<asp:RangeValidator ID="RVSAImprote" CssClass="form-control" runat="server" ControlToValidate="TxtSAImporte" Display="None" Type="Double" MinimumValue="1.00" MaximumValue="2147483647" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Importe''</b> debe ser mayor a cero." ValidationGroup="GrpModalSolicitarAnticipo"></asp:RangeValidator>
<ajax:ValidatorCalloutExtender ID="VCESAImporte" runat="server" HighlightCssClass="vco" TargetControlID="RVSAImprote" Width="300px"></ajax:ValidatorCalloutExtender>
</div>
<div class="input-group" style="text-align:right!important">
<asp:Label runat="server" ID="LblSaldoOCAnticipo"></asp:Label>
</div>
</div>
</div>
<hr />

View File

@@ -485,6 +485,37 @@ Partial Class OC
End Property
Private Property NumRow As Integer
Private Property SaldoOCAnticipo As Double
Get
If ViewState("SaldoOCAnticipo") Is Nothing Then
Return 0
Else
Return ViewState("SaldoOCAnticipo").ToString.ToDouble
End If
End Get
Set(value As Double)
ViewState("SaldoOCAnticipo") = value
End Set
End Property
Private Property ImporteAnticipos As Double
Get
If ViewState("ImporteAnticipos") Is Nothing Then
Return 0
Else
Return ViewState("ImporteAnticipos").ToString.ToDouble
End If
End Get
Set(value As Double)
ViewState("ImporteAnticipos") = value
End Set
End Property
#End Region
Protected Sub Page_Load(sender As Object, e As EventArgs) Handles Me.Load
@@ -725,7 +756,7 @@ Partial Class OC
End If
End If
InicializaSolicitarAnticipo()
'InicializaSolicitarAnticipo()
If TipoOC = "REQ" Then
BtnSolicitudAnticipo.Visible = False
@@ -1181,8 +1212,9 @@ Partial Class OC
MPContrato.Enabled = False
'SOLICITUD DE ANTICIPO
CveIEAnticipo = objOC.CveIEAnticipo
LtImporteIEAnticipo.Text = objOC.ImporteAnticipo.FormatoNumero
LtFolioIEAnticipo.Text = $"<a class=""Texto"" href=""/Bancos/IE.aspx?CveIE={objOC.CveIEAnticipo}"" target=""_blank"">{objOC.FolioIEAnticipo}</a>"
'LtImporteIEAnticipo.Text = objOC.ImporteAnticipo.FormatoNumero
'LtFolioIEAnticipo.Text = $"<a class=""Texto"" href=""/Bancos/IE.aspx?CveIE={objOC.CveIEAnticipo}"" target=""_blank"">{objOC.FolioIEAnticipo}</a>"
CveVenta = objOC.CveVenta
TieneVenta = objOC.TieneVenta
@@ -1197,15 +1229,8 @@ Partial Class OC
'Anticipos
CargarOptionAnticipos()
Dim objbancos As New ClsBancos
If objbancos.GetPrePolizasDetalle(-1, -1, pCveOrdenCompra) AndAlso objbancos.DtResultados.Rows.Count > 0 Then
BtnSolicitudAnticipo.Visible = False
generarAnticipo.Text = "Ver Anticipo"
generarAnticipo.NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", objbancos.DtResultados.Rows(0)("CveIE"))
Else
generarAnticipo.NavigateUrl = String.Format("/Bancos/IE.aspx?CveOrdenCompra={0}&CveProveedor={1}", pCveOrdenCompra, objOC.CveProveedor.ToString)
End If
objbancos.Dispose()
CargaAnticiposSolicitudes()
CveCotizacion = objOC.DtResultados.Rows(0)("CveCotizacion").ToString.ToEntero
If CveCotizacion > 0 Then
@@ -2438,7 +2463,7 @@ Partial Class OC
LugarEntrega, UsuarioActual.CveUsuario, CveEmpresaActual, GvD.Rows(0).FCHiddenField("HdnCvePresupuestoEgreso").Value.ToString.ToEntero, pCveProveedor:=CveProveedor, pCveProveedorSucursal:=CveProveedorSucursal,
RequiereCotizacion:=ChkCotizacion.Checked, CveUsuarioAsignado:=DdlUsuariosAsignado.SelectedValue.ToEntero, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text,
PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text, EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1),
CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=LtImporteIEAnticipo.Text.ToDouble, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero,
CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), Guia:=TxtGuia.Text.Trim, IEPS:=TxtIEPS.Text.ToDecimal, CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=ImporteAnticipos, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero,
Promocion:=Promocion, CveProveedorContacto:=CveProveedorContacto) Then
CveOrdenCompra = OC.CveOrdenCompra
CveEstatus = CboE.SelectedValue.ToEntero
@@ -3023,7 +3048,7 @@ Partial Class OC
CveUsuario, CveEmpresaActual, 0, pCveProveedor:=CveProveedor, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text,
PorcentajeIVA:=PorIVA, IVA:=IVACot, RetIVA:=RetIVA.ToString.ToDecimal, RetISR:=RetISR.ToString.ToDecimal, IDPoliza:=IdPoliza, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text,
EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), IEPS:=TxtIEPS.Text.ToDecimal,
CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=LtImporteIEAnticipo.Text.ToDouble, Promocion:=Promocion, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero) Then
CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=ImporteAnticipos, Promocion:=Promocion, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero) Then
'CREA POLIZA POR CADA PROVEEDOR
@@ -3089,7 +3114,7 @@ Partial Class OC
If objOrdenCompra.AddOrdenCompra("OC", -1, TxtDescrip.Text, TxtJustificacion.Text, DdlPrioridad.SelectedValue.ToEntero, TxtFecha.Text.ToDate, DdlMoneda.SelectedValue.ToEntero, CveEstatusInicialOC, TxtFechaEstimadaEntrega.Text, LugarEntrega,
CveUsuario, CveEmpresaActual, 0, pCveProveedor:=DdlProveedores.SelectedValue.ToEntero, pCveProveedorSucursal:=DdlProveedorSucursal.SelectedValue.ToEntero, CveCliente:=Ddlcliente.txtValue.Value.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, PrioridadObservacion:=txtobsprioridad.Text,
PorcentajeIVA:=Math.Round(DdlIVA.SelectedValue.ToDouble - 1, 2), IVA:=IVA, RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, IDPoliza:=IDPolizaPresupuestal, CveCotizacion:=CveCotizacion, FolioAdicional:=TxtFolioAdicional.Text,
EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), IEPS:=TxtIEPS.Text.ToDecimal, CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=LtImporteIEAnticipo.Text.ToDouble, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero,
EntregaDirecta:=If(ChkEntregaDirecta.Checked, 1, -1), CveDireccionEnvio:=If(DdlDireccionEnvio.Visible, DdlDireccionEnvio.SelectedValue.ToEntero, -1), IEPS:=TxtIEPS.Text.ToDecimal, CveIEAnticipo:=CveIEAnticipo, ImporteAnticipo:=ImporteAnticipos, UsoCFDI:=DdlUsoCFDI.SelectedValue.ToEntero,
Promocion:=Promocion) Then
@@ -4915,24 +4940,36 @@ Partial Class OC
#End Region
#Region " SOLICITAR ANTICIPOS "
Private Sub InicializaSolicitarAnticipo()
If CveOrdenCompra > 0 Then
If CveIEAnticipo > 0 Then
PorletIEAnticipo.Visible = True
UpIEAnticipo.Update()
Else
If GlobalDTOCEstatus(CveEmpresaActual).FiltroPrimeroValor("TipoTermino", $"CveEstatus = {CveEstatus}").ToEntero.Contiene(0, 3) Then
BtnSolicitudAnticipo.Visible = True
DdlSAUsuario.DataSource = GlobalDTUsuarios(-1, CveEmpresaActual)
DdlSAUsuario.DataBind()
DdlSAUsuario.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
End If
'Private Sub InicializaSolicitarAnticipo()
' If CveOrdenCompra > 0 Then
' If CveIEAnticipo > 0 Then
' PorletIEAnticipo.Visible = True
' UpIEAnticipo.Update()
' Else
' If GlobalDTOCEstatus(CveEmpresaActual).FiltroPrimeroValor("TipoTermino", $"CveEstatus = {CveEstatus}").ToEntero.Contiene(0, 3) Then
' BtnSolicitudAnticipo.Visible = True
' DdlSAUsuario.DataSource = GlobalDTUsuarios(-1, CveEmpresaActual)
' DdlSAUsuario.DataBind()
' DdlSAUsuario.Items.Insert(0, New ListItem("Seleccione", "-1"))
' End If
' End If
' End If
'End Sub
Protected Sub BtnSolicitarAnticipo_Click(sender As Object, e As EventArgs) Handles BtnSolicitarAnticipo.Click
If TxtSAImporte.Text.ToDecimal > SaldoOCAnticipo Then
Alert("El importe solicitado supera el saldo de la orden de compra", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
End Sub
Protected Sub BtnSolicitarAnticipo_Click(sender As Object, e As EventArgs) Handles BtnSolicitarAnticipo.Click
Dim Descripcion As New StringBuilder
Descripcion.AppendFormat("Importe anticipo : ${0} ({1}%) - <a target=""_blank"" href=""/Bancos/IE.aspx?Opcion=EGSSINFACT&CveOC={2}"">Pagar anticipo</a> - <b>Observacion:</b> {2} ", TxtSAImporte.Text.FormatoNumero, TxtSAImPorcentaje.Text, CveOrdenCompra, TxtSAObservaciones.Text)
@@ -7896,6 +7933,85 @@ Partial Class OC
'End If
End Sub
Private Sub CargaAnticiposSolicitudes()
If CveOrdenCompra > 0 Then
If CveIEAnticipo > 0 Then
PorletIEAnticipo.Visible = True
UpIEAnticipo.Update()
Else
End If
End If
Dim objbancos As New ClsOC
If objbancos.GetOCAnticipoSaldo(CveOrdenCompra, UsuarioActual.CveEmpresa) AndAlso objbancos.DtResultados.Rows.Count > 0 Then
SaldoOCAnticipo = objbancos.DtResultados(0)("Saldo").ToString.ToDecimal
LblSaldoOCAnticipo.Text = $"Saldo OC ${SaldoOCAnticipo.ToString.FormatoNumero}"
If SaldoOCAnticipo > 0 Then
DdlSAUsuario.Items.Clear()
If GlobalDTOCEstatus(CveEmpresaActual).FiltroPrimeroValor("TipoTermino", $"CveEstatus = {CveEstatus}").ToEntero.Contiene(0, 3) Then
BtnSolicitudAnticipo.Visible = True
DdlSAUsuario.DataSource = GlobalDTUsuarios(-1, CveEmpresaActual)
DdlSAUsuario.DataBind()
DdlSAUsuario.Items.Insert(0, New ListItem("Seleccione", "-1"))
End If
BtnSolicitudAnticipo.Visible = True
'generarAnticipo.Text = "Ver Anticipo"
Else
BtnSolicitudAnticipo.Visible = False
'generarAnticipo.Text = "Ver Anticipo"
'generarAnticipo.NavigateUrl = String.Format("/Bancos/IE.aspx?CveIE={0}", objbancos.DtResultados.Rows(0)("CveIE"))
End If
Else
' generarAnticipo.NavigateUrl = String.Format("/Bancos/IE.aspx?CveOrdenCompra={0}&CveProveedor={1}", CveCompra, DdlProveedorContacto.SelectedValue.ToEntero)
End If
If objbancos.GetOCAnticipo(CveOrdenCompra, UsuarioActual.CveEmpresa) Then
If objbancos.DtResultados.Rows.Count > 0 Then
PorletIEAnticipo.Visible = True
GvAnticpos.DataSource = objbancos.DtResultados
ImporteAnticipos = objbancos.DtResultados.SUM("Importe")
End If
Else
GvAnticpos.DataSource = Nothing
ImporteAnticipos = 0
End If
GvAnticpos.DataBind()
objbancos.Dispose()
UpAcciones.Update()
UpSolicitarAnticipo.Update()
End Sub
'Private Sub CargaVentaRelacionada()
' Dim GridViewPSAux As GridView = GvD
' Dim CveOCDetalle As New StringBuilder()