Merge branch 'master' of http://jperez@192.168.10.111:8383/SIG.git
This commit is contained in:
@@ -1314,6 +1314,7 @@ Partial Class Ventas
|
||||
#End Region
|
||||
|
||||
#Region "Propiedades Contratos"
|
||||
|
||||
Private Property DtContratos As DataTable
|
||||
Get
|
||||
Return If(IsNothing(ViewState("DtContratos")), Nothing, CType(ViewState("DtContratos"), DataTable))
|
||||
@@ -1403,6 +1404,59 @@ Partial Class Ventas
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
Private Property PorAmortizacionAnticipo As Integer
|
||||
Get
|
||||
|
||||
If ViewState("PorAmortizacionAnticipo") Is Nothing Then
|
||||
Return 0
|
||||
Else
|
||||
Return CType(ViewState("PorAmortizacionAnticipo"), Integer)
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(value As Integer)
|
||||
ViewState("PorAmortizacionAnticipo") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
|
||||
Private Property AmortizacionSujeridaContrato As Decimal
|
||||
Get
|
||||
|
||||
If ViewState("AmortizacionSujeridaContrato") Is Nothing Then
|
||||
Return 0
|
||||
Else
|
||||
Return ViewState("AmortizacionSujeridaContrato").ToString.ToDecimal
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(value As Decimal)
|
||||
ViewState("AmortizacionSujeridaContrato") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
Private Property EscontratoObra As Boolean
|
||||
Get
|
||||
If ViewState("EscontratoObra") Is Nothing Then
|
||||
Return False
|
||||
Else
|
||||
Return Boolean.Parse(ViewState("EscontratoObra").ToString)
|
||||
End If
|
||||
|
||||
End Get
|
||||
Set(value As Boolean)
|
||||
ViewState("EscontratoObra") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
#Region " PROPIEDADES NUEVAS | GUARDAR - IMPRESION "
|
||||
@@ -1454,6 +1508,14 @@ Partial Class Ventas
|
||||
ViewState("ObjFacturaNC") = value
|
||||
End Set
|
||||
End Property
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
#End Region
|
||||
|
||||
#Region " PROPIEDADES NUEVAS "
|
||||
@@ -3030,7 +3092,13 @@ Partial Class Ventas
|
||||
TieneContrato = True
|
||||
LnkOCs.Visible = True
|
||||
UpnTools.Update()
|
||||
|
||||
|
||||
|
||||
Else
|
||||
BtnEstimacion.Visible = True
|
||||
GvEst.Visible = True
|
||||
|
||||
DdlContratosOC.Items.Clear()
|
||||
DdlContratosOC.DataSource = DtContratos
|
||||
DdlContratosOC.DataBind()
|
||||
@@ -3071,6 +3139,19 @@ Partial Class Ventas
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If DrContrato("CveContratoTipo").ToString.ToEntero.Contiene(30, 31) Then
|
||||
PorAmortizacionAnticipo = DrContrato("PorAmortizacionAnticipo").ToString.ToEntero
|
||||
EscontratoObra = True
|
||||
Else
|
||||
PorAmortizacionAnticipo = 0
|
||||
EscontratoObra = False
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
LbContratoImporteTotal.Text = DrContrato("ImporteTotal").ToString().FormatoNumero
|
||||
LbContratoImporteMinimo.Text = DrContrato("ImporteMin").ToString().FormatoNumero
|
||||
LbContratoImporteMaximo.Text = DrContrato("ImporteMax").ToString().FormatoNumero
|
||||
@@ -3214,6 +3295,7 @@ Partial Class Ventas
|
||||
DdlTipoComprobante.Items.Remove(DdlTipoComprobante.Items.FindByValue("Cot"))
|
||||
End If
|
||||
|
||||
DVEstimacionesObra.Visible = False
|
||||
Select Case RBLTipoContrato.SelectedValue.ToEntero()
|
||||
Case 1
|
||||
DdlTipoComprobante.Items.Insert(0, New ListItem("Pedido", "Ped"))
|
||||
@@ -3226,7 +3308,35 @@ Partial Class Ventas
|
||||
DdlTipoComprobante.Items.Insert(0, New ListItem("Pedido de Consignación", "PeC"))
|
||||
DdlTipoComprobante.SelectedValue = "PeC"
|
||||
DdlTipoComprobante.Enabled = False
|
||||
|
||||
Case 4
|
||||
|
||||
TabGenerales.Enabled = True
|
||||
DVEstimacionesObra.Visible = True
|
||||
DdlEstimacionesObra.Items.Clear()
|
||||
Dim Con As New ClsContratos
|
||||
If Con.GetContratosAvanceEstimacionVentas(DdlContratosModal.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa) Then
|
||||
DdlEstimacionesObra.DataSource = Con.DtResultados
|
||||
Else
|
||||
DdlEstimacionesObra.DataSource = Nothing
|
||||
End If
|
||||
|
||||
Con.Dispose()
|
||||
|
||||
DdlEstimacionesObra.DataBind()
|
||||
DdlEstimacionesObra.Items.Insert(0, New ListItem("Todos", "-1"))
|
||||
|
||||
BtnCargarContratoDetalles.Visible = False
|
||||
BtnCancelarContratoDetalles.Visible = False
|
||||
BtnCalcularTotalesContrato.Visible = False
|
||||
|
||||
BtnEstimacion.Visible = False
|
||||
GvEst.Visible = False
|
||||
GvContratoDetalles.Visible = False
|
||||
|
||||
End Select
|
||||
UPEstimaciones.Update()
|
||||
Updatetabs.Update()
|
||||
|
||||
ChkPSOC.Checked = False
|
||||
CambiaTipoDocto()
|
||||
@@ -3560,6 +3670,7 @@ Partial Class Ventas
|
||||
UpContratos.Update()
|
||||
End Sub
|
||||
Private Sub DdlContratoModalSelectIndex()
|
||||
|
||||
If Not DdlContratosModal.SelectedValue.ToEntero() > 0 Then
|
||||
GvContratoDetalles.DataBind()
|
||||
UpContratos.Update()
|
||||
@@ -7192,6 +7303,9 @@ Partial Class Ventas
|
||||
|
||||
Protected Sub EmitirImprimirNew(Optional TipoDoctoViejo As String = "")
|
||||
|
||||
If Not ValidaVentaContratoObra() Then
|
||||
Exit Sub
|
||||
End If
|
||||
|
||||
If ValidaPagosContado() Then
|
||||
Exit Sub
|
||||
@@ -8785,6 +8899,13 @@ Partial Class Ventas
|
||||
ObjFactura.CveCorte = CveCorte
|
||||
ObjFactura.CveMesa = -1
|
||||
ObjFactura.NumeroPersonas = 0
|
||||
|
||||
|
||||
If ObjFactura.TipoDocto = "Ant" And DdlContratosModal.SelectedValue.ToEntero > 0 Or ObjFactura.TipoDocto = "Ing" And DdlContratosModal.SelectedValue.ToEntero > 0 Then
|
||||
CveContrato = DdlContratosModal.SelectedValue.ToEntero
|
||||
End If
|
||||
|
||||
|
||||
ObjFactura.CveContrato = If(CveContrato > 0, CveContrato, CvePresupuesto)
|
||||
|
||||
ObjFactura.CveClienteSucursal = DdlSucursalCliente.SelectedValue.ToEntero()
|
||||
@@ -10556,6 +10677,14 @@ Partial Class Ventas
|
||||
End If
|
||||
|
||||
|
||||
If ErrorList.Count = 0 AndAlso RBLTipoContrato.SelectedValue = "4" And DdlEstimacionesObra.SelectedValue.ToEntero > 0 Then
|
||||
|
||||
If Not ObjContr.UpdateContratosAvanceEstimacionVentas(DdlEstimacionesObra.SelectedValue.ToEntero, ObjFactura.CveVenta, UsuarioActual.CveEmpresa) Then
|
||||
ErrorList.Add("Ocurrió un error al actualizar la estimación")
|
||||
End If
|
||||
End If
|
||||
|
||||
|
||||
If ErrorList.Count = 0 Then
|
||||
'prepoliza
|
||||
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion, NCDescuento:=NCDescuento, ListaNCDescuento:=ListaNCDescuento, ObjInventario:=ObjInventario)
|
||||
@@ -13121,8 +13250,19 @@ Partial Class Ventas
|
||||
maxsaldo = total
|
||||
End If
|
||||
|
||||
|
||||
If DdlContratosModal.SelectedValue.ToEntero > 0 AndAlso AmortizacionSujeridaContrato > 0 Then
|
||||
|
||||
If AmortizacionSujeridaContrato > saldo Then
|
||||
AmortizacionSujeridaContrato = saldo
|
||||
End If
|
||||
|
||||
End If
|
||||
|
||||
|
||||
|
||||
e.Row.FCLiteral("MonedaVenta").Text = saldo.FormatoNumero(2)
|
||||
e.Row.FCCheckBox("Chk" & e.Row.RowIndex).Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1});", e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).ClientID, saldo))
|
||||
e.Row.FCCheckBox("Chk" & e.Row.RowIndex).Attributes.Add("onclick", String.Format("chkAnt(this,{0},{1},{2});", e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).ClientID, saldo, AmortizacionSujeridaContrato))
|
||||
e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).Attributes.Add("onKeyUp", String.Format("FnCambiaAnt({0},this,{1});", e.Row.FCCheckBox("Chk" & e.Row.RowIndex).ClientID, saldo))
|
||||
e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).Attributes.Add("onKeyUp", String.Format("CambioTipoMoneda({0},{1},{2},{3},{4});", e.Row.FCCheckBox("Chk" & e.Row.RowIndex).ClientID, e.Row.DataKey("Saldo"), e.Row.FCTextBox("TxtAnticipo" & e.Row.RowIndex).ClientID, e.Row.FCTextBox("TxtTC" & e.Row.RowIndex).ClientID, e.Row.DataKey("CveMoneda")))
|
||||
|
||||
@@ -13159,7 +13299,7 @@ Partial Class Ventas
|
||||
|
||||
|
||||
|
||||
End If
|
||||
End If
|
||||
End Sub
|
||||
Protected Sub BtnAceptarAnticipos_Click(sender As Object, e As System.EventArgs) Handles BtnAceptarAnticipos.Click
|
||||
Anticipos()
|
||||
@@ -18141,25 +18281,53 @@ Partial Class Ventas
|
||||
BtnEstimacion.Visible = True
|
||||
End If
|
||||
|
||||
'If RblOpcionContrato.SelectedValue = "3" Then
|
||||
|
||||
|
||||
' GvEst.DataSource = Nothing
|
||||
' GvEst.DataBind()
|
||||
' BtnEstimacion.Visible = False
|
||||
|
||||
' BtnCargarContratoDetalles.Visible = False
|
||||
' BtnCancelarContratoDetalles.Visible = False
|
||||
|
||||
' UPEstimaciones.Update()
|
||||
|
||||
'End If
|
||||
|
||||
End Sub
|
||||
Private Sub CargaDatosEstimaciones(CveCliente As Integer)
|
||||
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
|
||||
'BtnEstimacion.Visible = True
|
||||
DdlContrato.Items.Clear()
|
||||
DdlContrato.Items.Add(New ListItem("Todos", "-1"))
|
||||
DdlContrato.DataSource = Con.DtResultados.FiltraParametros("CveContrato > 0", "NumeroContrato", DistinctColumns:={"CveContrato", "NumeroContrato"})
|
||||
GvEst.DataSource = Con.DtResultados
|
||||
If Con.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"})
|
||||
End If
|
||||
End If
|
||||
End If
|
||||
UPEstimaciones.Update()
|
||||
Con.Dispose()
|
||||
DdlContrato.DataBind()
|
||||
GvEst.DataBind()
|
||||
|
||||
|
||||
UPEstimaciones.Update()
|
||||
Con.Dispose()
|
||||
DdlContrato.DataBind()
|
||||
GvEst.DataBind()
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
Protected Sub GVEst_RowDataBound(sender As Object, e As GridViewRowEventArgs) Handles GvEst.RowDataBound
|
||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||
@@ -25062,7 +25230,12 @@ Partial Class Ventas
|
||||
End Sub
|
||||
|
||||
Private Sub DdlTipoAmortizacionAnticipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAmortizacionAnticipo.SelectedIndexChanged
|
||||
|
||||
|
||||
ImporteSujeridoAnticipo(DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero)
|
||||
|
||||
divAnticipoMsg.Visible = False
|
||||
|
||||
If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("1", "2") Then
|
||||
'cuando es amortización por descuento, debe tener seleccionado descuentos previamente registrados
|
||||
If DdlTipoAmortizacionAnticipo.SelectedValue = "1" AndAlso LblDescuentos.Text.ToDecimal <= 0 Then
|
||||
@@ -25084,6 +25257,34 @@ Partial Class Ventas
|
||||
DdlTipoRelacionAnticipo.SelectedValueExist("-1")
|
||||
End If
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
|
||||
Private Sub ImporteSujeridoAnticipo(TipoAmortizacion As Integer)
|
||||
|
||||
'TipoAmortizacion
|
||||
'1.-Anticpo como descuento se basa en subtotal
|
||||
'2.-Anticipo con notade credito se basa en total
|
||||
|
||||
AmortizacionSujeridaContrato = 0
|
||||
Dim Porcentaje As Decimal = PorAmortizacionAnticipo * 0.01D
|
||||
|
||||
If PorAmortizacionAnticipo > 0 AndAlso TipoAmortizacion > 0 Then
|
||||
|
||||
If TipoAmortizacion = 1 Then
|
||||
AmortizacionSujeridaContrato = (TxtSubTotal2.Text.ToDecimal * Porcentaje).RoundSQL(2)
|
||||
ElseIf TipoAmortizacion = 2 Then
|
||||
AmortizacionSujeridaContrato = (TxtTotal.Text.ToDecimal * Porcentaje).RoundSQL(2)
|
||||
End If
|
||||
|
||||
Else
|
||||
AmortizacionSujeridaContrato = 0
|
||||
End If
|
||||
|
||||
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub DdlMetodoPago33_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlMetodoPago33.SelectedIndexChanged
|
||||
@@ -27751,6 +27952,55 @@ Partial Class Ventas
|
||||
End If
|
||||
End Sub
|
||||
|
||||
|
||||
Function ValidaVentaContratoObra() As Boolean
|
||||
|
||||
Dim Respuesta As Boolean = False
|
||||
|
||||
If EscontratoObra Then
|
||||
|
||||
If DdlTipoComprobante.SelectedValue = "Ing" Then
|
||||
|
||||
If DdlEstimacionesObra.SelectedValue.ToEntero > 0 Then
|
||||
|
||||
Dim ImporteAmortizarFinal As Decimal = 0
|
||||
If GVAnticipos.Rows.Count > 0 Then
|
||||
Dim actualindex As Integer = 0
|
||||
For Each row2 As GridViewRow In GVAnticipos.Rows
|
||||
If row2.FCCheckBox("Chk" & row2.RowIndex).Checked Then
|
||||
ImporteAmortizarFinal = ImporteAmortizarFinal + row2.FCTextBox($"TxtAnticipo{actualindex}").Text.ToDecimal
|
||||
End If
|
||||
actualindex = actualindex + 1
|
||||
Next
|
||||
End If
|
||||
|
||||
If ImporteAmortizarFinal > 0 Then
|
||||
Respuesta = True
|
||||
Else
|
||||
Respuesta = False
|
||||
Alert("Debe de seleccioanr un importe de amortización.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
Else
|
||||
Respuesta = False
|
||||
Alert("Se selecciono un contrato de obra, para continuar seleccione una estimación.", TipoMensaje.MsgAdvertencia)
|
||||
End If
|
||||
|
||||
ElseIf DdlTipoComprobante.SelectedValue = "Ant" Then
|
||||
Respuesta = True
|
||||
Else
|
||||
Alert("Tipo de documento no valido para contratos de obra.", TipoMensaje.MsgAdvertencia)
|
||||
Respuesta = True
|
||||
End If
|
||||
|
||||
Else
|
||||
Respuesta = True
|
||||
End If
|
||||
|
||||
Return Respuesta
|
||||
|
||||
End Function
|
||||
|
||||
#End Region
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user