Files
SIG/Ventas/VentasMedicas.aspx
2023-11-14 08:31:19 -07:00

3166 lines
177 KiB
Plaintext

<%@ Page Title="Ventas Medicas" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="VentasMedicas.aspx.vb" Inherits="VentasMedicas" EnableEventValidation="false" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%--Necesario para el modal que no se cierra--%>
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
<style>
.btn-xs {
padding: 0px 5px;
}
.nolineheight {
line-height: 1;
}
.claseesconder {
display: none;
}
.myventasbutton {
margin: 5px;
width: 170px;
}
body.dragging, body.dragging * {
cursor: move !important;
}
.dragged {
position: absolute;
opacity: 0.5;
z-index: 2000;
}
table.Sortable tr.placeholder {
display: block;
background: red;
position: relative;
margin: 0;
padding: 0;
border: none;
}
.Sortable th.placeholder {
display: block;
background: red;
position: relative;
width: 0;
height: 0;
margin: 0;
padding: 0;
}
.Sortable th.placeholder:before {
content: "";
position: absolute;
width: 0;
height: 0;
border: 5px solid transparent;
border-top-color: red;
top: -6px;
margin-left: -5px;
border-bottom: none;
}
table.Sortable tr.placeholder:before {
content: "";
position: absolute;
width: 0;
height: 0;
border: 5px solid transparent;
border-left-color: red;
margin-top: -5px;
left: -5px;
border-right: none;
}
.GvEst > tbody > tr > td:nth-child(2) {
padding-left: 36px;
}
.GvEst > tbody > tr.Totales > td:nth-child(2) {
padding-left: 4px;
}
.GvEst > tbody > tr.SubTotales > td:nth-child(2) {
padding-left: 12px;
}
.GvEst > tbody > tr.SubTotales2 > td:nth-child(2) {
padding-left: 20px;
}
.GvEst > tbody > tr.SubTotales3 > td:nth-child(2) {
padding-left: 28px;
}
.GVAnticipos input {
text-align: right;
}
.modalBackground {
background-color: Black;
filter: alpha(opacity=90);
opacity: 0.8;
}
.modalPopup {
background-color: #FFFFFF;
padding-bottom: 10px;
}
.rbl input[type="radio"] {
margin-left: 10px;
margin-right: 1px;
}
a.mylkbutton:link, a.mylkbutton:hover, a.mylkbutton:active {
color: black;
}
.arrow {
left: 20%;
}
.popover {
width: 500px !important;
max-width: 500px !important;
}
.popover .popover-title {
margin: 0 !important;
text-align: center;
}
.select2anothertable {
position: absolute;
left: 100%;
background-color: white;
/*top: 50px;*/ top: 21px;
/*max-height: 200px;*/ max-height: 229px;
/*background-color: #dcdcdc;*/
overflow: hidden;
}
.select2anothertable {
position: absolute;
left: 100%;
background-color: white;
/*top: 50px;*/ top: 21px;
/*max-height: 200px;*/ max-height: 229px;
/*background-color: #dcdcdc;*/
overflow: hidden;
}
.select2anothertable > table > tbody > tr > td:nth-of-type(odd) {
background-color: rgba(220, 220, 220, 0.45);
}
.select2anothertable > table > tbody > tr > td {
line-height: 21px;
white-space: nowrap;
}
.select2anothertable > table > tbody > tr.active {
background-color: #5897fb;
}
a.disabled {
pointer-events: none;
cursor: default;
}
/*Bootstrap text-uppercase =)*/
.Mayuscula {
text-transform: uppercase;
}
.no-padding {
padding: 0 !important;
}
</style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="HB" runat="Server">
<asp:UpdatePanel ID="UpnTools" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<li>
<asp:LinkButton ID="LnkAgregarPS" runat="server" OnClick="LnkAgregarPS_Click" ><i class="fa fa-plus"></i>Agregar Producto</asp:LinkButton>
</li>
</ContentTemplate>
<Triggers>
</Triggers>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
<asp:Label ID="LblTitulo" runat="server" Text="Registro de Ventas"></asp:Label>
</asp:Content>
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
</asp:Content>
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
<div style="display: table; width: 100%">
<asp:UpdatePanel ID="UpCliente" runat="server" UpdateMode="Conditional" class="portlet light xspadding bordered whitoutcol" style="width: 473px;">
<ContentTemplate>
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase"><a id="HlCliente" href="javascript:void(0);" runat="server" class="Texto" onclick="javascript:AbrirVentana('/Ventas/PopUpBuscarClientes.aspx?Opt=Fact', 800, 547, 'N', 'PopUpBuscar')">
<asp:Label runat="server" ID="LblTituloPorletCliente" Text="Cliente:"> </asp:Label></a></span>
<asp:LinkButton ID="LnkAgregarCliente" runat="server" AlternateText="Agregar Cliente" Text="<i class='fa fa-plus-square'></i>" />
<asp:TextBox ID="TxtCodigo" runat="server" AutoPostBack="true" BorderStyle="None" Width="65px"></asp:TextBox>
<asp:HiddenField ID="HdnCveCliente" runat="server" ClientIDMode="Static" Value="-1" />
<asp:HiddenField ID="HdnIndices" runat="server" ClientIDMode="Static" Value="-1" />
<asp:Button ID="BtnBuscarCliente" runat="server" ClientIDMode="Static" Text="Buscar Cliente" Style="display: none;" class="btn btn-primary" />
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom" style="padding-top: 0px; margin-top: -5px;">
<div class="form-body">
<table border="0" width="463px">
<tr align="left" runat="server" id="trNombreCliente">
<td width="95px"><b>Nombre:</b>&nbsp;</td>
<td width="200px">
<asp:Label ID="LblCliente" runat="server" Text="Cliente"></asp:Label></td>
<td width="95px" runat="server" ><b></b></td>
<td width="200px">
</td>
</tr>
<tr runat="server" id="trsucursalciente" visible="false">
<td align="left"><b>
<asp:Label ID="LblSucursal" runat="server" Text="Sucursal"></asp:Label>
:</b></td>
<td align="left">
<div class="row align-items-start">
<div class="col-md-10">
<asp:DropDownList ID="DdlSucursalCliente" runat="server" AutoPostBack="true" CssClass="form-control input-sm select2me" AppendDataBoundItems="true" DataTextField="SucursalCliente" DataValueField="CveClienteSucursal">
</asp:DropDownList>
</div>
<div class="col-md-2" style="padding: inherit;">
</div>
</div>
</td>
<td align="left">
<b>
<asp:Label ID="LtlTitleRFCSucursal" runat="server" Text=""></asp:Label></b>
</td>
<td align="left">
<asp:Label ID="LtlRFCSucursal" runat="server" Text=""></asp:Label>
</td>
</tr>
<tr align="left" runat="server" id="TrDireccion">
<td><b>Dirección:</b>&nbsp;</td>
<td>
<asp:Label ID="LblDireccion" runat="server" Text="Dirección"></asp:Label></td>
<td><b>Colonia:</b></td>
<td>
<asp:Label ID="LblColonia" runat="server" Text="Colonia"></asp:Label></td>
</tr>
<tr align="left" runat="server" id="TrCiudad">
<td><b>Ciudad, Edo:</b>&nbsp;</td>
<td>
<asp:Label ID="LblCiudad" runat="server" Text="Ciudad"></asp:Label>,&nbsp;<asp:Label ID="LblEstado" runat="server" Text="Estado"></asp:Label></td>
<td><b>C.P.:</b></td>
<td>
<asp:Label ID="LblCP" runat="server" Text="00000"></asp:Label></td>
</tr>
<tr align="left" runat="server" id="TrRFC">
<td><b>RFC:</b>&nbsp;</td>
<td>
<asp:Label ID="LblRFC" runat="server" Text="AAA010101AAA"></asp:Label>
<asp:HiddenField ID="HdnRFCVenta" runat="server" Value="AAA010101AAA" />
</td>
<td><b>Teléfono:</b></td>
<td>
<asp:Label ID="LblTelefono" runat="server" Text="9999999999"></asp:Label></td>
</tr>
<tr align="left" runat="server" id="TrOP" visible="false">
<td><b>Folio OP:</b>&nbsp;</td>
<td colspan="3">
<asp:DropDownList ID="DdlOrdenProduccion" runat="server" CssClass="form-control select2me" AppendDataBoundItems="true" DataTextField="FolioClienteFecha" DataValueField="CveOrdenProduccion" Width="90%">
</asp:DropDownList>
&nbsp<asp:LinkButton ID="LnkActualizarOrdenProduccion" OnClick="LnkActualizarOrdenProduccion_Click" Visible="false" CssClass="btn btn-default btn-circle btn-xs " data-toggle="tooltip" data-placement="top" ToolTip="Actualizar Orden de Producción" runat="server"><i class="fa fa-check" style="color:green" aria-hidden="true"></i></asp:LinkButton></td>
</tr>
<tr align="left" runat="server" id="trCRM1" visible="false">
<td width="95px"><b>Empresa:</b>&nbsp;</td>
<td width="200px">
<asp:Label ID="LblEmpresaCRM" runat="server" Text="Cliente"></asp:Label></td>
<td width="135px" runat="server" id="Td5"><b>Enviar Mail:</b></td>
<td width="85px">
<asp:CheckBox ID="ChkEnviarFacturaCRM" runat="server" /></td>
</tr>
<tr align="left" runat="server" id="trCRM2" visible="false">
<td><b>RFC:</b>&nbsp;</td>
<td>
<asp:Label ID="LblRFCCRM" runat="server" Text="AAA010101AAA"></asp:Label></td>
</tr>
<tr align="left" runat="server" id="trCRM3" visible="false">
<td><b>Medio de Captación::</b>&nbsp;</td>
<td>
<asp:Label ID="LblMedioCaptacionCRM" runat="server" Text=""></asp:Label></td>
</tr>
<tr>
<td><b>Medico:</b></td>
<td>
<asp:DropDownList ID="DdlMedico" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="Medico" DataValueField="CveMedico">
<asp:ListItem Value="-1">Seleccione uno</asp:ListItem>
</asp:DropDownList>
</td>
<td><b>Procedimiento:</b></td>
<td>
<asp:DropDownList ID="DdlProcedimiento" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="Procedimiento" DataValueField="CveProcedimiento">
<asp:ListItem Value="-1">Seleccione uno</asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr >
<td runat="server" id="TdRequiereTecnico1" visible="false">
<b>Rquiere Técnico:</b>
</td>
<td runat="server" id="TdRequiereTecnico2" visible="false">
<asp:CheckBox ID="ChkRequiereTecnico" runat="server" OnCheckedChanged="ChkRequiereTecnico_CheckedChanged" AutoPostBack="true" />
</td>
<td runat="server" id="TdFechaOS1" visible ="false">
<b>Fecha de Orden:</b>
</td>
<td runat="server" id="TdFechaOS2" visible ="false">
<asp:TextBox ID="TxtFecha" type="datetime-local" runat="server" CssClass="form-control" CausesValidation="true" Style="width: 100%" step="1"></asp:TextBox>
</td>
</tr>
</table>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpParametros" runat="server" UpdateMode="Conditional" class="portlet light xspadding .nolineheight bordered whitoutcol" style="width: 310px;">
<ContentTemplate>
<asp:HiddenField ID="HdnCargarInventario" runat="server" ClientIDMode="Static" Value="True" />
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">DATOS DE EMISIÓN</span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom" style="padding-top: 0px; margin-top: -5px;">
<table border="0" width="300px">
<tr align="left" id="TrTipo" runat="server">
<td style="min-width: 90px;"><b>Tipo:</b></td>
<td>
<table border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<asp:DropDownList CssClass="form-control input-sm" ID="DdlTipoComprobante" DataValueField="CveTipoDocumento" DataTextField="TipoDocumento" runat="server" AppendDataBoundItems="true" AutoPostBack="true" Width="100px">
<asp:ListItem Value="Ing" Text="Ingresos" Selected="True"></asp:ListItem>
<asp:ListItem Value="Egs" Text="Egresos"></asp:ListItem>
<asp:ListItem Value="Rem" Text="Remisión"></asp:ListItem>
<asp:ListItem Value="Cot" Text="Cotización"></asp:ListItem>
<asp:ListItem Value="Ant" Text="Anticipos"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
</table>
</td>
</tr>
<tr align="left">
<td>
<asp:Label runat="server" Font-Bold="true" ID="LblSubProyectosDatos">Sucursal:</asp:Label>
</td>
<td>
<asp:DropDownList ID="DdlSubProyectoDatos" AutoPostBack="True" runat="server" CssClass="form-control input-sm " DataTextField="SubProyecto" DataValueField="CveSubProyecto" Width="100px"></asp:DropDownList>
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpEstatus" runat="server" UpdateMode="Conditional" class="portlet light xspadding bordered whitoutcol" style="margin-left: auto">
<ContentTemplate>
<div id="DivEstatusFac" runat="server" visible="false">
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Estatus: </span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body form-horizontal form-row-sepe formnombottom" style="padding-top: 0px; margin-top: -5px;">
<table border="0" width="240px">
<tr align="left" id="TrEstatusCaja" visible="false" runat="server">
<td><b>Corte:</b>&nbsp;</td>
<td>
<asp:Label ID="LblEstatusCaja" runat="server"></asp:Label>
</td>
</tr>
<tr align="left" id="Trsaldo" visible="false" runat="server">
<td><b>Saldo:</b>&nbsp;</td>
<td>
<asp:HyperLink ID="HplSaldoAuxiliar" CssClass="Texto thickbox" runat="server"></asp:HyperLink><asp:HyperLink runat="server" CssClass="Texto thickbox" Visible="false" ID="HplPagado" Text="<b>PAGADO<b>"></asp:HyperLink>
<asp:HiddenField ID="HdnPagado" runat="server" />
</td>
</tr>
<tr align="left">
<td><b>Estatus:</b>&nbsp;</td>
<td>
<asp:Label ID="LbEstatus" Text="" runat="server" />
</td>
</tr>
<tr align="left" id="trContabilizada" runat="server" visible="False">
<td><b>Contabilizada:</b></td>
<td>
<asp:HyperLink ID="HLContabilizada" Target="_blank" runat="server" Text="No"></asp:HyperLink>
<asp:HyperLink ID="HPLContaCancelacion" Target="_blank" runat="server" Text=""></asp:HyperLink>
</td>
</tr>
<tr align="left">
<td><b>Se timbró:</b>&nbsp;</td>
<td>
<asp:Label ID="LblSeTimbro" runat="server" Text="No"></asp:Label></td>
</tr>
<tr align="left">
<td><b>Envió Mail:</b>&nbsp;</td>
<td>
<asp:Label ID="LblMail" runat="server" Text="No"></asp:Label></td>
</tr>
<tr align="left">
<td><b class="truncate">Usuario creó:</b>&nbsp;</td>
<td>
<asp:Label ID="LblUsuario" runat="server"></asp:Label></td>
</tr>
<tr align="left">
<td><b class="truncate">Fecha registró:</b>&nbsp;</td>
<td>
<asp:Label ID="LblFechaRegistro" runat="server"></asp:Label></td>
</tr>
<tr runat="server" id="trPresupuesto" visible="false">
<td colspan="2">
<asp:HyperLink runat="server" ID="HplPresupuesto" Target="_blank" Text="Ir a Presupuesto"></asp:HyperLink>
</td>
</tr>
</table>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpTurno" runat="server" UpdateMode="Conditional" Visible="false" class="portlet light xspadding bordered whitoutcol" style="width: 20%; display: flex; flex-direction: row; color: white; background-color: #c49f47">
<ContentTemplate>
<div id="DivTurno" runat="server" style="width: 100%; text-align: center;">
Turno:
<asp:Label runat="server" ID="LblTurno"></asp:Label>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:UpdatePanel ID="Updatetabs" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<ajax:TabContainer ID="Tab" runat="server" ActiveTabIndex="0" Width="100%">
<ajax:TabPanel ID="TabGenerales" runat="server" HeaderText="Generales">
<ContentTemplate>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<table id="TFuenteRecaudacion" runat="server" border="0" cellpadding="0" cellspacing="0">
<tr>
<td>
<b>Presupuesto de Ingreso:</b>
</td>
<td>
<asp:DropDownList ID="DdlFuenteRecaudacion" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="FuenteRecaudacionCodigoRubroIngreso" DataValueField="CvePresupuestoIngreso" Width="700px" ValidationGroup="GrpEmitirImprimir">
<asp:ListItem Text="Seleccione un Presupuesto de Ingreso" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVFuenteRecaudacion" runat="server" ControlToValidate="DdlFuenteRecaudacion" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Fuente Recaudacion''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GprAgregaPS"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOFuenteRecaudacion" runat="server" HighlightCssClass="vco" TargetControlID="RFVFuenteRecaudacion" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
</table>
</ContentTemplate>
</asp:UpdatePanel>
<div class="divtab">
<asp:UpdatePanel ID="UpPS" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div style="overflow-x: auto; width: 100%;">
<asp:GridView ID="GvPS" GridLines="None" runat="server" AutoGenerateColumns="False"
DataKeyNames="Consec,CvePS,CodigoPS,Total, IEPS, CveClasificacion,CveUM,CveProyecto,CveSubProyecto,TipoDocto,PS,Obs,Cantidad,PU,Descuento,IVA,CantidadInventario,CantidadFacturadaRem,CveVentaDetalle,CvePromocionDetalle"
CssClass="table table-striped table-advance table-hover mysmallbtn ScrollAD" Style="min-width: 980px;">
<Columns>
<%--0--%>
<asp:TemplateField ItemStyle-Font-Size="6pt">
<ItemTemplate>
<asp:Literal ID="LtlConsecutivo" runat="server" Text='<%# Eval("Consec", "{0:N0}") %>'></asp:Literal>&nbsp;
</ItemTemplate>
</asp:TemplateField>
<%--1--%>
<asp:TemplateField HeaderText="Cantidad">
<ItemTemplate>
<div class="row">
<div class="col-md-12">
<asp:Literal ID="LtlCantidad" runat="server" Text='<%# Eval("Cantidad", "{0:#,###.####}") %>'></asp:Literal>
</div>
</div>
<div class="row">
<div class="col-md-12">
<asp:Literal ID="LtlNumTurnos" runat="server" Visible="false" Text='<%# String.Format("Turnos: {0:#,###.####}", Eval("NumTurnos")) %>'></asp:Literal>
</div>
</div>
</ItemTemplate>
</asp:TemplateField>
<%--2--%>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlUnidadMedida" runat="server" Text='<%# Eval("UM") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<%--3--%>
<asp:TemplateField>
<ItemTemplate>
<span style="min-width: 220px; border-bottom: 1px solid gray;">
<asp:Label ID="LblClasificacion" runat="server" Text='<%# Eval("Clasificacion") %>'></asp:Label>
</span>
<br />
<asp:Label ID="LblPS" runat="server" Text='<%# Eval("CodigoPS") %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%--4--%>
<asp:TemplateField>
<ItemTemplate>
<asp:Literal ID="LtlObsPS" runat="server" Text='<%# Eval("Obs") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<%--5--%>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:Literal ID="LtlTiempoEntrega" runat="server" Text='<%# Eval("TiempoEntrega") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<%--6--%>
<asp:TemplateField Visible="false">
<ItemTemplate>
<asp:Literal ID="LtCantidadFacturadaRem" runat="server" Text='<%# Eval("CantidadFacturadaRem", "{0:#,##0.##}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<%--7 POR SI SE EMPIEZAN A METER MUCHOS SIMILARES SE PUSO PARA TODOS - MANEJO EN EL GvPS_RowDataBound--%>
<asp:TemplateField Visible="false" ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Literal ID="LtCantidadFacturada" runat="server" Text="0"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<%--8--%>
<asp:TemplateField>
<ItemTemplate>
<asp:Label Style="border-bottom: 1px solid gray;" ID="LblProyecto" runat="server" Text='<%# Eval("Proyecto", "{0}<br />") %>'></asp:Label>
<asp:Label ID="LblSubProyecto" runat="server" Text='<%# Eval("SubProyecto") %>' Width="90px"></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%--9--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<div class="row">
<div class="col-md-12">
<asp:Literal ID="LtlPU" runat="server" Text='<%# Eval("PU", "{0:N2}") %>'></asp:Literal>
</div>
</div>
<div class="row">
<div class="col-md-12">
<asp:Literal ID="LtlPrecioLista" runat="server" Visible="false" Text='<%# Eval("PrecioLista") %>'></asp:Literal>
</div>
</div>
</ItemTemplate>
</asp:TemplateField>
<%--10--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right" HeaderText="">
<ItemTemplate>
<asp:Literal ID="LtlDesc" runat="server" Text='<%# Eval("Descuento", "{0:N2}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<%--11--%>
<asp:TemplateField HeaderText="" Visible="False">
<ItemTemplate>
<asp:Literal ID="LtlPredial" runat="server" Text='<%# Eval("CuentaPredial") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<%--12--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblIVA" runat="server" Text='<%# Eval("ImporteIVA", "{0:#,##0.00##}") %>'></asp:Label><br />
<asp:Label ID="LblIVAPorcentaje" runat="server" Text='<%# String.Format("{0} {1}", (CDbl(Eval("PorcentajeIVA").ToString) * 100).ToString("#####"), If(CDbl(Eval("PorcentajeIVA").ToString) * 100 > 0, "%", "")) %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%--13--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Label ID="LblIEPS" runat="server" Text='<%# Eval("ImporteIEPS", "{0:#,##0.00##}") %>'></asp:Label><br />
<asp:Label ID="LblIEPSPorcentaje" runat="server" Text='<%# String.Format("{0} {1}", (CDbl(Eval("PorcentajeIEPS").ToString) * 100).ToString("#####"), If(CDbl(Eval("PorcentajeIEPS").ToString) * 100 > 0, "%", "")) %>'></asp:Label>
</ItemTemplate>
</asp:TemplateField>
<%--14--%>
<asp:BoundField DataField="ImporteRetIVA" HeaderText="Ret IVA" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ReadOnly="true" Visible="false" />
<%--15--%>
<asp:BoundField DataField="ImporteRetISR" HeaderText="Ret ISR" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" ReadOnly="true" Visible="false" />
<%--16--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Right">
<ItemTemplate>
<asp:Literal ID="LtlTotal" runat="server" Text='<%# Eval("TotalImporte", "{0:#,##0.00##}") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<%--17--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Editar">
<ItemTemplate>
<asp:LinkButton ID="imgE" runat="server" AlternateText="Editar" OnClick="GvPS_RowEditing"
CssClass="btn btn-circle btn-sm green" Text="<i class='fa fa-pencil'></i>" />
</ItemTemplate>
</asp:TemplateField>
<%--18--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Center" HeaderText="Eliminar">
<ItemTemplate>
<asp:LinkButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete"
CssClass="btn btn-circle btn-sm red" Text="<i class='icon-trash'></i>" data-toggle="confirmation" data-popout="true" data-original-title="confirmar" data-btn-ok-label="si" />
</ItemTemplate>
</asp:TemplateField>
<%--19--%>
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
<ItemTemplate>
<%--<asp:LinkButton ID="imgClone" runat="server" AlternateText="Clonar" CausesValidation="False" CommandName="Clonar" CommandArgument='<%# GvPS.Rows.Count.ToString() %>'
CssClass="btn btn-circle btn-sm blue" Text="<i class='fa fa-clone'></i>" />--%>
</ItemTemplate>
</asp:TemplateField>
<%--20--%>
<asp:TemplateField>
<HeaderTemplate>
<%--<asp:LinkButton ID="LnkOrdenarGvPS" runat="server" CssClass="Texto" Text="<i class='fa fa-retweet'></i>" OnClick="OrdenarGvPS" />--%>
</HeaderTemplate>
<ItemTemplate>
<%--<asp:TextBox ID="TxtOrden" runat="server" MaxLength="3" Type="number" Width="30px" Text='<%# Eval("Orden") %>' />--%>
</ItemTemplate>
</asp:TemplateField>
<%--21--%>
<asp:TemplateField HeaderText="Presupuesto de Ingreso" Visible="false">
<ItemTemplate>
<asp:DropDownList runat="server" ID="DdlFR" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="FuenteRecaudacionCodigoRubroIngreso" DataValueField="CvePresupuestoIngreso" Style="max-width: 100px;" OnSelectedIndexChanged="DdlFR_SelectedIndexChanged"></asp:DropDownList>
</ItemTemplate>
</asp:TemplateField>
<%--22--%>
<asp:BoundField DataField="TieneProntoPago" HeaderText="Pronto Pago" ItemStyle-Width="5%" ItemStyle-HorizontalAlign="Center" ReadOnly="true" Visible="false" />
</Columns>
<RowStyle CssClass="Texto" />
<AlternatingRowStyle CssClass="TextoAlterno" />
<HeaderStyle CssClass="TextTab1" />
</asp:GridView>
</div>
<div class="row">
<div class="col-md-6">
<div class="row">
<asp:UpdatePanel ID="UpRemisiones" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<div class="col-md-5" style="height: 200px; overflow: auto;" id="DivRemisionesFacturadas" runat="server">
<asp:GridView ID="GvRemisiones" runat="server" CssClass="table table-striped table-hover Widthall" AutoGenerateColumns="False" ClientIDMode="Static" EmptyDataText="" Caption="Facturas/Remisiones" GridLines="None">
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
<HeaderTemplate>Factura</HeaderTemplate>
<ItemTemplate>
<asp:HyperLink ID="HplFactura" runat="server" Target="_blank" CssClass="Texto" Text='<%# Eval("SerieFolio") %>' NavigateUrl='<%# Eval("CveVenta", "/Ventas/Ventas.aspx?CveVenta={0}")%>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<asp:UpdatePanel ID="UpAntNC" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<div class="col-md-6" id="DivAnticiposVinculados" runat="server">
<asp:Label ID="LblAntAplicados" runat="server" Text="" CssClass="alert alert-warning" Style="padding: 5px; margin-bottom: 5px; padding-right: 15px;" Visible=" false"></asp:Label>
<asp:GridView ID="GvAntNC" runat="server" CssClass="table table-striped table-hover Widthall"
AutoGenerateColumns="False" ClientIDMode="Static" EmptyDataText="" Caption="Anticipos/NC Vinculados"
GridLines="None" DataKeyNames="CveVenta,Serie,Folio,SerieFolio,FolioFiscal,TipoDocto,CveConceptoContable,Importe">
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
<HeaderTemplate>Factura</HeaderTemplate>
<ItemTemplate>
<asp:HyperLink ID="HplFactura" runat="server" Target="_blank" CssClass="Texto" Text='<%# Eval("SerieFolio") %>' NavigateUrl='<%# Eval("CveVenta", "/Ventas/Ventas.aspx?CveVenta={0}")%>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="TipoDocto" DataField="TipoDocto" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="Fecha" DataField="FechaAplicado" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="Total" DataField="SubTotal" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Anticipo/NC/IxC" DataField="Importe" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Mon" DataField="Moneda" ItemStyle-HorizontalAlign="Center" />
</Columns>
</asp:GridView>
<asp:GridView ID="GvNC" runat="server" CssClass="table table-striped table-hover Widthall" DataKeyNames="CveConceptoContable,Importe,CveVentaNC" AutoGenerateColumns="False" ClientIDMode="Static" EmptyDataText="" Caption="Anticipos/NC Vinculados" GridLines="None">
<Columns>
<asp:TemplateField ItemStyle-HorizontalAlign="Center">
<HeaderTemplate>Factura</HeaderTemplate>
<ItemTemplate>
<asp:HyperLink ID="HplFactura" runat="server" Target="_blank" CssClass="Texto" Text='<%# Eval("SerieFolio") %>' NavigateUrl='<%# Eval("CveVenta", "/Ventas/Ventas.aspx?CveVenta={0}")%>'></asp:HyperLink>
</ItemTemplate>
</asp:TemplateField>
<asp:BoundField HeaderText="TipoDocto" DataField="TipoDocto" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="Fecha" DataField="FechaAplicado" DataFormatString="{0:d}" ItemStyle-HorizontalAlign="Center" />
<asp:BoundField HeaderText="Total" DataField="SubTotal" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Anticipo/NC/IxC" DataField="Importe" DataFormatString="{0:N2}" ItemStyle-HorizontalAlign="Right" />
<asp:BoundField HeaderText="Mon" DataField="Moneda" ItemStyle-HorizontalAlign="Center" />
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div id="DivOCRelacionadas" class="col-md-3" runat="server" visible="false">
<asp:GridView runat="server" ID="GvOCRelacionadas" Caption="OC Relacionadas:" AutoGenerateColumns="False" DataKeyNames="CveOrdenCompra,Folio"
CssClass="table table-striped table-advance table-hover Widthall mysmallbtn" GridLines="None">
<Columns>
<asp:HyperLinkField DataTextField="Folio" DataNavigateUrlFields="CveOrdenCompra" DataNavigateUrlFormatString="/OC/OC.aspx?OC={0}" HeaderText="Orden Compra" />
</Columns>
</asp:GridView>
</div>
</div>
</div>
<div class="col-md-6 ">
<div class="row">
<div class="col-md-6">
<div class="row">
<div class="col-md-6">
<div id="DivCodigosUnicos" class="row" runat="server" visible="false">
<div class="col-md-12">
<asp:UpdatePanel ID="UpCodigosUnicos" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<div class="col-md-12">
<asp:GridView ID="GvCodigosUnicos" runat="server" CssClass="table table-striped table-hover Widthall" AutoGenerateColumns="False"
DataKeyNames="CvePolizaVirtual,Serie,IdProductoPolizaVirtual,Total,Descuento,AnioVehiculo,FechaUsado,IdModeloAuto,IdMarcaAuto,IdBCI,TipoServicio,TipoPoliza,TieneUsado,IdMarcaUsado" ClientIDMode="Static" EmptyDataText="" GridLines="None">
<Columns>
<asp:TemplateField HeaderText="Código Único">
<ItemTemplate>
<asp:TextBox ID="TxtCodigoUnico" runat="server" Text='<%# Eval("Serie") %>' />
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
<div class="col-md-6">
<table id="TbDescuentosAdicionales" border="0" rules="none" class="well TextTab" style="float: right;" runat="server" visible="false">
<tr align="right">
<td style="border: 1px none white"><b>Descuento Adicional Por Pago:</b></td>
<td>
<asp:Label ID="LblDescuentoAdicional" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
<td align="right">&nbsp;
</td>
</tr>
<tr align="right">
<td style="border: 1px none white"><b>Total Original:</b></td>
<td>
<asp:Label ID="LblTotalOriginal" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
<td align="right">&nbsp;
</td>
</tr>
<tr align="right">
<td style="border: 1px none white"><b>Total a Pagar:</b></td>
<td>
<asp:Label ID="LblTotalAPagarAdicional" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
<td align="right">&nbsp;
</td>
</tr>
</table>
<table id="TbDescuentosRNC" border="0" rules="none" class="well TextTab" style="float: right;" runat="server" visible="false">
<tr align="right">
<td style="border: 1px none white"><b>Descuentos RNC:</b></td>
<td>
<asp:Label ID="LblDescuentosRNC" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
<%-- <td align="right">&nbsp;<asp:LinkButton ID="LnkDescuentosRNC" runat="server" OnClick="LnkDescuentosRNC_Click" Text="<i class='fa fa-tag fa-lg font-green'></i>" AlternateText="Aplicacion de RNC" Style="cursor: pointer;" />
</td>--%>
</tr>
<tr align="right">
<td style="border: 1px none white"><b>Pronto Pago:</b></td>
<td>
<asp:Label ID="LblProntoPago" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
<td align="right">&nbsp;
</td>
</tr>
<tr align="right">
<td style="border: 1px none white"><b>Total a Pagar:</b></td>
<td>
<asp:Label ID="LblTotalAPagar" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
<td align="right">&nbsp;
</td>
</tr>
</table>
</div>
</div>
</div>
<div class="col-md-6">
<table border="0" rules="none" class="well TextTab" style="float: right;">
<tr align="right">
<td style="width: 150px;"><b>SubTotal:</b></td>
<td width="82px">
<asp:TextBox ID="TxtSubTotal" Enabled="false" ClientIDMode="Static" runat="server" BorderStyle="None" Style="text-align: right;" Text="0.00" Width="78px"></asp:TextBox></td>
<td align="right">&nbsp;
<asp:LinkButton ID="ImgOtrosConceptos" Enabled="false" Visible="false" CssClass="btn btn-circle btn-xs blue" ToolTip="Desglose de Conceptos" Text="<i class='fa fa-list'></i>" runat="server"></asp:LinkButton>
</td>
</tr>
<tr align="right">
<td><b>
<asp:Literal ID="LtlTitDescuentos" runat="server" Text="Descuentos:"></asp:Literal></b></td>
<td>
<asp:Label ID="LblDescuentos" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
<td align="right">&nbsp;
<a runat="server" id="ImgDescTotal" href="#"><i class='fa fa-comment-o'></i></a>
<%--<asp:LinkButton ID="ImgDescTotal" runat="server" ToolTip="Agregar Descuento" Text="<i class='fa fa-comment-o'></i>" Style="cursor: pointer;" />--%></td>
</tr>
<tr align="right">
<td style="border: 1px none white"><b>Amort. Ant.:</b></td>
<td>
<asp:Label ID="LblAmortizacion" ClientIDMode="Static" runat="server" Style="text-align: right;" Text="0.00" Width="78px"></asp:Label></td>
<td align="right">&nbsp;<asp:LinkButton ID="ImgAntiPend" runat="server" Text=" <i class='fa fa-money font-green'></i> " AlternateText="Cancelación de Anticipos" Style="cursor: pointer;" />
</td>
</tr>
<tr align="right">
<td style="border: 1px none white"><b>SubTotal 2:</b></td>
<td>
<asp:TextBox ID="TxtSubTotal2" ClientIDMode="Static" runat="server" BorderStyle="None" Style="text-align: right;" Text="0.00" Width="78px" Enabled="false"></asp:TextBox></td>
<td>
<%-- <asp:LinkButton ID="LkbAgregarComplementos" runat="server" CssClass="btn btn-circle btn-xs gray" Text="<i class='fa fa-bell '></i>"></asp:LinkButton>--%>
</td>
</tr>
<tr align="right">
<td style="border: 1px none white"><b>IVA:</b>
<asp:DropDownList ID="DdlIVA" CssClass="form-control select2me" Style="width: 35px; display: inline-block;" runat="server" Visible="false" AutoPostBack="true" OnSelectedIndexChanged="DdlIVA_SelectedIndexChanged">
<asp:ListItem Selected="True" Value="1.08">8%</asp:ListItem>
<asp:ListItem Value="1.16">16%</asp:ListItem>
<asp:ListItem Value="1">0%</asp:ListItem>
</asp:DropDownList></td>
<td>
<asp:TextBox ID="TxtIVA" ClientIDMode="Static" Enabled="false" runat="server" BorderStyle="None" Style="text-align: right;" Text="0.00" Width="78px"></asp:TextBox></td>
<asp:HiddenField ID="HdnIVAOriginal" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnIVACalculado" runat="server" ClientIDMode="Static" Value="0" />
<td></td>
</tr>
<tr id="TrRetIVA" runat="server" align="right" style="display: none;">
<td style="border: 1px none white"><b>Ret. IVA:</b></td>
<td>
<asp:TextBox ID="TxtRetIVA" ClientIDMode="Static" runat="server" BorderStyle="None" Style="text-align: right;" Text="0.00" Width="78px"></asp:TextBox>
</td>
<td>
<asp:Label ID="LblRetIVA" runat="server" BorderStyle="None" Text="0.00"></asp:Label>(%)
</td>
<td>
<asp:DropDownList ID="DdlTipoRetencion" Visible="false" Enabled="false" AutoPostBack="true" OnSelectedIndexChanged="DdlTipoRetencion_SelectedIndexChanged" CssClass="form-control input-sm" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="MetodoPago" DataValueField="CveMetodoPago" ValidationGroup="GrpGuardar">
<asp:ListItem Selected="True" Text="Sin Retención" Value="0"></asp:ListItem>
<asp:ListItem Text="Arrendamiento" Value="1"></asp:ListItem>
<asp:ListItem Text="Servicios Profesionales" Value="2"></asp:ListItem>
<asp:ListItem Text="Fletes" Value="3"></asp:ListItem>
<asp:ListItem Text="Servicios" Value="4"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr id="TrRetISR" runat="server" align="right" style="display: none;">
<td><b>Ret ISR:</b></td>
<td>
<asp:TextBox ID="TxtRetISR" ClientIDMode="Static" runat="server" BorderStyle="None" Style="text-align: right;" Text="0.00" Width="78px"></asp:TextBox></td>
<td>
<asp:Label ID="LblRetISR" runat="server" BorderStyle="None" Text="0.00"></asp:Label>&nbsp;(%)</td>
</tr>
<tr id="TrIEPS" runat="server" align="right" visible="false">
<%--<td colspan="2">
<asp:UpdatePanel ID="UpIEPS" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<asp:GridView ID="GvIEPS" runat="server" BorderWidth="0px" ShowHeader="False" horizontal-align="Right" GridLines="None" ShowHeaderWhenEmpty="False" DataKeyNames="PorcentajeIEPS, ImporteIEPS" AutoGenerateColumns="false">
<Columns>
<asp:TemplateField ItemStyle-Font-Bold="true">
<ItemTemplate>
<asp:Literal ID="LtlIEPS" runat="server"></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-HorizontalAlign="Right" ItemStyle-Width="82px">
<ItemTemplate>
<asp:TextBox ID="TxtIEPS" runat="server" BorderStyle="None" Style="text-align: right;" Text='<%# Eval("ImporteIEPS", "{0:N2}") %>' Width="78px" Enabled="false" BackColor="Transparent"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</td>--%>
<td><b>IEPS:</b></td>
<td>
<asp:TextBox ID="TxtIEPS" ClientIDMode="Static" runat="server" BorderStyle="None" Style="text-align: right;" Text="0.00" Width="78px"></asp:TextBox></td>
<td></td>
</tr>
<tr id="TrOtros" runat="server" visible="false">
<td colspan="2">
<asp:UpdatePanel ID="UpImpuestos" runat="server" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<asp:GridView ID="GvImpuestosLocales2" BorderWidth="0px" ShowHeader="False" runat="server" horizontal-align="Right" GridLines="None" ShowHeaderWhenEmpty="False" DataKeyNames="CveImpuestoLocal,ImpuestoLocal,Porcentaje,TipoImpuesto" AutoGenerateColumns="False" EmptyDataText="">
<Columns>
<asp:BoundField DataField="ImpuestoLocal" DataFormatString="{0}:" ItemStyle-Font-Bold="true" ItemStyle-HorizontalAlign="Right" ItemStyle-Width="150px" />
<asp:TemplateField ItemStyle-HorizontalAlign="Right" ItemStyle-Width="82px">
<ItemTemplate>
<asp:TextBox ID="TxtImpuestoLocalPS" runat="server" BorderStyle="None" Style="text-align: right;" Text='<%# Eval("Importe", "{0:N2}") %>' CssClass='<%# Eval("TipoImpuesto") %>' Width="78px"></asp:TextBox>
</ItemTemplate>
</asp:TemplateField>
</Columns>
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</td>
<td></td>
</tr>
<tr align="right">
<td><b>Total:</b></td>
<td>
<asp:UpdatePanel runat="server">
<ContentTemplate>
<asp:TextBox ID="TxtTotal" runat="server" CssClass="TextBoxAsLabel" ClientIDMode="Static" BorderStyle="None" Style="text-align: right;" Text="0.00" Width="78px"></asp:TextBox>
<asp:HiddenField ID="HdnVentaSaldo" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnCveVenta" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnSubTotalDescuestos" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnAmortizacion" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnTotalVenta" runat="server" ClientIDMode="Static" Value="0" />
</ContentTemplate>
</asp:UpdatePanel>
</td>
<td><b>Moneda:</b></td>
<td>
<asp:DropDownList ID="DdlMoneda" ClientIDMode="Static" CssClass="form-control input-sm" runat="server" DataTextField="Moneda" AppendDataBoundItems="true" AutoPostBack="true" DataValueField="CveMoneda" Width="70px"></asp:DropDownList>
</td>
</tr>
<tr id="TrConversionPesosTexto" align="right" style="display: none;">
<td><b>MXN:</b></td>
<td class="font-blue-sharp">
<asp:Label ID="LtlTotalConvertido" runat="Server" ClientIDMode="Static" Style="text-align: right;"></asp:Label>
</td>
</tr>
<tr id="TrConversionTipoCambio" runat="server" visible="false" align="right">
<td>
<asp:CheckBox ID="ChkConvertirDoctoPesos" data-size="small" runat="server" ToolTip="Las cantidades se definen en moneda extranjera, pero el documento se empresa a pesos (Se multiplica por el Tipo de Cambio)" onclick="ConvertirPesos(this);" /></td>
<td>
<b>Conv. Pesos:</b>
</td>
<td><b>T.C.:</b></td>
<td>
<asp:TextBox ID="TxtTipoCambio" onkeyup="ConvertirDllsPesos();" runat="server" CssClass="form-control input-sm" MaxLength="7" Text="1" Enabled="true" Width="70px" ClientIDMode="Static" ReadOnly="true"></asp:TextBox>
<asp:CompareValidator ID="CVTipoCambio" runat="server" ControlToValidate="TxtTipoCambio" Display="None" ErrorMessage="El campo <b>''Tipo de Cambio''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." Operator="DataTypeCheck" Type="Double" ValidationGroup="GrpEmitirImprimir"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCOTipoCambio" runat="server" HighlightCssClass="vco" TargetControlID="CVTipoCambio" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:Label runat="server" ID="LblTCValuacion" ToolTip="Última Valuación" Text="" Visible="false"></asp:Label>
</td>
</tr>
<tr id="TrConversionDolaresTexto" align="right" style="display: none;">
<td><b>DLLS:</b></td>
<td class="font-blue-sharp">
<asp:Label ID="LblDolaresConvertidos" runat="Server" ClientIDMode="Static" Style="text-align: right;"></asp:Label>
</td>
</tr>
<tr id="TrConversionDolares" runat="server" visible="false" align="right">
<td>
<asp:CheckBox ID="ChkConvertirDolares" data-size="small" runat="server" onclick="ConvertirDolares(this);" /></td>
<td>
<b>Conv. Dlls:</b>
</td>
<td><b>T.C.:</b></td>
<td>
<asp:TextBox ID="TxtTipoCambioDlls" onkeyup="ConvertirPesosDlls();" runat="server" CssClass="form-control input-sm" MaxLength="7" Text="1" Enabled="true" Width="70px" ClientIDMode="Static"></asp:TextBox>
<asp:CompareValidator ID="CvTipoCambioDolares" runat="server" ControlToValidate="TxtTipoCambioDlls" Display="None" ErrorMessage="El campo <b>''Tipo de Cambio''</b> no tiene el formato correcto, por favor corrija e intente de nuevo (Solo formato numérico)." Operator="DataTypeCheck" Type="Double" ValidationGroup="GrpEmitirImprimir"></asp:CompareValidator>
<ajax:ValidatorCalloutExtender ID="VCEOTipoCambioDlls" runat="server" HighlightCssClass="vco" TargetControlID="CvTipoCambioDolares" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
</table>
</div>
</div>
</div>
</div>
<asp:HiddenField ID="HdnTotalRNC" runat="server" ClientIDMode="Static" Value="0" />
<asp:HiddenField ID="HdnProntoPago" runat="server" ClientIDMode="Static" Value="0" />
</ContentTemplate>
</asp:UpdatePanel>
</div>
</ContentTemplate>
</ajax:TabPanel>
</ajax:TabContainer>
</ContentTemplate>
</asp:UpdatePanel>
<hr style="width: 100%;" />
<div class="row">
<div class="col-md-5">
<div id="divcondicionespago" runat="server">
<asp:UpdatePanel ID="UPCondicionesPago" runat="server" class="portlet light xspadding bordered " align="left" style="width: 400px;" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet-title" style="margin-bottom: 0px;">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Condiciones de Pago </span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body formnombottom">
<table border="0" width="100%">
<%-- <tr id="TrFormaEntrega" runat="server" visible="false">
<td align="left">Forma de entrega:</td>
<td align="left">
<asp:DropDownList ID="DdlFormaEntrega" DataTextField="CondicionEntrega" DataValueField="CveCondicionEntrega" CssClass=" form-control input-sm select2me" runat="server" Width="200px">
<asp:ListItem Selected="True" Text="-" Value="-1"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>--%>
<div runat="server" id="Tr33" visible="true">
<tr>
<td align="left">Uso CFDI:</td>
<td align="left">
<asp:DropDownList ID="DdlUsoCFDI" CssClass=" form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="UsoCFDIDescripcion" DataValueField="CveUsoCFDI" ValidationGroup="GrpEmitirImprimir" Width="200px">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVUsoCFDi" runat="server" ControlToValidate="DdlUsoCFDI" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Uso CFDi''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpEmitirImprimir"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEUsoCFDI" runat="server" HighlightCssClass="VCO" TargetControlID="RFVUsoCFDi" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<div runat="server" id="Tr34" visible="true">
<tr>
<td align="left">Método de Pago:</td>
<td align="left">
<asp:DropDownList ID="DdlMetodoPago33" runat="server" CssClass=" form-control input-sm select2me" AppendDataBoundItems="true" CausesValidation="true" DataTextField="MetodoPagoSAT" DataValueField="CveMetodoPago" Width="200px" AutoPostBack="true">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVMetodoPago33" runat="server" ControlToValidate="DdlMetodoPago33" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Método de Pago''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpEmitirImprimir"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEMetodoPago33" runat="server" HighlightCssClass="VCO" TargetControlID="RFVMetodoPago33" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
<tr>
<td align="left">Forma de Pago:</td>
<td align="left">
<asp:DropDownList ID="DdlFormaPago33" CssClass=" form-control input-sm select2me" runat="server" AppendDataBoundItems="true" CausesValidation="true" DataTextField="FormaPagoSAT" DataValueField="CveFormaPago" ValidationGroup="GrpEmitirImprimir" Width="200px">
<asp:ListItem Selected="True" Text="Seleccione" Value="-1"></asp:ListItem>
</asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVFormaPago33" runat="server" ControlToValidate="DdlFormaPago33" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Forma de Pago''</b> es necesario, por favor seleccione uno." InitialValue="-1" ValidationGroup="GrpEmitirImprimir"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEFormaPago33" runat="server" HighlightCssClass="VCO" TargetControlID="RFVFormaPago33" Width="300px"></ajax:ValidatorCalloutExtender>
</td>
</tr>
</div>
<tr runat="server" id="TrTipoRelacion" visible="false">
<td align="left">Tipo Relación</td>
<td>
<asp:DropDownList ID="DdlTiposRelacion" CssClass=" form-control input-sm select2me" runat="server" Width="200px" DataTextField="SATTipoRelacion" DataValueField="CveTipoRelacion">
<asp:ListItem Text="-" Value="-1"></asp:ListItem>
</asp:DropDownList>
</td>
</tr>
<tr>
<td colspan="2">
<hr style="margin: 0;" />
</td>
</tr>
</div>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
<div class="col-md-3">
<asp:UpdatePanel ID="UPObservaciones" runat="server" class="portlet light xspadding bordered " align="center" style="width: 300px;" UpdateMode="Conditional">
<ContentTemplate>
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span id="SpObs" runat="server" class="caption-subject bold uppercase">Observaciones </span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body formnombottom">
<table border="0" width="250px">
<tr align="left">
<td id="TrObsGenerales" runat="server">Observaciones Generales:&nbsp;</td>
</tr>
<tr align="left">
<td>
<asp:TextBox ID="TxtObsFact" runat="server" Rows="3" TextMode="MultiLine" Width="250px" MaxLength="800" CssClass="form-control input-sm"></asp:TextBox></td>
</tr>
<tr id="TrOC" runat="server">
<td>Orden de Compra: &nbsp;
<asp:TextBox ID="TxtOrdenCompra" runat="server" Width="100%" CssClass="form-control" CausesValidation="true"></asp:TextBox>
</td>
<td style="padding-top: 20px;">
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<div class="col-md-4" align="right">
<div class="row">
<div class="col-md-12" align="right" style="padding-bottom: 15px;">
<asp:UpdatePanel ID="UpFacturar" runat="server" class="portlet light xspadding bordered " style="width: 300px;" align="right" UpdateMode="Conditional">
<Triggers>
<asp:PostBackTrigger ControlID="BtnVistaPrevia" />
</Triggers>
<ContentTemplate>
<div class="portlet-title">
<div class="caption font-green">
<i class="icon-pin font-green"></i>
<span class="caption-subject bold uppercase">Acciones </span>
</div>
<div class="actions">
<div class="btn-group">
</div>
</div>
<div class="tools">
<a href="javascript:;" class="collapse"></a>
</div>
</div>
<div class="portlet-body formnombottom">
<div class="row" style="text-align: center;">
<asp:Label ID="LblMensaje" runat="server" Text="" CssClass="alert alert-warning" Style="padding: 5px; margin-bottom: 5px; padding-right: 25px;" Visible="false"></asp:Label>
</div>
<table border="0" style="text-align: center; width: 100%;">
<tr id="TrVistaPrevia" runat="server">
<td>
<asp:LinkButton ID="BtnVistaPrevia" runat="server" Text="Vista Previa <i class='fa-search-plus fa' style=' color: white;'></i>" CssClass="btn myventasbutton btn-primary" />
</td>
</tr>
<tr id="TrEmitir" runat="server" visible="false">
<td>
<asp:Button ID="BtnEmitir" runat="server" Text="Emitir" Width="170px" ValidationGroup="GrpEmitirImprimir" CssClass="btn myventasbutton btn-primary" />
</td>
</tr>
<tr runat="server" id="TrBotones">
<td align="center">
<asp:LinkButton ID="BtnEmitirImprimir" runat="server" Text="Emitir e Imprimir" ValidationGroup="GrpEmitirImprimir" CssClass="btn myventasbutton btn-primary" />
<div id="BtnsFacturar" class="btn-group myventasbutton" runat="server" visible="false">
<button class="btn myventasbutton btn-primary dropdown-toggle" data-toggle="dropdown" aria-expanded="false">
Facturar <i class="fa fa-angle-down"></i>
</button>
<ul class="dropdown-menu">
<li>
<asp:LinkButton ID="LBFacturarIngreso" Text="Ingreso" OnClick="LBFacturarIngreso_Click" runat="server" data-toggle="confirmation" data-popout="true" data-original-title="¿Seguro que desea facturar como tipo ingreso?" data-btn-ok-label="si" />
</li>
<li>
<asp:LinkButton ID="LBFacturarAnticipo" Text="Anticipo" OnClick="LBFacturarAnticipo_Click" runat="server" data-toggle="confirmation" data-popout="true" data-original-title="¿Seguro que desea facturar como tipo anticipo?" data-btn-ok-label="si" />
</li>
<%--<li>
<asp:Button ID="BtnFacturarIngreso" runat="server" Text="Ingreso" Visible="true" CssClass="btn myventasbutton" />
</li>
<li>
<asp:Button ID="BtnFacturarAnticipo" runat="server" Text="Ingreso" Visible="true" CssClass="btn myventasbutton" />
</li>--%>
</ul>
</div>
<asp:Button ID="BtnGenerarRemision" runat="server" Text="Generar Remisión" Visible="false" ValidationGroup="GrpEmitirImprimir" CssClass="btn myventasbutton btn-primary" data-toggle="confirmation" data-popout="true" data-original-title="¿Seguro que desea generar la remisión?" data-btn-ok-label="si" />
<asp:Button ID="BtnGeneraAutorizacion" runat="server" Text="Generar Autorización" OnClick="BtnGeneraAutorizacion_Click" Visible="false" ValidationGroup="GrpEmitirImprimir" CssClass="btn myventasbutton btn-primary" data-toggle="confirmation" data-popout="true" data-original-title="¿Seguro que desea generar la autorización?" data-btn-ok-label="si" />
<%--<asp:Button ID="Button2" runat="server" Text="Button" />--%>
<%--<asp:Button ID="BtnGenerarPoliza" runat="server" Text="GenerarPoliza" OnClick="BtnGenerarPoliza_Click" Visible="false" CssClass="btn myventasbutton btn-primary" />--%>
<%-- <asp:Button ID="BtnGenerarOS" runat="server" Text="Generar OS" Visible="false" CssClass="btn myventasbutton btn-primary" />
<asp:Button ID="BtnEditarCotizacion" runat="server" Text="Actualizar" Visible="false" CssClass="btn myventasbutton btn-primary" />
<asp:Button ID="BtnPermisoEditarCotizacion" runat="server" Text="Editar" Visible="false" CssClass="btn myventasbutton btn-primary" />
<asp:Button ID="BtnEditarRemision" runat="server" Text="Actualizar Remisión" CssClass="btn myventasbutton btn-primary" Visible="false" />
<asp:Button ID="BtnPermisoEditarRemision" runat="server" Text="Editar Remisión" CssClass="btn myventasbutton btn-primary" Visible="false" />
<asp:Button ID="BtnMandaMail" runat="server" Text="MandaMail" CssClass="btn myventasbutton btn-primary" Visible="false" />
<asp:Button ID="BtnCrearApartirDe" runat="server" Text="Crear a partir de" CssClass="btn myventasbutton btn-primary" Visible="false" />--%>
<asp:Button ID="BtnEditar" runat="server" Text="Editar" CssClass="btn myventasbutton btn-primary" Visible="false" />
</td>
</tr>
</table>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<br />
</div>
</div>
</div>
<asp:Button ID="BtnMostrarContrato" runat="server" Style="visibility: hidden; display: none;" />
<asp:Button ID="BtnCerrarContrato" runat="server" CssClass="btn btn-danger" Style="visibility: hidden; display: none;" />
<!-- ModalPopupExtender -->
<cc1:ModalPopupExtender ID="MPContrato" runat="server" PopupControlID="PanelContrato" TargetControlID="BtnMostrarContrato"
CancelControlID="BtnCerrarContrato" BackgroundCssClass="modalBackground">
</cc1:ModalPopupExtender>
<asp:Panel ID="PanelContrato" runat="server" CssClass="modalPopup" align="center" Style="display: none; padding: 10px;">
<asp:UpdatePanel ID="UpContratos" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<div id="AccionContrato" runat="server">
<p>
El Cliente tiene contratos vigentes.
<br />
¿La venta esta relacionada a un contrato?
</p>
<asp:RadioButtonList ID="RblOpcionContrato" runat="server" CssClass="rbl" RepeatDirection="Horizontal" RepeatLayout="Table">
<asp:ListItem Text="Si" Value="2"></asp:ListItem>
<asp:ListItem Text="No" Value="1"></asp:ListItem>
</asp:RadioButtonList>
<asp:LinkButton ID="BtnIniciarContrato" runat="server" CssClass="btn btn-success" Text="Aceptar" />
&nbsp;
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Panel>
<!-- ModalPopupExtender -->
<%-- ************************************************************************************************************************************************************************************************* --%>
<div class="row">
<div class="col-md-12 ">
<div class="portlet light bordered xspadding">
<div class="portlet-title">
<div class="caption font-green">
<span class="caption-subject bold uppercase">Bitacora</span>
</div>
<div class="actions">
<div class="btn-group">
<asp:HyperLink ID="ImgAddObs" CssClass="caption-subject bold font-green" data-toggle="modal" data-target="#ModalBitacora" runat="server" Text=" <i class='fa fa-commenting font-green'></i><span class='caption-subject bold'>Agregar</span>" Style="font-weight: 700 !important; cursor: pointer;" ToolTip="Observaciones"></asp:HyperLink><br />
<asp:HyperLink ID="HlEvento" CssClass="thickbox caption-subject bold font-green" runat="server" Visible="false" Style="cursor: pointer; text-decoration: none;" ToolTip="Agendar"><i class='fa fa-calendar-plus-o font-green' style='font-weight: 700 !important;' ></i> <span class="caption-subject bold font-green">Agendar</span></asp:HyperLink><br />
<asp:Literal ID="LtlTareaNueva" runat="server"></asp:Literal>
<UserControl:TareaNueva runat="server" ID="TareaNueva" />
<script>
function OnAddedTareaNueva() {
$('.btnupEventoBitacora').click();
}
</script>
</div>
</div>
</div>
<div class="portlet-body">
<asp:UpdatePanel ID="UPEventoBitacora" runat="server" UpdateMode="Conditional">
<ContentTemplate>
<asp:Button ID="btnupEventoBitacora" OnClick="btnupEventoBitacora_Click" UseSubmitBehavior="false" CssClass="hidden btnupEventoBitacora" runat="server" Text="Button" />
<asp:GridView ID="GvEB" runat="server" AutoGenerateColumns="False" EmptyDataText="No se han capturado comentarios o bitácora" CssClass="table table-striped table-advance table-hover Widthall" GridLines="None">
<Columns>
<asp:TemplateField>
<HeaderTemplate>Fecha</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlFecha" runat="server" Text='<%# Eval("FechaIng") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Fecha Agenda</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlFechaAgenda" runat="server" Text='<%# Eval("FechaInicio") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Usuario</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlUsuario" runat="server" Text='<%# Eval("Usuario") %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField>
<HeaderTemplate>Descripción</HeaderTemplate>
<ItemTemplate>
<asp:Literal ID="LtlEventoBitacora" runat="server" Text='<%#If(Eval("CveTipoEvento").ToString() = "1", String.Format("Tarea :<a href=""/OI/TareaDetalle.aspx?CveEvento={0}"">{1}<a>", Eval("CveEvento"), Eval("Asunto")), Eval("Descripcion").ToString()) %>'></asp:Literal>
</ItemTemplate>
</asp:TemplateField>
<asp:TemplateField ItemStyle-Width="50px">
<HeaderTemplate>Archivo</HeaderTemplate>
<ItemTemplate>
<asp:LinkButton ID="LinkArchivo" Visible="false" runat="server" CssClass="Texto" OnClick="DownloadFile">
<asp:Image ImageUrl="/Imagenes/Abajo.png" ID="ImgArchivo" runat="server" />
</asp:LinkButton>
</ItemTemplate>
</asp:TemplateField>
</Columns>
<HeaderStyle CssClass="Titulos" />
<AlternatingRowStyle CssClass="TextoAlterno" />
<RowStyle CssClass="Texto" />
</asp:GridView>
</ContentTemplate>
</asp:UpdatePanel>
</div>
</div>
</div>
</div>
<br />
<%-- MODAL BITACORA --%>
<asp:UpdatePanel runat="server" ID="UPAddEventoBitacora" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<div id="ModalBitacora" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header ">
<button type="button" class="close" data-dismiss="modal">&times;</button>
<h4 class="modal-title">Bitácora</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="col-md-8">
<label>Bitácora/Observaciones</label>
<br />
<asp:TextBox CssClass="form-control" ID="TxtEventoDescripcion" class="Widthall" runat="server" TextMode="MultiLine" Columns="60" Rows="6"></asp:TextBox>
<br />
</div>
<div class="col-md-4">
<asp:TextBox ID="Anexo" CssClass="ADSdropzone hidden" data-maxFile="1" Text="" runat="server"></asp:TextBox>
</div>
</div>
</div>
<div class="modal-footer">
<asp:Button ID="BtnGuardarEventoBitacora" runat="server" ClientIDMode="Static" Text="Guardar" CssClass="btn btn-primary" />
<button type="button" class="btn btn-danger" data-dismiss="modal">Cancelar</button>
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<%-- FIN MODAL BITACORA --%>
<asp:Button ID="BtnMateriales" runat="server" ClientIDMode="Static" Text="Materiales" Style="display: none;" />
<asp:Button ID="BtnEnviarMailCancelacion" runat="server" ClientIDMode="Static" Text="Enviar Mail Cliente" Style="display: none;" />
<asp:Button ID="BtnRefacturacionConfirmar" runat="server" ClientIDMode="Static" Text="Refacturacion Documento" Style="display: none;" />
<asp:Button ID="BtnRefacturacionConfirmarAceptacion" runat="server" ClientIDMode="Static" Text="Refacturacion Aceptacion Documento" Style="display: none;" />
<asp:Button ID="BtnRefrescarPagina" runat="server" ClientIDMode="Static" Text="Refrescar" Style="display: none;" />
<asp:Button ID="BtnAplicaNuevaNC" runat="server" ClientIDMode="Static" Text="AplicarNC" Style="display: none;" />
<asp:HiddenField ID="HdnCveVentaAcuse" runat="server" ClientIDMode="Static" Value="0" />
<div id="DVAddPS" class="modal ADS fade" role="dialog">
<asp:UpdatePanel class="modal-dialog" runat="server" ID="UpDVAddPS" UpdateMode="Conditional">
<ContentTemplate>
<div class="modal-content">
<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="H2" runat="server">
<asp:Literal runat="server" ID="LtlDVAddPSTitulo">Agregar Producto</asp:Literal>
</h4>
</div>
<div class="modal-body">
<div class="row">
<div class="form-group form-md-line-input input-iconright col-md-6 ">
<asp:TextBox ID="TxtCantidad" onkeyup="Recalcula();" onkeypress="DisableEnterKey(event);" runat="server" CssClass="form-control " ClientIDMode="Static" MaxLength="12" ValidationGroup="GprAgregaPS"></asp:TextBox>
<ajax:FilteredTextBoxExtender ID="SoloNumerosCantidad" runat="server" TargetControlID="TxtCantidad" FilterType="Custom, Numbers" ValidChars="." />
<asp:RequiredFieldValidator ID="RFVCantidad" runat="server" ControlToValidate="TxtCantidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> es necesario, por favor ingréselo." ValidationGroup="GprAgregaPS"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCOCantidad1" runat="server" HighlightCssClass="vco" TargetControlID="RFVCantidad" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:CustomValidator ID="CVCantidad" runat="server" ClientValidationFunction="ValidaDecimal6digits" ControlToValidate="TxtCantidad" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Cantidad''</b> no tiene el formato correcto. Por favor rectifique y vuelva a intentar." ValidateEmptyText="True" ValidationGroup="GprAgregaPS"></asp:CustomValidator>
<ajax:ValidatorCalloutExtender ID="VCECantidad" runat="server" HighlightCssClass="vco" TargetControlID="CVCantidad" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= TxtCantidad.ClientID.ToString()%>">Cantidad:</label>
</div>
</div>
<asp:UpdatePanel runat="server" ID="UPPPS" UpdateMode="Conditional">
<ContentTemplate>
<asp:HiddenField ID="HdnIVAPS" runat="server" Value="-1" />
<asp:HiddenField ID="HdnIVARetAPS" runat="server" Value="-1" />
<asp:HiddenField ID="HdnPS" runat="server" Value="-1" />
<asp:HiddenField ID="HdnCodigoPS" runat="server" Value="-1" />
<asp:HiddenField ID="HdnTipoPS" runat="server" Value="-1" />
<asp:HiddenField ID="HdnTipoInv" runat="server" Value="-1" />
<asp:HiddenField ID="HdnCodigo" runat="server" Value="-1" />
<asp:HiddenField ID="HdnAplicaIEPS" runat="server" Value="-1" />
<asp:HiddenField ID="HdnPorcentajeIEPS" runat="server" Value="-1" />
<asp:HiddenField ID="HdnCvePS" runat="server" Value="-1" />
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlClasificacion" CssClass="form-control input-sm select2me" runat="server" AppendDataBoundItems="true" AutoPostBack="true" DataTextField="Clasificacion" DataValueField="CveClasificacion" Width="100%">
<asp:ListItem Selected="True" Text="Seleccione la Clasificación (Todas)" Value="-1"></asp:ListItem>
</asp:DropDownList>
<label for="<%= DdlClasificacion.ClientID.ToString()%>">Clasificación:</label>
</div>
</div>
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<ADS:Dropdownlost runat="server" ID="DdlPS" CssStyle="width: 100%;" CssClass="DdlPS " CssClassDdl="form-control select2me " IncluyeTodos="false" DataTextField="PSCodigo" DataValueField="CvePS" data-onresult="CargaExistenciaAlmacenes" />
<label for="<%= DdlPS.ClientID.ToString()%>">Producto Servicio:</label>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:DropDownList ID="DdlUnidadMedida" AppendDataBoundItems="true" CssClass="form-control input-sm select2me " runat="server" DataTextField="UnidadMedida" DataValueField="CveUnidadMedida" Style="width: 100%; max-width: 150px;"></asp:DropDownList>
<asp:RequiredFieldValidator ID="RFVUnidadMedida" runat="server" ControlToValidate="DdlUnidadMedida" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Unidad de Medida''</b> es necesario, por favor ingréselo." ValidationGroup="GprAgregaPS"></asp:RequiredFieldValidator>
<ajax:ValidatorCalloutExtender ID="VCEUnidadMedida" runat="server" HighlightCssClass="vco" TargetControlID="RFVUnidadMedida" Width="300px"></ajax:ValidatorCalloutExtender>
<asp:RangeValidator ID="RVUM" runat="server" Type="Integer" MinimumValue="0" MaximumValue="999999999" ErrorMessage="El campo <b>''Unidad de Medida''</b> es necesario, por favor ingréselo." ControlToValidate="DdlUnidadMedida" Display="None" ValidationGroup="GprAgregaPS"></asp:RangeValidator>
<ajax:ValidatorCalloutExtender ID="VCEUM" runat="server" HighlightCssClass="vco" TargetControlID="RVUM" Width="300px"></ajax:ValidatorCalloutExtender>
<label for="<%= DdlUnidadMedida.ClientID.ToString()%>">Unidad De Medida:</label>
</div>
</div>
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
<asp:TextBox ID="TxtObsPS" CssClass="form-control input-sm" runat="server" Rows="2" TextMode="MultiLine" Width="100%"></asp:TextBox></th>
<label for="<%= TxtObsPS.ClientID.ToString()%>">Observaciones:</label>
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<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="GprAgregaPS" Width="100%" 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="GprAgregaPS"></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="GprAgregaPS"></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-6">
<div class="form-group form-md-line-input input-iconright">
</div>
</div>
</div>
<div class="row">
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
</div>
</div>
<div class="col-md-6">
<div class="form-group form-md-line-input input-iconright">
</div>
</div>
</div>
</div>
<div class="modal-footer">
<asp:LinkButton ID="LbAgregar" ClientIDMode="Static" runat="server" CssClass="btn btn-primary" Enabled="false" Text="Guardar" ValidationGroup="GprAgregaPS" />
<button type="button" class="btn btn-default" data-dismiss="modal">Cancelar</button>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</div>
<asp:UpdatePanel runat="server" ID="UpDvModalTipoVenta" UpdateMode="Conditional" RenderMode="Inline">
<ContentTemplate>
<div id="DvModalTipoVenta" class="modal ADS fade" role="dialog">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header ">
<h4 class="modal-title">Tipo de Venta</h4>
</div>
<div class="modal-body">
<asp:RadioButtonList ID="RBLTipoVenta" DataTextField="TipoVenta" DataValueField="CveTipoVenta" runat="server" AutoPostBack="true" OnSelectedIndexChanged="RBLTipoVenta_SelectedIndexChanged">
</asp:RadioButtonList>
</div>
<div class="modal-footer">
</div>
</div>
</div>
</div>
</ContentTemplate>
</asp:UpdatePanel>
</asp:Content>
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
<script type="text/javascript">
function DirclienteValidaCodigoPostal() {
$("#BtnDirClienteValidar").click();
}
function ValidaCuentaEfectivo(val, args) {
//VALIDA SOLO SI EL IMPORTE ES MAYOR A CERO
var totalPago = ToDouble($get("TxtImporteEfectivo").value);
if (totalPago > 0) {
args.IsValid = (ToDouble(args.Value) > 0);
}else
{
args.IsValid = true;
}
}
function ValidaCuentaCredito(val, args) {
//VALIDA SOLO SI EL IMPORTE ES MAYOR A CERO
var totalPago = ToDouble($get("TxtImporteCredito").value);
if (totalPago > 0) {
args.IsValid = (ToDouble(args.Value) > 0);
}else
{
args.IsValid = true;
}
}
function ValidaCuentaDebito(val, args) {
//VALIDA SOLO SI EL IMPORTE ES MAYOR A CERO
var totalPago = ToDouble($get("TxtImporteDebito").value);
if (totalPago > 0) {
args.IsValid = (ToDouble(args.Value) > 0);
}else
{
args.IsValid = true;
}
}
function ValidaCuentaCheque(val, args) {
//VALIDA SOLO SI EL IMPORTE ES MAYOR A CERO
var totalPago = ToDouble($get("TxtImporteCheque").value);
if (totalPago > 0) {
args.IsValid = (ToDouble(args.Value) > 0);
}else
{
args.IsValid = true;
}
}
function ValidaCuentaTransferencia(val, args) {
//VALIDA SOLO SI EL IMPORTE ES MAYOR A CERO
var totalPago = ToDouble($get("TxtImporteTransferencia").value);
if (totalPago > 0) {
args.IsValid = (ToDouble(args.Value) > 0);
}else
{
args.IsValid = true;
}
}
//FUNCIONES PARA COMERCIO EXTERIOR
function CalculaTotalUSD(TotalUSD, ValorUnitario, TxtCantidad) {
TotalUSD.innerText = FormatoNumero(ToDouble(ValorUnitario.value) * ToDouble(TxtCantidad.value), 2);
}
function LimitaCantidadAplicaDev(Cantidad, TxtCantidadAplicaDevolucion) {
if (ToDouble(TxtCantidadAplicaDevolucion.value) > Cantidad) {
TxtCantidadAplicaDevolucion.value = FormatoNumero(Cantidad, 2)
}
}
function CalculaImporteNCMasivo() {
var total = 0;
var valor = 0;
var saldo = 0;
var Porcentaje = ToDouble($get('TxtNCPorcentaje').value);
var cellindex = 0;
var TotalImportes = 0;
if ($('#C_DdlNCNivelImporte').val() == "1") {
cellindex = 9;
} else if ($('#C_DdlNCNivelImporte').val() == "2") {
cellindex = 3;
}
$('.gvcxcChe input:checked').each(function () {
valor = ToDouble($(this).closest('tr').find('>td')[cellindex].innerText);
TotalImportes += ToDouble($(this).closest('tr').find('>td')[cellindex].innerText);
saldo = ToDouble($(this).closest('tr').find('>td')[10].innerText);
if (valor > saldo) {
valor = saldo;
}
valor = Porcentaje * valor / 100;
$(this).closest('tr').find('.myvalue').val(FormatoNumero(valor, 2));
total += ToDouble(valor);
});
$get('TxtTotalGv').value = FormatoNumero(TotalImportes, 2);
$get('TxtNCImporte').value = FormatoNumero(total, 2);
if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1') {
CompararNC();
}
}
function CalculaSaldoRNCChk(TxtImporte, Saldo, Chk) {
//ImportesRNCCargo
if (Chk.checked) {
let SaldoMaximoUtilizable = ToDouble(HdnSaldoMaximoUsados.value)
let ImportesAsignados = 0;
$('.ImportesRNCCargo').each(function () {
if ($(this).context.id != TxtImporte.id) {
ImportesAsignados += ToDouble($(this).val());
}
});
let Importe = SaldoMaximoUtilizable - ImportesAsignados;
if (Importe > 0) {
if (Saldo > Importe) {
TxtImporte.value = FormatoNumero(Importe, 2);
} else {
TxtImporte.value = FormatoNumero(Saldo, 2);
}
} else {
if (SaldoMaximoUtilizable <= 0) {
TxtImporte.value = "";
Chk.checked = false;
} else {
TxtImporte.value = FormatoNumero(Saldo, 2);
}
}
} else {
TxtImporte.value = "";
}
}
function CalculaSaldoRNCChkDetalle(TxtCantidad, CantidadPendiente, ImporteTotal, Chk) {
//ImportesRNCCargo
let Importe = 0;
if (Chk.checked) {
let SaldoMaximoUtilizable = ToDouble(HdnSaldoMaximoUsados.value)
let ImportesAsignados = 0;
$('.ImportesRNCDetalle').each(function () {
if (Chk.id != $(this).find("td").eq(0).find(":checkbox").attr('id')) {
let seleccionado = $(this).find("td").eq(0).find(":checkbox").is(':checked');
if (seleccionado) {
let cantidad = ToDouble($(this).find("td").eq(1).find(":text").val());
let porcentajeIVA = ToDouble($(this).find("td").eq(0).find(":hidden").val());
let precio = ToDouble($(this).find("td").eq(5).find(":hidden").val());
let totalcalculableImpuestos = (cantidad * precio);
let iva = ToDouble((totalcalculableImpuestos * porcentajeIVA).toFixed(2));
ImportesAsignados += totalcalculableImpuestos + iva;
}
}
});
Importe = SaldoMaximoUtilizable - ImportesAsignados;
if (Importe > 0) {
} else {
if (SaldoMaximoUtilizable <= 0) {
Importe = 0;
Chk.checked = false;
} else {
Importe = 0;
}
}
} else {
Importe = 0;
}
Importe = ToDouble(Importe.toFixed(2));
if (Importe > 0) {
let pu = (ImporteTotal / CantidadPendiente);
if (pu > 0) {
const cantidadSugerida = (Importe / pu);
if (cantidadSugerida > CantidadPendiente) {
TxtCantidad.value = CantidadPendiente.toString();
}else {
TxtCantidad.value = cantidadSugerida.toString();
}
}else {
TxtCantidad.value = "0";
}
}else {
TxtCantidad.value = "0";
}
}
function CalculaSaldoRNCChkDetalleBonificacion(TxtCantidad, CantidadPendiente, ImporteTotal, Chk) {
//ImportesRNCCargo
let Importe = 0;
if (Chk.checked) {
let SaldoMaximoUtilizable = 999999999;
let ImportesAsignados = 0;
$('.ImportesRNCDetalleBonificacion').each(function () {
if (Chk.id != $(this).find("td").eq(0).find(":checkbox").attr('id')) {
let seleccionado = $(this).find("td").eq(0).find(":checkbox").is(':checked');
if (seleccionado) {
let cantidad = ToDouble($(this).find("td").eq(1).find(":text").val());
let porcentajeIVA = ToDouble($(this).find("td").eq(0).find(":hidden").val());
let precio = ToDouble($(this).find("td").eq(5).find(":hidden").val());
let totalcalculableImpuestos = (cantidad * precio);
let iva = ToDouble((totalcalculableImpuestos * porcentajeIVA).toFixed(2));
ImportesAsignados += totalcalculableImpuestos + iva;
}
}
});
Importe = SaldoMaximoUtilizable - ImportesAsignados;
if (Importe > 0) {
} else {
if (SaldoMaximoUtilizable <= 0) {
Importe = 0;
Chk.checked = false;
} else {
Importe = 0;
}
}
} else {
Importe = 0;
}
Importe = ToDouble(Importe.toFixed(2));
if (Importe > 0) {
let pu = (ImporteTotal / CantidadPendiente);
if (pu > 0) {
const cantidadSugerida = (Importe / pu);
if (cantidadSugerida > CantidadPendiente) {
TxtCantidad.value = CantidadPendiente.toString();
}else {
TxtCantidad.value = cantidadSugerida.toString();
}
}else {
TxtCantidad.value = "0";
}
}else {
TxtCantidad.value = "0";
}
}
function CalculaSaldoRNCChkDetalleBon(TxtCantidad, CantidadPendiente, ImporteTotal, Chk) {
//ImportesRNCCargo
let Importe = 0;
if (Chk.checked) {
let SaldoMaximoUtilizable = ToDouble(HdnSMUBon.value);
let ImportesAsignados = 0;
$('.ImportesRNCDetalleBonificacion').each(function () {
if (Chk.id != $(this).find("td").eq(0).find(":checkbox").attr('id')) {
let seleccionado = $(this).find("td").eq(0).find(":checkbox").is(':checked');
if (seleccionado) {
let cantidad = ToDouble($(this).find("td").eq(1).find(":text").val());
let porcentajeIVA = ToDouble($(this).find("td").eq(0).find(":hidden").val());
let precio = ToDouble($(this).find("td").eq(5).find(":hidden").val());
let totalcalculableImpuestos = (cantidad * precio);
let iva = ToDouble((totalcalculableImpuestos * porcentajeIVA).toFixed(2));
ImportesAsignados += totalcalculableImpuestos + iva;
}
}
});
Importe = SaldoMaximoUtilizable - ImportesAsignados;
if (Importe > 0) {
} else {
if (SaldoMaximoUtilizable <= 0) {
Importe = 0;
Chk.checked = false;
} else {
Importe = 0;
}
}
} else {
Importe = 0;
}
Importe = ToDouble(Importe.toFixed(2));
if (Importe > 0) {
let pu = (ImporteTotal / CantidadPendiente);
if (pu > 0) {
const cantidadSugerida = (Importe / pu);
if (cantidadSugerida > CantidadPendiente) {
TxtCantidad.value = CantidadPendiente.toString();
}else {
TxtCantidad.value = cantidadSugerida.toString();
}
}else {
TxtCantidad.value = "0";
}
}else {
TxtCantidad.value = "0";
}
}
function LimitaSaldoRNCChk(TxtImporte, Saldo) {
var Importe = 0;
if (TxtImporte.value.includes('.')) {
return;
}
if (TxtImporte.value.includes(',')) {
return;
}
var regex = new RegExp("^[-+]?[0-9]+\.[0-9]+$");
if (regex.test(TxtImporte.value)) {
if (TxtImporte.value != '') {
Importe = parseFloat(TxtImporte.value);
}
let SaldoMaximoUtilizable = parseFloat(HdnSaldoMaximoUsados.value)
let ImportesAsignados = 0;
$('.ImportesRNCCargo').each(function () {
if ($(this).context.id != TxtImporte.id) {
ImportesAsignados += ToDouble($(this).val());
}
});
let ImporteDiferencia = SaldoMaximoUtilizable - ImportesAsignados;
if (Importe > ImporteDiferencia) {
TxtImporte.value = FormatoNumero(ImporteDiferencia, 2);
} else {
TxtImporte.value = FormatoNumero(Importe, 2);;
}
}
}
function CalculaSaldoRNCBonChkDesc(TxtImporte, Saldo, Chk) {
if (Chk.checked) {
TxtImporte.value = FormatoNumero(Saldo, 2);
} else {
TxtImporte.value = "";
}
}
function LimitaSaldoRNCBonChkDesc(TxtImporte, Saldo) {
var Importe = 0;
if (TxtImporte.value.includes('.')) {
return;
}
if (TxtImporte.value.includes(',')) {
return;
}
var regex = new RegExp("^[-+]?[0-9]+\.[0-9]+$");
if (regex.test(TxtImporte.value)) {
if (TxtImporte.value != '') {
Importe = parseFloat(TxtImporte.value);
}
let SaldoMaximoUtilizable = parseFloat(Saldo)
let ImporteDiferencia = SaldoMaximoUtilizable; //- ImportesAsignados;
if (Importe > ImporteDiferencia) {
TxtImporte.value = FormatoNumero(ImporteDiferencia, 2);
} else {
TxtImporte.value = FormatoNumero(Importe, 2);;
}
}
}
function CalculaSaldoRNCBonChk(TxtImporte, Saldo, Chk) {
if (Chk.checked) {
let SaldoMaximoUtilizable = ToDouble(HdnSMUBon.value)
let ImportesAsignados = 0;
$('.ImportesRNCBon').each(function () {
if ($(this).context.id != TxtImporte.id) {
ImportesAsignados += ToDouble($(this).val());
}
});
let Importe = SaldoMaximoUtilizable - ImportesAsignados;
if (Importe > 0) {
if (Saldo > Importe) {
TxtImporte.value = FormatoNumero(Importe, 2);
} else {
TxtImporte.value = FormatoNumero(Saldo, 2);
}
} else {
if (SaldoMaximoUtilizable <= 0) {
TxtImporte.value = "";
Chk.checked = false;
} else {
TxtImporte.value = FormatoNumero(Saldo, 2);
}
}
} else {
TxtImporte.value = "";
}
}
function LimitaSaldoRNCBonChk(TxtImporte, Saldo) {
var Importe = 0;
if (TxtImporte.value.includes('.')) {
return;
}
if (TxtImporte.value.includes(',')) {
return;
}
var regex = new RegExp("^[-+]?[0-9]+\.[0-9]+$");
if (regex.test(TxtImporte.value)) {
if (TxtImporte.value != '') {
Importe = parseFloat(TxtImporte.value);
}
let SaldoMaximoUtilizable = parseFloat(HdnSMUBon.value)
let ImportesAsignados = 0;
$('.ImportesRNCBon').each(function () {
if ($(this).context.id != TxtImporte.id) {
ImportesAsignados += ToDouble($(this).val());
}
});
let ImporteDiferencia = SaldoMaximoUtilizable - ImportesAsignados;
if (Importe > ImporteDiferencia) {
TxtImporte.value = FormatoNumero(ImporteDiferencia, 2);
} else {
TxtImporte.value = FormatoNumero(Importe, 2);;
}
}
}
function CalculaTotalChk(Total, SubTotal, TxtTotalGv, TxtImporte, Saldo, Porcentaje, Chk) {
var Importe = 0, ImporteSinPorcentaje = 0;
Importe = ($('#C_DdlNCNivelImporte').val() == "1" ? Total : SubTotal);
ImporteSinPorcentaje = Importe;
if (Importe > Saldo) {
Importe = Saldo;
}
Importe = Porcentaje * Importe / 100;
if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1') {
if (Chk.checked) {
//SI HAY RNC SELECCIONADAS
if (ToDouble($get('TxtImportesRemisionesNC').value) > 0) {
let ImporteRestante = ToDouble($get('TxtImportesRemisionesNC').value) - ToDouble($get('TxtNCImporte').value)
if (ImporteRestante < 0) {
ImporteRestante = 0;
}
if ((ToDouble(TxtTotalGv.value) + ImporteSinPorcentaje) > ImporteRestante) {
TxtTotalGv.value = FormatoNumero(ToDouble(TxtTotalGv.value) + ImporteRestante, 2);
}
if (Importe > ImporteRestante) {
TxtImporte.value = FormatoNumero(ImporteRestante, 2);
$get('TxtNCImporte').value = FormatoNumero(ToDouble($get('TxtNCImporte').value) + ToDouble(TxtImporte.value), 2);
}else {
$get('TxtNCImporte').value = FormatoNumero(ToDouble($get('TxtNCImporte').value) + Importe, 2);
}
if (ToDouble(TxtImporte.value) <= 0) {
Chk.checked = false;
}
}else {
TxtTotalGv.value = FormatoNumero(ToDouble(TxtTotalGv.value) + ImporteSinPorcentaje, 2);
TxtImporte.value = FormatoNumero(Importe, 2);
$get('TxtNCImporte').value = FormatoNumero(ToDouble($get('TxtNCImporte').value) + Importe, 2);
}
} else {
TxtTotalGv.value = FormatoNumero(ToDouble(TxtTotalGv.value) - ImporteSinPorcentaje, 2);
$get('TxtNCImporte').value = FormatoNumero(ToDouble($get('TxtNCImporte').value) - ToDouble(TxtImporte.value), 2);
TxtImporte.value = "";
}
CompararNC();
}else {
if (Chk.checked) {
TxtTotalGv.value = FormatoNumero(ToDouble(TxtTotalGv.value) + ImporteSinPorcentaje, 2);
TxtImporte.value = FormatoNumero(Importe, 2);
$get('TxtNCImporte').value = FormatoNumero(ToDouble($get('TxtNCImporte').value) + Importe, 2);
} else {
TxtTotalGv.value = FormatoNumero(ToDouble(TxtTotalGv.value) - ImporteSinPorcentaje, 2);
$get('TxtNCImporte').value = FormatoNumero(ToDouble($get('TxtNCImporte').value) - ToDouble(TxtImporte.value), 2);
TxtImporte.value = "";
}
}
}
function CalculaTotalRNCChk(TxtImporte, Saldo, Chk) {
if (Chk.checked) {
TxtImporte.value = FormatoNumero(Saldo, 2);
} else {
TxtImporte.value = "";
}
if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1') {
CompararNC();
}
}
function LimitaCantidadRNCMasivo(TxtImporte, Saldo, Chk) {
var ImporteNuevo = TxtImporte.value;
Chk.checked = true;
if (ImporteNuevo > Saldo) {
ImporteNuevo = Saldo;
Entro = 1;
}
if (Entro == 1) {
TxtImporte.value = FormatoNumero(ImporteNuevo, 2);
}
if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1') {
CompararNC();
}
}
function LimitaCantidadNCMasivo(Porcentaje, Saldo, Total, Subtotal, TxtTotalGv, TxtTotal, Chk, TxtImporte) {
var ImporteNivel = 0, ImporteNuevo = 0, Entro = 0, ValorMaximoPorPorcentaje = 0, TotalConPorcentaje = 0, TotalImportes = 0;
ImporteNivel = ($('#C_DdlNCNivelImporte').val() == "1" ? Total : Subtotal);
ImporteNuevo = ToDouble(TxtImporte.value);
Chk.checked = true;
if (ImporteNuevo > ImporteNivel) {
ImporteNuevo = ImporteNivel;
Entro = 1;
}
if (ImporteNuevo > Saldo) {
ImporteNuevo = Saldo;
Entro = 1;
}
if (Entro == 1) {
TxtImporte.value = FormatoNumero(ImporteNuevo, 2);
}
var CellIndex = 0;
if ($('#C_DdlNCNivelImporte').val() == "1") {
CellIndex = 9;
} else if ($('#C_DdlNCNivelImporte').val() == "2") {
CellIndex = 3;
}
$('.gvcxcChe input:checked').each(function () {
TotalImportes += ToDouble($(this).closest('tr').find('>td')[CellIndex].innerText);
TotalConPorcentaje += ToDouble($(this).closest('tr').find('.myvalue').val());
});
TxtTotalGv.value = FormatoNumero(TotalImportes, 2);
TxtTotal.value = FormatoNumero(TotalConPorcentaje, 2);
if ('<%= UsuarioActual.Empresa.Funcionalidad(344) %>' == '1') {
CompararNC();
}
}
function LimitaPenalizacionDevolucion(TxtPenalizacion) {
const Porcentaje = ToDouble(TxtPenalizacion.value)
if (Porcentaje >= 100) {
TxtPenalizacion.value = "100"
}
}
function displayToastr(x) {
toastr.options = {
"closeButton": true,
"debug": false,
"positionClass": "toast-top-right",
"onclick": null,
"showDuration": "2",
"hideDuration": "1000",
"timeOut": "5000",
"extendedTimeOut": "1000",
"showEasing": "swing",
"hideEasing": "linear",
"showMethod": "fadeIn",
"hideMethod": "fadeOut"
}
// Display a success toast, with a title
if (x == 1) {
toastr.success('Producto agregado correctamente', '')
}
if (x == 2) {
toastr.success('Producto actualizado correctamente', '')
}
}
function CallServerMethod(e) {
tecla = (document.all) ? e.keyCode : e.which;
if (tecla == 13) {
$("#LnkAgregarPyME").trigger("click");
document.getElementById("TxtCantidadPyME").focus();
}
}
function setFocus(e, idFocus) {
let key = (window.event) ? window.event.keyCode : e.which;
if (key == 13) {
let Elemento = document.getElementById(idFocus)
if (Elemento)
Elemento.focus();
e.preventDefault();
e.stopPropagation();
return false;
} else {
return true;
}
}
function DisableEnterKey(e) {
let key = (window.event) ? window.event.keyCode : e.which;
if (key == 13) {
e.preventDefault();
e.stopPropagation();
return false;
}
}
function ClosePopup() {
try {
$('#DivAddVenta').modal('hide');
}
catch (e) { alert(e); }
}
function CreaDescripcionPS() {
var Text = '';
if ($('#C_DdlTipo').val() != "-1") {
Text = $("#C_DdlTipo option:selected").text();
}
if ($('#C_DdlMarcaPSDes').val() != "-1") {
Text += ' ' + $("#C_DdlMarcaPSDes option:selected").text();
}
Text += ' ' + $get('C_TxtModelo').value;
Text += ' ' + $get('C_TxtAdicional').value;
$get('C_TxtPS').value = Text;
}
function ValidaGuardar(ImprimeSucursal) {
$('.popover').remove();
$("#C_BtnEmitirImprimir").removeAttr("aria-describedby");
setTimeout(
function () {
;
var Text = '';
if ($("#C_DdlTipoComprobante").length) {
Text = '<b>' + $("#C_DdlTipoComprobante option:selected").text() + '</b><br/><br/>';
}
if ($("#C_LblCliente").length) {
if (ImprimeSucursal == 0) {
Text += '<b>Cliente:</b> ' + $get('C_LblCliente').innerText + '<br/>';
}
else {
if ($('#C_DdlSucursalCliente option:selected').text() == 'Matriz') {
Text += '<b>Cliente:</b> ' + $get('C_LblCliente').innerText + '<br/>';
}
else {
Text += '<b>Cliente:</b> ' + $('#C_DdlSucursalCliente option:selected').text() + '<br/>';
}
}
}
if ($("#C_TxtFolio").length) {
Text += '<b>Folio:</b> ' + $get('C_TxtFolio').value + '<br/>';
}
/*
if ($("#C_DdlVendedor").length) {
if (ToDouble($("#C_DdlVendedor option:selected").val()) > 0) {
Text += '<b>Vendedor:</b> ' + $("#C_DdlVendedor option:selected").text() + '<br/>';
}
}*/
if ($("#C_TxtFecha").length) {
Text += '<b>Fecha:</b> ' + $get('C_TxtFecha').value + '<br/>';
}
if ($("#TxtTotal").length) {
Text += '<b>Total: $</b> ' + $get('TxtTotal').value + ' ' + $("#DdlMoneda option:selected").text() + '<br/>';
}
if ($get('HdnTieneAnticipos').value == 1) {
if ($("#TxtTotal").length) {
if ($get('TxtTotal').value > 0) {
if ($get('HdnTieneAnticiposVinculados').value == 1) {
Text += '<br/><br/>Hay anticipos vinculados pero <b>no cubren la totalidad de la factura</b> ' + '<br/>';
} else {
Text += '<br/><br/>El cliente tiene <b>anticipos pendientes</b> y no se ha vinculado ninguno ' + '<br/>';
}
}
}
}
$('.popover-title').html(Text);
}, 10);
}
function C() {
return confirm('¿Desea quitar el Producto o Servicio de la Factura?');
}
function OpenInNewTab(url) {
var win = window.open(url, '_blank');
win.focus();
}
function OpenInCurentTab(url) {
var win = window.open(url, '_self');
win.focus();
}
function CargaCliente(CveCliente) {
$get("HdnCveCliente").value = CveCliente;
$('#BtnBuscarCliente').click();
}
function Recalcula() {
var Cant = $get("TxtCantidad").value;
var PrecioFormato = $get("TxtPrecio").value;
var Precio = Number(PrecioFormato.replace(/[^0-9\.]+/g, ""));
$get("LblPrecio1").innerText = formato_numero(PrecioFormato, 2, '.', ',');
if (isNaN(Cant))
Cant = 0;
if (isNaN(Precio))
Precio = 0;
$get("LblTotalPS").innerHTML = formato_numero(parseFloat(Cant) * parseFloat(PrecioFormato), 2, '.', ',');
$get("LblTotalPS1").innerHTML = $get("LblTotalPS").innerHTML;
}
function RecalculaPyME() {
var Cant = $get("TxtCantidadPyME").value;
var PrecioFormato = $get("TxtPrecioPyME").value;
var Precio = Number(PrecioFormato.replace(/[^0-9\.]+/g, ""));
$get("LblPrecio1").innerText = formato_numero(PrecioFormato, 2, '.', ',');
if (isNaN(Cant))
Cant = 0;
if (isNaN(Precio))
Precio = 0;
$get("LblTotalPyME").innerHTML = formato_numero(parseFloat(Cant) * parseFloat(PrecioFormato), 2, '.', ',');
$get("LblTotalPS1").innerHTML = $get("LblTotalPyME").innerHTML;
}
function CalculaDescuento() {
if ($get("TxtPorDescP").value != "0" && $get("TxtPorDescP").value != "") {
var Monto = 0;
var TipoDescuento = $get("HdnTipoDescuento").value;
if (TipoDescuento == 0) {
Monto = parseFloat($get("LblPrecio1").innerText.replace(",", "").replace(",", ""));
}
else if (TipoDescuento == 1) {
Monto = parseFloat($get("LblTotalPS1").innerText.replace(",", "").replace(",", ""));
}
else if (TipoDescuento == 2) {
Monto = parseFloat($get("LblSubTotal1").innerText.replace(",", "").replace(",", ""));
}
else if (TipoDescuento == 3) {
Monto = parseFloat($get("LblSubTotal1").innerText.replace(",", "").replace(",", ""));
}
var Descuento = parseFloat($get("TxtPorDescP").value);
$get("LblPrecioFinal").innerText = formato_numero(Monto - ((Monto * Descuento) / 100), 2, '.', ',');
var Total = Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""));
$get("LblDescuento").innerText = formato_numero(Total, 2, '.', ',');
$get("HdnDescuento").value = Total;
if (TipoDescuento == 2) {
Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""));
}
}
else if ($get("TxtDescP").value != "0" && $get("TxtDescP").value) {
var Monto = 0;
var TipoDescuento = $get("HdnTipoDescuento").value;
if (TipoDescuento == 0) {
Monto = parseFloat($get("LblPrecio1").innerText.replace(",", "").replace(",", ""));
}
else if (TipoDescuento == 1) {
Monto = parseFloat($get("LblTotalPS1").innerText.replace(",", "").replace(",", ""));
}
else if (TipoDescuento == 2) {
Monto = parseFloat($get("LblSubTotal1").innerText.replace(",", "").replace(",", ""));
}
else if (TipoDescuento == 3) {
Monto = parseFloat($get("LblSubTotal1").innerText.replace(",", "").replace(",", ""));
}
var Descuento = parseFloat($get("TxtDescP").value);
$get("LblPrecioFinal").innerText = formato_numero(Monto - Descuento, 2, '.', ',');
var Total = Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""));
$get("LblDescuento").innerText = formato_numero(Total, 2, '.', ',');
$get("HdnDescuento").value = Total;
if (TipoDescuento == 2) {
Monto - parseFloat($get("LblPrecioFinal").innerText.replace(",", "").replace(",", ""));
}
}
else {
$get("LblPrecioFinal").innerText = "0.00";
$get("LblDescuento").innerText = "0.00";
$get("HdnDescuento").value = "0.00";
}
}
function BorraDescuentos() {
$get("TxtPorDescP").value = "0";
$get("TxtDescP").value = "0";
$get("LblPrecioFinal").innerText = "0.00";
$get("LblDescuento").innerText = "0.00";
$get("HdnDescuento").value = 0;
$get('HdnTipoDescuento').value = '-1';
$("#LblSubTotal1").text($("#TxtSubTotal").val());
}
function formato_numero(numero, decimales, separador_decimal, separador_miles) { // v2007-08-06
numero = parseFloat(numero);
if (isNaN(numero)) {
return "";
}
if (decimales !== undefined) {
// Redondeamos
numero = numero.toFixed(decimales);
}
// Convertimos el punto en separador_decimal
numero = numero.toString().replace(".", separador_decimal !== undefined ? separador_decimal : ",");
if (separador_miles) {
// Añadimos los separadores de miles
var miles = new RegExp("(-?[0-9]+)([0-9]{3})");
while (miles.test(numero)) {
numero = numero.replace(miles, "$1" + separador_miles + "$2");
}
}
return numero;
}
function MuestraAnticipos() {
try {
$('#DivAnticipos').modal();
}
catch (e) { alert(e); }
}
function MuestraOtrosConceptos() {
try {
$("#ModalOtrosConceptos").show();
$("#ModalOtrosConceptos").center();
}
catch (e) { alert(e); }
}
function CalculaDiferencia() {
;
var total = 0
total = ToDouble($('#C_TxtEfectivoEnCaja').val()) - ToDouble($('#C_LblEfectivoEsperado').text());
$('#C_LblDiferenciaCaja').text(FormatoNumero(total));
}
function CalculaDiferenciaBloqueo() {
var total = 0;
total = ToDouble($('#C_TxtEfectivoCajaBloqueo').val()) - ToDouble($('#C_LblEfectivoBloqueo').text());
$('#C_LblDiferenciaCajaBloqueo').val(FormatoNumero(total));
}
function CalculaTotalPagoContado() {
var totalEfectivo = ToDouble($get("TxtImporteEfectivo").value);
var totalCredito = ToDouble($get("TxtImporteCredito").value);
var totalDebito = ToDouble($get("TxtImporteDebito").value);
var totalCheque = ToDouble($get("TxtImporteCheque").value);
var totalTransferencia = ToDouble($get("TxtImporteTransferencia").value);
var totalRNC = ToDouble($get("HdnTotalRNC").value);
var totalAmortizado = ToDouble($get("HdnAnticipos").value);
var totalProntoPago = ToDouble($get("HdnProntoPago").value);
var TotalOtrosContado = 0;
try {
if ($('#DdlOtroFormaPago').val() != "-1") {
TotalOtrosContado = ToDouble($get("TxtImporteOtrosContado").value);
}
} catch (e) { }
var total = totalEfectivo + totalCredito + totalDebito + totalCheque + totalTransferencia + TotalOtrosContado + totalRNC + totalAmortizado + totalProntoPago;
var totalVenta = ToDouble($get('TxtTotal').value);// - ToDouble($get('HdnPagadoContado').value);
if (total > totalVenta) {
lblCambio.innerHTML = "Cambio:";
HdnCambioFaltante.value = "1";
$get("TxtCambio").value = FormatoNumero(total - totalVenta);
} else {
if ('<%= UsuarioActual.Empresa.Funcionalidad(531) %>' == '1') {
lblCambio.innerHTML = "Faltante:";
HdnCambioFaltante.value = "2";
$get("TxtCambio").value = FormatoNumero(total - totalVenta, 2);
} else {
$get("TxtCambio").value = "$0.00"
}
}
$get("TxtImporteContado").value = FormatoNumero(total - totalRNC - totalAmortizado - totalProntoPago,2);
}
// ****************************************************************************************************************************************************************************
// ************** Contratos **************************************************************************************************************************************************
function AjustaTotales(_this) {
var pu; var cant;
if (_this.val().trim() == '') {
cant = 0;
} else {
cant = ToDouble(_this.val());
}
pu = ToDouble(_this.parent().prev().text());
_this.parent().next().html(FormatoNumero(pu * cant, 2));
//console.log(pu);
//console.log(cant);
//console.log(pu * cant);
}
//DESACTIVA TXTTOTAL
var DisabledTxtTotal = false;
function SetDisabledTxtTotal(valor) {
DisabledTxtTotal = valor;
$('#<%= TxtTotal.ClientID %>').prop('readonly', DisabledTxtTotal);
}
function loadpage() {
$('.AjustaT').each(function () {
AjustaTotales($(this));
})
$('.AjustaT').change(function () {
AjustaTotales($(this));
});
$('#<%= TxtTotal.ClientID %>').prop('readonly', DisabledTxtTotal);
$('#C_Tab_TabComplementos_TxtFechaLlegadaCP').datetimepicker({
dayOfWeekStart: 1,
lang: 'es',
format: 'd/m/Y H:i',
formatDate: 'd/m/Y H:i',
step: 30
});
$('#C_Tab_TabComplementos_TxtFechaEntregaCP').datetimepicker({
dayOfWeekStart: 1,
lang: 'es',
format: 'd/m/Y H:i',
formatDate: 'd/m/Y H:i',
step: 30
});
$('body').on('click', '.ChkAllClickAF input', function () { $(".ChkAllEvtAF input").not(this).prop('checked', $('.ChkAllClickAF input').is(':checked')); });
if(HdnCargarInventario.value == 'True'){
$("#TabAlmacen_tab .ajax__tab_inner").click(function () {
CargaMovimientosInventario();
});
}else {
$("#TabAlmacen_tab .ajax__tab_inner").unbind();
}
}
jQuery(document).ready(function () {
loadpage();
Sys.Application.add_load(function (s, e) {
loadpage();
});
});
// bad implementation
function sleep(milliSeconds) {
var startTime = new Date().getTime(); // get the current time
while (new Date().getTime() < startTime + milliSeconds); // hog cpu
}
function PrendeTextBox(Chk, Obj, Saldo, Row) {
$get("HdnTipoDescuento").value = "3";
if ($("#" + Chk.id).is(":checked")) {
$get(Obj).readOnly = false;
$get(Row).style.backgroundColor = "#82b6db";
$get(Obj).focus();
var total = parseFloat($('#<%= HplSaldoAuxiliar.ClientID%>').text().replace(',', ''));
$get(Obj).value = 0;
var suma = 0;
var txtvalue = total - suma;
if (txtvalue < 0) { txtvalue = 0; }
if (txtvalue < Saldo) { Saldo = txtvalue.toFixed(2); }
$get(Obj).value = Saldo;
$get("HdnAnticipos").value = parseFloat($get("HdnAnticipos").value) + parseFloat(Saldo);
} else {
$get(Obj).readOnly = true;
$get("HdnAnticipos").value = parseFloat($get("HdnAnticipos").value) - parseFloat($get(Obj).value);
$get(Obj).value = "";
$get(Row).style.backgroundColor = "#ffffff";
}
//if ($("input:checkbox:not(:checked)"))
SetText2($get("LblTotalAnticipos"), formato_numero($get("HdnAnticipos").value, 2, '.', ','));
}
function imprimircotizacion() {
__doPostBack('ctl00$HB$LnkImprimir', '');
}
function ValidaMontoMenor(Obj, Monto) {
;
Monto = ToDouble($('#C_Tab_TabGenerales_TxtTotal').val())
var ValorTxt = Obj.value;
var suma = 0;
var total = parseFloat($('#<%= HplSaldoAuxiliar.ClientID%>').text().replace(',', ''));
var txtvalue = (total - suma) + parseFloat(ValorTxt);
if (txtvalue < 0) { txtvalue = 0; }
if (txtvalue < Monto) { Monto = txtvalue.toFixed(2); }
if (isNaN(ValorTxt))
ValorTxt = 0;
if (isNaN(Monto))
Monto = 0;
if (parseFloat(ValorTxt) < 0) {
ValorTxt = 0;
Obj.value = 0;
}
if (parseFloat(ValorTxt) > parseFloat(Monto)) {
alert("El monto de ''Anticipo a Amortizar'' no puede ser mayor al monto del ''Anticipo''");
Obj.value = Monto;
}
}
function ImprimirCotizacion() {
__doPostBack('ctl00$HB$LNKImprimirCotizacion', '');
}
function SetText2(ObjTo, Value) {
ObjTo.innerText = Value;
}
//VALIDA QUE LA CANTIDAD DE T (TXT) NO SEA MAYOR A C
function ValidarCantidad(t, c) {
t.value = (t.value > c ? c : t.value)
}
//VALIDA QUE LA CANTIDAD DE T (TXT) NO SEA MENOR A C
function ValidarCantidadMenor(t, c) {
t.value = (t.value > c ? t.value : c)
}
function Comma(Num) { //function to add commas to textboxes
Num += '';
Num = Num.replace(',', ''); Num = Num.replace(',', ''); Num = Num.replace(',', '');
Num = Num.replace(',', ''); Num = Num.replace(',', ''); Num = Num.replace(',', '');
x = Num.split('.');
x1 = x[0];
x2 = x.length > 1 ? '.' + x[1] : '';
var rgx = /(\d+)(\d{3})/;
while (rgx.test(x1))
x1 = x1.replace(rgx, '$1' + ',' + '$2');
return x1 + x2;
}
function AddCodigoBarrasSerie(e) {
if (e.keyCode == 13 || e.which == 13) {
$('#BtnCodigoBarrasSerie').click();
}
}
//SERIE PS
function SeriePS(e, b, txt, hdn) {
;
if (e.keyCode == 13 || e.which == 13) {
if (txt.value != "" && txt.value != hdn.value) {
$(b).click();
}
}
}
function SeriePSBlur(b, txt, hdn) {
;
if (txt.value != "" && txt.value != hdn.value) {
$(b).click();
}
}
//SERIE-LOTE INV
var H1 = "";
var H2 = "";
var T = "";
function EnterAFEdit(event, Txt, Hdn1, Hdn2) {
if (event.which == 13 || event.keyCode == 13) {
H1 = Hdn1;
H2 = Hdn2;
T = Txt;
$get("HdnCodAFEdit").value = Txt.value;
$('#BtnVinculaAFEdit').click();
}
}
function AFBlurEdit(Txt, Hdn1, Hdn2) {
if (Txt.value.length > 0 && Txt.value != Hdn2.value) {
H1 = Hdn1;
H2 = Hdn2;
T = Txt;
$get("HdnCodAFEdit").value = Txt.value;
$('#BtnVinculaAFEdit').click();
}
}
function EnterAFEditOK(Cve, Codigo) {
$get(H1.id).value = Cve;
$get(H2.id).value = Codigo;
$get(T.id).value = (Codigo == -1) ? "" : Codigo;
}
//Suma Totales
function FnSuma() {
debugger;
$get('TxtSubTotal2').value = FormatoNumero(ToDouble($get('TxtSubTotal').value) - ToDouble($get('LblDescuentos').innerHTML) - ToDouble($get('LblAmortizacion').innerHTML), 2);
var totalVenta = ToDouble($get('TxtSubTotal2').value) + ToDouble($get('TxtIVA').value) + ToDouble($get('TxtIEPS') ? ToDouble($get('TxtIEPS').value) : 0) - ToDouble($get('TxtRetIVA') ? $get('TxtRetIVA').value : 0) - ToDouble($get('TxtRetISR') ? $get('TxtRetISR').value:0);
$('#TxtTotal').attr('value', FormatoNumero(totalVenta, 2));
$get('TxtTotal').value = FormatoNumero(totalVenta, 2);
$get('HdnTotalVenta').value = FormatoNumero(totalVenta, 2);
}
function chkAnt(t, txt, importe, AmorContrato = 0) {
var totalAnt = 0;
$get("HdnTipoDescuento").value = "3";
//si es con.nc,es.el.total
var Total = ToDouble($get(TipoAnticipo == 2 ? 'TxtTotal' : 'TxtSubTotal').value);
var SaldoCompra = parseFloat(parseFloat($get('HdnVentaSaldo').value).toFixed(2));
if (ToDouble($get('HdnCveVenta').value) == 0) SaldoCompra = Total;
if (t.checked) {
if (SaldoCompra > 0) {
//if (SaldoCompra > importe) {
// txt.value = importe.toFixed(2);
// SaldoCompra = SaldoCompra - importe;
// $get('HdnVentaSaldo').value = SaldoCompra;
//}
//} else {
// txt.value = SaldoCompra.toFixed(2);
// //SaldoCompra = 0.00;
// $get('HdnVentaSaldo').value = SaldoCompra;
//}
if(AmorContrato > 0){
txt.value = AmorContrato.toFixed(2);
}else{
txt.value = importe.toFixed(2);
}
totalAnt = FnSumaValoresAnt();
if (totalAnt > SaldoCompra) {
txt.value = FormatoNumero(importe - (totalAnt - SaldoCompra), 2);
$get('HdnVentaSaldo').value = 0.00;
alert("El Importe no debe de exceder a el saldo");
}
} else {
t.checked = false;
}
} else {
$get('HdnVentaSaldo').value = parseFloat(SaldoCompra) + parseFloat(txt.value);
txt.value = "";
}
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
}
function FnCambiaAnt(chk, txt, saldo) {
debugger;
var Total = ToDouble($get('TxtSubTotal').value);
let importeTxt = parseFloat(txt.value.replace(/,/g, ''));
if (isNaN(importeTxt)) {
importeTxt = 0;
} else {
if (importeTxt <= 0) {
importeTxt = 0;
chk.checked = false;
return;
}
}
saldo = (importeTxt > saldo) ? saldo : importeTxt;
var SaldoCompra = (Total - FnSumaValoresAnt() + ToDouble(txt.value)).toFixed(2); // le agrego lo del valor actual para validarlo //parseFloat(parseFloat($get('HdnVentaSaldo').value).toFixed(2));
if (SaldoCompra < 0) txt.value = SaldoCompra - txt.value;
//minimo entre saldocompra y el saldoanticipo
if (SaldoCompra < saldo) saldo = SaldoCompra;
if (ToDouble(txt.value) > 0) {
chk.checked = true;
} else {
chk.checked = false;
}
if (ToDouble(txt.value) > saldo) {
txt.value = saldo;
alert("El Importe no debe de exceder a el saldo");
}
$("#LblTotalAnticipos").text(FormatoNumero(FnSumaValoresAnt(), 2));
$get('HdnVentaSaldo').value = Total - FnSumaValoresAnt();
}
function FnSumaValoresAnt() {
debugger;
var totalPoints = 0;
var t = '';
$('input[name*=TxtAnticipo]').each(function () {
totalPoints += ToDouble($(this).val());
});
return Math.round(totalPoints * 100) / 100;
}
function BtnMateriales() {
$('#BtnMateriales').click();
}
function BtnEnviarMailCancelacion(CveVenta) {
HdnCveVentaAcuse.value = CveVenta;
$('#BtnEnviarMailCancelacion').click();
}
function BtnRefacturacionConfirmar() {
$('#BtnRefacturacionConfirmar').click();
}
function BtnRefacturacionConfirmarAceptacion(Liga) {
$('#BtnRefacturacionConfirmarAceptacion').click();
}
function BtnRefrescarPagina() {
$('#BtnRefrescarPagina').click();
}
function Recargar() {
$('#BtnRefrescarPagina').click();
}
function BtnAplicaNuevaNC() {
$('#BtnAplicaNuevaNC').click();
}
function BtnAplicaNuevaNC() {
$('#BtnAplicaNuevaNC').click();
}
function CargaMovimientosInventario() {
$('#BtnCargarInventario').click();
}
$('.DdlPS').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); });
$('.DdlPSPyME').on("select2:open", function (e) { $('.select2-container.select2-container--default .select2-dropdown .select2anothertable').remove(); });
$("body").on("mouseenter", ".select2-container.select2-container--default.select2-container--open .select2-dropdown li", function (event) {
var $this = $(this);
var ind = $this.index();
$(".select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable tr.active").removeClass('active');
$(".select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable tr:nth-child(" + (ind + 2) + ")").addClass('active');
//log($this);
});
var scrollfuncion = function () {
var stop = this.scrollTop;
$(".select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable").scrollTop(stop);
}
function CargaExistenciaAlmacenes(data, params) {
var div = $('<div class="select2anothertable" style=" max-width: 950px; overflow-x: auto;"></div>');
$('.select2-container.select2-container--default.select2-container--open .select2-dropdown .select2anothertable').remove();
$('.select2-container.select2-container--default.select2-container--open .select2-dropdown').prepend(div);
var table = $('<table id="TExistencias" ></table>'); div.append(table);
var tbody = $('<tbody></tbody>'); table.append(tbody);
$(".select2-container--default .select2-results>.select2-results__options").off("scroll", scrollfuncion);
$(".select2-container--default .select2-results>.select2-results__options").scroll(scrollfuncion);
var indexd = 0;
data.forEach(function (item) {
if (indexd == 0) {
var tr = $('<tr></tr>'); tbody.append(tr);
var td;
for (var key in item) {
if (!(key == "text" || key == "id")) { td = $('<td style="font-weight:bold;">' + key + '</td>'); tr.append(td); }
}
}
var tr = $('<tr></tr>'); tbody.append(tr);
var td;
for (var key in item) {
if (!(key == "text" || key == "id")) {
if ((item[key] > 0)) {
td = $('<td style = "font-weight:bold;" >' + item[key] + '</td>'); tr.append(td);
} else {
if ('<%= UsuarioActual.Empresa.Funcionalidad(566) %>' == '1') {
var buscarAlmacenes = "CargaExistenciasSucursales(" + item.id + ",'" + item.text + "');"
td = $('<td>' + item[key] + ' <button type="button" class="btn btn-xs btn-primary" onclick="' + buscarAlmacenes + '">Ver mas existencias</button></td>'); tr.append(td);
} else {
td = $('<td>' + item[key] + '</td>'); tr.append(td);
}
}
}
}
indexd += 1;
});
}
function CargaExistenciasSucursales(id, ps) {
$.ajax({
url: '/Ashx/SIGWeb.ashx?metodo=getpsalmacen&cveps=' + id,
type: 'get',
beforeSend: function () {
console.log("procesando.....");
},
success: function (response) {
var obj = JSON.parse(response);
MostarTablaSucursales(obj, ps);
}
});
}
function MostarTablaSucursales(almacenes, ps) {
var div = $('<div class="select2anothertable"></div>');
var table = $('<table style="width: 401px;"></table>');
var tbody = $('<tbody></tbody>'); table.append(tbody);
//div.append(table);
var indexd = 0;
almacenes.forEach(function (item) {
if (indexd == 0) {
var tr = $('<tr></tr>'); tbody.append(tr);
var td1 = $('<th style="font-weight: bold; width: 347px; text-align: center;">Almacen</th>');
var td2 = $('<th style="font-weight: bold; width: 181px; text-align: center;">Existencia</th>');
tr.append(td1);
tr.append(td2);
}
var tr = $('<tr style="text-align: left;"></tr>'); tbody.append(tr);
for (var key in item) {
if (!(key == "almacen" || key == "id")) {
var td1 = $('<td style="width: 347px;">' + item["almacen"] + '</td>'); tr.append(td1);
var td2 = $('<td style="font-weight: bold; width: 181px; text-align: center;"' + ((item["existencia"] > 0) ? 'style = "font-weight:bold;"' : '') + '>' + item["existencia"] + '</td>'); tr.append(td2);
}
}
indexd += 1;
});
if (almacenes.length > 0) {
TbExistenciasPS.innerHTML = table.html();
hPS.innerText = "Existencias: " + ps;
$("#DivModalExistencias").modal("show");
} else {
alert("No hay existencias en otros almacenes");
}
}
function playsonidito(NomArchivo) {
var URL = /Sonidos/ + NomArchivo
var snd = new Audio(URL);
snd.play();
snd.currentTime = 0;
}
function ConvertirDllsPesos() {
var totalPesos = FormatoNumero(ToDouble($get('TxtTotal').value) * ToDouble($get('TxtTipoCambio').value), 2)
$('#<%= LtlTotalConvertido.ClientID %>').text(totalPesos);
$("#TrConversionPesosTexto").show();
}
function ConvertirPesos(ChkConvertirDoctoPesos) {
//LIMPIA
$('#<%= LtlTotalConvertido.ClientID %>').text('');
$("#TrConversionPesosTexto").hide();
//CALCULA
if (ChkConvertirDoctoPesos.checked) {
ConvertirDllsPesos();
}
}
function ConvertirPesosDlls() {
var totalPesos = FormatoNumero(ToDouble($get('TxtTotal').value) / ToDouble($get('TxtTipoCambioDlls').value), 2)
$('#<%= LblDolaresConvertidos.ClientID %>').text(totalPesos);
$("#TrConversionDolaresTexto").show();
}
function ConvertirDolares(ChkConvertirDolares) {
//LIMPIA
$('#<%= LblDolaresConvertidos.ClientID %>').text('');
$("#TrConversionDolaresTexto").hide();
//CALCULA
if (ChkConvertirDolares.checked) {
ConvertirPesosDlls();
}
}
</script>
</asp:Content>