Edicion de remision en el punto de venta
This commit is contained in:
@@ -14,6 +14,7 @@ Imports System.Net
|
|||||||
Imports System.IO.Compression
|
Imports System.IO.Compression
|
||||||
Imports System.Text
|
Imports System.Text
|
||||||
Imports System.Net.Http
|
Imports System.Net.Http
|
||||||
|
Imports System.Collections.Generic
|
||||||
|
|
||||||
Namespace Modelos
|
Namespace Modelos
|
||||||
|
|
||||||
@@ -539,7 +540,64 @@ Namespace Modelos
|
|||||||
Public Property CveEstatus As Integer
|
Public Property CveEstatus As Integer
|
||||||
|
|
||||||
End Class
|
End Class
|
||||||
|
Public Function RegenerarPrePolizas(Optional TransaccionCompartida As SqlClient.SqlTransaction = Nothing, Optional ObjACTransac As ClsContPAQi = Nothing) As Boolean
|
||||||
|
Dim ErrorPrePolizas As Boolean = False
|
||||||
|
|
||||||
|
Dim ObjVentas As ClsVentas = Nothing
|
||||||
|
If TransaccionCompartida IsNot Nothing Then
|
||||||
|
ObjVentas = New ClsVentas(TransaccionCompartida)
|
||||||
|
Else
|
||||||
|
ObjVentas = New ClsVentas()
|
||||||
|
ObjVentas.IniciaTransacSQL()
|
||||||
|
End If
|
||||||
|
|
||||||
|
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
|
||||||
|
Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
|
||||||
|
Dim ObjEventos As New ClsOIEventos(ObjVentas.IniciaTransacSQL())
|
||||||
|
Dim ObjAC As ClsContPAQi = Nothing
|
||||||
|
|
||||||
|
If ObjACTransac Is Nothing Then
|
||||||
|
If UsuarioActual.Empresa.UsaAC Then
|
||||||
|
ObjAC = New ClsContPAQi(UsuarioActual.Empresa) : ObjAC.IniciaTransacSQL()
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
ObjAC = ObjACTransac
|
||||||
|
End If
|
||||||
|
|
||||||
|
ErrorPrePolizas = Not RegeneracionPolizas(Me, ObjVentas, ObjAC, ObjConta, ObjBancos, ObjEventos)
|
||||||
|
|
||||||
|
If TransaccionCompartida Is Nothing Then
|
||||||
|
ObjVentas.Commit()
|
||||||
|
ObjVentas.Dispose()
|
||||||
|
ObjBancos.Dispose()
|
||||||
|
ObjEventos.Dispose()
|
||||||
|
End If
|
||||||
|
|
||||||
|
If ObjACTransac Is Nothing Then
|
||||||
|
If ObjAC IsNot Nothing Then
|
||||||
|
ObjAC.Commit()
|
||||||
|
ObjAC.Dispose()
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
Return Not ErrorPrePolizas
|
||||||
|
End Function
|
||||||
|
Private Function RegeneracionPolizas(ObjFactura As Modelos.Factura, ByRef ObjVentas As ClsVentas, ByRef ObjAC As ClsContPAQi, ByRef ObjConta As ClsContabilidad, ObjBancos As ClsBancos, ObjEventos As ClsOIEventos) As Boolean
|
||||||
|
Dim ErrorPrePolizas As Boolean = False
|
||||||
|
|
||||||
|
'REMOVEMOS LOS CONCEPTOS DE LA PREPOLIZA
|
||||||
|
ErrorPrePolizas = Not ObjConta.RemovePrePolizasDetalle(ObjFactura.CvePrePoliza, -1, ObjFactura.CveVenta, 2)
|
||||||
|
|
||||||
|
'VUELVE A GENERAR LAS PREPOLIZAS
|
||||||
|
If Not ErrorPrePolizas Then
|
||||||
|
ErrorPrePolizas = ProcesoPrepolizas(ObjFactura, ObjConta, -1, ObjFactura.DtDetalle, ObjAC, ValorMultiplicador:=1, ObjBancos:=ObjBancos, ObjVentas:=ObjVentas, ObjEventos:=ObjEventos, DtRemisionesRelacionadas:=New DataTable, SeCancelaRemisionProceso:=False,
|
||||||
|
CancelarRemisiones:=False, ListaRemisionesCancelar:=New List(Of Integer))
|
||||||
|
End If
|
||||||
|
|
||||||
|
If Not ErrorPrePolizas Then ErrorPrePolizas = GuardarVentaImpuestosLocales(ObjFactura, ObjVentas, ObjConta, 1)
|
||||||
|
|
||||||
|
Return Not ErrorPrePolizas
|
||||||
|
End Function
|
||||||
Public Function EmitirFactura(Optional Timbrar As Boolean = True, Optional Transac As SqlClient.SqlTransaction = Nothing, Optional ObjContPaqTransac As ClsContPAQi = Nothing) As MMensajeFactura
|
Public Function EmitirFactura(Optional Timbrar As Boolean = True, Optional Transac As SqlClient.SqlTransaction = Nothing, Optional ObjContPaqTransac As ClsContPAQi = Nothing) As MMensajeFactura
|
||||||
Dim Retorno As New MMensajeFactura()
|
Dim Retorno As New MMensajeFactura()
|
||||||
|
|
||||||
@@ -1059,7 +1117,7 @@ Namespace Modelos
|
|||||||
Return Retorno
|
Return Retorno
|
||||||
End Function
|
End Function
|
||||||
|
|
||||||
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = true) As Byte()
|
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte()
|
||||||
Dim Url = New Uri(String.Format("http://{0}:{1}/Compras/PopUpVerFactura.aspx?P={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
|
Dim Url = New Uri(String.Format("http://{0}:{1}/Compras/PopUpVerFactura.aspx?P={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
|
||||||
Dim File As Byte() = Nothing
|
Dim File As Byte() = Nothing
|
||||||
Try
|
Try
|
||||||
|
|||||||
@@ -621,7 +621,8 @@
|
|||||||
<th runat="server" visible="false" id="nomostrar2"></th>
|
<th runat="server" visible="false" id="nomostrar2"></th>
|
||||||
</tr>
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
<asp:GridView ID="GvPS" GridLines="None" runat="server" data-tableheader="#tbps" ShowHeader="true" AutoGenerateColumns="False" DataKeyNames="Consec,CvePS,Total, IEPS, CveClasificacion,CveUM,CveProyecto,CveSubProyecto,TipoDocto,PS,Obs,Cantidad,PU,Descuento,IVA,CantidadInventario,CantidadFacturadaRem" CssClass="table table-striped table-advance table-hover Widthall Sortable mysmallbtn ScrollAD" Style="min-width: 980px;">
|
<asp:GridView ID="GvPS" GridLines="None" runat="server" data-tableheader="#tbps" ShowHeader="true" AutoGenerateColumns="False"
|
||||||
|
DataKeyNames="CveVentaDetalle,Consec,CvePS,Total, IEPS, CveClasificacion,CveUM,CveProyecto,CveSubProyecto,TipoDocto,PS,Obs,Cantidad,PU,Descuento,IVA,CantidadInventario,CantidadFacturadaRem,EsCargo" CssClass="table table-striped table-advance table-hover Widthall Sortable mysmallbtn ScrollAD" Style="min-width: 980px;">
|
||||||
<Columns>
|
<Columns>
|
||||||
<%--0--%>
|
<%--0--%>
|
||||||
<asp:TemplateField ItemStyle-Font-Size="6pt">
|
<asp:TemplateField ItemStyle-Font-Size="6pt">
|
||||||
@@ -1331,12 +1332,18 @@
|
|||||||
</div>
|
</div>
|
||||||
<div class="portlet-body formnombottom">
|
<div class="portlet-body formnombottom">
|
||||||
<table border="0" align="center">
|
<table border="0" align="center">
|
||||||
<tr>
|
<tr id="TrEmitir" runat="server">
|
||||||
<td>
|
<td>
|
||||||
<asp:Button ID="BtnEmitirImprimir" runat="server" Text="Emitir e Imprimir" Style="width: 170px; padding-right: 30px;" CssClass="btn btn-primary" ValidationGroup="GrpEmitirImprimir" />
|
<asp:Button ID="BtnEmitirImprimir" runat="server" Text="Emitir e Imprimir" Style="width: 170px; padding-right: 30px;" CssClass="btn btn-primary" ValidationGroup="GrpEmitirImprimir" />
|
||||||
<i class=" fa-print fa " style="margin-left: -30px; margin-top: 10px; color: white;"></i>
|
<i class=" fa-print fa " style="margin-left: -30px; margin-top: 10px; color: white;"></i>
|
||||||
</td>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
|
<tr>
|
||||||
|
<td>
|
||||||
|
<asp:Button ID="BtnEditarRemision" runat="server" Text="Actualizar Remision" CssClass="btn myventasbutton btn-primary" Visible="false" />
|
||||||
|
<asp:Button ID="BtnPermisoEditarRemision" runat="server" Text="Editar Remision" CssClass="btn myventasbutton btn-primary" Visible="false" />
|
||||||
|
</td>
|
||||||
|
</tr>
|
||||||
</table>
|
</table>
|
||||||
</div>
|
</div>
|
||||||
</ContentTemplate>
|
</ContentTemplate>
|
||||||
@@ -2827,8 +2834,7 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-9">
|
<div class="col-md-9">
|
||||||
<div class="form-group form-md-line-input input-iconright">
|
<div class="form-group form-md-line-input input-iconright">
|
||||||
<ADS:DropDownLost ID="DdlPSAjuste" CssStyle="width: 100%;" CssClass=" form-control input-sm DdlPS" IncluyeTodos="false" CssClassDdl="select2me form-control" runat="server" CausesValidation="true" DataTextField="PSCodigo" DataValueField="CvePS" Onselectedindexchange="DdlPSAjuste_selectedindexchange" >
|
<ADS:Dropdownlost ID="DdlPSAjuste" CssStyle="width: 100%;" CssClass=" form-control input-sm DdlPS" IncluyeTodos="false" CssClassDdl="select2me form-control" runat="server" CausesValidation="true" DataTextField="PSCodigo" DataValueField="CvePS" Onselectedindexchange="DdlPSAjuste_selectedindexchange"></ADS:Dropdownlost>
|
||||||
</ADS:DropDownLost>
|
|
||||||
<asp:HiddenField ID="HdnPSAjusteMarca" ClientIDMode="Static" runat="server" Value="-1" />
|
<asp:HiddenField ID="HdnPSAjusteMarca" ClientIDMode="Static" runat="server" Value="-1" />
|
||||||
<asp:HiddenField ID="HdnPSAjusteClasificacion" ClientIDMode="Static" runat="server" Value="-1" />
|
<asp:HiddenField ID="HdnPSAjusteClasificacion" ClientIDMode="Static" runat="server" Value="-1" />
|
||||||
<label for="<%= DdlPSAjuste.ClientID.ToString()%>">Producto/Servicio a Recibir:</label>
|
<label for="<%= DdlPSAjuste.ClientID.ToString()%>">Producto/Servicio a Recibir:</label>
|
||||||
@@ -2876,7 +2882,7 @@
|
|||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<div id="DivCodEnsamble" runat="server" class="form-group form-md-line-input input-iconright">
|
<div id="DivCodEnsamble" runat="server" class="form-group form-md-line-input input-iconright">
|
||||||
<asp:TextBox ID="TxtCodEnsamble" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
|
<asp:TextBox ID="TxtCodEnsamble" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
|
||||||
<asp:CustomValidator id="CVCodEnsamble" runat="server" ControlToValidate="TxtCodEnsamble" ClientValidationFunction="ValidarCodigoEnsamble" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Ensamble''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
|
<asp:CustomValidator ID="CVCodEnsamble" runat="server" ControlToValidate="TxtCodEnsamble" ClientValidationFunction="ValidarCodigoEnsamble" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Ensamble''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
|
||||||
<label for="<%= TxtCodEnsamble.ClientID.ToString()%>">Cod.Ensamble:</label>
|
<label for="<%= TxtCodEnsamble.ClientID.ToString()%>">Cod.Ensamble:</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2895,7 +2901,7 @@
|
|||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<div class="form-group form-md-line-input input-iconright">
|
<div class="form-group form-md-line-input input-iconright">
|
||||||
<asp:TextBox ID="TxtCodLinea" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
|
<asp:TextBox ID="TxtCodLinea" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
|
||||||
<asp:CustomValidator id="CVCodLinea" runat="server" ControlToValidate="TxtCodLinea" ClientValidationFunction="ValidarCodigoLinea" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Linea''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
|
<asp:CustomValidator ID="CVCodLinea" runat="server" ControlToValidate="TxtCodLinea" ClientValidationFunction="ValidarCodigoLinea" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Linea''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
|
||||||
<label for="<%= TxtCodLinea.ClientID.ToString()%>">Cod.Linea:</label>
|
<label for="<%= TxtCodLinea.ClientID.ToString()%>">Cod.Linea:</label>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@@ -2917,7 +2923,7 @@
|
|||||||
<div class="col-md-8">
|
<div class="col-md-8">
|
||||||
<div class="form-group form-md-line-input input-iconright">
|
<div class="form-group form-md-line-input input-iconright">
|
||||||
<asp:TextBox ID="TxtCodInspeccion" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
|
<asp:TextBox ID="TxtCodInspeccion" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
|
||||||
<asp:CustomValidator id="CVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" ClientValidationFunction="ValidarCodigoInspeccion" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Inspección''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
|
<asp:CustomValidator ID="CVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" ClientValidationFunction="ValidarCodigoInspeccion" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod.Inspección''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" />
|
||||||
<%-- <asp:RegularExpressionValidator ID="REVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod. Inspección''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" ValidationExpression="^[A-L][0-9][1-9A-Z][A-HJ-M]$"></asp:RegularExpressionValidator>--%>
|
<%-- <asp:RegularExpressionValidator ID="REVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" CssClass="help-block errorimput" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod. Inspección''</b> es incorrecto, por favor ingréselo correctamente." ValidationGroup="GrpAddVenta" ValidationExpression="^[A-L][0-9][1-9A-Z][A-HJ-M]$"></asp:RegularExpressionValidator>--%>
|
||||||
<%--<asp:RequiredFieldValidator ID="RFVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod. Inspeccion''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%>
|
<%--<asp:RequiredFieldValidator ID="RFVCodInspeccion" runat="server" ControlToValidate="TxtCodInspeccion" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod. Inspeccion''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%>
|
||||||
<%--<ajax:ValidatorCalloutExtender ID="VCECodInspeccion" runat="server" HighlightCssClass="vco" TargetControlID="RFVCodInspeccion"></ajax:ValidatorCalloutExtender>--%>
|
<%--<ajax:ValidatorCalloutExtender ID="VCECodInspeccion" runat="server" HighlightCssClass="vco" TargetControlID="RFVCodInspeccion"></ajax:ValidatorCalloutExtender>--%>
|
||||||
|
|||||||
@@ -566,6 +566,14 @@ Partial Class PV
|
|||||||
ViewState("Index") = value
|
ViewState("Index") = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
Private Property CveVentaDetalle As Integer
|
||||||
|
Get
|
||||||
|
Return ViewState("CveVentaDetalle").ToString.ToEntero
|
||||||
|
End Get
|
||||||
|
Set(value As Integer)
|
||||||
|
ViewState("CveVentaDetalle") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
Private ReadOnly Property AplicarVentaFacturada As Boolean
|
Private ReadOnly Property AplicarVentaFacturada As Boolean
|
||||||
Get
|
Get
|
||||||
@@ -722,6 +730,14 @@ Partial Class PV
|
|||||||
ViewState("TmpDTMetodosPago") = value
|
ViewState("TmpDTMetodosPago") = value
|
||||||
End Set
|
End Set
|
||||||
End Property
|
End Property
|
||||||
|
Private Property DTBCIUsados As DataTable
|
||||||
|
Get
|
||||||
|
Return If(IsNothing(ViewState("DTBCIUsados")), Nothing, CType(ViewState("DTBCIUsados"), DataTable))
|
||||||
|
End Get
|
||||||
|
Set(value As DataTable)
|
||||||
|
ViewState("DTBCIUsados") = value
|
||||||
|
End Set
|
||||||
|
End Property
|
||||||
|
|
||||||
#End Region
|
#End Region
|
||||||
|
|
||||||
@@ -1002,6 +1018,7 @@ Partial Class PV
|
|||||||
ViewState("ClienteRetIVA") = 0
|
ViewState("ClienteRetIVA") = 0
|
||||||
ViewState("ClienteRetISR") = 0
|
ViewState("ClienteRetISR") = 0
|
||||||
ViewState("EnviarCorreoCliente") = False
|
ViewState("EnviarCorreoCliente") = False
|
||||||
|
CveVentaDetalle = -1
|
||||||
EstablecioFolio = False
|
EstablecioFolio = False
|
||||||
EstatusCliente = False
|
EstatusCliente = False
|
||||||
RemisionesLista = New List(Of Integer)
|
RemisionesLista = New List(Of Integer)
|
||||||
@@ -1112,6 +1129,12 @@ Partial Class PV
|
|||||||
HdnCveCliente.Value = "-1"
|
HdnCveCliente.Value = "-1"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
'CARGA VENTA
|
||||||
|
If Request("CveVenta") IsNot Nothing Then
|
||||||
|
ViewState("CveVenta") = Request("CveVenta").ToString().ToEntero()
|
||||||
|
CargaVenta()
|
||||||
|
End If
|
||||||
|
|
||||||
'CARGA PARA FACTURAR
|
'CARGA PARA FACTURAR
|
||||||
ViewState("CveRemision") = IfNull(Request("CveRemision").ToEntero, 0)
|
ViewState("CveRemision") = IfNull(Request("CveRemision").ToEntero, 0)
|
||||||
ViewState("CveCotizacion") = IfNull(Request("CveCotizacion").ToEntero, 0)
|
ViewState("CveCotizacion") = IfNull(Request("CveCotizacion").ToEntero, 0)
|
||||||
@@ -1191,6 +1214,650 @@ Partial Class PV
|
|||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
Private Function CargaVenta() As Boolean
|
||||||
|
Dim Retorno As Boolean = False
|
||||||
|
'CARGA PARA FACTURACION
|
||||||
|
Dim CveRemision As Integer = IfNull(ViewState("CveRemision"), 0).ToString.ToEntero
|
||||||
|
Dim CveCotizacion As Integer = IfNull(ViewState("CveCotizacion"), 0).ToString.ToEntero
|
||||||
|
Dim CveVenta As Integer = Me.CveVenta
|
||||||
|
CveVenta = If(CveRemision > 0, CveRemision, CveVenta)
|
||||||
|
CveVenta = If(CveCotizacion > 0, CveCotizacion, CveVenta)
|
||||||
|
CveVenta = If(CvePedido > 0, CvePedido, CveVenta)
|
||||||
|
Dim SerieFolioPadre As String
|
||||||
|
Dim ObjVentas As New ClsVentas()
|
||||||
|
Try
|
||||||
|
If ObjVentas.GetVenta(CveVenta, UsuarioActual.CveEmpresa) Then
|
||||||
|
|
||||||
|
If ObjVentas.DtResultados IsNot Nothing AndAlso ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||||
|
Dim DbRowVenta As DataRow = ObjVentas.DtResultados.Rows(0)
|
||||||
|
Dim CveCliente As Integer = DbRowVenta("CveCliente").ToString.ToEntero
|
||||||
|
|
||||||
|
Dim ObjUsados As New ClsVentas
|
||||||
|
Dim DtUsados As DataTable = Nothing
|
||||||
|
If ObjUsados.GetVentasUsados(CveVenta, DdlSubProyectoDatos.SelectedValue.ToEntero(), DbRowVenta("Fecha").ToString.ToDateTime, UsuarioActual.CveEmpresa) Then
|
||||||
|
DtUsados = ObjUsados.DtResultados
|
||||||
|
End If
|
||||||
|
ObjUsados.Dispose()
|
||||||
|
|
||||||
|
'Me.CveEstatusFacturaPadre = DbRowVenta("CveEstatusFacturaPadre").ToString.ToEntero
|
||||||
|
'CargaEncabezado
|
||||||
|
DdlTipoComprobante.SelectedValue = DbRowVenta("TipoDocto").ToString
|
||||||
|
|
||||||
|
'contado 0, credito 1, terminal 2
|
||||||
|
If ObjVentas.DtResultados(0)("CondicionesPago").ToString.ToEntero = 1 Then
|
||||||
|
RBLPago.SelectedValue = "1"
|
||||||
|
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
||||||
|
UPCondicionesPago.Update()
|
||||||
|
ElseIf ObjVentas.DtResultados(0)("CondicionesPago").ToString.ToEntero = 0 Then
|
||||||
|
RBLPago.SelectedValue = "2"
|
||||||
|
RBLPago.Items(0).Enabled = False
|
||||||
|
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
||||||
|
UPCondicionesPago.Update()
|
||||||
|
Else
|
||||||
|
DdlCuentasTerminal.SelectedValue = DbRowVenta("CveCuentaTerminal").ToString
|
||||||
|
RBLPago.SelectedValue = "3"
|
||||||
|
RBLPago.Items(0).Enabled = False
|
||||||
|
RBLPago_SelectedIndexChanged(Nothing, Nothing)
|
||||||
|
UPCondicionesPago.Update()
|
||||||
|
End If
|
||||||
|
|
||||||
|
'CargaDetalle
|
||||||
|
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
||||||
|
TmpDT = ObjVentas.DtResultados.Copy()
|
||||||
|
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("ConsecPSPadre", GetType(Integer))
|
||||||
|
GvPS.DataSource = TmpDT
|
||||||
|
GvPS.DataBind()
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
'ESCONDE ACCIONES
|
||||||
|
UpnTools.Update()
|
||||||
|
|
||||||
|
HdnCveCliente.Value = CveCliente.ToString
|
||||||
|
ViewState("CveCliente") = CveCliente
|
||||||
|
ViewState("CveEmpresaCRM") = DbRowVenta("CveEmpresaCRM").ToString.ToEntero
|
||||||
|
ViewState("CveAcercamientoCRM") = DbRowVenta("CveAcercamientoCRM").ToString.ToEntero
|
||||||
|
Entrega = DbRowVenta("Entrega").ToString
|
||||||
|
Vigencia = DbRowVenta("Vigencia").ToString.ToDate.ToShortDateString
|
||||||
|
HplSaldoAuxiliar.Text = DbRowVenta("Saldo").ToString.FormatoNumero(2)
|
||||||
|
If Not HplSaldoAuxiliar.Text.ToDouble > 0 Then
|
||||||
|
HplSaldoAuxiliar.Visible = False
|
||||||
|
End If
|
||||||
|
HdnPagado.Value = DbRowVenta("Pagado").ToString
|
||||||
|
TxtTotal.Text = DbRowVenta("Total").ToString.FormatoNumero(2)
|
||||||
|
HdnVentaSaldo.Value = (SaldoVenta).ToString
|
||||||
|
CvePrePoliza = DbRowVenta("CvePrePoliza").ToString.ToEntero
|
||||||
|
CveVentaFacturada = DbRowVenta("CveVentaFacturada").ToString.ToEntero
|
||||||
|
|
||||||
|
DdlMoneda.SelectedValue = DbRowVenta("CveMoneda").ToString
|
||||||
|
CambiaMoneda()
|
||||||
|
|
||||||
|
If CveCliente > 0 Then
|
||||||
|
CargaCliente(CveCliente, -1) 'Estatus activo, se requiere para cargar una factura en la que el cliente a sido eliminado
|
||||||
|
End If
|
||||||
|
|
||||||
|
ViewState("CveAlmacenTransitorio") = DbRowVenta("CveAlmacenTraspasoDestino").ToString.ToEntero
|
||||||
|
DevolucionAlmacen = DbRowVenta("EsDevolucionVenta").ToString.ToEntero
|
||||||
|
|
||||||
|
'sino esta cargada la información del metodo de pago que le corresponde, la recarga para que se le pueda asignar
|
||||||
|
If DdlMetodoPago33.SelectedValue <> DbRowVenta("CveMetodoPago33").ToString Then
|
||||||
|
CargaFormaPago(DbRowVenta("CveMetodoPago33").ToString.ToEntero)
|
||||||
|
End If
|
||||||
|
DdlMetodoPago33.SelectedValueExist(DbRowVenta("CveMetodoPago33").ToString)
|
||||||
|
DdlFormaPago33.SelectedValueExist(DbRowVenta("CveFormaPago33").ToString.ToEntero)
|
||||||
|
|
||||||
|
If DdlFormaPago33.SelectedValue <> DbRowVenta("CveFormaPago33").ToString And DbRowVenta("CveFormaPago33").ToString <> "" Then
|
||||||
|
'sino está seleccionada la asginada la debe de cargar
|
||||||
|
Dim Nombre As String = GlobalDTVtaFormaPago().FiltroPrimeroValor("FormaPagoSAT", String.Format("CveFormaPago={0}", DbRowVenta("CveFormaPago33")))
|
||||||
|
DdlFormaPago33.Items.Add(New ListItem(Nombre, DbRowVenta("CveFormaPago33").ToString))
|
||||||
|
DdlFormaPago33.SelectedValueExist(DbRowVenta("CveFormaPago33").ToString.ToEntero)
|
||||||
|
End If
|
||||||
|
|
||||||
|
DdlUsoCFDI.SelectedValueExist(DbRowVenta("CveUsoCFDI").ToString)
|
||||||
|
|
||||||
|
If DbRowVenta("CveTipoRelacion").ToString.ToEntero > 0 Then
|
||||||
|
TrTipoRelacion.Visible = True
|
||||||
|
DdlTiposRelacion.SelectedValueExist(DbRowVenta("CveTipoRelacion").ToString.ToEntero)
|
||||||
|
HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString
|
||||||
|
End If
|
||||||
|
|
||||||
|
ViewState("FolioFiscal") = DbRowVenta("FolioFiscal").ToString
|
||||||
|
LblSerie.Text = DbRowVenta("Serie").ToString
|
||||||
|
ViewState("Serie") = DbRowVenta("Serie").ToString
|
||||||
|
ViewState("Folio") = DbRowVenta("Folio").ToString.ToEntero
|
||||||
|
TxtFolio.Text = DbRowVenta("Folio").ToString
|
||||||
|
LblFolioFiscal.Text = DbRowVenta("FolioFiscal").ToString
|
||||||
|
TxtFecha.Text = DbRowVenta("Fecha").ToString
|
||||||
|
TxtSubTotal.Text = DbRowVenta("SubTotal").ToString.FormatoNumero(2)
|
||||||
|
LblDescuentos.Text = DbRowVenta("Descuento").ToString.FormatoNumero(2)
|
||||||
|
LblAmortizacion.Text = DbRowVenta("Amortizacion").ToString.FormatoNumero(2)
|
||||||
|
TxtSubTotal2.Text = (TxtSubTotal.Text.Replace(",", "").Trim.Trim.ToDouble - LblDescuentos.Text.Replace(",", "").Trim.Trim.ToDouble - LblAmortizacion.Text.Replace(",", "").Trim.Trim.ToDouble).FormatoNumero(2)
|
||||||
|
TxtIVA.Text = DbRowVenta("IVA").ToString.FormatoNumero(2)
|
||||||
|
TxtRetIVA.Text = DbRowVenta("RetIVA").ToString.FormatoNumero(2)
|
||||||
|
If TxtRetIVA.Text.ToDecimal() > 0 Then
|
||||||
|
TrRetIVA.Style.Add("display", "")
|
||||||
|
UsuarioActual.Empresa.MostrarRetIVA = True
|
||||||
|
If TmpDT IsNot Nothing Then
|
||||||
|
Dim PorcentajeRetIVA = (TmpDT.MAX("PorcentajeRetIVA").ToDecimal() * 100)
|
||||||
|
LblRetIVA.Text = PorcentajeRetIVA.FormatoNumero(2)
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
TxtRetISR.Text = DbRowVenta("RetISR").ToString.FormatoNumero(2)
|
||||||
|
TxtIEPS.Text = DbRowVenta("IEPS").ToString.FormatoNumero(2)
|
||||||
|
TrIEPS.Visible = TxtIEPS.Text.ToDouble > 0
|
||||||
|
TxtTotal.Text = DbRowVenta("Total").ToString.FormatoNumero(2)
|
||||||
|
HdnTotalVenta.Value = DbRowVenta("Total").ToString.FormatoNumero(2)
|
||||||
|
TxtMotivoDescuento.Text = DbRowVenta("MotivoDescuento").ToString
|
||||||
|
TxtObsFact.Text = DbRowVenta("Observaciones").ToString
|
||||||
|
LblUsuario.Text = DbRowVenta("Nombre").ToString
|
||||||
|
LblSeTimbro.Text = DbRowVenta("SeTimbro").ToString
|
||||||
|
LblMail.Text = DbRowVenta("EnvioMail").ToString
|
||||||
|
TxtFechaPago.Text = DbRowVenta("FechaVencimiento").ToString
|
||||||
|
TxtFechaVencimientoCotizacion.Text = Vigencia
|
||||||
|
HdnIVAOriginal.Value = TxtIVA.Text
|
||||||
|
DdlTiposRelacion.SelectedValueExist(DbRowVenta("CveTipoRelacion"))
|
||||||
|
|
||||||
|
If DbRowVenta("CveTipoRelacion").ToString.ToEntero > 0 Then
|
||||||
|
TrTipoRelacion2.Visible = True
|
||||||
|
LblTipoRelacion.Text = DbRowVenta("TipoRelacion").ToString
|
||||||
|
HdnFolioFiscalNC.Value = DbRowVenta("FolioFiscalPadre").ToString
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
'Envio Direccion
|
||||||
|
If DbRowVenta("CveDireccionEnvio").ToString.ToEntero > 0 AndAlso DbRowVenta("CveDireccionEnvio").ToString IsNot Nothing Then
|
||||||
|
ChkDireccionEnvio.Checked = True
|
||||||
|
DdlDireccionEnvio.SelectedValueExist(DbRowVenta("CveDireccionEnvio").ToString.ToEntero)
|
||||||
|
DdlDireccionEnvio.Enabled = False
|
||||||
|
ChkDireccionEnvio.Enabled = False
|
||||||
|
DdlDireccionEnvio.Visible = True
|
||||||
|
trDireccionEnvio.Visible = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
|
||||||
|
TxtTipoCambio.Text = DbRowVenta("TipoCambio").ToString
|
||||||
|
|
||||||
|
ViewState("SelloCancelacion") = DbRowVenta("SelloCancelacion").ToString
|
||||||
|
ViewState("FechaCancelacion") = DbRowVenta("FechaCancelacion").ToString.ToDateTime
|
||||||
|
TxtAtencionA.Text = DbRowVenta("AtencionA").ToString
|
||||||
|
TxtTelefonoGenerico.Text = DbRowVenta("TelefonoGenerico").ToString
|
||||||
|
CveVentaPadre = DbRowVenta("CveVentaPadre").ToString.ToEntero
|
||||||
|
SerieFolioPadre = DbRowVenta("SerieFolioPadre").ToString
|
||||||
|
|
||||||
|
If DdlVendedor.SelectedValue.ToEntero > 0 AndAlso Not UsuarioActual.TienePermisoProceso(161) Then
|
||||||
|
DdlVendedor.Enabled = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
If CveVentaPadre > 0 Then
|
||||||
|
If IsNothing(Request("CveDevolucion")) AndAlso IsNumeric(Request("CveDevolucion")) Then
|
||||||
|
DdlNCFactura.Visible = True
|
||||||
|
Else
|
||||||
|
DdlNCFactura.Visible = False
|
||||||
|
End If
|
||||||
|
trNCFactura.Visible = True
|
||||||
|
LblSerieFolioPadre.Visible = True
|
||||||
|
LblSerieFolioPadre.Text = String.Format("<a Class=""Texto"" href=""/Ventas/Ventas.aspx?CveVenta={0}"" target=""_blank"">{1}</a>", CveVentaPadre, SerieFolioPadre)
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
DdlSucursalCliente.SelectedValueExist(DbRowVenta("CveClienteSucursal").ToString)
|
||||||
|
|
||||||
|
If DdlSubProyectoDatos.Items.Count = 0 Then
|
||||||
|
DdlSubProyectoDatos.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
||||||
|
End If
|
||||||
|
DdlSubProyectoDatos.SelectedValueExistInsert(DbRowVenta("CveSubProyecto").ToString, DbRowVenta("SubProyecto").ToString)
|
||||||
|
CargarAlmacenes()
|
||||||
|
|
||||||
|
|
||||||
|
CargaClienteSucursal(DbRowVenta("CveClienteSucursal").ToString.ToEntero)
|
||||||
|
|
||||||
|
If DbRowVenta("CveContrato").ToString.ToEntero > 0 Then
|
||||||
|
CveContrato = DbRowVenta("CveContrato").ToString.ToEntero
|
||||||
|
End If
|
||||||
|
|
||||||
|
IdPoliza = DbRowVenta("IdPoliza").ToString.ToEntero
|
||||||
|
|
||||||
|
'Carga si es Contabilizada
|
||||||
|
If IdPoliza > 0 Then
|
||||||
|
HLContabilizada.Text = "Si"
|
||||||
|
HLContabilizada.NavigateUrl = $"/Contabilidad/RegPoliza.aspx?IdPoliza={DbRowVenta("IdPoliza")}"
|
||||||
|
trContabilizada.Visible = True
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
If DbRowVenta("IdPolizaCancelacion").ToString.ToEntero > 0 Then
|
||||||
|
HPLContaCancelacion.Text = "Cancelación"
|
||||||
|
HPLContaCancelacion.NavigateUrl = String.Format("/Contabilidad/RegPoliza.aspx?IdPoliza={0}", DbRowVenta("IdPolizaCancelacion"))
|
||||||
|
trContabilizada.Visible = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
'CARGA IMPUESTOS LOCALES
|
||||||
|
If ObjVentas.GetVentaImpuestosLocales(CveVenta) Then
|
||||||
|
If ObjVentas.DtResultados.Rows.Count > 0 Then
|
||||||
|
TrOtros.Visible = True
|
||||||
|
TmpDTImpuestos = ObjVentas.DtResultados
|
||||||
|
GvImpuestosLocales2.DataSource = ObjVentas.DtResultados
|
||||||
|
GvImpuestosLocales2.DataBind()
|
||||||
|
|
||||||
|
GvImpuestosLocales2.Enabled = False
|
||||||
|
GvImpuestosLocales2.Visible = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
DdlVendedor.SelectedValue = DbRowVenta("CveVendedor").ToString
|
||||||
|
DdlTipoComprobante.Enabled = False
|
||||||
|
'TxtDocto.Enabled = False
|
||||||
|
DeshabilitarEdicion()
|
||||||
|
|
||||||
|
'CargaLeyendasFiscales
|
||||||
|
ViewState("VentaFolio") = If(LblSerie.Text.Trim.Length = 0, TxtFolio.Text.Trim, LblSerie.Text.Trim & "-" & TxtFolio.Text.Trim)
|
||||||
|
|
||||||
|
CalculaTotalesVenta(False)
|
||||||
|
|
||||||
|
tdVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot")
|
||||||
|
tdFechaVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot")
|
||||||
|
|
||||||
|
If DbRowVenta("TipoDocto").ToString = "Rem" Then
|
||||||
|
|
||||||
|
For Each Gvr As GridViewRow In GvPS.Rows
|
||||||
|
Gvr.FCLinkButton("imgE").Visible = False
|
||||||
|
Gvr.FCLinkButton("imgD").Visible = False
|
||||||
|
Next
|
||||||
|
|
||||||
|
'ACTIVA BOTONERA | DEBE TENER CONCEPTOS PENDIENTES DE FACTURAR
|
||||||
|
If TmpDT.SUM("CantidadFacturadaRem") < TmpDT.SUM("Cantidad") Then
|
||||||
|
TrEmitir.Visible = False
|
||||||
|
BtnPermisoEditarRemision.Visible = True
|
||||||
|
'ACTIVA CONVERSION DE MONEDA
|
||||||
|
If DdlMoneda.SelectedValue.ToEntero = 1 Then
|
||||||
|
TrConversionDolares.Visible = True
|
||||||
|
ChkConvertirDolares.Enabled = True
|
||||||
|
TxtTipoCambioDlls.Enabled = True
|
||||||
|
Else
|
||||||
|
TrConversionTipoCambio.Visible = True
|
||||||
|
ChkConvertirDoctoPesos.Enabled = True
|
||||||
|
TxtTipoCambio.Enabled = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
|
If UsuarioActual.CveEmpresa = 48 Then
|
||||||
|
TxtFecha.AutoPostBack = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
UpPS.Update()
|
||||||
|
UpContado.Update()
|
||||||
|
UpEstatus.Update()
|
||||||
|
Retorno = True
|
||||||
|
|
||||||
|
Else
|
||||||
|
ViewState("CveVenta") = -1
|
||||||
|
Alert("El documento solicitado no existe, favor de revisar su búsqueda.", TipoMensaje.MsgAdvertencia)
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al cargar la venta", ex)
|
||||||
|
End Try
|
||||||
|
ObjVentas.Dispose()
|
||||||
|
Return Retorno
|
||||||
|
End Function
|
||||||
|
|
||||||
|
#Region "E D I T A R - R E M I S I O N"
|
||||||
|
Private Sub DeshabilitarEdicion()
|
||||||
|
'PORLET CLIENTE
|
||||||
|
'DESACTIVA CAMBIO DE CLIENTE
|
||||||
|
HlCliente.Attributes.Remove("class")
|
||||||
|
HlCliente.Attributes.Add("class", "Texto disabled")
|
||||||
|
TxtCodigo.ReadOnly = True
|
||||||
|
ChkEnviarFactura.Enabled = False
|
||||||
|
ChkDireccionEnvio.Enabled = False
|
||||||
|
TxtAtencionA.Enabled = False
|
||||||
|
TxtFechaVencimientoCotizacion.Enabled = False
|
||||||
|
|
||||||
|
TxtCantidad.Enabled = False
|
||||||
|
DdlClasificacion.Enabled = False
|
||||||
|
|
||||||
|
DdlPS.Enabled = False
|
||||||
|
TxtObsPS.Enabled = False
|
||||||
|
TxtPrecio.Enabled = False
|
||||||
|
ImgDescPU.Attributes.Clear()
|
||||||
|
ImgDescTotal.Attributes.Clear()
|
||||||
|
LbAgregar.Enabled = False
|
||||||
|
DdlCuentasTerminal.Enabled = False
|
||||||
|
|
||||||
|
For Each Row As GridViewRow In GvPS.Rows
|
||||||
|
Row.FCLiteral("LtlConsecutivo").Text = (Row.RowIndex + 1).ToString()
|
||||||
|
Next
|
||||||
|
GvPS.Columns(ColumnaEditar).HeaderText = ""
|
||||||
|
GvPS.Columns(ColumnaEliminar).HeaderText = ""
|
||||||
|
'GvPS.Columns(ColumnaEliminar).Visible = False
|
||||||
|
|
||||||
|
TxtObsFact.Enabled = False
|
||||||
|
TxtMotivoDescuento.Enabled = False
|
||||||
|
'GvLeyendasFiscales.Enabled = False
|
||||||
|
TxtSubTotal.ReadOnly = True
|
||||||
|
TxtIVA.ReadOnly = True
|
||||||
|
TxtRetIVA.ReadOnly = True
|
||||||
|
TxtRetISR.ReadOnly = True
|
||||||
|
TxtIEPS.ReadOnly = True
|
||||||
|
TxtTotal.ReadOnly = True
|
||||||
|
|
||||||
|
'Sección Detalle
|
||||||
|
DdlMoneda.Enabled = False
|
||||||
|
'DdlSucursalEjecucion.Enabled = False
|
||||||
|
'DdlSucursalCobranza.Enabled = False
|
||||||
|
DdlVendedor.Enabled = False
|
||||||
|
DdlSucursalCliente.Enabled = False
|
||||||
|
|
||||||
|
ChkConvertirDoctoPesos.Enabled = False
|
||||||
|
ChkConvertirDolares.Enabled = False
|
||||||
|
TxtTipoCambio.Enabled = False
|
||||||
|
TxtTipoCambioDlls.Enabled = False
|
||||||
|
|
||||||
|
'Condiciones de Pago
|
||||||
|
RBLPago.Enabled = False
|
||||||
|
DdlFormaPago33.Enabled = False
|
||||||
|
DdlUsoCFDI.Enabled = False
|
||||||
|
DdlMetodoPago33.Enabled = False
|
||||||
|
'TxtNumCtaPago.Enabled = False
|
||||||
|
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") Then
|
||||||
|
TxtFechaPago.ReadOnly = Not UsuarioActual.TienePermisoProceso(260)
|
||||||
|
Else
|
||||||
|
TxtFechaPago.ReadOnly = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
imgCalendario.Enabled = False
|
||||||
|
|
||||||
|
BtnEmitirImprimir.Visible = False
|
||||||
|
End Sub
|
||||||
|
Private Sub HabilitarEdicion()
|
||||||
|
TxtCodigo.ReadOnly = False
|
||||||
|
ChkEnviarFactura.Enabled = True
|
||||||
|
ChkDireccionEnvio.Enabled = True
|
||||||
|
TxtAtencionA.Enabled = True
|
||||||
|
TxtFechaVencimientoCotizacion.Enabled = True
|
||||||
|
|
||||||
|
TxtCantidad.Enabled = True
|
||||||
|
DdlClasificacion.Enabled = True
|
||||||
|
|
||||||
|
DdlPS.Enabled = True
|
||||||
|
TxtObsPS.Enabled = True
|
||||||
|
TxtPrecio.Enabled = True
|
||||||
|
ImgDescPU.Attributes.Clear()
|
||||||
|
ImgDescTotal.Attributes.Clear()
|
||||||
|
LbAgregar.Enabled = True
|
||||||
|
DdlCuentasTerminal.Enabled = True
|
||||||
|
|
||||||
|
For Each Row As GridViewRow In GvPS.Rows
|
||||||
|
Row.FCLiteral("LtlConsecutivo").Text = (Row.RowIndex + 1).ToString()
|
||||||
|
Next
|
||||||
|
GvPS.Columns(ColumnaEditar).HeaderText = ""
|
||||||
|
GvPS.Columns(ColumnaEliminar).HeaderText = ""
|
||||||
|
|
||||||
|
TxtObsFact.Enabled = True
|
||||||
|
TxtMotivoDescuento.Enabled = True
|
||||||
|
TxtSubTotal.ReadOnly = False
|
||||||
|
TxtIVA.ReadOnly = False
|
||||||
|
TxtRetIVA.ReadOnly = False
|
||||||
|
TxtRetISR.ReadOnly = False
|
||||||
|
TxtIEPS.ReadOnly = False
|
||||||
|
TxtTotal.ReadOnly = False
|
||||||
|
|
||||||
|
'Sección Detalle
|
||||||
|
DdlMoneda.Enabled = True
|
||||||
|
DdlVendedor.Enabled = True
|
||||||
|
DdlSucursalCliente.Enabled = True
|
||||||
|
|
||||||
|
ChkConvertirDoctoPesos.Enabled = True
|
||||||
|
ChkConvertirDolares.Enabled = True
|
||||||
|
TxtTipoCambio.Enabled = True
|
||||||
|
TxtTipoCambioDlls.Enabled = True
|
||||||
|
|
||||||
|
'Condiciones de Pago
|
||||||
|
RBLPago.Enabled = True
|
||||||
|
DdlFormaPago33.Enabled = True
|
||||||
|
DdlUsoCFDI.Enabled = True
|
||||||
|
DdlMetodoPago33.Enabled = True
|
||||||
|
|
||||||
|
If DdlTipoComprobante.SelectedValue.Contiene("Ing", "Ant", "Rem") Then
|
||||||
|
TxtFechaPago.ReadOnly = Not UsuarioActual.TienePermisoProceso(260)
|
||||||
|
Else
|
||||||
|
TxtFechaPago.ReadOnly = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
imgCalendario.Enabled = True
|
||||||
|
End Sub
|
||||||
|
Private Sub BtnPermisoEditarRemision_Click(sender As Object, e As EventArgs) Handles BtnPermisoEditarRemision.Click
|
||||||
|
HabilitarEdicion()
|
||||||
|
BtnPermisoEditarRemision.Visible = False
|
||||||
|
BtnEditarRemision.Visible = True
|
||||||
|
TxtObsFact.Enabled = True
|
||||||
|
DdlUsoCFDI.Enabled = True
|
||||||
|
DdlMetodoPago33.Enabled = True
|
||||||
|
DdlFormaPago33.Enabled = True
|
||||||
|
UPCondicionesPago.Update()
|
||||||
|
RBLPago.Enabled = True
|
||||||
|
|
||||||
|
ViewState("CveClienteAnterior") = CveCliente
|
||||||
|
|
||||||
|
'SI EL DETALLE NO TIENE MOVIMIENTOS DE INVENTARIO ES VISIBLE
|
||||||
|
Dim CantidadFacturadaRemision = 0.0
|
||||||
|
For Each Gvr As GridViewRow In GvPS.Rows
|
||||||
|
Gvr.FCLinkButton("imgE").Visible = Not Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True"
|
||||||
|
Gvr.FCLinkButton("imgD").Visible = Not Gvr.DataKey("CantidadInventario").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True"
|
||||||
|
CantidadFacturadaRemision += Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble
|
||||||
|
Next
|
||||||
|
|
||||||
|
'ACTIVA CAMBIO DE CLIENTE - SI NO TIENE NADA FACTURADO
|
||||||
|
If Not CantidadFacturadaRemision > 0 AndAlso UsuarioActual.TienePermisoProceso(284) Then
|
||||||
|
HlCliente.Attributes.Remove("class")
|
||||||
|
HlCliente.Attributes.Add("class", "Texto")
|
||||||
|
TxtCodigo.ReadOnly = False
|
||||||
|
End If
|
||||||
|
|
||||||
|
TxtCantidad.Enabled = True
|
||||||
|
DdlClasificacion.Enabled = True
|
||||||
|
DdlPS.Enabled = True
|
||||||
|
TxtObsPS.Enabled = True
|
||||||
|
TxtPrecio.Enabled = True
|
||||||
|
LbAgregar.Enabled = True
|
||||||
|
ImgDescTotal.Attributes.Add("onclick", "javascript:$('#ModalDescuento').modal(); $get('LblTitulo1').style.display = ''; $get('LblTitulo2').style.display = 'none'; $get('LblTituloTipo1').style.display = ''; $get('LblTituloTipo2').style.display = 'none'; $get('HdnTipoDescuento').value = '2'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = ''; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = 'none'; $get('BtnAplicarDescG').style.display = ''; $get('TrMotivoDescuento').style.display = '';")
|
||||||
|
LblSubTotal1.Text = TxtSubTotal.Text
|
||||||
|
LblAmort.Text = TxtSubTotal.Text
|
||||||
|
|
||||||
|
UpPS.Update()
|
||||||
|
UpCliente.Update()
|
||||||
|
UPObservaciones.Update()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
Private Sub BtnEditarRemision_Click(sender As Object, e As EventArgs) Handles BtnEditarRemision.Click
|
||||||
|
Dim OcurrioError As Boolean = False
|
||||||
|
|
||||||
|
CreaObjetosVenta()
|
||||||
|
|
||||||
|
Dim ObjVentas As New ClsVentas
|
||||||
|
ObjVentas.IniciaTransacSQL()
|
||||||
|
|
||||||
|
Dim ObjConta As New ClsContabilidad(ObjVentas.IniciaTransacSQL())
|
||||||
|
Dim ObjBancos As New ClsBancos(ObjVentas.IniciaTransacSQL())
|
||||||
|
Dim ObjCGame As New ClsCGame(ObjVentas.IniciaTransacSQL())
|
||||||
|
Dim ObjAC As ClsContPAQi = Nothing
|
||||||
|
|
||||||
|
Dim Moneda As Integer = DdlMoneda.SelectedValue.ToEntero
|
||||||
|
Dim TipoCambio As Double = TxtTipoCambio.Text.ToDouble
|
||||||
|
Try
|
||||||
|
'CONVERTIR REMISION - TIPO MONEDA -DOLARES A PESOS
|
||||||
|
If DdlMoneda.SelectedValue.ToEntero <> 2 AndAlso ChkConvertirDolares.Checked Then
|
||||||
|
|
||||||
|
For Each Row As DataRow In TmpDT.Rows
|
||||||
|
Row("PU") = Math.Round(Row("PU").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, 6)
|
||||||
|
Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
|
||||||
|
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
|
||||||
|
Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
|
||||||
|
Row("ImporteIEPS") = Math.Round(Row("ImporteIEPS").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
|
||||||
|
Row("ImporteIVA") = Math.Round(Row("ImporteIVA").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
|
||||||
|
Row("ImporteRetIVA") = Math.Round(Row("ImporteRetIVA").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
|
||||||
|
Row("ImporteRetISR") = Math.Round(Row("ImporteRetISR").ToString.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
|
||||||
|
Next
|
||||||
|
|
||||||
|
Dim ImpuestosLocales As Double = 0
|
||||||
|
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
|
||||||
|
If gvr.RowType = DataControlRowType.DataRow Then
|
||||||
|
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TxtTipoCambioDlls.Text.Trim.ToDecimal).FormatoNumero
|
||||||
|
ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero
|
||||||
|
LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero
|
||||||
|
LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal / TxtTipoCambioDlls.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero
|
||||||
|
TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero
|
||||||
|
TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero
|
||||||
|
TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero
|
||||||
|
TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero
|
||||||
|
TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero
|
||||||
|
|
||||||
|
TipoCambio = TxtTipoCambioDlls.Text.Trim.ToDecimal
|
||||||
|
Moneda = 2
|
||||||
|
End If
|
||||||
|
|
||||||
|
'CONVERTIR REMISION - TIPO MONEDA -PESO A DOLARES
|
||||||
|
If DdlMoneda.SelectedValue.ToEntero <> 1 AndAlso ChkConvertirDoctoPesos.Checked Then
|
||||||
|
Dim Importe As Decimal
|
||||||
|
Dim TCC As Decimal = TxtTipoCambio.Text.Trim.ToDecimal
|
||||||
|
For Each Row As DataRow In TmpDT.Rows
|
||||||
|
Row("PU") = Math.Round(Row("PU").ToString.ToDecimal * TCC, 6)
|
||||||
|
Row("Total") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
|
||||||
|
Row("TotalImporte") = Math.Round(Row("Cantidad").ToString.ToDecimal * Row("PU").ToString.ToDecimal, NumeroDecimales)
|
||||||
|
Row("Descuento") = Math.Round(Row("Descuento").ToString.ToDecimal * TCC, NumeroDecimales)
|
||||||
|
Importe = Row("Total").ToString.ToDecimal - Row("Descuento").ToString.ToDecimal
|
||||||
|
Row("ImporteIEPS") = Math.Round(Importe * Row("PorcentajeIEPS").ToString.ToDecimal, NumeroDecimales)
|
||||||
|
Row("ImporteIVA") = Math.Round(Importe * Row("PorcentajeIVA").ToString.ToDecimal, NumeroDecimales)
|
||||||
|
Row("ImporteRetIVA") = Math.Round(Importe * Row("PorcentajeRetIVA").ToString.ToDecimal, NumeroDecimales)
|
||||||
|
Row("ImporteRetISR") = Math.Round(Importe * Row("PorcentajeRetISR").ToString.ToDecimal, NumeroDecimales)
|
||||||
|
Next
|
||||||
|
|
||||||
|
Dim ImpuestosLocales As Double = 0
|
||||||
|
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
|
||||||
|
If gvr.RowType = DataControlRowType.DataRow Then
|
||||||
|
gvr.FCTextBox("TxtImpuestoLocalPS").Text = (gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TxtTipoCambio.Text.Trim.ToDecimal).FormatoNumero
|
||||||
|
ImpuestosLocales += Math.Round(gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDouble * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales)
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
|
||||||
|
TxtSubTotal.Text = TmpDT.SUM("Total").ToDecimal.FormatoNumero
|
||||||
|
LblDescuentos.Text = TmpDT.SUM("Descuento").ToDecimal.FormatoNumero
|
||||||
|
LblAmortizacion.Text = Math.Round(LblAmortizacion.Text.Trim.ToDecimal * TxtTipoCambio.Text.Trim.ToDecimal, NumeroDecimales).FormatoNumero
|
||||||
|
TxtIVA.Text = TmpDT.SUM("ImporteIVA").ToDecimal.FormatoNumero
|
||||||
|
TxtRetIVA.Text = TmpDT.SUM("ImporteRetIVA").ToDecimal.FormatoNumero
|
||||||
|
TxtRetISR.Text = TmpDT.SUM("ImporteRetISR").ToDecimal.FormatoNumero
|
||||||
|
TxtIEPS.Text = TmpDT.SUM("ImporteIEPS").ToDecimal.FormatoNumero
|
||||||
|
TxtTotal.Text = (TxtSubTotal.Text.ToDecimal - LblDescuentos.Text.ToDecimal - LblAmortizacion.Text.ToDecimal + TxtIVA.Text.ToDecimal + TxtIEPS.Text.ToDecimal - TxtRetIVA.Text.ToDecimal - TxtRetISR.Text.ToDecimal - ImpuestosLocales).ToDecimal.FormatoNumero
|
||||||
|
|
||||||
|
|
||||||
|
TipoCambio = 1
|
||||||
|
Moneda = 1
|
||||||
|
End If
|
||||||
|
|
||||||
|
'Actualizo los parametros de la venta
|
||||||
|
If Not ObjVentas.UpdateVentas(TxtSubTotal.Text.ToDecimal, LblDescuentos.Text.ToDecimal, TxtIVA.Text.ToDecimal, TxtIEPS.Text.ToDecimal, TxtTotal.Text.ToDecimal, Moneda, TipoCambio, TxtFecha.Text.Trim.ToDate, TxtObsFact.Text.Trim,
|
||||||
|
UsuarioActual.CveEmpresa, CveVenta, 0, 0,
|
||||||
|
Vigencia:=TxtFechaVencimientoCotizacion.Text.Trim.ToDate, CondicionesPago:=If(RBLPago.SelectedValue = "2", 0, 1),
|
||||||
|
PedidoContrato:="", AtencionA:=TxtAtencionA.Text.Trim, CveMetodoPago33:=DdlMetodoPago33.SelectedValue.ToEntero,
|
||||||
|
CveFormaPago33:=DdlFormaPago33.SelectedValue.ToEntero, TipoDocto:="Rem", CveCliente:=CveCliente, CveClienteSucursal:=CveClienteSucursal,
|
||||||
|
OrdenCompra:="", RetIVA:=TxtRetIVA.Text.ToDecimal, RetISR:=TxtRetISR.Text.ToDecimal, Kilometraje:=0) Then
|
||||||
|
OcurrioError = True
|
||||||
|
End If
|
||||||
|
|
||||||
|
'Cargo de nueva cuenta el detalle de Ventas (Conceptos)
|
||||||
|
If Not OcurrioError Then
|
||||||
|
Dim index As Integer = 0
|
||||||
|
For Each Row As DataRow In TmpDT.Rows
|
||||||
|
Dim CveVentaDetalle As Integer = Row("CveVentaDetalle").ToString.ToEntero()
|
||||||
|
If CveVentaDetalle > 0 Then
|
||||||
|
If Not ObjVentas.UpdateVentaDetalleRemision(Row("CveVentaDetalle").ToString.ToEntero, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDecimal, Row("PU").ToString.ToDecimal(), Row("ImporteIEPS").ToString.ToDecimal(), Row("Obs").ToString, UsuarioActual.CveUsuario) Then
|
||||||
|
OcurrioError = True
|
||||||
|
Exit For
|
||||||
|
End If
|
||||||
|
Else
|
||||||
|
If Not ObjVentas.AddVentaDetalle(CveVenta, Row("CvePS").ToString.ToEntero, Row("Cantidad").ToString.ToDouble, Row("CveUM").ToString.ToEntero,
|
||||||
|
Row("PU").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("ImporteIVA").ToString.ToDouble, Math.Round((Row("Total").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)) * (1 + Row("PorcentajeIVA").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)))), 6),
|
||||||
|
Row("Obs").ToString, Row("Descuento").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), Row("TipoDescuento").ToString.ToEntero, Row("CveSubProyecto").ToString.ToEntero, Row("CvePresupuestoIngreso").ToString.ToEntero, PorcentajeIVA:=Row("PorcentajeIVA").ToString.ToDecimal, IEPS:=Row("ImporteIEPS").ToString.ToDouble(If(ChkConvertirDoctoPesos.Checked, TxtTipoCambio.Text.ToDecimal, 1)), PorcentajeIEPS:=Row("PorcentajeIEPS").ToString.ToDouble, TiempoEntrega:=Row("TiempoEntrega").ToString,
|
||||||
|
CveVentaDetallePadre:=Row("CveVentaDetalle").ToString.ToEntero, CveContratoDetalle:=Row("CveContratoDetalle").ToString.ToEntero, CvePromocionDetalle:=If(DtPromociones IsNot Nothing, DtPromociones.FiltroPrimeroValor("CvePromocionDetalle", $"CvePS={Row("CvePS").ToString}").ToEntero, -1),
|
||||||
|
ImporteRetIVA:=Row("ImporteRetIVA").ToString.ToDouble, ImporteRetISR:=Row("ImporteRetISR").ToString.ToDouble, PorcentajeRetIVA:=Row("PorcentajeRetIVA").ToString.ToDouble, PorcentajeRetISR:=Row("PorcentajeRetISR").ToString.ToDouble, CuentaPredial:=Row("CuentaPredial").ToString) Then
|
||||||
|
OcurrioError = True
|
||||||
|
Exit For
|
||||||
|
Else
|
||||||
|
TmpDT.Rows(index)("CveVentaDetalle") = ObjVentas.CveVentaDetalle
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
index = index + 1
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
ObjFactura.DtDetalle = TmpDT
|
||||||
|
|
||||||
|
'ELIMINA LOS DETALLES
|
||||||
|
If Not OcurrioError Then
|
||||||
|
Dim DtEliminados As New DataTable
|
||||||
|
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
||||||
|
DtEliminados = ObjVentas.DtResultados.FiltraParametros("", "", {"CveVentaDetalle"})
|
||||||
|
For Each Dr1 As DataRow In DtEliminados.Rows
|
||||||
|
If TmpDT.FiltraParametros($"CveVentaDetalle = {Dr1("CveVentaDetalle")}").Rows.Count = 0 Then
|
||||||
|
If Not ObjVentas.RemoveVentasDetalle(CveVenta, Dr1("CveVentaDetalle").ToString.ToEntero) Then
|
||||||
|
OcurrioError = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
Else
|
||||||
|
OcurrioError = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
|
||||||
|
'OcurrioError = ProcesoPrepolizas(ObjConta, ObjFactura, -1, TmpDT, ObjAC, 1, ObjBancos, ObjVentas)
|
||||||
|
|
||||||
|
'Actualizo impuestos locales
|
||||||
|
If Not OcurrioError Then
|
||||||
|
For Each gvr As GridViewRow In GvImpuestosLocales2.Rows
|
||||||
|
If gvr.RowType = DataControlRowType.DataRow Then
|
||||||
|
If Not ObjVentas.UpdateVentaImpuestoLocales(CveVenta, gvr.DataKey("CveImpuestoLocal").ToString.ToEntero, gvr.FCTextBox("TxtImpuestoLocalPS").Text.ToDecimal) Then
|
||||||
|
OcurrioError = True
|
||||||
|
End If
|
||||||
|
End If
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
|
||||||
|
'REGENERAR LOS SALDOS
|
||||||
|
If Not OcurrioError Then
|
||||||
|
OcurrioError = Not ObjFactura.RegenerarPrePolizas(ObjVentas.IniciaTransacSQL(), ObjAC)
|
||||||
|
End If
|
||||||
|
|
||||||
|
Catch ex As Exception
|
||||||
|
OcurrioError = True
|
||||||
|
OnError("Ocurrió un error al actualizar la remisión", ex)
|
||||||
|
End Try
|
||||||
|
|
||||||
|
If OcurrioError Then
|
||||||
|
ObjVentas.RollBack()
|
||||||
|
Alert("Ocurrió un error al guardar los cambios. Por favor intente de nuevo.", TipoMensaje.MsgError)
|
||||||
|
Else
|
||||||
|
ObjVentas.Commit()
|
||||||
|
If ObjAC IsNot Nothing Then ObjAC.Commit()
|
||||||
|
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion, JSBtnAceptar:="BtnRefrescarPagina();")
|
||||||
|
End If
|
||||||
|
|
||||||
|
ObjVentas.Dispose()
|
||||||
|
ObjConta.Dispose()
|
||||||
|
ObjBancos.Dispose()
|
||||||
|
If ObjAC IsNot Nothing Then ObjAC.Dispose()
|
||||||
|
End Sub
|
||||||
|
|
||||||
|
#End Region
|
||||||
|
|
||||||
#Region "PUNTO DE VENTA"
|
#Region "PUNTO DE VENTA"
|
||||||
Private Sub CargaCorteCaja()
|
Private Sub CargaCorteCaja()
|
||||||
'Checar si hay un Turno Abierto
|
'Checar si hay un Turno Abierto
|
||||||
@@ -1474,9 +2141,17 @@ Partial Class PV
|
|||||||
|
|
||||||
'CargaDetalle
|
'CargaDetalle
|
||||||
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
If ObjVentas.GetVentaDetalle(CveVenta) Then
|
||||||
TmpDT = ObjVentas.DtResultados
|
TmpDT = ObjVentas.DtResultados.Copy()
|
||||||
GvPS.DataSource = ObjVentas.DtResultados
|
TmpDT.Columns.Add("EntregaDirecta", GetType(Integer))
|
||||||
|
TmpDT.Columns.Add("CveMovimientoDetallePedido", GetType(Integer))
|
||||||
|
|
||||||
|
GvPS.DataSource = TmpDT
|
||||||
GvPS.DataBind()
|
GvPS.DataBind()
|
||||||
|
|
||||||
|
For Each Gvr As GridViewRow In GvPS.Rows
|
||||||
|
Gvr.FCLinkButton("imgE").Visible = False
|
||||||
|
Gvr.FCLinkButton("imgD").Visible = False
|
||||||
|
Next
|
||||||
End If
|
End If
|
||||||
|
|
||||||
'Carga Totales
|
'Carga Totales
|
||||||
@@ -1706,6 +2381,9 @@ Partial Class PV
|
|||||||
CambiaSucursal()
|
CambiaSucursal()
|
||||||
UpParametros.Update()
|
UpParametros.Update()
|
||||||
End If
|
End If
|
||||||
|
Else
|
||||||
|
CargaFormatoSucursal()
|
||||||
|
UpParametros.Update()
|
||||||
End If
|
End If
|
||||||
|
|
||||||
If ObjCliente.GetSucursales(CveCliente) Then
|
If ObjCliente.GetSucursales(CveCliente) Then
|
||||||
@@ -2344,15 +3022,15 @@ Partial Class PV
|
|||||||
Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), If(Retorno.TieneError, "", Retorno.LigaPV))
|
Alert(Mensaje, If(Retorno.TieneError, TipoMensaje.MsgError, TipoMensaje.MsgInformacion), If(Retorno.TieneError, "", Retorno.LigaPV))
|
||||||
Next
|
Next
|
||||||
|
|
||||||
Dim facBytes = DescargarFactura(Retorno.CveVenta, UsuarioActual.CveEmpresa)
|
'Dim facBytes = DescargarFactura(Retorno.CveVenta, UsuarioActual.CveEmpresa)
|
||||||
ImprimirbytesPDF(facBytes, ObjFactura.SerieFolio)
|
'ImprimirbytesPDF(facBytes, ObjFactura.SerieFolio)
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
End Sub
|
End Sub
|
||||||
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte()
|
Private Function DescargarFactura(CveVenta As Integer, CveEmpresa As Integer, Optional GetBytes As Boolean = True) As Byte()
|
||||||
Dim Url = New Uri(String.Format("http://{0}:{1}/Compras/PopUpVerFactura.aspx?P={2}", HttpContext.Current.Request.Url.Host, HttpContext.Current.Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
|
Dim Url = New Uri(String.Format("{0}://{1}:{2}/Compras/PopUpVerFactura.aspx?P={3}", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, Encripta(String.Format("OP=VTA&CVEVENTA={0}&PAG=1&GUARDAR=1", CveVenta))))
|
||||||
Dim File As Byte() = Nothing
|
Dim File As Byte() = Nothing
|
||||||
Try
|
Try
|
||||||
Using httpClient = New HttpClient()
|
Using httpClient = New HttpClient()
|
||||||
@@ -2377,7 +3055,14 @@ Partial Class PV
|
|||||||
#Region "OBJETO VENTA"
|
#Region "OBJETO VENTA"
|
||||||
|
|
||||||
Private Sub CreaObjetosVenta(Optional VistaPrevia As Boolean = False)
|
Private Sub CreaObjetosVenta(Optional VistaPrevia As Boolean = False)
|
||||||
|
|
||||||
|
If Me.CveVenta > 0 Then
|
||||||
|
ObjFactura = New Modelos.Factura(UsuarioActual, CveVenta, UsuarioActual.CveEmpresa, EsCancelacion:=False)
|
||||||
|
Else
|
||||||
ObjFactura = New Modelos.Factura(UsuarioActual)
|
ObjFactura = New Modelos.Factura(UsuarioActual)
|
||||||
|
ObjFactura.CvePrePoliza = -1
|
||||||
|
End If
|
||||||
|
|
||||||
ObjFactura.CveUsuario = UsuarioActual.CveUsuario
|
ObjFactura.CveUsuario = UsuarioActual.CveUsuario
|
||||||
ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa
|
ObjFactura.CveEmpresa = UsuarioActual.CveEmpresa
|
||||||
ObjFactura.TipoCambio = TxtTipoCambio.Text.Trim.ToDecimal
|
ObjFactura.TipoCambio = TxtTipoCambio.Text.Trim.ToDecimal
|
||||||
@@ -2393,7 +3078,6 @@ Partial Class PV
|
|||||||
'ObjFactura.Folio = If(ExFolioFactura, FolioXML.ToEntero, -1)
|
'ObjFactura.Folio = If(ExFolioFactura, FolioXML.ToEntero, -1)
|
||||||
ObjFactura.Serie = If(VistaPrevia, "VistaPrevia", LblSerie.Text)
|
ObjFactura.Serie = If(VistaPrevia, "VistaPrevia", LblSerie.Text)
|
||||||
ObjFactura.Fecha = New Date(TxtFecha.Text.Trim.ToDate.Year, TxtFecha.Text.Trim.ToDate.Month, TxtFecha.Text.Trim.ToDate.Day, Now.Hour, Now.Minute, Now.Second)
|
ObjFactura.Fecha = New Date(TxtFecha.Text.Trim.ToDate.Year, TxtFecha.Text.Trim.ToDate.Month, TxtFecha.Text.Trim.ToDate.Day, Now.Hour, Now.Minute, Now.Second)
|
||||||
ObjFactura.CvePrePoliza = -1
|
|
||||||
ObjFactura.CveMetodoPago = DdlMetodoPago.SelectedValue.ToEntero
|
ObjFactura.CveMetodoPago = DdlMetodoPago.SelectedValue.ToEntero
|
||||||
ObjFactura.MetodoPago = DdlMetodoPago.SelectedItem.Text
|
ObjFactura.MetodoPago = DdlMetodoPago.SelectedItem.Text
|
||||||
ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {DdlMetodoPago.SelectedValue}")
|
ObjFactura.ClaveMetodoPagoSAT = GlobalDTMetodosPago.FiltroPrimeroValor("ClaveSAT", $"CveMetodoPago = {DdlMetodoPago.SelectedValue}")
|
||||||
@@ -2801,6 +3485,7 @@ Partial Class PV
|
|||||||
TxtDescuento.Text = FormatoNumero(0, 2)
|
TxtDescuento.Text = FormatoNumero(0, 2)
|
||||||
TxtPrecio.Text = ""
|
TxtPrecio.Text = ""
|
||||||
|
|
||||||
|
Try
|
||||||
If CvePSParametro > 0 Then
|
If CvePSParametro > 0 Then
|
||||||
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
|
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=CvePSParametro).FiltroPrimero("")
|
||||||
|
|
||||||
@@ -2868,7 +3553,7 @@ Partial Class PV
|
|||||||
LblTotalPS.Text = "0.00"
|
LblTotalPS.Text = "0.00"
|
||||||
End If
|
End If
|
||||||
|
|
||||||
HdnIVAPS.Value = If(drPS("IVA").ToString = "-1", ViewState("IVA"), drPS("IVA").ToString).ToString
|
HdnIVAPS.Value = If(drPS("IVA").ToString = "-1", SubProyectoPorcentajeIVA.ToString(), drPS("IVA").ToString).ToString
|
||||||
HdnIVARetAPS.Value = drPS("RetIVA").ToString
|
HdnIVARetAPS.Value = drPS("RetIVA").ToString
|
||||||
HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString
|
HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString
|
||||||
HdnCtaContable.Value = drPS("IdCtaContVentas").ToString
|
HdnCtaContable.Value = drPS("IdCtaContVentas").ToString
|
||||||
@@ -2906,6 +3591,9 @@ Partial Class PV
|
|||||||
DdlUnidadMedida.SelectedValue = "-1"
|
DdlUnidadMedida.SelectedValue = "-1"
|
||||||
DdlUnidadMedida.DataBind()
|
DdlUnidadMedida.DataBind()
|
||||||
End If
|
End If
|
||||||
|
Catch ex As Exception
|
||||||
|
OnError("Ocurrió un error al cambiar el producto", ex)
|
||||||
|
End Try
|
||||||
|
|
||||||
UpClasificacion.Update()
|
UpClasificacion.Update()
|
||||||
UpPS.Update()
|
UpPS.Update()
|
||||||
@@ -3339,6 +4027,7 @@ Partial Class PV
|
|||||||
Row = TmpDT.NewRow()
|
Row = TmpDT.NewRow()
|
||||||
ElseIf Modalidad = "U" Then
|
ElseIf Modalidad = "U" Then
|
||||||
Dim Contador As Integer = 0
|
Dim Contador As Integer = 0
|
||||||
|
If CveVentaDetalle <= 0 Then
|
||||||
For Each Dr As DataRow In TmpDT.Rows
|
For Each Dr As DataRow In TmpDT.Rows
|
||||||
If Dr("Consec").ToString.ToEntero = Index Then
|
If Dr("Consec").ToString.ToEntero = Index Then
|
||||||
Exit For
|
Exit For
|
||||||
@@ -3346,6 +4035,9 @@ Partial Class PV
|
|||||||
Contador = Contador + 1
|
Contador = Contador + 1
|
||||||
Next
|
Next
|
||||||
Row = TmpDT.Rows(Contador)
|
Row = TmpDT.Rows(Contador)
|
||||||
|
Else
|
||||||
|
Row = TmpDT.Select($"CveVentaDetalle={CveVentaDetalle}")(0)
|
||||||
|
End If
|
||||||
End If
|
End If
|
||||||
|
|
||||||
Dim TotalCalculableImpuestos As Decimal = 0
|
Dim TotalCalculableImpuestos As Decimal = 0
|
||||||
@@ -3738,6 +4430,8 @@ Partial Class PV
|
|||||||
Modalidad = "U"
|
Modalidad = "U"
|
||||||
Index = GvRow.DataKey("Consec").ToEntero
|
Index = GvRow.DataKey("Consec").ToEntero
|
||||||
ConsecutivoVenta = GvRow.DataKey("Consec").ToEntero
|
ConsecutivoVenta = GvRow.DataKey("Consec").ToEntero
|
||||||
|
CveVentaDetalle = GvRow.DataKey("CveVentaDetalle").ToEntero
|
||||||
|
|
||||||
LnkAgregarPS.Text = "Actualizar"
|
LnkAgregarPS.Text = "Actualizar"
|
||||||
DdlClasificacion.SelectedValueExist(GvRow.DataKey("CveClasificacion"))
|
DdlClasificacion.SelectedValueExist(GvRow.DataKey("CveClasificacion"))
|
||||||
CargaPS(DdlClasificacion.SelectedValue.ToEntero, DdlPS)
|
CargaPS(DdlClasificacion.SelectedValue.ToEntero, DdlPS)
|
||||||
@@ -3756,7 +4450,9 @@ Partial Class PV
|
|||||||
LblTotalPS.Text = GvRow.DataKey("Total")
|
LblTotalPS.Text = GvRow.DataKey("Total")
|
||||||
ChkAgregar.Checked = False
|
ChkAgregar.Checked = False
|
||||||
divagregrarotrops.Visible = False
|
divagregrarotrops.Visible = False
|
||||||
|
If CveVenta <= 0 Then
|
||||||
Ajuste()
|
Ajuste()
|
||||||
|
End If
|
||||||
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
|
AddPolizaVirtual(DdlPS.SelectedValue.ToEntero())
|
||||||
UpVenta.Update()
|
UpVenta.Update()
|
||||||
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"), "EdicionVenta")
|
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"), "EdicionVenta")
|
||||||
@@ -3771,19 +4467,28 @@ Partial Class PV
|
|||||||
LimpiaAgregar()
|
LimpiaAgregar()
|
||||||
UpVenta.Update()
|
UpVenta.Update()
|
||||||
Else
|
Else
|
||||||
|
If Me.CveVentaDetalle > 0 Then
|
||||||
|
For Each Gvr As GridViewRow In GvPS.Rows
|
||||||
|
Gvr.FCLinkButton("imgE").Visible = Not Gvr.DataKey("CantidadFacturadaRem").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True"
|
||||||
|
Gvr.FCLinkButton("imgD").Visible = Not Gvr.DataKey("CantidadInventario").ToString.ToDouble > 0 AndAlso Gvr.DataKey("EsCargo") = "True"
|
||||||
|
Next
|
||||||
|
End If
|
||||||
|
UpVenta.Update()
|
||||||
RegistraScript("$('#DivAddVenta').modal('hide');")
|
RegistraScript("$('#DivAddVenta').modal('hide');")
|
||||||
End If
|
End If
|
||||||
End If
|
End If
|
||||||
|
Me.CveVentaDetalle = -1
|
||||||
End Sub
|
End Sub
|
||||||
Private Function AgregarPS() As Boolean
|
Private Function AgregarPS() As Boolean
|
||||||
|
Dim CveVentaDetalle As Integer = Me.CveVentaDetalle
|
||||||
|
|
||||||
|
Dim EsCargo As Boolean = False
|
||||||
|
If CveVentaDetalle > 0 Then
|
||||||
|
EsCargo = CBool(TmpDT.FiltroPrimeroValor("EsCargo", $"CveVentaDetalle={CveVentaDetalle}"))
|
||||||
|
End If
|
||||||
|
|
||||||
'SELECCIONA EL PS DEPENDIENDO LA MODALIDAD (CODIGO BARRAS - DDL)
|
'SELECCIONA EL PS DEPENDIENDO LA MODALIDAD (CODIGO BARRAS - DDL)
|
||||||
Dim CvePS = -1
|
Dim CvePS = DdlPS.SelectedValue.ToEntero
|
||||||
'If DIVCod.Visible Then
|
|
||||||
' CvePS = HdnCvePS.Value.ToEntero
|
|
||||||
'Else
|
|
||||||
CvePS = DdlPS.SelectedValue.ToEntero
|
|
||||||
'End If
|
|
||||||
|
|
||||||
If ValidaAgregarPS(CvePS, DdlUnidadMedida.SelectedValue.ToEntero, TxtPrecio.Text.Trim.ToDouble, HdnTipoPS.Value.ToEntero, TxtCantidad.Text.ToDecimal) Then
|
If ValidaAgregarPS(CvePS, DdlUnidadMedida.SelectedValue.ToEntero, TxtPrecio.Text.Trim.ToDouble, HdnTipoPS.Value.ToEntero, TxtCantidad.Text.ToDecimal) Then
|
||||||
|
|
||||||
@@ -3799,17 +4504,19 @@ Partial Class PV
|
|||||||
Dim CveProyecto As Integer = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("CveProyecto").ToString.ToEntero
|
Dim CveProyecto As Integer = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("CveProyecto").ToString.ToEntero
|
||||||
Dim Proyecto As String = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("Proyecto").ToString
|
Dim Proyecto As String = GlobalDTSubProyectos(-1, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveEmpresa:=UsuarioActual.CveEmpresa).Rows(0)("Proyecto").ToString
|
||||||
|
|
||||||
|
|
||||||
Dim Consec = AgregarProductoServicio(TxtCantidad.Text.ToDecimal, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
|
Dim Consec = AgregarProductoServicio(TxtCantidad.Text.ToDecimal, DdlUnidadMedida.SelectedValue.ToEntero, DdlUnidadMedida.SelectedItem.Text, DdlClasificacion.SelectedValue.ToEntero, DdlClasificacion.SelectedItem.Text,
|
||||||
CvePS, "", TxtObsPS.Text.Trim, If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal), Descuento,
|
CvePS, "", TxtObsPS.Text.Trim, If(CvePSAmortizacion > 0, TxtPrecio.Text.Trim.ToDecimal * -1, TxtPrecio.Text.Trim.ToDecimal), Descuento,
|
||||||
CveProyecto, Proyecto, DdlSubProyectoDatos.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedItem.Text,
|
CveProyecto, Proyecto, DdlSubProyectoDatos.SelectedValue.ToEntero, DdlSubProyectoDatos.SelectedItem.Text,
|
||||||
SerieLote:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS)
|
SerieLote:="", TiempoEntrega:="", CuentaPredial:="", RegeneraIEPS:=ClienteDesglosaIEPS, CveVentaDetalle:=CveVentaDetalle, EsCargo:=EsCargo)
|
||||||
|
|
||||||
|
If CveVentaDetalle <= 0 AndAlso Not EsCargo Then
|
||||||
Dim ListaPSCargo = CalculaUsados(Consec)
|
Dim ListaPSCargo = CalculaUsados(Consec)
|
||||||
If ListaPSCargo.Count > 0 Then
|
If ListaPSCargo.Count > 0 Then
|
||||||
CalculaRecepcionUsados(GvRecepcionUsados, CvePS, ListaPSCargo)
|
CalculaRecepcionUsados(GvRecepcionUsados, CvePS, ListaPSCargo)
|
||||||
End If
|
End If
|
||||||
|
|
||||||
|
End If
|
||||||
|
|
||||||
Return True
|
Return True
|
||||||
Else
|
Else
|
||||||
Return False
|
Return False
|
||||||
@@ -5040,7 +5747,8 @@ Partial Class PV
|
|||||||
Private Sub CargaBCIAjuste()
|
Private Sub CargaBCIAjuste()
|
||||||
Dim ObjGral As New ClsGenerales
|
Dim ObjGral As New ClsGenerales
|
||||||
If ObjGral.BCIUsadoGet(UsuarioActual.CveEmpresa) Then
|
If ObjGral.BCIUsadoGet(UsuarioActual.CveEmpresa) Then
|
||||||
DdlBCIAjuste.DataSource = ObjGral.DtResultados
|
DTBCIUsados = ObjGral.DtResultados.Copy()
|
||||||
|
DdlBCIAjuste.DataSource = DTBCIUsados
|
||||||
End If
|
End If
|
||||||
ObjGral.Dispose()
|
ObjGral.Dispose()
|
||||||
DdlBCIAjuste.DataBind()
|
DdlBCIAjuste.DataBind()
|
||||||
@@ -5065,6 +5773,8 @@ Partial Class PV
|
|||||||
Dim DtTamanios = GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo > 0")
|
Dim DtTamanios = GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo > 0")
|
||||||
|
|
||||||
CargaModelos()
|
CargaModelos()
|
||||||
|
CargaBCIAjuste()
|
||||||
|
|
||||||
GvRecepcionUsados.DataSource = DtTamanios
|
GvRecepcionUsados.DataSource = DtTamanios
|
||||||
GvRecepcionUsadosModal.DataSource = DtTamanios
|
GvRecepcionUsadosModal.DataSource = DtTamanios
|
||||||
|
|
||||||
@@ -5073,13 +5783,13 @@ Partial Class PV
|
|||||||
DdlTipoUso.DataBind()
|
DdlTipoUso.DataBind()
|
||||||
DdlTipoDefecto.DataBind()
|
DdlTipoDefecto.DataBind()
|
||||||
DdlFacturas.DataBind()
|
DdlFacturas.DataBind()
|
||||||
|
|
||||||
GvRecepcionUsados.DataBind()
|
GvRecepcionUsados.DataBind()
|
||||||
GvRecepcionUsadosModal.DataBind()
|
GvRecepcionUsadosModal.DataBind()
|
||||||
|
|
||||||
CreaDTmpDTAjustes()
|
CreaDTmpDTAjustes()
|
||||||
CreaDTmpDTRecepcionUsados()
|
CreaDTmpDTRecepcionUsados()
|
||||||
CreaDTmpDTPolizaVirtual()
|
CreaDTmpDTPolizaVirtual()
|
||||||
CargaBCIAjuste()
|
|
||||||
DdlDistribuidor.setEsWebService(True)
|
DdlDistribuidor.setEsWebService(True)
|
||||||
DivChkAjuste.Visible = True
|
DivChkAjuste.Visible = True
|
||||||
End Sub
|
End Sub
|
||||||
@@ -5095,16 +5805,8 @@ Partial Class PV
|
|||||||
|
|
||||||
Protected Sub GvRecepcionUsados_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvRecepcionUsados.RowDataBound
|
Protected Sub GvRecepcionUsados_RowDataBound(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewRowEventArgs) Handles GvRecepcionUsados.RowDataBound
|
||||||
If e.Row.RowType = DataControlRowType.DataRow Then
|
If e.Row.RowType = DataControlRowType.DataRow Then
|
||||||
|
e.Row.FCDropDownList("DdlBCIUsado").DataSource = DTBCIUsados.FiltraParametros(String.Format("CveTamaño = {0}", e.Row.DataKey("CveTamaño")))
|
||||||
Dim ObjGral As New ClsGenerales
|
|
||||||
If ObjGral.BCIUsadoGet(UsuarioActual.CveEmpresa) Then
|
|
||||||
e.Row.FCDropDownList("DdlBCIUsado").DataSource = ObjGral.DtResultados.FiltraParametros(String.Format("CveTamaño = {0}", e.Row.DataKey("CveTamaño")))
|
|
||||||
End If
|
|
||||||
'DdlBCIUsado.Items.Insert(0, New ListItem("Seleccione", "-1"))
|
|
||||||
'DdlBCIUsado.SelectedValueExist(-1)
|
|
||||||
e.Row.FCDropDownList("DdlBCIUsado").DataBind()
|
e.Row.FCDropDownList("DdlBCIUsado").DataBind()
|
||||||
'e.Row.FCDropDownList("DdlBCIUsado").SelectedValue = e.Row.DBCampo("CveBCIUsado")
|
|
||||||
|
|
||||||
End If
|
End If
|
||||||
End Sub
|
End Sub
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user