Entradas salidas, cambio control fecha

This commit is contained in:
rakcsle
2023-11-02 11:28:59 -07:00
parent f3e7c3f160
commit da8f11ebb9
2 changed files with 80 additions and 39 deletions

View File

@@ -152,10 +152,12 @@
<div class="row"> <div class="row">
<label class="col-md-1 truncate" style="width: 110px">Fecha:</label> <label class="col-md-1 truncate" style="width: 110px">Fecha:</label>
<div class="col-md-2"> <div class="col-md-4">
<div style="display: inline-block; vertical-align: text-bottom;">
<asp:TextBox ID="TextBox1" type="datetime-local" runat="server" CssClass="form-control" CausesValidation="true" Style="width: 198px" MaxLength="10"></asp:TextBox>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;"> <asp:TextBox ID="TxtFecha" type="datetime-local" runat="server" CssClass="form-control" CausesValidation="true" Style="width: 100%" step="1"></asp:TextBox>
<%--<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;">
<asp:TextBox ID="TxtFecha" runat="server" CssClass="form-control" CausesValidation="true" Style="width: 118px" MaxLength="10"></asp:TextBox> <asp:TextBox ID="TxtFecha" runat="server" CssClass="form-control" CausesValidation="true" Style="width: 118px" MaxLength="10"></asp:TextBox>
<span class="input-group-btn "> <span class="input-group-btn ">
<asp:LinkButton ID="ImgFecha" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton> <asp:LinkButton ID="ImgFecha" class="btn default " Text="<i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
@@ -170,18 +172,20 @@
<asp:RangeValidator ID="RVFecha" runat="server" ControlToValidate="TxtFecha" Display="None" Type="Date" MinimumValue="01/01/2000" MaximumValue="01/01/2000" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> no puede ser mayor al dia actual. Por favor verifcar." ValidationGroup="GrpGuardar"></asp:RangeValidator> <asp:RangeValidator ID="RVFecha" runat="server" ControlToValidate="TxtFecha" Display="None" Type="Date" MinimumValue="01/01/2000" MaximumValue="01/01/2000" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> no puede ser mayor al dia actual. Por favor verifcar." ValidationGroup="GrpGuardar"></asp:RangeValidator>
<ajax:ValidatorCalloutExtender ID="VCOFecha3" runat="server" HighlightCssClass="vco" TargetControlID="RVFecha" Width="350px"></ajax:ValidatorCalloutExtender> <ajax:ValidatorCalloutExtender ID="VCOFecha3" runat="server" HighlightCssClass="vco" TargetControlID="RVFecha" Width="350px"></ajax:ValidatorCalloutExtender>
</div> </div>--%>
</div> </div>
</div>
<label class="col-md-1 truncate" style="display: none">Hora:</label> <%-- <label class="col-md-1 truncate" style="display: none">Hora:</label>
<div class="col-md-1" style="display:none" > <div class="col-md-1" style="display:none" >
<div style="width: 85px;"> <div style="width: 85px;">
<asp:TextBox ID="TxtHora" type="time" runat="server" CssClass="form-control" CausesValidation="true" Style=" padding: 0px 0px 0px 0px; width: 53px" MaxLength="10"></asp:TextBox> <asp:TextBox ID="TxtHora" type="time" runat="server" CssClass="form-control" CausesValidation="true" Style=" padding: 0px 0px 0px 0px; width: 53px" MaxLength="10"></asp:TextBox>
</div> </div>
</div> </div>--%>
<label class="col-md-1 truncate" style="width: 110px" id="DivFolio1" runat="server">Folio:</label> <label class="col-md-1 truncate" style="width: 110px" id="DivFolio1" runat="server">Folio:</label>
<div class="col-md-2" id="DivFolio2" runat="server"> <div class="col-md-4" id="DivFolio2" runat="server">
<asp:TextBox ID="TxtFolio" runat="server" style="text-align:left;" CssClass="TextBoxAsLabel" Font-Bold="true" Width="100%"></asp:TextBox> <asp:TextBox ID="TxtFolio" runat="server" style="text-align:left;" CssClass="TextBoxAsLabel" Font-Bold="true" Width="110px"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="SoloNumerosFolio" runat="server" TargetControlID="TxtFolio" FilterType="Numbers" /> <ajax:FilteredTextBoxExtender ID="SoloNumerosFolio" runat="server" TargetControlID="TxtFolio" FilterType="Numbers" />
</div> </div>
</div> </div>

View File

@@ -3,6 +3,7 @@ Option Strict On
Imports System.Data Imports System.Data
Imports System.IO Imports System.IO
Imports CrystalDecisions.CrystalReports.ViewerObjectModel
Imports Extensiones Imports Extensiones
Partial Class Inventarios_EntradasSalidas Partial Class Inventarios_EntradasSalidas
@@ -383,13 +384,15 @@ Partial Class Inventarios_EntradasSalidas
CreaDT() CreaDT()
CargaCombos() CargaCombos()
TxtFecha.Text = NowADS().ToShortDateString
'TxtFecha.Text = Mov.Fecha.ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
TxtFecha.Text = NowADS().ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
TxtFechaInvFisico.Text = NowADS().ToShortDateString TxtFechaInvFisico.Text = NowADS().ToShortDateString
RVFecha.MaximumValue = NowADS().ToShortDateString 'RVFecha.MaximumValue = NowADS().ToShortDateString
If Not UsuarioActual.CveEmpresa = 48 Then If Not UsuarioActual.CveEmpresa = 48 Then
TxtFecha.Enabled = False TxtFecha.Enabled = False
ImgFecha.Visible = False 'ImgFecha.Visible = False
End If End If
@@ -468,7 +471,7 @@ Partial Class Inventarios_EntradasSalidas
If UsuarioActual.Empresa.Funcionalidad(281).ToEntero = 1 Then If UsuarioActual.Empresa.Funcionalidad(281).ToEntero = 1 Then
TxtFecha.Enabled = False TxtFecha.Enabled = False
ImgFecha.Visible = False 'ImgFecha.Visible = False
TxtFechaInvFisico.Enabled = False TxtFechaInvFisico.Enabled = False
ImgFechaInvFisico.Visible = False ImgFechaInvFisico.Visible = False
@@ -485,7 +488,7 @@ Partial Class Inventarios_EntradasSalidas
If EsConsumoInterno AndAlso UsuarioActual.TienePermisoProceso(340) Then If EsConsumoInterno AndAlso UsuarioActual.TienePermisoProceso(340) Then
TxtFecha.Enabled = True TxtFecha.Enabled = True
ImgFecha.Visible = True 'ImgFecha.Visible = True
End If End If
End If End If
@@ -755,9 +758,9 @@ Partial Class Inventarios_EntradasSalidas
CveMovimiento = Mov.CveMovimiento CveMovimiento = Mov.CveMovimiento
DtMov = Mov.DtResultados DtMov = Mov.DtResultados
TextBox1.Text = Mov.Fecha.ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T") TxtFecha.Text = Mov.Fecha.ToDateTime.ToString("yyyy-MM-dd HH:mm:ss").Replace(" ", "T")
TxtFecha.Text = Mov.Fecha.ToShortDateString 'TxtFecha.Text = Mov.Fecha.ToShortDateString
TxtHora.Text = Mov.Fecha.ToString("HH:mm") 'TxtHora.Text = Mov.Fecha.ToString("HH:mm")
EstatusAlmacenCompra = Mov.EstatusAlmacenCompra EstatusAlmacenCompra = Mov.EstatusAlmacenCompra
Folio = Mov.Folio Folio = Mov.Folio
Dim drM As DataRow = DtMov.Rows(0) Dim drM As DataRow = DtMov.Rows(0)
@@ -1116,10 +1119,10 @@ Partial Class Inventarios_EntradasSalidas
'BLOQUEA FECHA CUANDO YA SE TIENE POLIZA 'BLOQUEA FECHA CUANDO YA SE TIENE POLIZA
If HdnIdPoliza.Value.ToEntero > 0 And Not PermiteGuardar() Then If HdnIdPoliza.Value.ToEntero > 0 And Not PermiteGuardar() Then
TxtFecha.Enabled = False TxtFecha.Enabled = False
ImgFecha.Enabled = False 'ImgFecha.Enabled = False
Else Else
TxtFecha.Enabled = True TxtFecha.Enabled = True
ImgFecha.Enabled = True 'ImgFecha.Enabled = True
TxtObservaciones.Enabled = True TxtObservaciones.Enabled = True
End If End If
@@ -1146,7 +1149,7 @@ Partial Class Inventarios_EntradasSalidas
If UsuarioActual.Empresa.Funcionalidad(281).ToEntero = 1 Then If UsuarioActual.Empresa.Funcionalidad(281).ToEntero = 1 Then
TxtFecha.Enabled = False TxtFecha.Enabled = False
ImgFecha.Visible = False 'ImgFecha.Visible = False
TxtFechaInvFisico.Enabled = False TxtFechaInvFisico.Enabled = False
ImgFechaInvFisico.Visible = False ImgFechaInvFisico.Visible = False
@@ -1410,10 +1413,18 @@ Partial Class Inventarios_EntradasSalidas
#Region " AGREGAR - GUARDAR " #Region " AGREGAR - GUARDAR "
Private Function GetExistencias(CvePS As Integer, CveUnidadMedida As Integer, CveEmpresa As Integer, CveAlmacen As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional Serie As String = "-1", Optional Lote As String = "-1", Optional FechaCaducidad As Date = MinFecha) As Decimal Private Function GetExistencias(CvePS As Integer, CveUnidadMedida As Integer, CveEmpresa As Integer, CveAlmacen As Integer, Optional CveSeccionAlmacen As Integer = -1, Optional Serie As String = "-1", Optional Lote As String = "-1", Optional FechaCaducidad As Date = MinFecha) As Decimal
Dim FechaMovimiento As DateTime = TxtFecha.Text.Replace(",", "").ToDateTime
Dim FechaMovtoStr As String = $"{FechaMovimiento.ToString("yyyy/MM/dd")} {FechaMovimiento.ToString("hh:mm")}"
Dim Inv As New ClsInventarios Dim Inv As New ClsInventarios
Dim Existencia As Decimal = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, CveEmpresa, CveAlmacen, CveSeccionAlmacen:=CveSeccionAlmacen, FechaMovto:=String.Format("{0} {1}", TxtFecha.Text.ToDate.ToString("yyyy/MM/dd"), TxtHora.Text), Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad)
Dim Existencia As Decimal = Inv.GetExistenciasPS(CvePS, CveUnidadMedida, CveEmpresa, CveAlmacen, CveSeccionAlmacen:=CveSeccionAlmacen, FechaMovto:=FechaMovtoStr, Serie:=Serie, Lote:=Lote, FechaCaducidad:=FechaCaducidad)
Inv.Dispose() Inv.Dispose()
Return Existencia Return Existencia
End Function End Function
'Protected Sub btnAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click 'Protected Sub btnAgregar_Click(sender As Object, e As EventArgs) Handles LbAgregar.Click
@@ -1587,6 +1598,20 @@ Partial Class Inventarios_EntradasSalidas
End Sub End Sub
Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click Protected Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click
If Not IsDate(TxtFecha.Text.Replace(",", "")) Then
Alert("Debe seleccioanr una fecha valida", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If TxtFecha.Text.Replace(",", "").ToDate.ToString("dd/MM/yyyy").ToDate > NowADS().ToString("dd/MM/yyyy").ToDate Then
Alert("El campo <b>''Fecha''</b> no puede ser mayor al dia actual. Por favor verifcar", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
If EsNuevoMov Then If EsNuevoMov Then
CveMovimiento = 0 CveMovimiento = 0
End If End If
@@ -1626,17 +1651,24 @@ Partial Class Inventarios_EntradasSalidas
ActivoFijo = DdlActivoFijo.SelectedValue.ToEntero ActivoFijo = DdlActivoFijo.SelectedValue.ToEntero
End If End If
Dim FechaMovimiento As DateTime = TxtFecha.Text.Replace(",", "").ToDateTime
Dim FechaMovtoStr As String = $"{FechaMovimiento.ToString("yyyy/MM/dd")} {FechaMovimiento.ToString("hh:mm:ss")}"
'ACTUALIZAR 'ACTUALIZAR
If CveMovimiento > 0 Then If CveMovimiento > 0 Then
Dim Mensaje As String = "" Dim Mensaje As String = ""
'Actualiza Movimiento 'Actualiza Movimiento
If Not ObjInventario.UpdateMovimiento(CveMovimiento, DdlAlmacen.SelectedValue.ToEntero, DdlConcepto.SelectedValue.ToEntero, 1, String.Format("{0} {1}", TxtFecha.Text.ToDate.ToString("yyyy/MM/dd"), TxtHora.Text).ToDate,
If Not ObjInventario.UpdateMovimiento(CveMovimiento, DdlAlmacen.SelectedValue.ToEntero, DdlConcepto.SelectedValue.ToEntero, 1, FechaMovimiento,
TxtFolio.Text.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Guia:=TxtGuia.Text, Observaciones:=TxtObservaciones.Text) Then TxtFolio.Text.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Guia:=TxtGuia.Text, Observaciones:=TxtObservaciones.Text) Then
Mensaje = "Error al Actualizar el Movimiento" Mensaje = "Error al Actualizar el Movimiento"
ErrorMovInv = True ErrorMovInv = True
End If End If
If Not ErrorMovInv Then If Not ErrorMovInv Then
' Actualizo los movimientos ' Actualizo los movimientos
@@ -1644,7 +1676,7 @@ Partial Class Inventarios_EntradasSalidas
'Determina PU dependiendo MONEDA 'Determina PU dependiendo MONEDA
If DdlConcepto.SelectedValue.ToEntero = 2 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then If DdlConcepto.SelectedValue.ToEntero = 2 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then
ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.Replace(",", "").ToDate).ToDecimal
Else Else
ImporteConcepto = Dr("PU").ToString.ToDecimal ImporteConcepto = Dr("PU").ToString.ToDecimal
End If End If
@@ -1670,7 +1702,11 @@ Partial Class Inventarios_EntradasSalidas
Else Else
If GlobalDTInvConceptos.FiltraParametros(String.Format("CveConcepto = {0}", DdlConcepto.SelectedValue.ToEntero)).Rows.Count > 0 AndAlso GlobalDTInvConceptos.FiltraParametros(String.Format("CveConcepto = {0}", DdlConcepto.SelectedValue.ToEntero)).Rows(0)("Origen").ToString.ToEntero < 0 Then If GlobalDTInvConceptos.FiltraParametros(String.Format("CveConcepto = {0}", DdlConcepto.SelectedValue.ToEntero)).Rows.Count > 0 AndAlso GlobalDTInvConceptos.FiltraParametros(String.Format("CveConcepto = {0}", DdlConcepto.SelectedValue.ToEntero)).Rows(0)("Origen").ToString.ToEntero < 0 Then
If ObjInventario.GetExistenciasPS(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=String.Format("{0} {1}", TxtFecha.Text.ToDate.ToString("yyyy/MM/dd"), TxtHora.Text), Serie:=If(Dr("Serie").ToString = "", "-1", Dr("Serie").ToString), Lote:=If(Dr("Lote").ToString = "", "-1", Dr("Lote").ToString)) >= Dr("Cantidad").ToString.ToDouble Then
Dim FechaMovtoExistenciaStr As String = $"{FechaMovimiento.ToString("yyyy/MM/dd")} {FechaMovimiento.ToString("hh:mm")}"
If ObjInventario.GetExistenciasPS(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, CveAlmacen:=DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=FechaMovtoExistenciaStr, Serie:=If(Dr("Serie").ToString = "", "-1", Dr("Serie").ToString), Lote:=If(Dr("Lote").ToString = "", "-1", Dr("Lote").ToString)) >= Dr("Cantidad").ToString.ToDouble Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Observaciones:=Dr("Observaciones").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario, CveCultivoCuadroDetalle:=Dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, ImporteConcepto, CveAF:=Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Observaciones:=Dr("Observaciones").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=Dr("FechaCaducidad").ToString.ToDate, CveUsuarioModifico:=UsuarioActual.CveUsuario, CveCultivoCuadroDetalle:=Dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then
Mensaje = "Error al Agregar los nuevos movimientos" Mensaje = "Error al Agregar los nuevos movimientos"
ErrorMovInv = True : Exit For ErrorMovInv = True : Exit For
@@ -1721,9 +1757,9 @@ Partial Class Inventarios_EntradasSalidas
End If End If
If CuentaCargoCOG > 0 AndAlso CuentaAbonoAlmacen > 0 Then If CuentaCargoCOG > 0 AndAlso CuentaAbonoAlmacen > 0 Then
If ObjContaAC.AddMovimiento(IDPoliza, CuentaCargoCOG, False, Importe, "", "", 0, TxtFecha.Text.ToDate, "") Then If ObjContaAC.AddMovimiento(IDPoliza, CuentaCargoCOG, False, Importe, "", "", 0, TxtFecha.Text.Replace(",", "").ToDate, "") Then
'actualizo el idcuenta del presupuesto 'actualizo el idcuenta del presupuesto
If Not ObjContaAC.AddMovimiento(IDPoliza, CuentaAbonoAlmacen, True, Importe, "", "", 0, TxtFecha.Text.ToDate, "") Then If Not ObjContaAC.AddMovimiento(IDPoliza, CuentaAbonoAlmacen, True, Importe, "", "", 0, TxtFecha.Text.Replace(",", "").ToDate, "") Then
ErrorAC = True ErrorAC = True
End If End If
Else Else
@@ -1759,7 +1795,7 @@ Partial Class Inventarios_EntradasSalidas
'GUARDAR 'GUARDAR
Else Else
Dim Fecha As Date = String.Format("{0} {1}", TxtFecha.Text.ToDate.ToString("yyyy/MM/dd"), TxtHora.Text).ToDate Dim Fecha As DateTime = FechaMovimiento
Dim CveCliente As Integer = CInt(IIf((DdlClientes.SelectedValue.ToEntero <= 0), -1, DdlClientes.SelectedValue.ToEntero)) Dim CveCliente As Integer = CInt(IIf((DdlClientes.SelectedValue.ToEntero <= 0), -1, DdlClientes.SelectedValue.ToEntero))
Dim CveClienteSucursal As Integer = CInt(IIf((DdlClientesSucursales.SelectedValue.ToEntero <= 0), -1, DdlClientesSucursales.SelectedValue.ToEntero)) Dim CveClienteSucursal As Integer = CInt(IIf((DdlClientesSucursales.SelectedValue.ToEntero <= 0), -1, DdlClientesSucursales.SelectedValue.ToEntero))
@@ -1785,7 +1821,7 @@ Partial Class Inventarios_EntradasSalidas
Dim TotalCantidad As Double = DtMovimientos.SUMD("Cantidad") Dim TotalCantidad As Double = DtMovimientos.SUMD("Cantidad")
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inv/ES", 53, 0, 0, 1, TxtFecha.Text.ToDate, obs, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3) Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inv/ES", 53, 0, 0, 1, TxtFecha.Text.Replace(",", "").ToDate, obs, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, CveTipoPoliza:=3)
CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, DdlConcepto.SelectedValue.ToEntero, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Guia:=TxtGuia.Text, Observaciones:=TxtObservaciones.Text, CvePersonal:=DdlPersonal.SelectedValue.ToEntero, Recibio:=TxtResponsable.Text.Trim, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, DepartamentoEntrega:=TxtDepartamentoEntrega.Text, PedidoContrato:=TxtPedidoContrato.Text, CveProveedor:=tCveProveedor, Modulo:="ES/1") CveMovimiento = ObjInventario.AddMovimiento(CveAlmacen, DdlConcepto.SelectedValue.ToEntero, 1, Fecha, tFolio, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, SubProyecto, ActivoFijo, Guia:=TxtGuia.Text, Observaciones:=TxtObservaciones.Text, CvePersonal:=DdlPersonal.SelectedValue.ToEntero, Recibio:=TxtResponsable.Text.Trim, CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal, DepartamentoEntrega:=TxtDepartamentoEntrega.Text, PedidoContrato:=TxtPedidoContrato.Text, CveProveedor:=tCveProveedor, Modulo:="ES/1")
@@ -1802,7 +1838,8 @@ Partial Class Inventarios_EntradasSalidas
If DdlConcepto.SelectedValue.Contiene({"3", "11", "13", "21", "30", "31"}) Then If DdlConcepto.SelectedValue.Contiene({"3", "11", "13", "21", "30", "31"}) Then
For Each Dr As DataRow In DtMovimientos.Rows For Each Dr As DataRow In DtMovimientos.Rows
Dim FechaCaducidadVal As Date = If(Dr("AplicaCaducidad").ToString = "True", Dr("FechaCaducidad").ToString.ToDate, MinFecha) Dim FechaCaducidadVal As Date = If(Dr("AplicaCaducidad").ToString = "True", Dr("FechaCaducidad").ToString.ToDate, MinFecha)
If ObjInventario.GetExistenciasPS(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=String.Format("{0} {1}", TxtFecha.Text.ToDate.ToString("yyyy/MM/dd"), TxtHora.Text), Serie:=If(Dr("Serie").ToString = "", "-1", Dr("Serie").ToString), Lote:=If(Dr("Lote").ToString = "", "-1", Dr("Lote").ToString), FechaCaducidad:=FechaCaducidadVal) >= Dr("Cantidad").ToString.ToDouble Then Dim FechaMovtoExistenciaStr As String = $"{FechaMovimiento.ToString("yyyy/MM/dd")} {FechaMovimiento.ToString("hh:mm")}"
If ObjInventario.GetExistenciasPS(Dr("CvePS").ToString.ToEntero, Dr("CveUM").ToString.ToEntero, UsuarioActual.CveEmpresa, DdlAlmacen.SelectedValue.ToEntero, FechaMovto:=FechaMovtoExistenciaStr, Serie:=If(Dr("Serie").ToString = "", "-1", Dr("Serie").ToString), Lote:=If(Dr("Lote").ToString = "", "-1", Dr("Lote").ToString), FechaCaducidad:=FechaCaducidadVal) >= Dr("Cantidad").ToString.ToDouble Then
If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Observaciones:=Dr("Observaciones").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=FechaCaducidadVal, CveUsuarioModifico:=UsuarioActual.CveUsuario, CveCultivoCuadroDetalle:=Dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then If Not ObjInventario.AddMovimientoDetalle(CveMovimiento, Dr("Cantidad").ToString.ToDouble, Dr("CveUM").ToString.ToEntero, Dr("CvePS").ToString.ToEntero, Dr("PU").ToString.ToDecimal, Dr("CveAF").ToString.ToEntero, CveSeccionAlmacen:=Dr("CveSeccionAlmacen").ToString.ToEntero, Serie:=Dr("Serie").ToString, Observaciones:=Dr("Observaciones").ToString, Lote:=Dr("Lote").ToString, FechaCaducidad:=FechaCaducidadVal, CveUsuarioModifico:=UsuarioActual.CveUsuario, CveCultivoCuadroDetalle:=Dr("CveCultivoCuadroDetalle").ToString.ToEntero) Then
Mensaje = "Error al guardar los movimientos" Mensaje = "Error al guardar los movimientos"
@@ -1841,7 +1878,7 @@ Partial Class Inventarios_EntradasSalidas
Else Else
For Each Dr As DataRow In DtMovimientos.Rows For Each Dr As DataRow In DtMovimientos.Rows
If DdlConcepto.SelectedValue.ToEntero = 2 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then If DdlConcepto.SelectedValue.ToEntero = 2 AndAlso DdlMoneda.SelectedValue.ToEntero = 2 Then
ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal ImporteConcepto = Dr("PU").ToString.ToDecimal * GlobalTipoCambio(TxtFecha.Text.Replace(",", "").ToDate).ToDecimal
Else Else
ImporteConcepto = Dr("PU").ToString.ToDecimal ImporteConcepto = Dr("PU").ToString.ToDecimal
End If End If
@@ -2008,7 +2045,7 @@ Partial Class Inventarios_EntradasSalidas
End If End If
AC.Dispose() AC.Dispose()
IDPoliza = ObjContaAC.AddPoliza(3, "Salida de Almacen", TotalPorDevengar, TotalPorDevengar, UsuarioActual.CveUsuario, TxtFecha.Text.ToDate) IDPoliza = ObjContaAC.AddPoliza(3, "Salida de Almacen", TotalPorDevengar, TotalPorDevengar, UsuarioActual.CveUsuario, TxtFecha.Text.Replace(",", "").ToDate)
If IDPoliza > 0 Then If IDPoliza > 0 Then
Dim CuentaCargoCOG As Integer Dim CuentaCargoCOG As Integer
@@ -2034,9 +2071,9 @@ Partial Class Inventarios_EntradasSalidas
If Importe > 0 Then If Importe > 0 Then
If CuentaCargoCOG > 0 AndAlso CuentaAbonoAlmacen > 0 Then If CuentaCargoCOG > 0 AndAlso CuentaAbonoAlmacen > 0 Then
If ObjContaAC.AddMovimiento(IDPoliza, CuentaCargoCOG, False, Importe, "", ConceptoRenglon, 0, TxtFecha.Text.ToDate, "") Then If ObjContaAC.AddMovimiento(IDPoliza, CuentaCargoCOG, False, Importe, "", ConceptoRenglon, 0, TxtFecha.Text.Replace(",", "").ToDate, "") Then
'actualizo el idcuenta del presupuesto 'actualizo el idcuenta del presupuesto
If Not ObjContaAC.AddMovimiento(IDPoliza, CuentaAbonoAlmacen, True, Importe, "", ConceptoRenglon, 0, TxtFecha.Text.ToDate, "") Then If Not ObjContaAC.AddMovimiento(IDPoliza, CuentaAbonoAlmacen, True, Importe, "", ConceptoRenglon, 0, TxtFecha.Text.Replace(",", "").ToDate, "") Then
ErrorAC = True ErrorAC = True
Mensaje = "No se pudo insertar movimiento en la poliza 2." Mensaje = "No se pudo insertar movimiento en la poliza 2."
End If End If
@@ -2252,7 +2289,7 @@ Partial Class Inventarios_EntradasSalidas
Dim ObjInv As New ClsInventarios Dim ObjInv As New ClsInventarios
If CveMovimiento <= 0 Then If CveMovimiento <= 0 Then
CveMovimiento = ObjInv.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, DdlConcepto.SelectedValue.ToEntero, 1, TxtFecha.Text.ToDate, TxtFolio.Text.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Modulo:="ES/CS1") CveMovimiento = ObjInv.AddMovimiento(DdlAlmacen.SelectedValue.ToEntero, DdlConcepto.SelectedValue.ToEntero, 1, TxtFecha.Text.Replace(",", "").ToDate, TxtFolio.Text.ToEntero, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, Modulo:="ES/CS1")
End If End If
ObjInv.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, CostoPromedio, -1, Serie:=SerieLote) ObjInv.AddMovimientoDetalle(CveMovimiento, Cantidad, CveUM, CvePS, CostoPromedio, -1, Serie:=SerieLote)
@@ -2966,7 +3003,7 @@ Partial Class Inventarios_EntradasSalidas
Dim ErrorAC As Boolean = False Dim ErrorAC As Boolean = False
Dim TotalPorDevengar As Double = 0 Dim TotalPorDevengar As Double = 0
Dim Folio As String = "" Dim Folio As String = ""
Dim Fecha As Date = TxtFecha.Text.ToDate Dim Fecha As Date = TxtFecha.Text.Replace(",", "").ToDate
'cuando tiene AC y es salida de almacen, se manda al gasto 'cuando tiene AC y es salida de almacen, se manda al gasto
@@ -3832,7 +3869,7 @@ Partial Class Inventarios_EntradasSalidas
If tmpCostos.Rows.Count > 0 Then If tmpCostos.Rows.Count > 0 Then
Dim Concepto As String = If(TxtObservaciones.Text = "", ConceptoPoliza, $" {TxtObservaciones.Text}") Dim Concepto As String = If(TxtObservaciones.Text = "", ConceptoPoliza, $" {TxtObservaciones.Text}")
Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inv_EntradaSalida", 74, DtCostos.SUM("Total"), DtCostos.SUM("Total"), 1, TxtFecha.Text.ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa) Dim CvePrePoliza As Integer = ObjConta.AddPrePolizas("Inv_EntradaSalida", 74, DtCostos.SUM("Total"), DtCostos.SUM("Total"), 1, TxtFecha.Text.Replace(",", "").ToDate, ConceptoPoliza, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa)
CvePrePolizaRegistrada = CvePrePoliza CvePrePolizaRegistrada = CvePrePoliza
If HplCompra.Visible AndAlso HplCompra.Text <> "" Then If HplCompra.Visible AndAlso HplCompra.Text <> "" Then
@@ -4078,7 +4115,7 @@ Partial Class Inventarios_EntradasSalidas
If DdlPS.SelectedValue.ToEntero > 0 Then If DdlPS.SelectedValue.ToEntero > 0 Then
Dim ObjInventario As New ClsInventarios Dim ObjInventario As New ClsInventarios
Dim CostoPromedio As Decimal = ObjInventario.GetCostoPS(DdlPS.SelectedValue.ToEntero, txtCantidad.Text.ToDouble, DdlAlmacenInventarioFisico.SelectedValue.ToEntero, "", TxtFecha.Text.ToDate) Dim CostoPromedio As Decimal = ObjInventario.GetCostoPS(DdlPS.SelectedValue.ToEntero, txtCantidad.Text.ToDouble, DdlAlmacenInventarioFisico.SelectedValue.ToEntero, "", TxtFecha.Text.Replace(",", "").ToDate)
'GlobalDTPS(UsuarioActual.CveEmpresa, DdlPS.SelectedValue.ToEntero).FiltroPrimeroValor("CostoPromedio", "").ToDecimal 'GlobalDTPS(UsuarioActual.CveEmpresa, DdlPS.SelectedValue.ToEntero).FiltroPrimeroValor("CostoPromedio", "").ToDecimal
If CostoPromedio > 0 Then If CostoPromedio > 0 Then
@@ -5437,7 +5474,7 @@ Partial Class Inventarios_EntradasSalidas
If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 Then If DtPSVirtual IsNot Nothing AndAlso DtPSVirtual.Rows.Count > 0 Then
CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, If(tOrigen > 0, 36, 37), 1, TxtFecha.text.todate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveMovimientoRelacionado:=CveMovimiento, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="ES/GV") CveMovimientoVirtual = ObjInventario.AddMovimiento(CveAlmacenVirtual, If(tOrigen > 0, 36, 37), 1, TxtFecha.Text.Replace(",", "").ToDate, -1, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, -1, -1, -1, -1, CveMovimientoRelacionado:=CveMovimiento, Observaciones:=TxtObservaciones.Text.Trim, Modulo:="ES/GV")
FolioVirtual = ObjInventario.Folio FolioVirtual = ObjInventario.Folio
For Each RowUsado As DataRow In DtPSVirtual.Rows For Each RowUsado As DataRow In DtPSVirtual.Rows