}//fin metodo BuscarProductoVentas

        //inicio metodo cargar datagrid Ventas
        private void CargarVentas()
        {//inicio metdo cargar ventas
         //CAPTURAMOS VALOR DE LA FILA SELECCIONADA DG FORM2
            DFactura V        = new DFactura();
            DVentas  Ventas   = new DVentas();
            DDetalle Detalle1 = new DDetalle();
            decimal  Subtotal = 0;

            //dataVentas.Rows.Add(A, B, C, D, E);
            //foreach (DataGridViewRow fila in this.dataListadoProductos.Rows)
            //{
            //dataVentas.Rows.Add(fila.Cells[0].Value, fila.Cells[2].Value, fila.Cells[3].Value, fila.Cells[4].Value);
            //dataVentas.Rows.Add(A, B);
            //}
            //Int32 A = Convert.ToInt32(this.dataListadoProductos.CurrentRow.Cells[0].Value.ToString());
            //Int32 A = Convert.ToInt32(this.lblNumeroFactura.Text);
            //decimal P = Convert.ToDecimal(this.dataListadoProductos.CurrentRow.Cells[3].Value.ToString());
            //string B = this.txtCantidadProducto.Text;
            //string C = this.dataListadoProductos.CurrentRow.Cells[2].Value.ToString();
            //string D = this.dataListadoProductos.CurrentRow.Cells[3].Value.ToString();
            //Int32 E = dataListadoProductos.RowCount;
            //dataVentas.Rows.Add(A, B, D, E);

            //V.Fecha_venta = Convert.ToDateTime(this.dtpFechaVenta.Text);
            //V.Id_cliente = Convert.ToInt32(this.dataListadoProductos.CurrentRow.Cells[0].Value.ToString());
            //V.Id_cliente = Convert.ToInt32(this.txtIdentificador.Text);
            //V.Id_factura = Convert.ToInt32(this.txtCantidadProducto.Text);
            //V.Numero_factura = Convert.ToInt32(this.lblNumeroFactura.Text);
            //V.Comprobante_exposicion = Convert.ToInt32(this.dataListadoProductos.CurrentRow.Cells[0].Value.ToString());
            //V.Fecha_venta = Convert.ToDateTime(this.dtpFechaVenta.Value);

            //Detalle.Id_producto = Convert.ToInt32(this.dataListadoProductos.CurrentRow.Cells[5].Value.ToString());
            Ventas.Id_producto          = Convert.ToInt32(this.dataListadoProductos.CurrentRow.Cells[0].Value.ToString());
            Ventas.Precio_producto      = Convert.ToDecimal(this.dataListadoProductos.CurrentRow.Cells[4].Value.ToString());
            Ventas.Descripcion_producto = Convert.ToString(this.dataListadoProductos.CurrentRow.Cells[2].Value.ToString());
            Ventas.Cantidad_producto    = Convert.ToInt32(this.txtCantidadProducto.Text);
            Ventas.Id_factura           = Convert.ToInt32(this.lblNumeroFactura.Text);
            lst.Add(Ventas);
            LlenarGrilla();

            //Detalle.Id_producto = Convert.ToInt32(A);
            //Detalle.Precio_producto = Convert.ToDecimal(P);
            //Detalle.Cantidad_producto = Convert.ToInt32(this.txtCantidadProducto.Text);
            //lst.Add(Detalle);
            //LlenarGrilla();


            //foreach (DataGridViewRow row in dataListadoProductos.Rows)
            //{

            //int n = dataVentas.Rows.Add();
            //foreach (DataGridViewColumn col in dataListadoProductos.Columns)
            //    {
            //        dataVentas.Rows[n].Cells[col.Index].Value = dataListadoProductos.Rows[row.Index].Cells[col.Index].Value.ToString();
            //        //MessageBox.Show("numero de filas" + n);
            //    }


            //}
        }//fin metodo datagrid Ventas
Пример #2
0
        //public static string Insertar(int idpaciente, int idtipopaciente, int idempresaseguro, string tipopago, int idbanco, string numerochot, bool exonerado, string motivo, double descuento, double subtotal, double recargoemergencia, double abonar, double total, DataTable DtDetalles)
        //{
        //    DFactura Objeto = new DFactura();
        //    Objeto.IDPaciente = idpaciente;
        //    Objeto.IDTipoPaciente = idtipopaciente;
        //    Objeto.IDEmpresaSeguro = idempresaseguro;
        //    Objeto.TipoPago = tipopago;
        //    Objeto.IDBanco = idbanco;
        //    Objeto.NumeroCHoT = numerochot;
        //    Objeto.Exonerado = exonerado;
        //    Objeto.Motivo = motivo;
        //    Objeto.Descuento = descuento;
        //    Objeto.Subtotal = subtotal;
        //    Objeto.RecargoEmergencia = recargoemergencia;
        //    Objeto.Abonar = abonar;
        //    Objeto.Total = total;

        //    List<DDetalle_Factura> Detalles = new List<DDetalle_Factura>();
        //    foreach(DataRow row in DtDetalles.Rows)
        //    {
        //        DDetalle_Factura Detalle = new DDetalle_Factura();

        //        //voy a poner que se agregue el id mientras tanto
        //        //Detalle.ID = Convert.ToInt32(row["ID"].ToString());
        //        //Detalle.IDFactura = Convert.ToInt32(row["IDFactura"].ToString());
        //        Detalle.ExamenPerfil = Convert.ToString(row["EXoPERF"].ToString());
        //        Detalle.IDExamen = Convert.ToInt32(row["IDExamen"].ToString());
        //        Detalle.IDPerfil = Convert.ToInt32(row["IDPerfil"].ToString());
        //        //Detalle.IDDetalleOrden = Convert.ToInt32(row["IDDetalleOrden"].ToString());
        //    }

        //    return Objeto.Insertar(Objeto, Detalles);
        //}


        public static string Anular(int ID)
        {
            DFactura Objeto = new DFactura();

            Objeto.ID = ID;
            return(Objeto.Anular(Objeto));
        }
        //metodo eliminar
        public static string Eliminar(int id_factura)
        {
            DFactura Obj = new DFactura();

            Obj.Id_factura = id_factura;
            return(Obj.Eliminar(Obj));
        }
        //metodo editar
        public static string Editar(int id_factura, int id_cliente, string fecha_venta, decimal costo_total, int numero_factura, int comprobante_exposicion, int id_tipo_pago, int emite_factura, int tipo_factura)
        {
            DFactura Obj = new DFactura();

            Obj.Id_factura = id_factura;
            Obj.Id_cliente = id_cliente;
            if (fecha_venta != string.Empty)
            {
                try
                {
                    Obj.Fecha_venta = Convert.ToDateTime(fecha_venta);
                }
                catch (Exception)
                {
                    Obj.Fecha_venta = System.DateTime.Parse("1900-01-01");
                }
            }
            else
            {
                Obj.Fecha_venta = System.DateTime.Parse("1900-01-01");
            }
            Obj.Costo_total            = costo_total;
            Obj.Numero_factura         = numero_factura;
            Obj.Comprobante_exposicion = comprobante_exposicion;
            Obj.Id_tipo_pago           = id_tipo_pago;
            Obj.Emite_factura          = emite_factura;
            Obj.Tipo_factura           = tipo_factura;
            return(Obj.Editar(Obj));
        }
Пример #5
0
        //Metodo para buscar nombre
        public static DataTable BuscarNombre(string textobuscar)
        {
            DFactura Obj = new DFactura();

            Obj.TextoBuscar = textobuscar;
            return(Obj.BuscarNombreCliente(Obj));
        }
Пример #6
0
        public static string Insertar(int IdFactura, DateTime FechaFactura, int PersonaId, string ClienteNombre, int EmpleadoId, string EmpleadoNombre, int EmpleadoLegajo, decimal Total, DataTable dtDetalle)
        {
            DFactura Obj = new DFactura();

            Obj.IdFactura      = IdFactura;
            Obj.FechaFactura   = FechaFactura;
            Obj.PersonaId      = PersonaId;
            Obj.ClienteNombre  = ClienteNombre;
            Obj.EmpleadoId     = EmpleadoId;
            Obj.EmpleadoNombre = EmpleadoNombre;
            Obj.EmpleadoLegajo = EmpleadoLegajo;
            Obj.Total          = Total;
            List <DDetalle_Factura> detalles = new List <DDetalle_Factura>();

            foreach (DataRow row in dtDetalle.Rows)
            {
                DDetalle_Factura detalle = new DDetalle_Factura();
                detalle.IdFactura  = Convert.ToInt32(row["idfactura"].ToString());
                detalle.IdProducto = Convert.ToInt32(row["IdProducto"].ToString());
                detalle.PU         = Convert.ToDecimal(row["PU"].ToString());
                detalle.Cantidad   = Convert.ToInt32(row["Cantidad"].ToString());
                detalle.Subtotal   = Convert.ToDecimal(row["Subtotal"].ToString());
            }
            return(Obj.Insertar(Obj, detalles));
        }
Пример #7
0
        //Metodo para buscar nombre y rango de fechas
        public static DataTable BusquedaAvanzada(string textobuscar, string FechaDesde, string FechaHasta)
        {
            DFactura Obj = new DFactura();

            Obj.TextoBuscar = textobuscar;
            Obj.FechaDesde  = FechaDesde;
            Obj.FechaHasta  = FechaHasta;
            return(Obj.BusquedaAvanzada(Obj));
        }
Пример #8
0
        public static bool insertarFactura(string serie, string correlativo, int idventa)
        {
            DFactura objFactura = new DFactura();

            objFactura.Serie       = serie;
            objFactura.Correlativo = correlativo;
            objFactura.IdVenta     = idventa;

            return(objFactura.InsertarFactura(objFactura));
        }
Пример #9
0
        public static string Facturar(int IDBioanalista, string IDUsuario, int IDMedico, int IDTurno, DateTime Fecha, DataTable DtDetalleOrden, int idpaciente, int idtipopaciente, int idempresaseguro, string tipopago, int idbanco, string numerochot,
                                      bool exonerado, string motivo, double descuento, double subtotal, double recargoemergencia, double abonar, double total,
                                      DataTable DtDetalleFactura, ref int IDFactura)
        {
            //Objeto del Orden
            DOrden ObjetoOrden = new DOrden();

            ObjetoOrden.IDBioanalista = IDBioanalista;
            ObjetoOrden.IDUsuario     = IDUsuario;
            ObjetoOrden.IDMedico      = IDMedico;
            ObjetoOrden.IDTurno       = IDTurno;
            ObjetoOrden.Fecha         = Fecha;

            List <DDetalle_Orden> DetalleOrden = new List <DDetalle_Orden>();

            foreach (DataRow row in DtDetalleOrden.Rows)
            {
                DDetalle_Orden Detalle = new DDetalle_Orden();

                //voy a poner que se agregue el id mientras tanto
                //Detalle.ID = Convert.ToInt32(row["ID"].ToString());
                //Detalle.IDOrden = Convert.ToInt32(row["IDOrden"].ToString());
                Detalle.IDExamen = Convert.ToInt32(row["IDExamen"].ToString());

                DetalleOrden.Add(Detalle);
            }

            //Objeto de la Factura
            DFactura ObjetoFactura = new DFactura();

            ObjetoFactura.IDPaciente        = idpaciente;
            ObjetoFactura.IDTipoPaciente    = idtipopaciente;
            ObjetoFactura.IDEmpresaSeguro   = idempresaseguro;
            ObjetoFactura.TipoPago          = tipopago;
            ObjetoFactura.IDBanco           = idbanco;
            ObjetoFactura.NumeroCHoT        = numerochot;
            ObjetoFactura.Exonerado         = exonerado;
            ObjetoFactura.Motivo            = motivo;
            ObjetoFactura.Descuento         = descuento;
            ObjetoFactura.Subtotal          = subtotal;
            ObjetoFactura.RecargoEmergencia = recargoemergencia;
            ObjetoFactura.Abonar            = abonar;
            ObjetoFactura.Total             = total;

            List <DDetalle_Factura> DetalleFactura = new List <DDetalle_Factura>();

            foreach (DataRow row in DtDetalleFactura.Rows)
            {
                DDetalle_Factura Detalle = new DDetalle_Factura();

                //voy a poner que se agregue el id mientras tanto
                //Detalle.ID = Convert.ToInt32(row["ID"].ToString());
                //Detalle.IDFactura = Convert.ToInt32(row["IDFactura"].ToString());
                Detalle.ExamenPerfil = Convert.ToString(row["EXoPERF"].ToString());
                Detalle.IDExamen     = Convert.ToInt32(row["IDExamen"].ToString());
                Detalle.IDPerfil     = Convert.ToInt32(row["IDPerfil"].ToString());
                //Detalle.IDDetalleOrden = Convert.ToInt32(row["IDDetalleOrden"].ToString());

                DetalleFactura.Add(Detalle);
            }

            string response = ObjetoFactura.Facturar(ref ObjetoFactura, DetalleFactura, ObjetoOrden, DetalleOrden);

            IDFactura = ObjetoFactura.ID;

            return(response);
        }
        //metodo mostrar
        public static DataTable Mostrar()
        {
            DFactura Obj = new DFactura();

            return(Obj.Mostrar());
        }