530 lines
30 KiB
Plaintext
530 lines
30 KiB
Plaintext
<%@ Page Title="" Language="VB" MasterPageFile="~/Site.master" AutoEventWireup="false" CodeFile="FisImpuestos.aspx.vb" Inherits="Contabilidad_FisImpuestos" %>
|
|
|
|
<asp:Content ID="Content1" ContentPlaceHolderID="CP" runat="Server">
|
|
</asp:Content>
|
|
<asp:Content ID="Content2" ContentPlaceHolderID="Css" runat="Server">
|
|
<link href="/Metronic/assets/global/plugins/dropzone/css/dropzone.css" rel="stylesheet"/>
|
|
|
|
<style type="text/css">
|
|
.AutoExtender {
|
|
font-family: Verdana, Helvetica, sans-serif;
|
|
font-size: .9em;
|
|
font-weight: normal;
|
|
border: solid 1px #006699;
|
|
line-height: 20px;
|
|
padding: 2px;
|
|
background-color: White;
|
|
margin-left: 2px;
|
|
overflow: auto;
|
|
list-style-type: none;
|
|
}
|
|
.AutoExtenderList {
|
|
cursor: pointer;
|
|
color: darkgray;
|
|
text-align: left;
|
|
}
|
|
.AutoExtenderHighlight {
|
|
color: White;
|
|
background-color: #084784;
|
|
cursor: pointer;
|
|
}
|
|
#divwidth {
|
|
width: 150px !important;
|
|
}
|
|
#divwidth div {
|
|
width: 150px !important;
|
|
}
|
|
</style>
|
|
|
|
</asp:Content>
|
|
<asp:Content ID="Content3" ContentPlaceHolderID="HB" runat="Server">
|
|
</asp:Content>
|
|
<asp:Content ID="Content4" ContentPlaceHolderID="E" runat="Server">
|
|
<asp:Label ID="LblEncabezado" runat="server" Text="Impuestos"></asp:Label>
|
|
</asp:Content>
|
|
<asp:Content ID="Content5" ContentPlaceHolderID="H" runat="Server">
|
|
</asp:Content>
|
|
<asp:Content ID="Content6" ContentPlaceHolderID="C" runat="Server">
|
|
<table border="0" cellpadding="0" cellspacing="0" width="100%">
|
|
<tr>
|
|
<td align="left" style="width: 665px;">
|
|
<asp:UpdatePanel ID="UPImpuesto" runat="server" UpdateMode="Conditional">
|
|
<ContentTemplate>
|
|
<div class="chequesie">
|
|
<div class="chequesie1">
|
|
<div class="row">
|
|
<label class="col-md-3">Dependencia:</label>
|
|
<div class="col-md-9">
|
|
<asp:DropDownList ID="DdlProveedores" CssClass="form-control input-sm select2me" runat="server" DataTextField="RazonSocial" DataValueField="CveProveedor" Width="250px" ValidationGroup="GrpGuardar">
|
|
</asp:DropDownList>
|
|
<asp:RequiredFieldValidator ID="RFVDdlProveedores" runat="server" InitialValue="-1" ControlToValidate="DdlProveedores" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Proveedor''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
|
<ajax:ValidatorCalloutExtender ID="RFVCDdlProveedores" runat="server" HighlightCssClass="vco" TargetControlID="RFVDdlProveedores" Width="300px"></ajax:ValidatorCalloutExtender>
|
|
</div>
|
|
</div>
|
|
<div class="row">
|
|
<label class="col-md-3">Moneda:</label>
|
|
<div class="col-md-9">
|
|
<asp:DropDownList ID="DdlMoneda" CssClass="form-control input-sm select2me" runat="server" DataTextField="Nombre" DataValueField="Id" Width="250px" ValidationGroup="GrpGuardar">
|
|
</asp:DropDownList>
|
|
<asp:RequiredFieldValidator ID="RFVDdlMoneda" runat="server" InitialValue="-1" ControlToValidate="DdlMoneda" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Moneda''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
|
<ajax:ValidatorCalloutExtender ID="RFVCDdlMoneda" runat="server" HighlightCssClass="vco" TargetControlID="RFVDdlMoneda" Width="300px"></ajax:ValidatorCalloutExtender>
|
|
</div>
|
|
</div>
|
|
|
|
<div class="row">
|
|
<label class="col-md-3">Tipo Impuesto:</label>
|
|
<div class="col-md-9">
|
|
<asp:DropDownList ID="DdlTipoImpuesto" CssClass="form-control input-sm select2me" runat="server" DataTextField="ImpuestoTipo" DataValueField="CveImpuestoTipo" Width="250px" ValidationGroup="GrpGuardar">
|
|
</asp:DropDownList>
|
|
<asp:RequiredFieldValidator ID="RFVDdlTipoImpuesto" runat="server" InitialValue="-1" ControlToValidate="DdlTipoImpuesto" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Tipo Impuesto''</b> es necesario, por favor seleccione uno." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
|
<ajax:ValidatorCalloutExtender ID="RFVCDdlTipoImpuesto" runat="server" HighlightCssClass="vco" TargetControlID="RFVDdlTipoImpuesto" Width="300px"></ajax:ValidatorCalloutExtender>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
<div class="chequesie2">
|
|
<div class="row">
|
|
<div class="col-md-6">
|
|
</div>
|
|
<%--
|
|
<label class="col-md-1 control-label text-right">Fecha:</label>
|
|
<div class="col-md-3">
|
|
<div class="input-group input-small date date-picker" data-date-format="dd/mm/yyyy">
|
|
<asp:TextBox ID="TxtFechaImpuesto" runat="server" CssClass="form-control"></asp:TextBox>
|
|
<span class="input-group-btn ">
|
|
<asp:LinkButton runat="server" ID="ImgCalendario" class="btn default"><i class="fa fa-calendar"></i></asp:LinkButton>
|
|
</span>
|
|
</div>
|
|
<ajax:MaskedEditExtender ID="MEEFecha" runat="server" TargetControlID="TxtFechaImpuesto" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
|
<ajax:CalendarExtender ID="Calendario" runat="server" TargetControlID="TxtFechaImpuesto" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
|
<asp:RequiredFieldValidator ID="RFVTxtFechaImpuesto" runat="server" ControlToValidate="TxtFechaImpuesto" Display="None" ErrorMessage="El campo <b>''FechaDocumento''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
|
<asp:CompareValidator ID="CVTxtFechaImpuesto" runat="server" ControlToValidate="TxtFechaImpuesto" Display="None" ErrorMessage="El campo <b>''FechaDocumento''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpGuardar"></asp:CompareValidator>
|
|
<ajax:ValidatorCalloutExtender ID="VCOFechaDocumento1" runat="server" HighlightCssClass="vco" TargetControlID="RFVTxtFechaImpuesto" Width="350px"></ajax:ValidatorCalloutExtender>
|
|
<ajax:ValidatorCalloutExtender ID="VCOFechaDocumento2" runat="server" HighlightCssClass="vco" TargetControlID="CVTxtFechaImpuesto" Width="350px"></ajax:ValidatorCalloutExtender>
|
|
|
|
</div>--%>
|
|
</div>
|
|
<div class="row">
|
|
<label class="col-md-2 control-label">
|
|
<asp:Label ID="LblFolio" runat="server" Text="Folio:"></asp:Label></label>
|
|
<div class="col-md-2">
|
|
<asp:TextBox ID="TxtFolio" runat="server" MaxLength="14" class="form-control input-sm"></asp:TextBox>
|
|
<asp:RequiredFieldValidator ID="RFVTxtFolio" runat="server" ControlToValidate="TxtFolio" Display="None" ErrorMessage="<b><span style='text-decoration: underline'>ERROR:</span></b><br />El campo <b>''Folio''</b> es necesario." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
|
<ajax:ValidatorCalloutExtender ID="RFVCTxtFolio" runat="server" HighlightCssClass="vco" TargetControlID="RFVTxtFolio" Width="350px"></ajax:ValidatorCalloutExtender>
|
|
</div>
|
|
<label class="col-md-1 control-label text-right">Fecha:</label>
|
|
<div class="col-md-3">
|
|
<div class="input-group input-small date date-picker" data-date-format="dd/mm/yyyy">
|
|
<asp:TextBox ID="TxtFechaImpuesto" runat="server" CssClass="form-control"></asp:TextBox>
|
|
<span class="input-group-btn ">
|
|
<asp:LinkButton runat="server" ID="ImgCalendario" class="btn default"><i class="fa fa-calendar"></i></asp:LinkButton>
|
|
</span>
|
|
</div>
|
|
<ajax:MaskedEditExtender ID="MEEFecha" runat="server" TargetControlID="TxtFechaImpuesto" Mask="99/99/9999" MaskType="Date" DisplayMoney="Left" AcceptNegative="Left"></ajax:MaskedEditExtender>
|
|
<ajax:CalendarExtender ID="Calendario" runat="server" TargetControlID="TxtFechaImpuesto" PopupButtonID="ImgCalendario" PopupPosition="BottomRight" Enabled="True"></ajax:CalendarExtender>
|
|
<asp:RequiredFieldValidator ID="RFVTxtFechaImpuesto" runat="server" ControlToValidate="TxtFechaImpuesto" Display="None" ErrorMessage="El campo <b>''FechaDocumento''</b> es requerido por la aplicación, por favor ingrese una fecha." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
|
<asp:CompareValidator ID="CVTxtFechaImpuesto" runat="server" ControlToValidate="TxtFechaImpuesto" Display="None" ErrorMessage="El campo <b>''Fecha''</b> no tienes el formato correcto, por favor intente de nuevo con el siguiente formato: (dd/mm/yyyy)." Operator="DataTypeCheck" Type="Date" ValidationGroup="GrpGuardar"></asp:CompareValidator>
|
|
<ajax:ValidatorCalloutExtender ID="VCOFechaDocumento1" runat="server" HighlightCssClass="vco" TargetControlID="RFVTxtFechaImpuesto" Width="350px"></ajax:ValidatorCalloutExtender>
|
|
<ajax:ValidatorCalloutExtender ID="VCOFechaDocumento2" runat="server" HighlightCssClass="vco" TargetControlID="CVTxtFechaImpuesto" Width="350px"></ajax:ValidatorCalloutExtender>
|
|
</div>
|
|
<%--
|
|
<div class="col-md-2"></div>
|
|
<label class="col-md-1 control-label text-right">Importe:</label>
|
|
<asp:UpdatePanel ID="UPPImporte" class="col-md-2 input-icon" UpdateMode="Conditional" runat="server">
|
|
<ContentTemplate>
|
|
<i style="margin: 0px;">$</i>
|
|
<asp:TextBox ID="TxtImporte" runat="server" CssClass="form-control input-sm" MaxLength="16" Width="110px" ClientIDMode="Static" Style="text-align: right;" onkeyup="FncImporteCuenta(this)"></asp:TextBox>
|
|
<asp:HiddenField ID="HdnImporte" runat="server" ClientIDMode="Static" />
|
|
<asp:HiddenField ID="HdnCuentaImporte" runat="server" ClientIDMode="Static" />
|
|
<asp:RangeValidator ID="RVImporte" runat="server" Enabled="false" Type="Currency" MinimumValue="0" MaximumValue="0" ErrorMessage="Importe Excedido" ControlToValidate="TxtImporte" Display="Dynamic" ValidationGroup="GrpGuardar"></asp:RangeValidator>
|
|
</ContentTemplate>
|
|
</asp:UpdatePanel>
|
|
--%>
|
|
|
|
</div>
|
|
|
|
<div class="row">
|
|
<label class="col-md-2">Concepto:</label>
|
|
<div class="col-md-10">
|
|
<asp:TextBox ID="TxtConcepto" onkeyDown="checkTextAreaMaxLength(this,event,'100');" CssClass="form-control input-sm" runat="server" MaxLength="12" Width="400px" Rows="3" TextMode="MultiLine"></asp:TextBox>
|
|
<asp:RequiredFieldValidator ID="RFVTxtConcepto" runat="server" ControlToValidate="TxtConcepto" Display="None" ErrorMessage="El campo <b>''Concepto''</b> es requerido." ValidationGroup="GrpGuardar"></asp:RequiredFieldValidator>
|
|
<ajax:ValidatorCalloutExtender ID="RFVCTxtConcepto" runat="server" HighlightCssClass="vco" TargetControlID="RFVTxtConcepto" Width="350px"></ajax:ValidatorCalloutExtender>
|
|
</div>
|
|
</div>
|
|
<div class="row" id="trNotificar" runat="server" visible="False">
|
|
<label class="col-md-2">Notificar:</label>
|
|
<div class="col-md-10">
|
|
<asp:TextBox ID="TxtNotificarA" CssClass="form-control input-sm" runat="server" MaxLength="12" Width="400px" Rows="2" TextMode="MultiLine" ClientIDMode="Static"></asp:TextBox>
|
|
</div>
|
|
</div>
|
|
|
|
</div>
|
|
</div>
|
|
|
|
</ContentTemplate>
|
|
</asp:UpdatePanel>
|
|
<br />
|
|
<br />
|
|
</td>
|
|
<td style="text-align:left;vertical-align:top">
|
|
|
|
<div>
|
|
<asp:UpdatePanel ID="UpAnexo" runat="server" UpdateMode="Conditional">
|
|
<ContentTemplate>
|
|
<asp:TextBox ID="Anexo" CssClass="ADSdropzone hidden" data-maxFile="1" Text="" runat="server"></asp:TextBox>
|
|
</ContentTemplate>
|
|
</asp:UpdatePanel>
|
|
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
<asp:UpdatePanel ID="UPMovs" runat="server" UpdateMode="Conditional">
|
|
<ContentTemplate>
|
|
<input id="HdnCveCuenta" runat="server" type="hidden" value="-1" clientidmode="Static" />
|
|
|
|
<br />
|
|
<div style="width: 100%; min-height: 200px; overflow-scrolling:auto;">
|
|
<asp:GridView ID="GvMov" runat="server" AutoGenerateColumns="False"
|
|
DataKeyNames="IdMov,IDCuenta,Cargo,Abono,TipoMovto,CveConcepto,CveProveedor,CveSubProyecto,Importe" ShowHeaderWhenEmpty="true" Width="100%" CssClass="table table-striped table-hover" Style="margin-top: -10px; text-align: center;" GridLines="None">
|
|
<Columns>
|
|
<%-- <asp:TemplateField>
|
|
<HeaderTemplate>Código</HeaderTemplate>
|
|
<ItemTemplate>
|
|
<asp:Label ID="LtlCodigo" Font-Italic="true" Font-Size="7pt" runat="server" Text='<%# Eval("CodigoCuenta")%>'></asp:Label>
|
|
</ItemTemplate>
|
|
<ItemStyle HorizontalAlign="Left" />
|
|
</asp:TemplateField>--%>
|
|
<asp:TemplateField>
|
|
<HeaderTemplate>Cuenta</HeaderTemplate>
|
|
<ItemTemplate>
|
|
<asp:Literal ID="LtlCuenta" runat="server" Text='<%# Eval("Cuenta") %>'></asp:Literal>
|
|
</ItemTemplate>
|
|
<ItemStyle HorizontalAlign="Left" />
|
|
</asp:TemplateField>
|
|
<asp:BoundField ItemStyle-HorizontalAlign="Left" HeaderText="SubProyecto" DataField="SubProyecto" />
|
|
<asp:TemplateField>
|
|
<HeaderTemplate>Referencia</HeaderTemplate>
|
|
<ItemTemplate>
|
|
<asp:Literal ID="LtlReferencia" runat="server" Text='<%# Eval("RazonSocial")%>'></asp:Literal>
|
|
</ItemTemplate>
|
|
<ItemStyle HorizontalAlign="Left" />
|
|
</asp:TemplateField>
|
|
<%-- <asp:TemplateField Visible ="false">
|
|
<HeaderTemplate>Concepto</HeaderTemplate>
|
|
<ItemTemplate>
|
|
<asp:TextBox ID="TxtConcepto" runat="server" MaxLength="100" Text='<%# Eval("Concepto")%>'></asp:TextBox>
|
|
</ItemTemplate>
|
|
</asp:TemplateField>--%>
|
|
<asp:TemplateField HeaderStyle-Width="67px" ItemStyle-Width="136px">
|
|
<HeaderTemplate>Cargo</HeaderTemplate>
|
|
<ItemTemplate>
|
|
<asp:TextBox ID="TxtCargo" CssClass="txtcargo" runat="server" Width="65px" Visible="False" style="text-align:right!important" autocomplete="off" ></asp:TextBox>
|
|
<ajax:FilteredTextBoxExtender ID="FTBTxtCargo" runat="server"
|
|
TargetControlID="TxtCargo"
|
|
FilterType="Custom, Numbers"
|
|
ValidChars="+-.," />
|
|
<asp:Literal ID="LtlCargo" runat="server" Text='<%# Eval("Cargo", "{0:###,###,###.##}")%>' ></asp:Literal>
|
|
</ItemTemplate>
|
|
</asp:TemplateField>
|
|
<asp:TemplateField HeaderStyle-Width="67px" ItemStyle-Width="136px">
|
|
<HeaderTemplate>Abono</HeaderTemplate>
|
|
<ItemTemplate>
|
|
<asp:TextBox ID="TxtAbono" CssClass="txtabono" runat="server" Width="65px" Visible="False" style="text-align:right!important" autocomplete="off" ></asp:TextBox>
|
|
<ajax:FilteredTextBoxExtender ID="FTBTxtAbono" runat="server"
|
|
TargetControlID="TxtAbono"
|
|
FilterType="Custom, Numbers"
|
|
ValidChars="+-.," />
|
|
<asp:Literal ID="LtlAbono" runat="server" Text='<%# Eval("Abono", "{0:###,###,###.##}")%>'></asp:Literal>
|
|
</ItemTemplate>
|
|
</asp:TemplateField>
|
|
<asp:TemplateField HeaderText="" Visible="False">
|
|
<ItemTemplate>
|
|
<asp:ImageButton ID="imgD" runat="server" AlternateText="Eliminar" CausesValidation="False" CommandName="Delete" ImageUrl="/Imagenes/Btn_Delete.png" OnClientClick="javascript:return C();" />
|
|
</ItemTemplate>
|
|
</asp:TemplateField>
|
|
</Columns>
|
|
<RowStyle CssClass="Texto" />
|
|
<AlternatingRowStyle CssClass="TextoAlterno" />
|
|
<HeaderStyle CssClass="Titulos" />
|
|
</asp:GridView>
|
|
</div>
|
|
<table style="width: 100%;" class="table table-striped table-advance table-hover">
|
|
<tr>
|
|
<td ></td>
|
|
<th style="width: 136px;">
|
|
<asp:TextBox ID="TxtTotalCargos" runat="server" Width="65px" autocomplete="off"></asp:TextBox> </th>
|
|
<th style="width:136px;">
|
|
<asp:TextBox ID="TxtTotalAbonos" runat="server" Width="65px" autocomplete="off"></asp:TextBox></th>
|
|
</tr>
|
|
<tr>
|
|
<td colspan="3" style="text-align: center;">
|
|
<asp:UpdatePanel ID="UpGuardar" runat="server" UpdateMode="Conditional">
|
|
<ContentTemplate>
|
|
<asp:Button ID="BtnGuardar" runat="server" Text="Guardar" ValidationGroup="GrpGuardar" class="btn btn-primary" />
|
|
<asp:ValidationSummary ID="VS" runat="server" DisplayMode="BulletList" ShowSummary="true" ValidationGroup="GrpGuardar" />
|
|
</ContentTemplate>
|
|
</asp:UpdatePanel>
|
|
</td>
|
|
</tr>
|
|
</table>
|
|
</ContentTemplate>
|
|
</asp:UpdatePanel>
|
|
|
|
|
|
<script src="/Metronic/assets/global/plugins/dropzone/dropzone.js"></script>
|
|
</asp:Content>
|
|
<asp:Content ID="Content7" ContentPlaceHolderID="JS" runat="Server">
|
|
<script type="text/javascript" language="javascript">
|
|
|
|
function FnSuma(t, txt, importe) {
|
|
|
|
if (t.checked) {
|
|
txt.value = FormatNumber(importe, 2, true, true, true);
|
|
} else {
|
|
txt.value = "";
|
|
}
|
|
}
|
|
|
|
function FncImporte(txt, rowtxt, opcion) {
|
|
|
|
if (opcion == 1) {
|
|
$get(rowtxt).value = $get(txt).value == '' ? '' : FormatNumber(ToDouble($get(txt).value), 2, true, true, true);
|
|
debugger;
|
|
if ($get('ChkAbonoCuenta')) {
|
|
$get('ChkAbonoCuenta').checked = ($get(txt).value > 2000);
|
|
}
|
|
FormatoMoneda($get(txt));
|
|
} else {
|
|
$get(txt).value = $get(rowtxt).value == '' ? '' : FormatNumber(ToDouble($get(rowtxt).value), 2, true, true, true);
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
function FncImporteCuenta(txt) {
|
|
|
|
if ($get('ChkAbonoCuenta')) {
|
|
$get('ChkAbonoCuenta').checked = (parseFloat(txt.value.replace(/,/g, '')) > 2000);
|
|
}
|
|
FormatoMoneda(txt);
|
|
}
|
|
|
|
function SumaValores() {
|
|
var Importe = 0;
|
|
var topLevelElem = document.getElementById("form1");
|
|
var textBoxes = topLevelElem.getElementsByTagName("input");
|
|
for (var i = 0; i < textBoxes.length; i++) {
|
|
if (textBoxes[i].type == "text") {
|
|
if (textBoxes[i].id.indexOf('C_GvCxP_TxtAbonar') >= 0) {
|
|
if (textBoxes[i].value != '') {
|
|
Importe = parseFloat(Importe) + parseFloat(textBoxes[i].value.split(',').join(''));
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return Importe;
|
|
}
|
|
|
|
function FnCambia(chk, txt) {
|
|
|
|
if (txt.value != '') {
|
|
chk.checked = true;
|
|
} else {
|
|
chk.checked = false;
|
|
}
|
|
}
|
|
|
|
function getCuenta(pId) {
|
|
|
|
$get('HdnCveCuenta').value = pId;
|
|
|
|
PageMethods.wsGetNombreCuenta(pId, OnSucceeded);
|
|
|
|
}
|
|
|
|
function OnSucceeded(result, userContext, methodName) {
|
|
|
|
if (methodName == 'wsGetNombreCuenta') {
|
|
$get('TxtCuentaContable').value = result;
|
|
}
|
|
}
|
|
|
|
function myItemSelectedHandler(source, eventArgs) {
|
|
|
|
//debugger;
|
|
var CC = $get('HdnCveCuenta');
|
|
CC.value = eventArgs.get_value();
|
|
|
|
// var b = $get('C_Tabs_TabConyuge_BtnTruco');
|
|
// b.Click;
|
|
var aTargetElement = 'BtnSelCuenta';
|
|
__doPostBack(aTargetElement, eventArgs.get_value());
|
|
|
|
//alert(" Key : " + eventArgs.get_text() + " Value : " + eventArgs.get_value());
|
|
|
|
}
|
|
|
|
function LimpiaImporte(t, txt) {
|
|
|
|
if (t.value != '' && $get(txt)) {
|
|
$get(txt).value = '';
|
|
}
|
|
}
|
|
|
|
$(document).ready(function () {
|
|
|
|
//iterate through each textboxes and add keyup
|
|
//handler to trigger sum event
|
|
CargaTxtFunciones();
|
|
$('#<%= TxtTotalAbonos.ClientID %>').keypress(function (evt) { return false; });
|
|
$('#<%= TxtTotalAbonos.ClientID %>').bind("cut copy paste", function (e) {e.preventDefault();});
|
|
$('#<%= TxtTotalCargos.ClientID %>').keypress(function (evt) { return false; });
|
|
$('#<%= TxtTotalCargos.ClientID %>').bind("cut copy paste", function (e) { e.preventDefault(); });
|
|
calculateCargo();
|
|
calculateAbono();
|
|
comparar();
|
|
Sys.Application.add_load(function (s, e) {
|
|
CargaTxtFunciones();
|
|
});
|
|
}
|
|
);
|
|
|
|
|
|
function comparar() {
|
|
|
|
var TextoCargos = document.getElementById('<%= TxtTotalCargos.ClientID %>');
|
|
var TextoAbonos = document.getElementById('<%= TxtTotalAbonos.ClientID %>');
|
|
|
|
var tempVal = parseFloat(TextoCargos.value.replace(/,/g, ''));
|
|
|
|
if (TextoCargos.value == TextoAbonos.value && !isNaN(tempVal) && tempVal > 0) {
|
|
|
|
document.getElementById('<%= TxtTotalCargos.ClientID %>').style.border = "2px solid #04B431";
|
|
document.getElementById('<%= TxtTotalAbonos.ClientID %>').style.border = "2px solid #04B431";
|
|
document.getElementById('<%= TxtTotalCargos.ClientID %>').style.color = "";
|
|
document.getElementById('<%= TxtTotalAbonos.ClientID %>').style.color = "";
|
|
$('#<%= BtnGuardar.ClientID %>').prop('disabled', false);
|
|
}
|
|
else {
|
|
|
|
document.getElementById('<%= TxtTotalCargos.ClientID %>').style.border = "2px solid #ff0000";
|
|
document.getElementById('<%= TxtTotalAbonos.ClientID %>').style.border = "2px solid #ff0000";
|
|
document.getElementById('<%= TxtTotalCargos.ClientID %>').style.color = "#ff0000";
|
|
document.getElementById('<%= TxtTotalAbonos.ClientID %>').style.color = "#ff0000";
|
|
$('#<%= BtnGuardar.ClientID %>').prop('disabled', true);
|
|
}
|
|
|
|
}
|
|
|
|
function CargaTxtFunciones() {
|
|
|
|
$(".txtcargo").each(function () {
|
|
|
|
$(this).keyup(function () {
|
|
calculateCargo();
|
|
comparar();
|
|
});
|
|
});
|
|
|
|
|
|
$(".txtabono").each(function () {
|
|
|
|
$(this).keyup(function () {
|
|
calculateAbono();
|
|
comparar();
|
|
});
|
|
});
|
|
|
|
}
|
|
|
|
|
|
function calculateCargo() {
|
|
var sum = 0;
|
|
|
|
//iterate through each textboxes and add the values
|
|
|
|
$(".txtcargo").each(function () {
|
|
|
|
|
|
if (this.value.length != 0){
|
|
var tempVal = this.value.replace(/,/g, '');
|
|
|
|
//add only if the value is number
|
|
if(!isNaN(tempVal)){
|
|
this.value = numberFormat(tempVal);
|
|
sum += parseFloat(tempVal);
|
|
}
|
|
}
|
|
|
|
|
|
});
|
|
//.toFixed() method will roundoff the final sum to 2 decimal places
|
|
$('#<%= TxtTotalCargos.ClientID %>').val(sum.toFixed(2));
|
|
|
|
}
|
|
|
|
|
|
|
|
function calculateAbono() {
|
|
var sum = 0;
|
|
|
|
$(".txtabono").each(function () {
|
|
|
|
if (this.value.length != 0) {
|
|
var tempVal = this.value.replace(/,/g, '');
|
|
if (!isNaN(tempVal)) {
|
|
this.value = numberFormat(tempVal);
|
|
sum += parseFloat(tempVal);
|
|
}
|
|
}
|
|
});
|
|
$('#<%= TxtTotalAbonos.ClientID %>').val(sum.toFixed(2));
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
function checkTextAreaMaxLength(textBox, e, length) {
|
|
|
|
var mLen = textBox["MaxLength"];
|
|
if (null == mLen)
|
|
mLen = length;
|
|
|
|
var maxLength = parseInt(mLen);
|
|
if (!checkSpecialKeys(e)) {
|
|
if (textBox.value.length > maxLength - 1) {
|
|
if (window.event)//IE
|
|
e.returnValue = false;
|
|
else//Firefox
|
|
e.preventDefault();
|
|
}
|
|
}
|
|
}
|
|
function checkSpecialKeys(e) {
|
|
if (e.keyCode != 8 && e.keyCode != 46 && e.keyCode != 37 && e.keyCode != 38 && e.keyCode != 39 && e.keyCode != 40)
|
|
return false;
|
|
else
|
|
return true;
|
|
}
|
|
|
|
|
|
function numberFormat(_number) {
|
|
var _sep = ',';
|
|
_number = typeof _number != "undefined" && _number > 0 ? _number : "";
|
|
_number = _number.replace(new RegExp("^(\\d{" + (_number.length % 3 ? _number.length % 3 : 0) + "})(\\d{3})", "g"), "$1 $2").replace(/(\d{3})+?/gi, "$1 ").trim();
|
|
if (typeof _sep != "undefined" && _sep != " ") {
|
|
_number = _number.replace(/\s/g, _sep);
|
|
}
|
|
|
|
return _number;
|
|
}
|
|
|
|
|
|
</script>
|
|
|
|
</asp:Content>
|
|
|