Contratos Ventas, en amortizacion sugerir importe de a porcentje de anticipo y validar seleccion de estimacion y contrato.
This commit is contained in:
@@ -7908,7 +7908,7 @@
|
|||||||
$get('HdnTotalVenta').value = FormatoNumero(totalVenta, 2);
|
$get('HdnTotalVenta').value = FormatoNumero(totalVenta, 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
function chkAnt(t, txt, importe) {
|
function chkAnt(t, txt, importe, AmorContrato = 0) {
|
||||||
debugger;
|
debugger;
|
||||||
var totalAnt = 0;
|
var totalAnt = 0;
|
||||||
|
|
||||||
@@ -7925,6 +7925,8 @@
|
|||||||
|
|
||||||
if (SaldoCompra > 0) {
|
if (SaldoCompra > 0) {
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//if (SaldoCompra > importe) {
|
//if (SaldoCompra > importe) {
|
||||||
// txt.value = importe.toFixed(2);
|
// txt.value = importe.toFixed(2);
|
||||||
// SaldoCompra = SaldoCompra - importe;
|
// SaldoCompra = SaldoCompra - importe;
|
||||||
@@ -7935,7 +7937,14 @@
|
|||||||
// //SaldoCompra = 0.00;
|
// //SaldoCompra = 0.00;
|
||||||
// $get('HdnVentaSaldo').value = SaldoCompra;
|
// $get('HdnVentaSaldo').value = SaldoCompra;
|
||||||
//}
|
//}
|
||||||
txt.value = importe.toFixed(2);
|
|
||||||
|
if(AmorContrato > 0){
|
||||||
|
txt.value = AmorContrato.toFixed(2);
|
||||||
|
}else{
|
||||||
|
txt.value = importe.toFixed(2);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
totalAnt = FnSumaValoresAnt();
|
totalAnt = FnSumaValoresAnt();
|
||||||
|
|
||||||
|
|||||||
@@ -1314,6 +1314,7 @@ Partial Class Ventas
|
|||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region "Propiedades Contratos"
|
#Region "Propiedades Contratos"
|
||||||
|
|
||||||
Private Property DtContratos As DataTable
|
Private Property DtContratos As DataTable
|
||||||
Get
|
Get
|
||||||
Return If(IsNothing(ViewState("DtContratos")), Nothing, CType(ViewState("DtContratos"), DataTable))
|
Return If(IsNothing(ViewState("DtContratos")), Nothing, CType(ViewState("DtContratos"), DataTable))
|
||||||
@@ -1403,6 +1404,59 @@ Partial Class Ventas
|
|||||||
End Set
|
End Set
|
||||||
End Property
|
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
|
#End Region
|
||||||
|
|
||||||
#Region " PROPIEDADES NUEVAS | GUARDAR - IMPRESION "
|
#Region " PROPIEDADES NUEVAS | GUARDAR - IMPRESION "
|
||||||
@@ -1454,6 +1508,14 @@ Partial Class Ventas
|
|||||||
ViewState("ObjFacturaNC") = value
|
ViewState("ObjFacturaNC") = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
#Region " PROPIEDADES NUEVAS "
|
#Region " PROPIEDADES NUEVAS "
|
||||||
@@ -3077,6 +3139,19 @@ Partial Class Ventas
|
|||||||
Exit Sub
|
Exit Sub
|
||||||
End If
|
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
|
LbContratoImporteTotal.Text = DrContrato("ImporteTotal").ToString().FormatoNumero
|
||||||
LbContratoImporteMinimo.Text = DrContrato("ImporteMin").ToString().FormatoNumero
|
LbContratoImporteMinimo.Text = DrContrato("ImporteMin").ToString().FormatoNumero
|
||||||
LbContratoImporteMaximo.Text = DrContrato("ImporteMax").ToString().FormatoNumero
|
LbContratoImporteMaximo.Text = DrContrato("ImporteMax").ToString().FormatoNumero
|
||||||
@@ -7228,6 +7303,9 @@ Partial Class Ventas
|
|||||||
|
|
||||||
Protected Sub EmitirImprimirNew(Optional TipoDoctoViejo As String = "")
|
Protected Sub EmitirImprimirNew(Optional TipoDoctoViejo As String = "")
|
||||||
|
|
||||||
|
If Not ValidaVentaContratoObra() Then
|
||||||
|
Exit Sub
|
||||||
|
End If
|
||||||
|
|
||||||
If ValidaPagosContado() Then
|
If ValidaPagosContado() Then
|
||||||
Exit Sub
|
Exit Sub
|
||||||
@@ -8775,7 +8853,7 @@ Partial Class Ventas
|
|||||||
ObjFactura.NumeroPersonas = 0
|
ObjFactura.NumeroPersonas = 0
|
||||||
|
|
||||||
|
|
||||||
If ObjFactura.TipoDocto = "Ant" And DdlContratosModal.SelectedValue.ToEntero > 0 Then
|
If ObjFactura.TipoDocto = "Ant" And DdlContratosModal.SelectedValue.ToEntero > 0 Or ObjFactura.TipoDocto = "Ing" And DdlContratosModal.SelectedValue.ToEntero > 0 Then
|
||||||
CveContrato = DdlContratosModal.SelectedValue.ToEntero
|
CveContrato = DdlContratosModal.SelectedValue.ToEntero
|
||||||
End If
|
End If
|
||||||
|
|
||||||
@@ -13107,8 +13185,19 @@ Partial Class Ventas
|
|||||||
maxsaldo = total
|
maxsaldo = total
|
||||||
End If
|
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.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("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")))
|
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")))
|
||||||
|
|
||||||
@@ -13145,7 +13234,7 @@ Partial Class Ventas
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
Protected Sub BtnAceptarAnticipos_Click(sender As Object, e As System.EventArgs) Handles BtnAceptarAnticipos.Click
|
Protected Sub BtnAceptarAnticipos_Click(sender As Object, e As System.EventArgs) Handles BtnAceptarAnticipos.Click
|
||||||
Anticipos()
|
Anticipos()
|
||||||
@@ -25037,7 +25126,12 @@ Partial Class Ventas
|
|||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
Private Sub DdlTipoAmortizacionAnticipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAmortizacionAnticipo.SelectedIndexChanged
|
Private Sub DdlTipoAmortizacionAnticipo_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlTipoAmortizacionAnticipo.SelectedIndexChanged
|
||||||
|
|
||||||
|
|
||||||
|
ImporteSujeridoAnticipo(DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero)
|
||||||
|
|
||||||
divAnticipoMsg.Visible = False
|
divAnticipoMsg.Visible = False
|
||||||
|
|
||||||
If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("1", "2") Then
|
If DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("1", "2") Then
|
||||||
'cuando es amortización por descuento, debe tener seleccionado descuentos previamente registrados
|
'cuando es amortización por descuento, debe tener seleccionado descuentos previamente registrados
|
||||||
If DdlTipoAmortizacionAnticipo.SelectedValue = "1" AndAlso LblDescuentos.Text.ToDecimal <= 0 Then
|
If DdlTipoAmortizacionAnticipo.SelectedValue = "1" AndAlso LblDescuentos.Text.ToDecimal <= 0 Then
|
||||||
@@ -25059,6 +25153,34 @@ Partial Class Ventas
|
|||||||
DdlTipoRelacionAnticipo.SelectedValueExist("-1")
|
DdlTipoRelacionAnticipo.SelectedValueExist("-1")
|
||||||
End If
|
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
|
End Sub
|
||||||
|
|
||||||
Private Sub DdlMetodoPago33_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlMetodoPago33.SelectedIndexChanged
|
Private Sub DdlMetodoPago33_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlMetodoPago33.SelectedIndexChanged
|
||||||
@@ -27726,6 +27848,55 @@ Partial Class Ventas
|
|||||||
End If
|
End If
|
||||||
End Sub
|
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
|
#End Region
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user