agregando formulario de ajuste a la recepción de usados
This commit is contained in:
@@ -2420,6 +2420,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
CargaFolioAjuste()
|
||||
CargaTipoDefecto()
|
||||
CargaTipoDeUso()
|
||||
TxtFechaAjuste.Attributes.Add("onchange", "CalculaMesesUso();")
|
||||
TxtFechaAjuste.Text = Today.ToString("d")
|
||||
End Sub
|
||||
Private Sub CreaDTmpDTAjustes()
|
||||
@@ -2489,7 +2490,7 @@ Partial Class Inventarios_RecepcionUsados
|
||||
If drPS IsNot Nothing Then
|
||||
PrecioSugerido = drPS("Precio").ToString.ToDecimal
|
||||
End If
|
||||
|
||||
txtPrecio.Text = PrecioSugerido.FormatoNumero(2)
|
||||
TxtPUFactura.Text = PrecioSugerido.FormatoNumero(2)
|
||||
End If
|
||||
End Sub
|
||||
@@ -2601,6 +2602,51 @@ Partial Class Inventarios_RecepcionUsados
|
||||
|
||||
UpAjuste.Update()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnCalculaMesesUso_Click(sender As Object, e As EventArgs)
|
||||
CalculaMesesUso()
|
||||
End Sub
|
||||
Protected Sub BtnCalcularImporteAjuste_Click(sender As Object, e As EventArgs)
|
||||
CalculaPorcentajeAjuste()
|
||||
End Sub
|
||||
|
||||
Private Sub CalculaMesesUso()
|
||||
Dim FechaI As Date = TxtFechaAjuste.Text.ToDate.AddDays(1)
|
||||
Dim FechaF As Date = Now
|
||||
Dim Dia As Integer = FechaI.Day
|
||||
'validación adicional, para saber si el mes tiene 31 días y el actua es menor.
|
||||
If FechaI.Day > Today.LastDayOfMonth.Day Then Dia = Today.LastDayOfMonth.Day
|
||||
Dim FechaT As Date = String.Format("{0}/{1}/{2}", Dia, FechaF.Month, FechaF.Year).ToDate 'armo la fecha con el día del mes actual
|
||||
|
||||
Dim MesesTrascurridos As Integer = Math.Round(DateDiff(DateInterval.Day, FechaI, FechaT) / 30.4, 2).ToEntero 'saco los meses y lo redondeo
|
||||
|
||||
If FechaT > FechaF Then
|
||||
'todavía está en el mes actual.
|
||||
MesesTrascurridos = MesesTrascurridos
|
||||
Else
|
||||
MesesTrascurridos = MesesTrascurridos + 1
|
||||
End If
|
||||
TxtMesesUso.Text = MesesTrascurridos.ToString
|
||||
CalculaPorcentajeAjuste()
|
||||
End Sub
|
||||
|
||||
Protected Sub BtnAgregarProductoAjuste_Click(sender As Object, e As EventArgs)
|
||||
Dim CvePS As Integer = DdlPSAjuste.SelectedValue.ToEntero
|
||||
Dim ObjPS As New ClsProductosServicios
|
||||
Dim CveTamaño As Integer = -1
|
||||
If ObjPS.GetPS(CvePS, -1, UsuarioActual.CveEmpresa) Then
|
||||
CveTamaño = ObjPS.DtResultados.FiltroPrimeroValor("CveTamaño").ToEntero
|
||||
End If
|
||||
Dim Datos As DataRow = GlobalDTAcumTamaños().FiltroPrimero(String.Format("CveTamaño = {0} AND CveEmpresa = {1}", CveTamaño, UsuarioActual.CveEmpresa))
|
||||
|
||||
Dim TamañoPS As DataRow
|
||||
If ObjPS.GetPS(Datos.Item("CvePSCargo").ToString.ToEntero, -1, UsuarioActual.CveEmpresa) Then
|
||||
TamañoPS = ObjPS.DtResultados.FiltroPrimero("")
|
||||
End If
|
||||
AddNew(TamañoPS.Item("CvePS").ToString.ToEntero, TamañoPS.Item("PSCodigo").ToString, TamañoPS.Item("CveUM").ToString.ToEntero, TamañoPS.Item("UnidadMedida").ToString, 1.0, TxtPUFactura.Text.ToDouble,
|
||||
"", "-1", "-1", "-1", "", "", "", -1, "", "", -1)
|
||||
ObjPS.Dispose()
|
||||
End Sub
|
||||
#End Region
|
||||
|
||||
End Class
|
||||
|
||||
Reference in New Issue
Block a user