
907 N.E.2d 935 (2009)
The PEOPLE of the State of Illinois, Plaintiff-Appellee,
v.
Joshua G. EVANS, Defendant-Appellant.
No. 4-08-0334.
Appellate Court of Illinois, Fourth District.
May 8, 2009.
*936 Justice KNECHT delivered the opinion of the court:
In October 2007, defendant, Joshua G. Evans, as part of a fully negotiated plea agreement, pleaded guilty to aggravated fleeing or attempting to elude a peace officer 625 ILCS 5/11-204.1(a)(1) (West 2006)). The trial court sentenced defendant to 4 1/2 years' imprisonment, with credit for 51 days time served. In November 2007, defendant filed a motion for correction of time credit, which the trial court denied.
Defendant appeals, arguing (1) he is entitled to an additional 178 days' sentence credit and the corresponding $5-per-day mandatory credit for time served and (2) the trial court erred by ordering him to pay a $200 public-defender fee without considering his ability to pay for such services. We affirm.

I. BACKGROUND
On March 19, 2007, the State charged defendant by information with aggravated fleeing or attempting to elude a peace officer. According to Pike County deputy sheriff Sam Ferguson's testimony, on March 16, 2007, he observed defendant sitting in a car in a parking lot known to be a drug venue. Ferguson approached and asked defendant for identification. Defendant produced a Missouri driver's license and told Ferguson he was waiting for a friend. As Ferguson took defendant's license and began to walk back to his squad car, defendant began to pull away in his vehicle. Ferguson got into his squad car and chased defendant. The chase ended in Hannibal, Missouri, where local police arrested and jailed defendant on the Illinois charge of aggravated fleeing or attempting to elude a peace officer.
On October 31, 2007, the trial court agreed to execute the parties' negotiated plea agreement. The plea agreement provided for agreed sentence credit from September 10, 2007, through October 30, 2007.
On October 31, 2007, the trial court sentenced defendant as stated.
In November 2007, defendant filed a pro se motion for correction of time credit, alleging he should be credited from the date the warrant was served on March 20, 2007, to the date of sentencing on October 31, 2007, because he had been incarcerated in Missouri since the commission of this offense and only due to this offense.
In April 2008, the trial court denied defendant's motion for correction of time credit, finding it would be unfair to change the amount of sentence credit because it was a negotiated term of the plea agreement.
This appeal followed.

II. ANALYSIS
On appeal, defendant first argues the trial court erred in denying his motion for correction of time credit. Specifically, defendant contends he is entitled to 229 days' *937 sentence credit from his March 16, 2007, arrest through his October 31, 2007, sentencing. Defendant argues he was incarcerated in Missouri solely on the offense in this case and as a result, contends his presentence credit is incorrect.
The State argues because defendant's plea was negotiated, defendant should not be allowed to challenge the plea without first filing a motion to withdraw his guilty plea. See 210 Ill.2d R. 604(d) ("[n]o appeal shall be taken upon a negotiated plea of guilty challenging the sentence as excessive unless the defendant, within 30 days of the imposition of sentence, files a motion to withdraw the plea of guilty and vacate the judgment").
Defendant responds he did not need to file a motion to withdraw his guilty plea because he is not attacking the sentence itself since he is not arguing the term of years should be different. Instead, defendant maintains the sentence credit negotiated was wrong, cannot be waived, and must be corrected.

A. Standard of Review
It is statutorily mandated that a trial court give credit to a defendant for his presentence incarceration. 730 ILCS 5/5-8-7(b) (West 2006); People v. Beachem, 229 Ill.2d 237, 244, 321 Ill.Dec. 793, 890 N.E.2d 515, 519 (2008). We review the scope and application of a statute de novo. People v. Caballero, 228 Ill.2d 79, 82, 319 Ill.Dec. 364, 885 N.E.2d 1044, 1046 (2008).

B. Sentence Credit
The Unified Code of Corrections provides criminal defendants "shall be given credit on the determinate sentence * * * for time spent in custody as a result of the offense for which the sentence was imposed." 730 ILCS 5/5-8-7(b) (West 2006). "A defendant confined in a foreign state by reason of Illinois process is entitled to sentence credit for time confined in the foreign state." People v. Thomas, 313 Ill.App.3d 998, 1009-10, 246 Ill.Dec. 593, 730 N.E.2d 618, 628 (2000), overruled on other grounds by Crawford v. Washington, 541 U.S. 36, 64, 124 S.Ct. 1354, 1371, 158 L.Ed.2d 177, 200 (2004). However, a defendant is not entitled to credit for time spent in custody while incarcerated in another state as a result of a crime committed there. People v. Clinard, 242 Ill. App.3d 414, 417, 182 Ill.Dec. 737, 610 N.E.2d 161, 163 (1993). A defendant may request sentencing credit at any time unless he agreed to forego it as part of a plea or other sentencing agreement. People v. Williams, 384 Ill.App.3d 415, 416-17, 322 Ill.Dec. 882, 892 N.E.2d 129, 130-31 (2008).
At the April 2008 hearing on defendant's motion for correction of time credit, the trial court found the following:
"The court has considered the arguments of the defendant and the [State]. I have reviewed the transcript of the sentencing proceedings. The court is of the opinion that parties can negotiate the matter or amount of credit. In this instance * * * there was some question [whether defendant] * * * would be eligible for credit in Missouri or not. Apparently that was known to all parties, including [defendant]. Apparently that was a factor that [the State] gave or considered in reducing [its] offer from [5] to [4 1/2] years, and [defendant] was aware of the dispute involving the credit for time served. I believe the case was continued on at least one occasion because of that, so I think all parties were aware of the terms of the plea agreement; and one of the specific terms was credit would be from September 10th up until the day of sentencing, and that was a specific condition of the agreement. It was negotiated by and between the parties, and therefore, it would be unfair to the State to change the credit now since it was a negotiated term."
*938 In Williams, 384 Ill.App.3d at 417, 322 Ill.Dec. 882, 892 N.E.2d at 130-31, this court found where a defendant negotiates a favorable sentence as a part of a negotiated plea arrangement, he may not then repudiate it. There, the defendant was convicted of unlawful possession with intent to deliver cannabis. At the sentencing hearing, the State presented the trial court with an agreed sentence of 24 months' probation and 60 days in jail "`with no days['] pre[ ]sentence credit.'" The court accepted the parties' agreement and sentenced the defendant accordingly. Williams, 384 Ill.App.3d at 416, 322 Ill. Dec. 882, 892 N.E.2d at 130. On appeal, the defendant argued he should have received credit for at least two days of time served prior to sentencing and a $5-per-day credit against his fines. This court held the defendant had received the benefit of his bargain. The defendant received "`a very favorable disposition'" in the form of very little jail time and a delayed sentencing judgment. Williams, 384 Ill. App.3d at 417, 322 Ill.Dec. 882, 892 N.E.2d at 131.
In this case, as part of defendant's fully negotiated plea agreement, he agreed to the amount of sentence credit he would receive. Defendant's October 31, 2007, plea agreement set forth the following:
"[PROSECUTOR:] Your Honor, [defendant] would plead guilty to the offense as charged. He's eligible for extended term. He would be sentenced to [4 1/2] years in the Illinois Department of Corrections [(IDOC)] to run concurrent with his Missouri charge. His credit would be from September 10[, 2007,] up through [October 30, 2007]. There would be a $1,000 fine plus costs. There would be a credit up through today, $100 DARE assessment, [and] $200 public defender reimbursement. [Defendant] indicated that he had his DNA taken in Missouri. [It still] has to be taken here, I believe. I put in the order that [IDOC] will obtain his assessment. That's the extent of the plea.
THE COURT: Is that the agreement, Mr. Evans?
THE DEFENDANT: Yes, Your Honor."
Here, defendant bargained for his sentence and according to the record, acquiesced in the sentence imposed. The record shows the parties negotiated (1) the total sentence to be imposed, (2) whether the sentence imposed would be served consecutive or concurrent to defendant's Missouri sentence, and (3) the amount of presentence credit defendant would receive.
Defendant was eligible for a maximum extended-term sentence of six years in prison. See 730 ILCS 5/5-8-2(a)(6), (b) (West 2006). Instead, defendant negotiated a 4 1/2-year prison term. In addition, the parties agreed defendant would serve his sentence concurrent to a sentence he was already serving in Missouri. More important, defendant negotiated sentence credit from September 10, 2007, through October 30, 2007, for a total of 51 days. At the hearing on defendant's motion, the State argued the following:
"[Sentence credit] was part of the negotiation, a large part of the negotiation as to why we went to [4 1/2] years based on his criminal history. I thought more time was appropriate, but to negate any credit and try and figure out what credit he was entitled to and what he might not have been [entitled to] we knocked [time] off our sentence [offer]; and he agreed to that."
Allowing defendant to agree to a particular sentence, only to allow a reduction of the agreed-upon sentence would be unfair. Williams, 384 Ill.App.3d at 417, 322 Ill. Dec. 882, 892 N.E.2d at 131 ("[a] defendant has the right to first request sentencing credit at any time unless, as here, he *939 agreed to forego it as part of a plea or other sentencing agreement").
Following our reasoning in Williams, we find it would be unfair for defendant to benefit from a favorable agreement with the State only to challenge its terms on appeal. As a result, we find no reason to modify the terms of defendant's negotiated plea agreement. Accordingly, we affirm the trial court's dismissal of defendant's motion for correction of time credit.

C. Public-Defender Fee
Defendant next contends the trial court erred by ordering him to pay a $200 public-defender fee without holding a hearing to determine his ability to pay.
Section 113-3.1 of the Code of Criminal Procedure of 1963 (Procedure Code) provides, in pertinent part, as follows:
"Whenever * * * the court appoints counsel to represent a defendant, the court may order the defendant to pay to the Clerk of the Circuit Court a reasonable sum to reimburse either the county or the State for such representation. In a hearing to determine the amount of the payment, the court shall consider the affidavit prepared by the defendant under [s]ection 113-3 of this Code and any other information pertaining to the defendant's financial circumstances which may be submitted by the parties." 725 ILCS 5/113-3.1 (a) (West 2006).
In this case, however, the $200 public-defender fee was part of the fully negotiated plea:
"[PROSECUTOR:] Your Honor, [defendant] would plead guilty to the offense as charged. * * * There would be a $1,000 fine plus costs[-,] * * * $100 DARE assessment, [and] $200 public defender reimbursement.
THE COURT: Is that the agreement, Mr. Evans?
THE DEFENDANT: Yes, Your Honor."
Here, the public-defender fee was a negotiated term in defendant's fully negotiated plea agreement. Defendant agreed to the $200 fee as part of his negotiated plea. The trial court accepted the plea agreement and ordered defendant pay the agreed-upon $200 public-defender fee. Defendant cannot ask the court to proceed in a particular manner or acquiesce in same, and then on appeal claim the trial court committed error in doing do. People v. Heard, 396 Ill. 215, 219-20, 71 N.E.2d 321, 323 (1947); see also People v. Harvey, 211 Ill.2d 368, 385, 286 Ill.Dec. 124, 813 N.E.2d 181, 192 (2004). Accordingly, we affirm the trial court's payment order.

III. CONCLUSION
For the reasons stated, we affirm the trial court's judgment. As part of our judgment, we grant the State its $50 statutory assessment against defendant as costs of this appeal.
Affirmed.
MYERSCOUGH and STEIGMANN, JJ., concur.
