926 lines
42 KiB
C#
926 lines
42 KiB
C#
using Extensiones;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.UI.WebControls;
|
|
using static Extensiones.ModExtensiones;
|
|
|
|
public partial class Bancos_PagoDeudor : ClsPaginas
|
|
{
|
|
#region "PROPIEDADES"
|
|
private bool UsaComplementaria
|
|
{
|
|
get
|
|
{
|
|
return Convert.ToBoolean(ViewState["UsaComplementaria"]);
|
|
}
|
|
set
|
|
{
|
|
ViewState["UsaComplementaria"] = value;
|
|
}
|
|
}
|
|
private int CveMonedaPrestamo
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveMonedaPrestamo"].ToEntero();
|
|
}
|
|
|
|
set
|
|
{
|
|
ViewState["CveMonedaPrestamo"] = value;
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
|
|
CargaTipoTransaccion();
|
|
CargaCuentas();
|
|
CargaProveedores();
|
|
CargaReporte();
|
|
CargaSubproyectos();
|
|
CveMonedaPrestamo = 1;
|
|
UsaComplementaria = true;
|
|
if (UsuarioActual.CveEmpresa.Contiene(13)) { UsaComplementaria = false; }
|
|
TxtFechaDocumento.Text = NowADS().ToShortDateString();
|
|
TxtFechaPrestamo.Text = NowADS().ToShortDateString();
|
|
txtFechaI.Text = NowADS().FirstDayOfMonth().ToShortDateString();
|
|
txtFechaF.Text = NowADS().ToShortDateString();
|
|
TxtTCDolaresPrestamo.Text = get_GlobalTipoCambio(TxtFechaPrestamo.Text.ToDateTime()).FormatoNumero(4);
|
|
TxtTCDolaresPago.Text = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDateTime()).FormatoNumero(4);
|
|
TxtImporte.Attributes.Add("disabled", "disabled");
|
|
CargarCentrosDeCosto(null, null, null, LblSubProyecto);
|
|
LblSubProyecto2.Text = LblSubProyecto.Text;
|
|
|
|
ValidaFechaDocumentoDiasPosterioresPrestamo();
|
|
ValidaFechaDocumentoDiasPosteriores();
|
|
}
|
|
}
|
|
|
|
private void CargaSubproyectos()
|
|
{
|
|
|
|
DdlSubProyecto.DataSource = get_GlobalDTSubProyectos( UsuarioActual.CveEmpresa);
|
|
DdlSubProyecto.DataBind();
|
|
|
|
DdlSubProyecto.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
|
|
DdlSubProyectoPago.DataSource = get_GlobalDTSubProyectos( UsuarioActual.CveEmpresa);
|
|
DdlSubProyectoPago.DataBind();
|
|
|
|
DdlSubProyectoPago.Items.Insert(0, new ListItem("Seleccione", "-1"));
|
|
|
|
|
|
|
|
}
|
|
|
|
#region"INFORMACION GENERAL"
|
|
protected void CargaTipoTransaccion()
|
|
{
|
|
DdlTipoTransaccion.Items.Clear();
|
|
DdlTipoTransaccionPrestamo.Items.Clear();
|
|
|
|
DdlTipoTransaccion.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Ing' AND Estatus = 1");
|
|
DdlTipoTransaccionPrestamo.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Egs' AND Estatus = 1");
|
|
|
|
DdlTipoTransaccion.DataBind();
|
|
DdlTipoTransaccionPrestamo.DataBind();
|
|
|
|
DdlTipoTransaccion.Items.Insert(0, new ListItem("Seleccione Tipo Movimiento", "-1"));
|
|
DdlTipoTransaccionPrestamo.Items.Insert(0, new ListItem("Seleccione Tipo Movimiento", "-1"));
|
|
}
|
|
|
|
protected void CargaCuentas()
|
|
{
|
|
DdlCuenta.Items.Clear();
|
|
DdlCuentaPrestamo.Items.Clear();
|
|
|
|
DdlCuenta.DataSource = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa: UsuarioActual.CveEmpresa).FiltraParametros("CveTipoCuenta <> 1"); //quito las cajas chicas
|
|
DdlCuentaPrestamo.DataSource = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa: UsuarioActual.CveEmpresa).FiltraParametros("CveTipoCuenta <> 1");
|
|
|
|
DdlCuenta.DataBind();
|
|
DdlCuentaPrestamo.DataBind();
|
|
|
|
DdlCuenta.Items.Insert(0, new ListItem("Seleccione Cuenta", "-1"));
|
|
DdlCuentaPrestamo.Items.Insert(0, new ListItem("Seleccione Cuenta", "-1"));
|
|
}
|
|
|
|
protected void CargaProveedores()
|
|
{
|
|
DdlProveedores.setEsWebService(true);
|
|
DdlProveedorPrestamo.setEsWebService(true);
|
|
DdlProveedorAuxiliar.setEsWebService(true);
|
|
|
|
DdlProveedores.Attributes.Add("data-metodo", "getproveedores");
|
|
DdlProveedorPrestamo.Attributes.Add("data-metodo", "getproveedores");
|
|
DdlProveedorAuxiliar.Attributes.Add("data-metodo", "getproveedores");
|
|
}
|
|
|
|
protected void CambiaTipoMoneda()
|
|
{
|
|
if (DivTCDolaresPrestamo1.Visible)
|
|
{
|
|
TxtTCDolaresPrestamo.Text = get_GlobalTipoCambio(TxtFechaPrestamo.Text.ToDateTime()).FormatoNumero(4);
|
|
}
|
|
UpPrestamo.Update();
|
|
}
|
|
|
|
protected void CambiaTipoMonedaP()
|
|
{
|
|
if (DivTCDolaresPago.Visible)
|
|
{
|
|
TxtTCDolaresPago.Text = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDateTime()).FormatoNumero(4);
|
|
RegistraScript(String.Format("FnCambia({0},this,{1},2,'{2}',{3});", 0, 0, "", HdnMonPago.Value));
|
|
}
|
|
UpDatos.Update();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region "PRESTAMO DEUDORES"
|
|
protected void BtnCambiaTipoMoneda_Click(object sender, EventArgs e)
|
|
{
|
|
CambiaTipoMoneda();
|
|
}
|
|
|
|
protected void DdlCuentaPrestamo_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
long Folio;
|
|
ClsBancos bancos = new ClsBancos();
|
|
Folio = bancos.GetNextFolio(DdlCuentaPrestamo.SelectedValue.ToEntero(), DdlTipoTransaccionPrestamo.SelectedValue.ToEntero());
|
|
bancos.Dispose();
|
|
TxtFolioPrestamo.Text = Folio.ToString();
|
|
|
|
CveMonedaPrestamo = get_GlobalDTBancosCuentas(-1, CveEmpresa: UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMoneda", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveCuenta = {DdlCuentaPrestamo.SelectedValue.ToEntero()}").ToEntero();
|
|
|
|
if (CveMonedaPrestamo == 2)
|
|
{
|
|
TxtFechaPrestamo.Attributes.Add("onchange", "CambiaTC(this);");
|
|
DivTCDolaresPrestamo1.Visible = true;
|
|
DivTCDolaresPrestamo2.Visible = true;
|
|
}
|
|
else
|
|
{
|
|
TxtFechaPrestamo.Attributes.Remove("onchange");
|
|
DivTCDolaresPrestamo1.Visible = false;
|
|
DivTCDolaresPrestamo2.Visible = false;
|
|
}
|
|
UpPrestamo.Update();
|
|
}
|
|
|
|
protected void DdlProveedorPrestamo_selectedindexchange(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
protected void BtnGuardarPrestamo_Click(object sender, EventArgs e)
|
|
{
|
|
ClsBancos ObjIE = new ClsBancos();
|
|
ClsContabilidad ObjMov = new ClsContabilidad(ObjIE.IniciaTransacSQL());
|
|
ClsCompras ObjComp = new ClsCompras(ObjIE.IniciaTransacSQL());
|
|
|
|
string MsgError = "";
|
|
int CveIE = 0;
|
|
int CveConceptoContableBanco = 30;
|
|
int CveConceptoContablePrestamo = 43;
|
|
int CvePlantillaPoliza = 45;
|
|
int CvePrePoliza = 0;
|
|
int FolioFijo = 0;
|
|
//int IDPoliza = 0;
|
|
decimal tipoCambio = (CveMonedaPrestamo == 2) ? TxtTCDolaresPrestamo.Text.ToDecimal() : 1;
|
|
StringBuilder Msg = new StringBuilder();
|
|
|
|
//OBTIENE COMPROBANTE !!
|
|
string Comprobante = "";
|
|
List<Archivo> filesgral = AnexoPrestamo.getfiles().Archivos;
|
|
string filemove = "";
|
|
|
|
foreach (Archivo fileItem in filesgral)
|
|
{
|
|
Comprobante = System.IO.Path.GetExtension(string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "");
|
|
filemove = fileItem.filename;
|
|
}
|
|
|
|
// DATOS PREPOLIZA
|
|
if (DdlTipoTransaccionPrestamo.SelectedValue == "1" && UsuarioActual.CveEmpresa != 119) FolioFijo = TxtFolioPrestamo.Text.ToEntero();
|
|
CvePrePoliza = ObjMov.AddPrePolizas("PRESTAMO DEUDORES", CvePlantillaPoliza, TxtImportePrestamo.Text.Trim().ToDouble(), TxtImportePrestamo.Text.Trim().ToDouble(), CveMonedaPrestamo, TxtFechaPrestamo.Text.ToDate(), DdlProveedorPrestamo.SelectedText.ToString(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo: FolioFijo, ReglaFolioPoliza: ObjComp.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, null, UsuarioActual.CveEmpresa), CveTipoPoliza: ObjMov.ObtenerTipoPoliza(DdlTipoTransaccionPrestamo.SelectedValue, "-1", UsuarioActual.CveEmpresa));
|
|
|
|
if (CvePrePoliza > 0)
|
|
{
|
|
string Conc = TxtObservacionesPrestamo.Text == "" ? TxtFolioPrestamo.Text : TxtObservacionesPrestamo.Text;
|
|
string Ref = TxtObservacionesPrestamo.Text == "" ? TxtFolioPrestamo.Text : TxtObservacionesPrestamo.Text;
|
|
|
|
CveIE = ObjIE.AddBancos_IE(DdlCuentaPrestamo.SelectedValue.ToEntero(), DdlTipoTransaccionPrestamo.SelectedValue.ToEntero(), TxtFechaPrestamo.Text.Trim().ToDate(), TxtFolioPrestamo.Text.Trim(), DdlProveedorPrestamo.SelectedText.ToString(),
|
|
TxtImportePrestamo.Text.Trim().ToDouble(), CveMonedaPrestamo, tipoCambio.ToString().ToDouble(), TxtObservacionesPrestamo.Text.Trim(), "", false, false, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
|
|
|
|
if (CveIE > 0)
|
|
{
|
|
//GUARDA COMPROBANTE
|
|
if (!filemove.Equals(""))
|
|
{
|
|
filemove.FilesMove(CveIE.ToString(), string.Format(@"{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase: false);
|
|
}
|
|
|
|
// SI ES DOLARES
|
|
if (CveMonedaPrestamo == 2)
|
|
{
|
|
// BANCOS - BANCOS COMPLEMENTARIA
|
|
if (UsaComplementaria)
|
|
{
|
|
|
|
// BANCOS
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, TxtImportePrestamo.Text.ToDecimal(), TxtImportePrestamo.Text.ToDecimal(),CveConceptoContableBanco, Ref, Conc, CveIE:CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteME: TxtImportePrestamo.Text.ToDecimal(), TipoCambio: tipoCambio, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de bancos";
|
|
}
|
|
// BANCOS - COMPLEMENTARIA
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, 0, (TxtImportePrestamo.Text.ToDecimal() * tipoCambio) - TxtImportePrestamo.Text.ToDecimal(), 204, Ref, Conc, CveIE : CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteME: TxtImportePrestamo.Text.ToDecimal(), TipoCambio: tipoCambio, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de bancos complementaria";
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
// BANCOS
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, TxtImportePrestamo.Text.ToDecimal(), TxtImportePrestamo.Text.ToDecimal() * tipoCambio, CveConceptoContableBanco, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteME: TxtImportePrestamo.Text.ToDecimal(), TipoCambio: tipoCambio, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de bancos";
|
|
}
|
|
}
|
|
|
|
// DEUDORES - DEUDORES COMPLEMENTARIAI
|
|
if (UsaComplementaria)
|
|
{
|
|
// DEUDOR COMPLEMENTARIA
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, 0, (TxtImportePrestamo.Text.ToDecimal() * tipoCambio) - TxtImportePrestamo.Text.ToDecimal(), 256, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteME: TxtImportePrestamo.Text.ToDecimal(), TipoCambio: tipoCambio, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de deudor complementaria";
|
|
}
|
|
|
|
// DEUDOR
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, TxtImportePrestamo.Text.ToDecimal(), TxtImportePrestamo.Text.ToDecimal(), CveConceptoContablePrestamo, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteME: TxtImportePrestamo.Text.ToDecimal(), TipoCambio: tipoCambio, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de deudor";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
// DEUDOR
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, TxtImportePrestamo.Text.ToDecimal(), TxtImportePrestamo.Text.ToDecimal() * tipoCambio, CveConceptoContablePrestamo, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteME: TxtImportePrestamo.Text.ToDecimal(), TipoCambio: tipoCambio, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de deudor";
|
|
}
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
// BANCOS
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, TxtImportePrestamo.Text.ToDecimal(), TxtImportePrestamo.Text.ToDecimal(), CveConceptoContableBanco, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), TipoCambio: tipoCambio, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de bancos";
|
|
}
|
|
|
|
// DEUDOR
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, TxtImportePrestamo.Text.ToDecimal(), TxtImportePrestamo.Text.ToDecimal(), CveConceptoContablePrestamo, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), TipoCambio: tipoCambio, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de deudor";
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MsgError = "No se insertó el encabezado";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MsgError = "No se pudo insertar la póliza";
|
|
}
|
|
|
|
Usuario UA = UsuarioActual;
|
|
|
|
if (ObjMov.ValidacionesPrePoliza(CvePrePoliza, ref UA))
|
|
{
|
|
if (ObjMov.ValorPolizaDescuadre > 0)
|
|
{
|
|
$"Bancos/IE PAGO Deudor | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}".GuardaLogAD("LogPrePolizas");
|
|
}
|
|
}
|
|
|
|
if (MsgError.Equals(""))
|
|
{
|
|
ObjIE.Commit();
|
|
if (Msg.ToString().Equals(""))
|
|
{
|
|
Msg.Append("El Documento se guardo correctamente.<br/>");
|
|
}
|
|
System.IO.FileInfo archivo = null;
|
|
Msg.AppendFormat("Folio: <a class='Texto' target='_blank' href='/Bancos/IE.aspx?CveIE={0}'>{1}</a><br/>", CveIE, TxtFolioPrestamo.Text.Trim());
|
|
|
|
if (DdlTipoTransaccionPrestamo.SelectedValue.ToEntero().Contiene(2, 8, 9))
|
|
{
|
|
archivo = new System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta));
|
|
}
|
|
else if (DdlTipoTransaccionPrestamo.SelectedValue.ToEntero().Contiene(1))
|
|
{
|
|
archivo = new System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, DdlCuentaPrestamo.SelectedValue.ToEntero()));
|
|
|
|
if (!archivo.Exists)
|
|
{
|
|
archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", ModExtensiones.DirectorioBaseEmpresas));
|
|
}
|
|
}
|
|
else if (DdlTipoTransaccionPrestamo.SelectedValue.ToEntero().Contiene(6) && UsuarioActual.CveEmpresa == 72)
|
|
{
|
|
archivo = new System.IO.FileInfo(String.Format("{0}Formatos/ComprobanteEgreso.rdlc", UsuarioActual.Empresa.Ruta, DdlCuentaPrestamo.SelectedValue.ToEntero()));
|
|
}
|
|
|
|
//if (archivo.Length > 0)
|
|
//{
|
|
// if (archivo.Exists)
|
|
// {
|
|
// Msg.AppendFormat(@"<br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">{1}</a> ", Encripta(String.Format("OP=IECHEQUE&CVEIE={0}", CveIE)), String.Format("Imprimir {0}", DdlTipoTransaccion.SelectedItem));
|
|
// }
|
|
//}
|
|
|
|
//if (IDPoliza > 0)
|
|
//{
|
|
// Msg.AppendFormat(@"<br/><br/><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", IDPoliza);
|
|
//}
|
|
Msg.AppendFormat(@"<a class=""Texto"" target='_blank' href=""/Contabilidad/RegPrepolizaS.aspx?CvePrePoliza={0}"">Ver Póliza</a><br/>", CvePrePoliza);
|
|
Msg.AppendFormat($"<a class='Texto' target='_blank' href='/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=PREPO&CvePrePoliza={CvePrePoliza}")}'>Imprimir</a>");
|
|
|
|
}
|
|
else
|
|
{
|
|
ObjIE.RollBack();
|
|
}
|
|
|
|
if (!Msg.ToString().Equals(""))
|
|
{
|
|
string AccionJS = String.Format(@"document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery);
|
|
Alert(Msg.ToString(), TipoMensaje.MsgInformacion, String.Format(@"document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery));
|
|
}
|
|
|
|
ObjIE.Dispose();
|
|
ObjMov.Dispose();
|
|
|
|
if (ObjComp != null)
|
|
ObjComp.Dispose();
|
|
}
|
|
|
|
protected void DdlTipoTransaccionPrestamo_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
ValidaFechaDocumentoDiasPosterioresPrestamo();
|
|
}
|
|
protected void RVTxtFechaPrestamo_Init(object sender, EventArgs e)
|
|
{
|
|
RVTxtFechaPrestamo.MaximumValue = NowADS().AddDays(2).ToShortDateString();
|
|
RVTxtFechaPrestamo.MinimumValue = NowADS().AddMonths(-38).ToShortDateString();
|
|
CalendarioPrestamo.EndDate = NowADS().AddDays(2);
|
|
|
|
}
|
|
|
|
private void ValidaFechaDocumentoDiasPosterioresPrestamo()
|
|
{
|
|
RVTxtFechaPrestamo.MaximumValue = NowADS().AddDays(3).ToShortDateString();
|
|
RVTxtFechaPrestamo.ErrorMessage = "<b><span style='text-decoration: underline'>ERROR:</span></b> <br/> La fecha del documento no puede ser superior a 3 días de la fecha actual";
|
|
|
|
CalendarioPrestamo.EndDate = NowADS().AddDays(3);
|
|
|
|
// Equivalente a: If DdlTipoMovto.SelectedValue.Contiene("1", "16") Then
|
|
// Suponiendo que "Contiene" verifique si SelectedValue es "1" o "16"
|
|
if (DdlTipoTransaccionPrestamo.SelectedValue == "1" || DdlTipoTransaccionPrestamo.SelectedValue == "16")
|
|
{
|
|
// cheques, 3 meses
|
|
RVTxtFechaPrestamo.MaximumValue = NowADS().AddMonths(3).ToShortDateString();
|
|
RVTxtFechaPrestamo.ErrorMessage = "<b><span style='text-decoration: underline'>ERROR:</span></b> <br/> La fecha del documento no puede ser superior a 3 meses de la fecha actual";
|
|
CalendarioPrestamo.EndDate = NowADS().AddMonths(3);
|
|
}
|
|
|
|
// transfer, 3 semanas
|
|
if (DdlTipoTransaccionPrestamo.SelectedValue == "2")
|
|
{
|
|
RVTxtFechaPrestamo.MaximumValue = NowADS().AddDays(21).ToShortDateString();
|
|
RVTxtFechaPrestamo.ErrorMessage = "<b><span style='text-decoration: underline'>ERROR:</span></b> <br/> La fecha del documento no puede ser superior a 3 semanas de la fecha actual";
|
|
CalendarioPrestamo.EndDate = NowADS().AddDays(21);
|
|
}
|
|
|
|
UpPrestamo.Update();
|
|
//UpGuardar.Update();
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region "PAGO DEUDORES"
|
|
protected void DdlCuenta_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
long Folio;
|
|
ClsBancos bancos = new ClsBancos();
|
|
Folio = bancos.GetNextFolio(DdlCuenta.SelectedValue.ToEntero(), DdlTipoTransaccion.SelectedValue.ToEntero());
|
|
bancos.Dispose();
|
|
TxtFolio.Text = Folio.ToString();
|
|
|
|
int CveMoneda = get_GlobalDTBancosCuentas(-1, CveEmpresa: UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMoneda", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveCuenta = {DdlCuenta.SelectedValue.ToEntero()}").ToEntero();
|
|
HdnMonPago.Value = CveMoneda.ToString();
|
|
if (CveMoneda == 2)
|
|
{
|
|
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTCP(this);");
|
|
DivTCDolaresPago.Visible = true;
|
|
DivImporteMN.Visible = true;
|
|
TxtTCDolaresPago.Attributes.Add("onkeyup", String.Format("FnCambia({0},this,{1},2,'{2}',{3});", 0, 0, "", HdnMonPago.Value));
|
|
}
|
|
else
|
|
{
|
|
TxtFechaDocumento.Attributes.Remove("onchange");
|
|
TxtTCDolaresPago.Attributes.Remove("onkeyup");
|
|
DivTCDolaresPago.Visible = false;
|
|
DivImporteMN.Visible = false;
|
|
}
|
|
|
|
if (DdlProveedores.SelectedValue.ToEntero() > 0)
|
|
{
|
|
DdlProveedores_selectedindexchange(DdlProveedores, null);
|
|
}
|
|
|
|
UpDatos.Update();
|
|
}
|
|
|
|
protected void BtnCambiaTipoMonedaP_Click(object sender, EventArgs e)
|
|
{
|
|
CambiaTipoMonedaP();
|
|
}
|
|
|
|
protected void DdlProveedores_selectedindexchange(object sender, EventArgs e)
|
|
{
|
|
ClsMovimientos ObjMov = new ClsMovimientos();
|
|
ClsCompProveedores proveedores = new ClsCompProveedores();
|
|
|
|
|
|
if (DdlProveedores.SelectedValue.ToEntero() > 0)
|
|
{
|
|
if (ObjMov.GetDeudoresrXSaldar(DdlProveedores.SelectedValue.ToEntero(), -1, UsuarioActual.CveEmpresa))
|
|
{
|
|
GvMovDeudor.DataSource = ObjMov.DtResultados.FiltraParametros("CveIE > 0 AND Saldo > 0 ", "");
|
|
}
|
|
}
|
|
else
|
|
{
|
|
GvMovDeudor.DataSource = null;
|
|
}
|
|
TxtImporte.Text = "0.00";
|
|
|
|
GvMovDeudor.DataBind();
|
|
ObjMov.Dispose();
|
|
proveedores.Dispose();
|
|
UpMovDeudor.Update();
|
|
}
|
|
|
|
protected void GvMovDeudor_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
if (DdlCuenta.SelectedValue == "-1")
|
|
{
|
|
e.Row.FCCheckBox("Chk").Enabled = false;
|
|
e.Row.FCTextBox("TxtAbonar").Enabled = false;
|
|
}
|
|
|
|
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1},{2});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), HdnMonPago.Value));
|
|
e.Row.FCTextBox("TxtAbonar").Attributes.Add("onblur", String.Format("FnCambia({0},this,{1},1,'{2}',{3});", e.Row.FCCheckBox("Chk").ClientID, e.Row.DBCampo("Saldo"), "El Importe no debe de exceder el saldo", HdnMonPago.Value));
|
|
}
|
|
}
|
|
|
|
protected void BtnIEGuardar_Click(object sender, EventArgs e)
|
|
{
|
|
ClsBancos ObjIE = new ClsBancos();
|
|
ClsContabilidad ObjMov = new ClsContabilidad(ObjIE.IniciaTransacSQL());
|
|
ClsCompras ObjComp = new ClsCompras(ObjIE.IniciaTransacSQL());
|
|
|
|
string MsgError = "";
|
|
int CveIE = 0;
|
|
int CveConceptoContableBanco = 30;
|
|
int CveConceptoContableBancoComplementario = 204;
|
|
int CveConceptoContablePago = 37;
|
|
int CveConceptoContablePagoComplementaria = 256;
|
|
int CvePlantillaPoliza = 39;
|
|
int CvePrePoliza = 0;
|
|
int CveMoneda = get_GlobalDTBancosCuentas(-1, CveEmpresa: UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMoneda", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveCuenta = {DdlCuenta.SelectedValue.ToEntero()}").ToEntero();
|
|
int FolioFijo = 0;
|
|
//int IDPoliza = 0;
|
|
decimal tipoCambio = (TxtTCDolaresPago.Visible == true) ? TxtTCDolaresPago.Text.ToDecimal() : 1;
|
|
decimal importeMN = HdnImporteMN.Value.ToDecimal();
|
|
StringBuilder Msg = new StringBuilder();
|
|
|
|
|
|
//OBTIENE COMPROBANTE !!
|
|
string Comprobante = "";
|
|
List<Archivo> filesgral = Anexo.getfiles().Archivos;
|
|
string filemove = "";
|
|
|
|
foreach (Archivo fileItem in filesgral)
|
|
{
|
|
Comprobante = System.IO.Path.GetExtension(string.Format(@"{0}Temp\{1}", AppDomain.CurrentDomain.BaseDirectory, fileItem.filename)).Replace(".", "");
|
|
filemove = fileItem.filename;
|
|
}
|
|
|
|
// DATOS PREPOLIZA
|
|
if (DdlTipoTransaccion.SelectedValue == "1" && UsuarioActual.CveEmpresa != 119) FolioFijo = TxtFolio.Text.ToEntero();
|
|
|
|
CvePrePoliza = ObjMov.AddPrePolizas("PAGO DEUDORES", CvePlantillaPoliza, TxtImporte.Text.Trim().ToDouble(), TxtImporte.Text.Trim().ToDouble(), CveMoneda, TxtFechaDocumento.Text.ToDate(), DdlProveedores.SelectedText.ToString(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo: FolioFijo, ReglaFolioPoliza: ObjComp.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, null, UsuarioActual.CveEmpresa), CveTipoPoliza: ObjMov.ObtenerTipoPoliza(DdlTipoTransaccion.SelectedValue, "-1", UsuarioActual.CveEmpresa));
|
|
|
|
if (CvePrePoliza > 0)
|
|
{
|
|
string Conc = TxtObservaciones.Text == "" ? TxtFolio.Text : TxtObservaciones.Text;
|
|
string Ref = TxtObservaciones.Text == "" ? TxtFolio.Text : TxtObservaciones.Text;
|
|
decimal ImporteBanco = TxtImporte.Text.ToDecimal().RoundSQL();
|
|
decimal ImporteMNBanco = ImporteBanco;
|
|
decimal ImporteComplementaria = 0;
|
|
decimal TC = TxtTCDolaresPago.Text.ToDecimal();
|
|
|
|
CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero(), DdlTipoTransaccion.SelectedValue.ToEntero(), TxtFechaDocumento.Text.Trim().ToDate(), TxtFolio.Text.Trim(), DdlProveedores.SelectedText.ToString(), ImporteBanco.ToString().ToDouble(), CveMoneda,
|
|
(Double)tipoCambio, TxtObservaciones.Text.Trim(), "", false, false, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
|
|
|
|
|
|
decimal ImporteMN=0;
|
|
|
|
if (CveIE > 0)
|
|
{
|
|
decimal Importe;
|
|
|
|
|
|
//GUARDA COMPROBANTE
|
|
if (!filemove.Equals(""))
|
|
{
|
|
filemove.FilesMove(CveIE.ToString(), string.Format(@"{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase: false);
|
|
}
|
|
|
|
//GUARDA PREPOLIZAS DETALLE
|
|
foreach (GridViewRow gvr in GvMovDeudor.Rows)
|
|
{
|
|
if (gvr.FCCheckBox("Chk").Checked)
|
|
{
|
|
|
|
Decimal TCDoc = gvr.DataKey("TipoCambio").ToDecimal(); // tipo de cambio de IE
|
|
if (gvr.DataKey("FechaDocumento").ToDate() < TxtFechaDocumento.Text.ToDate().FirstDayOfMonth())
|
|
{
|
|
// si la fecha del documento a pagar es menor al primer dia del mes del pago, toma el TC del mes anterior
|
|
TCDoc = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDate().AddMonths(-1).LastDayOfMonth()).ToDecimal();
|
|
}
|
|
|
|
Importe = gvr.FCTextBox("TxtAbonar").Text.ToDecimal().RoundSQL();
|
|
ImporteMN = Importe;
|
|
ImporteComplementaria = 0;
|
|
|
|
int tCveMoneda = gvr.DataKey("CveMoneda").ToEntero();
|
|
if (CveMoneda == 1 && tCveMoneda == 1)
|
|
{
|
|
ImporteMN = Importe;
|
|
}
|
|
else if (CveMoneda == 1 && tCveMoneda == 2)
|
|
{
|
|
if (UsaComplementaria)
|
|
{
|
|
ImporteMN = Importe;
|
|
ImporteComplementaria = Importe * TCDoc - Importe;
|
|
}
|
|
else
|
|
{
|
|
ImporteMN = Importe * TCDoc;
|
|
ImporteComplementaria = 0;
|
|
}
|
|
}
|
|
else if (CveMoneda == 2 && tCveMoneda == 1)
|
|
{
|
|
|
|
ImporteMN = Importe;
|
|
}
|
|
else if (CveMoneda == 2 && tCveMoneda == 2)
|
|
{
|
|
if (UsaComplementaria)
|
|
{
|
|
ImporteMN = Importe;
|
|
ImporteComplementaria = Importe * TCDoc - Importe;
|
|
}
|
|
else
|
|
{
|
|
ImporteMN = Importe * TCDoc;
|
|
ImporteComplementaria = 0;
|
|
}
|
|
}
|
|
|
|
ImporteMN = ImporteMN.RoundSQL();
|
|
ImporteComplementaria = ImporteComplementaria.RoundSQL();
|
|
|
|
if (tCveMoneda != 1)
|
|
{
|
|
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, ImporteMN, CveConceptoContablePago, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), TipoCambio: TCDoc, TipoCambioPago: TC, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de pago deudor";
|
|
break;
|
|
}
|
|
if (UsaComplementaria)
|
|
{
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, ImporteComplementaria, CveConceptoContablePagoComplementaria, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), ImporteME: Importe, TipoCambio: TCDoc, TipoCambioPago: TC, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de deudor complementaria";
|
|
}
|
|
}
|
|
|
|
if (TC != TCDoc)
|
|
{
|
|
int CveConceptoDiferenciaCambiaria = 0;
|
|
bool TipoMovto = false;
|
|
if (TC < TCDoc)
|
|
{
|
|
CveConceptoDiferenciaCambiaria = 65;
|
|
TipoMovto = false;
|
|
Importe = (Importe * gvr.DataKey("TipoCambio").ToDecimal()) - (Importe * TC);
|
|
}
|
|
else if (TC > TCDoc)
|
|
{
|
|
CveConceptoDiferenciaCambiaria = 64;
|
|
TipoMovto = true;
|
|
Importe = (Importe * TC) - (Importe * gvr.DataKey("TipoCambio").ToDecimal());
|
|
}
|
|
ImporteMN = Importe;
|
|
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, ImporteMN, CveConceptoDiferenciaCambiaria, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), ImporteME: Importe, TipoCambio: gvr.DataKey("TipoCambio").ToDecimal(), TipoCambioPago: TC, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de diferencia cambiaria";
|
|
}
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, ImporteMN, CveConceptoContablePago, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), TipoCambio: gvr.DataKey("TipoCambio").ToDecimal(), TipoCambioPago: TC, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de pago deudor";
|
|
break;
|
|
}
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if (CveMoneda != 1)
|
|
{
|
|
if (UsaComplementaria)
|
|
{
|
|
ImporteMNBanco = ImporteBanco;
|
|
ImporteComplementaria = (ImporteBanco * TC - ImporteBanco).RoundSQL();
|
|
}
|
|
else
|
|
{
|
|
ImporteMNBanco = (ImporteBanco * TC).RoundSQL();
|
|
ImporteComplementaria = 0;
|
|
}
|
|
}
|
|
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, ImporteBanco, ImporteMNBanco, CveConceptoContableBanco, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteME: ImporteBanco, TipoCambio: TC, TipoCambioPago: TC, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de bancos";
|
|
}
|
|
|
|
if (CveMoneda != 1 && UsaComplementaria)
|
|
{
|
|
|
|
//decimal difComplementaria = ImporteMN - (ImporteBanco + ImporteComplementaria);
|
|
|
|
//if (difComplementaria != 0)
|
|
//{
|
|
// ImporteComplementaria = difComplementaria > 0 ? (ImporteComplementaria+ difComplementaria) : (ImporteComplementaria- difComplementaria);
|
|
//}
|
|
ImporteComplementaria = (ImporteBanco * TC) - ImporteBanco;
|
|
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, ImporteBanco, ImporteComplementaria, CveConceptoContableBancoComplementario, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteME: ImporteBanco, TipoCambio: TC, TipoCambioPago: TC, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de bancos complementaria";
|
|
}
|
|
}
|
|
|
|
Usuario UA = UsuarioActual;
|
|
if (ObjMov.ValidacionesPrePoliza(CvePrePoliza, ref UA, Opcion: 10))
|
|
|
|
{
|
|
if (ObjMov.ValorPolizaDescuadre > 0)
|
|
{
|
|
MsgError = ObjMov.MensajePolizaDescuadre;
|
|
$"Bancos/IE PAGO Deudor | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}".GuardaLogAD("LogPrePolizas");
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MsgError = "No se insertó el encabezado";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MsgError = "No se pudo insertar la póliza";
|
|
}
|
|
|
|
if (MsgError.Equals(""))
|
|
{
|
|
ObjIE.Commit();
|
|
if (Msg.ToString().Equals(""))
|
|
{
|
|
Msg.Append("El Documento se guardo correctamente.<br/>");
|
|
}
|
|
System.IO.FileInfo archivo = null;
|
|
Msg.AppendFormat("Folio: <a class='Texto' target='_blank' href='/Bancos/IE.aspx?CveIE={0}'>{1}</a><br/>", CveIE, TxtFolio.Text.Trim());
|
|
|
|
if (DdlTipoTransaccion.SelectedValue.ToEntero().Contiene(2, 8, 9))
|
|
{
|
|
archivo = new System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta));
|
|
}
|
|
else if (DdlTipoTransaccion.SelectedValue.ToEntero().Contiene(1))
|
|
{
|
|
archivo = new System.IO.FileInfo(String.Format("{0}Formatos/CHQ-{1}.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero()));
|
|
|
|
if (!archivo.Exists)
|
|
{
|
|
archivo = new System.IO.FileInfo(String.Format(@"{0}\Empresas\Grales\Formatos\CHQ.rdlc", ModExtensiones.DirectorioBaseEmpresas));
|
|
}
|
|
}
|
|
else if (DdlTipoTransaccion.SelectedValue.ToEntero().Contiene(6) && UsuarioActual.CveEmpresa == 72)
|
|
{
|
|
archivo = new System.IO.FileInfo(String.Format("{0}Formatos/ComprobanteEgreso.rdlc", UsuarioActual.Empresa.Ruta, DdlCuenta.SelectedValue.ToEntero()));
|
|
}
|
|
|
|
//if (archivo.Length > 0)
|
|
//{
|
|
// if (archivo.Exists)
|
|
// {
|
|
// Msg.AppendFormat(@"<br/><br/> <a class=""Texto"" target='_blank' href=""/Compras/PopUpVerFactura.aspx?P={0}"">{1}</a> ", Encripta(String.Format("OP=IECHEQUE&CVEIE={0}", CveIE)), String.Format("Imprimir {0}", DdlTipoTransaccion.SelectedItem));
|
|
// }
|
|
//}
|
|
|
|
//if (IDPoliza > 0)
|
|
//{
|
|
// Msg.AppendFormat(@"<br/><br/><a class=""Texto"" target='_blank' href=""/Contabilidad/RegPoliza.aspx?IdPoliza={0}"">Ver Póliza</a>", IDPoliza);
|
|
//}
|
|
Msg.AppendFormat(@"<a class=""Texto"" target='_blank' href=""/Contabilidad/RegPrepolizaS.aspx?CvePrePoliza={0}"">Ver Póliza</a><br/>", CvePrePoliza);
|
|
Msg.AppendFormat($"<a class='Texto' target='_blank' href='/Compras/PopUpVerFactura.aspx?P={Encripta($"OP=PREPO&CvePrePoliza={CvePrePoliza}")}'>Imprimir</a>");
|
|
|
|
}
|
|
else
|
|
{
|
|
Alert(MsgError.ToString(), TipoMensaje.MsgError);
|
|
ObjIE.RollBack();
|
|
}
|
|
|
|
if (!Msg.ToString().Equals(""))
|
|
{
|
|
string AccionJS = String.Format(@"document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery);
|
|
Alert(Msg.ToString(), TipoMensaje.MsgInformacion, String.Format(@"document.location.href=""{0}"";", HttpContext.Current.Request.Url.PathAndQuery));
|
|
}
|
|
|
|
ObjIE.Dispose();
|
|
ObjMov.Dispose();
|
|
|
|
if (ObjComp != null)
|
|
ObjComp.Dispose();
|
|
}
|
|
#endregion
|
|
|
|
#region"REPORTE"
|
|
protected void CargaReporte()
|
|
{
|
|
ClsBancos bancos = new ClsBancos();
|
|
if (bancos.GetDeudoresReporte(UsuarioActual.CveEmpresa))
|
|
{
|
|
GvReporte.DataSource = bancos.DtResultados;
|
|
|
|
}
|
|
bancos.Dispose();
|
|
GvReporte.DataBind();
|
|
UpReporte.Update();
|
|
}
|
|
|
|
|
|
protected void GvReporte_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
if (e.Row.DBCampo("CveProveedor") == "") e.Row.CssClass = "SubTotales";
|
|
}
|
|
}
|
|
|
|
#endregion
|
|
|
|
#region"AUXILIAR"
|
|
protected void CargaAuxiliar()
|
|
{
|
|
string FechaI, FechaF;
|
|
|
|
if (txtFechaI.Text != "")
|
|
FechaI = txtFechaI.Text;
|
|
else
|
|
FechaI = "-1";
|
|
if (txtFechaF.Text != "")
|
|
FechaF = txtFechaF.Text;
|
|
else
|
|
FechaF = "-1";
|
|
int CveProveedor = -1;
|
|
if (DdlProveedorAuxiliar.SelectedValue.ToEntero() > 0) CveProveedor = DdlProveedorAuxiliar.SelectedValue.ToEntero();
|
|
|
|
ClsBancos bancos = new ClsBancos();
|
|
if (bancos.GetDeudoresAuxiliar(CveProveedor, FechaI, FechaF, UsuarioActual.CveEmpresa))
|
|
{
|
|
GvAuxiliar.DataSource = bancos.DtResultados;
|
|
}
|
|
bancos.Dispose();
|
|
GvAuxiliar.DataBind();
|
|
UpAuxiliar.Update();
|
|
}
|
|
protected void BtnConsultarAuxiliar_Click(object sender, EventArgs e)
|
|
{
|
|
CargaAuxiliar();
|
|
}
|
|
protected void GvAuxiliar_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
|
|
}
|
|
}
|
|
#endregion
|
|
|
|
|
|
|
|
protected void BtnMostrarTC_Click(object sender, EventArgs e)
|
|
{
|
|
DivTCDolaresPago.Visible = true;
|
|
TxtTCDolaresPago.Attributes.Add("onkeyup", String.Format("FnCambia({0},this,{1},2,'{2}',{3});", 0, 0, "", HdnMonPago.Value));
|
|
TxtFechaDocumento.Attributes.Add("onchange", "CambiaTCP(this);");
|
|
DivImporteME.Visible = true;
|
|
LbImporteME.Text = HdnImporteME.Value;
|
|
}
|
|
|
|
protected void BtnOcultarTC_Click(object sender, EventArgs e)
|
|
{
|
|
DivTCDolaresPago.Visible = false;
|
|
TxtTCDolaresPago.Attributes.Remove("onkeyup");
|
|
TxtFechaDocumento.Attributes.Remove("onchange");
|
|
DivImporteME.Visible = false;
|
|
}
|
|
|
|
|
|
|
|
protected void DdlTipoTransaccion_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
ValidaFechaDocumentoDiasPosteriores();
|
|
}
|
|
|
|
protected void RVTxtFechaDocumento_Init(object sender, EventArgs e)
|
|
{
|
|
RVTxtFechaDocumento.MaximumValue = NowADS().AddDays(2).ToShortDateString();
|
|
RVTxtFechaDocumento.MinimumValue = NowADS().AddMonths(-38).ToShortDateString();
|
|
Calendario.EndDate = NowADS().AddDays(2);
|
|
}
|
|
|
|
private void ValidaFechaDocumentoDiasPosteriores()
|
|
{
|
|
RVTxtFechaDocumento.MaximumValue = NowADS().AddDays(3).ToShortDateString();
|
|
RVTxtFechaDocumento.ErrorMessage = "<b><span style='text-decoration: underline'>ERROR:</span></b> <br/> La fecha del documento no puede ser superior a 3 días de la fecha actual";
|
|
|
|
Calendario.EndDate = NowADS().AddDays(3);
|
|
|
|
// Equivalente a: If DdlTipoMovto.SelectedValue.Contiene("1", "16") Then
|
|
// Suponiendo que "Contiene" verifique si SelectedValue es "1" o "16"
|
|
if (DdlTipoTransaccion.SelectedValue == "1" || DdlTipoTransaccion.SelectedValue == "16")
|
|
{
|
|
// cheques, 3 meses
|
|
RVTxtFechaDocumento.MaximumValue = NowADS().AddMonths(3).ToShortDateString();
|
|
RVTxtFechaDocumento.ErrorMessage = "<b><span style='text-decoration: underline'>ERROR:</span></b> <br/> La fecha del documento no puede ser superior a 3 meses de la fecha actual";
|
|
Calendario.EndDate = NowADS().AddMonths(3);
|
|
}
|
|
|
|
// transfer, 3 semanas
|
|
if (DdlTipoTransaccion.SelectedValue == "2")
|
|
{
|
|
RVTxtFechaDocumento.MaximumValue = NowADS().AddDays(21).ToShortDateString();
|
|
RVTxtFechaDocumento.ErrorMessage = "<b><span style='text-decoration: underline'>ERROR:</span></b> <br/> La fecha del documento no puede ser superior a 3 semanas de la fecha actual";
|
|
Calendario.EndDate = NowADS().AddDays(21);
|
|
}
|
|
|
|
UpMovDeudor.Update();
|
|
//UpGuardar.Update();
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
} |