Example #1
0
        async void FechaFin_Focused(object sender, Xamarin.Forms.FocusEventArgs e)
        {
#if __IOS__
            DependencyService.Get <IForceKeyboardDismissalService>().DismissKeyboard();
#endif
            var result = await UserDialogs.Instance.DatePromptAsync(new DatePromptConfig
            {
                IsCancellable = true,
                MinimumDate   = DateTime.Now.AddDays(0),
                CancelText    = "CANCELAR",
                Title         = "Salida"
            });


            if (result.Ok)
            {
                FechaFinal.Text = String.Format("{0:dd/MM/yyyy}", result.SelectedDate);
                FechaFinal.Unfocus();
                DependencyService.Get <IForceKeyboardDismissalService>().DismissKeyboard();
            }
            else
            {
                FechaFinal.Unfocus();
                DependencyService.Get <IForceKeyboardDismissalService>().DismissKeyboard();
            }
        }
Example #2
0
        public bool Modificar()
        {
            ConexionDb conexion = new ConexionDb();

            return(conexion.EjecutarDB("Update Semestres set Codigo = " + Codigo + "', FechaInicio ='" + FechaInicio.ToString("dd/MM//yyyy") + "', FechaInicio ='" + FechaFin.ToString("dd/MM//yyyy") + "', FechaParcial1 ='" + FechaParcial1.ToString("dd/MM//yyyy") + "', FechaParcial2 ='" + FechaParcial2.ToString("dd/MM//yyyy") + "', FechaFinal ='" + FechaFinal.ToString("dd/MM//yyyy") + "' where IdEstudiante= " + IdSemestre));
        }
Example #3
0
        public bool Insertar()
        {
            ConexionDb conexion = new ConexionDb();
            bool       paso     = false;

            paso = conexion.EjecutarDB("Insert into Semestres (Codigo, FechaInicio, FechaFin, FechaParcial1, FechaParcial2, FechaFinal, esActivo) Values ('" + Codigo + "', '" + FechaInicio.ToString("MM/dd/yyyy") + "', '" + FechaFin.ToString("MM/dd/yyyy") + "', '" + FechaParcial1.ToString("MM/dd/yyyy") +
                                       "','" + FechaParcial2.ToString("MM/dd/yyyy") + "', '" + FechaFinal.ToString("MM/dd/yyyy") + "' , '" + esActivo + "' )");

            if (paso)
            {
                IdSemestre = (int)conexion.ObtenerValorDb("Select Max(IdSemestre) from Semestres");
            }
            return(paso);
        }
Example #4
0
        private void FechaIncioSelected(object sender, EventArgs e)
        {
            DateTimePicker dtp = (DateTimePicker)sender;

            FechaInicio  = Convert.ToDateTime(dtp.Text);
            FechaFinal   = FechaFinal != DateTime.MinValue ? FechaFinal : DateTime.Now;
            CurrentQuery = string.Format("WHERE rd.FechaRenta between '{0}' and '{1}' or rd.FechaDevolucion between '{0}' and '{1}'", FechaInicio.ToString("yyyy-MM-dd"), FechaFinal.ToString("yyyy-MM-dd"));
            SuccessFunction();
        }
Example #5
0
 public decimal CalcularMulta() => FechaFinal.Subtract(DateTime.Now).TotalDays < (FechaFinal.Subtract(FechaInicio).TotalDays / 2) ? Monto : (Monto * 2);
        public async void Search()
        {
            try
            {
                if (Customer == null)
                {
                    await dialogService.ShowMessage("Validacion",
                                                    "Debes seleccionar un cliente antes de ejecutar la busqueda.");

                    return;
                }

                CashHeaders.Clear();
                TotalLineas = 0;

                if (FiltroFechas || FiltroPeriodo)
                {
                    HayFiltro = true;
                }

                if (HayFiltro)
                {
                    if (FiltroFechas && FiltroPeriodo)
                    {
                        await dialogService.ShowMessage("Validacion",
                                                        "No es posible filtrar por rango de fechas y periodo a la vez.");

                        return;
                    }


                    //Si se filtro x rango de fechas...

                    if (FiltroFechas == true && FiltroPeriodo == false)
                    {
                        var pagosxfecha = dataService
                                          .Get <CashHeader>(true)
                                          .Where(s => s.CustId == Customer.CustId && Convert.ToDateTime(s.TranDate.ToString("yyyy/MM/dd")) >= Convert.ToDateTime(FechaInicial.ToString("yyyy/MM/dd")) && Convert.ToDateTime(s.TranDate.ToString("yyyy/MM/dd")) <= Convert.ToDateTime(FechaFinal.ToString("yyyy/MM/dd")))
                                          .ToList();

                        if (pagosxfecha == null || pagosxfecha.Count == 0)

                        {
                            await dialogService.ShowMessage("Informacion", "El cliente, no registra pagos en el rango de fechas seleccionado.");

                            return;
                        }

                        CashHeaders = new ObservableCollection <CashHeader>(pagosxfecha);
                        TotalLineas = CashHeaders.Sum(god => god.TranAmt);
                    }


                    //Si se filtro x periodo...

                    if (FiltroPeriodo == true && FiltroFechas == false)
                    {
                        if (Calendar == null)
                        {
                            await dialogService.ShowMessage("Informacion", "Debes seleccionar un periodo.");

                            return;
                        }


                        var pagosxperiodo = dataService
                                            .Get <CashHeader>(true)
                                            .Where(s => s.CustId == Customer.CustId && Convert.ToDateTime(s.TranDate.ToString("yyyy/MM/dd")) >= Convert.ToDateTime(Calendar.StartDate.ToString("yyyy/MM/dd")) && Convert.ToDateTime(s.TranDate.ToString("yyyy/MM/dd")) <= Convert.ToDateTime(Calendar.EndDate.ToString("yyyy/MM/dd")))
                                            .ToList();


                        if (pagosxperiodo == null || pagosxperiodo.Count == 0)

                        {
                            await dialogService.ShowMessage("Informacion", "El cliente, no registra pagos en el periodo seleccionado.");

                            return;
                        }

                        CashHeaders = new ObservableCollection <CashHeader>(pagosxperiodo);

                        TotalLineas = CashHeaders.Sum(god => god.TranAmt);
                    }
                }

                var pagos = dataService
                            .Get <CashHeader>(true)
                            .Where(s => s.CustId == Customer.CustId)
                            .ToList();

                if (pagos == null || pagos.Count == 0)

                {
                    await dialogService.ShowMessage("Informacion", "El cliente, no registra pagos.");

                    return;
                }

                CashHeaders = new ObservableCollection <CashHeader>(pagos);
                TotalLineas = CashHeaders.Sum(god => god.TranAmt);
            }

            catch (Exception ex)
            {
                await dialogService.ShowMessage("Error", ex.Message);
            }
        }
Example #7
0
        public async void Search()
        {
            try
            {
                if (Customer == null)
                {
                    await dialogService.ShowMessage("Validacion",
                                                    "Debes seleccionar un cliente antes de ejecutar la busqueda.");

                    return;
                }

                InvoiceHeaders.Clear();
                TotalLineas = 0;

                if (FiltroFechas || FiltroPeriodo || FacturaConSaldo)
                {
                    HayFiltro = true;
                }

                if (HayFiltro)
                {
                    if (FiltroFechas && FiltroPeriodo)
                    {
                        await dialogService.ShowMessage("Validacion",
                                                        "No es posible filtrar por rango de fechas y periodo a la vez.");

                        return;
                    }

                    //filtro x fact saldo
                    if (FacturaConSaldo == true && FiltroPeriodo == false && FiltroFechas == false)
                    {
                        var facturasconsaldo = dataService
                                               .Get <InvoiceHeader>(true)
                                               .Where(s => s.CustNum == Customer.CustNum && s.InvoiceBal > 0)
                                               .ToList();


                        if (facturasconsaldo == null || facturasconsaldo.Count == 0)

                        {
                            await dialogService.ShowMessage("Informacion", "El cliente, no registra facturas con saldo.");

                            return;
                        }

                        InvoiceHeaders  = new ObservableCollection <InvoiceHeader>(facturasconsaldo);
                        TotalLineas     = InvoiceHeaders.Sum(god => god.InvoiceAmt);
                        TotalSaldo      = InvoiceHeaders.Sum(god => god.InvoiceBal);
                        MontoMenosSaldo = (TotalLineas - TotalSaldo);
                    }

                    //filtro x fechas
                    if (FiltroFechas == true && FiltroPeriodo == false && FacturaConSaldo == false)
                    {
                        var invoicesxfechas = dataService
                                              .Get <InvoiceHeader>(true)
                                              .Where(s => s.CustNum == Customer.CustNum && Convert.ToDateTime(s.InvoiceDate.ToString("yyyy/MM/dd")) >= Convert.ToDateTime(FechaInicial.ToString("yyyy/MM/dd")) && Convert.ToDateTime(s.InvoiceDate.ToString("yyyy/MM/dd")) <= Convert.ToDateTime(FechaFinal.ToString("yyyy/MM/dd")))
                                              .ToList();

                        if (invoicesxfechas == null || invoicesxfechas.Count == 0)

                        {
                            await dialogService.ShowMessage("Informacion", "El cliente, no registra facturas en el rango de fechas seleccionado.");

                            return;
                        }

                        InvoiceHeaders  = new ObservableCollection <InvoiceHeader>(invoicesxfechas);
                        TotalLineas     = InvoiceHeaders.Sum(god => god.InvoiceAmt);
                        TotalSaldo      = InvoiceHeaders.Sum(god => god.InvoiceBal);
                        MontoMenosSaldo = (TotalLineas - TotalSaldo);
                    }

                    //filtro x fechas y fact. con saldo
                    if (FiltroFechas == true && FacturaConSaldo == true && FiltroPeriodo == false)
                    {
                        var invoicesxfechas = dataService
                                              .Get <InvoiceHeader>(true)
                                              .Where(s => s.CustNum == Customer.CustNum && Convert.ToDateTime(s.InvoiceDate.ToString("yyyy/MM/dd")) >= Convert.ToDateTime(FechaInicial.ToString("yyyy/MM/dd")) && Convert.ToDateTime(s.InvoiceDate.ToString("yyyy/MM/dd")) <= Convert.ToDateTime(FechaFinal.ToString("yyyy/MM/dd")) && s.InvoiceBal > 0)
                                              .ToList();

                        if (invoicesxfechas == null || invoicesxfechas.Count == 0)

                        {
                            await dialogService.ShowMessage("Informacion", "El cliente, no registra facturas con saldo en el rango de fechas seleccionado.");

                            return;
                        }

                        InvoiceHeaders  = new ObservableCollection <InvoiceHeader>(invoicesxfechas);
                        TotalLineas     = InvoiceHeaders.Sum(god => god.InvoiceAmt);
                        TotalSaldo      = InvoiceHeaders.Sum(god => god.InvoiceBal);
                        MontoMenosSaldo = (TotalLineas - TotalSaldo);
                    }

                    //filtro x periodo
                    if (FiltroPeriodo == true && FiltroFechas == false && FacturaConSaldo == false)
                    {
                        if (Calendar == null)
                        {
                            await dialogService.ShowMessage("Informacion", "Debes seleccionar un periodo.");

                            return;
                        }


                        var facturasxperiodo = dataService
                                               .Get <InvoiceHeader>(true)
                                               .Where(s => s.CustNum == Customer.CustNum && Convert.ToDateTime(s.InvoiceDate.ToString("yyyy/MM/dd")) >= Convert.ToDateTime(Calendar.StartDate.ToString("yyyy/MM/dd")) && Convert.ToDateTime(s.InvoiceDate.ToString("yyyy/MM/dd")) <= Convert.ToDateTime(Calendar.EndDate.ToString("yyyy/MM/dd")))
                                               .ToList();

                        if (facturasxperiodo == null || facturasxperiodo.Count == 0)

                        {
                            await dialogService.ShowMessage("Informacion", "El cliente, no registra facturas en el periodo seleccionado.");

                            return;
                        }

                        InvoiceHeaders  = new ObservableCollection <InvoiceHeader>(facturasxperiodo);
                        TotalLineas     = InvoiceHeaders.Sum(god => god.InvoiceAmt);
                        TotalSaldo      = InvoiceHeaders.Sum(god => god.InvoiceBal);
                        MontoMenosSaldo = (TotalLineas - TotalSaldo);
                    }

                    //filtro x periodo y fact. con saldo
                    if (FiltroPeriodo == true && FacturaConSaldo == true && FiltroFechas == false)
                    {
                        if (Calendar == null)
                        {
                            await dialogService.ShowMessage("Informacion", "Debes seleccionar un periodo.");

                            return;
                        }


                        var facturasxpreiodo = dataService
                                               .Get <InvoiceHeader>(true)
                                               .Where(s => s.CustNum == Customer.CustNum && Convert.ToDateTime(s.InvoiceDate.ToString("yyyy/MM/dd")) >= Convert.ToDateTime(Calendar.StartDate.ToString("yyyy/MM/dd")) && Convert.ToDateTime(s.InvoiceDate.ToString("yyyy/MM/dd")) <= Convert.ToDateTime(Calendar.EndDate.ToString("yyyy/MM/dd")))
                                               .ToList();

                        if (facturasxpreiodo == null || facturasxpreiodo.Count == 0)

                        {
                            await dialogService.ShowMessage("Informacion", "El cliente, no registra facturas en el periodo seleccionado.");

                            return;
                        }

                        InvoiceHeaders  = new ObservableCollection <InvoiceHeader>(facturasxpreiodo);
                        TotalLineas     = InvoiceHeaders.Sum(god => god.InvoiceAmt);
                        TotalSaldo      = InvoiceHeaders.Sum(god => god.InvoiceBal);
                        MontoMenosSaldo = (TotalLineas - TotalSaldo);
                    }
                }

                else

                {
                    var facturas = dataService
                                   .Get <InvoiceHeader>(true)
                                   .Where(s => s.CustNum == Customer.CustNum)
                                   .ToList();

                    if (facturas == null || facturas.Count == 0)

                    {
                        await dialogService.ShowMessage("Informacion", "El cliente, no registra facturas.");

                        return;
                    }

                    InvoiceHeaders  = new ObservableCollection <InvoiceHeader>(facturas);
                    TotalLineas     = InvoiceHeaders.Sum(god => god.InvoiceAmt);
                    TotalSaldo      = InvoiceHeaders.Sum(god => god.InvoiceBal);
                    MontoMenosSaldo = (TotalLineas - TotalSaldo);
                }

                await navigationService.Navigate("InvoicesListPage");
            }

            catch (Exception ex)
            {
                await dialogService.ShowMessage("Error", ex.Message);
            }
        }
 public bool Modificar()
 {
     return(conexion.EjecutarDB("Update Semestres set Codigo = " + Codigo.ToDbString() + ", FechaInicio = " + FechaInicio.ToDbString() + ", FechaFin = " + FechaFin.ToDbString() + ", FechaParcial1 = " + FechaParcial1.ToDbString() + ", FechaParcial2 = " + FechaParcial2.ToDbString() + ", FechaFinal = " + FechaFinal.ToDbString() + ", Activo = " + Activo.ToDbString() + " where IdSemestre = " + IdSemestre));
 }
        public bool Insertar()
        {
            bool paso = conexion.EjecutarDB("insert into Semestres(Codigo, FechaInicio, FechaFin, FechaParcial1, FechaParcial2, FechaFinal, Activo) values(" + Codigo.ToDbString() + "," + FechaInicio.ToDbString() + "," + FechaFin.ToDbString() + "," + FechaParcial1.ToDbString() + "," + FechaParcial2.ToDbString() + "," + FechaFinal.ToDbString() + "," + Activo.ToDbString() + ")");

            if (paso)
            {
                this.IdSemestre = (int)conexion.ObtenerValorDb("select MAX(IdSemestre) from Semestres");
            }
            return(paso);
        }