
41 Cal.Rptr.3d 156 (2006)
138 Cal.App.4th 43
Patience THORNBURG, Petitioner,
v.
SUPERIOR COURT, Respondent;
Bactes Imaging Solutions, Inc., Real Party in Interest.
No. D045247.
Court of Appeal, Fourth District, Division One.
March 29, 2006.
*157 Niddrie, Fish & Buchanan, Michael H. Fish; Huffman & Kostas and James C. Kostas; Law Offices of Sheldon A. Ostroff and Sheldon A. Ostroff, San Diego; and Law Offices of Barron Ramos and Barron Ramos, Del Mar, for Petitioner.
No appearance for Respondent.
Simpson Delmore Green, Robert W. Hicks and John T. Glothlin for Real Party in Interest.
BENKE, J.
Real party in interest Bactes Imaging Solutions, Inc. (Bactes), entered into an agreement with a hospital under which Bactes agreed to respond to patient requests for copies of their medical records. Under the terms of the agreement, upon receipt of a records request from a patient the hospital agreed to provide the patient's records to Bactes and Bactes agreed to make copies of the records and provide the copies to the patient or his or her attorney.
By its express terms, Evidence Code[1] section 1158 limits the amount health care providers may charge for copying patient records and providing them to attorneys retained by patients. Under the terms of its agreement with the hospital, Bactes had the obligation of responding to section 1158 requests and is therefore subject to the limitations of the statute. Accordingly, the trial court erred in sustaining without leave to amend Bactes's demurrer to two causes of action which alleged Bactes violated the statute.

FACTUAL AND PROCEDURAL BACKGROUND
In January 2001 Bactes entered into a contract with El Centro Regional Medical *158 Center (the hospital) to provide copy services for the hospital. The agreement provided the hospital would receive, open and review all requests for patient records and determine whether the requests were appropriate. The hospital agreed that following its review of record requests, it would "place the requests in a designated area for BACTES'S representative." With respect to collecting fees from individuals and entities requesting copies, the agreement provides: "6. EL CENTRO REGIONAL MEDICAL CENTER will not be held responsible for the collecting of copy fees from requesting parties. BACTES is solely responsible to collect all fees." Indeed, with respect to fees, the agreement goes even further and directs: "7. All fees mailed to EL CENTRO REGIONAL MEDICAL CENTER with requests for copies for patient charts will be given to BACTES'S representative."
Bactes agreed that its representative would copy the requested records and then invoice, package and mail the copies to the patients, attorneys, insurance companies or physicians who requested the records. Bactes agreed to provide these services at no charge to the hospital. Bactes further agreed it would hold the hospital harmless "from any loss from the operations of Bactes in copying medical record information as judged in a court of law."
The first amended complaint alleges petitioner Patience Thornburg submitted two requests to the hospital for copies of her treatment records. Bactes charged her $41.80 for 27 photocopied pages in response to the first request. With respect to the second request, the hospital charged Thornburg $60 for 30 photocopied pages.
Thornburg then filed a claim against the hospital in which she asserted the amount the hospital charged her exceeded the $0.10-a-page limit set forth in section 1158. Thornburg also filed a civil complaint against Bactes, alleging violations of section 1158 and Business and Professions Code sections 17200 et seq. The complaint stated Thornburg would amend the complaint to name the hospital as Doe 1 in the event her claim was rejected.
Bactes demurred to both causes of action and the trial court sustained the demurrer with leave to amend, concluding the cost limitations in section 1158 do not apply to a photocopy service and Thornburg failed to plead sufficient facts to establish an agency relationship between Bactes and the hospital. Thornburg then filed an amended complaint, naming both Bactes and the hospital as defendants. The amended complaint alleged three causes of action against Bactes: violation of section 1158, violation of Civil Code section 2342 and a third derivative cause of action in which Thornburg alleged Bactes's violation of section 1158 supported a claim under Business and Professions Code section 17200 et seq. Thornburg incorporated the agreement for services between Bactes and the hospital into the amended complaint.
Bactes again demurred to all three causes of action. The trial court sustained Bactes's demurrer to the first two causes of action without leave to amend, but overruled it as to the third cause of action. The trial court reasoned that section 1158 does not apply to agents of medical providers or employers, and in any event the first amended complaint failed to allege the hospital exercised the necessary level of control over Bactes to create an agency relationship. Shortly afterward, Thornburg requested the trial court dismiss the third cause of action without prejudice. The trial court granted the request and entered judgment in favor of Bactes.
Thornburg filed a notice of appeal.


*159 DISCUSSION

I
Bactes argues that because the trial court dismissed Thornburg's third cause of action without prejudice, no appealable judgment has been entered. (See Hoveida v. Scripps Health (2005) 125 Cal.App.4th 1466, 1469, 23 Cal.Rptr.3d 667.) Thornburg agrees that in light of the holding in Hoveida v. Scripps Health her appeal was premature. She asks that instead of dismissing her appeal, we treat it as a petition for a writ of mandate. Because the question presented has been fully briefed on the merits, and is solely a question of law which we resolve in Thornburg's favor, we grant her request. (See Black Diamond Asphalt, Inc. v. Superior Court (2003) 114 Cal.App.4th 109, 115, 7 Cal. Rptr.3d 466; Campbell v. Alger (1999) 71 Cal.App.4th 200, 206, 83 Cal.Rptr.2d 696; IFS Industries, Inc. v. Stephens (1984) 159 Cal.App.3d 740, 757, 205 Cal.Rptr. 915.) As Thornburg points out, there would be little utility in dismissing her appeal and requiring her to litigate her wholly derivative claim under section Business and Professions Code section 17200 in the absence of a definitive determination of her principal substantive claims under section 1158.

II
In reviewing a judgment sustaining a demurrer, "we examine the complaint de novo to determine whether it alleges facts sufficient to state a cause of action under any legal theory, such facts being assumed true for this purpose." (McCall v. PacifiCare of Cal., Inc. (2001) 25 Cal.4th 412, 415, 106 Cal.Rptr.2d 271, 21 P.3d 1189.)

III
The principal question we confront is whether Bactes is governed by the fee limitations imposed by section 1158. In interpreting any statute, we are guided by familiar and well established rules. These "rules of statutory construction require us to ascertain the intent of the enacting legislative body so that we may adopt the construction that best effectuates the purpose of the law. [Citation.] We first examine the words themselves because the statutory language is generally the most reliable indicator of legislative intent. [Citation.] The words of the statute should be given their ordinary and usual meaning and should be construed in their statutory context. [Citations.] These canons generally preclude judicial construction that renders part of the statute `meaningless or inoperative.' [Citation.] In addition, words should be given the same meaning throughout a code unless the Legislature has indicated otherwise." (Hassan v. Mercy American River Hospital (2003) 31 Cal.4th 709, 715-716, 3 Cal.Rptr.3d 623, 74 P.3d 726.) Thus "`[t]he "plain meaning" rule does not prohibit a court from determining whether the literal meaning of a statute comports with its purpose. . . . Literal construction should not prevail if it is contrary to the legislative intent apparent in the statute.' [Citation.]" "`Statutes should be construed so as to be given a reasonable result consistent with the legislative purpose.' [Citations.] `The court should take into account matters such as context, the object in view, the evils to be remedied, the history of the times and of legislation upon the same subject, public policy, and contemporaneous construction.' [Citation]" (Rincon Del Diablo Municipal Water Dist. v. San Diego County Water Authority (2004) 121 Cal.App.4th 813, 818, 17 Cal. Rptr.3d 666.)
Consistent with the rules of construction, we look first to the language of *160 the statute.[2] The first paragraph of the statute sets forth the underlying duty of health care providers to give patients access to their medical records. As the court in National Football League Management Council v. Superior Court (1983) 138 Cal.App.3d 895, 903, 188 Cal.Rptr. 337, stated: "Evidence Code section 1158 states a clear public policy of permitting a patient, before filing any action, to inspect and to copy any medical records concerning the patient. The legislative purpose behind the enactment is not stated, but its apparent goal is to permit a patient to evaluate the treatment he or she received before determining whether to bring an action against the medical provider. Section 1158 also enables the patient to seek freely advice concerning the adequacy of medical care and to create a medical history file for the patient's information or subsequent use. It operates to prevent a medical provider from maintaining secret notes which can be obtained by the patient only through litigation and potentially protracted discovery proceedings." (Fn.omitted.)
*161 As Bactes notes, the first paragraph of the statute does not expressly impose the document production duty on contractors or agents of health care providers and employers. On the other hand, as Thornburg notes, the second paragraph of the statute, which prevents copying of records where a patient's attorney has employed a copy service, expressly extends that prohibition to all the entities set forth in the first paragraph and "agents thereof." If the records are not produced, the third paragraph subjects any person or entity having "custody or control of the records" to liability for the expenses, including attorney fees, incurred in obtaining production. The fourth paragraph requires that patients pay "any person or entity enumerated above" the reasonable costs of copying and delivering the records. The cost limitations of the statute are then set forth in the fifth paragraph, which defines "reasonable costs" as including "ten cents ($0.10) per page for standard reproduction of documents of a size 8-1/2 by 14 inches or less."
For its part, Bactes argues that the words "entity enumerated above" in the fourth paragraph of the statute only refer to the entities set forth in the first paragraph because those are the only entities required to produce documents. Thus Bactes argues that contractors like itself are not subject to the definition of "reasonable costs" set forth in the fifth paragraph. For her part, Thornburg argues that the reference to "entity enumerated above" in the fourth paragraph literally includes all entities previously mentioned in the statute, including the agents referred to in the second paragraph. Thornburg asserts that Bactes is an agent of the hospital and therefore, under her interpretation, directly subject to the limitations set forth in the fifth paragraph.
We are unwilling to entirely embrace either Bactes's or Thornburg's interpretation of the statute. Bactes's interpretation, which would limit the duty imposed by the statute to the persons and entities named in the first paragraph, would undermine the obvious purpose of the cost limitations set forth in the fifth paragraph. Under Bactes's interpretation, a patient seeking records covered by section 1158 must pay Bactes its copying charges, which exceed the statutory limit, because Bactes is not one of the health care providers enumerated in the first paragraph. The patient must then either simply forego the cost limitations set forth in the statute or attempt to recoup from the health care provider expressly covered by the statute the difference between the amount Bactes charged and the statutory maximum. It is difficult to believe that having expressly placed the cost limitations in the statute the Legislature intended that they could either be avoided by having another entity respond to the section 1158 request or only enforced by way of the circuitous and burdensome remedy of recovering the cost differential from an expressly covered health care provider.
In sum we are not willing to so strictly limit liability under statute that the entities denominated in the first paragraph of the statute can easily avoid the requirements of the statute. If the Legislature really intended that health care providers could avoid the cost limitations set forth in the fifth paragraph of the statute by simply retaining a copy service, we doubt the Legislature would have taken the trouble to impose those limitations in the first place.
If Bactes's interpretation is subject to attack because it unduly narrows the entities subject to the cost limitations of the statute, Thornburg's interpretation casts too broad a net. The fact that the second paragraph of the statute prevents both medical providers and their agents from interfering with a copy service retained *162 by a patient's attorney does not suggest the Legislature intended that all of a medical provider's agents  including every employee or officer of the medical provider  would be directly responsible for meeting all the obligations of the statute. Indeed, we note that in general agents and employees are not liable for statutory duties imposed on their principles. (See Gruenberg v. Aetna Ins. Co. (1973) 9 Cal.3d 566, 576, 108 Cal.Rptr. 480, 510 P.2d 1032; Doctors' Co. v. Superior Court (1989) 49 Cal.3d 39, 44-45, 260 Cal.Rptr. 183, 775 P.2d 508; Applied Equipment Corp. v. Litton Saudi Arabia Ltd. (1994) 7 Cal.4th 503, 511-512, 28 Cal.Rptr.2d 475, 869 P.2d 454; Wise v. Southern Pacific Co. (1963) 223 Cal.App.2d 50, 72, 35 Cal.Rptr. 652.) When agents and employees are acting in their official capacities on behalf of their principals and not as individuals for their own advantage, their acts are generally privileged and do not give rise to liability in tort or under statutes which impose duties on their principals. (See Doctors' Co. v. Superior Court, supra, 49 Cal.3d at p. 45, 260 Cal.Rptr. 183, 775 P.2d 508; Applied Equipment Corp. v. Litton Saudi Arabia Ltd., supra, 7 Cal.4th at p. 512, fn. 4, 28 Cal.Rptr.2d 475, 869 P.2d 454.) Just as it is difficult to accept the notion that the Legislature intended to impose cost limitations that are so easy to avoid as to be meaningless, it is also difficult to believe that in the case of copying patient records the public interest is so vital that the Legislature intended to strip the employees of medical providers of the immunity from liability they otherwise enjoy.
However, the cases also recognize that an agent loses his or her protection when he is acting for his own benefit or advantage rather than solely on behalf of and at the direction of his or her principal. (See Doctors' Co. v. Superior Court, supra, 49 Cal.3d at pp. 46-47, 260 Cal.Rptr. 183, 775 P.2d 508; Wise v. Southern Pacific Co., supra, 223 Cal.App.2d at p. 72, 35 Cal.Rptr. 652; Black v. Sullivan (1975) 48 Cal.App.3d 557, 567-568, 122 Cal.Rptr. 119.) This exception has been applied most notably in situations where a third party, not subject to a statutory obligation, assisted a principal in violating the statute and did so not only to advance the principal's interest but because the third party had an independent financial interest in the transaction. (See Black v. Sullivan, supra, 48 Cal.App.3d at pp. 567-568, 122 Cal.Rptr. 119.) In Black v. Sullivan a law firm client held a note and deed of trust on a parcel of rural property. The client assigned his beneficial interest in the deed of trust as security for legal fees. The debtor on the note asked the client for a beneficiary statement so he could sell the property. The law firm's client, in violation of Civil Code section 1943 and allegedly with the assistance of the law firm, failed to provide the beneficiary statement in a timely manner and the debtor was unable to successfully sell the property. The court held the law firm had no obligation under Civil Code section 1943 to provide the beneficiary statement because it only held the note and deed as security. However, as the court in Doctors' Co. v. Superior Court, supra, 49 Cal.3d at page 47, 260 Cal.Rptr. 183, 775 P.2d 508, noted in discussing Black v. Sullivan: "The attorneys therefore had a personal interest, apart from that of their clients, in regaining the property (which had increased in value) by preventing its sale by the plaintiffs." Thus the lack of liability under the statute "`[did] not prevent their liability for a failure to comply with that section under a theory that they aided, cooperated and assisted in [the beneficiaries'] noncompliance or conspired to interfere with the escrow contract by preventing the closing of the escrow. [Citations.]'" (Ibid.)
Given section 1158's manifest purpose of limiting the cost of copying, we cannot construe the scope of the statute so narrowly *163 and mechanically that the limitation is easily and effectively avoided by health care providers who attempt to contract away their responsibilities under the statute. On the other hand, we cannot by way of judicial construction radically expand the scope and impact of the statute. Thus, as we interpret the admittedly ambiguous provisions of section 1158, the agents or contractors of entities expressly covered in the first paragraph of the statute may be held liable under the statute but only if (1) they have assumed the duty of responding to section 1158 requests and (2) they are acting for their own advantage and benefit as well the interests of entities expressly covered by the statute.[3]

IV
Given the terms of the agreement between Bactes and the hospital, Thornburg may allege Bactes is liable under the statute.
Under the agreement, whenever a request for records is made the hospital retrieves the records and makes them available exclusively to Bactes, who is then responsible for making copies, delivering them to the requesting party and billing the requesting party. Given these terms, Thornburg can easily allege Bactes has assumed the duty to meet the hospital's obligations under section 1158.[4]
Thornburg can also readily allege that in responding to her request Bactes was acting for its own advantage and in its own interest. Under the agreement, the hospital is required to turn over to Bactes any fees it has received for copying. In addition, Bactes has agreed to hold the hospital harmless for any liability Bactes's responses engender. Most importantly, Bactes is not required under the agreement to limit what it charges or in any way to account to the hospital for the fees it recovers. Indeed, Bactes contends that under the contract it had such independence and control over its work that as a matter of law it is not an agent of the hospital.[5]
Because on this record Thornburg can allege Bactes assumed the hospital's duties under the statute and further that in meeting that obligation Bactes pursued its own financial interests, the demurrer should not have been sustained without leave to amend.

V
The conclusion we have reached ensures that patients such as Thornburg will have a practical means of enforcing section 1158 which does not radically expand the scope of the statute. Our conclusion is also consistent with notions of fairness and equity. At the time Bactes entered into its agreement with the hospital, Bactes had constructive, if not actual, notice of the terms of section 1158. Thus Bactes was aware of the hospital's obligations under the statute and the cost limitations of the fifth paragraph. Having entered into an agreement with the hospital under which the hospital agreed it *164 would not provide requested records but would instead permit Bactes to do so, it is entirely fair that the hospital's statutory obligations be imposed on Bactes. In this regard we note the provisions of Civil Code section 1589: "A voluntary acceptance of the benefit of a transaction is equivalent to a consent to all the obligations arising from it, so far as the facts are known, or ought to be known, to the person accepting." (See also 1 Witkin, Summary of Cal. Law (10th ed.) Contracts, § 740, pp. 824-827.)
Let a writ issue directing the trial court to vacate its order sustaining Bactes's demurrer without leave to amend and enter a new order consistent with the views we have expressed. Costs in the writ proceeding are awarded to Thornburg.
WE CONCUR: McCONNELL, P.J., and HALLER, J.
NOTES
[1]  All further statutory references are to the Evidence Code unless otherwise indicated.
[2]  Section 1158 provides as follows: "Whenever, prior to the filing of any action or the appearance of a defendant in an action, an attorney at law or his or her representative presents a written authorization therefor signed by an adult patient, by the guardian or conservator of his or her person or estate, or, in the case of a minor, by a parent or guardian of the minor, or by the personal representative or an heir of a deceased patient, or a copy thereof, a physician and surgeon, dentist, registered nurse, dispensing optician, registered physical therapist, podiatrist, licensed psychologist, osteopathic physician and surgeon, chiropractor, clinical laboratory bioanalyst, clinical laboratory technologist, or pharmacist or pharmacy, duly licensed as such under the laws of the state, or a licensed hospital, shall make all of the patient's records under his, hers or its custody or control available for inspection and copying by the attorney at law or his, or her, representative, promptly upon the presentation of the written authorization.

"No copying may be performed by any medical provider or employer enumerated above, or by an agent thereof, when the requesting attorney has employed a professional photocopier or anyone identified in Section 22451 of the Business and Professions Code as his or her representative to obtain or review the records on his or her behalf. The presentation of the authorization by the agent on behalf of the attorney shall be sufficient proof that the agent is the attorney's representative.
"Failure to make the records available, during business hours, within five days after the presentation of the written authorization, may subject the person or entity having custody or control of the records to liability for all reasonable expenses, including attorney's fees, incurred in any proceeding to enforce this section.
"All reasonable costs incurred by any person or entity enumerated above in making patient records available pursuant to this section may be charged against the person whose written authorization required the availability of the records.
"`Reasonable cost,' as used in this section, shall include, but not be limited to, the following specific costs: ten cents ($0.10) per page for standard reproduction of documents of a size 8 1/2 by 14 inches or less; twenty cents ($0.20) per page for copying of documents from microfilm; actual costs for the reproduction of oversize documents or the reproduction of documents requiring special processing which are made in response to an authorization; reasonable clerical costs incurred in locating and making the records available to be billed at the maximum rate of sixteen dollars ($16) per hour per person, computed on the basis of four dollars ($4) per quarter hour or fraction thereof; actual postage charges; and actual costs, if any, charged to the witness by a third person for the retrieval and return of records held by that third person.
"Where the records are delivered to the attorney or the attorney's representative for inspection or photocopying at the record custodian's place of business, the only fee for complying with the authorization shall not exceed fifteen dollars ($15), plus actual costs, if any, charged to the record custodian by a third person for retrieval and return of records held offsite by the third person."
[3]  We note that here the request for records was made directly to the hospital by the patient. We do not consider the application of section 1158 where the request for records is made directly to a copy service by an attorney.
[4]  We recognize that Bactes's obligations under the agreement are broader than responding to section 1158 requests. As we interpret the agreement, Bactes also responds to records requests from insurers, employers, other medical providers and governmental agencies.
[5]  As we have interpreted section 1158, whether Bactes is an agent of the hospital such that under traditional agency principals the hospital is liable for Bactes's conduct is not material. The critical question is whether, as an agent or independent contractor, Bactes assumed the duty of responding to section 1158 requests.
