--FIX existencias

--FIX validacion de pagos con devolucion
-- Aplicar motivo de devolucion
This commit is contained in:
2024-07-17 20:58:33 -07:00
parent 1ba2988430
commit b706dc9b2c
2 changed files with 65 additions and 7 deletions

View File

@@ -968,6 +968,11 @@
<asp:HyperLink runat="server" ID="HplPresupuesto" Target="_blank" Text="Ir a Presupuesto"></asp:HyperLink> <asp:HyperLink runat="server" ID="HplPresupuesto" Target="_blank" Text="Ir a Presupuesto"></asp:HyperLink>
</td> </td>
</tr> </tr>
<tr align="left" id="TrMotivoDev" runat="server" visible="false">
<td><b class="truncate">Motivo devolución:</b>&nbsp;</td>
<td>
<asp:Label ID="lblMotivoDev" runat="server"></asp:Label></td>
</tr>
</table> </table>
</div> </div>
@@ -7611,6 +7616,16 @@
</div> </div>
<div class="col-md-6"></div> <div class="col-md-6"></div>
</div> </div>
<div class="row" id="DivMotivoDevolucion" visible="false" runat="server">
<div class="col-md-2">
<label>Motivo:</label>
</div>
<div class="col-md-6">
<asp:DropDownList ID="DdlMotivoDevolucion" CssClass=" form-control input-sm select2me" runat="server" Width="100%" DataTextField="MotivoDevolucion" DataValueField="CveMotivoDevolucion">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" CssClass="help-block errorimput" Display="Dynamic" InitialValue="-1" ControlToValidate="DdlMotivoDevolucion" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Motivo''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAplicaDevolucion"></asp:RequiredFieldValidator>
</div>
</div>
<div class="row" style="margin-bottom: 10px;"> <div class="row" style="margin-bottom: 10px;">
<div class="text-right col-md-offset-8 col-md-4"> <div class="text-right col-md-offset-8 col-md-4">
<input type="text" id="TxtBusquedaDevolucion" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaDevolucion','{0}')", GvAplicaDevolucion.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" /> <input type="text" id="TxtBusquedaDevolucion" class="form-control input-sm" onkeyup="<%= String.Format("FiltrarTabla('TxtBusquedaDevolucion','{0}')", GvAplicaDevolucion.ClientID) %>" style="display: inline-block; margin-right: -20px; width: 150px;" />

View File

@@ -5284,6 +5284,8 @@ Partial Class Ventas
Trsaldo.Visible = True Trsaldo.Visible = True
HplSaldoAuxiliar.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta")) HplSaldoAuxiliar.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta"))
HplPagado.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta")) HplPagado.NavigateUrl = String.Format("/Contabilidad/PopUpAuxiliar.aspx?Tipo=CxCClientes&CveCliente={0}&CveVenta={1}&TB_iframe=true&height=550&width=920", DbRowVenta("CveCliente"), DbRowVenta("CveVenta"))
TrMotivoDev.Visible = True
lblMotivoDev.Text = DbRowVenta("MotivoDevolucion").ToString()
Case "Ped" Case "Ped"
DdlTipoComprobante.Items.Insert(0, New ListItem("Pedido", "Ped")) DdlTipoComprobante.Items.Insert(0, New ListItem("Pedido", "Ped"))
CvePedido = CveVenta CvePedido = CveVenta
@@ -5527,6 +5529,7 @@ Partial Class Ventas
TxtObsFact.Text = DbRowVenta("Observaciones").ToString() TxtObsFact.Text = DbRowVenta("Observaciones").ToString()
LblUsuario.Text = DbRowVenta("Nombre").ToString().SubStringADS(30) LblUsuario.Text = DbRowVenta("Nombre").ToString().SubStringADS(30)
LblFechaRegistro.Text = DbRowVenta("FechaIng").ToString().ToDate.ToShortDateString LblFechaRegistro.Text = DbRowVenta("FechaIng").ToString().ToDate.ToShortDateString
LblSeTimbro.Text = DbRowVenta("SeTimbro").ToString() LblSeTimbro.Text = DbRowVenta("SeTimbro").ToString()
LblMail.Text = DbRowVenta("EnvioMail").ToString() LblMail.Text = DbRowVenta("EnvioMail").ToString()
TxtFechaPago.Text = DbRowVenta("FechaVencimiento").ToString() TxtFechaPago.Text = DbRowVenta("FechaVencimiento").ToString()
@@ -8957,7 +8960,7 @@ Partial Class Ventas
If ValidaExistencia AndAlso DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then If ValidaExistencia AndAlso DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then
'VALIDA EXISTENCIA 'VALIDA EXISTENCIA
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153}) Then If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 140, 153, 190, 192, 197}) Then
'SI ES VENTA NUEVA TOMA EN CUENTA LO DEL TMPDT 'SI ES VENTA NUEVA TOMA EN CUENTA LO DEL TMPDT
If CveVenta <= 0 Then If CveVenta <= 0 Then
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < TxtCantidad.Text.ToDouble Then
@@ -14008,6 +14011,11 @@ Partial Class Ventas
'CveAlmacenTraspasoDestino 'CveAlmacenTraspasoDestino
End If End If
Dim CveMotivoDevolucion As Integer = -1
If DdlMotivoDevolucion.SelectedValue.ToEntero() > 0 Then
CveMotivoDevolucion = DdlMotivoDevolucion.SelectedValue.ToEntero()
End If
If Not ObjVentas.AddVenta(factura.TipoDocto, factura.Folio, factura.CveCliente, factura.CveClienteSucursal, factura.SubTotalTC, factura.DescuentoTC, If Not ObjVentas.AddVenta(factura.TipoDocto, factura.Folio, factura.CveCliente, factura.CveClienteSucursal, factura.SubTotalTC, factura.DescuentoTC,
factura.AmortizacionTC, factura.IVATC, factura.RetIVATC, factura.RetISRTC, factura.AmortizacionTC, factura.IVATC, factura.RetIVATC, factura.RetISRTC,
@@ -14027,7 +14035,7 @@ Partial Class Ventas
FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia, ServicioDomicilio:=TrServicioDomicilio.Visible, FormaPaqueteria:=RblPaqueteria.SelectedValue.ToEntero, FacturarSucursal:=factura.FacturarSucursal, VentaDesglosaIEPS:=factura.VentaDesglosaIEPS, RFCReceptor:=RFCReceptor, Adjunto:=Adjunto, DevolucionImportePagado:=factura.DevolucionImportePagado, EsGarantia:=factura.EsGarantia, ServicioDomicilio:=TrServicioDomicilio.Visible,
CveLineaAdicional:=DdlLineaAdicional.SelectedValue.ToEntero(), DescripcionVenta:=DescripcionVenta, CveLineaAdicional:=DdlLineaAdicional.SelectedValue.ToEntero(), DescripcionVenta:=DescripcionVenta,
CveMedico:=CveMedico, CveProcedimiento:=CveProcedimiento, CveTipoVenta:=CveTipoVentaGuardar, RequiereOS:=ChkRequiereTecnico.Checked, FechaParaSurtir:=factura.FechaParaSurtir, CveMedico:=CveMedico, CveProcedimiento:=CveProcedimiento, CveTipoVenta:=CveTipoVentaGuardar, RequiereOS:=ChkRequiereTecnico.Checked, FechaParaSurtir:=factura.FechaParaSurtir,
Paciente:=TxtPaciente.Text, Episodio:=TxtEpisodio.Text) Then Paciente:=TxtPaciente.Text, Episodio:=TxtEpisodio.Text, CveMotivoDevolucion:=CveMotivoDevolucion) Then
ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico") ErrorList.Add("Ocurrió un error al Generar la Venta.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
Else Else
If factura.TipoDocto.Contiene("Dev", "Egs") OrElse DtVentasNC IsNot Nothing OrElse CveEstatusRefacturacion > 0 OrElse CveAnticipoPadre > 0 Then If factura.TipoDocto.Contiene("Dev", "Egs") OrElse DtVentasNC IsNot Nothing OrElse CveEstatusRefacturacion > 0 OrElse CveAnticipoPadre > 0 Then
@@ -18887,7 +18895,7 @@ Partial Class Ventas
If ValidaExistencia Then If ValidaExistencia Then
'VALIDA EXISTENCIA 'VALIDA EXISTENCIA
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153, 140, 186, 190}) Then If UsuarioActual.CveEmpresa.Contiene({72, 80, 119, 153, 140, 186, 190, 192, 197}) Then
Dim BuscarEnTabla As Boolean = If(UsuarioActual.Empresa.Funcionalidad(715) = "1", True, False) Dim BuscarEnTabla As Boolean = If(UsuarioActual.Empresa.Funcionalidad(715) = "1", True, False)
@@ -18899,7 +18907,14 @@ Partial Class Ventas
CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=0, PendientePorSurtir:=1, CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=0, PendientePorSurtir:=1,
RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla) RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla)
Else Else
Existencia = ObjInv2.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(),
Dim CveAlmacenConsulta As Integer = -1
If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso DivAlmacen.Visible Then
CveAlmacenConsulta = ddlAlmacen.SelectedValue.ToEntero()
End If
Existencia = ObjInv2.GetExistenciasPS(CvePS, CveUM, UsuarioActual.CveEmpresa, CveAlmacenConsulta, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero(),
CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, CveVendedor:=DdlVendedor.SelectedValue.ToEntero(), CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1,
RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla) RestringirAlmacenes:=1, ExcluyeApartados:=-1, BuscarEnTabla:=BuscarEnTabla)
End If End If
@@ -18907,7 +18922,19 @@ Partial Class Ventas
If CveVenta <= 0 OrElse Me.EsCreaApartirDe Then If CveVenta <= 0 OrElse Me.EsCreaApartirDe Then
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < (If(CantidadModal > 0, CantidadModal, TxtCantidad.Text.ToDouble)) Then If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS} AND (EntregaDirecta IS NULL OR EntregaDirecta < 1)") < (If(CantidadModal > 0, CantidadModal, TxtCantidad.Text.ToDouble)) Then
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
Dim CveAlmacenConsulta As Integer = -1
Dim StrAlmacen As New StringBuilder
If UsuarioActual.Empresa.Funcionalidad(567) = "1" AndAlso DivAlmacen.Visible Then
CveAlmacenConsulta = ddlAlmacen.SelectedValue.ToEntero()
If CveAlmacenConsulta > 0 Then
Dim Almacen As String = GlobalDTAlmacen(UsuarioActual.CveEmpresa, CveAlmacen:=CveAlmacenConsulta).FiltroPrimeroValor("Almacen")
StrAlmacen.AppendFormat("<br/>Almacén: {0}", Almacen)
End If
End If
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + "." + StrAlmacen.ToString(), TipoMensaje.MsgAdvertencia)
Return False Return False
End If End If
Else Else
@@ -24047,9 +24074,9 @@ Partial Class Ventas
Dim AmortizacionNC As Decimal = 0 Dim AmortizacionNC As Decimal = 0
'SI ES AMORTIZACION POR NOTA DE CREDITO DEBE SUMAR LA TOTALIDAD PARA COMPARAR EL PAGO 'SI ES AMORTIZACION POR NOTA DE CREDITO DEBE SUMAR LA TOTALIDAD PARA COMPARAR EL PAGO
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant") AndAlso DdlTipoAmortizacionAnticipo.SelectedValue.Contiene("2", "4") Then
For Each gvr As GridViewRow In GVAnticipos.Rows For Each gvr As GridViewRow In GVAnticipos.Rows
If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3) Then If gvr.FCCheckBox("Chk" & gvr.RowIndex) IsNot Nothing AndAlso gvr.FCCheckBox("Chk" & gvr.RowIndex).Checked AndAlso gvr.DataKey("CveConceptoContable").ToEntero().Contiene(3, 12) Then
AmortizacionNC += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal AmortizacionNC += gvr.FCTextBox(String.Format("TxtAnticipo{0}", gvr.RowIndex)).Text.ToDecimal
End If End If
Next Next
@@ -37387,6 +37414,22 @@ Partial Class Ventas
End If End If
If PuedeAplicarDevolucion Then If PuedeAplicarDevolucion Then
If UsuarioActual.Empresa.Funcionalidad(382) = "1" Then
DivMotivoDevolucion.Visible = True
Using ObjVenta As New ClsVentas
If ObjVenta.GetMotivoDevolucion(-1, 1, UsuarioActual.CveEmpresa) Then
DdlMotivoDevolucion.DataSource = ObjVenta.DtResultados.Copy()
End If
DdlMotivoDevolucion.DataBind()
DdlMotivoDevolucion.Items.Insert(0, New ListItem("Seleccione", "-1"))
End Using
UpDevolucion.Update()
End If
RegistraScript("$('#DivAplicaDevolucion').modal('show');") RegistraScript("$('#DivAplicaDevolucion').modal('show');")
End If End If