-- se quitó codigo de PyME

This commit is contained in:
2023-08-11 19:11:47 -07:00
parent 9bc6c4f940
commit 9f87b1eb6f
2 changed files with 12 additions and 832 deletions

View File

@@ -1333,7 +1333,6 @@
<ItemTemplate>
<asp:LinkButton ID="imgE" runat="server" AlternateText="Editar" CausesValidation="False" CommandName="Edit"
CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
<asp:LinkButton ID="ImgEPyME" Visible="false" runat="server" AlternateText="Editar" CausesValidation="False" CssClass="btn btn-circle btn-sm green" OnClick="Edit_Click" Text="<i class='fa fa-pencil'></i>" />
</ItemTemplate>
</asp:TemplateField>
<%--18--%>
@@ -6332,113 +6331,6 @@
</asp:UpdatePanel>
</div>
<div id="DivAddVenta" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<asp:UpdatePanel ID="UpVenta" class="modal-content rowpadding" tabindex="-1" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">&times;</span>
</button>
<h4 class="modal-title" id="myModalLabelVenta">Registrar Producto/Servicio</h4>
</div>
<div class="modal-body">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCantidadPyME" runat="server" ClientIDMode="Static" CssClass="form-control" CausesValidation="true"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender6" runat="server" TargetControlID="TxtCantidadPyME" FilterType=" Numbers" />
<asp:RequiredFieldValidator ID="RequiredFieldValidator9" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtCantidadPyME" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
<label for="<%= TxtCantidadPyME.ClientID.ToString()%>">Cantidad:</label>
</div>
<asp:UpdatePanel runat="server" ID="UpClasificacionPyME" UpdateMode="Conditional">
<ContentTemplate>
<div id="DivAddClasificacionPyME" runat="server" class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlClasificacionPyME" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Clasificacion" DataValueField="CveClasificacion" Width="50%">
<asp:ListItem Selected="True" Text="Seleccione la Clasificación (Todas)" Value="-1"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlClasificacionPyME.ClientID.ToString()%>">Clasificacion:</label>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group form-md-line-input input-iconright">
<label for="<%= DdlPSPyME.ClientID.ToString()%>">Producto/Servicio:</label>
<ADS:Dropdownlost runat="server" ID="DdlPSPyME" CssStyle="width: 100%;" CssClass=" form-control input-sm DdlPS" IncluyeTodos="false" CssClassDdl="select2me form-control" DataTextField="PSCodigo" DataValueField="CvePS" data-onresult="CargaExistenciaAlmacenes" />
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<br />
<div id="DivAddUMPyME" runat="server" class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlUMPyME" AppendDataBoundItems="true" CssClass="form-control input-sm select2me " runat="server" DataTextField="UnidadMedida" DataValueField="CveUnidadMedida" Style="width: 50%; max-width: 150px;"></asp:DropDownList>
<label for="<%= DdlUMPyME.ClientID.ToString()%>">Unidad de Medida:</label>
</div>
<br />
<div>
<label>Observación:</label>
<br />
<asp:TextBox ID="TxtObsPyME" runat="server" CssClass="form-control input-sm" Height="50" TextMode="MultiLine" CausesValidation="true" MaxLength="500"></asp:TextBox>
</div>
<div id="divproyectos" runat="server">
<asp:UpdatePanel ID="UPPProyecto" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div class="form-group form-md-line-input input-iconright" id="divProyectoPyME" runat="server">
<asp:Label ID="LblProyectoPyME" runat="server" for="<%= DdlProyectoPyME.ClientID.ToString()%>">Proyecto:</asp:Label>
<asp:DropDownList ID="DdlProyectoPyME" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Proyecto" DataValueField="CveProyecto" Width="50%">
<asp:ListItem Selected="true" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
</div>
<div class="form-group form-md-line-input input-iconright">
<asp:Label ID="LblSubProyectoPyME" runat="server" for="<%= DdlSubProyectoPyME.ClientID.ToString()%>">SubProyecto:</asp:Label>
<asp:DropDownList ID="DdlSubProyectoPyME" CssClass="form-control input-sm select2me" runat="server" DataTextField="SubProyecto" DataValueField="CveSubProyecto" Width="50%">
<asp:ListItem Selected="true" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPrecioPyME" runat="server" CausesValidation="true" lang="nb" ClientIDMode="Static" MaxLength="12" ValidationGroup="GrpAddVenta" CssClass="form-control"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender5" runat="server" TargetControlID="TxtPrecioPyME" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RequiredFieldValidator10" runat="server" CssClass="help-block errorimput" ControlToValidate="TxtPrecioPyME" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
<label for="<%= TxtPrecioPyME.ClientID.ToString()%>">Precio:</label>
</div>
</div>
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtDescuentoPyME" runat="server" Enabled="false" CausesValidation="true" lang="nb" ClientIDMode="Static" MaxLength="12" CssClass="form-control"></asp:TextBox>
<label for="<%= TxtDescuentoPyME.ClientID.ToString()%>">Descuento:</label>
</div>
</div>
</div>
<div class="form-group form-md-line-input input-iconright">
<div class="row">
<div class="col-md-6">
<asp:Label ID="LblTot" runat="server">Total: $</asp:Label>
<asp:Label ID="LblTotalPyME" runat="server" ClientIDMode="Static" Text="0.00"></asp:Label>
</div>
<div class="col-md-6" align="right" id="divagregrarotrops" runat="server">
<label>Agregar otro Producto:</label>
<asp:CheckBox ID="ChkAgregar" runat="server" Checked="true" />
</div>
</div>
</div>
</div>
<div class="modal-footer">
<asp:UpdatePanel ID="UpdatePanel2" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ClientIDMode="Static" ID="LnkAgregarPyME" runat="server" CssClass="btn btn-primary" Enabled="false" Text="Agregar" ValidationGroup="GrpAddVenta" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<asp:UpdatePanel UpdateMode="conditional" runat="server">
<ContentTemplate>
<asp:Button Text="text" ID="BtnReordenar" ClientIDMode="static" Style="display: none" runat="server" />

View File

@@ -74,15 +74,6 @@ Partial Class Ventas
End Set
End Property
Private Property idCuentaContabilizacion As Integer
Get
Return ViewState("idCuentaContabilizacion").ToString().ToEntero()
End Get
Set(value As Integer)
ViewState("idCuentaContabilizacion") = value
End Set
End Property
Private Property CuentasContablesInvalidas As StringBuilder
Get
Return CType(ViewState("CuentasContablesInvalidas"), StringBuilder)
@@ -2385,7 +2376,6 @@ Partial Class Ventas
Me.CveVendedorContrato = -1
Me.CveVendedorEmpresaCRM = -1
Me.EsGarantia = False
idCuentaContabilizacion = 1
CveEmpresaCRM = 0
CveAcercamientoCRM = 0
EstatusCliente = False
@@ -2553,8 +2543,6 @@ Partial Class Ventas
LblUsuario.Text = UsuarioActual.Usuario
LblFechaRegistro.Text = Now.ToShortDateString()
TxtPrecioPyME.Attributes.Add("onKeyUp ", "RecalculaPyME();")
TxtCantidadPyME.Attributes.Add("onKeyUp ", "RecalculaPyME();")
ImgDescPU.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 = '0'; $get('LblPrecio1').style.display = ''; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';")
ImgDescConcepto.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 = '1'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = ''; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';")
ImgDescTotal.Visible = False
@@ -2583,9 +2571,6 @@ Partial Class Ventas
TabAlmacen.Enabled = UsuarioActual.Empresa.UsaInventarios
TxtPorDescP.Attributes.Add("onKeyUp", "CalculaDescuento();")
TxtDescP.Attributes.Add("onKeyUp", "CalculaDescuento();")
TxtCantidadPyME.Attributes.Add("onkeypress", "cambiaFoco('TxtPrecioPyME')")
TxtObsPyME.Attributes.Add("onkeypress", "cambiaFoco('TxtPrecioPyME')")
TxtPrecioPyME.Attributes.Add("onkeypress", "CallServerMethod(event)")
CreaDTmpC()
CreaDTmpF()
@@ -2599,7 +2584,6 @@ Partial Class Ventas
CargaPS(-1, DdlPSMercancia)
CargaPS(-1, DdlPSFlete)
'CargaPSRemision(-1, DdlPSRemision)
CargaPSPyME(-1, DdlPSPyME)
CreaDTVentas()
CargaMetodosPago()
@@ -2648,11 +2632,6 @@ Partial Class Ventas
HdnCveCliente.Value = Request("CveCliente")
CargaCliente(CveCliente)
VerificarContrato(True)
ElseIf Request("CveFactura") IsNot Nothing AndAlso IsNumeric(Request("CveFactura")) AndAlso Request("CveFactura").ToEntero() > 0 AndAlso Request("CveCliente") IsNot Nothing AndAlso IsNumeric(Request("CveCliente")) AndAlso Request("CveCliente").ToEntero() > 0 Then
ViewState("CveCliente") = Request("CveCliente")
ViewState("CveFactura") = Request("CveFactura").ToEntero()
Dim RFC As String = CargaFactura(CveFactura)
CargaCliente(CveCliente)
Else
ViewState("CveCliente") = -1
HdnCveCliente.Value = "-1"
@@ -3213,10 +3192,7 @@ Partial Class Ventas
CargarCentrosDeCosto(DdlProyecto, DdlSubProyecto, LblProyectoHeader, LblSubProyecto, AplicaTodos:="")
DdlSubProyecto.SelectedValueExist(DdlSubProyectoDatos.SelectedValue)
CargarCentrosDeCosto(DdlProyectoPyME, DdlSubProyectoPyME, LblProyectoPyME, LblSubProyectoPyME, AplicaTodos:="")
DdlProyectoPyME.SelectedValueExist(DdlSubProyectoDatos.SelectedValue)
BrSubProyecto.Visible = DdlProyecto.Visible
divProyectoPyME.Visible = DdlProyecto.Visible
If UsuarioActual.CveEmpresa.Contiene(172, 173) Then
LnkAddVenta.Visible = True
@@ -3239,10 +3215,6 @@ Partial Class Ventas
Gvr.FCLinkButton("imgEPyME").Visible = True
Next
LnkAddVenta.Visible = True
divproyectos.Visible = False
DivAddClasificacionPyME.Visible = False
DivAddUMPyME.Visible = False
End If
If UsuarioActual.Empresa.CvePlataforma = 2 Then
@@ -3261,10 +3233,6 @@ Partial Class Ventas
Gvr.FCLinkButton("imgEPyME").Visible = True
Next
LnkAddVenta.Visible = True
divproyectos.Visible = False
DivAddClasificacionPyME.Visible = False
DivAddUMPyME.Visible = False
End If
TabVentaAF.Visible = (UsuarioActual.CveRol = 1)
@@ -5514,7 +5482,6 @@ Partial Class Ventas
ImgDescTotal.Attributes.Clear()
ImgDescConcepto.Attributes.Clear()
LbAgregar.Enabled = False
LnkAgregarPyME.Enabled = False
DdlCuentasTerminal.Enabled = False
For Each Row As GridViewRow In GvPS.Rows
@@ -6169,12 +6136,7 @@ Partial Class Ventas
DdlProyecto.DataSource = dtt
DdlProyecto.DataBind()
DdlProyectoPyME.DataSource = dtt
DdlProyectoPyME.DataBind()
CveSubProyecto = GetSubProyectoSucursal()
CargaSubProyecto(CveSubProyecto)
End Sub
@@ -6272,7 +6234,6 @@ Partial Class Ventas
If CveSubProyecto > 0 Then DdlSubProyecto.SelectedValueExist(CveSubProyecto)
End Sub
Private Sub CargaEmpresaCRM(CveEmpresaCRM As Integer)
Dim ObjCRM As New ClsCRM
If ObjCRM.GetEmpresasCRM(UsuarioActual.CveEmpresa, CveEmpresaCRM) Then
@@ -6317,12 +6278,8 @@ Partial Class Ventas
trCRM3.Visible = True
LblTituloPorletCliente.Text = "EMPRESA CRM"
tdTelefonoGen.Visible = False
tdTxtTelefonoGen.Visible = False
End If
Me.CveVendedorEmpresaCRM = ObjCRM.DtResultados.Rows(0)("CveVendedorAsignado").ToString().ToEntero()
@@ -6747,13 +6704,10 @@ Partial Class Ventas
tdVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot")
tdFechaVigencia.Visible = DdlTipoComprobante.SelectedValue.Contiene("Cot")
LbAgregar.Enabled = True
LnkAgregarPyME.Enabled = True
CargarAlmacenes()
CargaDocumentacionCliente()
If UsuarioActual.CveEmpresa.Contiene(72, 80, 1, 119) Then
@@ -7694,7 +7648,6 @@ Partial Class Ventas
Retorno = LimiteRestanteSucursal
PorcentajeCredito = PorcentajeSaldoSucursal
End If
Else
Retorno = ObjVentasAplciar.DtResultados(0)("LimiteRestanteCliente").ToString().ToDecimal
PorcentajeCredito = ObjVentasAplciar.DtResultados(0)("PorcentajeSaldoCliente").ToString().ToDecimal
@@ -7719,9 +7672,6 @@ Partial Class Ventas
DdlSubProyectoEjecucion.DataSource = dtt.FiltraParametros("EsSucursal = True ")
DdlSubProyectoEjecucion.DataBind()
DdlSubProyectoPyME.DataSource = dtt
DdlSubProyectoPyME.DataBind()
DdlSubProyectoFiltroAF.DataSource = dtt
DdlSubProyectoFiltroAF.DataBind()
DdlSubProyectoFiltroAF.Items.Insert(0, New ListItem("Todos", "-1"))
@@ -7731,14 +7681,11 @@ Partial Class Ventas
Private Sub CargaClasificaciones()
If UsuarioActual.Empresa.TipoContabilidad = 2 AndAlso UsuarioActual.Empresa.UsaAC Then
DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=1).FiltraParametros(" Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion")
DdlClasificacionPyME.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=1).FiltraParametros(" Codigo = '' OR Codigo IS NULL ", Orderby:="Clasificacion")
Else
DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa).FiltraParametros("UsoClasificacion IN (1,3) and Estado = 1", Orderby:="Clasificacion")
DdlClasificacionPyME.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa, UsoClasificacion:=1).FiltraParametros("", Orderby:="Clasificacion")
End If
'DdlClasificacion.DataSource = GlobalDTClasificaciones(UsuarioActual.CveEmpresa)
DdlClasificacion.DataBind()
DdlClasificacionPyME.DataBind()
End Sub
Private Sub CargaPS(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost, Optional AplicaParaVenta As Boolean = True)
@@ -10095,7 +10042,6 @@ Partial Class Ventas
If UsuarioActual.CveEmpresa = 140 Then
AutoConta = True
idCuentaContabilizacion = 10
End If
Try
@@ -13811,7 +13757,6 @@ Partial Class Ventas
Dim CveCuentaContabilizacion As Integer = 1
Dim tipoCambio As Decimal
Dim TCPago As Decimal = 1
Dim CuentasContablesInvalidasSIG As New StringBuilder
If ObjFactura.TipoDocto = "Ing" Or ObjFactura.TipoDocto = "Ant" Or ObjFactura.TipoDocto = "Com" Then
@@ -13863,6 +13808,11 @@ Partial Class Ventas
SeContabiliza = False
End If
Dim AutoConta As Boolean = UsuarioActual.Empresa.Funcionalidad(200) = "1"
If UsuarioActual.CveEmpresa = 119 AndAlso DdlTipoComprobante.SelectedValue.Contiene("Ant", "Rem", "RNC", "Cot", "Ped", "Pd2", "PA", "Egs", "Dev") Then
AutoConta = False
End If
Dim UsaComplementariaClientes As Boolean = True
If ObjConta.GetPlantillaConceptos(ObjFactura.CveEmpresa, CvePlantilaPoliza) Then
@@ -14156,7 +14106,7 @@ Partial Class Ventas
End If
Next
If Not ErrorPrepoliza AndAlso ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5) Then
If Not ErrorPrepoliza AndAlso ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 5, AutoConta:=AutoConta) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
'ErrorPrepoliza = True
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
@@ -14229,7 +14179,7 @@ Partial Class Ventas
End If
End If
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 2) Then
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 2, AutoConta:=AutoConta) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
GuardaLogAD($"Ventas/Ventas-ProcesoPrePolizas | Error:{ObjConta.MensajePolizaDescuadre} Diferencia:{ObjConta.ValorDiferencia} | CvePrePoliza:{ObjFactura.CvePrePoliza}", "LogPrePolizas")
End If
@@ -14970,7 +14920,7 @@ Partial Class Ventas
End If
End If
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 2) Then
If ObjConta.ValidacionPrePolizaCuadre(ObjFactura.CvePrePoliza, 2, AutoConta:=AutoConta) Then
If ObjConta.ValorPolizaDescuadre > 0 Then
If ObjConta.ValorPolizaDescuadre = 2 Then
ErrorPrepoliza = True
@@ -16406,7 +16356,7 @@ Partial Class Ventas
End Sub
Private Function AgregarPrePolizasXTrasladar(ObjConta As ClsContabilidad, CvePrePoliza As Integer, PorcentajeAmortizacion As Decimal, TipoCambio As Decimal, ByRef CuentasContablesInvalidas As StringBuilder, ByRef idCuentaContabilizacion As Integer, ByRef CveCuentaContabilizacion As Integer, Importe13 As Decimal, Importe8 As Decimal, Importe9 As Decimal) As Boolean
Private Function AgregarPrePolizasXTrasladar(ObjConta As ClsContabilidad, CvePrePoliza As Integer, PorcentajeAmortizacion As Decimal, TipoCambio As Decimal, ByRef CuentasContablesInvalidas As StringBuilder, ByRef CveCuentaContabilizacion As Integer, Importe13 As Decimal, Importe8 As Decimal, Importe9 As Decimal) As Boolean
Dim ImporteMovimiento As Decimal
Dim ImporteMX As Decimal
Dim FechaMovimiento As Date = Now
@@ -16446,7 +16396,7 @@ Partial Class Ventas
End Function
'Charlie
Private Function AgregarPrePolizasTrasladadas(ObjConta As ClsContabilidad, CvePrePoliza As Integer, PorcentajeAmortizacion As Decimal, TipoCambio As Decimal, ByRef CuentasContablesInvalidas As StringBuilder, ByRef idCuentaContabilizacion As Integer, Optional ByRef CuentasContablesInvalidasSIG As StringBuilder = Nothing, Optional ByRef CveCuentaContabilizacion As Integer = Nothing) As Boolean
Private Function AgregarPrePolizasTrasladadas(ObjConta As ClsContabilidad, CvePrePoliza As Integer, PorcentajeAmortizacion As Decimal, TipoCambio As Decimal, ByRef CuentasContablesInvalidas As StringBuilder, Optional ByRef CuentasContablesInvalidasSIG As StringBuilder = Nothing, Optional ByRef CveCuentaContabilizacion As Integer = Nothing) As Boolean
Dim ImporteMovimiento As Decimal
Dim ImporteMX As Decimal
@@ -17552,9 +17502,6 @@ Partial Class Ventas
DdlPS.Attributes.Remove("data-cvesubproyecto")
DdlPS.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue)
DdlPSPyME.Attributes.Remove("data-cvesubproyecto")
DdlPSPyME.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue)
UpPS.Update()
End Sub
Private Sub RecargaSucursalPartidas()
@@ -18375,50 +18322,6 @@ Partial Class Ventas
UPCondicionesPago.Update()
End Sub
Private Sub AgregarPSPYME()
If Modalidad = "A" Then
Dim CveProyecto As Integer = IIf(DdlProyectoPyME.SelectedValue <> "-1", DdlProyectoPyME.SelectedValue, "0").ToString().ToEntero()
Dim Proyecto As String = IIf(DdlProyectoPyME.SelectedValue <> "-1", DdlProyectoPyME.SelectedItem.Text, "").ToString()
Dim CveSubProyecto As Integer = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedValue, "0").ToString().ToEntero()
Dim SubProyecto As String = IIf(DdlSubProyectoPyME.SelectedValue <> "-1", DdlSubProyectoPyME.SelectedItem.Text, "").ToString()
Dim PU As Decimal = TxtPrecioPyME.Text.ToDecimal()
Dim Cantidad As Decimal = TxtCantidadPyME.Text.ToDecimal()
Dim CvePS As Integer = DdlPSPyME.SelectedValue.ToEntero()
Dim Descuento As Modelos.VentaDescuentos = CalcularDescuentos(CvePS, Cantidad, PU)
AgregarProductoServicio(Cantidad, DdlUMPyME.SelectedValue.ToEntero(), DdlUMPyME.SelectedItem.Text, DdlClasificacionPyME.SelectedValue.ToEntero(), DdlClasificacionPyME.SelectedItem.Text,
CvePS, DdlPSPyME.SelectedText, TxtObsPyME.Text, PU, Descuento.ImporteDescuento, CveProyecto, Proyecto, CveSubProyecto, SubProyecto)
CalculaUsados()
CalculaTotalesVenta()
ElseIf Modalidad = "U" Then
Dim ErrorEdit As Boolean = True
Dim Contador As Integer = 0
For Each row As DataRow In TmpDT.Rows
If row("Consec").ToString().ToEntero() = Index Then
ErrorEdit = False
Exit For
End If
Contador = Contador + 1
Next
If ErrorEdit = True Then
Exit Sub
Else
TmpDT.AcceptChanges()
TmpDT.Rows.RemoveAt(Contador)
TmpDT.AcceptChanges()
End If
End If
End Sub
Private Sub LimpiaAgregar()
TxtCantidad.Text = ""
TxtNumTurnos.Text = ""
@@ -19797,11 +19700,11 @@ Partial Class Ventas
If ObjClientes.GetClientes(-1, Nombre, Codigo, NombreCorto, RFC, Telefono, Mail, -1, UsuarioActual.CveEmpresa, TipoCliente:=-1) Then
If ObjClientes.DtResultados.Rows.Count > 0 Then
If UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 77 AndAlso Not ObjClientes.CveCliente.Contiene(10450, 10460, 10458) Then
TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : LnkAgregarPyME.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False
TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False
UpFacturar.Update()
Exit Sub
ElseIf UsuarioActual.CveEmpresa = 2 AndAlso UsuarioActual.CveUsuario = 21 AndAlso Not ObjClientes.CveCliente.Contiene(27448) Then
TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : LnkAgregarPyME.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False
TrEmitir.Visible = False : BtnCrearApartirDe.Enabled = False : LbAgregar.Enabled = False : BtnBuscarCliente.Enabled = False : BtnEmitirImprimir.Visible = False : TrVistaPrevia.Visible = False
UpFacturar.Update()
Exit Sub
Else
@@ -21578,7 +21481,6 @@ Partial Class Ventas
DdlSubProyecto.Enabled = True
TxtPrecio.Enabled = True
LbAgregar.Enabled = True
LnkAgregarPyME.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
@@ -23609,425 +23511,6 @@ Partial Class Ventas
#End Region
#Region "CargaFactura"
Private Function CargaFactura(CveFactura As Integer) As String
Dim RFC As String = ""
Dim XMLDoc As New XmlDocument
Dim Archivo As String = String.Format("{0}Ventas\{1}\{2}", UsuarioActual.Empresa.Ruta, Request("RFC"), $"{Request("CveFactura")}.xml")
If IO.File.Exists(Archivo) Then
Dim Validada As Boolean = True
LbAgregar.Visible = False
If Validada Then
XMLDoc.Load(Archivo)
CreaDTConceptos()
CargaConceptosXML(XMLDoc)
CargaComprobanteXML(XMLDoc)
Select Case TipoComprobante
Case "ingreso" : DdlTipoComprobante.SelectedValue = "Ing"
Case "egreso" : DdlTipoComprobante.SelectedValue = "Egs"
End Select
Dim Descuentos As Decimal = 0
RFC = ReceptorRFC
TxtFecha.Text = Fecha
TxtFolio.Text = FolioXML.ToString()
If (FolioXML <> "") Then
ViewState("ExFolioFactura") = True
End If
Dim IVA As Decimal
IVA = TrasladoIVA
If Not UsuarioActual.TienePermisoProceso(130) Then
TxtFolio.Enabled = False
End If
DdlTipoComprobante.Enabled = False
TxtFecha.Enabled = False
ImgFecha.Enabled = False
TxtSubTotal.Enabled = False
TxtSubTotal2.Enabled = False
TxtIVA.Enabled = False
'TxtTotal.Enabled = False
RegistraScript("SetDisabledTxtTotal(true);")
If TxtFolio.Text.Trim = "" Then TxtFolio.Enabled = True
TxtIVA.Text = IVA.FormatoNumero
TxtRetIVA.Text = RetencionIVA.FormatoNumero
LblDescuentos.Text = Descuentos.FormatoNumero
TxtFecha.Text = Fecha.ToDate.ToShortDateString
Dim Msg As String = ""
'PRUEBA
'http://rm/Compras/Compras.aspx?CveFactura=122518 Emp: 48
'tTotal = Math.Round(SubTotal2 + IVA - RetencionIVA - RetencionISR + IEPS + OtrosImpuestos, 2)
Dim AjustaUltimoConcepto = False
'en otro impuesto lo esta registrando en ajuste en automatico
If OtrosImpuestos > 0 Then
AjustaUltimoConcepto = True
End If
If RFC = "CFE370814QI0" Then ' RFC de CFE, se hace un ajuste por diferencia para sacar el DAP
'OtrosImpuestos = Total - (SubTotal2 + IVA)
'este importe lo vamos a meter al gasto
'AjustaImporteUltimoConcepto(OtrosImpuestos)
OtrosImpuestos = 1
AjustaUltimoConcepto = True
'SubTotal2 = SubTotal
End If
Dim SubTotalReal As Decimal = Math.Round(Total + RetencionISR + RetencionIVA - IVA + Descuentos, 2) ' NO se incluye otros impuestos para ajustar esa cifra
Dim DiferenciaTotales As Decimal = SubTotalReal - Math.Round(SubTotalConceptos, 2)
ViewState("Folio") = FolioXML
End If
Else
Alert("No se encontró la factura", TipoMensaje.MsgAdvertencia)
End If
'GvPS.DataSource = 'DTConceptos
'GvPS.DataBind()
Return RFC
End Function
Private Sub CreaDTConceptos()
DTConceptos = New DataTable
DTConceptos.Columns.Add("Consec", GetType(Integer))
DTConceptos.Columns.Add("Cantidad", GetType(Decimal))
DTConceptos.Columns.Add("UM", GetType(String))
DTConceptos.Columns.Add("CveClasificacion", GetType(Integer))
DTConceptos.Columns.Add("PS", GetType(String))
DTConceptos.Columns.Add("PU", GetType(Decimal))
DTConceptos.Columns.Add("Descuento", GetType(Decimal))
DTConceptos.Columns.Add("IVA", GetType(Decimal))
DTConceptos.Columns.Add("Total", GetType(Decimal))
End Sub
Private Sub CargaConceptosXML(XMLDoc As XmlDocument)
Dim i As Integer = 0
Dim node As XmlNode
Dim PU As Decimal = 0
Dim Descuento As Double = 0
Dim CveUM As Integer = 0
Dim UMM As String = "No Aplica"
Dim tCvePS As Integer = 0
Dim TipoPS As Integer = 0
Dim tCveClasif As Integer = -1
Dim Clasif As String = "Sin Clasificación"
Dim tPSCodigo As String = "-"
Dim tPSDescripcion As String = "-"
Dim PSS As String = ""
Dim Obs As String = ""
Dim SubTotalTemp = 0.0D
'GLOBALS
Dim DtUM = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa).AsEnumerable
Dim DtUMAlias = GlobalDTUnidadesMedidaAlias(UsuarioActual.CveEmpresa).AsEnumerable
'Dim DtPS = GlobalDTProductosServicios(UsuarioActual.CveEmpresa).AsEnumerable
Dim DtPS = GlobalDTPS(UsuarioActual.CveEmpresa).AsEnumerable
Dim DtPSAlias = GlobalDTProductosServiciosAlias(UsuarioActual.CveEmpresa).AsEnumerable
''AGREGA EN TABLA TEMPORAL
'Dim DtPSTemp = TmpDT.Clone
'Dim Row As DataRow = Nothing
For i = 0 To XMLDoc.DocumentElement.ChildNodes(2).ChildNodes.Count - 1
' INICIALIZA VALORES
PU = 0
Descuento = 0
CveUM = 0
UMM = "No Aplica"
tCvePS = 0
TipoPS = 0
tCveClasif = -1
Clasif = "Sin Clasificación"
tPSCodigo = "-"
tPSDescripcion = "-"
PSS = ""
Obs = ""
Total = 0
'CARGA NODO ACTUAL
node = XMLDoc.DocumentElement.ChildNodes(2).ChildNodes(i)
'CARGA PU
PU = ValorXML(node, "valorUnitario").ToDecimal
'SI PU >= TOTAL AND CANTIDAD > 0 : PU / CANTIDAD, por si tiene descuento en el importe y el valor unitario es mayor, lo ajusta
If ValorXML(node, "cantidad").ToDecimal > 0 AndAlso ValorXML(node, "valorUnitario").ToDecimal >= (ValorXML(node, "importe").ToDecimal / ValorXML(node, "cantidad").ToDecimal) Then
PU = ValorXML(node, "importe").ToDecimal / ValorXML(node, "cantidad").ToDecimal
End If
If ValorXML(node, "cantidad").ToDecimal > 0 AndAlso ValorXML(node, "valorUnitario").ToDouble <= 0 And ValorXML(node, "importe").ToDouble > 0 Then
PU = ValorXML(node, "importe").ToDecimal / ValorXML(node, "cantidad").ToDecimal
End If
'OBTIENE DESCUENTO
If ValorXML(node, "descuento") IsNot Nothing Then Descuento = ValorXML(node, "descuento").Trim.ToDouble
'OBTIENE TOTAL
If ValorXML(node, "importe") IsNot Nothing Then Total = ValorXML(node, "importe").Trim.ToDecimal
'OBTIENE SUBTOTAL
SubTotalTemp += If(Total > 0, Total, PU * ValorXML(node, "cantidad").ToDecimal)
'OBTIENE UM
If ValorXML(node, "unidad") IsNot Nothing Then UMM = ValorXML(node, "unidad").Trim
'BUSCA UM EN CATALOGO
UMM = UMM.ToUpper.Replace(".", "").Replace(",", "")
Dim fUM = (From u In DtUM
Where String.Compare(u!UnidadMedida.ToString().ToUpper.Trim, UMM, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0 OrElse
String.Compare(u!Abreviatura.ToString().ToUpper.Trim, UMM, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0
Select CveUnidadMedida = u!CveUnidadMedida, UnidadMedida = u!UnidadMedida).FirstOrDefault()
If fUM IsNot Nothing AndAlso fUM.CveUnidadMedida.ToString().ToEntero() > 0 Then
CveUM = fUM.CveUnidadMedida.ToString().ToEntero()
UMM = fUM.UnidadMedida.ToString()
Else
'BUSCA UM EN ALIAS
Dim fUMAlias = (From u In DtUMAlias
Where String.Compare(u!UnidadMedidaAlias.ToString().ToUpper.Trim, UMM, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0
Select u!CveUnidadMedida, u!UnidadMedida).FirstOrDefault()
If fUMAlias IsNot Nothing Then
CveUM = fUMAlias.CveUnidadMedida.ToString().ToEntero()
UMM = fUMAlias.UnidadMedida.ToString()
End If
End If
'se le puso una condicion de que ignorara los acentos, porque en la bd, marcaria error porque no distingue acentos
'CONCEPTO PRUEBA "TRABAJOS DE CONSTRUCCION", RM/Compras/Compras.aspx?CveFactura=13402&RFC=ECO061206QW7
'' u!PS.ToString().ToUpper.Trim = PSS
'BUSCA PS
PSS = ValorXML(node, "descripcion").ToUpper.Trim.Replace(vbCrLf, " ").Replace(vbLf, " ").Replace("'", "''").Replace(" ", " ")
If PSS.Length > 844 Then
PSS = PSS.Substring(0, 844) '844,por ser el numero de caracteres aceptados en la columna de la BD
End If
tPSCodigo = PSS
'BUSCA PS EN CATALOGO
Dim fPS = (From u In DtPS
Where String.Compare(u!PS.ToString().ToUpper.Trim, PSS, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0
Select u!CvePS, u!CveClasificacion, u!Clasificacion, u!CveTipoPS, u!PSCodigo).FirstOrDefault()
If fPS IsNot Nothing Then
PSS = fPS.PSCodigo.ToString()
tCvePS = fPS.CvePS.ToString().ToEntero()
TipoPS = fPS.CveTipoPS.ToString().ToEntero()
tCveClasif = fPS.CveClasificacion.ToString().ToEntero()
Clasif = fPS.Clasificacion.ToString()
tPSCodigo = fPS.PSCodigo.ToString()
Else
'BUSCA PS EN ALIAS
Dim fPSAlias = (From u In DtPSAlias
Where String.Compare(u!PSAlias.ToString().ToUpper.Trim, PSS, CultureInfo.CurrentCulture, CompareOptions.IgnoreNonSpace) = 0
Select u!CvePS, u!PS, u!CveClasificacion, u!Clasificacion, u!CveTipoPS, u!PSCodigo).FirstOrDefault()
If fPSAlias IsNot Nothing Then
Obs = PSS
PSS = fPSAlias.PS.ToString()
tCvePS = fPSAlias.CvePS.ToString().ToEntero()
TipoPS = fPSAlias.CveTipoPS.ToString().ToEntero()
tCveClasif = fPSAlias.CveClasificacion.ToString().ToEntero()
Clasif = fPSAlias.Clasificacion.ToString()
tPSCodigo = fPSAlias.PSCodigo.ToString()
Else
tCvePS = 20168
End If
End If
'PARA GLUYAS
If UsuarioActual.CveEmpresa = 66 Then
tPSCodigo = String.Format("{1} - {0}", ValorXML(node, "descripcion").ToUpper.Trim.Replace(vbCrLf, " ").Replace(vbLf, " ").Replace("'", "''"), ValorXML(node, "noIdentificacion").Trim)
End If
'' AGREGA PS
'AGREGA A TMPDT
'AddPS(ValorXML(node, "cantidad").ToDouble, CveUM, UMM, tCveClasif, Clasif, tCvePS, PSS, TipoPS, "-1", "SE", "SE", Obs, PU, Total, 0, 0, PSCodigo:=tPSCodigo, TCalculaTotales:=False)
AgregarProductoServicio(ValorXML(node, "cantidad").ToDecimal, CveUM, UMM, tCveClasif, Clasif, tCvePS, PSS, Obs, PU, 0, 0, "", 0, "")
Next
CalculaTotalesVenta()
'AddPS2(False)
'Dim SubTotalConceptos = Math.Round(SubTotalTemp, 2)
'TmpDT = DtPSTemp.Copy
'DtPSTemp.Dispose()
End Sub
Private Sub CargaComprobanteXML(XMLDoc As XmlDocument)
Dim nodo As XmlNode = XMLDoc.DocumentElement
_SerieXML = ValorXML(nodo, "serie")
If _SerieXML <> "" Then _SerieXML = _SerieXML
_Version = ValorXML(nodo, "version")
_FolioXML = ValorXML(nodo, "folio")
_Fecha = ValorXML(nodo, "fecha")
SubTotal = ValorXML(nodo, "subTotal").ToDecimal
Total = ValorXML(nodo, "total").ToDecimal
'Descuentos = ValorXML(nodo, "descuento").ToDecimal
_Moneda = ValorXML(nodo, "Moneda")
_TipoComprobante = ValorXML(nodo, "tipoDeComprobante")
Dim Prefijo As String = If(XMLDoc.DocumentElement.Prefix = "", "cfd", XMLDoc.DocumentElement.Prefix)
Dim cfdVer As String = "http://www.sat.gob.mx/cfd/3"
Dim namespaces As New XmlNamespaceManager(XMLDoc.NameTable)
If Prefijo.ToLower <> "cfdi" Then cfdVer = "http://www.sat.gob.mx/cfd/2"
namespaces.AddNamespace(Prefijo, cfdVer)
namespaces.AddNamespace("tfd", "http://www.sat.gob.mx/TimbreFiscalDigital")
namespaces.AddNamespace("implocal", "http://www.sat.gob.mx/implocal")
namespaces.AddNamespace("registrofiscal", "http://www.sat.gob.mx/registrofiscal")
Dim node As XmlNode
node = XMLDoc.SelectSingleNode(String.Format("//{0}:Emisor", Prefijo), namespaces)
If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then
EmisorRFC = ValorXML(node, "RFC")
'EmisorNombre = ValorXML(node, "nombre")
End If
node = XMLDoc.SelectSingleNode(String.Format("//{0}:Receptor", Prefijo), namespaces)
If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then
ReceptorRFC = ValorXML(node, "RFC")
End If
node = XMLDoc.SelectSingleNode(String.Format("//{0}:Impuestos", Prefijo), namespaces)
If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then
Dim nodeRetenciones As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:Retencion", Prefijo), namespaces)
TotalRetenciones = ValorXML(node, "totalImpuestosRetenidos", "0").ToDecimal
For Each retencion As XmlNode In nodeRetenciones
If retencion.Attributes("impuesto").Value = "IVA" Then
RetencionIVA += retencion.Attributes("importe").Value.ToDecimal
End If
If retencion.Attributes("impuesto").Value = "ISR" Then
RetencionISR += retencion.Attributes("importe").Value.ToDecimal
End If
' Do something.
Next
SumaTotalRetenciones += RetencionIVA
SumaTotalRetenciones += RetencionISR
TotalTraslados = ValorXML(node, "totalImpuestosTrasladados", "0").ToDecimal
Dim nodeTraslados As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:Traslado", Prefijo), namespaces)
For Each traslado As XmlNode In nodeTraslados
If traslado.Attributes("impuesto").Value = "IVA" Then
TrasladoIVA += traslado.Attributes("importe").Value.ToDecimal
End If
If traslado.Attributes("impuesto").Value = "IEPS" Then
TrasladoIEPS += traslado.Attributes("importe").Value.ToDecimal
End If
'If traslado.Attributes("impuesto").Value = "ISR" Then
' TrasladoISR = traslado.Attributes("importe").Value
'End If
' Do something.
Next
SumaTotalTraslados += TrasladoIVA
SumaTotalTraslados += TrasladoIEPS
End If
Dim nodeComp As XmlNode = XMLDoc.SelectSingleNode(String.Format("//{0}:Complemento", Prefijo), namespaces)
If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then
Dim nodeTFD As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:TimbreFiscalDigital", "tfd"), namespaces)
_TFDUUID = ValorXML(nodeTFD, "UUID", "")
Dim nodeRF As XmlNode = nodeComp.SelectSingleNode(String.Format("//{0}:CFDIRegistroFiscal ", "registrofiscal"), namespaces)
If nodeRF IsNot Nothing Then
_FolioXML = ValorXML(nodeRF, "folio").TrimStart("0"c)
End If
node = node.SelectSingleNode(String.Format("//{0}:ImpuestosLocales", "implocal"), namespaces)
If node IsNot Nothing AndAlso node.ChildNodes.Count > 0 Then
OtrosImpuestos = ValorXML(node, "TotaldeTraslados", "0").ToDecimal
If RetencionIVA <= 0 AndAlso ValorXML(node, "TotaldeRetenciones", "0").ToDouble > 0 Then RetencionIVA = ValorXML(node, "TotaldeRetenciones", "0").ToDecimal
'For Each retencion As XmlNode In nodeImpLocales
' If retencion.Attributes("impuesto").Value = "IVA" Then
' RetencionIVA += retencion.Attributes("importe").Value.ToDouble
' End If
' If retencion.Attributes("impuesto").Value = "ISR" Then
' RetencionISR += retencion.Attributes("importe").Value.ToDouble
' End If
' ' Do something.
'Next
' SumaTotalRetenciones += RetencionIVA
' SumaTotalRetenciones += RetencionISR
'TotalTraslados = ValorXML(node, "totalImpuestosTrasladados", "0").ToDouble
'Dim nodeTraslados As XmlNodeList = XMLDoc.SelectNodes(String.Format("//{0}:Traslado", Prefijo), namespaces)
'For Each traslado As XmlNode In nodeTraslados
' If traslado.Attributes("impuesto").Value = "IVA" Then
' TrasladoIVA += traslado.Attributes("importe").Value.ToDouble
' End If
' If traslado.Attributes("impuesto").Value = "IEPS" Then
' TrasladoIEPS += traslado.Attributes("importe").Value.ToDouble
' End If
' 'If traslado.Attributes("impuesto").Value = "ISR" Then
' ' TrasladoISR = traslado.Attributes("importe").Value
' 'End If
' ' Do something.
'Next
'SumaTotalTraslados += TrasladoIVA
'SumaTotalTraslados += TrasladoIEPS
End If
End If
End Sub
Private Function ValorXML(n As XmlNode, Campo As String, Optional Retorno As String = "") As String
Dim o As XmlNode = n.Attributes.Cast(Of XmlAttribute)().SingleOrDefault(Function(a) String.Compare(a.Name, Campo, True) = 0)
If o Is Nothing Then
Return Retorno
Else
Return o.Value
End If
End Function
#End Region
#Region "Metodos Viejos"
Private Sub GeneraPDF(FechaFactura As DateTime, FolioFiscal As String, NoSerieCertificado As String, FechaCertificacion As DateTime, NoSerieCertificadoContribuyente As String,
DTConceptos As DataTable, SelloCFDi As String, SelloSAT As String, CBB As String, Folio As String, RutaXML As String, EsVistaPrevia As Boolean, MuestraAlert As Boolean, Optional MR As ReportViewer = Nothing)
@@ -25395,7 +24878,6 @@ Partial Class Ventas
ImgDescTotal.Attributes.Clear()
ImgDescConcepto.Attributes.Clear()
LbAgregar.Enabled = False
LnkAgregarPyME.Enabled = False
divcondicionespago.Visible = False
BtnEmitirImprimir.Text = "Guardar"
@@ -25618,198 +25100,6 @@ Partial Class Ventas
End Sub
#End Region
#Region "P Y M E"
Private Sub LnkAddVenta_Click(sender As Object, e As EventArgs) Handles LnkAddVenta.Click
Modalidad = "A"
LnkAgregarPyME.Text = "Agregar"
TxtCantidadPyME.Text = "1"
TxtObsPyME.Text = ""
TxtPrecioPyME.Text = "0.00"
TxtDescuentoPyME.Text = "0.00"
LblTotalPyME.Text = "0.00"
If Not UsuarioActual.Empresa.Funcionalidad(141).ToString() = "1" Then
DdlPSPyME.SelectedValue = "-1"
Else
DdlPSPyME.SelectedValue = ""
DdlPSPyME.SelectedText = ""
End If
DdlClasificacionPyME.SelectedIndex = -1
DdlProyectoPyME.SelectedIndex = -1
DdlSubProyectoPyME.SelectedIndex = -1
DdlUMPyME.Items.Clear()
ChkAgregar.Checked = True
divagregrarotrops.Visible = True
UpVenta.Update()
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"))
End Sub
Public Sub Edit_Click(sender As Object, e As EventArgs)
Dim GvRow As GridViewRow = DirectCast(DirectCast(sender, LinkButton).NamingContainer, GridViewRow)
Modalidad = "U"
Index = GvRow.DataKey("Consec").ToEntero()
LnkAgregarPyME.Text = "Actualizar"
DdlClasificacionPyME.SelectedValueExist(GvRow.DataKey("CveClasificacion"))
CargaPSPyME(DdlClasificacionPyME.SelectedValue.ToEntero(), DdlPSPyME)
UpClasificacionPyME.Update()
If Not UsuarioActual.Empresa.Funcionalidad(141).ToString() = "1" Then
DdlPSPyME.SelectedValue = GvRow.DataKey("CvePS")
Else
DdlPSPyME.SelectedValue = GvRow.DataKey("CvePS")
DdlPSPyME.SelectedText = GvRow.DataKey("PS")
End If
DdlPSPyMEIndexChange()
DdlProyectoPyME.SelectedValueExist(GvRow.DataKey("CveProyecto"))
CargaSubProyecto()
DdlSubProyectoPyME.SelectedValueExist(GvRow.DataKey("CveSubProyecto"))
DdlUMPyME.SelectedValueExist(GvRow.DataKey("CveUM"))
TxtCantidadPyME.Text = GvRow.DataKey("Cantidad")
TxtObsPyME.Text = GvRow.DataKey("Obs")
TxtPrecioPyME.Text = GvRow.DataKey("PU")
TotAnt = GvRow.DataKey("Total").ToDecimal
LblTotalPyME.Text = GvRow.DataKey("Total")
ChkAgregar.Checked = False
divagregrarotrops.Visible = False
UpVenta.Update()
RegistraScript(String.Format("$('#{0}').modal('show');", "DivAddVenta"), "EdicionVenta")
End Sub
Private Sub LnkAgregarPyME_Click(sender As Object, e As EventArgs) Handles LnkAgregarPyME.Click
AgregarPSPYME()
If ChkAgregar.Checked = True And Modalidad = "A" Then
LnkAgregarPyME.Text = "Agregar"
TxtCantidadPyME.Text = ""
TxtObsPyME.Text = ""
TxtPrecioPyME.Text = "0.00"
LblTotalPyME.Text = "0.00"
If Not UsuarioActual.Empresa.Funcionalidad(141).ToString() = "1" Then
DdlPSPyME.SelectedValue = "-1"
Else
DdlPSPyME.SelectedValue = ""
DdlPSPyME.SelectedText = ""
End If
DdlClasificacionPyME.SelectedIndex = -1
DdlProyectoPyME.SelectedIndex = -1
DdlSubProyectoPyME.SelectedIndex = -1
DdlUMPyME.Items.Clear()
UpVenta.Update()
RegistraScript("displayToastr(1);", "display")
Else
If Modalidad = "A" Then RegistraScript("displayToastr(1);", "display1")
If Modalidad = "U" Then RegistraScript("displayToastr(2);", "display2")
RegistraScript("ClosePopup();", "AddUpdatePS")
End If
End Sub
Private Sub DdlPSPyME_selectedindexchange(sender As Object, e As EventArgs) Handles DdlPSPyME.selectedindexchange
DdlPSPyMEIndexChange()
End Sub
Private Sub CargaPSPyME(CveClasificacion As Integer, Objeto As ADServerControl.Dropdownlost)
Objeto.setEsWebService(True)
Objeto.Attributes.Add("data-cvesubproyecto", DdlSubProyectoDatos.SelectedValue)
Objeto.ddlWS.Attributes.Add("data-cveclasificacion", CveClasificacion.ToString())
Objeto.ddlWS.Attributes.Add("data-pagina", "ventas/ventas")
Objeto.ddlWS.Attributes.Add("data-Estatus", "1")
End Sub
Private Sub DdlPSPyMEIndexChange()
If CveCliente > 0 OrElse DdlPSPyME.SelectedValue = "-2" Then
If DdlPSPyME.SelectedValue IsNot Nothing AndAlso DdlPSPyME.SelectedValue.ToEntero() > 0 Then
Dim drPS As DataRow = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=DdlPSPyME.SelectedValue.ToEntero()).FiltroPrimero("")
If drPS IsNot Nothing Then
'HdnUnidadMedida.Value = PS.Rows(0)("CveUnidadMedida").ToString()
HdnPS.Value = drPS("PS").ToString()
HdnCodigoPS.Value = drPS("PSCodigo").ToString()
HdnTipoPS.Value = drPS("CveTipoPS").ToString()
HdnTipoInv.Value = drPS("Inv_CveMetodoInventario").ToString()
HdnAplicaIEPS.Value = drPS("AplicaIEPS").ToString()
HdnPorcentajeIEPS.Value = drPS("IEPSPorcentaje").ToString()
DdlUMPyME.Items.Clear()
If UsuarioActual.Empresa.UsaInventarios Then
DdlUMPyME.DataSource = GlobalDTProductosServiciosEquivalencias(DdlPSPyME.SelectedValue.ToEntero(), -1, UsuarioActual.CveEmpresa)
Else
DdlUMPyME.DataSource = GlobalDTUnidadesMedida(UsuarioActual.CveEmpresa)
End If
DdlUMPyME.Items.Insert(0, New ListItem("Seleccione", "-1"))
DdlUMPyME.SelectedValue = "-1"
DdlUMPyME.DataBind()
DdlUMPyME.SelectedValueExist(drPS("CveUnidadMedida").ToString())
'LblUnidadMedida.Text = PS.Rows(0)("UnidadMedida").ToString()
TxtPrecioPyME.Text = drPS("Precio").ToString().FormatoNumero(2).Replace(","c, "")
Dim Cantidad As Decimal = TxtCantidadPyME.Text.ToDecimal()
Dim PU As Decimal = TxtPrecioPyME.Text.ToDecimal()
Dim ObjDescuento As Modelos.VentaDescuentos = CalcularDescuentos(DdlPSPyME.SelectedValue.ToEntero(), Cantidad, PU)
TxtDescuentoPyME.Text = ObjDescuento.ImporteDescuento.FormatoNumero(2).Replace(","c, "")
LblTotalPyME.Text = ((Cantidad * PU) - ObjDescuento.ImporteDescuento).FormatoNumero(2).Replace(","c, "")
If UsuarioActual.CveEmpresa = 80 Then
'busca el precio de la sucursal
Dim ObjPS As New ClsProductosServicios
If ObjPS.GetPSSucursales(DdlPSPyME.SelectedValue.ToEntero(), UsuarioActual.CveEmpresa, DdlSubProyectoDatos.SelectedValue.ToEntero()) Then
Dim dtt As DataTable = ObjPS.DtResultados
Dim drPrecio As DataRow = dtt.FiltroPrimero("")
If drPrecio IsNot Nothing Then
TxtPrecioPyME.Text = drPrecio("Importe").ToString().ToDouble.ToString("N4")
End If
dtt.Dispose()
End If
ObjPS.Dispose()
End If
'If IsNumeric(TxtCantidad.Text.Trim) Then
' LblTotalPyME.Text = (TxtCantidad.Text.Trim.ToDouble * TxtPrecio.Text.ToDouble).ToString().FormatoNumero(2)
'End If
HdnIVAPS.Value = If(drPS("IVA").ToString() = "-1", ViewState("IVA"), drPS("IVA").ToString()).ToString()
HdnIVARetAPS.Value = drPS("RetIVA").ToString()
HdnAsientoContable.Value = drPS("AsientoContableVentas").ToString()
HdnAplicaParaConcepto.Value = drPS("AplicaParaConcepto").ToString()
HdnCodigo.Value = drPS("Codigo").ToString()
If DdlClasificacionPyME.SelectedIndex = 0 Then
If drPS("CveClasificacion").ToString() IsNot Nothing Then
DdlClasificacionPyME.SelectedValueExist(drPS("CveClasificacion").ToString())
Else
Alert("El Productos/Servicio no tiene asignada una Clasificación.")
End If
End If
End If
'RegistraScript("Recalcula();")
'PS.Dispose()
ElseIf DdlPSPyME.SelectedValue = "-2" Then
CargaPSPyME(-1, DdlPSPyME)
End If
Else
Alert("Es necesario seleccionar el cliente al cual se le va a facturar.", TipoMensaje.MsgAdvertencia, "AbrirVentana(""/Ventas/PopUpBuscarClientes.aspx?Opt=Fact"", 800, 547, ""N"", ""PopUpBuscar"")")
End If
UpVenta.Update()
End Sub
Private Sub DdlClasificacionPyME_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlClasificacionPyME.SelectedIndexChanged
CargaPSPyME(DdlClasificacionPyME.SelectedValue.ToEntero(), DdlPSPyME)
UpClasificacionPyME.Update()
End Sub
#End Region
#Region "REORDENAR"
Protected Sub BtnReordenar_Click(sender As Object, e As EventArgs) Handles BtnReordenar.Click
Dim sArray As String()
@@ -30632,7 +29922,6 @@ Partial Class Ventas
DdlSubProyecto.Enabled = True
TxtPrecio.Enabled = True
LbAgregar.Enabled = True
LnkAgregarPyME.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
@@ -32374,7 +31663,6 @@ Partial Class Ventas
DdlSubProyecto.Enabled = True
TxtPrecio.Enabled = True
LbAgregar.Enabled = True
LnkAgregarPyME.Enabled = True
ImgDescPU.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 = '0'; $get('LblPrecio1').style.display = ''; $get('LblTotalPS1').style.display = 'none'; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';")
ImgDescConcepto.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 = '1'; $get('LblPrecio1').style.display = 'none'; $get('LblTotalPS1').style.display = ''; $get('LblSubTotal1').style.display = 'none'; $get('LblAmort').style.display = 'none'; $get('BtnAplicarDescP').style.display = ''; $get('BtnAplicarDescG').style.display = 'none'; $get('TrMotivoDescuento').style.display = '';")