We prove that the electron density function of a real physical system can be uniquely determined by its values on any finite subsystem. This establishes the existence of a rigorous density-functional theory for any open electronic system. By introducing a new density functional for dissipative interactions between the reduced system and its environment, we subsequently develop a time-dependent density-functional theory which depends in principle only on the electron density of the reduced system. In the steady-state limit, the conventional first-principles nonequilibrium Green's function formulation for the current is recovered. A practical scheme is proposed for the new density functional: the wide-band limit approximation, which is applied to simulate the transient current through a model molecular device.