This commit is contained in:
Raul Pimienta
2019-11-04 21:10:25 -07:00
52 changed files with 22951 additions and 8731 deletions

View File

@@ -229,11 +229,11 @@
</div>
</div>
<asp:GridView ID="gvSucursal" runat="server" AutoGenerateColumns="False" DataKeyNames="CveSubProyecto" EmptyDataText="No se encontraron Sucursales" ToolTip="Listado de Sucursales habilitadas para Productos o Servicios"
CssClass="table table-striped table-smallpadding table-advance table-hover Widthall" Style="text-align: center;" GridLines="None">
CssClass="table table-striped table-smallpadding table-advance table-hover Widthall" OnRowDataBound="gvSucursal_RowDataBound" Style="text-align: center;" GridLines="None">
<Columns>
<asp:TemplateField>
<ItemTemplate>
<asp:CheckBox ID="chkSucursal" runat="server" Checked='<%# Eval("Activo") %>' CssClass="CsMCheckGvSucursal" />
<asp:CheckBox ID="chkSucursal" runat="server" Checked="false" CssClass="CsMCheckGvSucursal" />
<asp:HiddenField ID="hdnEnBD" runat="server" Value='<%# If (IsDBNull(Eval("CvePS")),0,1) %>' />
</ItemTemplate>
</asp:TemplateField>
@@ -415,6 +415,9 @@
$('.CsMCheckGvSucursal').find('input[type=checkbox]').prop('checked', false);
}
}
function FncSeleccionaChk(chk) {
chk.checked = true;
}

View File

@@ -468,7 +468,12 @@ Partial Class Ventas_ActualizarPrecios
End While
Return dataTable
End Function
End Function
#End Region
Protected Sub gvSucursal_RowDataBound(sender As Object, e As GridViewRowEventArgs)
If e.Row.RowType = DataControlRowType.DataRow Then
e.Row.FCTextBox("TxtPrecioMinimo").Attributes.Add("onKeyUp", String.Format("FncSeleccionaChk({0});", e.Row.FCCheckBox("chkSucursal").ClientID))
End If
End Sub
End Class

View File

@@ -2465,9 +2465,9 @@ Partial Class Clientes
If ErrorProceso Then
ObjClientes.RollBack()
Else
ObjClientes.Commit()
'JM 05-02-19: CRM ASIGAN CLIENTE A EMPRESACRM
ObjClientes.Commit()
'JM 05-02-19: CRM ASIGAN CLIENTE A EMPRESACRM
Dim MensajeCRM As String = ""
If CveEmpresaCRM > 0 Then
If VincularEmpresaCRM() Then
@@ -2536,13 +2536,8 @@ Partial Class Clientes
ObjClientes.Commit()
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
CargaHistorial()
CargaDatos()
UpDatos.Update()
UpnHistorial.Update()
Alert("Los cambios se guardaron correctamente.", TipoMensaje.MsgInformacion)
If EstatusAnteriorCliente <> ChkEstado.Checked Then
Dim DTVendedor As New DataTable
@@ -2551,7 +2546,7 @@ Partial Class Clientes
If DTVendedor.Rows.Count > 0 Then
Dim _CorreoVendedor As String = DTVendedor(0)("Correo").ToString
If _CorreoVendedor.Length > 0 Then
If _CorreoVendedor.Length > 0 And UsuarioActual.Empresa.Funcionalidad(571).ToEntero > 0 Then
Dim Asunto As String = ""
Dim Para As String = _CorreoVendedor
@@ -2559,19 +2554,22 @@ Partial Class Clientes
If ChkEstado.Checked Then
Asunto = "Activación de cliente " & TxtNombre.Text
SBBody.Append(String.Format(" Por Medio de la presente se le notifica que el estatus del cliente {0} a sido activado.", TxtNombre.Text))
SBBody.Append(String.Format(" Por Medio de la presente se le notifica que el estatus del cliente {0} ha sido activado.", TxtNombre.Text))
Else
Asunto = "Desactivación de cliente " & TxtNombre.Text
SBBody.Append(String.Format(" Por Medio de la presente se le notifica que el estatus del cliente {0} a sido desactivado.", TxtNombre.Text))
End If
EstatusAnteriorCliente = ChkEstado.Checked
MandaCorreo(Asunto, Para, SBBody.ToString)
SBBody.Append(String.Format(" Por Medio de la presente se le notifica que el estatus del cliente {0} ha sido desactivado.", TxtNombre.Text))
End If
MandaCorreo(Asunto, Para + "", SBBody.ToString)
End If
End If
End If
CargaHistorial()
CargaDatos()
UpDatos.Update()
UpnHistorial.Update()
End If
End If
ObjClientes.Dispose()

View File

@@ -223,7 +223,7 @@
<table border="0" width="463px">
<tr align="left">
<td width="95px"><b>Nombre:</b>&nbsp;</td>
<td width="110px"><b>Nombre:</b>&nbsp;</td>
<td width="200px">
<asp:Label ID="LblCliente" runat="server" Text="Cliente"></asp:Label></td>
<td width="85px" runat="server" id="LblEnviarMail"><b>Enviar Mail:</b></td>
@@ -303,6 +303,14 @@
</td>
</tr>
<tr align="left" style="border: 4px solid red" runat="server" id="TrEsDistribuidor" visible="false">
<td><b style="color: red;">Es Distribuidor</b></td>
<td></td>
<td><b style="color: red">Vendedor:</b></td>
<td>
<asp:Label ID="LbVendedor" runat="server" Text=""></asp:Label></td>
</tr>
</table>
</div>
</div>
@@ -2592,13 +2600,6 @@
<label for="<%= TxtCantidad.ClientID.ToString()%>">Cantidad:</label>
</div>
</div>
<div class="col-md-8">
<asp:UpdatePanel ID="UpBtnDescuento" runat="server" class="portlet-body form" UpdateMode="Conditional">
<ContentTemplate>
<asp:LinkButton ID="ImgDescPU" runat="server" Text="<i class='fa fa-comment-o'></i>" Style="cursor: pointer;" AlternateText="Agregar Descuento" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<asp:UpdatePanel runat="server" ID="UpClasificacion" UpdateMode="Conditional">
@@ -2660,35 +2661,47 @@
</div>
</div>
<br />
<div id="DivRecepcionUsados" runat="server">
<div class="row">
<div class="col-md-12" id="DivRecepcionUsados" runat="server" visible="false">
<asp:GridView ID="GvRecepcionUsados" runat="server" GridLines="None" ShowHeaderWhenEmpty="true" CssClass="table table-hover table-striped ScrollAD mysmallbtn"
data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" data-height="100"
DataKeyNames="CvePSCargo,CveUM,Cargo,CveTamaño">
<Columns>
<asp:BoundField DataField="CodigoPS" HeaderText="Tamaño" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="35%" />
<asp:TemplateField HeaderText="Cantidad" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20%">
<div class="row">
<div class="col-md-5">
<label>Modelo:</label>
<br />
<asp:DropDownList ID="DdlModeloAuto" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="ModeloMarca" DataValueField="CveModeloAuto">
</asp:DropDownList>
</div>
</div>
<br />
<div class="row">
<div class="col-md-12" visible="false">
<asp:GridView ID="GvRecepcionUsados" runat="server" GridLines="None" ShowHeaderWhenEmpty="true" CssClass="table table-hover table-striped ScrollAD mysmallbtn"
data-sort="true" BorderWidth="1" BorderColor="#D3D3D3" CellSpacing="0" Width="100%" AutoGenerateColumns="False" data-height="100"
DataKeyNames="CvePSCargo,CveUM,Cargo,CveTamaño">
<Columns>
<asp:BoundField DataField="CodigoPS" HeaderText="Tamaño" ItemStyle-HorizontalAlign="Left" ItemStyle-Width="35%" />
<asp:TemplateField HeaderText="Cantidad" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20%">
<ItemTemplate>
<asp:TextBox ID="TxtCantidad" CssClass="form-control linewhitsize" runat="server" Width="90%" Height="30px"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTBECantidad" runat="server" TargetControlID="TxtCantidad" FilterType="Custom, Numbers" ValidChars="." />
</ItemTemplate>
</asp:TemplateField>
<%-- <asp:TemplateField HeaderText="Modelo" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="30%">
<ItemTemplate>
<asp:TextBox ID="TxtCantidad" CssClass="form-control linewhitsize" runat="server" Width="90%" Height="30px"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FTBECantidad" runat="server" TargetControlID="TxtCantidad" FilterType="Custom, Numbers" ValidChars="." />
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="Modelo" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="30%">
<ItemTemplate>
<asp:DropDownList ID="DdlModeloAuto" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="ModeloMarca" DataValueField="CveModeloAuto" >
<asp:DropDownList ID="DdlModeloAuto" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="ModeloMarca" DataValueField="CveModeloAuto">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField HeaderText="BCI" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="25%">
<ItemTemplate>
<asp:DropDownList ID="DdlBCIUsado" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="BCI" DataValueField="CveBCIUsado" Width="90%">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</asp:TemplateField>--%>
<asp:TemplateField HeaderText="BCI" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="25%">
<ItemTemplate>
<asp:DropDownList ID="DdlBCIUsado" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="BCI" DataValueField="CveBCIUsado" Width="90%">
</asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</div>
</div>
@@ -2704,15 +2717,27 @@
<br />
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPrecio" runat="server" onkeypress="setFocus(event,'LbAgregar');" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GrpAddVenta" Width="76px" CssClass="form-control "></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtPrecio" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVPrecio" runat="server" ControlToValidate="TxtPrecio" Display="None" 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>
<ajax:ValidatorCalloutExtender ID="VCPrecio" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVPrecio" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GrpAddVenta"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VCEPrecio" runat="server" HighlightCssClass="vco" TargetControlID="CVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= TxtPrecio.ClientID.ToString()%>">Precio:</label>
<div class="row">
<div class="col-md-3">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPrecio" runat="server" onkeypress="setFocus(event,'LbAgregar');" onkeyup="Recalcula();" CausesValidation="true" lang="nb" ClientIDMode="Static" Text="0.00" MaxLength="12" ValidationGroup="GrpAddVenta" Width="76px" CssClass="form-control "></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender4" runat="server" TargetControlID="TxtPrecio" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVPrecio" runat="server" ControlToValidate="TxtPrecio" Display="None" 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>
<ajax:ValidatorCalloutExtender ID="VCPrecio" runat="server" HighlightCssClass="vco" TargetControlID="RFVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVPrecio" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtPrecio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Precio''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GrpAddVenta"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VCEPrecio" runat="server" HighlightCssClass="vco" TargetControlID="CVPrecio" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= TxtPrecio.ClientID.ToString()%>">Precio:</label>
</div>
</div>
<div class="col-md-8">
<asp:UpdatePanel ID="UpBtnDescuento" runat="server" class="portlet-body form" UpdateMode="Conditional">
<ContentTemplate>
<asp:LinkButton ID="ImgDescPU" runat="server" Text="<i class='fa fa-tags' style='color:dimgray;'></i>" Style="cursor: pointer;" AlternateText="Agregar Descuento" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div class="form-group form-md-line-input input-iconright">
<div class="row">
<div class="col-md-6">
@@ -2742,6 +2767,9 @@
</div>
</div>
<asp:UpdatePanel ID="UpAjuste" runat="server" class="portlet-body form" UpdateMode="Conditional">
<Triggers>
<asp:PostBackTrigger ControlID="BtnPDFHistorial" />
</Triggers>
<ContentTemplate>
<div class="col-md-1" id="DivAjuste" runat="server" visible="false">
<div class="portlet light xspadding bordered">
@@ -2751,10 +2779,10 @@
<span class="caption-subject bold uppercase">Ajuste </span>
</div>
<div class="tools">
<asp:LinkButton ID="BtnPDFHistorial" OnClick="BtnPDFHistorial_Click" runat="server" data-toggle="tooltip" Title="PDF"><i class="fa fa-file-pdf-o" style="font-size:15px; font-weight:bold; color:dimgray;"></i></asp:LinkButton>
<a href="javascript;" class="collapse" data-original-title="" title=""></a>
</div>
</div>
<div class="row">
<div class="col-md-12">
<div class="form-group form-md-line-input input-iconright">
@@ -2765,14 +2793,14 @@
</div>
</div>
<div class="row">
<div class="col-md-9">
<div class="col-md-12">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlPSAjuste" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="PSCodigo" DataValueField="CvePS" OnSelectedIndexChanged="DdlPSAjuste_selectedindexchange" Width="100%" AutoPostBack="true">
</asp:DropDownList>
<label for="<%= DdlPSAjuste.ClientID.ToString()%>">Producto/Servicio a Recibir:</label>
</div>
</div>
<div class="col-md-3">
<%-- <div class="col-md-3">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPUFactura" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVPUFactura" runat="server" ControlToValidate="TxtPUFactura" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''PU Factura''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
@@ -2780,10 +2808,10 @@
<ajax:FilteredTextBoxExtender ID="FTBEPUFactura" runat="server" TargetControlID="TxtPUFactura" FilterType="Custom, Numbers" ValidChars=".," />
<label for="<%= TxtPUFactura.ClientID.ToString()%>">P.U.:</label>
</div>
</div>
</div>--%>
</div>
<div class="row">
<div class="col-md-6">
<div class="col-md-8">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlFolioGarantia" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="FolioGarantia" DataValueField="CveFolioGarantia" Width="100%">
</asp:DropDownList>
@@ -2792,7 +2820,7 @@
<label for="<%= DdlFolioGarantia.ClientID.ToString()%>">Folio:</label>
</div>
</div>
<div class="col-md-6">
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtConsecutivoAjuste" CssClass="form-control" runat="server" MaxLength="25"></asp:TextBox>
<%--<asp:RequiredFieldValidator ID="RFVConsecutivoAjuste" runat="server" ControlToValidate="TxtConsecutivoAjuste" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Consec.''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%>
@@ -2802,15 +2830,16 @@
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="col-md-8">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCodEnsamble" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
<%--<asp:RequiredFieldValidator ID="RFVCodEnsamble" runat="server" ControlToValidate="TxtCodEnsamble" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Folio''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%>
<asp:RegularExpressionValidator ID="REVCodEnsamble" runat="server" ControlToValidate="TxtCodEnsamble" 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" ValidationExpression="^[0-9][A-HJ-M]([[0-2][1-9]|3[0-1])([A-Z]|X[1-9])[ACEN][A-HJ-NO-Z][A-F]$"></asp:RegularExpressionValidator>
<%--<asp:RequiredFieldValidator ID="RFVCodEnsamble" runat="server" ControlToValidate="TxtCodEnsamble" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Folio''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%
<%--<ajax:ValidatorCalloutExtender ID="VCECodEnsamble" runat="server" HighlightCssClass="vco" TargetControlID="RFVCodEnsamble"></ajax:ValidatorCalloutExtender>--%>
<label for="<%= TxtCodEnsamble.ClientID.ToString()%>">Cod.Ensamble:</label>
</div>
</div>
<div class="col-md-6">
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoUso" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="TipoUso" DataValueField="CveTipoUso" Width="100%" AutoPostBack="true" OnSelectedIndexChanged="DdlTipoUso_SelectedIndexChanged">
</asp:DropDownList>
@@ -2822,7 +2851,7 @@
</div>
<br />
<div class="row">
<div class="col-md-6">
<div class="col-md-8">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCodLinea" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
<%--<asp:RequiredFieldValidator ID="RFVCodLinea" runat="server" ControlToValidate="TxtCodLinea" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cod. Linea''</b> es necesario, por favor ingréselo." ValidationGroup="VGMAjuste"></asp:RequiredFieldValidator>--%>
@@ -2830,34 +2859,31 @@
<label for="<%= TxtCodLinea.ClientID.ToString()%>">Cod.Linea:</label>
</div>
</div>
<div class="col-md-6">
<div class="row">
<div class="col-md-4" style="text-align: left">Fecha:</div>
<div class="col-md-6">
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;">
<asp:TextBox ID="TxtFechaAjuste" CssClass="form-control input-sm ADSMaskDate" Width="100%" runat="server"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkFechaAjuste" class="btn default " Text=" <i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaAjuste" runat="server" TargetControlID="TxtFechaAjuste" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEEFechaAjuste" TargetControlID="TxtFechaAjuste" PopupButtonID="LnkFechaAjuste" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RFVFechaAjuste" runat="server" ControlToValidate="TxtFechaAjuste" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEFechaAjuste" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaAjuste"></ajax:ValidatorCalloutExtender>
</div>
</div>
<div class="col-md-4">
<label for="<%= TxtFechaAjuste.ClientID.ToString()%>">Fecha:</label>
<div class="input-group input-sm input-small date date-picker " data-date-format="dd/mm/yyyy" style="width: 120px !important; padding: 0px;">
<asp:TextBox ID="TxtFechaAjuste" CssClass="form-control input-sm ADSMaskDate" Width="100%" runat="server"></asp:TextBox>
<span class="input-group-btn ">
<asp:LinkButton ID="LnkFechaAjuste" class="btn default " Text=" <i class='fa fa-calendar'></i>" runat="server"></asp:LinkButton>
</span>
<ajax:MaskedEditExtender ID="MEEFechaAjuste" runat="server" TargetControlID="TxtFechaAjuste" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
<ajax:CalendarExtender runat="server" ID="CEEFechaAjuste" TargetControlID="TxtFechaAjuste" PopupButtonID="LnkFechaAjuste" PopupPosition="BottomRight" Enabled="True" Format="dd/MM/yyyy"></ajax:CalendarExtender>
<asp:RequiredFieldValidator ID="RFVFechaAjuste" runat="server" ControlToValidate="TxtFechaAjuste" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fecha''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEFechaAjuste" runat="server" HighlightCssClass="vco" TargetControlID="RFVFechaAjuste"></ajax:ValidatorCalloutExtender>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="col-md-8">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtCodInspeccion" CssClass="form-control" runat="server" MaxLength="50"></asp:TextBox>
<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][3-9][1-9A-V][A-FK-O]$"></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>--%>
<%--<ajax:ValidatorCalloutExtender ID="VCECodInspeccion" runat="server" HighlightCssClass="vco" TargetControlID="RFVCodInspeccion"></ajax:ValidatorCalloutExtender>--%>
<label for="<%= TxtCodInspeccion.ClientID.ToString()%>">Cod. Inspección:</label>
</div>
</div>
<div class="col-md-6">
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtMesesUso" CssClass="form-control" runat="server" MaxLength="50" Enabled="false"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVMesesUso" runat="server" ControlToValidate="TxtMesesUso" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Meses de Uso''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
@@ -2868,16 +2894,25 @@
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlTipoDefecto" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="TipoDefecto" DataValueField="CveTipoDefecto" Width="100%">
<asp:DropDownList ID="DdlTipoDefecto" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="TipoDefecto" DataValueField="CveTipoDefecto" Width="100%" OnSelectedIndexChanged="DdlTipoDefecto_SelectedIndexChanged" AutoPostBack="true">
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVTipoDefecto" runat="server" ControlToValidate="DdlTipoDefecto" InitialValue="-1" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo de Defecto''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCETipoDefecto" runat="server" HighlightCssClass="vco" TargetControlID="RFVTipoDefecto"></ajax:ValidatorCalloutExtender>
<label for="<%= DdlTipoDefecto.ClientID.ToString()%>">Tipo de Defecto:</label>
</div>
</div>
<div class="col-md-6">
<div class="col-md-4">
<div id="DivCodigoTD" class="form-group form-md-line-input input-iconright" runat="server" visible="false">
<asp:TextBox ID="TxtCodigoTD" CssClass="form-control" runat="server" MaxLength="11" Width="100%"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVCodigoTD" runat="server" ControlToValidate="TxtCodigoTD" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Código''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="ValidatorCalloutExtender2" runat="server" HighlightCssClass="vco" TargetControlID="RFVCodigoTD"></ajax:ValidatorCalloutExtender>
<ajax:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" runat="server" TargetControlID="TxtCodigoTD" FilterType="Custom, Numbers, UppercaseLetters " ValidChars="." />
<label for="<%= TxtCodigoTD.ClientID.ToString()%>">Código:</label>
</div>
</div>
<div class="col-md-4">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtPorcentajeAjuste" CssClass="form-control" Enabled="false" runat="server" MaxLength="50"></asp:TextBox>
<asp:RequiredFieldValidator ID="RFVPorcentajeAjuste" runat="server" ControlToValidate="TxtPorcentajeAjuste" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''% Ajuste''</b> es necesario, por favor ingréselo." ValidationGroup="GrpAddVenta"></asp:RequiredFieldValidator>
@@ -3080,6 +3115,7 @@
var Descuento = parseFloat($get("TxtPorDescP").value);
$get("LblPrecioFinal").innerText = formato_numero(Monto - ((Monto * Descuento) / 100), 2, '.', ',');
$get("TxtPrecio").value = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ',');
var Total = Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""));
$get("LblDescuento").innerText = formato_numero(Total, 2, '.', ',');
$get("HdnDescuento").value = Total;
@@ -3107,6 +3143,7 @@
var Descuento = parseFloat($get("TxtDescP").value);
$get("TxtPorDescP").value = Descuento * 100 / Monto * 10
$get("LblPrecioFinal").innerText = formato_numero(Monto - Descuento, 2, '.', ',');
$get("TxtPrecio").value = formato_numero(parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", "")), 2, '.', ',');
var Total = Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""));
$get("LblDescuento").innerText = formato_numero(Total, 2, '.', ',');
$get("HdnDescuento").value = Total;

View File

@@ -8,6 +8,7 @@ Imports System.Linq
Imports System.Security.Cryptography.X509Certificates
Imports System.Globalization
Imports System.Net.Http
Imports Microsoft.Reporting.WebForms
Partial Class PV
Inherits ClsPaginas
@@ -932,6 +933,14 @@ Partial Class PV
ViewState("DtPUFacturas") = value
End Set
End Property
Private Property DtModelosAuto As DataTable
Get
Return CType(ViewState("DtModelosAuto"), DataTable)
End Get
Set(value As DataTable)
ViewState("DtModelosAuto") = value
End Set
End Property
#End Region
#Region "PROPIEDADES ACUMULADORES"
@@ -1166,6 +1175,7 @@ Partial Class PV
DdlTipoComprobante.Items.Add(New ListItem("Remisión", "Rem"))
DdlTipoComprobante.SelectedValueExist("Rem")
End If
DdlTipoDefecto.Width = New Unit(260%)
'Le quitamos el tamaño extra
'RegistraScript("window.onload = function AjustarVentana() { $('.page-content').css('min-height','100%'); }")
@@ -1601,6 +1611,11 @@ Partial Class PV
ViewState("CodCliente") = ObjCliente.Codigo
ViewState("ClienteDesglosaIEPS") = ObjCliente.DesglosaIEPS
If (Boolean.Parse(ObjCliente.DtResultados(0)("EsDistribuidor").ToString)) Then
TrEsDistribuidor.Visible = True
LbVendedor.Text = GlobalDTVendedores(UsuarioActual.CveEmpresa).FiltroPrimeroValor("Vendedor", $"CveVendedor = {ObjCliente.Vendedor}")
End If
ViewState("CliNoExt") = ObjCliente.NoExt
ViewState("CliNoInt") = ObjCliente.NoInt
ViewState("CliLocalidad") = If(ObjCliente.Localidad.Trim.Length = 0, ObjCliente.Ciudad.Trim, ObjCliente.Localidad.Trim)
@@ -2772,10 +2787,8 @@ Partial Class PV
DivRecepcionUsados.Visible = True
If DdlTipoComprobante.SelectedValue <> "Rem" Then
GvRecepcionUsados.Columns(2).Visible = False
GvRecepcionUsados.Columns(3).Visible = False
Else
GvRecepcionUsados.Columns(2).Visible = True
GvRecepcionUsados.Columns(3).Visible = True
End If
End If
@@ -2858,6 +2871,16 @@ Partial Class PV
Protected Sub DdlPS_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlPS.selectedindexchange
DdlPSIndexChange(DdlPS.SelectedValue.ToEntero, DdlPS)
End Sub
Protected Sub DdlTipoDefecto_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DdlTipoDefecto.SelectedIndexChanged
If DdlTipoDefecto.SelectedValue.ToEntero = 17 Then
DivCodigoTD.Visible = True
DdlTipoDefecto.Width = New Unit(140%)
Else
DivCodigoTD.Visible = False
DdlTipoDefecto.Width = New Unit(200%)
End If
End Sub
Protected Sub DdlSucursalCliente_SelectedIndexChanged(sender As Object, e As EventArgs) Handles DdlSucursalCliente.SelectedIndexChanged
CargaClienteSucursal(DdlSucursalCliente.SelectedValue.ToEntero)
End Sub
@@ -3462,10 +3485,10 @@ Partial Class PV
End If
Next
If CantidadUsados > TxtCantidad.Text.ToEntero() Then
Alert("No puede tener una cantidad mayor a la de los cargos", TipoMensaje.MsgAdvertencia)
Return False
End If
'If CantidadUsados > TxtCantidad.Text.ToEntero() Then
' Alert("No puede tener una cantidad mayor a la de los cargos", TipoMensaje.MsgAdvertencia)
' Return False
'End If
'VALIDA PROMOCIONES
Dim ObjVentas As New ClsVentas
@@ -4922,6 +4945,7 @@ Partial Class PV
Dim DtTamanios = GlobalDTAcumTamaños.FiltraParametros($"CveEmpresa = {UsuarioActual.CveEmpresa} AND CvePSCargo > 0")
CargaModelos()
GvRecepcionUsados.DataSource = DtTamanios
GvRecepcionUsadosModal.DataSource = DtTamanios
@@ -4941,6 +4965,15 @@ Partial Class PV
DivChkAjuste.Visible = True
End Sub
Private Sub CargaModelos()
Dim ObjGral As New ClsGenerales
If ObjGral.ModelosAutosGet(UsuarioActual.CveEmpresa) Then
DtModelosAuto = ObjGral.DtResultados
DdlModeloAuto.DataSource = DtModelosAuto
End If
DdlModeloAuto.DataBind()
End Sub
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
@@ -4953,10 +4986,6 @@ Partial Class PV
e.Row.FCDropDownList("DdlBCIUsado").DataBind()
'e.Row.FCDropDownList("DdlBCIUsado").SelectedValue = e.Row.DBCampo("CveBCIUsado")
If ObjGral.ModelosAutosGet(UsuarioActual.CveEmpresa) Then
e.Row.FCDropDownList("DdlModeloAuto").DataSource = ObjGral.DtResultados
End If
e.Row.FCDropDownList("DdlModeloAuto").DataBind()
End If
End Sub
@@ -4989,7 +5018,7 @@ Partial Class PV
LimpiaAjuste()
If TmpDTAjustes IsNot Nothing AndAlso TmpDTAjustes.FiltraParametros($"ConsecutivoVenta = {ConsecutivoVenta}").Rows.Count > 0 Then
ModalidadAjuste = "U"
TxtPrecio.Attributes.Add("onKeyUp", $"CambiaAjuste(this,{TxtPUFactura.ClientID});")
TxtPrecio.Attributes.Add("onKeyUp", $"CambiaAjuste(this,{TxtPrecio.ClientID});")
ChkAjuste.Checked = True
DivAjuste.Visible = True
CargaAjusteDetalle()
@@ -5005,7 +5034,7 @@ Partial Class PV
TxtCodEnsamble.Text = ""
DdlTipoUso.SelectedIndex = -1
TxtCodLinea.Text = ""
TxtPUFactura.Text = ""
TxtPrecio.Text = ""
TxtFechaAjuste.Text = Now.ToShortDateString
CEEFechaAjuste.EndDate = Now
TxtCodInspeccion.Text = ""
@@ -5014,7 +5043,7 @@ Partial Class PV
TxtPorcentajeAjuste.Text = ""
TxtPoliza.Text = ""
TxtImporteAjuste.Text = ""
DdlPSAjuste.SelectedIndex = 0
DdlPSAjuste.SelectedIndex = -1
ChkAjuste.Checked = False
DivAjuste.Visible = False
End Sub
@@ -5047,8 +5076,8 @@ Partial Class PV
CargaPSAjuste()
DdlPSAjuste.SelectedValueExist(Dr("CvePS").ToString)
TxtFechaAjuste.Text = Dr("FechaAjuste").ToString.ToDate.ToShortDateString
TxtPUFactura.Text = Dr("PUFactura").ToString.ToDecimal.FormatoNumero(2)
TxtPUFactura.Enabled = Not Dr("CveVenta").ToString.ToEntero > 0
TxtPrecio.Text = Dr("PUFactura").ToString.ToDecimal.FormatoNumero(2)
TxtPrecio.Enabled = Not Dr("CveVenta").ToString.ToEntero > 0
End If
End Sub
Protected Sub BtnCalculaMesesUso_Click(sender As Object, e As EventArgs)
@@ -5056,7 +5085,17 @@ Partial Class PV
End Sub
Private Sub CalculaMesesUso()
TxtMesesUso.Text = DateDiff(DateInterval.Month, TxtFechaAjuste.Text.ToDate, Now).ToEntero.ToString
Dim FechaI = TxtFechaAjuste.Text.ToDate.AddDays(1)
Dim FechaF = Now
'Dim NumDiasAlMes As Double = (365 / 12)
'Dim DiasTranscurridos = DateDiff(DateInterval.Day, FechaI, FechaF)
'Dim MesesTranscurridos As Double = DiasTranscurridos / NumDiasAlMes
'Dim NoMesesTrascurridos = Math.Ceiling(MesesTranscurridos)
TxtMesesUso.Text = (DateDiff(DateInterval.Month, FechaI, FechaF) + 1).ToString()
CalculaPorcentajeAjuste()
End Sub
@@ -5099,7 +5138,7 @@ Partial Class PV
If ObjAcum.GarantiasMesesGet(-1, UsuarioActual.CveEmpresa, CveMarca, DdlTipoUso.SelectedValue.ToEntero, TxtMesesUso.Text.ToEntero) Then
If ObjAcum.DtResultados.Rows.Count > 0 Then
TxtPorcentajeAjuste.Text = (ObjAcum.DtResultados.Rows(0)("Valor").ToString.ToDouble / 100).ToString
TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDouble * TxtPUFactura.Text.ToDouble).FormatoNumero
TxtImporteAjuste.Text = (TxtPorcentajeAjuste.Text.ToDouble * TxtPrecio.Text.ToDouble).FormatoNumero
Dim CargoActual As Decimal = 0
Dim CargoAnterior As Decimal = 0
@@ -5128,8 +5167,8 @@ Partial Class PV
End If
End If
TxtDescuentoAjuste.Text = ((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior)).FormatoNumero
TxtDescuentoAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoActual - CargoAnterior).FormatoNumero}."
TxtDescuentoAjuste.Text = ((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior)).FormatoNumero
TxtDescuentoAjuste.ToolTip = $"La diferencia de ajuste fue: {(TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble).FormatoNumero()}. La diferencia de tamaños fue: {(CargoActual - CargoAnterior).FormatoNumero}."
End If
End If
ObjAcum.Dispose()
@@ -5163,7 +5202,7 @@ Partial Class PV
'End Function
Private Sub GuardaAjuste()
TxtPUFactura.Text = TxtPrecio.Text
TxtPrecio.Text = TxtPrecio.Text
UpAjuste.Update()
Dim CargoAnterior As Double = 0
@@ -5187,7 +5226,7 @@ Partial Class PV
Row("CvePS") = DdlPSAjuste.SelectedValue
Row("PS") = DdlPSAjuste.SelectedItem.Text
Row("CveVenta") = DdlFacturas.SelectedValue
Row("PUFactura") = TxtPUFactura.Text.ToDouble
Row("PUFactura") = TxtPrecio.Text.ToDouble
Row("Cantidad") = 1
Dim CveUM As Integer = -1
If DdlPSAjuste.SelectedValue.ToEntero > 0 Then
@@ -5217,7 +5256,7 @@ Partial Class PV
TmpDTAjustes.Rows(IndexAjuste)("CvePS") = DdlPSAjuste.SelectedValue
TmpDTAjustes.Rows(IndexAjuste)("PS") = DdlPSAjuste.SelectedItem.Text
TmpDTAjustes.Rows(IndexAjuste)("CveVenta") = DdlFacturas.SelectedValue
TmpDTAjustes.Rows(IndexAjuste)("PUFactura") = TxtPUFactura.Text.ToDouble
TmpDTAjustes.Rows(IndexAjuste)("PUFactura") = TxtPrecio.Text.ToDouble
TmpDTAjustes.Rows(IndexAjuste)("Cantidad") = 1
Dim CveUM As Integer = -1
If DdlPSAjuste.SelectedValue.ToEntero > 0 Then
@@ -5244,7 +5283,7 @@ Partial Class PV
End If
End If
Dr("Descuento") = Math.Round((TxtPUFactura.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior), NumeroDecimales)
Dr("Descuento") = Math.Round((TxtPrecio.Text.ToDouble - TxtImporteAjuste.Text.ToDouble) - (CargoActual - CargoAnterior), NumeroDecimales)
Dim TotalCalculableImpuestos As Decimal = (Dr("Cantidad").ToString.ToDecimal * (Dr("PU").ToString.ToDecimal)) - Dr("Descuento").ToString.ToDecimal
Dr("ImporteIVA") = Math.Round(Dr("PorcentajeIVA").ToString.ToDecimal * TotalCalculableImpuestos, NumeroDecimales)
@@ -5281,8 +5320,8 @@ Partial Class PV
DivAjuste.Attributes.Add("class", "col-md-6")
DivDatosVenta.Attributes.Remove("class")
DivDatosVenta.Attributes.Add("class", "col-md-6")
TxtPrecio.Attributes.Add("onKeyUp", $"CambiaAjuste(this,{TxtPUFactura.ClientID});")
TxtPUFactura.Text = TxtPrecio.Text
TxtPrecio.Attributes.Add("onKeyUp", $"CambiaAjuste(this,{TxtPrecio.ClientID});")
TxtPrecio.Text = TxtPrecio.Text
Else
For Each Gvr As GridViewRow In GvRecepcionUsados.Rows
If Gvr.RowType = DataControlRowType.DataRow Then
@@ -5363,7 +5402,7 @@ Partial Class PV
Row("CveVentaDetalle") = -1
Row("PU") = Gvr.DataKey("Cargo").ToDouble
Row("CveBCIUsado") = Gvr.FCDropDownList("DdlBCIUsado").SelectedValue.ToEntero
Row("CveModeloAuto") = Gvr.FCDropDownList("DdlModeloAuto").SelectedValue.ToEntero
Row("CveModeloAuto") = DdlModeloAuto.SelectedValue.ToEntero
TmpDTRecepcionUsados.Rows.Add(Row)
End If
@@ -5376,13 +5415,13 @@ Partial Class PV
Next
StrCargos.Remove(StrCargos.Length - 1, 1)
If TotalCantidad > TmpDT.FiltraParametros($"EsCargo = True AND CvePS IN ({StrCargos})").SUMD("Cantidad") Then
Dim drt As DataRow() = TmpDT.Select("CvePS = " & CvePS)
TmpDT.Rows.Remove(drt(0))
'If TotalCantidad > TmpDT.FiltraParametros($"EsCargo = True AND CvePS IN ({StrCargos})").SUMD("Cantidad") Then
' Dim drt As DataRow() = TmpDT.Select("CvePS = " & CvePS)
' TmpDT.Rows.Remove(drt(0))
Alert("No puede tener una cantidad mayor a la de los cargos", TipoMensaje.MsgAdvertencia)
Exit Sub
End If
' Alert("No puede tener una cantidad mayor a la de los cargos", TipoMensaje.MsgAdvertencia)
' Exit Sub
'End If
For Each Dr As DataRow In TmpDT.FiltraParametros($"EsCargo = True AND CvePS IN ({StrCargos})").Rows
@@ -5628,6 +5667,46 @@ Partial Class PV
End Sub
#End Region
Protected Sub BtnPDFHistorial_Click(sender As Object, e As EventArgs)
Dim Imagen As New System.IO.FileInfo(String.Format("{0}/Logo.png", UsuarioActual.Empresa.Ruta))
Dim logouri = String.Format("{0}://{1}:{2}/Empresas/{3}/Logo.png", Request.Url.Scheme, Request.Url.Host, Request.Url.Port, UsuarioActual.CveEmpresa)
Dim DtDatos As New DataTable
Dim params As New List(Of ReportParameter)
'Informacion Distribuidor
params.Add(New ReportParameter("NombreCliente", LtlCliente.Text))
params.Add(New ReportParameter("CiudadEstado", LblCiudad.Text.Trim + ", " + LblEstado.Text))
params.Add(New ReportParameter("TelCliente", LblTelefono.Text))
params.Add(New ReportParameter("NombreEmpresa", UsuarioActual.Empresa.Empresa))
params.Add(New ReportParameter("Consec", TxtConsecutivoAjuste.Text.Trim))
params.Add(New ReportParameter("FolioAcuse", If(DdlFolioGarantia.SelectedValue.ToEntero = -1, "", DdlFolioGarantia.SelectedItem.Text)))
'Informacion de Garantia o ajuste
params.Add(New ReportParameter("FechaInst", TxtFechaAjuste.Text.Trim))
params.Add(New ReportParameter("Fecha", Now.ToShortDateString))
params.Add(New ReportParameter("Defecto", If(DdlTipoDefecto.SelectedValue.ToEntero = -1, "", DdlTipoDefecto.SelectedItem.Text)))
params.Add(New ReportParameter("MesesUso", TxtMesesUso.Text.Trim))
params.Add(New ReportParameter("PorcentajeAjuste", TxtPorcentajeAjuste.Text.Trim))
'Informacion Acumulador
params.Add(New ReportParameter("CodEnsamble", If(TxtCodEnsamble.Text.Length > 7, TxtCodEnsamble.Text.Trim.Substring(0, 7), "")))
params.Add(New ReportParameter("CodLinea", TxtCodLinea.Text.Trim))
params.Add(New ReportParameter("CodInspeccion", TxtCodInspeccion.Text.Trim))
'Informacion Vehiculo
params.Add(New ReportParameter("MarcaAuto", If(DdlPS.SelectedValue.ToEntero > 0, DtModelosAuto.FiltroPrimeroValor("Marca", $"CveModeloAuto ={DdlModeloAuto.SelectedValue}"), "")))
params.Add(New ReportParameter("TipoAuto", If(DdlPS.SelectedValue.ToEntero > 0, DtModelosAuto.FiltroPrimeroValor("Modelo", $"CveModeloAuto ={DdlModeloAuto.SelectedValue}"), "")))
'Informacion Consumidor
params.Add(New ReportParameter("Direccion", LblDireccion.Text))
If Imagen.Exists Then
params.Add(New ReportParameter("LogoPath", logouri))
Else
params.Add(New ReportParameter("LogoPath", ""))
End If
ImprimirPDF("Empresas/Grales/Formatos/Ajuste.rdlc", DtDatos, params, "Reporte de Ajuste", "PDF")
End Sub
End Class

View File

@@ -122,57 +122,62 @@ public partial class Ventas_RepCancelacionesPorRespuesta : ClsPaginas
sb.AppendFormat("Es Cancelable: {0} <br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EsCancelable);
sb.AppendFormat("Estatus de Cancelación: {0} <br/><br/>", string.IsNullOrEmpty(resp.EsCancelable) ? "Desconocido" : resp.EstatusCancelacion);
//var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje;
if (!UsuarioActual.Empresa.FacturaProduccion && (string.IsNullOrEmpty(uuid) || uuid.Contains("test")))
{
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC).Mensaje;
//sb.AppendFormat("{0} <br/>", FueCancelado);
//if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
//{
// Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
//}
if ((resp.EsCancelable.ToUpper() == "NO CANCELABLE"))
{
sb.Append("Esta factura no es cancelable.");
return sb.ToString();
}
if (resp.Estado.ToUpper().Trim() == "CANCELADO" || resp.EstatusCancelacion.ToUpper() == "PLAZO VENCIDO")
{
CveEstatus = 5;
var solicitud = new WSGF.Service1SoapClient();
var acuse = solicitud.GetAcuse(emisor, "rene.molina@adsistemas.mx", "rene2018", uuid);
if (acuse.Estado == 0)
{
var xmlAcuse = new System.Xml.XmlDocument();
xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64));
CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")[0].InnerText;
CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
}
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion).Mensaje;
sb.AppendFormat("{0} <br/>", FueCancelado);
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
{
Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
}
}
else
{
if ((resp.EsCancelable.ToUpper() == "NO CANCELABLE"))
{
sb.Append("Esta factura no es cancelable.");
return sb.ToString();
}
sb.AppendFormat("{0} <br/>", FueCancelado);
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
{
Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
}
}
else if (resp.EstatusCancelacion.ToUpper() == "SOLICITUD RECHAZADA")
{
//ASIGNAMOS ESTATUS EMITIDA
CveEstatus = 3;
var ObjVentas = new ClsVentas();
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
{
sb.Append("El estatus de la factura fue cambiado a 'Emitida'.");
}
else
{
sb.Append("Ocurrió un error al cambiar el estatus de la factura.");
}
ObjVentas.Dispose();
if (resp.Estado.ToUpper().Trim() == "CANCELADO" || resp.EstatusCancelacion.ToUpper() == "PLAZO VENCIDO")
{
CveEstatus = 5;
var solicitud = new WSGF.Service1SoapClient();
var acuse = solicitud.GetAcuse(emisor, "rene.molina@adsistemas.mx", "rene2018", uuid);
if (acuse.Estado == 0)
{
var xmlAcuse = new System.Xml.XmlDocument();
xmlAcuse.LoadXml(DecodeBase64(acuse.CfdiB64));
CancelacionAcuse = xmlAcuse.GetElementsByTagName("SignatureValue")[0].InnerText;
CancelacionFecha = xmlAcuse.SelectSingleNode("Acuse").Attributes["Fecha"].Value.ToDate();
}
var FueCancelado = CancelarDocumento(CveVenta, CveEstatus, CveCliente, Folio, uuid, CancelacionAcuse, CancelacionFecha, TipoDocto, total.ToDouble(), UsuarioActual.Empresa.CvePAC, EsRefacturacion: EsRefacturacion).Mensaje;
sb.AppendFormat("{0} <br/>", FueCancelado);
if (CveEstatus.Contiene(4, 5) && EsRefacturacion)
{
Response.Redirect(string.Format("Ventas.aspx?CveDevolucion={0}&NuevaFactura=1", CveVenta));
}
}
else if (resp.EstatusCancelacion.ToUpper() == "SOLICITUD RECHAZADA")
{
//ASIGNAMOS ESTATUS EMITIDA
CveEstatus = 3;
var ObjVentas = new ClsVentas();
if (ObjVentas.UpdateEstatusVenta(CveVenta, CveEstatus, UsuarioActual.CveEmpresa))
{
sb.Append("El estatus de la factura fue cambiado a 'Emitida'.");
}
else
{
sb.Append("Ocurrió un error al cambiar el estatus de la factura.");
}
ObjVentas.Dispose();
}
}
}
else

View File

@@ -3417,7 +3417,7 @@
</div>
<div class="col-md-8">
<asp:DropDownList ID="DdlTipoRelacion" runat="server" Width="250px" CssClass="select2me">
<asp:DropDownList ID="DdlTipoRelacionAnticipo" runat="server" Width="250px" CssClass="select2me">
<asp:ListItem Text="-" Value="-1"></asp:ListItem>
<asp:ListItem Text="07 - CFDI por aplicación de anticipo" Value="7"></asp:ListItem>
</asp:DropDownList>

View File

@@ -1335,6 +1335,17 @@ Partial Class Ventas
ViewState("CveOC") = value
End Set
End Property
Private Property RegistroxOC As Boolean
Get
Return CBool(IfNull(ViewState("RegistroxOC"), False))
End Get
Set(value As Boolean)
ViewState("RegistroxOC") = value
End Set
End Property
Private Property EnviarCorreoCliente As Boolean
Get
Return CBool(ViewState("EnviarCorreoCliente").ToString)
@@ -3784,7 +3795,7 @@ Partial Class Ventas
'DdlAmortizacionConceptos.SelectedValue = DbRowVenta("AnticipoPosicion").ToString
'ChkAnticipoEnSubTotal.Checked = DbRowVenta("AnticipoEnSubTotal").ToString = "True"
DdlTipoAmortizacionAnticipo.SelectedValueExist(DbRowVenta("CveTipoAmortizacionAnticipo"))
DdlTipoRelacion.SelectedValueExist(DbRowVenta("CveTipoRelacion"))
DdlTiposRelacion.SelectedValueExist(DbRowVenta("CveTipoRelacion"))
'HdnAmortizacion.Value = LblAmort.Text.ToDouble.ToString
'HdnSubTotalDescuestos.Value = (TxtSubTotal.Text.Replace(",", "").ToDouble - LblDescuentos.Text.Replace(",", "").ToDouble - LblAmortizacion.Text.Trim.Replace(",", "").ToDouble - TxtRetISR.Text.Replace(",", "").ToDouble).FormatoNumero(2)
@@ -5612,7 +5623,7 @@ Partial Class Ventas
End Sub
Protected Sub GvPS_RowUpdating(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewUpdateEventArgs) Handles GvPS.RowUpdating
'Dim TipoDescuento As Integer
Dim Cantidad, PU, Descuento As Decimal
Dim Cantidad, PU, Descuento, CantidadInventario As Decimal
Dim CuentaPredial As String
Cantidad = GvPS.Rows(e.RowIndex).FCTextBox("TxtCantidad").Text.ToDecimal
@@ -5620,6 +5631,7 @@ Partial Class Ventas
Descuento = Math.Round(GvPS.Rows(e.RowIndex).FCTextBox("TxtDescuento").Text.ToDecimal, NumeroDecimales)
CuentaPredial = GvPS.Rows(e.RowIndex).FCTextBox("TxtPredial").Text.Trim
Dim DatarowPS As DataRow = Nothing
DatarowPS = GlobalDTPS(UsuarioActual.CveEmpresa, CvePS:=TmpDT.Rows(e.RowIndex)("CvePS").ToString.ToEntero).FiltroPrimero("") ' Estado = -1
@@ -5632,6 +5644,136 @@ Partial Class Ventas
End If
End If
'si es remisión, ingreso, anticipo debe de considerar el preciominimo
If Not UsuarioActual.TienePermisoProceso(169) Then ' NO VALIDA EXISTENCIAS NI COSTO - PERMISO PARA NO VALIDAR
Dim CvePS As Integer = DatarowPS("CvePS").ToString.ToEntero
CantidadInventario = GvPS.Rows(e.RowIndex).DataKey("CantidadInventario").ToString.ToDecimal
Dim ValidaExistencia As Boolean = True
If CantidadInventario > 0 Then 'si ya hay algo surtido, que no valide existencia
ValidaExistencia = False
End If
'SOLO VALIDA EXISTENCIAS Y COSTO: SI USA INVENTARIOS, SOLO PRODUCTOS TIPO PRODUCTO, SOLO REMISIONES E INGRESOS
If UsuarioActual.Empresa.UsaInventarios AndAlso (DdlTipoComprobante.SelectedValue.Contiene("Rem", "Ing", "PA") Or (DdlTipoComprobante.SelectedValue.Contiene("Cot") And UsuarioActual.CveEmpresa.Contiene(119))) Then
Dim ObjInventarios As New ClsInventarios
Dim Existencia As Decimal
If ValidaExistencia Then
Existencia = ObjInventarios.GetExistenciasPS(CvePS, -1, UsuarioActual.CveEmpresa, -1, FechaMovto:=DateTime.Today.AddDays(1).ToString("yyyy/MM/dd HH:mm"), CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero, CveVendedor:=DdlVendedor.SelectedValue.ToEntero, CveCliente:=If(UsuarioActual.Empresa.Funcionalidad(146) = "1", -1, CveCliente), ExcluyeAdelantado:=1, PendientePorSurtir:=1, RestringirAlmacenes:=1, ExcluyeApartados:=-1)
End If
Dim Costo As Decimal = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, DdlSubProyectoDatos.SelectedValue.ToEntero)
'si el costo es cero, puede ser que no halla movimientos del producto, en esa sucursal. y se volverá a sacar sin especificar sucursal
If Costo = 0 Then Costo = ObjInventarios.GetCostoPS(CvePS, TxtCantidad.Text.Trim.ToDouble, -1, "-1", TxtFecha.Text.ToDate, -1)
ObjInventarios.Dispose()
Dim PrecioMinimo As Decimal = 0
'RMF. condicion temporal, para reubicación, precio mínimo
If UsuarioActual.CveEmpresa = 119 Then
'Dim CvePrecioLista As Integer = 38
Dim objPS As New ClsProductosServicios
If objPS.GetPSSucursalesALL(CvePS, UsuarioActual.CveEmpresa, CveSubProyecto:=DdlSubProyectoDatos.SelectedValue.ToEntero) Then
PrecioMinimo = objPS.DtResultados.FiltroPrimeroValor("PrecioMinimo", "").ToDecimal
If PrecioMinimo > 0 Then
Costo = PrecioMinimo
End If
End If
objPS.Dispose()
End If
If ValidaExistencia AndAlso DdlTipoComprobante.SelectedValue <> "Cot" And ChkSinExistencia.Checked = False AndAlso Not RegistroxOC Then
'VALIDA EXISTENCIA
If UsuarioActual.CveEmpresa.Contiene({72, 80, 119}) Then
If Existencia - TmpDT.SUM("Cantidad", $"CvePS = {CvePS}") < TxtCantidad.Text.ToDouble Then
Alert("No cuenta con la cantidad suficiente en inventario. Cuenta con " + Existencia.FormatoNumero(2) + ".", TipoMensaje.MsgAdvertencia)
End If
End If
End If
'VALIDA COSTOS
If Not CveContrato > 0 Then
'BANDERAS PARA VALIDACIONES
Dim EsValido = False
Dim EsValidoMayor = False
Dim CostoMenor = 0.0D
Dim CostoMayor = 0.0D
'PRECIO MINIMO
If UsuarioActual.Empresa.Funcionalidad(129).ToEntero > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then
CostoMenor = Costo + ((UsuarioActual.Empresa.Funcionalidad(129).ToDecimal / 100) * Costo)
If PrecioMinimo > 0 Then CostoMenor = PrecioMinimo
'SI EL PRECIO ES MAYOR AL COSTO, SI PASA
If PU * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) >= CostoMenor Then
EsValido = True
End If
Else
EsValido = True
End If
'PRECIO MAXIMO
If UsuarioActual.Empresa.Funcionalidad(133).ToEntero > 0 AndAlso UsuarioActual.CveUsuario <> 1560 Then
CostoMayor = Costo + ((UsuarioActual.Empresa.Funcionalidad(133).ToDecimal / 100) * Costo)
'SI EL PRECIO ES MAYOR AL COSTO MAXIMO, SI PASA
If PU * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) <= CostoMayor Then
EsValidoMayor = True
End If
Else
EsValidoMayor = True
End If
''VALIDA PROMOCION: SI TIENE PROMOCION Y EL PRECIO ES MENOR AL PRECIO DE PROMOCION, NO PASA | SI YA CUMPLE NO VUELVE A VALIDAR
''SIRVE PARA VALIDAR PRECIOS DEBAJO DEL PRECIO MINIMO PERMITIDO
'If Not EsValido Then
' If DtPromociones.FiltraParametros($"CvePS = {CvePS}").Rows.Count > 0 Then
' If PU * If(DdlMoneda.SelectedValue.ToEntero = 1, 1, TxtTipoCambio.Text.ToDecimal) >= DtPromociones.FiltroPrimeroValor("PUPromocion", $"CvePS = {CvePS}").ToDecimal Then
' EsValido = True
' End If
' End If
'End If
'NO DEJA REGISTRAR MENOS AL PRECIO MINIMO
Dim MensajeCosto As New StringBuilder
Dim TienePermisoImportes As Boolean = UsuarioActual.TienePermisoProceso(201)
If Not EsValido Then
MensajeCosto.AppendFormat("El Producto <b>{0}</b>. No se puede vender a un precio menor de su Costo <br/>", DatarowPS("PS").ToString)
If TienePermisoImportes Then
MensajeCosto.AppendFormat("El costo del producto es: <b>${0}</b> <br/>", Costo)
MensajeCosto.AppendFormat("El rango menor aceptado es: {0}% <b>${1}</b> <br/>", UsuarioActual.Empresa.Funcionalidad(129).ToEntero, CostoMenor)
MensajeCosto.AppendFormat("El precio indicado es: <b>${0}</b> ({1}% de ganancia) <br/>", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero)
End If
Alert(String.Format(MensajeCosto.ToString), TipoMensaje.MsgAdvertencia)
e.Cancel = True
Exit Sub
End If
'NO DEJA REGISTRAR MAS AL PRECIO MAXIMO
If Not EsValidoMayor Then
MensajeCosto.AppendFormat("El Producto <b>{0}</b>. No se puede vender a un precio mayor de su rango aceptado<br/>", HdnPS.Value)
If TienePermisoImportes Then
MensajeCosto.AppendFormat("El costo del producto es: <b>${0}</b> <br/>", Costo)
MensajeCosto.AppendFormat("El rango mayor aceptado es: {0}% <b>${1}</b> <br/>", UsuarioActual.Empresa.Funcionalidad(133).ToEntero, CostoMayor)
MensajeCosto.AppendFormat("El precio indicado es: <b>${0}</b> ({1}% de ganancia) <br/>", PU.FormatoNumero, (If(Costo > 0, ((PU - Costo) * 100) / Costo, 0)).FormatoNumero)
End If
Alert(MensajeCosto.ToString, TipoMensaje.MsgAdvertencia)
e.Cancel = True
Exit Sub
End If
End If
End If
End If
If TmpDT.Rows(e.RowIndex)("CvePS").ToString <> GvPS.Rows(e.RowIndex).FCDropDownLost("DdlPS").SelectedValue Then
'eliminar y cargar el ps ***
Dim DdlUM As DropDownList = GvPS.Rows(e.RowIndex).FCDropDownList("DdlUnidadMedida")
@@ -6431,8 +6573,12 @@ Partial Class Ventas
actualindex = actualindex + 1
Next
End If
Dim EsNCAmortizacion As Boolean = False
If DdlTipoComprobante.SelectedValue = "Egs" AndAlso ChkAplicaNCAnticipo.Checked Then
EsNCAmortizacion = True
End If
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS, ObjEventos, ObjCGame, ObjClientes)
GuardarVenta(ObjVentas, ObjConta, ObjInventario, ObjContr, ObjFactura, TmpDT, ObjFactura.CveNCaVincular, ObjContPaq, ObjBancos, ObjOS, ObjEventos, ObjCGame, ObjClientes, EsNCAmortizacion:=EsNCAmortizacion)
'SI ES REFACTURACION
Dim ObjNC As List(Of Object) = Nothing
@@ -6455,57 +6601,9 @@ Partial Class Ventas
End If
End If
''[IPP]
''DATATABLES A USAR
'Dim DtSites As New DataTable
'Dim DtExcel As New DataTable
''CARGAS EXCEL EN DATATABLE
'DtExcel = TmpDT
''CARGAS LOS SITES REGISTRADOS
'If ObjBancos.GetBancos() Then
' DtSites = ObjBancos.DtResultados
'End If
''PROCESAS EXCEL
'Dim CveSiteActual = -1
'For Each Row As DataRow In TmpDT.Rows
' 'VALIDA QUE EXISTA EL SITE
' If DtExcel.Select($"Site = {Row("SITE")}").Count = 0 Then 'SI NO EXISTE AGREGA EL SITE
' CveSiteActual = ObjBancos.AddComplementoPago(-1, -1, "", -1, -1, -1)
' 'VALIDAS QUE SE HALLA AGREGADO
' If CveSiteActual > 0 Then
' 'AGREGA NUEVO SITE AL DATATABLE TEMPORAL DE SITES
' Dim DrNuevoSite = DtExcel.NewRow
' DrNuevoSite("CVE") = CveSiteActual
' DrNuevoSite("SITE") = Row("SITE")
' Else
' Alert("ERROR AL AGREGAR EL SITE")
' Exit For
' End If
' ElseIf DtExcel.Select($"Site = {Row("SITE")}").Count = 1 Then 'SI EXISTE OBTIENES CVE
' CveSiteActual = DtExcel.Select($"Site = {Row("SITE")}")(0)("Cve").ToString.ToEntero
' Else
' Alert("ERROR SOLO DEBE DAR RESULTADO 0 ó 1")
' Exit For
' End If
' 'AGREGA A TABLA CON LA DE MAS INFORMACION
' If Not ObjBancos.AddBancos_EstatusIE(CveSiteActual, Row("CAMPOS").ToString, Row("CAMPOS_EXTRA").ToString.ToEntero) Then
' Alert("ERROR AL GUARDAR")
' Exit For
' End If
'Next
'SI ES amortizacion 3.3
Dim Obj2 As New List(Of Object)
'SI ES amortizacion 3.3
Dim Obj2 As New List(Of Object)
If ErrorList.Count = 0 Then
' cambiar la condicion para saber si hay seleccionado
@@ -7016,7 +7114,7 @@ Partial Class Ventas
ObjFacturaDevolucion.UsoCFDI = DdlUsoCFDI.SelectedItem.Text
ObjFacturaDevolucion.ClaveUsoCFDI = GlobalDTSATUsosCFDI.FiltroPrimeroValor("UsoCFDI", $"CveUsoCFDI = {DdlUsoCFDI.SelectedValue}")
ObjFacturaDevolucion.CveTipoRelacion = DdlTipoRelacion.SelectedValue.ToEntero
ObjFacturaDevolucion.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero
ObjFacturaDevolucion.TipoRelacion = "07"
Dim Fol As New List(Of String)
Fol.Add(FolioFiscalRelacionado)
@@ -7311,6 +7409,8 @@ Partial Class Ventas
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
DtVentasNC.Rows(0)("Importe") = Total
DtVentasNC.Rows(0)("TC") = factura.TipoCambio
DtVentasNC.Rows(0)("TCCambioValuacion") = factura.TipoCambio
End If
ObjFacturaDevolucion.Timbre = PreParaTimbre(ObjFacturaDevolucion)
@@ -7846,7 +7946,7 @@ Partial Class Ventas
End If
'Amortizacion
ObjFactura.CveTipoRelacion = DdlTipoRelacion.SelectedValue.ToEntero
ObjFactura.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero
If ObjFactura.CveTipoRelacion > 0 Then
Select Case ObjFactura.CveTipoRelacion
Case 7
@@ -7859,16 +7959,19 @@ Partial Class Ventas
ObjFactura.AplicaDevolucion = Me.AplicaDevolucion
ObjFactura.CveTipoAmortizacionAnticipo = DdlTipoAmortizacionAnticipo.SelectedValue.ToEntero
ObjFactura.Timbre.Comprobante.TipoComprobante = If(ObjFactura.TipoDocto.Contiene("Ing", "Ant"), "I", If(ObjFactura.TipoDocto.Contiene("Egs", "Dev"), "E", ""))
If ObjFactura.Timbre.Comprobante.TipoComprobante = "E" Then
If ObjFactura.TipoDocumento.Contiene("Nota de Crédito") Then
If ObjFactura.TipoDocto = "Egs" Then
ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "01"
ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Nota de Crédito aplicada a Ingreso"
End If
If ObjFactura.TipoDocumento.Contiene("Nota de Devolución") Then
If ObjFactura.TipoDocto = "Dev" Then
ObjFactura.Timbre.CFDIRelacionados.TipoRelacion = "03"
ObjFactura.Timbre.CFDIRelacionados.TipoRelacionTexto = "Devolución aplicada a Ingreso"
End If
ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero
ObjFactura.Timbre.CFDIRelacionados.UUID.Add(HdnFolioFiscalNC.Value)
End If
' cuando es refacturacoin es cfdirelacionado, con relacion 04
@@ -7879,18 +7982,12 @@ Partial Class Ventas
End If
If ObjFactura.TipoDocto = "Egs" Then
ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero
End If
If ObjFactura.TipoDocto = "Dev" Then
ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero
End If
If ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso NuevaFactura = 1 Then ' refacturación
ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero
End If
If ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso DdlTiposRelacion.SelectedValue.ToEntero > 0 Then ' refacturación
ObjFactura.CveTipoRelacion = DdlTiposRelacion.SelectedValue.ToEntero
If ObjFactura.TipoDocto.Contiene("Ing", "Ant") AndAlso DdlTipoRelacionAnticipo.SelectedValue.ToEntero > 0 Then ' refacturación
ObjFactura.CveTipoRelacion = DdlTipoRelacionAnticipo.SelectedValue.ToEntero
If GVAnticipos.Rows.Count > 0 Then
For Each gvr As GridViewRow In GVAnticipos.Rows
If gvr.FCCheckBox(String.Format("Chk{0}", gvr.RowIndex)).Checked AndAlso gvr.DataKey("CveConceptoContable") = "12" Then ' solo notas de crédito
@@ -8288,7 +8385,7 @@ Partial Class Ventas
Else
'SI LA FACTURA VIENE DE SER CANCELADA SISTEMA CUANDO SE REFACTURO NO HAY QUE RELACIONAR
If (CveEstatusFacturaPadre > 0 AndAlso CveEstatusFacturaPadre <> 4) OrElse (DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0) Then
If (CveEstatusFacturaPadre > 0 AndAlso CveEstatusFacturaPadre <> 4) OrElse (DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0) OrElse HdnFolioFiscalNC.Value.ToString <> "" Then
If Obj.CveTipoRelacion > 0 Then
Select Case Obj.CveTipoRelacion
@@ -8655,6 +8752,7 @@ Partial Class Ventas
If GVOC.Rows.Count > 0 Or GvOCPS.Rows.Count > 0 Then
'Checa las facturas selecionadas
VerificaOrdenesCompra(DTOrdenesCompra)
RegistroxOC = False
Dim dtSeleccionadas As DataTable = DTOrdenesCompra.FiltraParametros("Aplicado = True")
If GvPS.Rows.Count > 0 Then
@@ -8697,7 +8795,7 @@ Partial Class Ventas
sb.Remove(sb.Length - 1, 1)
If ObjClientes.GetVentasOCTotales(CveCliente, sb.ToString, If(ChkPSOC.Checked, 2, 1)) Then
DTOrdenesCompraPS = ObjClientes.DtResultados
RegistroxOC = True
Dim tCantidad As Decimal = 0
For Each Dr As DataRow In DTOrdenesCompraPS.Select()
tCantidad = If(ChkPSOC.Checked, GvOCPS.Rows(IndiceGVDataKey(GvOCPS, "CveOrdenCompraDetalle", $"{Dr("CveOrdenCompraDetalle")}")).FCTextBox("TxtCantidadOC").Text, Dr("Cantidad")).ToString.ToDecimal
@@ -9134,7 +9232,7 @@ Partial Class Ventas
If ErrorList.Count = 0 Then
'prepoliza
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos)
GuardarVentaPrePolizas(ObjConta, factura, TmpDTDetalle, CveNCaVincular, objContPaqi, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion)
If ErrorList.Count = 0 Then
'inventarios
If Not EsNCAmortizacion Then
@@ -9182,7 +9280,7 @@ Partial Class Ventas
If DdlTipoComprobante.SelectedValue <> "Cot" Then
If factura.CvePrePoliza > 0 Then
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, 1, ObjBancos, ObjVentas, ObjEventos:=ObjEventos) Then
If ProcesoPrepolizas(ObjConta, factura, CveIE, TmpDTDetalleMovimientos, objContPaqi, 1, ObjBancos, ObjVentas, ObjEventos:=ObjEventos, EsNCAmortizacion:=EsNCAmortizacion) Then
ErrorList.Add("Ocurrió un error al agregar los Movimientos de la prepoliza.<br />Revise su factura y cualquier detalle comuníquese a Soporte Técnico")
End If
@@ -9440,9 +9538,8 @@ Partial Class Ventas
TipoCambioNC = GlobalTipoCambio(TxtFecha.Text.ToDate).ToDecimal
End If
If Not EsNCAmortizacion Then
'APLICA NC SALDOS DIRECTOS
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
'APLICA NC SALDOS DIRECTOS
If DtVentasNC IsNot Nothing AndAlso DtVentasNC.Rows.Count > 0 Then
For Each Dr As DataRow In DtVentasNC.Rows
@@ -9580,8 +9677,6 @@ Partial Class Ventas
Exit For
End If
End If
End If
'APLICA DEVOLUCION SALDOS DIRECTOS
If AplicaDevolucion Then
@@ -9901,6 +9996,13 @@ Partial Class Ventas
CveVentaAmortizacionAplicar = ObjFactura.CveVenta
End If
''Cuando se está amortizando con un anticipo y es la modalidad de NC
'If ObjFactura.TipoDocto.Contiene("Ing") AndAlso CveAnticipo > 0 AndAlso DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then
' ConceptoContableAplicar = 11
' CveVentaAplicar = CveAnticipo
' CveVentaAmortizacionAplicar = ObjFactura.CveVenta
'End If
' If UsuarioActual.CveEmpresa = 119 Then
'código fijo en base el porcentaje iva, que se afecten las clasificaciones
@@ -9976,20 +10078,12 @@ Partial Class Ventas
importeMovimiento = 0
Case 150 'Descuento sobre ventas
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") Then
If ObjFactura.TipoDocto.Contiene("Egs", "Dev") AndAlso Not EsNCAmortizacion Then
Dim ConceptoContableAplicar = 150
Dim CveVentaAplicar = ObjFactura.CveVenta
Dim CveVentaAmortizacionAplicar = -1
'cuando es NC, por amortización de anticipo, no debe de registrar el concepto 11,
'pero cuando es NC y se aplicó anticipo, debe de restarle el importe
If ObjFactura.TipoDocto.Contiene("Egs") And CveAnticipo > 0 AndAlso ChkAplicaNCAnticipo.Checked = True Then
ConceptoContableAplicar = 11
CveVentaAplicar = CveAnticipo
CveVentaAmortizacionAplicar = ObjFactura.CveVenta
End If
If UsuarioActual.CveEmpresa = 119 Then
'código fijo en base el porcentaje iva, que se afecten las clasificaciones
@@ -9998,16 +10092,6 @@ Partial Class Ventas
'se excluyen las clasificaciones anteriores para que se asignen las de ingreso
If Not TmpDTDetalle(i)("CveClasificacion").ToString.Contiene("19958", "19933", "18097") Then
'If TmpDTDetalle(i)("PorcentajeIVA").ToString.ToDecimal > 0 Then
' If TmpDTDetalle(i)("PorcentajeIVA").ToString.ToDecimal = 0.08 Then
' TmpDTDetalle(i)("CveClasificacion") = 20242 'clasif: ventas tasa 8%
' Else
' TmpDTDetalle(i)("CveClasificacion") = 19929 'clasif: ventas tasa 16%
' End If
'Else
' TmpDTDetalle(i)("CveClasificacion") = 19930 'clasif: ventas tasa 0%
'End If
If GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows.Count > 0 Then
TmpDTDetalle(i)("CveClasificacion") = GlobalDTClasificacionPorcentaje(UsuarioActual.CveEmpresa, PorcentajeIVA:=TmpDT.MAX("PorcentajeIVA").ToDouble).Rows(0)("CveClasificacion").ToString
End If
@@ -15507,7 +15591,7 @@ Partial Class Ventas
End If
Catch ex As Exception
Alert("No se pudo verificar la fecha del certificado", TipoMensaje.MsgError)
Alert("No se pudo verificar la fecha del certificado", TipoMensaje.ToastError)
End Try
End Sub
#End Region
@@ -15754,6 +15838,10 @@ Partial Class Ventas
TxtOrdenCompra.Enabled = True
TxtPedidoContrato.Enabled = True
TxtObsAlmacen.Enabled = True
DdlUsoCFDI.Enabled = True
DdlMetodoPago33.Enabled = True
DdlFormaPago33.Enabled = True
UPCondicionesPago.Update()
ModalidadEdicion = True
@@ -20872,6 +20960,8 @@ Partial Class Ventas
Gv.DataKey("SATClaveProdServ").ToString, Gv.DataKey("SATClaveUM").ToString, -1, Gv.DataKey("CveVentaDetalle").ToString.ToEntero, -1, -1, -1, -1)
End If
Next
TrTipoRelacion.Visible = True
DdlTiposRelacion.SelectedValueExist("3")
LimpiaDocumentoDEV()
@@ -21326,10 +21416,10 @@ Partial Class Ventas
If DdlTipoAmortizacionAnticipo.SelectedValue = "2" Then DivConceptoNC.Visible = True Else DivConceptoNC.Visible = False
DdlTipoRelacion.SelectedValueExist("7")
DdlTipoRelacionAnticipo.SelectedValueExist("7")
Else
DivConceptoNC.Visible = False
DdlTipoRelacion.SelectedValueExist("-1")
DdlTipoRelacionAnticipo.SelectedValueExist("-1")
End If
End Sub