Cambios en ventas para contratos de emd

This commit is contained in:
2023-02-01 10:26:49 -07:00
parent 8cb609f6ea
commit d72a785136
3 changed files with 217 additions and 116 deletions

View File

@@ -554,11 +554,11 @@
</div>
</td>
</tr>
<tr align="left" id="TrDescripcionVenta" runat="server" visible="false">
<td><b>Descripción de factura:</b></td>
<td>
<asp:TextBox ID="TxtDescripcionVenta" runat="server" Rows="3" TextMode="MultiLine" Width="250px" MaxLength="800" CssClass="form-control input-sm" Enabled="false"></asp:TextBox></td>
</tr>
</table>
</div>
</div>
@@ -907,32 +907,6 @@
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpDescripcionVenta" runat="server" class="portlet light xspadding bordered whitoutcol" style="margin-left: auto" UpdateMode="Conditional" Visible="false">
<ContentTemplate>
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span id="Span1" runat="server" class="caption-subject bold uppercase">Descripción </span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body formnombottom">
<table border="0" width="250px">
<tr align="left">
<td>
<asp:TextBox ID="TxtDescripcionVenta" runat="server" Rows="3" TextMode="MultiLine" Width="250px" MaxLength="800" CssClass="form-control input-sm" Enabled="false"></asp:TextBox></td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:UpdatePanel ID="Updatetabs" runat="server" UpdateMode="Conditional">
@@ -3165,7 +3139,7 @@
<asp:HyperLink ID="HLContrato" Target="_blank" CssClass="Texto" runat="server" Text="" Font-Bold="true"></asp:HyperLink>
<asp:GridView ID="GvEst" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron Estimaciones para este cliente" Width="100%" DataKeyNames="CveContrato,CveFamilias,CveSubFamilias,CveContratoAvance,Name,Importe,NumeroContrato,CveSubProyecto,FechaInicial" SelectedRowStyle-BackColor="#CCFF66" CssClass="table GvEst table-advance table-hover" Style="text-align: center;" GridLines="None">
<asp:GridView ID="GvEst" runat="server" AutoGenerateColumns="false" EmptyDataText="No se encontraron estimaciones para este cliente" Width="100%" DataKeyNames="CveContrato,CveFamilias,CveSubFamilias,CveContratoAvance,Name,Importe,NumeroContrato,CveSubProyecto,FechaInicial" SelectedRowStyle-BackColor="#CCFF66" CssClass="table GvEst table-advance table-hover" Style="text-align: center;" GridLines="None">
<Columns>
<asp:TemplateField>
<ItemTemplate>
@@ -4552,7 +4526,7 @@
<asp:Label runat="server" Text="Descripción:" Font-Bold="true" Width="120px" />
</td>
<td colspan="1">
<asp:TextBox runat="server" ID="TxtDescripcionCaja" TextMode="MultiLine" Width="170px" />
<asp:TextBox runat="server" ID="TxtDescripcionCaja" TextMode="MultiLine" Width="100%" />
</td>
</tr>
<tr>

View File

@@ -2315,6 +2315,15 @@ Partial Class Ventas
End Set
End Property
Private Property CveContratoTipo As Integer
Get
Return IfNull(ViewState("CveContratoTipo"), "-1", ViewState("CveContratoTipo")).ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("CveContratoTipo") = value
End Set
End Property
#End Region
'#Region "AuxiliarConta"
@@ -3464,7 +3473,7 @@ Partial Class Ventas
End If
If UsuarioActual.CveEmpresa = 13 Then
UpDescripcionVenta.Visible = True
TrDescripcionVenta.Visible = True
If CveVenta <= 0 Then
TxtDescripcionVenta.Enabled = True
End If
@@ -3742,6 +3751,7 @@ Partial Class Ventas
End Try
End Sub
Private Sub VerificarContrato(Optional AfterPageLoad As Boolean = False)
Dim ObjContratos As New ClsContratos
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, CveCliente, -1, 1) Then
@@ -3823,6 +3833,17 @@ Partial Class Ventas
End If
If UsuarioActual.CveEmpresa = 13 Then
DivEstimaciones.Visible = True
GvEst.Visible = False
ContratoDetalles.Visible = False
GvContratoDetalles.Visible = True
BtnEstimacion.Visible = False
End If
PresionarBotonModal("C_BtnCerrarContrato")
End Sub
Private Sub BtnCancelarContratoDetalles_Click(sender As Object, e As EventArgs) Handles BtnCancelarContratoDetalles.Click
@@ -4067,9 +4088,17 @@ Partial Class Ventas
' ObjClientes.Dispose()
'End If
Dim CveContratoSeleccionado As Integer = -1
If DdlContratosModal.SelectedValue.ToEntero() > 0 Then
CveContratoSeleccionado = DdlContratosModal.SelectedValue.ToEntero()
End If
If Me.CveContratoTipo = 33 AndAlso DdlContrato.SelectedValue.ToEntero() > 0 Then
CveContratoSeleccionado = DdlContrato.SelectedValue.ToEntero()
End If
Dim DrContrato As DataRow = DtContratos.FiltroPrimero($"CveContrato = {CveContratoSeleccionado}")
Dim DrContrato As DataRow = DtContratos.FiltroPrimero($"CveContrato = {DdlContratosModal.SelectedValue.ToEntero()}")
Dim ps As New ClsInventarios
CveContrato = DdlContratosModal.SelectedValue.ToEntero()
AplicaGastoContrato = If(DrContrato("CveContratoTipo").ToString().Contiene("9", "10", "13"), True, False) 'Arrendamiento, Servicios De Impresion, Financiamiento
@@ -4083,6 +4112,7 @@ Partial Class Ventas
TxtIVA.Text = "0"
TxtRetIVA.Text = "0"
Dim ps As New ClsInventarios
For Each Row As GridViewRow In GvContratoDetalles.Rows
If Row.FCTextBox("TxtCant").Text.ToEntero() > 0 Then
@@ -4107,8 +4137,8 @@ Partial Class Ventas
SeleccionadoContrato += Row.FCTextBox("TxtCant").Text.ToEntero() * Row.FCLiteral("LtlPU").Text.ToDouble
AgregarProductoServicio(Row.FCTextBox("TxtCant").Text.ToEntero(), Row.DataKey("CveUM").ToEntero(), Row.FCLiteral("LtlUM").Text, Row.DataKey("CveClasificacion").ToEntero(),
Row.DataKey("Clasificacion"), Row.DataKey("CvePS").ToEntero(), Row.FCLiteral("LtlPS").Text, If(CveCicloComercial > 0, ObsPlantilla, $"/ {Row.FCLiteral("LtCveInterna").Text}"), Row.FCLiteral("LtlPU").Text.ToDecimal, 0,
DrContrato("CveProyecto").ToString().ToEntero(), DrContrato("ProyectoContrato").ToString(), DrContrato("CveSubProyecto").ToString().ToEntero(), DrContrato("SubProyectoContrato").ToString(), CveContratoDetalle:=Row.DataKey("CveContratoDetalle").ToEntero())
Row.DataKey("Clasificacion"), Row.DataKey("CvePS").ToEntero(), Row.FCLiteral("LtlPS").Text, If(CveCicloComercial > 0, ObsPlantilla, $"/ {Row.FCLiteral("LtCveInterna").Text}"), Row.FCLiteral("LtlPU").Text.ToDecimal, 0,
DrContrato("CveProyecto").ToString().ToEntero(), DrContrato("ProyectoContrato").ToString(), DrContrato("CveSubProyecto").ToString().ToEntero(), DrContrato("SubProyectoContrato").ToString(), CveContratoDetalle:=Row.DataKey("CveContratoDetalle").ToEntero())
'AddPS(Row.FCTextBox("TxtCant").Text.ToEntero(), Row.DataKey("CveUM").ToEntero(), Row.FCLiteral("LtlUM").Text, Row.DataKey("CveClasificacion").ToEntero(), Row.DataKey("Clasificacion"),
' Row.DataKey("CvePS").ToEntero(), Row.FCLiteral("LtlPS").Text, If(CveCicloComercial > 0, Row.DataKey("Observaciones"), $"/ {Row.FCLiteral("LtCveInterna").Text}"), Row.FCLiteral("LtlPU").Text.ToDouble, If(Row.DataKey("IVA").ToDouble = -1, ViewState("IVA").ToString().ToDouble, Row.DataKey("IVA").ToDouble), 0, 0, 1, 0, True, "",
' DrContrato("CveProyecto").ToString().ToEntero(), DrContrato("ProyectoContrato").ToString(), DrContrato("CveSubProyecto").ToString().ToEntero(), DrContrato("SubProyectoContrato").ToString(), CveTipoPS, CveTipoInv, CveContratoDetalle:=Row.DataKey("CveContratoDetalle").ToEntero(), CodigoPS:=Row.FCLiteral("LtlPS").Text)
@@ -4125,6 +4155,7 @@ Partial Class Ventas
End If
Next
ps.Dispose()
'SI EL CONTRATO TIENE IMPUESTOS LOCALES SE CARGAN LOS DEL CONTRATO AHUEVO
If RBLTipoContrato.SelectedValue = "2" Then
@@ -4175,7 +4206,15 @@ Partial Class Ventas
CalculaUsados()
CalculaTotalesVenta()
LbAgregar.Visible = False
If Me.CveContratoTipo <> 33 Then
LbAgregar.Visible = False
Else
Me.CveContrato = DdlContrato.SelectedValue.ToEntero()
LbAgregar.Visible = True
End If
UpPS.Update()
'restricciones para evitar cambios una vez seleccionado el contrato
@@ -4192,7 +4231,7 @@ Partial Class Ventas
PresionarBotonModal("C_BtnCerrarContrato")
ps.Dispose()
UpFacturar.Update()
End Sub
Private Sub CargarContratoUrl()
@@ -4366,6 +4405,11 @@ Partial Class Ventas
e.Row.FCTextBox("TxtCant").Enabled = False
End If
If Me.CveContratoTipo = 33 Then
e.Row.FCTextBox("TxtCant").Enabled = False
e.Row.FCTextBox("TxtCant").Text = e.Row.DBCampo("Cantidad")
End If
''Si viene de una OC Sin Facturar y tiene contrato
'If TieneContrato AndAlso ContratosConOC IsNot Nothing AndAlso ContratosConOC.ToString().Length > 0 Then
' e.Row.FCTextBox("TxtCant").Text = e.Row.DBCampo("CantidadOC").ToString()
@@ -4821,7 +4865,7 @@ Partial Class Ventas
End If
If UsuarioActual.CveEmpresa = 13 Then
UpDescripcionVenta.Visible = True
TrDescripcionVenta.Visible = True
TxtDescripcionVenta.Text = DbRowVenta("DescripcionVenta").ToString()
End If
@@ -6682,7 +6726,11 @@ Partial Class Ventas
'CargaFolios()
CargaDatosEstimaciones(CveCliente)
If UsuarioActual.CveEmpresa = 13 Then
CargaContratosCliente(CveCliente)
Else
CargaDatosEstimaciones(CveCliente)
End If
If ObjCliente.GetClienteImpuestosLocales(CveCliente) Then
'se cargan impuestos locales
@@ -13452,11 +13500,13 @@ Partial Class Ventas
End If
'Contratos
If factura.CveContrato > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing") Then
GuardarContratoAvanceEstimaciones(ObjContr, factura, ErrorList, 1)
'CUANDO ES NOTA DE CRÉDITO, NO DEBE DE CONSIDERAR AVANCE, CUANDO ES NOTA DE CRÉDITO POR AMORTIZACIÓN
ElseIf factura.CveContrato > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") AndAlso Not EsNCAmortizacion Then
GuardarContratoAvanceEstimaciones(ObjContr, factura, ErrorList, -1)
If factura.CveContrato > 0 AndAlso Me.CveContratoTipo <> 33 Then
If factura.CveContrato > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ing") Then
GuardarContratoAvanceEstimaciones(ObjContr, factura, ErrorList, 1)
'CUANDO ES NOTA DE CRÉDITO, NO DEBE DE CONSIDERAR AVANCE, CUANDO ES NOTA DE CRÉDITO POR AMORTIZACIÓN
ElseIf factura.CveContrato > 0 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Egs", "Dev") AndAlso Not EsNCAmortizacion Then
GuardarContratoAvanceEstimaciones(ObjContr, factura, ErrorList, -1)
End If
End If
'Impuestos Locales
@@ -13626,7 +13676,9 @@ Partial Class Ventas
If ErrorList.Count = 0 Then
'estimaciones
GuardarVentaEstimaciones(ObjContr, factura)
If Me.CveContratoTipo <> 33 Then
GuardarVentaEstimaciones(ObjContr, factura)
End If
If ErrorList.Count = 0 Then
'armonizaccionContable
GuardarVentaAC(ObjVentas, factura, Msgok, objContPaqi)
@@ -21410,18 +21462,39 @@ Partial Class Ventas
Protected Sub DdlContrato_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlContrato.SelectedIndexChanged
Dim valueselect = DdlContrato.SelectedValue
CargaDatosEstimaciones(CveCliente)
DdlContrato.SelectedValue = valueselect
If DdlContrato.SelectedValue.ToEntero() > 0 Then
For Each gvr As GridViewRow In GvEst.Rows
If gvr.DataKey("CveContratoAvance").ToEntero() > 0 Then
gvr.FCCheckBox("Chk").Checked = True
gvr.FCCheckBox("Chk").Visible = True
End If
Next
BtnEstimacion.Visible = True
Dim CveContrato As Integer = valueselect.ToEntero()
Using ObjContratos As New ClsContratos
If ObjContratos.GetContratos(CveContrato, UsuarioActual.CveEmpresa, CveCliente:=CveCliente) Then
Me.CveContratoTipo = ObjContratos.DtResultados.Rows(0)("CveContratoTipo").ToString().ToEntero()
End If
End Using
If CveContratoTipo <> 33 Then
CargaDatosEstimaciones(CveCliente)
DdlContrato.SelectedValue = valueselect
If DdlContrato.SelectedValue.ToEntero() > 0 Then
For Each gvr As GridViewRow In GvEst.Rows
If gvr.DataKey("CveContratoAvance").ToEntero() > 0 Then
gvr.FCCheckBox("Chk").Checked = True
gvr.FCCheckBox("Chk").Visible = True
End If
Next
BtnEstimacion.Visible = True
End If
Else
CargaDatosContratoDetalle()
GvEst.Visible = False
ContratoDetalles.Visible = False
GvContratoDetalles.Visible = True
DdlContrato.SelectedValue = valueselect
BtnEstimacion.Visible = False
UPEstimaciones.Update()
End If
'If RblOpcionContrato.SelectedValue = "3" Then
@@ -21441,34 +21514,62 @@ Partial Class Ventas
If CveVenta > 0 Then
Exit Sub
End If
Dim Con As New ClsContratos
If Con.GetEstimacionesPorFacturar(-1, CveCliente, DdlContrato.SelectedValue.ToEntero(), 0, UsuarioActual.CveEmpresa) Then
GvEst.DataSource = Con.DtResultados
If Con.DtResultados.Rows.Count > 0 Then
Dim ObjContrato As New ClsContratos
If ObjContrato.GetEstimacionesPorFacturar(-1, CveCliente, DdlContrato.SelectedValue.ToEntero(), 0, UsuarioActual.CveEmpresa) Then
GvEst.DataSource = ObjContrato.DtResultados
If ObjContrato.DtResultados.Rows.Count > 0 Then
'BtnEstimacion.Visible = True
DdlContrato.Items.Clear()
DdlContrato.Items.Add(New ListItem("Todos", "-1"))
DdlContrato.DataSource = Con.DtResultados.FiltraParametros("CveContrato > 0", "NumeroContrato", DistinctColumns:={"CveContrato", "NumeroContrato"})
DdlContrato.DataSource = ObjContrato.DtResultados.FiltraParametros("CveContrato > 0", "NumeroContrato", DistinctColumns:={"CveContrato", "NumeroContrato"})
End If
End If
ObjContrato.Dispose()
UPEstimaciones.Update()
Con.Dispose()
DdlContrato.DataBind()
GvEst.DataBind()
UPEstimaciones.Update()
End Sub
Private Sub CargaDatosContratoDetalle()
If CveVenta > 0 Then
Exit Sub
End If
Dim ObjContrato As New ClsContratos
If DdlContrato.SelectedValue.ToEntero() > 0 Then
If ObjContrato.GetContratosDetalle(DdlContrato.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then
GvContratoDetalles.DataSource = ObjContrato.DtResultados
End If
Else
GvContratoDetalles.DataSource = Nothing
End If
ObjContrato.Dispose()
GvContratoDetalles.DataBind()
GvContratoDetalles.EmptyDataText = "No se encontraron productos/servicios para este contrato"
UPEstimaciones.Update()
End Sub
Private Sub CargaContratosCliente(CveCliente As Integer)
If CveVenta > 0 Then
Exit Sub
End If
DdlContrato.Items.Clear()
DdlContrato.Items.Add(New ListItem("Todos", "-1"))
Dim ObjContratos As New ClsContratos
If ObjContratos.GetContratos(-1, UsuarioActual.CveEmpresa, CveCliente:=CveCliente, CveEstatus:=-1) Then
DdlContrato.DataSource = ObjContratos.DtResultados.FiltraParametros("CveContrato > 0", "NumeroContrato", DistinctColumns:={"CveContrato", "NumeroContrato"})
End If
ObjContratos.Dispose()
DdlContrato.DataBind()
UPEstimaciones.Update()
End Sub
Protected Sub GVEst_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEst.RowDataBound
If e.Row.RowType = DataControlRowType.DataRow Then