930 lines
42 KiB
C#
930 lines
42 KiB
C#
using Extensiones;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Text;
|
|
using System.Web;
|
|
using System.Web.UI.WebControls;
|
|
using static Extensiones.ModExtensiones;
|
|
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
|
|
|
public partial class Bancos_PagoAcreedor : ClsPaginas
|
|
{
|
|
|
|
#region "PROPIEDADES"
|
|
|
|
private int CveMonedaCuentaPago
|
|
{
|
|
get
|
|
{
|
|
return ViewState["CveMonedaCuentaPago"].ToEntero();
|
|
}
|
|
|
|
set
|
|
{
|
|
ViewState["CveMonedaCuentaPago"] = value;
|
|
}
|
|
}
|
|
private DataTable DtDatos
|
|
{
|
|
get { return DtDatos = (DataTable)ViewState["DtDatos"]; }
|
|
set { ViewState["DtDatos"] = value; }
|
|
}
|
|
|
|
#endregion
|
|
|
|
protected void Page_Load(object sender, EventArgs e)
|
|
{
|
|
if (!IsPostBack)
|
|
{
|
|
CveMonedaCuentaPago = 0;
|
|
rowComisiones.Visible = true;
|
|
|
|
CargaTipoTransaccion();
|
|
CargaCuentas();
|
|
CargaProveedores();
|
|
CargaReporte();
|
|
CargaSubproyectos();
|
|
TxtFechaDocumento.Text = NowADS().ToShortDateString();
|
|
TxtFechaPrestamo.Text = NowADS().ToShortDateString();
|
|
txtFechaI.Text = NowADS().FirstDayOfMonth().ToShortDateString();
|
|
txtFechaF.Text = NowADS().ToShortDateString();
|
|
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.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Egs' AND Estatus = 1");
|
|
DdlTipoTransanccionPrestamo.DataSource = GlobalDTTipoTransacciones.FiltraParametros("Tipo='Ing' AND Estatus = 1 ");
|
|
|
|
DdlTipoTransaccion.DataBind();
|
|
DdlTipoTransanccionPrestamo.DataBind();
|
|
|
|
DdlTipoTransaccion.Items.Insert(0, new ListItem("Seleccione Tipo Movimiento", "-1"));
|
|
DdlTipoTransanccionPrestamo.Items.Insert(0, new ListItem("Seleccione Tipo Movimiento", "-1"));
|
|
}
|
|
|
|
protected void CargaCuentas()
|
|
{
|
|
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");
|
|
}
|
|
#endregion
|
|
|
|
#region "PAGO ACREEDORES"
|
|
protected void DdlCuenta_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
DataRow dr = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa: UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta = {0}", DdlCuenta.SelectedValue));
|
|
CveMonedaCuentaPago = 0;
|
|
if (dr != null)
|
|
{
|
|
CveMonedaCuentaPago = dr["CveMoneda"].ToString().ToEntero();
|
|
}
|
|
|
|
if (CveMonedaCuentaPago != 1)
|
|
{
|
|
divTCPago.Visible = true;
|
|
TxtTCPago.Text = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDate()).ToString();
|
|
}
|
|
else if (DtDatos != null)
|
|
{
|
|
if (DtDatos.FiltraParametros("CveIE > 0 AND Saldo > 0 AND CveMoneda = 2", "").Rows.Count > 0)
|
|
{
|
|
divTCPago.Visible = true;
|
|
TxtTCPago.Text = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDate()).ToString();
|
|
}
|
|
}
|
|
else
|
|
{
|
|
divTCPago.Visible = false;
|
|
TxtTCPago.Text = "1";
|
|
}
|
|
|
|
long Folio;
|
|
ClsBancos bancos = new ClsBancos();
|
|
Folio = bancos.GetNextFolio(DdlCuenta.SelectedValue.ToEntero(), DdlTipoTransaccion.SelectedValue.ToEntero());
|
|
bancos.Dispose();
|
|
TxtFolio.Text = Folio.ToString();
|
|
|
|
|
|
TxtDDImporte.Attributes.Add("onblur", $"validaDeudoresDiversos({CveMonedaCuentaPago});FormatoMoneda(this);");
|
|
UpDatos.Update();
|
|
}
|
|
|
|
protected void DdlProveedores_selectedindexchange(object sender, EventArgs e)
|
|
{
|
|
if (DdlProveedores.SelectedValue.ToEntero() > 0)
|
|
{
|
|
ClsMovimientos ObjMov = new ClsMovimientos();
|
|
if (ObjMov.GetIngresosAcreedorXSaldar(DdlProveedores.SelectedValue.ToEntero(), -1, UsuarioActual.CveEmpresa))
|
|
{
|
|
GvMovAcreedor.DataSource = ObjMov.DtResultados.FiltraParametros("CveIE > 0 AND Saldo > 0 ", "");
|
|
DtDatos = ObjMov.DtResultados.FiltraParametros("CveIE > 0 AND Saldo > 0", "");
|
|
if (DtDatos.FiltraParametros("CveIE > 0 AND Saldo > 0 AND CveMoneda = 2", "").Rows.Count > 0)
|
|
{
|
|
divTCPago.Visible = true;
|
|
TxtTCPago.Text = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDate()).ToString();
|
|
}
|
|
}
|
|
ObjMov.Dispose();
|
|
}
|
|
else
|
|
{
|
|
GvMovAcreedor.DataSource = null;
|
|
}
|
|
|
|
GvMovAcreedor.DataBind();
|
|
//foreach (GridViewRow Gvr in GvMovAcreedor.Rows)
|
|
//{
|
|
// Gvr.FCTextBox("TxtCveMoneda").Visible = false;
|
|
//}
|
|
UpMovAcreedor.Update();
|
|
|
|
}
|
|
|
|
protected void GvMovAcreedor_RowDataBound(object sender, GridViewRowEventArgs e)
|
|
{
|
|
if (e.Row.RowType == DataControlRowType.DataRow)
|
|
{
|
|
e.Row.FCCheckBox("Chk").Attributes.Add("onclick", String.Format("FnSuma(this,{0},{1},{2});", e.Row.FCTextBox("TxtAbonar").ClientID, e.Row.DBCampo("Saldo"), CveMonedaCuentaPago));
|
|
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", CveMonedaCuentaPago));
|
|
e.Row.FCTextBox("TxtComision").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", CveMonedaCuentaPago));
|
|
}
|
|
}
|
|
|
|
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 CveConceptoContablePago = 42;
|
|
int CveConceptoContablePrestamoComplementario = 351;
|
|
int CvePlantillaPoliza = 43;
|
|
int CvePrePoliza = 0;
|
|
int CveMonedaPago = get_GlobalDTBancosCuentas(-1, CveEmpresa: UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMoneda", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveCuenta = {DdlCuenta.SelectedValue.ToEntero()}").ToEntero();
|
|
int FolioFijo = 0;
|
|
//int IDPoliza = 0;
|
|
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;
|
|
}
|
|
|
|
// asigna a propiedades las cuentas del acreedor
|
|
AsignaCuentaProveedor(DdlProveedores.SelectedValue.ToEntero());
|
|
|
|
// DATOS PREPOLIZA
|
|
if (DdlTipoTransaccion.SelectedValue == "1" && UsuarioActual.CveEmpresa != 119) FolioFijo = TxtFolio.Text.ToEntero();
|
|
|
|
CvePrePoliza = ObjMov.AddPrePolizas("PAGO ACREEDORES", CvePlantillaPoliza, TxtImporte.Text.Trim().ToDouble(), TxtImporte.Text.Trim().ToDouble(), CveMonedaPago, 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)
|
|
{
|
|
decimal ImporteBanco = TxtImporte.Text.ToDecimal();
|
|
decimal ImporteMNBanco = ImporteBanco;
|
|
decimal ImporteComplementaria = 0;
|
|
decimal TCPago = TxtTCPago.Text.ToDecimal();
|
|
string Conc = TxtObservaciones.Text == "" ? TxtFolio.Text : TxtObservaciones.Text;
|
|
string Ref = TxtObservaciones.Text == "" ? TxtFolio.Text : TxtObservaciones.Text;
|
|
|
|
CveIE = ObjIE.AddBancos_IE(DdlCuenta.SelectedValue.ToEntero(), DdlTipoTransaccion.SelectedValue.ToEntero(), TxtFechaDocumento.Text.Trim().ToDate(), TxtFolio.Text.Trim(), DdlProveedores.SelectedText.ToString(), ImporteBanco.ToString().ToDouble(), CveMonedaPago,
|
|
TCPago.ToString().ToDouble(), TxtObservaciones.Text.Trim(), "", ChkAbonoCuenta.Checked, false, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
|
|
|
|
if (CveIE > 0)
|
|
{
|
|
decimal Importe;
|
|
decimal ImporteMN;
|
|
decimal ImporteComision;
|
|
decimal ImporteComisionMN;
|
|
decimal AcumImporteMN = 0;
|
|
decimal ImporteBancosMN, ImporteAcreedorMN;
|
|
bool TipoMovtoComision = false;
|
|
int CveConceptoDiferenciaCambiaria = 0;
|
|
|
|
//GUARDA PREPOLIZAS DETALLE
|
|
foreach (GridViewRow gvr in GvMovAcreedor.Rows)
|
|
{
|
|
Importe = gvr.FCTextBox("TxtAbonar").Text.ToDecimal();
|
|
ImporteComision = gvr.FCTextBox("TxtComision").Text.ToDecimal();
|
|
ImporteMN = Importe;
|
|
ImporteAcreedorMN = Importe;
|
|
ImporteBancosMN = Importe;
|
|
ImporteComisionMN = ImporteComision;
|
|
ImporteComplementaria = 0;
|
|
|
|
if (gvr.FCTextBox("TxtComision").Text.ToDecimal() < 0)
|
|
{
|
|
TipoMovtoComision = true;
|
|
ImporteComision = ImporteComision * -1;
|
|
ImporteComisionMN = ImporteComisionMN * -1;
|
|
}
|
|
else
|
|
{
|
|
TipoMovtoComision = false;
|
|
}
|
|
|
|
if (gvr.FCCheckBox("Chk").Checked)
|
|
{
|
|
Decimal TC = gvr.DataKey("TipoCambio").ToDecimal();
|
|
int tCveMoneda = gvr.DataKey("CveMoneda").ToEntero();
|
|
//Verifica Fluctuación mensual
|
|
if (tCveMoneda > 1 && gvr.DataKey("FechaDocumento").ToDate() < TxtFechaDocumento.Text.ToDate().FirstDayOfMonth())
|
|
{
|
|
TC = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDate().AddMonths(-1).LastDayOfMonth()).ToDecimal();//obtengo el TC del mes anterior del pago
|
|
CveConceptoContablePago = 384;
|
|
}
|
|
ImporteBancosMN = (Importe * TCPago).RoundSQL();
|
|
ImporteAcreedorMN = (Importe * TC).RoundSQL();
|
|
|
|
if (CveMonedaPago == 1 && tCveMoneda == 1)
|
|
{
|
|
//ImporteMN = Importe;
|
|
//ImporteComisionMN = ImporteComision;
|
|
}
|
|
else if (CveMonedaPago == 1 && tCveMoneda == 2)
|
|
{
|
|
//ImporteComisionMN = ImporteComision;
|
|
|
|
//ImporteMN = Importe;
|
|
//ImporteComplementaria = (Importe * TC - Importe).RoundSQL();
|
|
}
|
|
else if (CveMonedaPago == 2 && tCveMoneda == 1)
|
|
{
|
|
ImporteBancosMN = Importe;
|
|
ImporteMN = Importe;
|
|
//ImporteComisionMN = ImporteComision;
|
|
//ImporteComplementaria = 0;
|
|
}
|
|
else if (CveMonedaPago == 2 && tCveMoneda == 2)
|
|
{
|
|
|
|
//ImporteComisionMN = ImporteComision;
|
|
//ImporteMN = Importe;
|
|
//ImporteComplementaria = (Importe * TC - Importe).RoundSQL();
|
|
}
|
|
|
|
//ImporteMN = ImporteMN.RoundSQL();
|
|
//ImporteComplementaria = ImporteComplementaria.RoundSQL();
|
|
ImporteComisionMN = ImporteComisionMN.RoundSQL();
|
|
ImporteComision = ImporteComision.RoundSQL();
|
|
AcumImporteMN += ImporteMN;
|
|
|
|
if (tCveMoneda > 1 ) { CveConceptoContablePago = 384; }
|
|
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, Importe, ImporteMN, CveConceptoContablePago, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), TipoCambio: TC, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de pago acreedor";
|
|
break;
|
|
}
|
|
|
|
if (tCveMoneda > 1 && MsgError == "")
|
|
{
|
|
ImporteComplementaria = (Importe * TC - Importe).RoundSQL();
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, Importe, ImporteComplementaria, CveConceptoContablePrestamoComplementario, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), ImporteME: Importe, TipoCambio: TC, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
|
MsgError = "No se pudo insertar concepto de acreedor complementaria";
|
|
}
|
|
|
|
if (ImporteBancosMN != ImporteAcreedorMN && MsgError == "")
|
|
{
|
|
bool TipoMovto = false;
|
|
if (TCPago > TC)
|
|
{
|
|
CveConceptoDiferenciaCambiaria = 65;
|
|
TipoMovto = false;
|
|
}
|
|
else if (TCPago < TC)
|
|
{
|
|
CveConceptoDiferenciaCambiaria = 64;
|
|
TipoMovto = true;
|
|
}
|
|
Importe = ((Importe * TCPago) - (Importe * TC)).Abs();
|
|
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovto, Importe, Importe, CveConceptoDiferenciaCambiaria, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteME: Importe, CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), TipoCambio: TC, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero()))
|
|
MsgError = "No se pudo insertar concepto de diferencia cambiaria";
|
|
}
|
|
|
|
if (ImporteComision != 0 && MsgError == "" && DdlOtrosPagos.SelectedValue == "2")
|
|
{
|
|
|
|
ImporteComisionMN = (ImporteComision * TCPago).RoundSQL();
|
|
int tTipoConceptoOtro = 255;
|
|
|
|
//if (DdlOtrosPagos.SelectedValue == "3") tTipoConceptoOtro = 43; //deudores diversos
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoComision, ImporteComision, ImporteComisionMN, tTipoConceptoOtro, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), CveIEDevolucion: gvr.DataKey("CveIE").ToEntero(), TipoCambio: TC, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de pago acreedor";
|
|
break;
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
if (TxtDDImporte.Text.ToDecimal() != 0 && MsgError == "" && DdlOtrosPagos.SelectedValue == "3")
|
|
{
|
|
ImporteComision = TxtDDImporte.Text.ToDecimal();
|
|
ImporteComisionMN = ImporteComision;
|
|
|
|
if (TxtDDImporte.Text.ToDecimal() < 0)
|
|
{
|
|
TipoMovtoComision = true;
|
|
ImporteComision = ImporteComision * -1;
|
|
ImporteComisionMN = ImporteComisionMN * -1;
|
|
}
|
|
else
|
|
{
|
|
TipoMovtoComision = false;
|
|
}
|
|
|
|
//Decimal TC = get_GlobalTipoCambio(TxtFechaDocumento.Text.ToDate()).ToDecimal();
|
|
//int tCveMoneda = get_GlobalDTBancosCuentas(-1, DdlCuenta.SelectedValue.ToEntero()).FiltroPrimeroValor("CveMoneda").ToEntero();
|
|
//CveMonedaPago
|
|
|
|
ImporteComision = ImporteComision.RoundSQL();
|
|
ImporteComisionMN = (ImporteComision * TCPago).RoundSQL();
|
|
|
|
ImporteComisionMN = (ImporteComision * TCPago).RoundSQL();
|
|
|
|
|
|
int tTipoConceptoOtro = 43; //deudores diversos
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, TipoMovtoComision, ImporteComision, ImporteComisionMN, tTipoConceptoOtro, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), TipoCambio: TCPago, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de pago acreedor";
|
|
}
|
|
}
|
|
|
|
if (CveMonedaPago != 1)
|
|
{
|
|
ImporteComplementaria = (ImporteBanco * TCPago - ImporteBanco).RoundSQL();
|
|
}
|
|
|
|
if (MsgError == "" && !ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, ImporteBanco, ImporteBanco, 30, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteME: ImporteBanco, TipoCambio: TCPago, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero())) MsgError = "No se pudo insertar concepto de bancos";
|
|
|
|
//movimiento de ajuste por sino se aplicó en el proceso anterior
|
|
if (MsgError == "" && CveMonedaPago != 1)
|
|
{
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, ImporteBanco, ImporteComplementaria, 204, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedores.SelectedValue.ToEntero(), ImporteME: ImporteBanco, TipoCambio: TCPago, TipoCambioPago: TCPago, CveSubProyecto: DdlSubProyectoPago.SelectedValue.ToEntero())) MsgError = "No se pudo insertar concepto de bancos complementaria";
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
MsgError = "No se insertó movimiento bancario";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MsgError = "No se pudo insertar la póliza";
|
|
}
|
|
|
|
//VALIDA QUE CUADRE LA PREPOLIZA
|
|
Usuario UA = UsuarioActual;
|
|
if (MsgError == "" && ObjMov.ValidacionesPrePoliza(CvePrePoliza, ref UA, Opcion: 5))
|
|
{
|
|
if (ObjMov.ValorPolizaDescuadre > 0)
|
|
{
|
|
MsgError = ObjMov.MensajePolizaDescuadre;
|
|
ModExtensiones.GuardaLogAD($"Bancos/IE PAGO ACREEDOR | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas");
|
|
}
|
|
}
|
|
|
|
if (MsgError.Equals(""))
|
|
{
|
|
ObjIE.Commit();
|
|
if (Msg.ToString().Equals(""))
|
|
{
|
|
Msg.AppendFormat("El Documento se guardo correctamente. <br/> Folio <b><a href='/Bancos/IE.aspx?CveIE={0}' target='_blank' class='Texto'>{1}</a></b> <br/>", CveIE, ObjIE.Folio);
|
|
|
|
}
|
|
//GUARDA COMPROBANTE
|
|
if (!filemove.Equals(""))
|
|
{
|
|
filemove.FilesMove(CveIE.ToString(), string.Format(@"{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase: false);
|
|
}
|
|
System.IO.FileInfo archivo = null;
|
|
|
|
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
|
|
{
|
|
ObjIE.RollBack();
|
|
Alert(MsgError, TipoMensaje.MsgError);
|
|
}
|
|
|
|
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 "PRESTAMO ACREEDORES"
|
|
protected void DdlCuentaPrestamo_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
DataRow dr = get_GlobalDTBancosCuentas(UsuarioActual.CveUsuario, CveEmpresa: UsuarioActual.CveEmpresa).FiltroPrimero(String.Format("CveCuenta = {0}", DdlCuentaPrestamo.SelectedValue));
|
|
int tCveMoneda = 0;
|
|
if (dr != null)
|
|
{
|
|
tCveMoneda = dr["CveMoneda"].ToString().ToEntero();
|
|
}
|
|
|
|
if (tCveMoneda != 1)
|
|
{
|
|
divTCPrestamo.Visible = true;
|
|
TxtTCPrestamo.Text = get_GlobalTipoCambio(TxtFechaPrestamo.Text.ToDate()).ToString();
|
|
}
|
|
else
|
|
{
|
|
divTCPrestamo.Visible = false;
|
|
TxtTCPrestamo.Text = "1";
|
|
}
|
|
|
|
long Folio;
|
|
ClsBancos bancos = new ClsBancos();
|
|
Folio = bancos.GetNextFolio(DdlCuentaPrestamo.SelectedValue.ToEntero(), DdlTipoTransanccionPrestamo.SelectedValue.ToEntero());
|
|
bancos.Dispose();
|
|
TxtFolioPrestamo.Text = Folio.ToString();
|
|
// si la moneda no es peso, se pone tc
|
|
}
|
|
|
|
protected void DdlProveedorPrestamo_selectedindexchange(object sender, EventArgs e)
|
|
{
|
|
|
|
}
|
|
|
|
private void AsignaCuentaProveedor(int CveProveedor)
|
|
{
|
|
|
|
}
|
|
|
|
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 = 41;
|
|
int CveConceptoContableBancoComplementario = 204;
|
|
int CveConceptoContablePrestamoComplementario = 351;
|
|
int CvePlantillaPoliza = 44;
|
|
int CvePrePoliza = 0;
|
|
int CveMoneda = get_GlobalDTBancosCuentas(-1, CveEmpresa: UsuarioActual.CveEmpresa).FiltroPrimeroValor("CveMoneda", $"CveEmpresa = {UsuarioActual.CveEmpresa} AND CveCuenta = {DdlCuentaPrestamo.SelectedValue.ToEntero()}").ToEntero();
|
|
int FolioFijo = 0;
|
|
//int IDPoliza = 0;
|
|
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;
|
|
}
|
|
// asigna a propiedades las cuentas del acreedor
|
|
AsignaCuentaProveedor(DdlProveedorPrestamo.SelectedValue.ToEntero());
|
|
|
|
// DATOS PREPOLIZA
|
|
if ((DdlTipoTransanccionPrestamo.SelectedValue == "1"))
|
|
FolioFijo = TxtFolioPrestamo.Text.ToEntero();
|
|
CvePrePoliza = ObjMov.AddPrePolizas("PRESTAMO ACRREDORES", CvePlantillaPoliza, TxtImportePrestamo.Text.Trim().ToDouble(), TxtImportePrestamo.Text.Trim().ToDouble(), CveMoneda, TxtFechaPrestamo.Text.ToDate(), DdlProveedorPrestamo.SelectedText.ToString(), UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa, FolioFijo: FolioFijo, ReglaFolioPoliza: ObjComp.ObtenerReglaFolio(DdlTipoTransaccion.SelectedValue, null, UsuarioActual.CveEmpresa), CveTipoPoliza: ObjMov.ObtenerTipoPoliza(DdlTipoTransanccionPrestamo.SelectedValue, "-1", UsuarioActual.CveEmpresa));
|
|
|
|
if (CvePrePoliza > 0)
|
|
{
|
|
decimal Importe = TxtImportePrestamo.Text.ToDecimal();
|
|
decimal ImporteMN = Importe;
|
|
decimal ImporteComplementaria = 0;
|
|
decimal TC = TxtTCPrestamo.Text.ToDecimal();
|
|
string Conc = TxtObservacionesPrestamo.Text == "" ? TxtFolioPrestamo.Text : TxtObservacionesPrestamo.Text;
|
|
string Ref = TxtObservacionesPrestamo.Text == "" ? TxtFolioPrestamo.Text : TxtObservacionesPrestamo.Text;
|
|
|
|
CveIE = ObjIE.AddBancos_IE(DdlCuentaPrestamo.SelectedValue.ToEntero(), DdlTipoTransanccionPrestamo.SelectedValue.ToEntero(), TxtFechaPrestamo.Text.Trim().ToDate(), TxtFolioPrestamo.Text.Trim(), DdlProveedorPrestamo.SelectedText.ToString(), Importe.ToString().ToDouble(), CveMoneda,
|
|
TC.ToString().ToDouble(), TxtObservacionesPrestamo.Text.Trim(), "", false, false, -1, CvePrePoliza, Comprobante, UsuarioActual.CveUsuario, UsuarioActual.CveEmpresa);
|
|
|
|
if (CveMoneda != 1)
|
|
{
|
|
ImporteMN = Importe;
|
|
ImporteComplementaria = Importe * TC - Importe;
|
|
}
|
|
|
|
|
|
|
|
if (CveIE > 0)
|
|
{
|
|
//GUARDA COMPROBANTE
|
|
if (!filemove.Equals(""))
|
|
{
|
|
filemove.FilesMove(CveIE.ToString(), string.Format(@"{0}IE", UsuarioActual.Empresa.Ruta), ConcatenarDirectorioBase: false);
|
|
}
|
|
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, Importe, ImporteMN, CveConceptoContableBanco, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), TipoCambio: TC, TipoCambioPago: TC, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de bancos";
|
|
}
|
|
|
|
if (CveMoneda != 1)
|
|
{
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, ImporteMN, 383, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), TipoCambio: TC, TipoCambioPago: TC, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de acreedor";
|
|
}
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, false, Importe, ImporteComplementaria, CveConceptoContableBancoComplementario, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteME: Importe, TipoCambio: TC, TipoCambioPago: TC, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de bancos complementaria";
|
|
}
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, ImporteComplementaria, CveConceptoContablePrestamoComplementario, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), ImporteME: Importe, TipoCambio: TC, TipoCambioPago: TC, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de acreedor complementaria";
|
|
}
|
|
|
|
}
|
|
else
|
|
{
|
|
if (!ObjMov.AddPrePolizasDetalle(CvePrePoliza, true, Importe, ImporteMN, CveConceptoContablePrestamo, Ref, Conc, CveIE: CveIE, CveProveedor: DdlProveedorPrestamo.SelectedValue.ToEntero(), TipoCambio: TC, TipoCambioPago: TC, CveSubProyecto: DdlSubProyecto.SelectedValue.ToEntero()))
|
|
{
|
|
MsgError = "No se pudo insertar concepto de acreedor";
|
|
}
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MsgError = "No se insertó el encabezado";
|
|
}
|
|
}
|
|
else
|
|
{
|
|
MsgError = "No se pudo insertar la póliza";
|
|
}
|
|
|
|
//VALIDA QUE CUADRE LA POLIZA
|
|
Usuario UA = UsuarioActual;
|
|
if (MsgError == "" && ObjMov.ValidacionesPrePoliza(CvePrePoliza, ref UA, Opcion: 5))
|
|
{
|
|
if (ObjMov.ValorPolizaDescuadre > 0)
|
|
{
|
|
MsgError = ObjMov.MensajePolizaDescuadre;
|
|
ModExtensiones.GuardaLogAD($"Bancos/IE PAGO ACREEDOR | Error:{ObjMov.MensajePolizaDescuadre} Diferencia:{ObjMov.ValorDiferencia} | CvePrePoliza:{CvePrePoliza}", "LogPrePolizas");
|
|
}
|
|
}
|
|
|
|
if (MsgError.Equals(""))
|
|
{
|
|
ObjIE.Commit();
|
|
if (Msg.ToString().Equals(""))
|
|
{
|
|
Msg.Append("El Documento se guardo correctamente.<br/>");
|
|
}
|
|
System.IO.FileInfo archivo = null;
|
|
|
|
if (DdlTipoTransanccionPrestamo.SelectedValue.ToEntero().Contiene(2, 8, 9))
|
|
{
|
|
archivo = new System.IO.FileInfo(String.Format("{0}Formatos/Transferencia.rdlc", UsuarioActual.Empresa.Ruta));
|
|
}
|
|
else if (DdlTipoTransanccionPrestamo.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 (DdlTipoTransanccionPrestamo.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();
|
|
Alert(MsgError, TipoMensaje.MsgError);
|
|
}
|
|
|
|
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"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.GetAcreedoresAuxiliar(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
|
|
|
|
#region"REPORTE"
|
|
protected void CargaReporte()
|
|
{
|
|
|
|
DateTime FInicio = MinFecha;
|
|
DateTime FFin = MaxFecha;
|
|
|
|
if (TxtFechaInicio.Text.Length == 10)
|
|
{
|
|
FInicio = TxtFechaInicio.Text.ToDate();
|
|
}
|
|
|
|
if (TxtFechaFin.Text.Length == 10)
|
|
{
|
|
FFin = TxtFechaFin.Text.ToDate();
|
|
}
|
|
|
|
ClsBancos bancos = new ClsBancos();
|
|
if (bancos.GetAcreedoresReporte(UsuarioActual.CveEmpresa, FInicio, FFin))
|
|
{
|
|
GvReporte.DataSource = bancos.DtResultados;
|
|
GvReporte.DataBind();
|
|
}
|
|
bancos.Dispose();
|
|
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
|
|
|
|
|
|
protected void DdlOtrosPagos_SelectedIndexChanged(object sender, EventArgs e)
|
|
{
|
|
divDD.Visible = false;
|
|
if (DdlOtrosPagos.SelectedValue == "2")
|
|
{
|
|
TxtOtrosImportes.Visible = true;
|
|
TxtTotal.Visible = true;
|
|
GvMovAcreedor.Columns[8].Visible = true;
|
|
TxtOtrosImportes.Text = "";
|
|
TxtTotal.Text = "";
|
|
RegistraScript($"$get('TxtImporte').value = FormatoNumero(SumaValores({CveMonedaCuentaPago}), 2);");
|
|
}
|
|
else
|
|
{
|
|
if (DdlOtrosPagos.SelectedValue == "3")
|
|
{
|
|
TxtDDImporte.Text = "";
|
|
divDD.Visible = true;
|
|
RegistraScript($"$get('TxtImporte').value = FormatoNumero(SumaValores({CveMonedaCuentaPago}), 2);");
|
|
}
|
|
TxtOtrosImportes.Visible = false;
|
|
TxtTotal.Visible = false;
|
|
GvMovAcreedor.Columns[8].Visible = false;
|
|
}
|
|
UpDatos.Update();
|
|
UpMovAcreedor.Update();
|
|
}
|
|
|
|
protected void BtnConsultarReporte_Click(object sender, EventArgs e)
|
|
{
|
|
CargaReporte();
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
}
|
|
|
|
UpDatos.Update();
|
|
//UpGuardar.Update();
|
|
}
|
|
|
|
|
|
|
|
|
|
protected void DdlTipoTransanccionPrestamo_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 (DdlTipoTransanccionPrestamo.SelectedValue == "1" || DdlTipoTransanccionPrestamo.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 (DdlTipoTransanccionPrestamo.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();
|
|
|
|
}
|
|
|
|
}
|