private void rptFinanciamientos_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     var prestamos =
         new EmpeñosDC(new clsConeccionDB().StringConn()).Prestamos.Where(
             finan => finan.Estado == "Vigente").Select(finan => finan);
     DatosInforme.DataSource = prestamos;
 }
        public FrmArticulos()
        {
            InitializeComponent();DataColumn num = new DataColumn
            {
                ColumnName = "Clave",
                DataType = Type.GetType("System.Int32"),
                AutoIncrement = true,
                AutoIncrementSeed = 1,
                AutoIncrementStep = 1,
                ReadOnly = true,
                Unique = true
            };
            _dtprecios.Columns.Add(num);
            _dtprecios.Columns.Add("Tipo", Type.GetType("System.String"));
            _dtprecios.Columns.Add("Contado", Type.GetType("System.Decimal"));
            _dtprecios.Columns.Add("Apartado", Type.GetType("System.Decimal"));
            var precios =
                new EmpeñosDC(new clsConeccionDB().StringConn()).Precios.Select(p => new { p.Tipo, Contado = p.VentaContado, Apartado = p.VentaApartado });

            foreach (var pre in precios)
            {
                _dtprecios.Rows.Add(new object[] {null, pre.Tipo, pre.Contado, pre.Apartado});
            }
            _dtprecios.Rows.Add(new object[] {null, "Varios", 0M, 0M});
            cboTipo.Properties.DataSource = _dtprecios;
            cboTipo.Properties.DisplayMember = "Tipo";
            cboTipo.Properties.ValueMember = "Clave";
        }
 public static bool CajaEstado()
 {
     var caj=new EmpeñosDC(new clsConeccionDB().StringConn()).Cajas.SingleOrDefault(
             c => c.FechaCajaAbierto.Date == DateTime.Today.Date);
     if (caj != null)
         return caj.Estado;
     return true;
 }
        public static decimal SaldoEnCaja()
        {
            EmpeñosDC _entidades = new EmpeñosDC(new clsConeccionDB().StringConn());
            Caja caja = _entidades.Cajas.FirstOrDefault(c => c.FechaCajaAbierto.Date == DateTime.Today.Date);
            if (caja != null)
            {
                decimal cajaInicial =
                    caja.CajaInicial; //(from c in _mapeoCasaEmpenios.Cajas
                //where c.FechaCajaAbierto == DateTime.Today.Date && c.Estado
                //select (decimal?)c.CajaInicial).Sum()??0;
                decimal com = (from c in _entidades.Compras
                               where c.FechaCompra == DateTime.Today.Date && c.Estado == true
                               select (decimal?)c.TotalCompra).Sum() ?? 0;
                decimal empe = (from e in _entidades.Boletas
                                where e.FechaPrestamo == DateTime.Today.Date && e.EstadoBoleta != "Cancelado"
                                select (decimal?)e.Prestamo).Sum()??0;
                decimal inte = (from i in _entidades.PagosInteres
                                where i.FechaPago == DateTime.Today.Date && i.Estado == true
                                select (decimal?)i.TotalPagar).Sum()??0;
                decimal desem = (from d in _entidades.Desempeños
                                 where d.FechaDesempeño == DateTime.Today.Date && d.Estado == true
                                 select (decimal?)d.TotalPagar).Sum()??0;
                decimal ret = (from r in _entidades.Transacciones
                               where r.FechaTransaccion == DateTime.Today.Date && r.TipoTransaccion == "Retiro" && r.Estado == true
                               select (decimal?)r.Cantidad).Sum()??0;
                decimal dep = (from depo in _entidades.Transacciones
                               where depo.FechaTransaccion == DateTime.Today.Date && depo.TipoTransaccion == "Deposito" && depo.Estado == true        //DateTime.Now
                               select (decimal?)depo.Cantidad).Sum()??0;
                decimal ventas = (from vc in _entidades.Ventas
                                  where vc.TipoVenta == "Contado" && vc.Estado=="Pagado" && vc.FechaVenta == DateTime.Today.Date
                                  select (decimal?)vc.TotalVenta).Sum() ?? 0;
                decimal apartados = (from vc in _entidades.Ventas
                                     where vc.TipoVenta == "Apartado" && vc.Estado!="Cancelado" && vc.FechaVenta == DateTime.Today.Date
                                     select (decimal?)vc.Enganche).Sum() ?? 0;
                decimal abonos = (from abo in _entidades.PagosVentas
                                  where abo.Estado && abo.FechaPago == DateTime.Today.Date
                                  select (decimal?)abo.Abono).Sum() ?? 0;
                decimal pagoF = (from pf in _entidades.PagosFinanciamientos
                                 where pf.Estado&& pf.FechaPago.Date == DateTime.Today.Date
                                 select (decimal?)pf.TotalPago).Sum() ?? 0;
                decimal finan = (from pf in _entidades.Prestamos
                                 where pf.Estado != "Cancelado" && pf.FechaPrestamo.Date == DateTime.Today.Date
                                 select (decimal?)pf.Cantidad).Sum() ?? 0;
                decimal engan = (from pf in _entidades.Prestamos
                                 where pf.Estado != "Cancelado" && pf.FechaPrestamo.Date == DateTime.Today.Date
                                 select (decimal?)pf.Enganche).Sum() ?? 0;
                decimal creditos = (from pf in _entidades.FinancieraCreditos
                                    where pf.Estado == "Activo" && pf.FechaInicio.Date == DateTime.Today.Date
                                    select (decimal?)pf.Prestamo).Sum() ?? 0;
                decimal pagCre = (from pf in _entidades.FinancieraPagos
                                  where pf.Estado && pf.FechaPago.Date == DateTime.Today.Date
                                  select (decimal?)pf.TotalPago).Sum() ?? 0;

                decimal saldo =  (cajaInicial+ inte+desem+dep+pagoF+engan+ventas+abonos+apartados+pagCre) -(empe + com + finan+ret+ creditos);
                return saldo;
            }
            return 0M;
        }
 private void xr14_SummaryGetResult(object sender, SummaryGetResultEventArgs e)
 {
     decimal valor =
        new EmpeñosDC(new clsConeccionDB().StringConn()).Articulos.Where(
            v => v.Kilates == "Oro 14Kt" && (v.FechaRegistro >= Convert.ToDateTime(FechaInicial.Value) && v.FechaRegistro <= Convert.ToDateTime(FechaFinal.Value)) && v.Estado != "Baja").Sum(v => (decimal?)v.Peso) ??
        0;
     e.Result = valor;
     e.Handled = true;
 }
 private void xr14Nuevo_SummaryGetResult(object sender, SummaryGetResultEventArgs e)
 {
     decimal valor =
       new EmpeñosDC(new clsConeccionDB().StringConn()).Articulos.Where(
           v => v.Kilates == "Oro 14Kt Nuevo" && v.FechaRegistro == DateTime.Today.Date && v.Estado != "Baja").Sum(v => (decimal?)v.Peso) ??
       0;
     e.Result = valor;
     e.Handled = true;
 }
        public void Nuevo()
        {
            _entidades = new EmpeñosDC(new clsConeccionDB().StringConn());
            _guardado = false;
            _dTpagos.Rows.Clear();
            _folios = "";

            dtpFechaCredito.DateTime = DateTime.Today.Date;
            gridIntegrantes.DataSource = null;

            new ManejadorControles().LimpiarControles(gpoContenedor);
            //_cveFinanciamiento = 0;
            //txtNombre.Focus();
            dtpFechaPago.EditValue = DateTime.Today.Date;
            botonGuardar.Enabled = true;
            gridPagos.DataSource = _dTpagos;
        }
예제 #8
0
        public FrmCompras()
        {
            InitializeComponent();
            DataColumn num = new DataColumn
            {
                ColumnName = "Clave",
                DataType = Type.GetType("System.Int32"),
                AutoIncrement = true,
                AutoIncrementSeed = 1,
                AutoIncrementStep = 1,
                ReadOnly = true,
                Unique = true
            };
            _dtprecios.Columns.Add(num);
            _dtprecios.Columns.Add("Tipo", Type.GetType("System.String"));
            _dtprecios.Columns.Add("PrecioGr", Type.GetType("System.Decimal"));

            var precios = new EmpeñosDC(new clsConeccionDB().StringConn()).Precios.Select(p => new { p.Tipo, PrecioGr = p.Compra });

            foreach (var pre in precios)
            {
                _dtprecios.Rows.Add(new object[] { null, pre.Tipo, pre.PrecioGr });
            }
            _dtprecios.Rows.Add(new object[] { null, "Dolares", _entidades.Configuraciones.First().PrecioCompraDolar });
            cboTipoPrenda.Properties.DataSource = _dtprecios;
            cboTipoPrenda.Properties.DisplayMember = "Tipo";
            cboTipoPrenda.Properties.ValueMember = "Clave";

            _dtArticulos.Columns.Add("TipoCompra", Type.GetType("System.String"));
            _dtArticulos.Columns.Add("PesoCantidad", Type.GetType("System.Decimal"));
            _dtArticulos.Columns.Add("PrecioCompra", Type.GetType("System.Decimal"));
            _dtArticulos.Columns.Add("ImporteArticulo", Type.GetType("System.Decimal"));
            gridBusqueda.DataSource = _dtArticulos;
            grvResultado.Columns[1].DisplayFormat.FormatType = FormatType.Numeric;
            grvResultado.Columns[1].DisplayFormat.FormatString = "###.##";
            grvResultado.Columns[2].DisplayFormat.FormatType = FormatType.Numeric;
            grvResultado.Columns[2].DisplayFormat.FormatString = "$ #,##0.00";
            grvResultado.Columns[3].DisplayFormat.FormatType = FormatType.Numeric;
            grvResultado.Columns[3].DisplayFormat.FormatString = "$ #,##0.00";
        }
예제 #9
0
        private void btnAgregarPrenda_Click(object sender, EventArgs e)
        {
            if (Convert.ToDecimal(txtAvaluo.EditValue) == 0M) return;
            if (cboTipoPrenda.Text == "Dolares")
            {
                decimal precio =
                   new EmpeñosDC(new clsConeccionDB().StringConn()).Configuraciones.First().PrecioCompraDolar;
                _dtArticulos.Rows.Add(new[]
                {cboTipoPrenda.Text, txtPesoEmpenio.EditValue,precio , txtAvaluo.EditValue});
            }
            else
            {
                decimal precio =
                    new EmpeñosDC(new clsConeccionDB().StringConn()).Precios.First(
                        p => p.Tipo == cboTipoPrenda.Text).Compra;
                _dtArticulos.Rows.Add(new[] {cboTipoPrenda.Text, txtPesoEmpenio.EditValue, precio, txtAvaluo.EditValue});
            }

            new ManejadorControles().LimpiarControles(txtPesoEmpenio);
            cboTipoPrenda.EditValue = cboTipoPrenda.Properties.GetDataSourceValue(cboTipoPrenda.Properties.ValueMember, 0);
            cboTipoPrenda.Focus();
            txtTotalCompra.EditValue = _dtArticulos.Rows.Cast<DataRow>().Aggregate<DataRow, decimal>(0M, (current, row) => current + (decimal)row["ImporteArticulo"]);
        }
 private void rptAutoFinanciamiento_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     Prestamo pre=new EmpeñosDC(new clsConeccionDB().StringConn()).Prestamos.FirstOrDefault(c=>c.Clave==(int)CvePrestamo.Value);
     DatosInforme.DataSource = pre;
 }
 private void XrptSubDetalleBoleta_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     DataSource =
         new EmpeñosDC(new clsConeccionDB().StringConn()).DetallesBoletas.Where(
             db => db.Folio == FolioBoleta.Value.ToString());
 }
 private void rptIngresos_ItemClick(object sender, ItemClickEventArgs e)
 {
     var art = new EmpeñosDC(new clsConeccionDB().StringConn()).Articulos.Where(
                             v => v.FechaRegistro == DateTime.Today.Date && v.Estado != "Baja");
     if (art.Any())
     {
         XrptIngresoArticulos articulos = new XrptIngresoArticulos { DataSource = art };
         articulos.ShowPreviewDialog();
     }
     else
         XtraMessageBox.Show("No hay suficientes datos para mostrar el reporte", "Registros 0");
 }
        private void ImprimirTikets()
        {
            Configuracione empre = new EmpeñosDC(new clsConeccionDB().StringConn()).Configuraciones.First();

            string empresa = new clsModificarConfiguracion().configGetValue("Empresa");
            string razonSocial = new clsModificarConfiguracion().configGetValue("RazonSocial");
            string rfc = new clsModificarConfiguracion().configGetValue("RFC");
            string curp = new clsModificarConfiguracion().configGetValue("CURP");
            string dirc = String.Format("{0} CP {1} {2}", empre.Direccion, empre.CodigoPostal,empre.Municipio);

            int padRe = ((40 - empresa.Length) / 2) + empresa.Length;
            int padRrs = ((40 - razonSocial.Length) / 2) + razonSocial.Length;
            int padRrfc = ((40 - rfc.Length) / 2) + rfc.Length;
            int padRcurp = ((40 - curp.Length) / 2) + curp.Length;

            Ticket ticket = new Ticket(2);
            ticket.AddHeaderLine("            CASA  DE  EMPEÑOS           ");
            ticket.AddHeaderLine("                                        ");
            ticket.AddHeaderLine(empresa.PadLeft(padRe));
            ticket.AddHeaderLine(razonSocial.PadLeft(padRrs));
            ticket.AddHeaderLine(rfc.PadLeft(padRrfc));
            ticket.AddHeaderLine(curp.PadLeft(padRcurp));
            if (dirc.Length > 40)
            {
                int currentChar = 0;
                int itemLenght = dirc.Length;

                while (itemLenght > 40)
                {
                    ticket.AddHeaderLine(dirc.Substring(currentChar, 40));
                    currentChar += 40;
                    itemLenght -= 40;
                }
                ticket.AddHeaderLine(dirc.Substring(currentChar));

            }
            else
            {
                ticket.AddHeaderLine(dirc);
            }
            ticket.AddHeaderLine("           TICKET DE " + cboTipo.Text.ToUpper());

            ticket.AddSubHeaderLine("CLAVE: " + txtCLave.Text);
            ticket.AddSubHeaderLine("REALIZO: " + new clsModificarConfiguracion().configGetValue("UsuarioAPP"));
            ticket.AddSubHeaderLine(String.Format("FECHA: {0} {1}", DateTime.Today.ToString("dd/MMM/yyyy").ToUpper(), DateTime.Now.ToShortTimeString()));
            string[] lineas = txtConcepto.Text.Split(new[] {"\r\n"}, StringSplitOptions.RemoveEmptyEntries);
            foreach (var linea in lineas )
            {
                ticket.AddItem("", linea, "");
            }
            //ticket.AddItem("", txtConcepto.Text, "");
            ticket.AddTotal("CANTIDAD:", Convert.ToDecimal(txtCantidad.EditValue).ToString("$ #,##0.00"));
            ticket.AddFooterLine("");
            ticket.AddFooterLine("");
            ticket.AddFooterLine("________________________________________");
            ticket.AddFooterLine("                AUTORIZO                ");
            ticket.AddFooterLine("");
            ticket.AddFooterLine("");
            ticket.AddFooterLine("");

            ticket.PrintTicket(new clsModificarConfiguracion().configGetValue("ImpresoraTickets"));
        }
 private void rptRetiros_ItemClick(object sender, ItemClickEventArgs e)
 {
     var dep = new EmpeñosDC(new clsConeccionDB().StringConn()).Transacciones.Where(b => b.TipoTransaccion == "Retiro" && b.FechaTransaccion == DateTime.Today && b.Estado == true);
     if (dep.Any())
     {
         XrptTransaccionesXDia rptbol = new XrptTransaccionesXDia
         {
             DataSource = dep,
             TipoTransaccion = { Value = "Retiros" }
         };
         rptbol.ShowPreviewDialog();
     }
     else
         XtraMessageBox.Show("No Hay Suficientes datos para mostrar el reporte", "Registros 0");
 }
 private bool VericarHorario()
 {
     string dia = DateTime.Today.Date.ToString("dddd");
     Horario hr = new EmpeñosDC(new clsConeccionDB().StringConn()).Horarios.SingleOrDefault(h => h.Dia == dia);
     if (hr != null && ((TimeSpan.Compare(DateTime.Now.TimeOfDay, hr.HoraInicial.TimeOfDay) >= 0) &&
                        (TimeSpan.Compare(DateTime.Now.TimeOfDay, hr.HoraFinal.TimeOfDay) <= 0)))
         return true;
     return false;
 }
예제 #16
0
        private void ImprimirNotaCompra()
        {
            Configuracione empre = new EmpeñosDC(new clsConeccionDB().StringConn()).Configuraciones.First();

            string empresa = new clsModificarConfiguracion().configGetValue("Empresa");
            string razonSocial = new clsModificarConfiguracion().configGetValue("RazonSocial");
            string rfc = new clsModificarConfiguracion().configGetValue("RFC");
            string curp = new clsModificarConfiguracion().configGetValue("CURP");
            string dirc = String.Format("{0} CP {1}", empre.Direccion, empre.CodigoPostal);
            int padRe = ((40 - empresa.Length) / 2) + empresa.Length;
            int padRrs = ((40 - razonSocial.Length) / 2) + razonSocial.Length;
            int padRrfc = ((40 - rfc.Length) / 2) + rfc.Length;
            int padRcurp = ((40 - curp.Length) / 2) + curp.Length;

            Ticket ticket = new Ticket(5);
            ticket.AddHeaderLine("            CASA  DE  EMPEÑOS           ");
            ticket.AddHeaderLine("                                        ");
            ticket.AddHeaderLine(empresa.PadLeft(padRe));
            ticket.AddHeaderLine(razonSocial.PadLeft(padRrs));
            ticket.AddHeaderLine(rfc.PadLeft(padRrfc));
            ticket.AddHeaderLine(curp.PadLeft(padRcurp));
            if (dirc.Length > 40)
            {
                int currentChar = 0;
                int itemLenght = dirc.Length;

                while (itemLenght > 40)
                {
                    ticket.AddHeaderLine(dirc.Substring(currentChar, 40));
                    currentChar += 40;
                    itemLenght -= 40;
                }
                ticket.AddHeaderLine(dirc.Substring(currentChar));

            }
            else
            {
                ticket.AddHeaderLine(dirc);
            }
            ticket.AddHeaderLine(empre.Municipio);
            ticket.AddHeaderLine("             TICKET DE VENTA            ");
            Usuario usu = new EmpeñosDC(new clsConeccionDB().StringConn()).Usuarios.Single(u => u.CveUsuario == Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IDUsuarioApp")));
            ticket.AddSubHeaderLine("ATENDIO: " + usu.Nombre);
            ticket.AddSubHeaderLine("FOLIO COMPRA: " + txtCveCompra.Text);
            ticket.AddSubHeaderLine(String.Format("FECHA VENTA: {0} {1}", DateTime.Today.ToString("dd/MMM/yyyy"), DateTime.Now.ToShortTimeString()));

            foreach (DataRow pRow in _dtArticulos.Rows)
            {
                ticket.AddItem(pRow[1].ToString(),SacarTipo( pRow[0].ToString()), Convert.ToDecimal(pRow[2]).ToString("C"), Convert.ToDecimal(pRow[3]).ToString("C"),"");
            }
            ticket.AddTotal("TOTAL VENTA: ",Convert.ToDecimal(txtTotalCompra.EditValue).ToString("C"));
            ticket.AddFooterLine("");
            ticket.AddFooterLine("");
            ticket.AddFooterLine("");
            ticket.AddFooterLine("");
            ticket.PrintTicket(new clsModificarConfiguracion().configGetValue("ImpresoraTickets"));
        }
예제 #17
0
 private void txtPesoEmpenio_EditValueChanged(object sender, EventArgs e)
 {
     if (cboTipoPrenda.Text == "Dolares")
     {
         txtAvaluo.EditValue = _entidades.Configuraciones.First().PrecioCompraDolar * Convert.ToDecimal(txtPesoEmpenio.EditValue);
         return;
     }
     decimal precio =
             new EmpeñosDC(new clsConeccionDB().StringConn()).Precios.Single(
                 p => p.Tipo == cboTipoPrenda.Text).Compra;
     txtAvaluo.EditValue = precio *
                           Convert.ToDecimal(txtPesoEmpenio.EditValue);
 }
        private void GuardarArticulo_Click(object sender, EventArgs e)
        {
            try
            {
                if (!ClsVerificarCaja.CajaEstado())
                {
                    XtraMessageBox.Show("La Caja del Dia de hoy ya se ha cerrado\n SISTEMA BLOQUEADO", "Caja Cerrada",
                        MessageBoxButtons.OK, MessageBoxIcon.Error);
                    Application.Exit();
                }
                if ((int) txtClave.EditValue == 0)
                {
                    var art = new Articulo
                    {
                        Descripcion = txtDescripcion.Text,
                        Peso = Convert.ToDecimal(txtPeso.EditValue),
                        Kilates = cboTipo.Text,
                        Precio = Convert.ToDecimal(txtPrecio.EditValue),
                        PrecioCredito = Convert.ToDecimal(txtPrecioApartado.EditValue),
                        FechaRegistro = DateTime.Today.Date,
                        Estado = "Disponible",
                        CveUsuario = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IDUsuarioApp"))
                    };

                    txtClave.EditValue = new LogicaArticulos().InsertarArticulo(art);
                }
                else
                {
                    var original = new EmpeñosDC(new clsConeccionDB().StringConn()).Articulos.Single(a => a.Clave==Convert.ToInt32(txtClave.EditValue));
                    Articulo art=new Articulo
                    {
                        Clave = original.Clave,
                        Descripcion = txtDescripcion.Text,
                        Peso = Convert.ToDecimal(txtPeso.EditValue),
                        Kilates = cboTipo.Text,
                        Precio = Convert.ToDecimal(txtPrecio.EditValue),
                        PrecioCredito = Convert.ToDecimal(txtPrecioApartado.EditValue),
                        FechaRegistro = Convert.ToDateTime(dtpFechaRegistro.EditValue).Date,
                        Estado =original.Estado,
                        CveUsuario = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IDUsuarioApp")),
                    };
                    new LogicaArticulos().ActualizarArticulo(art,original);

                } XtraMessageBox.Show("Articulo Guardado");
                new ManejadorControles().DesectivarTextBox(gpoContenedor, false);
                LlenargridArticulos();
            }
            catch (ValidationException vex)
            {
                XtraMessageBox.Show(vex.Message, "Validación de Datos", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
            }
        }
예제 #19
0
 private void CalcularAvaluo()
 {
     if (cboTipoPrenda.EditValue != null && Convert.ToDecimal(cboTipoPrenda.EditValue) < 9)
     {
         decimal precio =
             new EmpeñosDC(new clsConeccionDB().StringConn()).Precios.Single(
                 p => p.Tipo == cboTipoPrenda.Text).Empeño;
         txtAvaluo.EditValue = precio *
                               Convert.ToDecimal(txtPesoEmpenio.EditValue);
     }
     else
     {
         txtAvaluo.EditValue = 0;
         txtAvaluo.Properties.ReadOnly = false;
     }
 }
 private void rptIntereses_ItemClick(object sender, ItemClickEventArgs e)
 {
     var inte = new EmpeñosDC(new clsConeccionDB().StringConn()).PagosInteres.Where(b => b.FechaPago == DateTime.Today && b.Estado == true);
     if (inte.Any())
     {
         XrptInteresesDia rptbol = new XrptInteresesDia { DataSource = inte };
         rptbol.ShowPreviewDialog();
     }
     else
         XtraMessageBox.Show("No Hay Suficientes datos para mostrar el reporte", "Registros 0");
 }
 private void rptPagosCreditos_ItemClick(object sender, ItemClickEventArgs e)
 {
     var dep = new EmpeñosDC(new clsConeccionDB().StringConn()).FinancieraPagos.Where(b => b.FechaPago == DateTime.Today && b.Estado);
     if (dep.Any())
     {
         XrptPagosCreditos rptbol = new XrptPagosCreditos
         {
             DataSource = dep,
         };
         rptbol.ShowPreviewDialog();
     }
     else
         XtraMessageBox.Show("No Hay Suficientes datos para mostrar el reporte", "Registros 0");
 }
 private void XrptSubDetalleVenta_BeforePrint(object sender, System.Drawing.Printing.PrintEventArgs e)
 {
     DataSource =
       new EmpeñosDC(new clsConeccionDB().StringConn()).DetalleVentas.Where(
           db => db.CveVenta ==Convert.ToInt32( CveVenta.Value));
 }
 private void rptVentas_ItemClick(object sender, ItemClickEventArgs e)
 {
     var vent = new EmpeñosDC(new clsConeccionDB().StringConn()).Ventas.Where(
                             v => v.FechaVenta == DateTime.Today.Date && v.Estado != "Cancelado");
     if (vent.Any())
     {
         XrptVentasDia articulos = new XrptVentasDia { DataSource = vent };
         articulos.ShowPreviewDialog();
     }
     else
         XtraMessageBox.Show("No hay suficientes datos para mostrar el reporte", "Registros 0");
 }
 private void rptVentasAtrasadas_ItemClick(object sender, ItemClickEventArgs e)
 {
     var vent = new EmpeñosDC(new clsConeccionDB().StringConn()).Ventas.Where(
         v =>
             v.FechaVenta.AddMonths(
                 Convert.ToInt32(new clsModificarConfiguracion().configGetValue("VencimientoApartado"))).Date <
             DateTime.Today.Date && v.Estado == "Apartado");
     if (vent.Any())
     {
         XrptApartadosAtrasados articulos = new XrptApartadosAtrasados { DataSource = vent };
         articulos.ShowPreviewDialog();
     }
     else
         XtraMessageBox.Show("No hay suficientes datos para mostrar el reporte", "Registros 0");
 }
 private void btnVerPagos_Click(object sender, EventArgs e)
 {
     var pagos = new EmpeñosDC(new clsConeccionDB().StringConn()).PagosInteres.Where(pg => pg.FolioBoleta == txtFolioBoleta.Text && pg.Estado )
         .Select(pg => new { pg.Clave, MesPagado = pg.MesPagado ?? "N/A", pg.Interes, pg.Recargos, pg.TotalPagar, pg.FechaPago, Registro = pg.Usuario.Nombre });
     DataTable dtPagos = new LinqToDataTable().ObtenerDataTable2(pagos);
     if (dtPagos.Rows.Count == 0)
     {
         MessageBox.Show("Boleta sin pagos de interes", Application.ProductName);
         return;
     }
     FrmCronograma cro = new FrmCronograma { Tipo = "PagosInteres", DtCronos = dtPagos };
     cro.ShowDialog(this);
 }
        private void ImprimirTickets(int cveDesempeño)
        {
            Configuracione empre = new EmpeñosDC(new clsConeccionDB().StringConn()).Configuraciones.First();

            string empresa = new clsModificarConfiguracion().configGetValue("Empresa");
            string razonSocial = new clsModificarConfiguracion().configGetValue("RazonSocial");
            string rfc = new clsModificarConfiguracion().configGetValue("RFC");
            string curp = new clsModificarConfiguracion().configGetValue("CURP");
            string dirc = String.Format("{0} CP {1}", empre.Direccion, empre.CodigoPostal);
            int padRe = ((40 - empresa.Length) / 2) + empresa.Length;
            int padRrs = ((40 - razonSocial.Length) / 2) + razonSocial.Length;
            int padRrfc = ((40 - rfc.Length) / 2) + rfc.Length;
            int padRcurp = ((40 - curp.Length) / 2) + curp.Length;

            Ticket ticket = new Ticket(0);
            ticket.AddHeaderLine("            CASA  DE  EMPEÑOS           ");
            ticket.AddHeaderLine("                                        ");
            ticket.AddHeaderLine(empresa.PadLeft(padRe));
            ticket.AddHeaderLine(razonSocial.PadLeft(padRrs));
            ticket.AddHeaderLine(rfc.PadLeft(padRrfc));
            ticket.AddHeaderLine(curp.PadLeft(padRcurp));
            if (dirc.Length > 40)
            {
                int currentChar = 0;
                int itemLenght = dirc.Length;

                while (itemLenght > 40)
                {
                    ticket.AddHeaderLine(dirc.Substring(currentChar, 40));
                    currentChar += 40;
                    itemLenght -= 40;
                }
                ticket.AddHeaderLine(dirc.Substring(currentChar));

            }
            else
            {
                ticket.AddHeaderLine(dirc);
            }
            ticket.AddHeaderLine(empre.Municipio);
            ticket.AddHeaderLine("          TICKET DE DESEMPEÑO           ");
            Usuario usu = new EmpeñosDC(new clsConeccionDB().StringConn()).Usuarios.Single(u => u.CveUsuario == Convert.ToInt32(new clsModificarConfiguracion().configGetValue("IDUsuarioApp")));
            ticket.AddSubHeaderLine("ATENDIO: " + usu.Nombre);
            ticket.AddSubHeaderLine("FOLIO BOLETA: " + txtFolioBoleta.Text);
            ticket.AddSubHeaderLine("DESEMPEÑO NUM: " + cveDesempeño);
            ticket.AddSubHeaderLine("CLIENTE: " + txtNomCliente.Text);
            ticket.AddSubHeaderLine(String.Format("FECHA DESEMPEÑO:{0} {1}", DateTime.Today.ToString("dd/MMM/yyyy").ToUpper(), DateTime.Now.ToShortTimeString()));
            ticket.AddSubHeaderLine("----------------------------------------");
            ticket.AddSubHeaderLine("         ARTICULOS A DESEMPEÑAR         ");
            string prendas = _dtprenda.Rows.Cast<DataRow>().Aggregate("", (current, pRow) => current + pRow[0] + ",");
            ticket.AddSubHeaderLine(prendas);
            for (int x = 0; x < _dtIntereses.Rows.Count; x++)
                ticket.AddItem(
                    txtClave.Text,
                    Convert.ToDecimal(_dtIntereses.Rows[x][3]).ToString("C2"),
                    Convert.ToDecimal(_dtIntereses.Rows[x][5]).ToString("C2"),
                    Convert.ToDecimal(_dtIntereses.Rows[x][6]).ToString("C2"),
                    Convert.ToDateTime(_dtIntereses.Rows[x][1]).ToString("dd-MMM-yyyy") + " al " + Convert.ToDateTime(_dtIntereses.Rows[x][2]).ToString("dd-MMM-yyyy"));
            ticket.AddTotal("MESES PAGADOS: ", txtMeses.EditValue.ToString());
            ticket.AddTotal("INTERES TOTAL: ", double.Parse(txtInteresGenererado.EditValue.ToString()).ToString("C2"));
            ticket.AddTotal("RECARGOS: ", double.Parse(txtRecargoGenerado.EditValue.ToString()).ToString("C2"));
            ticket.AddTotal("RECARGO POR DÍA: ", double.Parse(txtRecargoDia.EditValue.ToString()).ToString("C2"));
            ticket.AddTotal("DIAS RECARGO: ", txtDiasRecargo.EditValue.ToString());
            ticket.AddTotal("TOTAL A PAGAR: ", double.Parse(txtTotalPago.EditValue.ToString()).ToString("C2"));
            ticket.AddFooterLine("");
            ticket.AddFooterLine("FECHA DE EMPEÑO: "+ dtpFechaEmpeño.DateTime.Date.ToString("dd-MMMM-yyyy").ToUpper());
            ticket.AddFooterLine("");
            ticket.AddFooterLine("");
            ticket.AddFooterLine("");
            ticket.PrintTicket(new clsModificarConfiguracion().configGetValue("ImpresoraTickets"));
        }
예제 #27
0
        public void Nuevo()
        {
            Guardado = false;
            AutoCompleteStringCollection lista = new AutoCompleteStringCollection();
            var clientes = new EmpeñosDC(new clsConeccionDB().StringConn()).Boletas.Select(c => new { c.Cliente });
            foreach (var lugar in clientes)
            {
                lista.Add(lugar.Cliente);
            }

            txtNomCliente.MaskBox.AutoCompleteMode = AutoCompleteMode.Suggest;
            txtNomCliente.MaskBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
            txtNomCliente.MaskBox.AutoCompleteCustomSource = lista;
            new ManejadorControles().LimpiarControles(gpoContenedor);
            new ManejadorControles().DesectivarTextBox(this, true);
            txtNomCliente.Focus();
            cboTipoPrenda.EditValue = cboTipoPrenda.Properties.GetDataSourceValue(cboTipoPrenda.Properties.ValueMember, 0);
            _dtprenda.Rows.Clear();
            dtpFechaPago.DateTime = dtpFechaEmpeño.DateTime.AddMonths(1);
            txtFolioBoleta.EditValue = ObtenerUltimoFolio();
        }
 private void rptPagos_ItemClick(object sender, ItemClickEventArgs e)
 {
     var abonos = new EmpeñosDC(new clsConeccionDB().StringConn()).PagosFinanciamientos.Where(
                             v => v.FechaPago == DateTime.Today.Date && v.Estado);
     if (abonos.Any())
     {
         XrptPagosFinanciamiento abo = new XrptPagosFinanciamiento { DataSource = abonos };
         abo.ShowPreviewDialog();
     }
     else
         XtraMessageBox.Show("No hay suficientes datos para mostrar el reporte", "Registros 0");
 }
예제 #29
0
        private string ObtenerUltimoFolio()
        {
            try
            {
                var fol =
                    new EmpeñosDC(new clsConeccionDB().StringConn()).Boletas.OrderByDescending(b => b.IDBoleta)
                        .FirstOrDefault();
                int ult;
                if (fol == null)
                    ult = 1;
                else
                    ult = fol.IDBoleta + 1;
                if (ult <= 25000)
                    return (ult).ToString().PadLeft(5, '0');
                if (ult > 25000 && ult <= 50000)
                    return "A" + (ult - 25000).ToString().PadLeft(5, '0');
                if (ult > 50000 && ult <= 75000)
                    return "B" + (ult - 50000).ToString().PadLeft(5, '0');
                if (ult > 75000 && ult <= 100000)
                    return "C" + (ult - 75000).ToString().PadLeft(5, '0');
                if (ult > 75000 && ult <= 100000)
                    return "D" + (ult - 100000).ToString().PadLeft(5, '0');
                if (ult > 100000 && ult <= 125000)
                    return "E" + (ult - 125000).ToString().PadLeft(5, '0');
                if (ult > 125000 && ult <= 150000)
                    return "F" + (ult - 150000).ToString().PadLeft(5, '0');
                if (ult > 150000 && ult <= 175000)
                    return "G" + (ult - 175000).ToString().PadLeft(5, '0');
                if (ult > 175000 && ult <= 200000)
                    return "H" + (ult - 200000).ToString().PadLeft(5, '0');
                if (ult > 200000 && ult <= 225000)
                    return "1" + (ult - 225000).ToString().PadLeft(5, '0');
                if (ult > 225000 && ult <= 250000)
                    return "J" + (ult - 250000).ToString().PadLeft(5, '0');
                if (ult > 250000 && ult <= 275000)
                    return "K" + (ult - 275000).ToString().PadLeft(5, '0');
                if (ult > 275000 && ult <= 300000)
                    return "L" + (ult - 300000).ToString().PadLeft(5, '0');
                if (ult > 300000 && ult <= 325000)
                    return "M" + (ult - 325000).ToString().PadLeft(5, '0');
                if (ult > 325000 && ult <= 350000)
                    return "N" + (ult - 350000).ToString().PadLeft(5, '0');
                if (ult > 350000 && ult <= 375000)
                    return "0" + (ult - 375000).ToString().PadLeft(5, '0');
                if (ult > 375000 && ult <= 400000)
                    return "P" + (ult - 400000).ToString().PadLeft(5, '0');
                if (ult > 400000 && ult <= 425000)
                    return "Q" + (ult - 425000).ToString().PadLeft(5, '0');
                if (ult > 425000 && ult <= 450000)
                    return "R" + (ult - 450000).ToString().PadLeft(5, '0');
                if (ult > 450000 && ult <= 475000)
                    return "S" + (ult - 475000).ToString().PadLeft(5, '0');
                if (ult > 475000 && ult <= 400000)
                    return "T" + (ult - 500000).ToString().PadLeft(5, '0');
                return "00001";
            }
            catch (Exception ex)
            {

                XtraMessageBox.Show(ex.Message);
                return null;
            }
        }
        private void BoletaDevuelta(string p)
        {
            try
            {
                Nuevo();
                Boleta bol = new EmpeñosDC(new clsConeccionDB().StringConn()).Boletas.SingleOrDefault(b => b.Folio == p);
                if (bol == null)
                {
                    XtraMessageBox.Show(String.Format("La Boleta: {0} no Existe", txtFolioBoleta.Text), "Boleta no Encontrada", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
                    return;
                }
                txtFolioBoleta.EditValue = p;
                txtFolioBoleta.Enabled = false;
                txtNomCliente.EditValue = bol.Cliente;
                txtCotitular.EditValue = bol.Cotitular;
                txtPrestamo.EditValue = bol.Prestamo;
                txtInteres.EditValue = bol.Interes;
                dtpFechaEmpeño.DateTime = bol.FechaPrestamo;
                dtpFechaSaldada.DateTime = bol.FechaPrestamo.AddMonths(bol.PagosInteres.Count(pg => pg.Estado ));
                _dtprenda.Rows.Clear();
                if (bol.DetallesBoletas.Any())
                {
                    var prendas = bol.DetallesBoletas
                            .Select(
                                db =>
                                    new
                                    {
                                        db.Prenda.Descripcion,
                                        db.Prenda.Peso,
                                        db.Prenda.Tipo,
                                        db.Prenda.Avaluo
                                    });
                    foreach (var pr in prendas)
                    {
                        _dtprenda.Rows.Add(new object[] { pr.Descripcion, pr.Peso, pr.Tipo, pr.Avaluo });
                    }
                }
                else
                {
                    PrendasAnteriores(bol.Articulos).ForEach(prenda => _dtprenda.Rows.Add(new object[] { prenda, 0, 0, 0 }));
                }
                gridPrendas.DataSource = _dtprenda;
                grvPrendas.Columns[3].DisplayFormat.FormatType = FormatType.Numeric;
                grvPrendas.Columns[3].DisplayFormat.FormatString = "c2";
                gridPrendas.ForceInitialize();

                switch (bol.EstadoBoleta)
                {
                    case "Vencido":
                        botonGuardar.Enabled = false;
                        XtraMessageBox.Show("El Empeño a vencido y se ha Fundido", "Boleta Vencida");
                        return;

                    case "Desempeñado":
                        botonGuardar.Enabled = false;
                        DateTime fchDesempeño =
                            new EmpeñosDC(new clsConeccionDB().StringConn()).Desempeños.Single(d => d.FolioBoleta == bol.Folio).FechaDesempeño;
                        XtraMessageBox.Show("La Boleta: " + bol.Folio + " Se ha Desempeñado\n FECHA DESEMPEÑO: " + fchDesempeño.ToString("dd/MMM/yyyy"), "Boleta Desempeñada", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);

                        return;
                    case "Vigente":
                        TimeSpan diasdespuesPrestamo = DateTime.Now.Subtract(dtpFechaSaldada.DateTime.Date);
                        int diastrancurridos = (int)diasdespuesPrestamo.TotalDays;
                        int diasparavencer = Convert.ToInt32(new clsModificarConfiguracion().configGetValue("DiasVencimiento"));
                        if (diastrancurridos > diasparavencer)
                        {
                            botonGuardar.Enabled = false;
                            XtraMessageBox.Show("La boleta ya esta VENCIDA \n ya han pasado " + diastrancurridos + " DIAS  de  " + diasparavencer + " dias para poder pagar", "Boleta VENCIDA");
                            return;
                        }
                        botonGuardar.Enabled = true;
                        break;
                    case "Cancelado":
                        XtraMessageBox.Show("La Boleta esta cancelada");
                        botonGuardar.Enabled = false;
                        return;

                }
                CalcularIntereses(dtpFechaSaldada.DateTime.Date,bol.PagosInteres.Count);
            }
            catch (Exception ex)
            {

                XtraMessageBox.Show(ex.Message);
            }
        }