Except as provided in RCW
7.115.020, any person may be compelled to attend as a witness before any court of record, judge, commissioner, or referee, in any civil action or proceeding in this state. No such person shall be compelled to attend as a witness in any civil action or proceeding unless the fees are paid or tendered to such person which are allowed by law for one day's attendance as a witness and for traveling to and returning from the place where he or she is required to attend, together with any allowance for meals and lodging theretofore fixed as specified herein: PROVIDED, That such fees be demanded by any witness residing within the same county where such court of record, judge, commissioner, or referee is located, or within twenty miles of the place where such court is located, at the time of service of the subpoena: PROVIDED FURTHER, That a party desiring the attendance of a witness residing outside of the county in which such action or proceeding is pending, or more than twenty miles of the place where such court is located, shall apply ex parte to such court, or to the judge, commissioner, referee, or clerk thereof, who, if such application be granted and a subpoena issued, shall fix without notice an allowance for meals and lodging, if any to be allowed, together with necessary travel expenses, and the amounts so fixed shall be endorsed upon the subpoena and tendered to such witness at the time of the service of the subpoena: PROVIDED FURTHER, That the court shall fix and allow at or after trial such additional amounts for meals, lodging, and travel as it may deem reasonable for the attendance of such witness.